diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 2b5e2fb..99791c2 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -11,7 +11,7 @@ "name": "ab", "source": "./plugin", "description": "Spec-driven build orchestration with git worktree isolation and session memory", - "version": "1.0.2", + "version": "1.0.3", "keywords": ["build", "spec", "automation", "worktree", "qa"] } ] diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..d43f7af --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,30 @@ +# Changelog + +All notable changes to Auto-Build plugin. + +## [1.0.3] - 2024-12-22 + +### Fixed +- Worktree scripts now use `$(pwd)` for project root instead of calculating from script location +- Scripts work correctly when called via `${CLAUDE_PLUGIN_ROOT}/scripts/` + +## [1.0.2] - 2024-12-21 + +### Added +- CLAUDE.md file for development guidance + +## [1.0.1] - 2024-12-21 + +### Fixed +- hooks.json format corrected (use object instead of array) + +## [1.0.0] - 2024-12-20 + +### Added +- Initial release +- 8 commands: spec, build, worktree, qa-review, memory-save, memory-search, status, help +- 5 agents: spec-writer, planner, coder, qa-reviewer, qa-fixer +- Git worktree isolation support +- Bidirectional memory system (JSON + Markdown) +- CLAUDE.md integration with context-aware agents +- Post-install hook for automatic setup diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..51a0143 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,97 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +Auto-Build is a Claude Code plugin that provides spec-driven build orchestration with autonomous agents. It enables structured feature development through 5 specialized agents, git worktree isolation, and persistent cross-session memory. + +## Repository Structure + +This is a **plugin repository** with two levels: +- **Root level**: Marketplace configuration (`.claude-plugin/marketplace.json`) +- **`plugin/` directory**: The actual plugin that gets installed + +``` +auto-build-plugin/ +├── .claude-plugin/marketplace.json # Marketplace catalog +├── plugin/ # Plugin source (copied on install) +│ ├── .claude-plugin/plugin.json # Plugin manifest (prefix: "ab") +│ ├── commands/ # 8 slash commands (/ab:*) +│ ├── agents/ # 5 specialized agents +│ ├── hooks/hooks.json # Lifecycle hooks config +│ ├── hooks/post-install.sh # Runs after plugin install +│ ├── scripts/ # Bash scripts for worktree ops +│ ├── rules/ # Auto-build patterns (copied to .claude/rules/) +│ └── templates/ # Templates for CLAUDE.md, specs, plans +└── README.md # User-facing documentation +``` + +## Key Architecture Concepts + +### Plugin Installation Flow +1. User runs `/plugin install ab@roa2web-tools` +2. Plugin is copied to Claude Code cache at `${CLAUDE_PLUGIN_ROOT}` +3. `post-install.sh` hook executes and creates: + - `.auto-build-data/` directory structure + - `.claude/rules/auto-build-patterns.md` + - `.claude/rules/auto-build-memory.md` + - `CLAUDE.md` (if missing) + +### Script Path Resolution +Scripts in `plugin/scripts/` are called via `${CLAUDE_PLUGIN_ROOT}/scripts/` but operate on the **current working directory** (user's project). Scripts must use `$(pwd)` for project root, not relative paths from script location. + +### Memory System (Bidirectional) +- **JSON files** (`.auto-build-data/memory/*.json`): Searchable via `/ab:memory-search` +- **Markdown** (`.claude/rules/auto-build-memory.md`): Auto-loaded by Claude Code + +### Agent Context Awareness +`spec-writer` and `planner` agents read CLAUDE.md and auto-build-memory.md to respect project conventions. + +## Commands Reference + +| Command | Implementation | +|---------|---------------| +| `/ab:spec ` | `commands/spec.md` → launches `agents/spec-writer.md` | +| `/ab:build ` | `commands/build.md` → launches `agents/planner.md` then `agents/coder.md` | +| `/ab:qa-review` | `commands/qa-review.md` → loops `agents/qa-reviewer.md` + `agents/qa-fixer.md` | +| `/ab:worktree ` | `commands/worktree.md` → calls `scripts/worktree-*.sh` | +| `/ab:memory-save` | `commands/memory-save.md` → saves to JSON + syncs to markdown | +| `/ab:memory-search` | `commands/memory-search.md` → searches JSON files | +| `/ab:status` | `commands/status.md` | +| `/ab:help` | `commands/help.md` | + +## Development Guidelines + +### Modifying Scripts +When editing `plugin/scripts/*.sh`: +- Use `PROJECT_ROOT="$(pwd)"` - never calculate from `BASH_SOURCE` +- Scripts execute from plugin cache but operate on user's project +- Reference plugin files via relative paths from script location + +### Adding Commands +Create `.md` file in `plugin/commands/` with frontmatter: +```yaml +--- +description: Short description +argument-hint: [optional] +--- +``` + +### Adding Agents +Create `.md` file in `plugin/agents/` with frontmatter: +```yaml +--- +name: agent-name +description: What it does +model: sonnet|opus|haiku +color: blue|green|red +--- +``` + +### Version Updates +**IMPORTANT**: When making any changes to the plugin, bump the version in BOTH files so users can update: +- `.claude-plugin/marketplace.json` → `plugins[0].version` +- `plugin/.claude-plugin/plugin.json` → `version` + +Also update `CHANGELOG.md` with the changes. diff --git a/plugin/.claude-plugin/plugin.json b/plugin/.claude-plugin/plugin.json index 2093fa7..bd6cbac 100644 --- a/plugin/.claude-plugin/plugin.json +++ b/plugin/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "ab", "description": "Auto-Build: Spec-driven build orchestration with worktree isolation and session memory", - "version": "1.0.2", + "version": "1.0.3", "author": { "name": "ROA2WEB Team" } diff --git a/plugin/scripts/worktree-cleanup.sh b/plugin/scripts/worktree-cleanup.sh index b24d15b..d9db126 100644 --- a/plugin/scripts/worktree-cleanup.sh +++ b/plugin/scripts/worktree-cleanup.sh @@ -7,9 +7,8 @@ set -e FEATURE_NAME="$1" -# Get project root (parent of .auto-build) -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" +# Get project root from current working directory (where Claude Code is running) +PROJECT_ROOT="$(pwd)" PROJECT_NAME=$(basename "$PROJECT_ROOT") WORKTREES_DIR="$(dirname "$PROJECT_ROOT")/ab-worktrees" @@ -104,5 +103,5 @@ else echo "" echo "To cleanup a specific worktree:" - echo " bash .auto-build/scripts/worktree-cleanup.sh " + echo " /ab:worktree cleanup " fi diff --git a/plugin/scripts/worktree-create.sh b/plugin/scripts/worktree-create.sh index b76cd62..031a992 100644 --- a/plugin/scripts/worktree-create.sh +++ b/plugin/scripts/worktree-create.sh @@ -12,9 +12,9 @@ if [ -z "$FEATURE_NAME" ]; then exit 1 fi -# Get project root (parent of .auto-build) -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" +# Get project root from current working directory (where Claude Code is running) +# Note: This script is called from ${CLAUDE_PLUGIN_ROOT}/scripts/ but operates on the project +PROJECT_ROOT="$(pwd)" PROJECT_NAME=$(basename "$PROJECT_ROOT") # Define paths diff --git a/plugin/scripts/worktree-list.sh b/plugin/scripts/worktree-list.sh index c7d0c4a..d61a5ae 100644 --- a/plugin/scripts/worktree-list.sh +++ b/plugin/scripts/worktree-list.sh @@ -4,9 +4,8 @@ set -e -# Get project root (parent of .auto-build) -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" +# Get project root from current working directory (where Claude Code is running) +PROJECT_ROOT="$(pwd)" echo "========================================" echo " Git Worktrees" diff --git a/plugin/scripts/worktree-switch.sh b/plugin/scripts/worktree-switch.sh index 16bdb1b..b8f4981 100644 --- a/plugin/scripts/worktree-switch.sh +++ b/plugin/scripts/worktree-switch.sh @@ -6,9 +6,8 @@ set -e FEATURE_NAME="$1" -# Get project root (parent of .auto-build) -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" +# Get project root from current working directory (where Claude Code is running) +PROJECT_ROOT="$(pwd)" PROJECT_NAME=$(basename "$PROJECT_ROOT") WORKTREES_DIR="$(dirname "$PROJECT_ROOT")/ab-worktrees"