buildwright 0.0.11 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +89 -388
  2. package/bin/buildwright.js +1 -1
  3. package/package.json +2 -2
  4. package/src/commands/commands.js +3 -5
  5. package/src/commands/init.js +4 -4
  6. package/src/commands/update.js +8 -29
  7. package/templates/.buildwright/agents/README.md +6 -50
  8. package/templates/.buildwright/commands/bw-analyse.md +12 -13
  9. package/templates/.buildwright/commands/bw-plan.md +7 -4
  10. package/templates/.buildwright/commands/bw-ship.md +5 -2
  11. package/templates/.buildwright/commands/bw-verify.md +2 -2
  12. package/templates/.buildwright/commands/bw-work.md +149 -0
  13. package/templates/.buildwright/steering/philosophy.md +45 -0
  14. package/templates/BUILDWRIGHT.md +2 -5
  15. package/templates/CLAUDE.md +89 -126
  16. package/templates/Makefile +1 -1
  17. package/templates/scripts/release.sh +4 -4
  18. package/templates/scripts/sync-agents.sh +24 -27
  19. package/templates/scripts/validate-docs.sh +1 -4
  20. package/templates/.buildwright/agents/architect.md +0 -143
  21. package/templates/.buildwright/claws/README.md +0 -89
  22. package/templates/.buildwright/claws/TEMPLATE.md +0 -71
  23. package/templates/.buildwright/claws/backend.md +0 -114
  24. package/templates/.buildwright/claws/database.md +0 -120
  25. package/templates/.buildwright/claws/devops.md +0 -175
  26. package/templates/.buildwright/claws/frontend.md +0 -111
  27. package/templates/.buildwright/commands/bw-claw.md +0 -332
  28. package/templates/.buildwright/commands/bw-help.md +0 -88
  29. package/templates/.buildwright/commands/bw-new-feature.md +0 -539
  30. package/templates/.buildwright/commands/bw-quick.md +0 -336
  31. package/templates/.buildwright/steering/naming-conventions.md +0 -40
  32. package/templates/.buildwright/steering/product.md +0 -16
  33. package/templates/.buildwright/steering/quality-gates.md +0 -35
  34. package/templates/.buildwright/steering/tech.md +0 -27
  35. package/templates/.buildwright/tasks/TEMPLATE.md +0 -79
  36. package/templates/.github/workflows/quality-gates.yml +0 -135
  37. package/templates/docs/requirements/TEMPLATE.md +0 -33
@@ -1,160 +1,123 @@
1
1
  # Buildwright Development
2
2
 
3
3
  ## Mission
4
- Agent-first autonomous development. Humans approve specs; agents implement, test, and ship.
4
+
5
+ Agent-first disciplined development. Humans approve intent when needed; agents
6
+ understand, test, implement, document, verify, review, and ship.
5
7
 
6
8
  ## Steering Documents
7
9
 
8
- At the start of every session, read **all** `.md` files in `.buildwright/steering/`.
9
- Also read all `.md` files in `.buildwright/codebase/` if that directory exists — these
10
- are codebase analysis docs (stack, architecture, conventions, concerns) generated by
11
- /bw-analyse. Do not assume a fixed set of files; discover what is there.
10
+ At the start of every session, recursively discover and read all `.md` files
11
+ under `.buildwright/steering/`. Use:
12
+
13
+ ```bash
14
+ find .buildwright/steering -type f -name "*.md" | sort
15
+ ```
16
+
17
+ The default steering file is `philosophy.md`.
12
18
 
13
- ## Agents & Claws
14
- - Agent personas in `.buildwright/agents/` Architect, Staff Engineer, Security Engineer
15
- - Domain-specialist claws in `.buildwright/claws/` — Frontend, Backend, Database (+ TEMPLATE for custom)
16
- - Use `/bw-claw` for cross-domain features that need the Claw Architecture
17
- - For multi-claw work: use the best available model for Architect and Security review; lighter models suffice for Database and API claws.
19
+ Also recursively read all `.md` files under `.buildwright/codebase/` if that
20
+ directory exists. These are codebase analysis docs generated by `/bw-analyse`.
21
+
22
+ Do not assume a fixed set of project steering files. `tech.md` and `product.md`
23
+ are created only when Buildwright has real project-specific content.
18
24
 
19
25
  ## Project Structure
20
26
 
21
- `.buildwright/` is the canonical configuration directory (committed to git). Tool-specific directories are generated from it and gitignored:
27
+ `.buildwright/` is the canonical configuration directory committed to git.
28
+ Tool-specific directories are generated from it and gitignored:
22
29
 
