buildwright 0.0.5 → 0.0.7

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 (41) hide show
  1. package/package.json +1 -1
  2. package/templates/.buildwright/agents/README.md +53 -0
  3. package/templates/.buildwright/agents/architect.md +143 -0
  4. package/templates/.buildwright/agents/security-engineer.md +193 -0
  5. package/templates/.buildwright/agents/staff-engineer.md +134 -0
  6. package/templates/.buildwright/claws/README.md +89 -0
  7. package/templates/.buildwright/claws/TEMPLATE.md +71 -0
  8. package/templates/.buildwright/claws/backend.md +114 -0
  9. package/templates/.buildwright/claws/database.md +120 -0
  10. package/templates/.buildwright/claws/devops.md +175 -0
  11. package/templates/.buildwright/claws/frontend.md +111 -0
  12. package/templates/.buildwright/commands/bw-analyse.md +86 -0
  13. package/templates/.buildwright/commands/bw-claw.md +332 -0
  14. package/templates/.buildwright/commands/bw-help.md +85 -0
  15. package/templates/.buildwright/commands/bw-new-feature.md +504 -0
  16. package/templates/.buildwright/commands/bw-quick.md +323 -0
  17. package/templates/.buildwright/commands/bw-ship.md +288 -0
  18. package/templates/.buildwright/commands/bw-verify.md +108 -0
  19. package/templates/.buildwright/steering/naming-conventions.md +40 -0
  20. package/templates/.buildwright/steering/product.md +16 -0
  21. package/templates/.buildwright/steering/quality-gates.md +35 -0
  22. package/templates/.buildwright/steering/tech.md +27 -0
  23. package/templates/.buildwright/tasks/TEMPLATE.md +79 -0
  24. package/templates/.env.example +11 -1
  25. package/templates/.github/workflows/quality-gates.yml +150 -0
  26. package/templates/BUILDWRIGHT.md +99 -1
  27. package/templates/CLAUDE.md +150 -1
  28. package/templates/Makefile +86 -1
  29. package/templates/docs/requirements/TEMPLATE.md +33 -0
  30. package/templates/scripts/bump-version.sh +33 -0
  31. package/templates/scripts/hooks/post-checkout +24 -0
  32. package/templates/scripts/hooks/post-merge +14 -0
  33. package/templates/scripts/hooks/pre-commit +14 -0
  34. package/templates/scripts/install-hooks.sh +35 -0
  35. package/templates/scripts/release.sh +38 -0
  36. package/templates/scripts/sync-agents.sh +294 -0
  37. package/templates/scripts/validate-skill.sh +156 -0
  38. package/templates/.buildwright +0 -1
  39. package/templates/.github +0 -1
  40. package/templates/docs +0 -1
  41. package/templates/scripts +0 -1
