Files
auto-build/plugin/commands/build.md
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

6.1 KiB

description, argument-hint
description argument-hint
Orchestrate feature implementation from specification <feature-name>

Build Feature from Specification

Orchestrate the complete implementation of a feature using its specification. This is the core command that coordinates planning, coding, and progress tracking.

Input

  • Feature name: $ARGUMENTS (required, must match existing spec)

Prerequisites

  • Spec must exist at .auto-build/specs/{feature-name}/spec.md
  • Status must be SPEC_COMPLETE or PLANNING_COMPLETE or IMPLEMENTING

Workflow

1. Load Specification

  • Read .auto-build/specs/{feature-name}/spec.md
  • Read .auto-build/specs/{feature-name}/status.json
  • Validate spec exists and is complete
  • If status is IMPLEMENTING, resume from current task

2. Offer Worktree (for new builds)

If status is SPEC_COMPLETE:

This feature may modify multiple files.
Create an isolated git worktree? (recommended for larger features)
[Yes] [No]

If yes:

  • Run: bash ${CLAUDE_PLUGIN_ROOT}/scripts/worktree-create.sh {feature-name}
  • Update status.json with worktree path
  • Display next steps:
════════════════════════════════════════════════════════════════
  WORKTREE CREATED
════════════════════════════════════════════════════════════════

✅ Worktree created at: ../ab-worktrees/{project}-{feature-name}/
✅ Branch: feature/ab-{feature-name}

⚠️  NEXT STEPS:

1. Open a NEW VSCode window in the worktree:

   code ../ab-worktrees/{project}-{feature-name}/

2. In the NEW window, continue the build:

   /ab:build {feature-name}

────────────────────────────────────────────────────────────────
Note: Specs and plans in .auto-build/ are already available in
the worktree (they're in git). No symlinks needed!
════════════════════════════════════════════════════════════════
  • STOP HERE - Do not proceed with implementation in the current directory
  • The user must switch to the worktree directory first

3. Planning Phase

If status is PLANNING_COMPLETE (plan already exists):

  • Skip directly to Implementation Loop (step 4)
  • This happens when resuming in a worktree after plan was created in main repo

If status is SPEC_COMPLETE:

  1. Load memory context (if exists):

    • Read .auto-build/memory/patterns.json
    • Read .auto-build/memory/gotchas.json
  2. Launch planner agent with:

    • The complete spec.md content
    • Relevant patterns from memory
    • Instruction to create ordered implementation tasks
  3. The planner creates .auto-build/specs/{feature-name}/plan.md:

    # Implementation Plan: {feature-name}
    
    ## Tasks
    
    ### Task 1: [Title]
    **Files**: file1.ts, file2.ts
    **Description**: What to do
    **Dependencies**: None
    
    ### Task 2: [Title]
    **Files**: file3.ts
    **Description**: What to do
    **Dependencies**: Task 1
    
    ...
    
  4. Update status to PLANNING_COMPLETE

4. Implementation Loop

For each task in plan.md:

  1. Update status to IMPLEMENTING, set currentTask

  2. Display task info:

    Task 3/7: Add API endpoint for user stats
    Files: src/api/users.ts, src/types/user.ts
    
  3. Launch coder agent with:

    • Current task details
    • Spec context
    • Relevant patterns from memory
    • Files to modify
  4. After coder completes:

    • Update status.json with task progress
    • Ask: "Continue to next task? [Yes] [No] [Skip]"
  5. Repeat until all tasks complete

5. Completion

When all tasks done:

  • Update status to IMPLEMENTATION_COMPLETE
  • Display summary:
    Build complete: {feature-name}
    
    Tasks completed: 7/7
    Files modified: 12
    
    Next steps:
    - Run QA review: /ab:qa-review
    - Or test manually and save learnings: /ab:memory-save
    

State Machine

SPEC_COMPLETE
     |
     v
PLANNING (planner agent running)
     |
     v
PLANNING_COMPLETE
     |
     v
IMPLEMENTING (coder agent loop)
     |
     +---> [user skips/aborts] ---> PAUSED
     |
     v
IMPLEMENTATION_COMPLETE
     |
     v
[/ab:qa-review] ---> QA_REVIEW ---> COMPLETE

Resume Logic

If status is already IMPLEMENTING:

  • Read currentTask from status.json
  • Ask: "Resume from task {n}/{total}? [Yes] [Restart] [Cancel]"
  • If yes: Continue from that task
  • If restart: Reset to task 1

Status JSON During Build

{
  "feature": "user-dashboard",
  "status": "IMPLEMENTING",
  "currentTask": 3,
  "totalTasks": 7,
  "worktree": "../ab-worktrees/project-user-dashboard/",
  "created": "2025-01-15T10:00:00Z",
  "updated": "2025-01-15T14:30:00Z",
  "history": [
    {"status": "SPEC_COMPLETE", "at": "..."},
    {"status": "PLANNING_COMPLETE", "at": "..."},
    {"status": "IMPLEMENTING", "at": "...", "task": 1},
    {"status": "IMPLEMENTING", "at": "...", "task": 2},
    {"status": "IMPLEMENTING", "at": "...", "task": 3}
  ]
}

Error Handling

  • If coder fails on a task: Mark task as failed, ask user to continue or fix manually
  • If worktree creation fails: Continue without worktree, warn user
  • If spec not found: "Spec not found. Create with: /ab:spec {name}"

Note on Team Collaboration

Since specs and plans are stored in .auto-build/ (committed to git), any team member can:

  1. Clone the repo and see existing specs/plans
  2. Continue implementation from where another developer left off
  3. Share memory (patterns, gotchas) with the team

After making progress, commit changes to share with team:

git add .auto-build/
git commit -m "build: {feature-name} - completed task X/Y"