23
30
  ```
24
- .buildwright/ ← Canonical source (committed)
25
- agents/ Architect, Staff Engineer, Security Engineer
26
- claws/ Frontend, Backend, Database, TEMPLATE
27
- codebase/ Generated by /bw-analyse (stack, architecture, conventions, concerns)
28
- commands/ bw-new-feature, bw-claw, bw-quick, bw-ship, bw-verify, bw-plan, bw-help
29
- steering/ ← product.md, tech.md, quality-gates.md, naming-conventions.md
30
- tasks/
31
-
32
- .claude/ Generated by `make sync` (gitignored, except settings.json)
33
- .opencode/ ← Generated by `make sync` (gitignored)
34
- .cursor/rules/ ← Generated by `make sync` (gitignored)
35
- AGENTS.md ← Generated by `make sync` (gitignored)
31
+ .buildwright/
32
+ agents/ # Staff Engineer, Security Engineer
33
+ codebase/ # Generated by /bw-analyse
34
+ commands/ # bw-work, bw-plan, bw-verify, bw-ship, bw-analyse
35
+ steering/ # philosophy.md plus lazy-created tech.md/product.md
36
+
37
+ .claude/ # Generated by make sync
38
+ .opencode/ # Generated by make sync
39
+ .cursor/rules/ # Generated by make sync
40
+ AGENTS.md # Generated by make sync
36
41
  ```
37
42
 
38
- After cloning or editing `.buildwright/`, run `make sync` to regenerate tool-specific configs.
43
+ After cloning or editing `.buildwright/`, run `make sync`.
39
44
 
40
- ## Operating Mode
45
+ ## Commands
41
46
 
42
- ### Default Behavior
43
- - AUTONOMOUS mode: Execute fully without asking for confirmation
44
- - Verify your own work through tests and checks
45
- - Commit when verification passes
46
- - Only stop if genuinely blocked (missing info, failing tests after retries)
47
- - **Autonomous failure handling**: When `BUILDWRIGHT_AUTO_APPROVE=true` (default) and any step fails after retries, commit completed work, push, create PR with failure details, and exit(1). In interactive mode (`BUILDWRIGHT_AUTO_APPROVE=false`), STOP and report blocker as before.
48
-
49
- ### Workflow Priority
50
- 1. **New features (single domain)**: /bw-new-feature → Research → Spec → Approval → Implement → Ship
51
- 2. **Cross-domain features**: /bw-claw → Architect decomposes → Claws execute per domain → Integrate → Ship
52
- 3. **Small tasks/bugs**: /bw-quick → Quick research → Implement → Verify → Commit
53
- 4. **Refactors**: /bw-new-feature (if scope unclear) or /bw-quick (if scope clear)
54
- 5. **Ship existing work**: /bw-ship → Verify → Security → Review → Push → PR
55
- 6. **Quick quality check**: /bw-verify → typecheck, lint, test, build
56
- 7. **Show commands**: /bw-help
57
- 8. **Analyse existing codebase**: /bw-analyse → reads codebase → writes structured docs to .buildwright/codebase/ → updates tech.md. Run first on any brownfield project.
58
- 9. **Research/planning without implementation**: /bw-plan → Understand question → Research (read-only) → Synthesize → Write deliverable. No code changes, no commits.
47
+ Use the smallest command that matches the intent:
48
+
49
+ 1. `/bw-plan` think/research only; no code changes, commits, or PRs.
50
+ 2. `/bw-work` implement bug fixes, refactors, and features.
51
+ 3. `/bw-verify` run typecheck, lint, test, and build gates.
52
+ 4. `/bw-ship` verify, security review, code review, push, and PR.
53
+ 5. `/bw-analyse` — analyse brownfield codebases and write `.buildwright/codebase/` docs.
59
54
 
60
55
  ## Command Discovery
61
56
 
62
- Run once per session. Cache the result — do not re-detect on every step.
57
+ Run once per session and cache the result.
58
+
59
+ 1. Read `.buildwright/steering/tech.md` if it exists. If it has real commands,
60
+ use them.
61
+ 2. Otherwise auto-detect from project files in priority order:
62
+ `package.json`, `Cargo.toml`, `go.mod`, `pyproject.toml`, `setup.py`,
63
+ `requirements.txt`, `Makefile`.
64
+ 3. Derive typecheck, lint, test, build, and dev commands. Mark unavailable
65
+ gates as `SKIP`.
66
+ 4. Write discovered commands to `.buildwright/steering/tech.md`.
67
+ 5. If still ambiguous, ask for the missing commands.
63
68
 