@@ -0,0 +1,504 @@
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.2 Deep-Read Relevant Codebase
114
+
115
+ Based on the requirements, identify and deeply read relevant areas:
116
+
117
+ ```bash
118
+ # Find related files
119
+ find . -type f -name "*.ts" | xargs grep -l "[relevant terms]"
120
+
121
+ # Read each file thoroughly - understand, don't skim
122
+ ```
123
+
124
+ **Read with these questions:**
125
+ - How does similar functionality work today?
126
+ - What patterns are used for this type of feature?
127
+ - What services/utilities already exist that I should use?
128
+ - What would break if I change this?
129
+
130
+ ### 2.3 Read Existing Tests
131
+
132
+ ```bash
133
+ # Find related tests
134
+ find . -type f -name "*.test.*" -o -name "*.spec.*" | xargs grep -l "[relevant terms]"
135
+ ```
136
+
137
+ Understand:
138
+ - How similar features are tested
139
+ - Expected behaviors
140
+ - Edge cases already handled
141
+
142
+ ### 2.4 Write Research Document
143
+
144
+ Create `docs/specs/[feature-name]/research.md`:
145
+
146
+ ```markdown
147
+ # Research: [Feature Name]
148
+
149
+ ## Date
150
+ [Current date]
151
+
152
+ ## Requirements Summary
153
+ [Brief summary of what's being built]
154
+
155
+ ---
156
+
157
+ ## Product Context
158
+ [Relevant info from product.md]
159
+ - Product vision alignment
160
+ - Related features
161
+ - User personas affected
162
+
163
+ ---
164
+
165
+ ## Technical Context
166
+ [Relevant info from tech.md]
167
+ - Stack components involved
168
+ - Conventions to follow
169
+ - Commands to use
170
+
171
+ ---
172
+
173
+ ## Codebase Analysis
174
+
175
+ ### Relevant Files
176
+ | File | Purpose | Key Functions |
177
+ |------|---------|---------------|
178
+ | [path] | [what it does] | [functions to use/extend] |
179
+
180
+ ### Existing Patterns
181
+ - [Pattern 1]: Used in [file], should follow for [reason]
182
+ - [Pattern 2]: [description]
183
+
184
+ ### Services/Utilities to Reuse
185
+ - [Service]: [what it does, how to use]
186
+ - [Utility]: [what it does, how to use]
187
+
188
+ ### Integration Points
189
+ - [System A]: Will need to integrate via [method]
190
+ - [System B]: [description]
191
+
192
+ ---
193
+
194
+ ## Test Patterns
195
+ - Similar features tested with: [approach]
196
+ - Test utilities available: [list]
197
+ - Coverage expectations: [from quality-gates.md]
198
+
199
+ ---
200
+
201
+ ## Risks & Considerations
202
+ - [Risk 1]: [description and mitigation]
203
+ - [Risk 2]: [description and mitigation]
204
+
205
+ ---
206
+
207
+ ## Recommendations for Implementation
208
+ - Use [existing utility] for [purpose]
209
+ - Follow [pattern] from [file]
210
+ - Avoid [anti-pattern] because [reason]
211
+ ```
212
+
213
+ **This document becomes input for the planning phase.**
214
+
215
+ ---
216
+
217
+ ## Phase 1.5: Resolve Ambiguities (CRITICAL — DO NOT SKIP)
218
+
219
+ Based on research findings, identify ALL underspecified aspects before designing:
220
+
221
+ 1. Review the research document and original requirements
222
+ 2. Identify gaps: edge cases, error handling, integration points, scope boundaries, backward compatibility, performance needs
223
+
224
+ **If BUILDWRIGHT_AUTO_APPROVE is not set to `false` (default — autonomous mode):**
225
+ - Make your best judgment for each ambiguity based on research findings
226
+ - Document each decision and rationale in the research document under "Assumptions Made"
227
+ - Prefer the simpler, safer, more conventional choice
228
+ - Proceed directly to specification
229
+
230
+ **If BUILDWRIGHT_AUTO_APPROVE=false (interactive mode):**
231
+ - Present all questions to the user in a clear, organized list
232
+ - Wait for answers before proceeding to specification
233
+
234
+ This phase prevents the #2 failure mode: building the wrong thing because requirements were ambiguous.
235
+
236
+ ---
237
+
238
+ ## Phase 3: Generate Technical Specification
239
+
240
+ Create `docs/specs/[feature-name]/spec.md`
241
+
242
+ **The spec must reference and build upon research.md findings.**
243
+
244
+ ### Section 1: Overview
245
+ - Problem Statement
246
+ - Success Metrics (measurable)
247
+ - Scope (in/out)
248
+
249
+ ### Section 2: Design Principles Applied
250
+ - How KISS, YAGNI, no premature optimization are applied
251
+ - **Reference existing patterns from research**
252
+
253
+ ### Section 3: Approaches Considered (CRITICAL)
254
+ - Design at least 2 approaches with different trade-off focuses:
255
+ - **Minimal changes**: Smallest change, maximum reuse of existing code
256
+ - **Clean architecture**: Best maintainability and elegant abstractions
257
+ - **Pragmatic balance** (optional): Speed + quality middle ground
258
+ - For each: pros/cons/complexity/estimate
259
+ - **Autonomous mode**: Pick the best approach, document rationale
260
+ - **Interactive mode**: Present recommendation and let user choose
261
+ - **Reference existing patterns and code from research**
262
+
263
+ ### Section 4: User Journeys
264
+ - Primary flows with diagrams
265
+ - Edge cases and handling
266
+
267
+ ### Section 5: Technical Design
268
+ - Architecture diagram
269
+ - Data model (if applicable)
270
+ - API design (if applicable)
271
+ - **Reference existing services/utilities from research**
272
+
273
+ ### Section 6: What We're NOT Doing
274
+ - Explicit list of excluded features
275
+ - Why each is excluded
276
+
277
+ ### Section 7: Security Considerations
278
+ - Input validation, auth, data protection
279
+
280
+ ### Section 8: Testing Strategy
281
+ - **Follow test patterns identified in research**
282
+ - What to test, what NOT to test
283
+
284
+ ### Section 9: Implementation Milestones
285
+ - Each: independently deployable, 2-4 hours, clear done criteria
286
+ - **Reference specific files/functions from research**
287
+
288
+ ### Section 10: Open Questions & Assumptions
289
+
290
+ ---
291
+
292
+ ## Phase 4: Validate Specification (AUTO)
293
+
294
+ Adopt Staff Engineer persona from `.buildwright/agents/staff-engineer.md`.
295
+
296
+ Review the spec for:
297
+ - Does it leverage existing patterns from research?
298
+ - Problem clearly understood?
299
+ - Approaches genuinely evaluated?
300
+ - Design principles applied?
301
+ - Risks identified?
302
+ - Milestones realistic?
303
+
304
+ Act on findings by severity:
305
+ - **Critical Issues**: Fix in spec and re-validate. These block approval.
306
+ - **Recommendations**: Fix if straightforward (< 5 min). Otherwise note as TODO in spec — address during implementation.
307
+ - **Observations**: Acknowledge and move on. Do not modify spec.
308
+
309
+ If zero critical issues remain → proceed to approval.
310
+
311
+ ---
312
+
313
+ ## Phase 5: Request Human Approval
314
+
315
+ Present summary:
316
+
317
+ ```
318
+ ═══════════════════════════════════════════════════════════════
319
+ SPECIFICATION COMPLETE
320
+ ═══════════════════════════════════════════════════════════════
321
+
322
+ Feature: [name]
323
+ Research: docs/specs/[feature-name]/research.md
324
+ Spec: docs/specs/[feature-name]/spec.md
325
+
326
+ RESEARCH FINDINGS
327
+ ─────────────────
328
+ • Existing patterns to follow: [list]
329
+ • Services to reuse: [list]
330
+ • Key risks identified: [list]
331
+
332
+ APPROACH CHOSEN
333
+ ───────────────
334
+ [Brief description]
335
+
336
+ Considered [N] alternatives. Chose this because:
337
+ • [Reason 1]
338
+ • [Reason 2]
339
+
340
+ MILESTONES
341
+ ──────────
342
+ 1. [Milestone 1] (~X hrs)
343
+ 2. [Milestone 2] (~X hrs)
344
+ 3. [Milestone 3] (~X hrs)
345
+
346
+ Total: ~[X] hours
347
+
348
+ STAFF ENGINEER REVIEW: ✅ Passed
349
+
350
+ ═══════════════════════════════════════════════════════════════
351
+
352
+ Please review:
353
+ • docs/specs/[feature-name]/research.md (codebase analysis)
354
+ • docs/specs/[feature-name]/spec.md (implementation plan)
355
+
356
+ Reply "approved" to proceed with implementation.
357
+ Reply with feedback to revise.
358
+ ═══════════════════════════════════════════════════════════════
359
+ ```
360
+
361
+ **If BUILDWRIGHT_AUTO_APPROVE is not set to `false` (default — autonomous mode):**
362
+ - Commit spec to git (audit trail): `docs: add spec for [feature-name]`
363
+ - Proceed directly to Phase 6: Implement
364
+
365
+ **If BUILDWRIGHT_AUTO_APPROVE=false (interactive mode):**
366
+ - STOP and wait for human to say "approved".
367
+
368
+ ---
369
+
370
+ ## Phase 6: Implement (After Approval)
371
+
372
+ ### Detect Implementation Mode
373
+
374
+ **Single-domain or small scope** → Sequential implementation (below)
375
+
376
+ **Multi-domain (3+ independent components, 8+ hours, crosses layer boundaries)** → Recommend Claw Architecture:
377
+
378
+ ```
379
+ ╔═══════════════════════════════════════════════════════════════╗
380
+ ║ MULTI-DOMAIN FEATURE DETECTED ║
381
+ ╠═══════════════════════════════════════════════════════════════╣
382
+ ║ ║
383
+ ║ This feature touches [N] domains: [list] ║
384
+ ║ ║
385
+ ║ Recommendation: Use /bw-claw for multi-agent execution ║
386
+ ║ ║
387
+ ║ Benefits: ║
388
+ ║ • Each domain gets a specialist agent (claw) ║
389
+ ║ • Interface contracts prevent integration failures ║
390
+ ║ • Parallel execution where possible ║
391
+ ║ ║
392
+ ║ /bw-claw "[feature description]" ║
393
+ ║ ║
394
+ ║ Or say "continue" to proceed with single-agent mode. ║
395
+ ╚═══════════════════════════════════════════════════════════════╝
396
+ ```
397
+
398
+ If parallel selected, $ARGUMENTS.parallel set, or user says "claw":
399
+ - Switch to `/bw-claw` pipeline
400
+ - STOP this command
401
+
402
+ ### Sequential Implementation (Default)
403
+
404
+ For each milestone:
405
+
406
+ 1. **Write tests first (TDD)**
407
+ - Follow test patterns from research.md
408
+ - Create failing tests
409
+ - Commit: `test: add tests for [milestone]`
410
+
411
+ 2. **Implement**
412
+ - Follow patterns identified in research.md
413
+ - Use existing services/utilities discovered
414
+ - Write minimal code to pass tests
415
+ - Remember: KISS, YAGNI
416
+
417
+ 3. **Verify (with retry)**
418
+ ```bash
419
+ [typecheck] [lint] [test] [build]
420
+ ```
421
+ - If fails → Fix and retry (up to BUILDWRIGHT_AGENT_RETRIES attempts, default 2)
422
+ - If same error repeats → Not making progress — handle failure (see below)
423
+ - If still failing after retries → Handle failure:
424
+ - **Autonomous** (`BUILDWRIGHT_AUTO_APPROVE=true`, default): Commit completed milestones, push branch, create PR with failure summary (see BUILDWRIGHT.md template), exit(1).
425
+ - **Interactive** (`BUILDWRIGHT_AUTO_APPROVE=false`): STOP and report blocker.
426
+
427
+ 4. **If ALL pass:** Run milestone quality check, then commit.
428
+
429
+ ### Milestone Quality Check
430
+
431
+ After each milestone passes verification, briefly self-review for:
432
+ - **Simplicity**: Is this the simplest solution? Any unnecessary complexity?
433
+ - **Correctness**: Any logic errors or missed edge cases in the new code?
434
+ - **Conventions**: Does the new code follow established project patterns?
435
+
436
+ Only flag HIGH SIGNAL issues (confidence ≥ 80). Fix issues autonomously — don't gold-plate, ship what works.
437
+
438
+ 5. **Commit:** `feat([scope]): [description]`
439
+
440
+ ---
441
+
442
+ ## Phase 6.5: Update Project Documentation
443
+
444
+ Based on what you just implemented, identify which documentation files are affected
445
+ and update them. Common candidates:
446
+
447
+ - **README.md** — new commands, env vars, setup steps, or usage changed
448
+ - **docs/** — any guides or API reference covering the changed functionality
449
+ - **CHANGELOG.md** — add an entry for any user-facing change
450
+
451
+ State up front which files you will update (e.g. "Updating README.md: adding env var X").
452
+ Skip entirely if nothing user-facing changed (internal refactor, test-only changes).
453
+
454
+ If docs were updated, commit them before calling `/bw-ship`:
455
+ ```bash
456
+ git add [doc files]
457
+ git commit -m "docs: update documentation for [feature-name]"
458
+ ```
459
+
460
+ ---
461
+
462
+ ## Phase 7: Ship
463
+
464
+ Run `/bw-ship` which chains:
465
+ 1. verify → typecheck, lint, test, build
466
+ 2. security → OWASP, SAST, secrets, deps
467
+ 3. review → Staff Engineer code review
468
+ 4. release → commit, push, PR
469
+
470
+ `/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.
471
+
472
+ ---
473
+
474
+ ## Final Report
475
+
476
+ ```
477
+ ═══════════════════════════════════════════════════════════════
478
+ FEATURE COMPLETE
479
+ ═══════════════════════════════════════════════════════════════
480
+
481
+ Feature: [name]
482
+ Branch: feature/[feature-name]
483
+ PR: [URL]
484
+
485
+ ARTIFACTS
486
+ ─────────
487
+ • Research: docs/specs/[feature-name]/research.md
488
+ • Spec: docs/specs/[feature-name]/spec.md
489
+
490
+ PIPELINE STATUS
491
+ ───────────────
492
+ ✅ Research Complete
493
+ ✅ Spec Generated
494
+ ✅ Spec Reviewed (Staff Engineer)
495
+ ✅ Human Approved
496
+ ✅ Implemented (TDD)
497
+ ✅ Verified
498
+ ✅ Security Reviewed
499
+ ✅ Code Reviewed (Staff Engineer)
500
+ ✅ Shipped
501
+
502
+ Quality gates running in CI. Will auto-merge on pass.
503
+ ═══════════════════════════════════════════════════════════════
504
+ ```