Files
beads/scripts/generate-llms-full.sh
Steve Yegge 584608a14e feat: add llms.txt standard support for AI agent discoverability (#784)
Cherry-picked website/, scripts/generate-llms-full.sh, and deploy-docs.yml
from joyshmitz's PR. Fixed workflow to trigger on main branch instead of
docs/docusaurus-site.

Features:
- Docusaurus documentation site with llms.txt support
- Environment-variable driven config (defaults to steveyegge org)
- Automated llms-full.txt generation from docs
- GitHub Pages deployment workflow

Co-authored-by: joyshmitz <joyshmitz@users.noreply.github.com>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Executed-By: beads/crew/dave
Rig: beads
Role: crew
2025-12-30 18:27:50 -08:00

74 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
# Generate llms-full.txt from website documentation
# This concatenates all docs into a single file for LLM consumption
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
DOCS_DIR="$PROJECT_ROOT/website/docs"
OUTPUT_FILE="$PROJECT_ROOT/website/static/llms-full.txt"
# Header
cat > "$OUTPUT_FILE" << 'EOF'
# Beads Documentation (Complete)
> This file contains the complete beads documentation for LLM consumption.
> Generated automatically from the documentation source files.
> For the web version, visit: https://steveyegge.github.io/beads/
---
EOF
# Function to process a markdown file
process_file() {
local file="$1"
local relative_path="${file#$DOCS_DIR/}"
echo "<document path=\"docs/$relative_path\">" >> "$OUTPUT_FILE"
echo "" >> "$OUTPUT_FILE"
# Remove frontmatter and add content
sed '/^---$/,/^---$/d' "$file" >> "$OUTPUT_FILE"
echo "" >> "$OUTPUT_FILE"
echo "</document>" >> "$OUTPUT_FILE"
echo "" >> "$OUTPUT_FILE"
}
# Process files in order (intro first, then by category)
if [ -f "$DOCS_DIR/intro.md" ]; then
process_file "$DOCS_DIR/intro.md"
fi
# Process directories in logical order
for dir in getting-started core-concepts architecture cli-reference workflows multi-agent integrations recovery reference; do
if [ -d "$DOCS_DIR/$dir" ]; then
# Process index first if exists
if [ -f "$DOCS_DIR/$dir/index.md" ]; then
process_file "$DOCS_DIR/$dir/index.md"
fi
# Process other files
for file in "$DOCS_DIR/$dir"/*.md; do
if [ -f "$file" ] && [ "$(basename "$file")" != "index.md" ]; then
process_file "$file"
fi
done
fi
done
# Add footer
cat >> "$OUTPUT_FILE" << 'EOF'
---
# End of Documentation
For updates and contributions, visit: https://github.com/steveyegge/beads
EOF
echo "Generated: $OUTPUT_FILE"
echo "Size: $(wc -c < "$OUTPUT_FILE" | tr -d ' ') bytes"
echo "Lines: $(wc -l < "$OUTPUT_FILE" | tr -d ' ')"