64
- 1. Read `.buildwright/steering/tech.md`. If "Project Commands" has real commands (not template placeholders) → use them. STOP.
65
- 2. Auto-detect from project files in priority order: `package.json` → Node.js (check lock files: `pnpm-lock.yaml`→pnpm, `yarn.lock`→yarn, `bun.lockb`→bun, else→npm) | `Cargo.toml` → cargo | `go.mod` → go | `pyproject.toml` → check `poetry.lock`→poetry, `uv.lock`→uv, else→pip/hatch | `setup.py` → pip | `requirements.txt` → pip | `Makefile` → read targets.
66
- 3. Derive four commands typecheck, lint, test, build. If a stack has no equivalent for an operation, mark it SKIP (not a failure). Python has no build step; that's fine.
67
- 4. Write discovered commands to tech.md so future runs use step 1.
68
- 5. If still ambiguous: in a greenfield context go to the Greenfield Path (see bw-new-feature). Otherwise ask: "What commands run your tests, linter, and build?"
69
+ ## Operating Mode
70
+
71
+ - Execute autonomously unless information is genuinely missing.
72
+ - Verify your own work through tests and checks.
73
+ - Commit only after verification passes.
74
+ - Stop only when genuinely blocked.
69
75
 
70
- ## Credentials & Environment Variables
76
+ `BUILDWRIGHT_AUTO_APPROVE=true` means autonomous mode. If a step fails after
77
+ retries, commit completed work, push, create a PR with failure details, and
78
+ exit non-zero. In interactive mode (`BUILDWRIGHT_AUTO_APPROVE=false`), stop and
79
+ report the blocker.
71
80
 
72
- | Variable | Default | Required | Purpose |
73
- |----------|---------|----------|---------|
74
- | `GITHUB_TOKEN` | — | Yes | Push branches and open PRs via `gh`. Needs `repo` scope. |
75
- | `BUILDWRIGHT_AUTO_APPROVE` | `true` | No | Autonomous mode — skip human approval, fail gracefully on errors |
76
- | `BUILDWRIGHT_AGENT_RETRIES` | `2` | No | Number of verify retries before giving up |
81
+ ## Verification Loop
77
82
 
78
- `GITHUB_TOKEN` is the only credential. Use a fine-grained personal access token scoped to a single repository with "Contents: Read and write" and "Pull requests: Read and write" permissions. `BUILDWRIGHT_AUTO_APPROVE` is a configuration flag, not a secret.
83
+ Before every commit, run discovered gates:
79
84
 
80
- ## Verification Loop (CRITICAL)
85
+ 1. Typecheck
86
+ 2. Lint
87
+ 3. Test
88
+ 4. Build
81
89
 
82
- Before EVERY commit, discover commands first (see Command Discovery above), then run:
90
+ Skip only gates that are unavailable for the stack. If a required step fails,
91
+ fix and retry up to `BUILDWRIGHT_AGENT_RETRIES` times, default 2.
83
92
 
84
- 1. **Type check** — run DISCOVERED_TYPECHECK (SKIP gracefully if this stack has none)
85
- 2. **Lint** — run DISCOVERED_LINT (SKIP gracefully if this stack has none)
86
- 3. **Test** — run DISCOVERED_TEST
87
- 4. **Build** — run DISCOVERED_BUILD (SKIP gracefully if this stack has no build step, e.g. Python)
93
+ ## Documentation Discipline
88
94
 
89
- If ANY required step fails: fix and retry (max 2 attempts). If same error repeats or still failing: STOP and report blocker.
95
+ Documentation is part of done.
96
+
97
+ Before every commit, update affected README, docs, command text, API docs,
98
+ examples, changelog, or generated user-facing docs. If no docs need updating,
99
+ say why in the final report.
90
100
 
91
101
  ## Git Rules
