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.
- package/package.json +1 -1
- package/templates/.buildwright/agents/README.md +53 -0
- package/templates/.buildwright/agents/architect.md +143 -0
- package/templates/.buildwright/agents/security-engineer.md +193 -0
- package/templates/.buildwright/agents/staff-engineer.md +134 -0
- package/templates/.buildwright/claws/README.md +89 -0
- package/templates/.buildwright/claws/TEMPLATE.md +71 -0
- package/templates/.buildwright/claws/backend.md +114 -0
- package/templates/.buildwright/claws/database.md +120 -0
- package/templates/.buildwright/claws/devops.md +175 -0
- package/templates/.buildwright/claws/frontend.md +111 -0
- package/templates/.buildwright/commands/bw-analyse.md +86 -0
- package/templates/.buildwright/commands/bw-claw.md +332 -0
- package/templates/.buildwright/commands/bw-help.md +85 -0
- package/templates/.buildwright/commands/bw-new-feature.md +504 -0
- package/templates/.buildwright/commands/bw-quick.md +323 -0
- package/templates/.buildwright/commands/bw-ship.md +288 -0
- package/templates/.buildwright/commands/bw-verify.md +108 -0
- package/templates/.buildwright/steering/naming-conventions.md +40 -0
- package/templates/.buildwright/steering/product.md +16 -0
- package/templates/.buildwright/steering/quality-gates.md +35 -0
- package/templates/.buildwright/steering/tech.md +27 -0
- package/templates/.buildwright/tasks/TEMPLATE.md +79 -0
- package/templates/.env.example +11 -1
- package/templates/.github/workflows/quality-gates.yml +150 -0
- package/templates/BUILDWRIGHT.md +99 -1
- package/templates/CLAUDE.md +150 -1
- package/templates/Makefile +86 -1
- package/templates/docs/requirements/TEMPLATE.md +33 -0
- package/templates/scripts/bump-version.sh +33 -0
- package/templates/scripts/hooks/post-checkout +24 -0
- package/templates/scripts/hooks/post-merge +14 -0
- package/templates/scripts/hooks/pre-commit +14 -0
- package/templates/scripts/install-hooks.sh +35 -0
- package/templates/scripts/release.sh +38 -0
- package/templates/scripts/sync-agents.sh +294 -0
- package/templates/scripts/validate-skill.sh +156 -0
- package/templates/.buildwright +0 -1
- package/templates/.github +0 -1
- package/templates/docs +0 -1
- package/templates/scripts +0 -1
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bw-quick
|
|
3
|
+
description: Fast path for ad-hoc tasks (bug fixes, small features, config changes) without full planning
|
|
4
|
+
arguments:
|
|
5
|
+
- name: task
|
|
6
|
+
description: What to do (inline description)
|
|
7
|
+
required: true
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Quick Mode
|
|
11
|
+
|
|
12
|
+
Fast path for ad-hoc tasks that don't need full planning.
|
|
13
|
+
|
|
14
|
+
**Use for:**
|
|
15
|
+
- Bug fixes
|
|
16
|
+
- Small features (< 2 hours)
|
|
17
|
+
- Config changes
|
|
18
|
+
- One-off tasks
|
|
19
|
+
- Refactors with clear scope
|
|
20
|
+
|
|
21
|
+
**Don't use for:**
|
|
22
|
+
- New features with unclear scope
|
|
23
|
+
- Changes touching multiple systems
|
|
24
|
+
- Anything needing architectural decisions
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
28
|
+
│ QUICK MODE │
|
|
29
|
+
├─────────────────────────────────────────────────────────────┤
|
|
30
|
+
│ 1. Understand task │
|
|
31
|
+
│ 2. Quick research (relevant files only) │
|
|
32
|
+
│ 3. Implement with TDD │
|
|
33
|
+
│ 4. Verify (typecheck, lint, test, build) │
|
|
34
|
+
│ 5. Security (OWASP + secrets + dependencies) │
|
|
35
|
+
│ 6. Code Review (Staff Engineer) │
|
|
36
|
+
│ 7. Commit │
|
|
37
|
+
└─────────────────────────────────────────────────────────────┘
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Step 1: Understand Task
|
|
43
|
+
|
|
44
|
+
**First, run Tech Discovery Protocol** (Command Discovery in CLAUDE.md) to determine the project's
|
|
45
|
+
test, lint, typecheck, and build commands. Cache the result for subsequent steps.
|
|
46
|
+
|
|
47
|
+
If no project files are found (greenfield — no `package.json`, `Cargo.toml`, `go.mod`, etc.),
|
|
48
|
+
ask for the product vision before proceeding. Quick tasks on a blank project need context.
|
|
49
|
+
|
|
50
|
+
Parse: $ARGUMENTS.task
|
|
51
|
+
|
|
52
|
+
Identify:
|
|
53
|
+
- What needs to change
|
|
54
|
+
- Why (bug, feature, refactor)
|
|
55
|
+
- Expected outcome
|
|
56
|
+
- Scope boundaries
|
|
57
|
+
|
|
58
|
+
If scope is unclear or large, recommend:
|
|
59
|
+
```
|
|
60
|
+
This task seems complex. Consider using /bw-new-feature instead for:
|
|
61
|
+
• Proper research phase
|
|
62
|
+
• Technical specification
|
|
63
|
+
• Staff Engineer review
|
|
64
|
+
|
|
65
|
+
Continue with /bw-quick anyway? (say "continue" or use /bw-new-feature)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Step 2: Quick Research
|
|
71
|
+
|
|
72
|
+
**Lightweight research - only what's needed for this task.**
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Find directly relevant files
|
|
76
|
+
grep -r "[relevant terms]" --include="*.ts" --include="*.tsx" -l .
|
|
77
|
+
|
|
78
|
+
# Read the specific files that will change
|
|
79
|
+
cat [files to modify]
|
|
80
|
+
|
|
81
|
+
# Check for existing tests
|
|
82
|
+
find . -name "*.test.*" -o -name "*.spec.*" | xargs grep -l "[relevant terms]"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Understand:
|
|
86
|
+
- Current implementation
|
|
87
|
+
- Patterns used in these files
|
|
88
|
+
- Related tests
|
|
89
|
+
|
|
90
|
+
**Do NOT write a research document. Keep it in context.**
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Step 3: Implement with TDD
|
|
95
|
+
|
|
96
|
+
### 3.1 Write/Update Tests First
|
|
97
|
+
|
|
98
|
+
If bug fix:
|
|
99
|
+
```bash
|
|
100
|
+
# Write a failing test that reproduces the bug
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
If feature:
|
|
104
|
+
```bash
|
|
105
|
+
# Write tests for the expected behavior
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Commit: `test: add test for [task]`
|
|
109
|
+
|
|
110
|
+
### 3.2 Implement
|
|
111
|
+
|
|
112
|
+
- Fix the bug / add the feature
|
|
113
|
+
- Follow existing patterns in the file
|
|
114
|
+
- Minimal changes only
|
|
115
|
+
- KISS, YAGNI
|
|
116
|
+
|
|
117
|
+
### 3.3 Update Documentation
|
|
118
|
+
|
|
119
|
+
Based on what you just implemented, identify which documentation files are affected and update them.
|
|
120
|
+
|
|
121
|
+
Common candidates:
|
|
122
|
+
- **README.md** — new behaviour, changed commands, updated flags, usage examples
|
|
123
|
+
- **docs/** — any guides or reference covering the changed functionality
|
|
124
|
+
- **CHANGELOG.md** — add an entry for any user-facing change
|
|
125
|
+
|
|
126
|
+
State up front which files you will update (e.g. "Updating README.md: correcting pipeline steps").
|
|
127
|
+
Skip entirely if nothing user-facing changed (internal refactor, test-only changes).
|
|
128
|
+
|
|
129
|
+
If docs were updated, commit them separately before the next step:
|
|
130
|
+
```bash
|
|
131
|
+
git add [doc files]
|
|
132
|
+
git commit -m "docs: update documentation for [task]"
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 3.4 Verify (with retry)
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
# Run project's verification commands
|
|
139
|
+
[typecheck]
|
|
140
|
+
[lint]
|
|
141
|
+
[test]
|
|
142
|
+
[build]
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
- If fails → Fix and retry (up to BUILDWRIGHT_AGENT_RETRIES attempts, default 2)
|
|
146
|
+
- If same error repeats → Not making progress — handle failure (see below)
|
|
147
|
+
- If still failing after retries → Handle failure:
|
|
148
|
+
- **Autonomous** (`BUILDWRIGHT_AUTO_APPROVE=true`, default): Commit completed work, push branch, exit(1). No PR for quick tasks.
|
|
149
|
+
- **Interactive** (`BUILDWRIGHT_AUTO_APPROVE=false`): STOP and report blocker.
|
|
150
|
+
|
|
151
|
+
### 3.5 Security Review
|
|
152
|
+
|
|
153
|
+
Adopt Security Engineer persona from `.buildwright/agents/security-engineer.md`.
|
|
154
|
+
|
|
155
|
+
Scope: `git diff HEAD` (uncommitted changes only).
|
|
156
|
+
|
|
157
|
+
Run automated scans:
|
|
158
|
+
- Dependency vulnerabilities (stack-appropriate audit tool) — skip gracefully if unavailable
|
|
159
|
+
- Secrets detection (pattern scan for API keys, passwords, tokens, private keys)
|
|
160
|
+
- SAST (`semgrep --config p/owasp-top-ten .` if available — skip gracefully if unavailable)
|
|
161
|
+
|
|
162
|
+
Then perform manual OWASP Top 10 review of changed files only.
|
|
163
|
+
|
|
164
|
+
**If CRITICAL vulnerabilities found → Handle failure:**
|
|
165
|
+
- **Autonomous** (`BUILDWRIGHT_AUTO_APPROVE=true`, default): Commit completed work, push branch, exit(1).
|
|
166
|
+
- **Interactive** (`BUILDWRIGHT_AUTO_APPROVE=false`): STOP immediately.
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
╔═══════════════════════════════════════════════════════════════╗
|
|
170
|
+
║ SECURITY ║
|
|
171
|
+
╠═══════════════════════════════════════════════════════════════╣
|
|
172
|
+
║ Dependencies: ✅/❌ ([N] vulnerabilities) ║
|
|
173
|
+
║ Secrets: ✅/❌ ([N] found) ║
|
|
174
|
+
║ OWASP Scan: ✅/❌ ([N] issues) ║
|
|
175
|
+
╠═══════════════════════════════════════════════════════════════╣
|
|
176
|
+
║ Status: SECURE / CRITICAL VULNERABILITIES ║
|
|
177
|
+
╚═══════════════════════════════════════════════════════════════╝
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
### 3.6 Code Review
|
|
183
|
+
|
|
184
|
+
Adopt Staff Engineer persona from `.buildwright/agents/staff-engineer.md`.
|
|
185
|
+
|
|
186
|
+
Scope: `git diff HEAD` (same diff as security step).
|
|
187
|
+
|
|
188
|
+
Review changed code for:
|
|
189
|
+
- Logic errors and edge cases
|
|
190
|
+
- Error handling completeness
|
|
191
|
+
- Missing validation at system boundaries
|
|
192
|
+
- Unnecessary complexity introduced
|
|
193
|
+
|
|
194
|
+
**If CHANGES REQUESTED → Handle failure:**
|
|
195
|
+
- **Autonomous** (`BUILDWRIGHT_AUTO_APPROVE=true`, default): Commit completed work, push branch, exit(1).
|
|
196
|
+
- **Interactive** (`BUILDWRIGHT_AUTO_APPROVE=false`): STOP immediately.
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
╔═══════════════════════════════════════════════════════════════╗
|
|
200
|
+
║ CODE REVIEW ║
|
|
201
|
+
╠═══════════════════════════════════════════════════════════════╣
|
|
202
|
+
║ Logic: ✅/❌ ║
|
|
203
|
+
║ Error Handling: ✅/❌ ║
|
|
204
|
+
║ Validation: ✅/❌ ║
|
|
205
|
+
╠═══════════════════════════════════════════════════════════════╣
|
|
206
|
+
║ Status: APPROVED / CHANGES REQUESTED ║
|
|
207
|
+
╚═══════════════════════════════════════════════════════════════╝
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
### 3.7 Commit
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
git add [changed files]
|
|
216
|
+
git commit -m "[type]([scope]): [description]"
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Commit types:
|
|
220
|
+
- `fix:` for bug fixes
|
|
221
|
+
- `feat:` for small features
|
|
222
|
+
- `refactor:` for refactors
|
|
223
|
+
- `chore:` for config/maintenance
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Step 4: Report
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
╔═══════════════════════════════════════════════════════════════╗
|
|
231
|
+
║ QUICK TASK COMPLETE ║
|
|
232
|
+
╠═══════════════════════════════════════════════════════════════╣
|
|
233
|
+
║ ║
|
|
234
|
+
║ Task: [description] ║
|
|
235
|
+
║ Type: [bug fix / feature / refactor / chore] ║
|
|
236
|
+
║ ║
|
|
237
|
+
║ Changes: ║
|
|
238
|
+
║ • [file1]: [what changed] ║
|
|
239
|
+
║ • [file2]: [what changed] ║
|
|
240
|
+
║ ║
|
|
241
|
+
║ Verification: ║
|
|
242
|
+
║ ✅ Type Check ║
|
|
243
|
+
║ ✅ Lint ║
|
|
244
|
+
║ ✅ Tests ║
|
|
245
|
+
║ ✅ Build ║
|
|
246
|
+
║ ✅ Security ║
|
|
247
|
+
║ ✅ Code Review ║
|
|
248
|
+
║ ║
|
|
249
|
+
║ Commit: [hash] [message] ║
|
|
250
|
+
║ ║
|
|
251
|
+
╠═══════════════════════════════════════════════════════════════╣
|
|
252
|
+
║ ║
|
|
253
|
+
║ Ready to push? Run: git push ║
|
|
254
|
+
║ Or run /bw-ship to push + open PR ║
|
|
255
|
+
║ ║
|
|
256
|
+
╚═══════════════════════════════════════════════════════════════╝
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## When to Escalate
|
|
262
|
+
|
|
263
|
+
If during implementation you discover:
|
|
264
|
+
- Task is larger than expected
|
|
265
|
+
- Changes needed in multiple systems
|
|
266
|
+
- Architectural decisions required
|
|
267
|
+
- Unclear requirements
|
|
268
|
+
|
|
269
|
+
**STOP and recommend:**
|
|
270
|
+
|
|
271
|
+
```
|
|
272
|
+
╔═══════════════════════════════════════════════════════════════╗
|
|
273
|
+
║ SCOPE ESCALATION ║
|
|
274
|
+
╠═══════════════════════════════════════════════════════════════╣
|
|
275
|
+
║ ║
|
|
276
|
+
║ This task is more complex than expected: ║
|
|
277
|
+
║ • [Reason 1] ║
|
|
278
|
+
║ • [Reason 2] ║
|
|
279
|
+
║ ║
|
|
280
|
+
║ Recommendation: Use /bw-new-feature for proper planning ║
|
|
281
|
+
║ ║
|
|
282
|
+
║ /bw-new-feature "[task description with discovered context]" ║
|
|
283
|
+
║ ║
|
|
284
|
+
╚═══════════════════════════════════════════════════════════════╝
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## Examples
|
|
290
|
+
|
|
291
|
+
### Bug Fix
|
|
292
|
+
```
|
|
293
|
+
/bw-quick "Fix login timeout - session expires after 5 minutes instead of 30"
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### Small Feature
|
|
297
|
+
```
|
|
298
|
+
/bw-quick "Add loading spinner to the submit button"
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Config Change
|
|
302
|
+
```
|
|
303
|
+
/bw-quick "Increase rate limit from 100 to 500 requests per minute"
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Refactor
|
|
307
|
+
```
|
|
308
|
+
/bw-quick "Extract the validation logic from UserForm into a separate hook"
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## Difference from /bw-new-feature
|
|
314
|
+
|
|
315
|
+
| Aspect | /bw-quick | /bw-new-feature |
|
|
316
|
+
|--------|--------|--------------|
|
|
317
|
+
| Research | Quick (in-context) | Full (research.md) |
|
|
318
|
+
| Spec | None | Full spec.md |
|
|
319
|
+
| Staff Engineer Review | Required (diff-scoped) | Spec + Code |
|
|
320
|
+
| Security Review | Required (diff-scoped) | Required |
|
|
321
|
+
| Estimated Time | < 2 hours | Any |
|
|
322
|
+
| Scope | Clear, bounded | Any |
|
|
323
|
+
| Commits | 1-2 | Per milestone |
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bw-ship
|
|
3
|
+
description: Run full quality pipeline (verify → security → review) then commit, push, and create PR. Fails fast if any step fails.
|
|
4
|
+
arguments:
|
|
5
|
+
- name: message
|
|
6
|
+
description: Commit message (conventional format). Required if there are uncommitted changes.
|
|
7
|
+
required: false
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Ship Pipeline
|
|
11
|
+
|
|
12
|
+
This command runs the full quality pipeline before shipping.
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
16
|
+
│ SHIP PIPELINE │
|
|
17
|
+
├─────────────────────────────────────────────────────────────┤
|
|
18
|
+
│ │
|
|
19
|
+
│ 1. VERIFY (quick checks) ← Retry up to 2x │
|
|
20
|
+
│ └─ typecheck → lint → test → build │
|
|
21
|
+
│ │ │
|
|
22
|
+
│ ▼ PASS? Continue : Retry/STOP │
|
|
23
|
+
│ │
|
|
24
|
+
│ 2. SECURITY (OWASP + SAST) ← No retry │
|
|
25
|
+
│ └─ dependencies → secrets → OWASP scan │
|
|
26
|
+
│ │ │
|
|
27
|
+
│ ▼ PASS? Continue : STOP │
|
|
28
|
+
│ │
|
|
29
|
+
│ 3. REVIEW (Staff Engineer) ← No retry │
|
|
30
|
+
│ └─ logic → errors → patterns → quality │
|
|
31
|
+
│ │ │
|
|
32
|
+
│ ▼ PASS? Continue : STOP │
|
|
33
|
+
│ │
|
|
34
|
+
│ 4. RELEASE │
|
|
35
|
+
│ └─ commit → push → create PR │
|
|
36
|
+
│ │
|
|
37
|
+
└─────────────────────────────────────────────────────────────┘
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Step 1: Verify (Quick Checks) — Retry up to 2x
|
|
43
|
+
|
|
44
|
+
Before verifying, confirm that README.md, docs/, and CHANGELOG.md reflect the
|
|
45
|
+
changes being shipped. Update any that are out of date.
|
|
46
|
+
|
|
47
|
+
Run quick verification checks:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Discover and run project commands
|
|
51
|
+
# Type check
|
|
52
|
+
# Lint
|
|
53
|
+
# Test
|
|
54
|
+
# Build
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**If fails → Fix and retry (up to BUILDWRIGHT_AGENT_RETRIES attempts, default 2).**
|
|
58
|
+
**If same error repeats → Not making progress — handle failure (see below).**
|
|
59
|
+
**If still failing after retries → Handle failure:**
|
|
60
|
+
|
|
61
|
+
- **Autonomous** (`BUILDWRIGHT_AUTO_APPROVE=true`, default): Commit completed work, push branch, create PR with failure summary (see BUILDWRIGHT.md template), exit(1).
|
|
62
|
+
- **Interactive** (`BUILDWRIGHT_AUTO_APPROVE=false`): STOP and report blocker to human.
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
╔═══════════════════════════════════════════════════════════════╗
|
|
66
|
+
║ STEP 1: VERIFY ║
|
|
67
|
+
╠═══════════════════════════════════════════════════════════════╣
|
|
68
|
+
║ Type Check: ✅/❌ ║
|
|
69
|
+
║ Lint: ✅/❌ ║
|
|
70
|
+
║ Tests: ✅/❌ ║
|
|
71
|
+
║ Build: ✅/❌ ║
|
|
72
|
+
╠═══════════════════════════════════════════════════════════════╣
|
|
73
|
+
║ Attempt: [1/2/3] ║
|
|
74
|
+
║ Status: PASS / RETRY / FAIL ║
|
|
75
|
+
╚═══════════════════════════════════════════════════════════════╝
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
If FAIL after retries:
|
|
79
|
+
- **Autonomous**: Commit + push + create failed PR (using BUILDWRIGHT.md template) + exit(1).
|
|
80
|
+
- **Interactive**: Report specific errors and STOP.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Step 2: Security Review — No retry (needs human judgment)
|
|
85
|
+
|
|
86
|
+
Adopt Security Engineer persona from `.buildwright/agents/security-engineer.md`.
|
|
87
|
+
|
|
88
|
+
### 2.1 Determine Scope
|
|
89
|
+
```bash
|
|
90
|
+
git diff --name-only main...HEAD
|
|
91
|
+
# Or if no main branch:
|
|
92
|
+
git diff --name-only HEAD
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 2.2 Automated Scans
|
|
96
|
+
Run tools from the Security Engineer persona's "Tools to Use" section:
|
|
97
|
+
- Dependency vulnerabilities (`npm audit` / `cargo audit` / etc.) — skip gracefully if unavailable
|
|
98
|
+
- Secrets detection (pattern scan for API keys, passwords, tokens, private keys)
|
|
99
|
+
- SAST (`semgrep --config p/owasp-top-ten .` if available)
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# Skip gracefully if tools are unavailable
|
|
103
|
+
[DISCOVERED_AUDIT_COMMAND] 2>/dev/null || echo "Dependency audit not available for this stack"
|
|
104
|
+
semgrep --config p/owasp-top-ten . 2>/dev/null || echo "semgrep not available"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Where DISCOVERED_AUDIT_COMMAND is the stack-appropriate audit tool, e.g.:
|
|
108
|
+
`npm audit` | `cargo audit` | `pip-audit` | `bundle audit` | `go list -m -json all | nancy sleuth`
|
|
109
|
+
|
|
110
|
+
### 2.3 Manual Review (Phased)
|
|
111
|
+
|
|
112
|
+
**Phase A — Repository Context:** Understand existing security posture — frameworks, middleware, auth patterns, trust boundaries.
|
|
113
|
+
|
|
114
|
+
**Phase B — Comparative Analysis:** Does new code follow established security patterns? Does it bypass or weaken existing controls?
|
|
115
|
+
|
|
116
|
+
**Phase C — Vulnerability Assessment:** Check changed code against OWASP Top 10 (A01-A10) using the full checklist from the Security Engineer persona.
|
|
117
|
+
|
|
118
|
+
**If CRITICAL vulnerabilities found → No retry. Handle failure:**
|
|
119
|
+
|
|
120
|
+
- **Autonomous** (`BUILDWRIGHT_AUTO_APPROVE=true`, default): Commit completed work, push branch, create PR with failure summary (see BUILDWRIGHT.md template), exit(1).
|
|
121
|
+
- **Interactive** (`BUILDWRIGHT_AUTO_APPROVE=false`): STOP immediately. Security issues require human judgment.
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
╔═══════════════════════════════════════════════════════════════╗
|
|
125
|
+
║ STEP 2: SECURITY ║
|
|
126
|
+
╠═══════════════════════════════════════════════════════════════╣
|
|
127
|
+
║ Dependencies: ✅/❌ ([N] vulnerabilities) ║
|
|
128
|
+
║ Secrets: ✅/❌ ([N] found) ║
|
|
129
|
+
║ OWASP Scan: ✅/❌ ([N] issues) ║
|
|
130
|
+
╠═══════════════════════════════════════════════════════════════╣
|
|
131
|
+
║ Status: SECURE / CRITICAL VULNERABILITIES ║
|
|
132
|
+
╚═══════════════════════════════════════════════════════════════╝
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
If CRITICAL VULNERABILITIES:
|
|
136
|
+
- **Autonomous**: Commit + push + create failed PR (using BUILDWRIGHT.md template) + exit(1).
|
|
137
|
+
- **Interactive**: Report specific issues and STOP.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Step 3: Code Review — No retry (architectural decisions)
|
|
142
|
+
|
|
143
|
+
Adopt Staff Engineer persona from `.buildwright/agents/staff-engineer.md`.
|
|
144
|
+
|
|
145
|
+
### 3.1 Determine Scope
|
|
146
|
+
```bash
|
|
147
|
+
git diff main...HEAD
|
|
148
|
+
# Or if no main branch:
|
|
149
|
+
git diff HEAD
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### 3.2 Phased Review
|
|
153
|
+
|
|
154
|
+
**Phase A — Repository Context:** Understand existing patterns, conventions, error handling, and testing approaches.
|
|
155
|
+
|
|
156
|
+
**Phase B — Comparative Analysis:** Does new code follow established patterns? Does it bypass or weaken existing controls?
|
|
157
|
+
|
|
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
|
+
|
|
160
|
+
Assess against categories from the Staff Engineer persona's "In Code" checklist.
|
|
161
|
+
|
|
162
|
+
**⚠️ APPROVED WITH COMMENTS** → Proceed to release. Fix recommendations if straightforward, otherwise note for follow-up.
|
|
163
|
+
**❌ CHANGES REQUESTED** → No retry. Handle failure:
|
|
164
|
+
|
|
165
|
+
- **Autonomous** (`BUILDWRIGHT_AUTO_APPROVE=true`, default): Commit completed work, push branch, create PR with failure summary (see BUILDWRIGHT.md template), exit(1).
|
|
166
|
+
- **Interactive** (`BUILDWRIGHT_AUTO_APPROVE=false`): STOP immediately. Code review issues often involve architectural decisions that need human input.
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
╔═══════════════════════════════════════════════════════════════╗
|
|
170
|
+
║ STEP 3: CODE REVIEW ║
|
|
171
|
+
╠═══════════════════════════════════════════════════════════════╣
|
|
172
|
+
║ Logic: ✅/❌ ║
|
|
173
|
+
║ Error Handling:✅/❌ ║
|
|
174
|
+
║ Performance: ✅/❌ ║
|
|
175
|
+
║ Maintainability:✅/❌ ║
|
|
176
|
+
╠═══════════════════════════════════════════════════════════════╣
|
|
177
|
+
║ Status: APPROVED / CHANGES REQUESTED ║
|
|
178
|
+
╚═══════════════════════════════════════════════════════════════╝
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
If CHANGES REQUESTED:
|
|
182
|
+
- **Autonomous**: Commit + push + create failed PR (using BUILDWRIGHT.md template) + exit(1).
|
|
183
|
+
- **Interactive**: Report specific issues and STOP.
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Step 4: Release
|
|
188
|
+
|
|
189
|
+
All checks passed. Now ship:
|
|
190
|
+
|
|
191
|
+
### 4.1 Stage Changes
|
|
192
|
+
```bash
|
|
193
|
+
git add [specific files you changed] # NEVER git add -A
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### 4.2 Commit
|
|
197
|
+
```bash
|
|
198
|
+
# Use provided message or generate from changes
|
|
199
|
+
git commit -m "$ARGUMENTS.message"
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
If no message provided and there are changes, generate a conventional commit message based on the changes.
|
|
203
|
+
|
|
204
|
+
### 4.3 Push
|
|
205
|
+
```bash
|
|
206
|
+
# Push to remote
|
|
207
|
+
git push origin HEAD
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### 4.4 Create PR
|
|
211
|
+
```bash
|
|
212
|
+
# Create pull request
|
|
213
|
+
gh pr create --fill
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
If `gh` is not available, provide the PR creation URL.
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Final Report
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
╔═══════════════════════════════════════════════════════════════╗
|
|
224
|
+
║ SHIP COMPLETE ║
|
|
225
|
+
╠═══════════════════════════════════════════════════════════════╣
|
|
226
|
+
║ ║
|
|
227
|
+
║ ✅ Verify: PASSED ║
|
|
228
|
+
║ ✅ Security: PASSED ║
|
|
229
|
+
║ ✅ Review: APPROVED ║
|
|
230
|
+
║ ✅ Release: SHIPPED ║
|
|
231
|
+
║ ║
|
|
232
|
+
╠═══════════════════════════════════════════════════════════════╣
|
|
233
|
+
║ Commit: [commit hash] ║
|
|
234
|
+
║ Branch: [branch name] ║
|
|
235
|
+
║ PR: [PR URL] ║
|
|
236
|
+
╠═══════════════════════════════════════════════════════════════╣
|
|
237
|
+
║ ║
|
|
238
|
+
║ Quality gates will run in CI. ║
|
|
239
|
+
║ PR will auto-merge when all gates pass. ║
|
|
240
|
+
║ ║
|
|
241
|
+
╚═══════════════════════════════════════════════════════════════╝
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## Failure Handling
|
|
247
|
+
|
|
248
|
+
### Interactive Mode (`BUILDWRIGHT_AUTO_APPROVE=false`)
|
|
249
|
+
|
|
250
|
+
STOP and show the blocker:
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
╔═══════════════════════════════════════════════════════════════╗
|
|
254
|
+
║ SHIP BLOCKED ║
|
|
255
|
+
╠═══════════════════════════════════════════════════════════════╣
|
|
256
|
+
║ ║
|
|
257
|
+
║ ❌ Failed at: [STEP NAME] ║
|
|
258
|
+
║ ║
|
|
259
|
+
║ Reason: ║
|
|
260
|
+
║ [Specific failure details] ║
|
|
261
|
+
║ ║
|
|
262
|
+
║ To fix: ║
|
|
263
|
+
║ [Actionable remediation steps] ║
|
|
264
|
+
║ ║
|
|
265
|
+
║ After fixing, run /bw-ship again. ║
|
|
266
|
+
║ ║
|
|
267
|
+
╚═══════════════════════════════════════════════════════════════╝
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Autonomous Mode (`BUILDWRIGHT_AUTO_APPROVE=true`, default)
|
|
271
|
+
|
|
272
|
+
Commit completed work, push, create PR with failure details, and exit(1):
|
|
273
|
+
|
|
274
|
+
1. Stage and commit all completed work to the feature branch
|
|
275
|
+
2. Push branch to remote
|
|
276
|
+
3. Create PR using the failure summary template from BUILDWRIGHT.md
|
|
277
|
+
4. Exit with non-zero code so CI/CD registers the failure
|
|
278
|
+
|
|
279
|
+
The PR title should be prefixed with `[FAILED]` and the body should follow the PR Failure Summary Template documented in BUILDWRIGHT.md.
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Multi-Agent Safety
|
|
284
|
+
|
|
285
|
+
- Only commit files you modified
|
|
286
|
+
- Never use `git stash`
|
|
287
|
+
- Pull before push if needed
|
|
288
|
+
- Use atomic commits
|