buildwright 0.0.12 → 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 (36) 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/sync-agents.sh +18 -25
  18. package/templates/scripts/validate-docs.sh +1 -4
  19. package/templates/.buildwright/agents/architect.md +0 -143
  20. package/templates/.buildwright/claws/README.md +0 -89
  21. package/templates/.buildwright/claws/TEMPLATE.md +0 -71
  22. package/templates/.buildwright/claws/backend.md +0 -114
  23. package/templates/.buildwright/claws/database.md +0 -120
  24. package/templates/.buildwright/claws/devops.md +0 -175
  25. package/templates/.buildwright/claws/frontend.md +0 -111
  26. package/templates/.buildwright/commands/bw-claw.md +0 -332
  27. package/templates/.buildwright/commands/bw-help.md +0 -88
  28. package/templates/.buildwright/commands/bw-new-feature.md +0 -539
  29. package/templates/.buildwright/commands/bw-quick.md +0 -336
  30. package/templates/.buildwright/steering/naming-conventions.md +0 -40
  31. package/templates/.buildwright/steering/product.md +0 -16
  32. package/templates/.buildwright/steering/quality-gates.md +0 -35
  33. package/templates/.buildwright/steering/tech.md +0 -27
  34. package/templates/.buildwright/tasks/TEMPLATE.md +0 -79
  35. package/templates/.github/workflows/quality-gates.yml +0 -135
  36. package/templates/docs/requirements/TEMPLATE.md +0 -33