92
- - Atomic commits: only commit files you changed
93
- - Conventional commits: feat:, fix:, refactor:, test:, docs:, chore:
94
- - List each file explicitly in commit message
95
- - Never edit .env files
96
- - Never run destructive git operations without explicit instruction
97
- - Multi-agent safety: NEVER use git stash (other agents may be working)
98
- - Only `.buildwright/` is committed never commit `.claude/` or `.opencode/` content files
99
- - After editing any file in `.buildwright/`, run `make sync` before committing
100
- - Before committing, update README.md, SKILL.md, docs/, or CHANGELOG.md if the change affects user-facing behavior
101
- - After editing any `.buildwright/commands/` file, run `make sync` — it automatically checks that every command is documented in README.md and SKILL.md and warns about gaps
102
-
103
- ## Cross-Domain Features (Claw Architecture)
104
- When a feature touches multiple domains (e.g., DB + API + UI):
105
- 1. `/bw-claw` triggers the Architect persona (`.buildwright/agents/architect.md`)
106
- 2. Architect registers new fields in `.buildwright/steering/naming-conventions.md` BEFORE spawning claws
107
- 3. Each claw (`.buildwright/claws/*.md`) executes its domain task using TDD
108
- 4. Claws derive naming from the conventions registry — they never invent their own
109
- 5. Architect integrates and runs quality gates
110
-
111
- ## Design Principles (ALWAYS APPLY)
112
-
113
- 1. **KISS (Keep It Simple, Stupid)**
114
- - Prefer simple solutions over clever ones
115
- - If it feels complex, step back and simplify
116
- - Code should be readable by a junior developer
117
-
118
- 2. **YAGNI (You Aren't Gonna Need It)**
119
- - Build only what's required NOW
120
- - No speculative features "for later"
121
- - Avoid abstractions until they're proven needed
122
- - No wrapper types, adapter layers, or extension points "just in case"
123
- - If the requirements don't ask for it, don't build it
124
-
125
- 3. **No Premature Optimization**
126
- - Make it work first, then make it fast (if needed)
127
- - Optimize only with profiling data
128
- - Readability > micro-optimizations
129
-
130
- 4. **Boring Technology**
131
- - Prefer proven, well-documented solutions
132
- - New tech only when it solves a real problem
133
- - Consider maintenance burden
134
-
135
- 5. **Fail Fast, Fail Loud**
136
- - Validate inputs at boundaries
137
- - Throw errors early with clear messages
138
- - No silent failures
139
-
140
- 6. **DRY (Don't Repeat Yourself)**
141
- - Before writing new code, search for existing functions, types, and utilities that already do the job
142
- - Reuse existing structures — if `User` exists, don't create `UserDTO` or `UserEntity` unless the codebase already separates those concerns
143
- - If two pieces of code do similar things, extract the common part rather than duplicating
144
- - Prefer importing over reimplementing
145
-
146
- ## Code Standards
147
- - Follow existing patterns in the codebase exactly
148
- - Keep files under 500 lines; split proactively
149
- - Write tests for all new functionality (TDD preferred)
150
- - Avoid type system escape hatches (`any` in TypeScript, untyped `interface{}` in Go, `Any` in Python) — use proper types
151
- - Use Decimal/BigDecimal for financial calculations, NEVER floating point
152
- - All user inputs must be validated
102
+
103
+ - Atomic commits: only commit files you changed.
104
+ - Conventional commits: `feat:`, `fix:`, `refactor:`, `test:`, `docs:`, `chore:`.
105
+ - Never edit `.env` files.
106
+ - Never run destructive git operations without explicit instruction.
107
+ - Never use `git stash`.
108
+ - Only `.buildwright/` is canonical. Do not commit generated `.claude/`,
109
+ `.opencode/`, `.cursor/rules/`, `skills/`, or `AGENTS.md`.
110
+ - After editing `.buildwright/`, run `make sync`.
111
+
112
+ ## Philosophy
113
+
114
+ Always apply `.buildwright/steering/philosophy.md`: KISS, YAGNI, DRY, boring
115
+ technology, fail fast, Red -> Green -> Refactor, and documentation discipline.
153
116
 
154
117
  ## Self-Improvement
155
- When you discover a pattern, gotcha, or better approach:
156
- - Add it below under "Learned Patterns"
157
- - Keep entries concise (one line each)
118
+
119
+ When you discover a reusable pattern or gotcha, add it below.
158
120
 
159
121
  ## Learned Patterns
122
+
160
123
  <!-- Agent adds entries here as it learns -->
@@ -25,7 +25,7 @@ dist: sync
25
25
  cursor: sync
26
26
  @echo "Cursor rules generated at .cursor/rules/"
27
27
  @echo "Open this project in Cursor — rules are applied automatically."
28
- @echo "Settings > Rules shows steering rules as 'Always' and commands/agents/claws as 'Intelligent'."
28
+ @echo "Settings > Rules shows steering rules as 'Always' and commands/agents as 'Intelligent'."
29
29
 
30
30
  # OpenCode — install skill to user global config
31
31
  opencode: sync
@@ -19,11 +19,11 @@ NEW_VERSION=$(node -p "require('./cli/package.json').version")
19
19
  git add cli/package.json cli/package-lock.json SKILL.md
20
20
  git commit -m "chore: bump version to v$NEW_VERSION"
21
21
 
22
- # Step 3: annotated tag
23
- git tag -a "v$NEW_VERSION" -m "Release v$NEW_VERSION"
24
-
25
- # Step 4: push commit + tag
22
+ # Step 3: push commit first
26
23
  git push
24
+
25
+ # Step 4: annotated tag (after commit is on remote)
26
+ git tag -a "v$NEW_VERSION" -m "Release v$NEW_VERSION"
27
27
  git push origin "v$NEW_VERSION"
28
28
 
29
29
  # Step 5: GitHub release with auto-generated notes
@@ -5,17 +5,13 @@
5
5
  # Generates:
6
6
  # .claude/commands/ ← from .buildwright/commands/ (paths rewritten to .claude/)
7
7
  # .claude/agents/ ← from .buildwright/agents/
8
- # .claude/claws/ ← from .buildwright/claws/
9
8
  # .claude/steering/ ← from .buildwright/steering/
10
- # .claude/tasks/ ← from .buildwright/tasks/
11
9
  # .opencode/commands/ ← from .buildwright/commands/ (paths rewritten to .opencode/)
12
10
  # .opencode/agents/ ← from .buildwright/agents/
13
- # .opencode/claws/ ← from .buildwright/claws/
14
11
  # .opencode/steering/ ← from .buildwright/steering/
15
12
  # .cursor/rules/steering/ ← .mdc files with alwaysApply: true
16
13
  # .cursor/rules/commands/ ← .mdc files with alwaysApply: false
17
14
  # .cursor/rules/agents/ ← .mdc files with alwaysApply: false
18
- # .cursor/rules/claws/ ← .mdc files with alwaysApply: false
19
15
  # AGENTS.md ← CLAUDE.md with OpenCode header prepended
20
16
  # dist/buildwright/ ← SKILL.md packaged for ClawHub
21
17
  #
@@ -95,35 +91,29 @@ CURSOR_DESCRIPTION=""
95
91
  set_cursor_frontmatter() {
96
92
  local preset="$1"
97
93
  local filename="$2"
94
+ local base_filename
95
+ base_filename=$(basename "$filename")
98
96
 
99
97
  case "$preset" in
100
98
  steering|codebase) CURSOR_ALWAYS_APPLY="true" ;;
101
99
  *) CURSOR_ALWAYS_APPLY="false" ;;
102
100
  esac
103
101
 
104
- case "${preset}:${filename}" in
102
+ case "${preset}:${base_filename}" in
105
103
  steering:product) CURSOR_DESCRIPTION="Buildwright product context: goals, features, user personas, business constraints" ;;
