buildwright 0.0.8 → 0.0.10
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.
- package/README.md +401 -45
- package/bin/buildwright.js +8 -0
- package/package.json +1 -1
- package/src/commands/commands.js +81 -0
- package/templates/.buildwright/commands/bw-help.md +4 -1
- package/templates/.buildwright/commands/bw-new-feature.md +23 -0
- package/templates/.buildwright/commands/bw-plan.md +210 -0
- package/templates/.buildwright/commands/bw-quick.md +11 -0
- package/templates/CLAUDE.md +3 -1
- package/templates/Makefile +8 -1
- package/templates/scripts/sync-agents.sh +32 -1
- package/templates/scripts/validate-docs.sh +67 -0
package/README.md
CHANGED
|
@@ -1,81 +1,437 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Buildwright
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Ship code you don't read. Let automated systems be your reviewer.**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
An agent-first autonomous development workflow where humans approve specifications and agents handle everything else — implementation, testing, security review, code review, and shipping.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## The Flow
|
|
10
|
+
|
|
11
|
+
```mermaid
|
|
12
|
+
flowchart TD
|
|
13
|
+
A["/bw-new-feature"] --> B{Greenfield?}
|
|
14
|
+
B -- Yes --> C[Ask product vision<br>Derive tech stack from vision]
|
|
15
|
+
C --> D
|
|
16
|
+
B -- No --> D["1. RESEARCH<br>Deep-read codebase"]
|
|
17
|
+
D --> E["1.5. RESOLVE AMBIGUITIES<br>Auto-decide or ask user<br>(BUILDWRIGHT_AUTO_APPROVE)"]
|
|
18
|
+
E --> F["2. PLAN<br>Generate spec"]
|
|
19
|
+
F --> G["3. VALIDATE<br>Staff Engineer review (auto)"]
|
|
20
|
+
G --> H["4. APPROVE<br>Human or auto<br>(BUILDWRIGHT_AUTO_APPROVE)"]
|
|
21
|
+
H --> I["5. BUILD<br>TDD per milestone<br>→ verify after each"]
|
|
22
|
+
I --> J["6.5 UPDATE DOCS<br>README · CHANGELOG · docs/"]
|
|
23
|
+
J --> K["7. SHIP"]
|
|
24
|
+
K --> L[Verify]
|
|
25
|
+
L --> M[Security]
|
|
26
|
+
M --> N[Review]
|
|
27
|
+
N --> O["PR Ready ✓"]
|
|
28
|
+
|
|
29
|
+
P["/bw-quick"] --> Q[Quick research]
|
|
30
|
+
Q --> R[Implement TDD]
|
|
31
|
+
R --> S[Verify]
|
|
32
|
+
S --> U[Security]
|
|
33
|
+
U --> V[Code Review]
|
|
34
|
+
V --> W[Update Docs]
|
|
35
|
+
W --> T["Commit Ready ✓"]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
> If anything fails → commit completed work, push, PR with failure report, exit(1). No orphaned branches.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Greenfield Projects
|
|
43
|
+
|
|
44
|
+
Starting a new project? Buildwright handles it:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
/bw-new-feature "Add product catalog with search"
|
|
48
|
+
|
|
49
|
+
> "This looks like a new project. What is the product vision, and do you have
|
|
50
|
+
> any tech constraints (team expertise, deployment environment, integrations,
|
|
51
|
+
> compliance)?"
|
|
52
|
+
E-commerce platform for handmade crafts. Team knows Python. Deploying to AWS Lambda.
|
|
53
|
+
|
|
54
|
+
> [AI generates steering docs + spec]
|
|
55
|
+
> [Derives and presents tech stack for approval]
|
|
56
|
+
|
|
57
|
+
PROPOSED TECH STACK
|
|
58
|
+
───────────────────
|
|
59
|
+
[Stack derived from your product vision and constraints]
|
|
60
|
+
Chosen because: [2-3 sentences linking requirements to stack]
|
|
61
|
+
Alternatives considered: [brief list]
|
|
62
|
+
|
|
63
|
+
Reply "approved" to proceed with this stack.
|
|
64
|
+
Or adjust: "approved, but use PostgreSQL instead of DynamoDB"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
One question. One approval. Tech stack + spec reviewed together.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Autonomous Mode
|
|
72
|
+
|
|
73
|
+
Want fully autonomous operation? Skip human approval entirely:
|
|
6
74
|
|
|
7
75
|
```bash
|
|
8
|
-
|
|
76
|
+
# Set environment variable
|
|
77
|
+
export BUILDWRIGHT_AUTO_APPROVE=true
|
|
78
|
+
|
|
79
|
+
# Then run as usual
|
|
80
|
+
/bw-new-feature "Add user authentication"
|
|
9
81
|
```
|
|
10
82
|
|
|
11
|
-
|
|
83
|
+
**What happens:**
|
|
84
|
+
- Research, plan, validate still run (quality preserved)
|
|
85
|
+
- Spec documents committed to git BEFORE implementation
|
|
86
|
+
- No approval wait — proceeds directly to build
|
|
87
|
+
- Full audit trail in version control
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
docs(spec): add specification for user-auth
|
|
91
|
+
|
|
92
|
+
- research.md: codebase analysis
|
|
93
|
+
- spec.md: implementation plan
|
|
94
|
+
- Validated by Staff Engineer agent
|
|
95
|
+
|
|
96
|
+
Auto-approved: BUILDWRIGHT_AUTO_APPROVE=true
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Use autonomous mode when:**
|
|
100
|
+
- You trust the workflow for routine features
|
|
101
|
+
- Running in CI/CD pipelines
|
|
102
|
+
- Batch processing multiple features
|
|
103
|
+
- You want to review specs via git history instead of real-time
|
|
104
|
+
|
|
105
|
+
---
|
|
12
106
|
|
|
13
107
|
## Quick Start
|
|
14
108
|
|
|
109
|
+
### npm (Recommended)
|
|
110
|
+
|
|
15
111
|
```bash
|
|
16
|
-
|
|
17
|
-
cd my-project
|
|
18
|
-
|
|
112
|
+
npm install -g buildwright
|
|
113
|
+
cd my-project && buildwright init
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Requires Node.js 18+. All templates are bundled — works offline after install. Run `buildwright update` to pull the latest commands/agents/claws from GitHub.
|
|
117
|
+
|
|
118
|
+
### For Claude Code
|
|
19
119
|
|
|
20
|
-
|
|
21
|
-
|
|
120
|
+
```bash
|
|
121
|
+
# Add to any project
|
|
122
|
+
curl -sL https://raw.githubusercontent.com/raunakkathuria/buildwright/main/setup.sh | bash
|
|
22
123
|
|
|
23
|
-
# Customize
|
|
24
|
-
nano .buildwright/steering/product.md #
|
|
25
|
-
nano .buildwright/steering/tech.md #
|
|
124
|
+
# Customize steering docs
|
|
125
|
+
nano .buildwright/steering/product.md # Your product context
|
|
126
|
+
nano .buildwright/steering/tech.md # Your tech stack
|
|
26
127
|
|
|
27
128
|
# Start building
|
|
28
129
|
claude
|
|
29
|
-
> /bw-new-feature "Add user authentication"
|
|
130
|
+
> /bw-new-feature "Add user authentication with OAuth2"
|
|
30
131
|
```
|
|
31
132
|
|
|
32
|
-
|
|
133
|
+
### For an existing clone
|
|
33
134
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
| `buildwright update` | Update commands/agents/claws from GitHub (preserves your steering docs) |
|
|
38
|
-
| `buildwright sync` | Re-sync `.buildwright/` to `.claude/`, `.opencode/`, `.cursor/rules/` |
|
|
135
|
+
```bash
|
|
136
|
+
# After cloning the repo, generate tool-specific configs
|
|
137
|
+
make sync
|
|
39
138
|
|
|
40
|
-
|
|
139
|
+
# This creates:
|
|
140
|
+
# .claude/ (commands, agents, claws, steering — from .buildwright/)
|
|
141
|
+
# .opencode/ (commands, agents, claws, steering — from .buildwright/)
|
|
142
|
+
# .cursor/rules/ (commands, agents, claws, steering — from .buildwright/)
|
|
143
|
+
# AGENTS.md (from CLAUDE.md — for OpenCode compatibility)
|
|
41
144
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
- `Makefile`, `CLAUDE.md`, `BUILDWRIGHT.md`
|
|
46
|
-
2. Makes scripts executable
|
|
47
|
-
3. Runs `make sync` to generate `.claude/`, `.opencode/`, `.cursor/rules/`
|
|
48
|
-
4. Installs git hooks for auto-sync on `.buildwright/` changes
|
|
145
|
+
# Install git hooks to auto-sync on .buildwright/ changes
|
|
146
|
+
make install-hooks
|
|
147
|
+
```
|
|
49
148
|
|
|
50
|
-
|
|
149
|
+
### For OpenClaw
|
|
51
150
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
-
|
|
56
|
-
|
|
151
|
+
The recommended approach is to run the setup script, which installs the full workflow (commands, agents, claws, steering docs) into your project:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
curl -sL https://raw.githubusercontent.com/raunakkathuria/buildwright/main/setup.sh | bash
|
|
155
|
+
make sync
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Alternatively, install just the skill globally for reference across all projects:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
mkdir -p ~/.openclaw/skills/buildwright
|
|
162
|
+
curl -s https://raw.githubusercontent.com/raunakkathuria/buildwright/main/SKILL.md > ~/.openclaw/skills/buildwright/SKILL.md
|
|
163
|
+
```
|
|
57
164
|
|
|
58
|
-
**
|
|
165
|
+
> **Note:** The global skill install provides buildwright's workflow guidance via SKILL.md. The slash commands (`/bw-new-feature`, `/bw-claw`, etc.) require the full project setup above.
|
|
59
166
|
|
|
60
|
-
|
|
167
|
+
### For OpenCode
|
|
168
|
+
|
|
169
|
+
Same as above — run the setup script for the full workflow:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
curl -sL https://raw.githubusercontent.com/raunakkathuria/buildwright/main/setup.sh | bash
|
|
173
|
+
make sync
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Or install the skill globally:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
mkdir -p ~/.config/opencode/skills/buildwright
|
|
180
|
+
curl -s https://raw.githubusercontent.com/raunakkathuria/buildwright/main/SKILL.md > ~/.config/opencode/skills/buildwright/SKILL.md
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
> **Note:** The global skill install provides buildwright's workflow guidance via SKILL.md. The slash commands require the full project setup.
|
|
184
|
+
|
|
185
|
+
### For Cursor
|
|
186
|
+
|
|
187
|
+
Same setup — run the setup script for the full workflow:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
curl -sL https://raw.githubusercontent.com/raunakkathuria/buildwright/main/setup.sh | bash
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Cursor rules are generated automatically in `.cursor/rules/` by the sync step. Open the project in Cursor — steering rules apply always, commands/agents/claws apply intelligently.
|
|
194
|
+
|
|
195
|
+
### For Codex CLI
|
|
196
|
+
|
|
197
|
+
Buildwright skills are discovered by Codex via `~/.agents/skills/`. After cloning:
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
cd ~/.codex/buildwright && make codex
|
|
201
|
+
# Creates: ~/.agents/skills/buildwright → skills/
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Or follow the detailed guide in [`.codex/INSTALL.md`](.codex/INSTALL.md).
|
|
205
|
+
|
|
206
|
+
Each `bw-*` command is available as a Codex skill. `AGENTS.md` (generated by `make sync`) is also read automatically by Codex at the project level.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## When to Use What
|
|
211
|
+
|
|
212
|
+
| Scenario | Approach | Why |
|
|
213
|
+
|----------|----------|-----|
|
|
214
|
+
| New feature, unclear scope | `/bw-new-feature` | Research prevents building the wrong thing |
|
|
215
|
+
| New feature, clear scope | `/bw-new-feature` | Spec creates audit trail + validation |
|
|
216
|
+
| Bug fix | `/bw-quick` | Fast path with full quality gates |
|
|
217
|
+
| Small task (< 2 hrs) | `/bw-quick` | Lightweight planning, full quality gates |
|
|
218
|
+
| Config change | `/bw-quick` | Quick path with security scan + code review |
|
|
219
|
+
| Refactor, clear scope | `/bw-quick` | You already know what to change |
|
|
220
|
+
| Refactor, unclear scope | `/bw-new-feature` | Research phase prevents breaking things |
|
|
221
|
+
| Unfamiliar / brownfield codebase | `/bw-analyse` | Generates stack, architecture, conventions, and concerns docs so every session starts with real context |
|
|
222
|
+
| Greenfield project | `/bw-new-feature` | Auto-generates steering docs + tech stack |
|
|
223
|
+
| Prototype / spike | Just code it | Ceremony kills exploration speed |
|
|
224
|
+
| One-off script | Just code it | No need for spec, review, or CI |
|
|
225
|
+
| Learning / experimenting | Just code it | Pipeline adds friction to discovery |
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Commands
|
|
61
230
|
|
|
62
231
|
| Command | Purpose |
|
|
63
232
|
|---------|---------|
|
|
233
|
+
| `/bw-analyse` | Analyse codebase: writes stack, architecture, conventions, concerns to `.buildwright/codebase/`, updates `tech.md` |
|
|
64
234
|
| `/bw-new-feature` | Full pipeline: research → spec → approve → build → ship |
|
|
235
|
+
| `/bw-claw` | Multi-agent: architect decomposes → claws execute per domain |
|
|
65
236
|
| `/bw-quick` | Fast path for bug fixes, small tasks |
|
|
66
|
-
| `/bw-
|
|
67
|
-
| `/bw-ship` | Quality gates + push
|
|
68
|
-
| `/bw-verify` | Quick typecheck
|
|
69
|
-
| `/bw-
|
|
70
|
-
|
|
237
|
+
| `/bw-plan` | Research a question, produce a written deliverable — no implementation, no commits |
|
|
238
|
+
| `/bw-ship` | Quality gates + release: verify → security → review → push → PR |
|
|
239
|
+
| `/bw-verify` | Quick checks: typecheck, lint, test, build |
|
|
240
|
+
| `/bw-help` | Show available commands |
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Agent Personas
|
|
245
|
+
|
|
246
|
+
Modular, extensible agent personas in `.buildwright/agents/`:
|
|
247
|
+
|
|
248
|
+
| Agent | File | Used By | Purpose |
|
|
249
|
+
|-------|------|---------|---------|
|
|
250
|
+
| Staff Engineer | `staff-engineer.md` | `/bw-new-feature`, `/bw-ship` | Spec & code review |
|
|
251
|
+
| Security Engineer | `bw-security-engineer.md` | `/bw-ship` | OWASP, SAST, security review |
|
|
252
|
+
|
|
253
|
+
### Adding New Agents
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
# Create new agent persona
|
|
257
|
+
cat > .buildwright/agents/qa-engineer.md << 'EOF'
|
|
258
|
+
# QA Engineer Agent
|
|
259
|
+
|
|
260
|
+
You are a QA Engineer specialized in test coverage...
|
|
261
|
+
|
|
262
|
+
## What You Look For
|
|
263
|
+
...
|
|
264
|
+
|
|
265
|
+
## Output Format
|
|
266
|
+
...
|
|
267
|
+
EOF
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Then reference in commands:
|
|
271
|
+
```markdown
|
|
272
|
+
## Adopt Persona
|
|
273
|
+
Read and adopt persona from `.buildwright/agents/qa-engineer.md`
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## Security Review
|
|
279
|
+
|
|
280
|
+
The security phase in `/bw-ship` covers:
|
|
281
|
+
|
|
282
|
+
| Category | Checks |
|
|
283
|
+
|----------|--------|
|
|
284
|
+
| **OWASP Top 10** | All 10 categories (A01-A10:2021) |
|
|
285
|
+
| **SAST** | Static analysis via Semgrep |
|
|
286
|
+
| **Secrets** | API keys, passwords, tokens, private keys |
|
|
287
|
+
| **Dependencies** | npm audit, cargo audit, pip-audit |
|
|
288
|
+
| **Financial** | No float for currency, transaction integrity, audit logging |
|
|
289
|
+
|
|
290
|
+
### Severity Triage
|
|
291
|
+
|
|
292
|
+
Findings are classified by severity to avoid blocking on low-risk items:
|
|
293
|
+
|
|
294
|
+
| Severity | Action | Example |
|
|
295
|
+
|----------|--------|---------|
|
|
296
|
+
| **Critical / High** | Block — must fix before merge | SQL injection, exposed secrets, auth bypass |
|
|
297
|
+
| **Medium** | Fix in this PR if feasible, otherwise track | Missing rate limiting, verbose error messages |
|
|
298
|
+
| **Low / Info** | Advisory — log and move on | Minor header hardening, informational findings |
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## Project Structure
|
|
303
|
+
|
|
304
|
+
```
|
|
305
|
+
your-project/
|
|
306
|
+
├── CLAUDE.md # Agent instructions (committed)
|
|
307
|
+
├── BUILDWRIGHT.md # Human documentation (committed)
|
|
308
|
+
├── SKILL.md # Agent Skills standard (committed)
|
|
309
|
+
├── .buildwright/ # Canonical config (committed)
|
|
310
|
+
│ ├── agents/ # Reusable personas
|
|
311
|
+
│ │ ├── architect.md
|
|
312
|
+
│ │ ├── staff-engineer.md
|
|
313
|
+
│ │ └── security-engineer.md
|
|
314
|
+
│ ├── claws/ # Domain specialists
|
|
315
|
+
│ │ ├── frontend.md
|
|
316
|
+
│ │ ├── backend.md
|
|
317
|
+
│ │ ├── database.md
|
|
318
|
+
│ │ └── TEMPLATE.md
|
|
319
|
+
│ ├── codebase/ # Analysis docs (generated by /bw-analyse)
|
|
320
|
+
│ │ ├── STACK.md
|
|
321
|
+
│ │ ├── ARCHITECTURE.md
|
|
322
|
+
│ │ ├── CONVENTIONS.md
|
|
323
|
+
│ │ └── CONCERNS.md
|
|
324
|
+
│ ├── commands/ # Slash commands
|
|
325
|
+
│ │ ├── bw-analyse.md
|
|
326
|
+
│ │ ├── bw-claw.md
|
|
327
|
+
│ │ ├── bw-new-feature.md
|
|
328
|
+
│ │ ├── bw-plan.md
|
|
329
|
+
│ │ ├── bw-quick.md
|
|
330
|
+
│ │ ├── bw-ship.md
|
|
331
|
+
│ │ ├── bw-verify.md
|
|
332
|
+
│ │ └── bw-help.md
|
|
333
|
+
│ ├── steering/ # Project context
|
|
334
|
+
│ │ ├── product.md
|
|
335
|
+
│ │ ├── tech.md
|
|
336
|
+
│ │ ├── quality-gates.md
|
|
337
|
+
│ │ └── naming-conventions.md
|
|
338
|
+
│ └── tasks/
|
|
339
|
+
├── .claude/ # Generated by `make sync` (gitignored)
|
|
340
|
+
│ ├── settings.json # Claude Code permissions (committed)
|
|
341
|
+
│ └── agents/, claws/, commands/, steering/ (generated)
|
|
342
|
+
├── .opencode/ # Generated by `make sync` (gitignored)
|
|
343
|
+
├── .cursor/rules/ # Generated by `make sync` (gitignored)
|
|
344
|
+
├── AGENTS.md # Generated by `make sync` (gitignored)
|
|
345
|
+
├── scripts/
|
|
346
|
+
│ ├── sync-agents.sh # Sync .buildwright/ → .claude/ + .opencode/ + .cursor/rules/
|
|
347
|
+
│ ├── install-hooks.sh # Install git hooks (run via: make install-hooks)
|
|
348
|
+
│ ├── validate-skill.sh # Validate SKILL.md against agentskills.io
|
|
349
|
+
│ └── hooks/ # Git hooks source (committed, installed to .git/hooks/)
|
|
350
|
+
│ ├── pre-commit # Auto-sync when .buildwright/ files are staged
|
|
351
|
+
│ ├── post-merge # Auto-sync after git pull/merge
|
|
352
|
+
│ └── post-checkout # Auto-sync on branch switches
|
|
353
|
+
├── docs/
|
|
354
|
+
│ ├── requirements/
|
|
355
|
+
│ └── specs/
|
|
356
|
+
└── .github/
|
|
357
|
+
└── workflows/
|
|
358
|
+
└── quality-gates.yml
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
> **Note:** After cloning, run `make sync && make install-hooks` to generate tool-specific configs and install git hooks that auto-sync on `.buildwright/` changes.
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## Design Principles (Built-In)
|
|
366
|
+
|
|
367
|
+
Every spec and implementation follows:
|
|
368
|
+
|
|
369
|
+
| Principle | Meaning |
|
|
370
|
+
|-----------|---------|
|
|
371
|
+
| **KISS** | Keep It Simple — prefer simple over clever |
|
|
372
|
+
| **YAGNI** | You Aren't Gonna Need It — build only what's needed now |
|
|
373
|
+
| **No Premature Optimization** | Make it work first, optimize with data |
|
|
374
|
+
| **Boring Technology** | Proven tools over shiny new ones |
|
|
375
|
+
| **Fail Fast** | Validate early, error loudly |
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
## Extending the Workflow
|
|
380
|
+
|
|
381
|
+
### Add New Agent
|
|
382
|
+
|
|
383
|
+
1. Create `.buildwright/agents/[role].md`
|
|
384
|
+
2. Define mindset, checklist, output format
|
|
385
|
+
3. Reference in commands with `Adopt persona from...`
|
|
386
|
+
|
|
387
|
+
### Add New Command
|
|
388
|
+
|
|
389
|
+
1. Create `.buildwright/commands/[name].md`
|
|
390
|
+
2. Define arguments, phases, output format
|
|
391
|
+
3. Reference agents as needed
|
|
392
|
+
|
|
393
|
+
### Planned Agents (Future)
|
|
394
|
+
|
|
395
|
+
| Agent | Purpose |
|
|
396
|
+
|-------|---------|
|
|
397
|
+
| QA Engineer | Test coverage, edge cases |
|
|
398
|
+
| Performance Engineer | Bottleneck identification |
|
|
399
|
+
| DevOps Engineer | Infrastructure review |
|
|
400
|
+
| Database Engineer | Schema review, query optimization |
|
|
401
|
+
| UX Engineer | API design review |
|
|
402
|
+
|
|
403
|
+
---
|
|
404
|
+
|
|
405
|
+
## Customization
|
|
406
|
+
|
|
407
|
+
| File | Purpose | Edit Frequency |
|
|
408
|
+
|------|---------|----------------|
|
|
409
|
+
| `.buildwright/steering/product.md` | Product context | Per project |
|
|
410
|
+
| `.buildwright/steering/tech.md` | Tech stack & commands | Per project |
|
|
411
|
+
| `.buildwright/agents/*.md` | Agent personas | Rarely |
|
|
412
|
+
| `.buildwright/commands/*.md` | Slash commands | Rarely |
|
|
413
|
+
| `CLAUDE.md` | Learned patterns | As discovered |
|
|
414
|
+
|
|
415
|
+
---
|
|
416
|
+
|
|
417
|
+
## FAQ
|
|
418
|
+
|
|
419
|
+
### Do I need to review code?
|
|
420
|
+
No. `/bw-ship` handles security review and code review automatically using Staff Engineer and Security Engineer personas.
|
|
71
421
|
|
|
72
|
-
|
|
422
|
+
### What if a step fails?
|
|
423
|
+
- **Verify fails**: Retries up to 2x automatically.
|
|
424
|
+
- **Security/Review fails**: No retry — requires judgment.
|
|
425
|
+
- **Autonomous mode** (`BUILDWRIGHT_AUTO_APPROVE=true`): Commits completed work, pushes, creates PR with failure details, exits with error code.
|
|
426
|
+
- **Interactive mode** (`BUILDWRIGHT_AUTO_APPROVE=false`): STOP immediately — human fixes in-session.
|
|
73
427
|
|
|
74
|
-
|
|
428
|
+
### Can I skip security review?
|
|
429
|
+
No. Both `/bw-ship` and `/bw-quick` include mandatory security and code review steps. Use `/bw-verify` for quick checks during active development, before committing.
|
|
75
430
|
|
|
76
|
-
|
|
431
|
+
### How do I add project-specific rules?
|
|
432
|
+
Add to `CLAUDE.md` under "Learned Patterns" or create a new agent.
|
|
77
433
|
|
|
78
|
-
|
|
434
|
+
---
|
|
79
435
|
|
|
80
436
|
## License
|
|
81
437
|
|
package/bin/buildwright.js
CHANGED
|
@@ -5,6 +5,7 @@ const { Command } = require('commander');
|
|
|
5
5
|
const { init } = require('../src/commands/init');
|
|
6
6
|
const { update } = require('../src/commands/update');
|
|
7
7
|
const { sync } = require('../src/commands/sync');
|
|
8
|
+
const { commands } = require('../src/commands/commands');
|
|
8
9
|
|
|
9
10
|
const pkg = require('../package.json');
|
|
10
11
|
|
|
@@ -36,4 +37,11 @@ program
|
|
|
36
37
|
sync();
|
|
37
38
|
});
|
|
38
39
|
|
|
40
|
+
program
|
|
41
|
+
.command('commands')
|
|
42
|
+
.description('List available agent slash commands (/bw-*)')
|
|
43
|
+
.action(() => {
|
|
44
|
+
commands();
|
|
45
|
+
});
|
|
46
|
+
|
|
39
47
|
program.parse(process.argv);
|
package/package.json
CHANGED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
const CYAN = '\x1b[36m';
|
|
7
|
+
const BOLD = '\x1b[1m';
|
|
8
|
+
const RESET = '\x1b[0m';
|
|
9
|
+
const DIM = '\x1b[2m';
|
|
10
|
+
|
|
11
|
+
const HARDCODED = [
|
|
12
|
+
{ name: 'bw-analyse', description: 'Analyse codebase: writes stack, architecture, conventions, concerns to .buildwright/codebase/' },
|
|
13
|
+
{ name: 'bw-claw', description: 'Multi-agent: architect decomposes → claws execute per domain' },
|
|
14
|
+
{ name: 'bw-new-feature', description: 'Full pipeline: research → spec → approve → build → ship' },
|
|
15
|
+
{ name: 'bw-plan', description: 'Research a question, produce a written deliverable — no implementation, no commits' },
|
|
16
|
+
{ name: 'bw-quick', description: 'Fast path for bug fixes, small tasks, config changes' },
|
|
17
|
+
{ name: 'bw-ship', description: 'Quality gates + release: verify → security → review → push → PR' },
|
|
18
|
+
{ name: 'bw-verify', description: 'Quick checks: typecheck, lint, test, build' },
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
function parseFrontmatter(content) {
|
|
22
|
+
const parts = content.split('---');
|
|
23
|
+
if (parts.length < 3) return null;
|
|
24
|
+
const front = parts[1];
|
|
25
|
+
const name = front.match(/^name:\s*(.+)$/m)?.[1]?.trim();
|
|
26
|
+
const description = front.match(/^description:\s*(.+)$/m)?.[1]?.trim();
|
|
27
|
+
return name && description ? { name, description } : null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function loadFromDir(dir) {
|
|
31
|
+
const files = fs.readdirSync(dir).filter(f => f.startsWith('bw-') && f.endsWith('.md') && f !== 'bw-help.md');
|
|
32
|
+
const entries = [];
|
|
33
|
+
for (const file of files) {
|
|
34
|
+
const content = fs.readFileSync(path.join(dir, file), 'utf8');
|
|
35
|
+
const parsed = parseFrontmatter(content);
|
|
36
|
+
if (parsed) entries.push(parsed);
|
|
37
|
+
}
|
|
38
|
+
return entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function formatList(entries) {
|
|
42
|
+
const maxLen = Math.max(...entries.map(e => e.name.length));
|
|
43
|
+
return entries.map(({ name, description }) => {
|
|
44
|
+
const padded = `/${name}`.padEnd(maxLen + 2);
|
|
45
|
+
return ` ${BOLD}${padded}${RESET} ${DIM}${description}${RESET}`;
|
|
46
|
+
}).join('\n');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function commands() {
|
|
50
|
+
const cwd = process.cwd();
|
|
51
|
+
const commandsDir = path.join(cwd, '.buildwright', 'commands');
|
|
52
|
+
|
|
53
|
+
let entries;
|
|
54
|
+
let source;
|
|
55
|
+
|
|
56
|
+
if (fs.existsSync(commandsDir)) {
|
|
57
|
+
entries = loadFromDir(commandsDir);
|
|
58
|
+
source = 'project';
|
|
59
|
+
} else {
|
|
60
|
+
entries = HARDCODED;
|
|
61
|
+
source = 'default';
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
console.log('');
|
|
65
|
+
console.log(`${CYAN}${BOLD}╔═══════════════════════════════════════════════════════════════╗${RESET}`);
|
|
66
|
+
console.log(`${CYAN}${BOLD}║ AGENT SLASH COMMANDS ║${RESET}`);
|
|
67
|
+
console.log(`${CYAN}${BOLD}╚═══════════════════════════════════════════════════════════════╝${RESET}`);
|
|
68
|
+
console.log('');
|
|
69
|
+
console.log('Use these inside Claude Code, Cursor, or OpenCode:');
|
|
70
|
+
console.log('');
|
|
71
|
+
console.log(formatList(entries));
|
|
72
|
+
console.log('');
|
|
73
|
+
if (source === 'default') {
|
|
74
|
+
console.log(`${DIM}(Showing default commands. Run inside a Buildwright project to see project-specific commands.)${RESET}`);
|
|
75
|
+
console.log('');
|
|
76
|
+
}
|
|
77
|
+
console.log(`Run ${BOLD}buildwright help${RESET} for CLI setup commands.`);
|
|
78
|
+
console.log('');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
module.exports = { commands };
|
|
@@ -18,6 +18,7 @@ WORKFLOW
|
|
|
18
18
|
/bw-ship Quality gates + release: verify → security → review → push → PR
|
|
19
19
|
/bw-verify Quick checks: typecheck, lint, test, build
|
|
20
20
|
/bw-analyse Analyse codebase: writes stack, architecture, conventions, concerns to .buildwright/codebase/
|
|
21
|
+
/bw-plan <question> Research a question, produce a written deliverable — no implementation, no commits
|
|
21
22
|
/bw-help Show this command list
|
|
22
23
|
|
|
23
24
|
╔═══════════════════════════════════════════════════════════════╗
|
|
@@ -49,6 +50,7 @@ SHIP EXISTING WORK:
|
|
|
49
50
|
╚═══════════════════════════════════════════════════════════════╝
|
|
50
51
|
|
|
51
52
|
Brownfield, need codebase context → /bw-analyse
|
|
53
|
+
Question/analysis, no coding → /bw-plan
|
|
52
54
|
Single domain, needs planning → /bw-new-feature
|
|
53
55
|
Crosses multiple domains/layers → /bw-claw
|
|
54
56
|
Small task, clear scope → /bw-quick
|
|
@@ -74,7 +76,8 @@ SHIP EXISTING WORK:
|
|
|
74
76
|
║ TIPS ║
|
|
75
77
|
╚═══════════════════════════════════════════════════════════════╝
|
|
76
78
|
|
|
77
|
-
• Use /bw-
|
|
79
|
+
• Use /bw-plan for research, analysis, or planning without implementation
|
|
80
|
+
• Use /bw-new-feature for anything that needs planning + implementation
|
|
78
81
|
• Use /bw-claw when feature crosses domain boundaries
|
|
79
82
|
• Use /bw-quick for clear, bounded tasks
|
|
80
83
|
• Verify retries 2x automatically; security/review stops immediately
|
|
@@ -110,6 +110,29 @@ Extract:
|
|
|
110
110
|
- Existing patterns to follow
|
|
111
111
|
- Commands to use
|
|
112
112
|
|
|
113
|
+
### 2.1b Read Codebase Analysis Docs (if present)
|
|
114
|
+
|
|
115
|
+
If `.buildwright/codebase/` exists (generated by `/bw-analyse`), read all docs there:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
ls .buildwright/codebase/ 2>/dev/null && cat .buildwright/codebase/*.md
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
These docs contain pre-mapped context:
|
|
122
|
+
- `STACK.md` — confirmed tech stack and dependencies
|
|
123
|
+
- `ARCHITECTURE.md` — layer structure, entry points, data flow
|
|
124
|
+
- `CONVENTIONS.md` — naming patterns, import style, test framework
|
|
125
|
+
- `CONCERNS.md` — known issues and gaps to avoid repeating
|
|
126
|
+
|
|
127
|
+
**If codebase docs exist:** they replace most of the general scanning in 2.2. Focus your
|
|
128
|
+
deep-read (2.2) on the specific files relevant to this feature only. Follow the
|
|
129
|
+
conventions and architecture exactly — do not invent new patterns.
|
|
130
|
+
|
|
131
|
+
**If not present:** proceed with 2.2 as written. Consider running `/bw-analyse` first on
|
|
132
|
+
brownfield projects for faster, more accurate results.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
113
136
|
### 2.2 Deep-Read Relevant Codebase
|
|
114
137
|
|
|
115
138
|
Based on the requirements, identify and deeply read relevant areas:
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bw-plan
|
|
3
|
+
description: Research a question or topic and produce a written deliverable — no implementation, no commits
|
|
4
|
+
arguments:
|
|
5
|
+
- name: question
|
|
6
|
+
description: A question, topic, or path to a structured task file (.md)
|
|
7
|
+
required: true
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# /bw-plan — Research and Planning Without Implementation
|
|
11
|
+
|
|
12
|
+
## When to use
|
|
13
|
+
|
|
14
|
+
Research and planning tasks where the output is a written deliverable — not
|
|
15
|
+
implementation. Use when someone asks a question, wants an analysis, or needs
|
|
16
|
+
a structured plan/report before (or instead of) writing code.
|
|
17
|
+
|
|
18
|
+
Examples:
|
|
19
|
+
- "What are the performance risks in this Flutter app?"
|
|
20
|
+
- "Plan a migration from monolith to microservices"
|
|
21
|
+
- "Evaluate which payment provider we should use"
|
|
22
|
+
- "Produce a static analysis report for this codebase"
|
|
23
|
+
|
|
24
|
+
**Contrast with other commands:**
|
|
25
|
+
- `/bw-new-feature` — research + spec + implement + ship
|
|
26
|
+
- `/bw-quick` — implement immediately (no planning doc)
|
|
27
|
+
- `/bw-analyse` — analyse this project's own codebase for Buildwright context
|
|
28
|
+
- `/bw-plan` — research a question, write a deliverable, stop there
|
|
29
|
+
|
|
30
|
+
## Invocation
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
/bw-plan [question or topic | path/to/task.md]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Inline question:**
|
|
37
|
+
```
|
|
38
|
+
/bw-plan "what are the performance risks in this Flutter app?"
|
|
39
|
+
/bw-plan "plan a migration from REST to GraphQL"
|
|
40
|
+
/bw-plan "compare Redis vs Memcached for our session cache"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Structured task file:**
|
|
44
|
+
```
|
|
45
|
+
/bw-plan tasks/flutter-perf-review.md
|
|
46
|
+
/bw-plan .buildwright/tasks/architecture-review.md
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Phase 1 — Understand
|
|
52
|
+
|
|
53
|
+
If a **task file** is provided, read it. Extract:
|
|
54
|
+
- `Inputs` block — variable names, descriptions, defaults
|
|
55
|
+
- `Rules` block — constraints on evidence, scope, output format
|
|
56
|
+
- `Research Areas` block — what categories to investigate
|
|
57
|
+
- `Outputs` block — file names and content requirements
|
|
58
|
+
|
|
59
|
+
Substitute any `<placeholder>` tokens from invocation args or sensible defaults
|
|
60
|
+
(e.g. `<date>` → today's date, `<repo_path>` → current working directory).
|
|
61
|
+
|
|
62
|
+
If **inline text** is provided, infer:
|
|
63
|
+
- The question or goal
|
|
64
|
+
- Likely research areas from the question
|
|
65
|
+
- Default output location: `docs/plans/<kebab-slug>/<YYYY-MM-DD>/plan.md`
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Phase 2 — Clarify
|
|
70
|
+
|
|
71
|
+
In **interactive mode** (`BUILDWRIGHT_AUTO_APPROVE=false`): if a critical input
|
|
72
|
+
is ambiguous (e.g. target repository path is unknown), ask one focused question
|
|
73
|
+
before proceeding.
|
|
74
|
+
|
|
75
|
+
In **autonomous mode** (`BUILDWRIGHT_AUTO_APPROVE=true`, default): apply
|
|
76
|
+
sensible defaults and proceed. Note any assumptions in the deliverable.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Phase 3 — Research
|
|
81
|
+
|
|
82
|
+
**First, check for pre-analysed codebase docs:**
|
|
83
|
+
|
|
84
|
+
If `.buildwright/codebase/` exists (generated by `/bw-analyse`), read it before scanning files:
|
|
85
|
+
- `STACK.md` — confirmed tech stack for context
|
|
86
|
+
- `ARCHITECTURE.md` — layer structure to reference in findings
|
|
87
|
+
- `CONVENTIONS.md` — patterns to cite as "current standard" in recommendations
|
|
88
|
+
- `CONCERNS.md` — known issues; findings that overlap get higher severity/priority
|
|
89
|
+
|
|
90
|
+
These docs accelerate research and improve accuracy of recommendations.
|
|
91
|
+
|
|
92
|
+
Read relevant code, config, and documentation. Run read-only tools listed in
|
|
93
|
+
the task (e.g. `flutter analyze`, `dart analyze`, `npm audit`, `cargo audit`,
|
|
94
|
+
`semgrep --config auto`). Capture all stdout/stderr as labeled evidence.
|
|
95
|
+
|
|
96
|
+
**Evidence labels (use exactly these):**
|
|
97
|
+
- `inferred from code` — finding comes from reading source files
|
|
98
|
+
- `backed by tool output` — finding is confirmed by a tool's output
|
|
99
|
+
- `backed by docs/external source` — finding references documentation
|
|
100
|
+
|
|
101
|
+
**Do NOT:**
|
|
102
|
+
- Modify any source file
|
|
103
|
+
- Run commands that write to the target repository
|
|
104
|
+
- Run build steps unless the task explicitly requires them
|
|
105
|
+
|
|
106
|
+
If a tool is unavailable, note it as a blocker in the summary; skip and continue.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Phase 4 — Synthesize
|
|
111
|
+
|
|
112
|
+
Organize findings into structured sections per the task's Research Areas (or
|
|
113
|
+
inferred categories for inline questions).
|
|
114
|
+
|
|
115
|
+
**For analysis/audit tasks**, each finding includes:
|
|
116
|
+
- `title` — short descriptive name
|
|
117
|
+
- `category` — from the task's research areas
|
|
118
|
+
- `severity` — critical / high / medium / low
|
|
119
|
+
- `confidence` — high / medium / low
|
|
120
|
+
- `evidence_type` — one of the three labels above
|
|
121
|
+
- `evidence` — file path + line number, or tool command + output excerpt
|
|
122
|
+
- `why it matters` — impact on users or system
|
|
123
|
+
- `recommended action` — concrete fix or next step
|
|
124
|
+
- `estimated effort` — hours/days rough estimate
|
|
125
|
+
- `needs_runtime_verification` — true/false
|
|
126
|
+
|
|
127
|
+
**For planning/decision tasks**, structure around:
|
|
128
|
+
- Options considered
|
|
129
|
+
- Recommendation
|
|
130
|
+
- Rationale
|
|
131
|
+
- Risks and mitigations
|
|
132
|
+
- Next steps
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Phase 5 — Write Deliverable
|
|
137
|
+
|
|
138
|
+
Write artifact files to `output_dir`. Must write at minimum:
|
|
139
|
+
- `plan.md` — or the task-specified primary document
|
|
140
|
+
|
|
141
|
+
May also write supporting files if the task specifies them:
|
|
142
|
+
- `.csv` — comma-separated with a header row
|
|
143
|
+
- `.json` — valid JSON, schema as specified in task
|
|
144
|
+
- Additional `.md` files (e.g. `top10.md`, `backlog.md`)
|
|
145
|
+
|
|
146
|
+
Create `output_dir` if it does not exist.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Phase 6 — Summarize
|
|
151
|
+
|
|
152
|
+
Print to stdout:
|
|
153
|
+
- Output directory path and files written
|
|
154
|
+
- Top 3–5 findings or key recommendations
|
|
155
|
+
- Any blockers that prevented complete research (tools unavailable, files inaccessible)
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Hard Constraints (always enforced)
|
|
160
|
+
|
|
161
|
+
- **NEVER** modify source files in any target repository
|
|
162
|
+
- **NEVER** commit, push, or create PRs
|
|
163
|
+
- **NEVER** claim something is "measured" or "confirmed" without direct evidence
|
|
164
|
+
- Every finding must cite evidence (file + line, or tool output excerpt)
|
|
165
|
+
- The task's `Rules` block can add constraints; it cannot remove these hard constraints
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Task File Format
|
|
170
|
+
|
|
171
|
+
Structured task files follow this template:
|
|
172
|
+
|
|
173
|
+
```markdown
|
|
174
|
+
## Inputs
|
|
175
|
+
- `<variable_name>`: description [default: value]
|
|
176
|
+
- `<repo_path>`: path to the repository to analyse [default: current directory]
|
|
177
|
+
- `<output_dir>`: where to write artifacts [default: docs/plans/<slug>/<date>/]
|
|
178
|
+
|
|
179
|
+
## Rules
|
|
180
|
+
1. This is a read-only pass. Do not modify any source files.
|
|
181
|
+
2. Separate findings by evidence type: inferred / tool-backed / doc-backed.
|
|
182
|
+
3. Every finding must include a file path and line reference or tool output.
|
|
183
|
+
|
|
184
|
+
## Research Areas
|
|
185
|
+
1. Category A — what to look for
|
|
186
|
+
2. Category B — what to look for
|
|
187
|
+
3. ...
|
|
188
|
+
|
|
189
|
+
## Outputs
|
|
190
|
+
- `plan.md` — primary report with executive summary and all findings
|
|
191
|
+
- `top10.md` — top 10 prioritized findings
|
|
192
|
+
- `backlog.csv` — all findings as CSV with columns: title,category,severity,confidence,effort
|
|
193
|
+
- `summary.json` — machine-readable summary: { findings_count, top_findings[], blockers[] }
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Example
|
|
199
|
+
|
|
200
|
+
The Flutter performance review task maps directly to this format:
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
/bw-plan tasks/flutter-perf-review.md
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Where `tasks/flutter-perf-review.md` defines:
|
|
207
|
+
- Inputs: repo_path, main package, entrypoints, target platforms, output_dir
|
|
208
|
+
- Rules: static analysis only, evidence required, no source modification
|
|
209
|
+
- Research Areas: rebuild risks, list/grid risks, rendering, CPU, data/arch, images, deps, code health
|
|
210
|
+
- Outputs: performance-static-review.md, performance-static-top10.md, performance-static-backlog.csv, performance-static-summary.json
|
|
@@ -71,6 +71,17 @@ Continue with /bw-quick anyway? (say "continue" or use /bw-new-feature)
|
|
|
71
71
|
|
|
72
72
|
**Lightweight research - only what's needed for this task.**
|
|
73
73
|
|
|
74
|
+
**First, check for pre-analysed codebase docs:**
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
ls .buildwright/codebase/ 2>/dev/null
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
If present, read `CONVENTIONS.md` and `ARCHITECTURE.md` — they give you naming patterns
|
|
81
|
+
and layer boundaries without scanning the whole codebase. Check `CONCERNS.md` to avoid
|
|
82
|
+
introducing more of the same issues. Then narrow your search to the specific files for
|
|
83
|
+
this task.
|
|
84
|
+
|
|
74
85
|
```bash
|
|
75
86
|
# Find directly relevant files
|
|
76
87
|
grep -r "[relevant terms]" --include="*.ts" --include="*.tsx" -l .
|
package/templates/CLAUDE.md
CHANGED
|
@@ -25,7 +25,7 @@ are codebase analysis docs (stack, architecture, conventions, concerns) generate
|
|
|
25
25
|
agents/ ← Architect, Staff Engineer, Security Engineer
|
|
26
26
|
claws/ ← Frontend, Backend, Database, TEMPLATE
|
|
27
27
|
codebase/ ← Generated by /bw-analyse (stack, architecture, conventions, concerns)
|
|
28
|
-
commands/ ← bw-new-feature, bw-claw, bw-quick, bw-ship, bw-verify, bw-help
|
|
28
|
+
commands/ ← bw-new-feature, bw-claw, bw-quick, bw-ship, bw-verify, bw-plan, bw-help
|
|
29
29
|
steering/ ← product.md, tech.md, quality-gates.md, naming-conventions.md
|
|
30
30
|
tasks/
|
|
31
31
|
|
|
@@ -55,6 +55,7 @@ After cloning or editing `.buildwright/`, run `make sync` to regenerate tool-spe
|
|
|
55
55
|
6. **Quick quality check**: /bw-verify → typecheck, lint, test, build
|
|
56
56
|
7. **Show commands**: /bw-help
|
|
57
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.
|
|
58
59
|
|
|
59
60
|
## Command Discovery
|
|
60
61
|
|
|
@@ -97,6 +98,7 @@ If ANY required step fails: fix and retry (max 2 attempts). If same error repeat
|
|
|
97
98
|
- Only `.buildwright/` is committed — never commit `.claude/` or `.opencode/` content files
|
|
98
99
|
- After editing any file in `.buildwright/`, run `make sync` before committing
|
|
99
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
|
|
100
102
|
|
|
101
103
|
## Cross-Domain Features (Claw Architecture)
|
|
102
104
|
When a feature touches multiple domains (e.g., DB + API + UI):
|
package/templates/Makefile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.PHONY: dist clean sync sync-check cursor opencode openclaw validate install-hooks uninstall-hooks bump release test-cli
|
|
1
|
+
.PHONY: dist clean sync sync-check cursor opencode openclaw codex validate install-hooks uninstall-hooks bump release test-cli
|
|
2
2
|
|
|
3
3
|
# ============================================================================
|
|
4
4
|
# Sync — Generate .claude/, .opencode/, .cursor/rules/ from .buildwright/ (canonical)
|
|
@@ -39,6 +39,13 @@ openclaw: sync
|
|
|
39
39
|
@cp SKILL.md ~/.openclaw/skills/buildwright/SKILL.md
|
|
40
40
|
@echo "Installed to ~/.openclaw/skills/buildwright/"
|
|
41
41
|
|
|
42
|
+
# Codex CLI — install skills for native skill discovery
|
|
43
|
+
codex: sync
|
|
44
|
+
@mkdir -p ~/.agents/skills
|
|
45
|
+
@ln -sfn $(PWD)/skills ~/.agents/skills/buildwright
|
|
46
|
+
@echo "Installed to ~/.agents/skills/buildwright"
|
|
47
|
+
@echo "Restart Codex to discover Buildwright skills."
|
|
48
|
+
|
|
42
49
|
# ============================================================================
|
|
43
50
|
# Validate SKILL.md against Agent Skills spec (agentskills.io)
|
|
44
51
|
# ============================================================================
|
|
@@ -261,7 +261,21 @@ sync_cursor_dir ".buildwright/agents" "agents" "agent"
|
|
|
261
261
|
sync_cursor_dir ".buildwright/claws" "claws" "claw"
|
|
262
262
|
|
|
263
263
|
# ============================================================================
|
|
264
|
-
# 5.
|
|
264
|
+
# 5. .buildwright/commands/ → skills/ (Codex CLI skill discovery)
|
|
265
|
+
# ============================================================================
|
|
266
|
+
|
|
267
|
+
if [ "$CHECK_ONLY" = false ]; then
|
|
268
|
+
for file in .buildwright/commands/bw-*.md; do
|
|
269
|
+
[ -f "$file" ] || continue
|
|
270
|
+
name=$(basename "$file" .md)
|
|
271
|
+
mkdir -p "skills/$name"
|
|
272
|
+
cp "$file" "skills/$name/SKILL.md"
|
|
273
|
+
echo " synced $file → skills/$name/SKILL.md"
|
|
274
|
+
done
|
|
275
|
+
fi
|
|
276
|
+
|
|
277
|
+
# ============================================================================
|
|
278
|
+
# 6. Package for ClawHub (dist/)
|
|
265
279
|
# ============================================================================
|
|
266
280
|
|
|
267
281
|
if [ "$CHECK_ONLY" = false ] && [ -f "SKILL.md" ]; then
|
|
@@ -270,6 +284,15 @@ if [ "$CHECK_ONLY" = false ] && [ -f "SKILL.md" ]; then
|
|
|
270
284
|
echo " packaged dist/buildwright/SKILL.md for ClawHub"
|
|
271
285
|
fi
|
|
272
286
|
|
|
287
|
+
# ============================================================================
|
|
288
|
+
# 7. README.md → cli/README.md (single source of truth for npm package page)
|
|
289
|
+
# ============================================================================
|
|
290
|
+
|
|
291
|
+
if [ "$CHECK_ONLY" = false ] && [ -f "README.md" ]; then
|
|
292
|
+
cp README.md cli/README.md
|
|
293
|
+
echo " README.md → cli/README.md"
|
|
294
|
+
fi
|
|
295
|
+
|
|
273
296
|
# ============================================================================
|
|
274
297
|
# Result
|
|
275
298
|
# ============================================================================
|
|
@@ -291,4 +314,12 @@ else
|
|
|
291
314
|
echo " .buildwright/ → .cursor/rules/ (.mdc with frontmatter)"
|
|
292
315
|
echo " CLAUDE.md → AGENTS.md"
|
|
293
316
|
echo " SKILL.md → dist/buildwright/SKILL.md"
|
|
317
|
+
echo " .buildwright/commands/ → skills/ (Codex CLI skill discovery)"
|
|
318
|
+
echo " README.md → cli/README.md (npm package page)"
|
|
319
|
+
|
|
320
|
+
# Validate all commands are documented in SKILL.md and README.md
|
|
321
|
+
if [ -f "scripts/validate-docs.sh" ]; then
|
|
322
|
+
echo ""
|
|
323
|
+
bash scripts/validate-docs.sh || true
|
|
324
|
+
fi
|
|
294
325
|
fi
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# validate-docs.sh — checks that every bw-* command is documented in SKILL.md and README.md
|
|
3
|
+
# Run automatically by sync-agents.sh after each sync.
|
|
4
|
+
# Exit code 1 if any commands are missing from documentation.
|
|
5
|
+
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
COMMANDS_DIR=".buildwright/commands"
|
|
9
|
+
SKILL_MD="SKILL.md"
|
|
10
|
+
README_MD="README.md"
|
|
11
|
+
|
|
12
|
+
RED='\033[0;31m'
|
|
13
|
+
YELLOW='\033[1;33m'
|
|
14
|
+
GREEN='\033[0;32m'
|
|
15
|
+
BOLD='\033[1m'
|
|
16
|
+
RESET='\033[0m'
|
|
17
|
+
|
|
18
|
+
if [ ! -d "$COMMANDS_DIR" ]; then
|
|
19
|
+
echo " validate-docs: $COMMANDS_DIR not found, skipping"
|
|
20
|
+
exit 0
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
missing=0
|
|
24
|
+
|
|
25
|
+
for file in "$COMMANDS_DIR"/bw-*.md; do
|
|
26
|
+
[ -f "$file" ] || continue
|
|
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
|
+
# Extract name from YAML frontmatter
|
|
33
|
+
name=$(awk '/^---/{f=!f;next} f && /^name:/{print $2;exit}' "$file" 2>/dev/null | tr -d '\r')
|
|
34
|
+
|
|
35
|
+
if [ -z "$name" ]; then
|
|
36
|
+
echo -e " ${YELLOW}validate-docs: $basename has no 'name' in frontmatter — skipping${RESET}"
|
|
37
|
+
continue
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
cmd="/$name"
|
|
41
|
+
file_missing=0
|
|
42
|
+
|
|
43
|
+
# Check SKILL.md
|
|
44
|
+
if [ -f "$SKILL_MD" ] && ! grep -qi "### $cmd" "$SKILL_MD" 2>/dev/null; then
|
|
45
|
+
echo -e " ${RED}${BOLD}validate-docs: $cmd missing from SKILL.md${RESET}"
|
|
46
|
+
file_missing=1
|
|
47
|
+
missing=$((missing + 1))
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
# Check README.md
|
|
51
|
+
if [ -f "$README_MD" ] && ! grep -q "$cmd" "$README_MD" 2>/dev/null; then
|
|
52
|
+
echo -e " ${RED}${BOLD}validate-docs: $cmd missing from README.md${RESET}"
|
|
53
|
+
file_missing=1
|
|
54
|
+
missing=$((missing + 1))
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
if [ "$file_missing" -eq 0 ]; then
|
|
58
|
+
echo -e " ${GREEN}validate-docs: $cmd ✓${RESET}"
|
|
59
|
+
fi
|
|
60
|
+
done
|
|
61
|
+
|
|
62
|
+
if [ "$missing" -gt 0 ]; then
|
|
63
|
+
echo ""
|
|
64
|
+
echo -e " ${RED}${BOLD}validate-docs: $missing documentation gap(s) found.${RESET}"
|
|
65
|
+
echo -e " Update README.md and SKILL.md, then re-run 'make sync'."
|
|
66
|
+
exit 1
|
|
67
|
+
fi
|