Initial Auto-Build plugin structure
This commit is contained in:
86
plugin/hooks/post-install.sh
Normal file
86
plugin/hooks/post-install.sh
Normal 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 ""
|
||||
Reference in New Issue
Block a user