106
104
  steering:tech) CURSOR_DESCRIPTION="Buildwright technical context: stack, commands, architecture patterns" ;;
107
- steering:quality-gates) CURSOR_DESCRIPTION="Buildwright quality gates: automated checks that must pass before merge" ;;
108
- steering:naming-conventions) CURSOR_DESCRIPTION="Buildwright naming conventions: canonical field and endpoint registry" ;;
105
+ steering:philosophy) CURSOR_DESCRIPTION="Buildwright engineering philosophy: KISS, YAGNI, TDD, docs discipline" ;;
109
106
  codebase:STACK) CURSOR_DESCRIPTION="Codebase tech stack: languages, runtime, frameworks, dependencies, integrations" ;;
110
107
  codebase:ARCHITECTURE) CURSOR_DESCRIPTION="Codebase architecture: layers, data flow, entry points, directory structure" ;;
111
108
  codebase:CONVENTIONS) CURSOR_DESCRIPTION="Codebase conventions: naming, code style, imports, error handling, testing patterns" ;;
112
109
  codebase:CONCERNS) CURSOR_DESCRIPTION="Codebase concerns: tech debt, bugs, security risks, performance bottlenecks" ;;
113
- command:bw-new-feature) CURSOR_DESCRIPTION="Buildwright bw-new-feature: full pipeline for new features with spec and TDD" ;;
114
- command:bw-claw) CURSOR_DESCRIPTION="Buildwright bw-claw: multi-agent cross-domain feature development" ;;
115
- command:bw-quick) CURSOR_DESCRIPTION="Buildwright bw-quick: fast path for bug fixes and small tasks" ;;
110
+ command:bw-work) CURSOR_DESCRIPTION="Buildwright bw-work: implement bug fixes, refactors, and features" ;;
116
111
  command:bw-ship) CURSOR_DESCRIPTION="Buildwright bw-ship: quality pipeline then commit, push, and PR" ;;
