buildwright 0.0.10 → 0.0.11
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 +2 -1
- package/package.json +1 -1
- package/templates/.buildwright/agents/staff-engineer.md +4 -0
- package/templates/.buildwright/commands/bw-new-feature.md +15 -3
- package/templates/.buildwright/commands/bw-quick.md +3 -1
- package/templates/.buildwright/commands/bw-ship.md +2 -2
- package/templates/.buildwright/steering/quality-gates.md +2 -2
- package/templates/.github/workflows/quality-gates.yml +0 -15
- package/templates/CLAUDE.md +8 -0
- package/templates/scripts/sync-agents.sh +10 -2
package/README.md
CHANGED
|
@@ -369,7 +369,8 @@ Every spec and implementation follows:
|
|
|
369
369
|
| Principle | Meaning |
|
|
370
370
|
|-----------|---------|
|
|
371
371
|
| **KISS** | Keep It Simple — prefer simple over clever |
|
|
372
|
-
| **YAGNI** | You Aren't Gonna Need It — build only what's needed now |
|
|
372
|
+
| **YAGNI** | You Aren't Gonna Need It — build only what's needed now, no speculative abstractions |
|
|
373
|
+
| **DRY** | Don't Repeat Yourself — reuse existing code, extract common logic |
|
|
373
374
|
| **No Premature Optimization** | Make it work first, optimize with data |
|
|
374
375
|
| **Boring Technology** | Proven tools over shiny new ones |
|
|
375
376
|
| **Fail Fast** | Validate early, error loudly |
|
package/package.json
CHANGED
|
@@ -35,6 +35,8 @@ You are a **Staff Engineer** with 15+ years of experience building production sy
|
|
|
35
35
|
- Security vulnerabilities
|
|
36
36
|
- Performance foot-guns
|
|
37
37
|
- Unnecessary complexity
|
|
38
|
+
- Duplicated logic that should reuse existing functions or be extracted into shared utilities
|
|
39
|
+
- Unnecessary new types or abstractions when existing ones suffice
|
|
38
40
|
- Missing validation
|
|
39
41
|
- Poor abstractions
|
|
40
42
|
- Technical debt being introduced
|
|
@@ -107,6 +109,8 @@ Only flag issues where:
|
|
|
107
109
|
- Security vulnerabilities with a concrete exploit path (defer to security phase in /bw-ship)
|
|
108
110
|
- Data loss or corruption risk with a traceable scenario
|
|
109
111
|
- Missing validation at system boundaries where untrusted input enters
|
|
112
|
+
- Reimplemented logic that already exists elsewhere in the codebase (DRY violation with concrete duplicate identified)
|
|
113
|
+
- New types, wrappers, or abstractions not required by current requirements (YAGNI violation)
|
|
110
114
|
|
|
111
115
|
Do NOT flag:
|
|
112
116
|
- Potential issues that depend on specific inputs or runtime state
|
|
@@ -148,6 +148,7 @@ find . -type f -name "*.ts" | xargs grep -l "[relevant terms]"
|
|
|
148
148
|
- How does similar functionality work today?
|
|
149
149
|
- What patterns are used for this type of feature?
|
|
150
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?
|
|
151
152
|
- What would break if I change this?
|
|
152
153
|
|
|
153
154
|
### 2.3 Read Existing Tests
|
|
@@ -208,6 +209,13 @@ Create `docs/specs/[feature-name]/research.md`:
|
|
|
208
209
|
- [Service]: [what it does, how to use]
|
|
209
210
|
- [Utility]: [what it does, how to use]
|
|
210
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
|
+
|
|
211
219
|
### Integration Points
|
|
212
220
|
- [System A]: Will need to integrate via [method]
|
|
213
221
|
- [System B]: [description]
|
|
@@ -433,9 +441,11 @@ For each milestone:
|
|
|
433
441
|
|
|
434
442
|
2. **Implement**
|
|
435
443
|
- Follow patterns identified in research.md
|
|
436
|
-
- Use existing services/utilities discovered
|
|
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
|
|
437
447
|
- Write minimal code to pass tests
|
|
438
|
-
- Remember: KISS, YAGNI
|
|
448
|
+
- Remember: KISS, YAGNI, DRY
|
|
439
449
|
|
|
440
450
|
3. **Verify (with retry)**
|
|
441
451
|
```bash
|
|
@@ -453,6 +463,8 @@ For each milestone:
|
|
|
453
463
|
|
|
454
464
|
After each milestone passes verification, briefly self-review for:
|
|
455
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.
|
|
456
468
|
- **Correctness**: Any logic errors or missed edge cases in the new code?
|
|
457
469
|
- **Conventions**: Does the new code follow established project patterns?
|
|
458
470
|
|
|
@@ -522,6 +534,6 @@ PIPELINE STATUS
|
|
|
522
534
|
✅ Code Reviewed (Staff Engineer)
|
|
523
535
|
✅ Shipped
|
|
524
536
|
|
|
525
|
-
Quality gates running in CI.
|
|
537
|
+
Quality gates running in CI. PR ready for team review.
|
|
526
538
|
═══════════════════════════════════════════════════════════════
|
|
527
539
|
```
|
|
@@ -96,6 +96,7 @@ find . -name "*.test.*" -o -name "*.spec.*" | xargs grep -l "[relevant terms]"
|
|
|
96
96
|
Understand:
|
|
97
97
|
- Current implementation
|
|
98
98
|
- Patterns used in these files
|
|
99
|
+
- Existing functions, types, and utilities that can be reused instead of reimplemented
|
|
99
100
|
- Related tests
|
|
100
101
|
|
|
101
102
|
**Do NOT write a research document. Keep it in context.**
|
|
@@ -122,8 +123,9 @@ Commit: `test: add test for [task]`
|
|
|
122
123
|
|
|
123
124
|
- Fix the bug / add the feature
|
|
124
125
|
- Follow existing patterns in the file
|
|
126
|
+
- Reuse existing functions and types — do NOT reimplement what already exists
|
|
125
127
|
- Minimal changes only
|
|
126
|
-
- KISS, YAGNI
|
|
128
|
+
- KISS, YAGNI, DRY
|
|
127
129
|
|
|
128
130
|
### 3.3 Update Documentation
|
|
129
131
|
|
|
@@ -153,7 +153,7 @@ git diff HEAD
|
|
|
153
153
|
|
|
154
154
|
**Phase A — Repository Context:** Understand existing patterns, conventions, error handling, and testing approaches.
|
|
155
155
|
|
|
156
|
-
**Phase B — Comparative Analysis:** Does new code follow established patterns? Does it bypass or weaken existing controls?
|
|
156
|
+
**Phase B — Comparative Analysis:** Does new code follow established patterns? Does it reuse existing utilities and types instead of reimplementing? Does it bypass or weaken existing controls?
|
|
157
157
|
|
|
158
158
|
**Phase C — Issue Assessment:** Review changes for real issues. For each: verify it's real, confirm it was INTRODUCED by these changes, assign confidence (only report ≥ 80).
|
|
159
159
|
|
|
@@ -236,7 +236,7 @@ If `gh` is not available, provide the PR creation URL.
|
|
|
236
236
|
╠═══════════════════════════════════════════════════════════════╣
|
|
237
237
|
║ ║
|
|
238
238
|
║ Quality gates will run in CI. ║
|
|
239
|
-
║ PR
|
|
239
|
+
║ PR ready for team review when all gates pass. ║
|
|
240
240
|
║ ║
|
|
241
241
|
╚═══════════════════════════════════════════════════════════════╝
|
|
242
242
|
```
|
|
@@ -31,5 +31,5 @@ These automated gates replace human code review. ALL must pass for merge.
|
|
|
31
31
|
- [ ] Rate limiting on sensitive endpoints
|
|
32
32
|
- [ ] Audit logging for transactions
|
|
33
33
|
|
|
34
|
-
##
|
|
35
|
-
When ALL gates pass → PR
|
|
34
|
+
## Merge Policy
|
|
35
|
+
When ALL gates pass → PR is ready for merge (team follows their own merge process)
|
|
@@ -133,18 +133,3 @@ jobs:
|
|
|
133
133
|
go) govulncheck ./... || echo "govulncheck not installed" ;;
|
|
134
134
|
python) pip-audit || safety check || echo "No Python audit tool" ;;
|
|
135
135
|
esac
|
|
136
|
-
|
|
137
|
-
auto-merge:
|
|
138
|
-
needs: quality
|
|
139
|
-
runs-on: ubuntu-latest
|
|
140
|
-
if: github.event_name == 'pull_request'
|
|
141
|
-
permissions:
|
|
142
|
-
contents: write
|
|
143
|
-
pull-requests: write
|
|
144
|
-
steps:
|
|
145
|
-
- name: Auto-merge on quality pass
|
|
146
|
-
uses: pascalgn/automerge-action@v0.15.6
|
|
147
|
-
env:
|
|
148
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
149
|
-
MERGE_METHOD: squash
|
|
150
|
-
MERGE_LABELS: ""
|
package/templates/CLAUDE.md
CHANGED
|
@@ -119,6 +119,8 @@ When a feature touches multiple domains (e.g., DB + API + UI):
|
|
|
119
119
|
- Build only what's required NOW
|
|
120
120
|
- No speculative features "for later"
|
|
121
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
|
|
122
124
|
|
|
123
125
|
3. **No Premature Optimization**
|
|
124
126
|
- Make it work first, then make it fast (if needed)
|
|
@@ -135,6 +137,12 @@ When a feature touches multiple domains (e.g., DB + API + UI):
|
|
|
135
137
|
- Throw errors early with clear messages
|
|
136
138
|
- No silent failures
|
|
137
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
|
+
|
|
138
146
|
## Code Standards
|
|
139
147
|
- Follow existing patterns in the codebase exactly
|
|
140
148
|
- Keep files under 500 lines; split proactively
|
|
@@ -60,7 +60,11 @@ sync_dir() {
|
|
|
60
60
|
tmpdir=$(mktemp -d)
|
|
61
61
|
cp -R "$src/"* "$tmpdir/" 2>/dev/null || true
|
|
62
62
|
if [ -n "$rewrite_from" ] && [ -n "$rewrite_to" ]; then
|
|
63
|
-
|
|
63
|
+
# Only rewrite @@.buildwright/ (read instructions) → tool-specific path
|
|
64
|
+
# Bare .buildwright/ (write/canonical instructions) stays untouched
|
|
65
|
+
find "$tmpdir" -name "*.md" -exec sed -i '' \
|
|
66
|
+
-e "s|@@${rewrite_from}|${rewrite_to}|g" \
|
|
67
|
+
{} + 2>/dev/null || true
|
|
64
68
|
fi
|
|
65
69
|
if ! diff -rq "$tmpdir" "$dst" > /dev/null 2>&1; then
|
|
66
70
|
echo "OUT OF SYNC: $dst differs from $src"
|
|
@@ -71,8 +75,12 @@ sync_dir() {
|
|
|
71
75
|
mkdir -p "$dst"
|
|
72
76
|
rsync -a --delete "$src/" "$dst/" 2>/dev/null || (rm -rf "$dst"/* && cp -R "$src/"* "$dst/")
|
|
73
77
|
# Rewrite path references for tool-specific copies
|
|
78
|
+
# @@.buildwright/ = "resolve to tool-specific dir" → gets rewritten
|
|
79
|
+
# Bare .buildwright/ = "canonical path" → stays untouched
|
|
74
80
|
if [ -n "$rewrite_from" ] && [ -n "$rewrite_to" ]; then
|
|
75
|
-
find "$dst" -name "*.md" -exec sed -i
|
|
81
|
+
find "$dst" -name "*.md" -exec sed -i '' \
|
|
82
|
+
-e "s|@@${rewrite_from}|${rewrite_to}|g" \
|
|
83
|
+
{} + 2>/dev/null || true
|
|
76
84
|
fi
|
|
77
85
|
echo " synced $src → $dst"
|
|
78
86
|
fi
|