Files
auto-build/plugin/hooks/post-install.sh
Marius Mutu 940c6a9f58 feat: Move specs and memory to git for multi-developer collaboration (v1.0.6)
BREAKING CHANGE: Specs, plans, and memory moved from .auto-build-data/ (gitignored)
to .auto-build/ (git-tracked) to enable team collaboration.

Changes:
- Specs/plans now in .auto-build/specs/ (shared with team)
- Memory (patterns, gotchas) now in .auto-build/memory/ (shared with team)
- .auto-build-data/ now only contains local data (worktrees, cache)
- Added /ab:migrate command for existing projects
- Removed symlinks from worktree-create.sh (no longer needed)

Benefits:
- Any developer can continue a plan started by another
- Patterns and gotchas shared across team
- Works on Windows/Linux/Mac without symlinks
- Full version history in git

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 17:44:52 +02:00

103 lines
4.0 KiB
Bash

#!/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/ structure (COMMITTED TO GIT - shared with team)
echo "Creating .auto-build/ structure (shared with team)..."
mkdir -p "$PROJECT_ROOT/.auto-build"/{specs,memory/sessions}
# Initialize memory files if they don't exist
if [ ! -f "$PROJECT_ROOT/.auto-build/memory/patterns.json" ]; then
echo '{"patterns": [], "updated": null}' > "$PROJECT_ROOT/.auto-build/memory/patterns.json"
fi
if [ ! -f "$PROJECT_ROOT/.auto-build/memory/gotchas.json" ]; then
echo '{"gotchas": [], "updated": null}' > "$PROJECT_ROOT/.auto-build/memory/gotchas.json"
fi
# 5. Create .auto-build-data/ structure (GITIGNORED - local only)
echo "Creating .auto-build-data/ structure (local only)..."
mkdir -p "$PROJECT_ROOT/.auto-build-data"/{worktrees,cache/qa-iterations}
# Initialize worktree registry
if [ ! -f "$PROJECT_ROOT/.auto-build-data/worktrees/worktree-registry.json" ]; then
echo '{"worktrees": []}' > "$PROJECT_ROOT/.auto-build-data/worktrees/worktree-registry.json"
fi
# 6. 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 local data (worktrees, cache)" >> "$PROJECT_ROOT/.gitignore"
echo ".auto-build-data/" >> "$PROJECT_ROOT/.gitignore"
echo "Added .auto-build-data/ to .gitignore"
fi
else
echo "# Auto-Build local data (worktrees, cache)" > "$PROJECT_ROOT/.gitignore"
echo ".auto-build-data/" >> "$PROJECT_ROOT/.gitignore"
echo "Created .gitignore with .auto-build-data/ entry"
fi
# 7. 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/ (specs & memory - shared with team)"
echo " ✅ .auto-build-data/ (local worktrees & cache)"
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 ""
echo "Note: Don't forget to commit .auto-build/ to share specs with your team!"
echo ""