117
112
  command:bw-verify) CURSOR_DESCRIPTION="Buildwright bw-verify: quick quality checks (typecheck, lint, test, build)" ;;
118
- command:bw-help) CURSOR_DESCRIPTION="Buildwright bw-help: list all available Buildwright commands" ;;
119
113
  command:bw-analyse) CURSOR_DESCRIPTION="Buildwright bw-analyse: analyse codebase, write structured docs to .buildwright/codebase/, update tech.md" ;;
120
- agent:architect) CURSOR_DESCRIPTION="Buildwright Architect agent persona" ;;
114
+ command:bw-plan) CURSOR_DESCRIPTION="Buildwright bw-plan: research a question, produce a written deliverable — no implementation" ;;
121
115
  agent:staff-engineer) CURSOR_DESCRIPTION="Buildwright Staff Engineer agent persona" ;;
122
116
  agent:security-engineer) CURSOR_DESCRIPTION="Buildwright Security Engineer agent persona" ;;
123
- claw:frontend) CURSOR_DESCRIPTION="Buildwright Frontend domain specialist claw" ;;
124
- claw:backend) CURSOR_DESCRIPTION="Buildwright Backend domain specialist claw" ;;
125
- claw:database) CURSOR_DESCRIPTION="Buildwright Database domain specialist claw" ;;
126
- claw:devops) CURSOR_DESCRIPTION="Buildwright DevOps domain specialist claw" ;;
127
117
  *) CURSOR_DESCRIPTION="Buildwright ${preset}: ${filename}" ;;
128
118
  esac
129
119
  }
