beads/scripts/generate-llms-full.sh
Isaac Karrer 7f0a165f4e
feat(docs): version Docusaurus site and align llms-full with snapshots (#3033)
* feat(docs): version Docusaurus site and align llms-full with snapshots

Add docs version 1.0.0, version dropdown, lastVersion defaulting to stable,
merged markdown config, and RELEASING steps for future doc snapshots.
generate-llms-full.sh reads the latest entry in versions.json.

README links the published documentation site.

Closes #2644

Made-with: Cursor

* fix(docs): update org URLs to gastownhall and refresh 1.0.0 snapshot

- Update default orgName in docusaurus.config.ts from steveyegge to
  gastownhall to match the repo's new home
- Update hardcoded steveyegge URLs in generate-llms-full.sh
- Refresh versioned_docs 1.0.0 snapshot to include quickstart changes
  from #3032 which merged after the original snapshot was taken
- Regenerate llms-full.txt with corrected URLs and updated content

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: matt wilkie <maphew@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 21:12:54 -07:00

97 lines
2.8 KiB
Bash
Executable file

#!/bin/bash
# Generate llms-full.txt from website documentation
# This concatenates all docs into a single file for LLM consumption.
# Uses the latest *released* docs snapshot (versioned_docs) when present so
# llms-full matches the default site version, not unreleased "Next".
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
OUTPUT_FILE="$PROJECT_ROOT/website/static/llms-full.txt"
resolve_docs_dir() {
local vfile="$PROJECT_ROOT/website/versions.json"
if [ ! -f "$vfile" ]; then
echo "$PROJECT_ROOT/website/docs"
return
fi
# versions.json lists newest first; first semver-like string wins
local ver
ver=$(grep -oE '"[0-9][^"]*"' "$vfile" | head -1 | tr -d '"')
if [ -n "$ver" ] && [ -d "$PROJECT_ROOT/website/versioned_docs/version-$ver" ]; then
echo "$PROJECT_ROOT/website/versioned_docs/version-$ver"
else
echo "$PROJECT_ROOT/website/docs"
fi
}
DOCS_DIR="$(resolve_docs_dir)"
DOC_VERSION_LABEL="development"
if [[ "$DOCS_DIR" == *"/versioned_docs/version-"* ]]; then
DOC_VERSION_LABEL="${DOCS_DIR##*version-}"
fi
# 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 (version: ${DOC_VERSION_LABEL}).
> For the web version, visit: https://gastownhall.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/gastownhall/beads
EOF
echo "Generated: $OUTPUT_FILE"
echo "Source docs: $DOCS_DIR"
echo "Size: $(wc -c < "$OUTPUT_FILE" | tr -d ' ') bytes"
echo "Lines: $(wc -l < "$OUTPUT_FILE" | tr -d ' ')"