@@ -1,539 +0,0 @@
1
- ---
2
- name: bw-new-feature
3
- description: Research codebase, generate spec, validate, get approval, implement with TDD, and ship
4
- arguments:
5
- - name: requirements
6
- description: Path to requirements file OR inline description of what to build
7
- required: true
8
- - name: skip-research
9
- description: Skip research phase (not recommended)
10
- required: false
11
- - name: parallel
12
- description: Enable parallel multi-agent implementation
13
- required: false
14
- ---
15
-
16
- ## Feature Development Pipeline
17
-
18
- ```
19
- ┌─────────────────────────────────────────────────────────────┐
20
- │ NEW FEATURE PIPELINE │
21
- ├─────────────────────────────────────────────────────────────┤
22
- │ 0. DETECT → Greenfield or existing project? │
23
- │ 1. RESEARCH → Deep-read codebase, understand context │
24
- │ 1.5. RESOLVE AMBIGUITIES → Auto-decide or ask user │
25
- │ 2. PLAN → Generate spec informed by research │
26
- │ 3. VALIDATE → Staff Engineer reviews spec (auto) │
27
- │ 4. APPROVE → Human reviews and says "approved" │
28
- │ 5. BUILD → TDD: test → implement → verify │
29
- │ 6. SHIP → verify → security → review → release │
30
- └─────────────────────────────────────────────────────────────┘
31
- ```
32
-
33
- ---
34
-
35
- ## Phase 0: Detect (Greenfield or Existing?)
36
-
37
- **Check for existing tech indicators:**
38
- - Language manifests: `package.json`, `Cargo.toml`, `go.mod`, `pyproject.toml`, `setup.py`
39
- - Dependency files: `requirements.txt`, lock files
40
- - Build files: `Makefile`, `build.gradle`, `CMakeLists.txt`
41
- - Source directories: `src/`, `lib/`, `app/`, `cmd/`
42
- - Git history: `git log --oneline -5` (any commits = existing project)
43
-
44
- **Decision:**
45
- - **Any found** → **Existing Project Path**: Run Tech Discovery Protocol (Command Discovery in CLAUDE.md), read steering docs, proceed to Phase 1.
46
- - **None found** → **Greenfield Path** (below).
47
-
48
- ### Greenfield Path
49
-
50
- 1. Ask ONE question:
51
- ```
52
- This looks like a new project. What is the product vision, and do you have any
53
- tech constraints (team expertise, deployment environment, integrations, compliance)?
54
- ```
55
- 2. **STOP and wait for the answer.** Do NOT proceed until answered.
56
- 3. Derive the stack from the answer — reason from: product type, team knowledge, deployment constraints, scale, compliance. **No hardcoded default stack.**
57
- 4. Generate `.buildwright/steering/product.md` and `.buildwright/steering/tech.md` from the answer.
58
- 5. At Phase 4 (Human Approval), present the proposed tech stack alongside the spec:
59
- ```
60
- PROPOSED TECH STACK
61
- ───────────────────
62
- [Stack derived from your requirements]
63
-
64
- Chosen because: [2-3 sentences linking requirements to stack choice]
65
- Alternatives considered: [brief list]
66
-
67
- Reply "approved" or adjust: "approved, but use X instead of Y"
68
- ```
69
- 6. After approval, finalize `tech.md` with actual commands so future runs use Step 1 of the discovery protocol.
70
-
71
- **Existing Project Priority Rule (always apply):**
72
- 1. Team's filled-in `tech.md` > auto-detection
73
- 2. Existing code patterns > Buildwright conventions
74
- 3. Existing deployment config (`Dockerfile`, `k8s/`, `compose.yml`) > DevOps claw defaults
75
- 4. Existing test patterns > TDD suggestions in claws
76
- 5. Never modify working infrastructure to match Buildwright defaults
77
-
78
- ---
79
-
80
- ## Phase 1: Understand Requirements
81
-
82
- If $ARGUMENTS.requirements is a file path, read it.
83
- Otherwise, treat it as an inline description.
84
-
85
- **Gather:**
86
- - What is being requested
87
- - User personas and goals
88
- - Constraints mentioned
89
- - Success criteria
90
-
91
- ---
92
-
93
- ## Phase 2: Research (CRITICAL)
94
-
95
- **Skip only if $ARGUMENTS.skip-research is set. Not recommended.**
96
-
97
- This phase prevents the #1 failure mode: code that works in isolation but breaks the surrounding system.
98
-
99
- ### 2.1 Read Steering Documents
100
-
101
- ```bash
102
- # Always read these first
103
- cat .buildwright/steering/product.md # Product context
104
- cat .buildwright/steering/tech.md # Tech stack, commands, patterns
105
- ```
106
-
107
- Extract:
108
- - Product vision and current focus
109
- - Tech stack and conventions
110
- - Existing patterns to follow
111
- - Commands to use
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
-
136
- ### 2.2 Deep-Read Relevant Codebase
137
-
138
- Based on the requirements, identify and deeply read relevant areas:
139
-
140
- ```bash
141
- # Find related files
142
- find . -type f -name "*.ts" | xargs grep -l "[relevant terms]"
143
-
144
- # Read each file thoroughly - understand, don't skim
145
- ```
146
-
147
- **Read with these questions:**
148
- - How does similar functionality work today?
149
- - What patterns are used for this type of feature?
150
- - What services/utilities already exist that I should use?
151
- - What types/structs already exist that I can reuse instead of creating new ones?
152
- - What would break if I change this?
153
-
154
- ### 2.3 Read Existing Tests
155
-
156
- ```bash
157
- # Find related tests
158
- find . -type f -name "*.test.*" -o -name "*.spec.*" | xargs grep -l "[relevant terms]"
159
- ```
160
-
161
- Understand:
162
- - How similar features are tested
163
- - Expected behaviors
164
- - Edge cases already handled
165
-
166
- ### 2.4 Write Research Document
167
-
168
- Create `docs/specs/[feature-name]/research.md`:
169
-
170
- ```markdown
171
- # Research: [Feature Name]
172
-
173
- ## Date
174
- [Current date]
175
-
176
- ## Requirements Summary
177
- [Brief summary of what's being built]
178
-
179
- ---
180
-
181
- ## Product Context
182
- [Relevant info from product.md]
183
- - Product vision alignment
184
- - Related features
185
- - User personas affected
186
-
187
- ---
188
-
189
- ## Technical Context
190
- [Relevant info from tech.md]
191
- - Stack components involved
192
- - Conventions to follow
193
- - Commands to use
194
-
195
- ---
196
-
197
- ## Codebase Analysis
198
-
199
- ### Relevant Files
200
- | File | Purpose | Key Functions |
201
- |------|---------|---------------|
202
- | [path] | [what it does] | [functions to use/extend] |
203
-
204
- ### Existing Patterns
205
- - [Pattern 1]: Used in [file], should follow for [reason]
206
- - [Pattern 2]: [description]
207
-
208
- ### Services/Utilities to Reuse
209
- - [Service]: [what it does, how to use]
210
- - [Utility]: [what it does, how to use]
211
-
212
- ### Reusable Types & Functions
213
- - [Function/Type]: [location] — [what it does, how to reuse]
214
- - [Function/Type]: [location] — [what it does, how to reuse]
215
-
216
- Flag any near-duplicates found during research. If two utilities do similar things,
217
- recommend which one to use and whether to consolidate.
218
-
219
- ### Integration Points
220
- - [System A]: Will need to integrate via [method]
221
- - [System B]: [description]
222
-
223
- ---
224
-
225
- ## Test Patterns
226
- - Similar features tested with: [approach]
227
- - Test utilities available: [list]
228
- - Coverage expectations: [from quality-gates.md]
229
-
230
- ---
231
-
232
- ## Risks & Considerations
233
- - [Risk 1]: [description and mitigation]
234
- - [Risk 2]: [description and mitigation]
235
-
236
- ---
237
-
238
- ## Recommendations for Implementation
239
- - Use [existing utility] for [purpose]
240
- - Follow [pattern] from [file]
241
- - Avoid [anti-pattern] because [reason]
242
- ```
243
-
244
- **This document becomes input for the planning phase.**
245
-
246
- ---
247
-
248
- ## Phase 1.5: Resolve Ambiguities (CRITICAL — DO NOT SKIP)
249
-
250
- Based on research findings, identify ALL underspecified aspects before designing:
251
-
252
- 1. Review the research document and original requirements
253
- 2. Identify gaps: edge cases, error handling, integration points, scope boundaries, backward compatibility, performance needs
254
-
255
- **If BUILDWRIGHT_AUTO_APPROVE is not set to `false` (default — autonomous mode):**
256
- - Make your best judgment for each ambiguity based on research findings
257
- - Document each decision and rationale in the research document under "Assumptions Made"
258
- - Prefer the simpler, safer, more conventional choice
259
- - Proceed directly to specification
260
-
261
- **If BUILDWRIGHT_AUTO_APPROVE=false (interactive mode):**
262
- - Present all questions to the user in a clear, organized list
263
- - Wait for answers before proceeding to specification
264
-
265
- This phase prevents the #2 failure mode: building the wrong thing because requirements were ambiguous.
266
-
267
- ---
268
-
269
- ## Phase 3: Generate Technical Specification
270
-
271
- Create `docs/specs/[feature-name]/spec.md`
272
-
273
- **The spec must reference and build upon research.md findings.**
274
-
275
- ### Section 1: Overview
276
- - Problem Statement
277
- - Success Metrics (measurable)
278
- - Scope (in/out)
279
-
280
- ### Section 2: Design Principles Applied
281
- - How KISS, YAGNI, no premature optimization are applied
282
- - **Reference existing patterns from research**
283
-
284
- ### Section 3: Approaches Considered (CRITICAL)
285
- - Design at least 2 approaches with different trade-off focuses:
286
- - **Minimal changes**: Smallest change, maximum reuse of existing code
287
- - **Clean architecture**: Best maintainability and elegant abstractions
288
- - **Pragmatic balance** (optional): Speed + quality middle ground
289
- - For each: pros/cons/complexity/estimate
290
- - **Autonomous mode**: Pick the best approach, document rationale
291
- - **Interactive mode**: Present recommendation and let user choose
292
- - **Reference existing patterns and code from research**
293
-
294
- ### Section 4: User Journeys
295
- - Primary flows with diagrams
296
- - Edge cases and handling
297
-
298
- ### Section 5: Technical Design
299
- - Architecture diagram
300
- - Data model (if applicable)
301
- - API design (if applicable)
302
- - **Reference existing services/utilities from research**
303
-
304
- ### Section 6: What We're NOT Doing
305
- - Explicit list of excluded features
306
- - Why each is excluded
307
-
308
- ### Section 7: Security Considerations
309
- - Input validation, auth, data protection
310
-
311
- ### Section 8: Testing Strategy
312
- - **Follow test patterns identified in research**
313
- - What to test, what NOT to test
314
-
315
- ### Section 9: Implementation Milestones
316
- - Each: independently deployable, 2-4 hours, clear done criteria
317
- - **Reference specific files/functions from research**
318
-
319
- ### Section 10: Open Questions & Assumptions
320
-
321
- ---
322
-
323
- ## Phase 4: Validate Specification (AUTO)
324
-
325
- Adopt Staff Engineer persona from `.buildwright/agents/staff-engineer.md`.
326
-
327
- Review the spec for:
328
- - Does it leverage existing patterns from research?
329
- - Problem clearly understood?
330
- - Approaches genuinely evaluated?
331
- - Design principles applied?
332
- - Risks identified?
333
- - Milestones realistic?
334
-
335
- Act on findings by severity:
336
- - **Critical Issues**: Fix in spec and re-validate. These block approval.
337
- - **Recommendations**: Fix if straightforward (< 5 min). Otherwise note as TODO in spec — address during implementation.
338
- - **Observations**: Acknowledge and move on. Do not modify spec.
339
-
340
- If zero critical issues remain → proceed to approval.
341
-
342
- ---
343
-
344
- ## Phase 5: Request Human Approval
345
-
346
- Present summary:
347
-
348
- ```
349
- ═══════════════════════════════════════════════════════════════
350
- SPECIFICATION COMPLETE
351
- ═══════════════════════════════════════════════════════════════
352
-
353
- Feature: [name]
354
- Research: docs/specs/[feature-name]/research.md
355
- Spec: docs/specs/[feature-name]/spec.md
356
-
357
- RESEARCH FINDINGS
358
- ─────────────────
359
- • Existing patterns to follow: [list]
360
- • Services to reuse: [list]
361
- • Key risks identified: [list]
362
-
363
- APPROACH CHOSEN
364
- ───────────────
365
- [Brief description]
366
-
367
- Considered [N] alternatives. Chose this because:
368
- • [Reason 1]
369
- • [Reason 2]
370
-
371
- MILESTONES
372
- ──────────
373
- 1. [Milestone 1] (~X hrs)
374
- 2. [Milestone 2] (~X hrs)
375
- 3. [Milestone 3] (~X hrs)
376
-
377
- Total: ~[X] hours
378
-
379
- STAFF ENGINEER REVIEW: ✅ Passed
380
-
381
- ═══════════════════════════════════════════════════════════════
382
-
383
- Please review:
384
- • docs/specs/[feature-name]/research.md (codebase analysis)
385
- • docs/specs/[feature-name]/spec.md (implementation plan)
386
-
387
- Reply "approved" to proceed with implementation.
388
- Reply with feedback to revise.
389
- ═══════════════════════════════════════════════════════════════
390
- ```
391
-
392
- **If BUILDWRIGHT_AUTO_APPROVE is not set to `false` (default — autonomous mode):**
393
- - Commit spec to git (audit trail): `docs: add spec for [feature-name]`
394
- - Proceed directly to Phase 6: Implement
395
-
396
- **If BUILDWRIGHT_AUTO_APPROVE=false (interactive mode):**
397
- - STOP and wait for human to say "approved".
398
-
399
- ---
400
-
401
- ## Phase 6: Implement (After Approval)
402
-
403
- ### Detect Implementation Mode
404
-
405
- **Single-domain or small scope** → Sequential implementation (below)
406
-
407
- **Multi-domain (3+ independent components, 8+ hours, crosses layer boundaries)** → Recommend Claw Architecture:
408
-
409
- ```
410
- ╔═══════════════════════════════════════════════════════════════╗
411
- ║ MULTI-DOMAIN FEATURE DETECTED ║
412
- ╠═══════════════════════════════════════════════════════════════╣
413
- ║ ║
414
- ║ This feature touches [N] domains: [list] ║
415
- ║ ║
416
- ║ Recommendation: Use /bw-claw for multi-agent execution ║
417
- ║ ║
418
- ║ Benefits: ║
419
- ║ • Each domain gets a specialist agent (claw) ║
420
- ║ • Interface contracts prevent integration failures ║
421
- ║ • Parallel execution where possible ║
422
- ║ ║
423
- ║ /bw-claw "[feature description]" ║
424
- ║ ║
425
- ║ Or say "continue" to proceed with single-agent mode. ║
426
- ╚═══════════════════════════════════════════════════════════════╝
427
- ```
428
-
429
- If parallel selected, $ARGUMENTS.parallel set, or user says "claw":
430
- - Switch to `/bw-claw` pipeline
431
- - STOP this command
432
-
433
- ### Sequential Implementation (Default)
434
-
435
- For each milestone:
436
-
437
- 1. **Write tests first (TDD)**
438
- - Follow test patterns from research.md
439
- - Create failing tests
440
- - Commit: `test: add tests for [milestone]`
441
-
442
- 2. **Implement**
443
- - Follow patterns identified in research.md
444
- - Use existing services/utilities discovered — do NOT reimplement
445
- - Reuse existing types and structures — create new ones only when no existing type fits
446
- - If you find yourself writing logic that resembles something in the codebase, stop and reuse or extract
447
- - Write minimal code to pass tests
448
- - Remember: KISS, YAGNI, DRY
449
-
450
- 3. **Verify (with retry)**
451
- ```bash
452
- [typecheck] [lint] [test] [build]
453
- ```
454
- - If fails → Fix and retry (up to BUILDWRIGHT_AGENT_RETRIES attempts, default 2)
455
- - If same error repeats → Not making progress — handle failure (see below)
456
- - If still failing after retries → Handle failure:
457
- - **Autonomous** (`BUILDWRIGHT_AUTO_APPROVE=true`, default): Commit completed milestones, push branch, create PR with failure summary (see BUILDWRIGHT.md template), exit(1).
458
- - **Interactive** (`BUILDWRIGHT_AUTO_APPROVE=false`): STOP and report blocker.
459
-
460
- 4. **If ALL pass:** Run milestone quality check, then commit.
461
-
462
- ### Milestone Quality Check
463
-
464
- After each milestone passes verification, briefly self-review for:
465
- - **Simplicity**: Is this the simplest solution? Any unnecessary complexity?
466
- - **Duplication**: Does this duplicate existing functions, types, or logic? Can anything be reused or extracted?
467
- - **Necessity**: Is every new type, abstraction, and code path required by the current requirements? Remove anything speculative.
468
- - **Correctness**: Any logic errors or missed edge cases in the new code?
469
- - **Conventions**: Does the new code follow established project patterns?
470
-
471
- Only flag HIGH SIGNAL issues (confidence ≥ 80). Fix issues autonomously — don't gold-plate, ship what works.
472
-
473
- 5. **Commit:** `feat([scope]): [description]`
474
-
475
- ---
476
-
477
- ## Phase 6.5: Update Project Documentation
478
-
479
- Based on what you just implemented, identify which documentation files are affected
480
- and update them. Common candidates:
481
-
482
- - **README.md** — new commands, env vars, setup steps, or usage changed
483
- - **docs/** — any guides or API reference covering the changed functionality
484
- - **CHANGELOG.md** — add an entry for any user-facing change
485
-
486
- State up front which files you will update (e.g. "Updating README.md: adding env var X").
487
- Skip entirely if nothing user-facing changed (internal refactor, test-only changes).
488
-
489
- If docs were updated, commit them before calling `/bw-ship`:
490
- ```bash
491
- git add [doc files]
492
- git commit -m "docs: update documentation for [feature-name]"
493
- ```
494
-
495
- ---
496
-
497
- ## Phase 7: Ship
498
-
499
- Run `/bw-ship` which chains:
500
- 1. verify → typecheck, lint, test, build
501
- 2. security → OWASP, SAST, secrets, deps
502
- 3. review → Staff Engineer code review
503
- 4. release → commit, push, PR
504
-
505
- `/bw-ship` handles autonomous failure internally — if any step fails in autonomous mode, it commits completed work, pushes, creates a failed PR, and exits(1). See ship.md for details.
506
-
507
- ---
508
-
509
- ## Final Report
510
-
511
- ```
512
- ═══════════════════════════════════════════════════════════════
513
- FEATURE COMPLETE
514
- ═══════════════════════════════════════════════════════════════
515
-
516
- Feature: [name]
517
- Branch: feature/[feature-name]
518
- PR: [URL]
519
-
520
- ARTIFACTS
521
- ─────────
522
- • Research: docs/specs/[feature-name]/research.md
523
- • Spec: docs/specs/[feature-name]/spec.md
524
-
525
- PIPELINE STATUS
526
- ───────────────
527
- ✅ Research Complete
528
- ✅ Spec Generated
529
- ✅ Spec Reviewed (Staff Engineer)
530
- ✅ Human Approved
531
- ✅ Implemented (TDD)
532
- ✅ Verified
533
- ✅ Security Reviewed
534
- ✅ Code Reviewed (Staff Engineer)
535
- ✅ Shipped
536
-
537
- Quality gates running in CI. PR ready for team review.
538
- ═══════════════════════════════════════════════════════════════
539
- ```