@@ -143,20 +133,25 @@ sync_cursor_dir() {
143
133
  fi
144
134
 
145
135
  if [ "$CHECK_ONLY" = false ]; then
136
+ rm -rf "$dst"
146
137
  mkdir -p "$dst"
147
138
  fi
148
139
 
149
- for src_file in "$src"/*.md; do
140
+ while IFS= read -r src_file; do
150
141
  [ -f "$src_file" ] || continue
151
- local filename
152
- filename=$(basename "$src_file" .md)
142
+ local rel_file filename base_filename
143
+ rel_file="${src_file#$src/}"
144
+ filename="${rel_file%.md}"
145
+ base_filename=$(basename "$filename")
153
146
 
154
147
  # Skip meta files — they're internal docs, not rules
155
- case "$filename" in
148
+ case "$base_filename" in
156
149
  README|TEMPLATE) continue ;;
157
150
  esac
158
151
 
159
152
  local dst_file="$dst/$filename.mdc"
153
+ local dst_parent
154
+ dst_parent=$(dirname "$dst_file")
160
155
  set_cursor_frontmatter "$preset" "$filename"
161
156
 
162
157
  if [ "$CHECK_ONLY" = true ]; then
@@ -181,6 +176,7 @@ sync_cursor_dir() {
181
176
  rm -f "$tmpfile"
182
177
  fi
183
178
  else
179
+ mkdir -p "$dst_parent"
184
180
  {
185
181
  printf '%s\n' "---"
186
182
  printf 'description: "%s"\n' "$CURSOR_DESCRIPTION"
@@ -190,7 +186,7 @@ sync_cursor_dir() {
190
186
  sed 's|@\.buildwright/|@.cursor/rules/|g' "$src_file"
191
187
  } > "$dst_file"
192
188
  fi
193
- done
189
+ done < <(find "$src" -type f -name "*.md" | sort)
194
190
 
195
191
  if [ "$CHECK_ONLY" = false ]; then
196
192
  echo " synced $src → $dst (*.mdc)"
@@ -210,10 +206,8 @@ SYNC_NEEDED=false
210
206
 
211
207
  sync_dir ".buildwright/commands" ".claude/commands" ".buildwright/" ".claude/"
212
208
  sync_dir ".buildwright/agents" ".claude/agents" ".buildwright/" ".claude/"
213
- sync_dir ".buildwright/claws" ".claude/claws" ".buildwright/" ".claude/"
214
209
  sync_dir ".buildwright/steering" ".claude/steering"
215
210
  sync_dir ".buildwright/codebase" ".claude/codebase"
216
- sync_dir ".buildwright/tasks" ".claude/tasks"
217
211
 
218
212
  # ============================================================================
219
213
  # 2. .buildwright/ → .opencode/ (rewrite .buildwright/ → .opencode/)
@@ -221,7 +215,6 @@ sync_dir ".buildwright/tasks" ".claude/tasks"
221
215
 
222
216
  sync_dir ".buildwright/commands" ".opencode/commands" ".buildwright/" ".opencode/"
223
217
  sync_dir ".buildwright/agents" ".opencode/agents" ".buildwright/" ".opencode/"
224
- sync_dir ".buildwright/claws" ".opencode/claws" ".buildwright/" ".opencode/"
225
218
  sync_dir ".buildwright/steering" ".opencode/steering"
226
219
  sync_dir ".buildwright/codebase" ".opencode/codebase"
227
220
 
@@ -266,13 +259,13 @@ sync_cursor_dir ".buildwright/steering" "steering" "steering"
266
259
  sync_cursor_dir ".buildwright/codebase" "codebase" "codebase"
267
260
  sync_cursor_dir ".buildwright/commands" "commands" "command"
268
261
  sync_cursor_dir ".buildwright/agents" "agents" "agent"
269
- sync_cursor_dir ".buildwright/claws" "claws" "claw"
270
262
 
271
263
  # ============================================================================
272
264
  # 5. .buildwright/commands/ → skills/ (Codex CLI skill discovery)
273
265
  # ============================================================================
274
266
 
275
267
  if [ "$CHECK_ONLY" = false ]; then
268
+ rm -rf skills
276
269
  for file in .buildwright/commands/bw-*.md; do
277
270
  [ -f "$file" ] || continue
278
271
  name=$(basename "$file" .md)
@@ -294,9 +287,11 @@ fi
294
287
 
295
288
  # ============================================================================
296
289
  # 7. README.md → cli/README.md (single source of truth for npm package page)
290
+ # Only runs in the buildwright repo itself, which has a cli/ directory.
291
+ # Generated services do not have cli/ and must not fail here.
297
292
  # ============================================================================
298
293
 
299
- if [ "$CHECK_ONLY" = false ] && [ -f "README.md" ]; then
294
+ if [ "$CHECK_ONLY" = false ] && [ -f "README.md" ] && [ -d "cli" ]; then
300
295
  cp README.md cli/README.md
301
296
  echo " README.md → cli/README.md"
302
297
  fi
@@ -323,7 +318,9 @@ else
323
318
  echo " CLAUDE.md → AGENTS.md"
324
319
  echo " SKILL.md → dist/buildwright/SKILL.md"
325
320
  echo " .buildwright/commands/ → skills/ (Codex CLI skill discovery)"
326
- echo " README.md → cli/README.md (npm package page)"
321
+ if [ -d "cli" ]; then
322
+ echo " README.md → cli/README.md (npm package page)"
323
+ fi
327
324
 
328
325
  # Validate all commands are documented in SKILL.md and README.md
329
326
  if [ -f "scripts/validate-docs.sh" ]; then
@@ -25,11 +25,8 @@ missing=0
25
25
  for file in "$COMMANDS_DIR"/bw-*.md; do
26
26
  [ -f "$file" ] || continue
27
27
 
28
- # Skip bw-help.md — it IS the help output, doesn't need its own docs section
29
- basename=$(basename "$file")
30
- [ "$basename" = "bw-help.md" ] && continue
31
-
32
28
  # Extract name from YAML frontmatter
29
+ basename=$(basename "$file")
33
30
  name=$(awk '/^---/{f=!f;next} f && /^name:/{print $2;exit}' "$file" 2>/dev/null | tr -d '\r')
34
31
 
35
32
  if [ -z "$name" ]; then
@@ -1,143 +0,0 @@
1
- # Architect Agent (Brain)
2
-
3
- You are a **System Architect** — the brain of the Claw Architecture. You analyze requirements, decompose work across domains, spawn specialized claws, and combine their results into a cohesive whole.
4
-
5
- You have 20+ years building complex distributed systems. You think in layers, interfaces, and contracts.
6
-
7
- ## Your Role
8
-
9
- 1. **Analyze** — Understand the feature request across all system layers
10
- 2. **Decompose** — Break work into domain-specific tasks for claws
11
- 3. **Coordinate** — Define interfaces and shared naming conventions
12
- 4. **Integrate** — Combine claw outputs, run integration checks
13
- 5. **Ship** — Run Buildwright quality gates on the combined result
14
-
15
- ## How You Think
16
-
17
- ```
18
- "What domains does this feature touch?"
19
- "What's the contract between each domain?"
20
- "Can these claws work in parallel or do they have dependencies?"
21
- "What shared vocabulary do the claws need?"
22
- ```
23
-
24
- ## Decomposition Process
25
-
26
- ### Step 1: Identify Domains
27
-
28
- Read the project structure and determine which layers exist:
29
-
30
- | Domain | Typical Directories | Claw |
31
- |--------|-------------------|------|
32
- | Frontend/UI | `ui/`, `frontend/`, `src/components/`, `app/` | UI Claw |
33
- | Backend/API | `api/`, `backend/`, `server/`, `src/routes/` | API Claw |
34
- | Database | `database/`, `db/`, `migrations/`, `prisma/` | DB Claw |
35
- | Infrastructure | `infra/`, `terraform/`, `k8s/`, `helm/`, `Dockerfile` | DevOps Claw (`devops.md`) |
36
-
37
- ### Step 2: Define Interfaces
38
-
39
- Before spawning claws, define the contracts between them:
40
-
41
- ```markdown
42
- ## Interface Contract: [Feature Name]
43
-
44
- ### New Fields
45
- | Concept | Database | API (JSON) | UI (JS) |
46
- |---------|----------|------------|---------|
47
- | [field] | snake_case | camelCase | camelCase |
48
-
49
- ### New Endpoints
50
- | Method | Path | Request | Response |
51
- |--------|------|---------|----------|
52
- | [verb] | [path] | [schema] | [schema] |
53
-
54
- ### Dependencies Between Claws
55
- [claw A] must complete before [claw B] because [reason]
56
- ```
57
-
58
- ### Step 3: Create Claw Tasks
59
-
60
- For each domain that needs changes, create a clear task:
61
-
62
- ```markdown
63
- ## Claw Task: [Domain] — [Feature]
64
-
65
- ### Context
66
- [What this claw needs to know about the overall feature]
67
-
68
- ### Interface Contract
69
- [Relevant subset of the interface contract]
70
-
71
- ### Specific Work
72
- 1. [Concrete step 1]
73
- 2. [Concrete step 2]
74
-
75
- ### Verification
76
- - [How to verify this claw's work in isolation]
77
- - [Integration points to test]
78
- ```
79
-
80
- ### Step 4: Execution Strategy
81
-
82
- Determine the execution order:
83
-
84
- ```
85
- PARALLEL (no dependencies):
86
- UI Claw ─────┐
87
- API Claw ────├─► Brain combines
88
- DB Claw ─────┘
89
-
90
- SEQUENTIAL (has dependencies):
91
- DB Claw → API Claw → UI Claw
92
- (schema first, then endpoints, then UI)
93
-
94
- MIXED (partial dependencies):
95
- DB Claw ──► API Claw ──┐
96
- UI Claw ────────────────├─► Brain combines
97
- (UI can work on component while DB+API are sequential)
98
- ```
99
-
100
- ## Integration Phase
101
-
102
- After all claws complete:
103
-
104
- 1. **Verify interfaces** — Do the pieces actually fit together?
105
- 2. **Run integration tests** — End-to-end flows work?
106
- 3. **Check naming consistency** — Shared vocabulary respected?
107
- 4. **Run /bw-verify** — Full quality gates pass?
108
-
109
- ## Output Format
110
-
111
- ```
112
- ## ARCHITECTURE PLAN
113
- ═══════════════════
114
-
115
- ### Feature: [name]
116
- ### Domains Affected: [list]
117
-
118
- ### Interface Contract
119
- [table of shared fields, endpoints, events]
120
-
121
- ### Claw Tasks
122
- 1. [Domain] Claw: [summary] — [parallel/sequential]
123
- 2. [Domain] Claw: [summary] — [parallel/sequential]
124
- 3. [Domain] Claw: [summary] — [parallel/sequential]
125
-
126
- ### Execution Order
127
- [diagram showing parallel vs sequential]
128
-
129
- ### Integration Checklist
130
- - [ ] [check 1]
131
- - [ ] [check 2]
132
- ```
133
-
134
- ## When NOT to Decompose
135
-
136
- Use single-agent mode (standard /bw-new-feature or /bw-quick) when:
137
- - Feature touches only one domain
138
- - Changes are small/bounded (< 2 hours)
139
- - No cross-layer interfaces needed
140
- - Project is a monolith with no clear domain separation
141
-
142
- The overhead of multi-agent coordination isn't worth it for simple tasks.
143
-