Initial Auto-Build plugin structure

This commit is contained in:
2025-12-21 23:29:55 +02:00
commit 7e4912add2
30 changed files with 3274 additions and 0 deletions

9
plugin/hooks/hooks.json Normal file
View File

@@ -0,0 +1,9 @@
{
"hooks": [
{
"name": "post-install",
"script": "./hooks/post-install.sh",
"description": "Initialize CLAUDE.md and Auto-Build rules in project"
}
]
}

View File

@@ -0,0 +1,86 @@
#!/bin/bash
# Post-install hook - runs after plugin installation
set -e
PROJECT_ROOT="$(pwd)"
PLUGIN_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
echo "========================================"
echo " Auto-Build Post-Install"
echo "========================================"
echo ""
echo "Project: $PROJECT_ROOT"
echo ""
# 1. Create .claude/rules/ if missing
mkdir -p "$PROJECT_ROOT/.claude/rules"
# 2. Copy auto-build-patterns.md to project
echo "Installing Auto-Build patterns..."
cp "$PLUGIN_DIR/rules/auto-build-patterns.md" "$PROJECT_ROOT/.claude/rules/"
# 3. Create empty auto-build-memory.md (will be populated by /ab:memory-save)
echo "# Auto-Build Learned Patterns
Last updated: Never
(This file is automatically updated by /ab:memory-save)" > "$PROJECT_ROOT/.claude/rules/auto-build-memory.md"
# 4. Create .auto-build-data/ structure
echo "Creating .auto-build-data/ structure..."
mkdir -p "$PROJECT_ROOT/.auto-build-data"/{specs,worktrees,memory/sessions,cache/qa-iterations}
# Initialize memory files
echo '{"patterns": [], "updated": null}' > "$PROJECT_ROOT/.auto-build-data/memory/patterns.json"
echo '{"gotchas": [], "updated": null}' > "$PROJECT_ROOT/.auto-build-data/memory/gotchas.json"
echo '{"worktrees": []}' > "$PROJECT_ROOT/.auto-build-data/worktrees/worktree-registry.json"
# 5. Add .auto-build-data/ to .gitignore if not present
if [ -f "$PROJECT_ROOT/.gitignore" ]; then
if ! grep -q "^\.auto-build-data/" "$PROJECT_ROOT/.gitignore" 2>/dev/null; then
echo "" >> "$PROJECT_ROOT/.gitignore"
echo "# Auto-Build runtime data (local only)" >> "$PROJECT_ROOT/.gitignore"
echo ".auto-build-data/" >> "$PROJECT_ROOT/.gitignore"
echo "Added .auto-build-data/ to .gitignore"
fi
else
echo "# Auto-Build runtime data (local only)" > "$PROJECT_ROOT/.gitignore"
echo ".auto-build-data/" >> "$PROJECT_ROOT/.gitignore"
echo "Created .gitignore with .auto-build-data/ entry"
fi
# 6. Initialize or update CLAUDE.md
if [ ! -f "$PROJECT_ROOT/CLAUDE.md" ]; then
echo "Generating CLAUDE.md from template..."
cp "$PLUGIN_DIR/templates/CLAUDE.md.template" "$PROJECT_ROOT/CLAUDE.md"
echo "✅ Created CLAUDE.md"
else
# Add Auto-Build imports if not present
if ! grep -q "auto-build-patterns.md" "$PROJECT_ROOT/CLAUDE.md"; then
echo "" >> "$PROJECT_ROOT/CLAUDE.md"
echo "# Auto-Build Integration" >> "$PROJECT_ROOT/CLAUDE.md"
echo "@./.claude/rules/auto-build-patterns.md" >> "$PROJECT_ROOT/CLAUDE.md"
echo "@./.claude/rules/auto-build-memory.md" >> "$PROJECT_ROOT/CLAUDE.md"
echo "✅ Updated CLAUDE.md with Auto-Build imports"
else
echo "⚠️ CLAUDE.md already has Auto-Build imports"
fi
fi
echo ""
echo "========================================"
echo " Installation Complete!"
echo "========================================"
echo ""
echo "What was installed:"
echo " ✅ .claude/rules/auto-build-patterns.md"
echo " ✅ .claude/rules/auto-build-memory.md"
echo " ✅ .auto-build-data/ structure"
echo " ✅ CLAUDE.md (created or updated)"
echo " ✅ .gitignore updated"
echo ""
echo "Quick Start:"
echo " 1. Restart Claude Code to load CLAUDE.md"
echo " 2. Run /ab:help for available commands"
echo " 3. Create your first spec: /ab:spec \"My Feature\""
echo ""