buildwright 0.0.5 → 0.0.6
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 +82 -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 +245 -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 +82 -1
- package/templates/docs/requirements/TEMPLATE.md +33 -0
- package/templates/scripts/bump-version.sh +37 -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/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,16 @@
|
|
|
1
|
+
# Product Context
|
|
2
|
+
|
|
3
|
+
## What We're Building
|
|
4
|
+
[Describe your product/project here]
|
|
5
|
+
|
|
6
|
+
## Key Features
|
|
7
|
+
[List main features]
|
|
8
|
+
|
|
9
|
+
## User Personas
|
|
10
|
+
[Describe target users]
|
|
11
|
+
|
|
12
|
+
## Business Constraints
|
|
13
|
+
[Timeline, compliance, integrations]
|
|
14
|
+
|
|
15
|
+
## Current Focus
|
|
16
|
+
[What's being worked on now]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Quality Gates
|
|
2
|
+
|
|
3
|
+
These automated gates replace human code review. ALL must pass for merge.
|
|
4
|
+
|
|
5
|
+
## Gate 1: Static Analysis
|
|
6
|
+
- [ ] Type check passes (zero errors)
|
|
7
|
+
- [ ] Lint passes (zero errors, warnings acceptable)
|
|
8
|
+
- [ ] No new lint warnings introduced
|
|
9
|
+
|
|
10
|
+
## Gate 2: Tests
|
|
11
|
+
- [ ] All existing tests pass
|
|
12
|
+
- [ ] New code has tests
|
|
13
|
+
- [ ] Coverage does not decrease
|
|
14
|
+
- [ ] Critical paths have >80% coverage
|
|
15
|
+
|
|
16
|
+
## Gate 3: Security
|
|
17
|
+
- [ ] No high/critical vulnerabilities in dependencies
|
|
18
|
+
- [ ] No secrets in code
|
|
19
|
+
- [ ] SAST scan passes (if configured)
|
|
20
|
+
|
|
21
|
+
## Gate 4: Build
|
|
22
|
+
- [ ] Production build succeeds
|
|
23
|
+
- [ ] No build warnings
|
|
24
|
+
|
|
25
|
+
## Gate 5: AI Review (Optional)
|
|
26
|
+
- [ ] No blocking issues from AI reviewer
|
|
27
|
+
|
|
28
|
+
## Financial/Trading Code (Additional)
|
|
29
|
+
- [ ] No floating-point for currency
|
|
30
|
+
- [ ] All inputs validated
|
|
31
|
+
- [ ] Rate limiting on sensitive endpoints
|
|
32
|
+
- [ ] Audit logging for transactions
|
|
33
|
+
|
|
34
|
+
## Auto-Merge Criteria
|
|
35
|
+
When ALL gates pass → PR auto-merges → Deploy triggers
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Technical Context
|
|
2
|
+
|
|
3
|
+
## Stack
|
|
4
|
+
[List your tech stack]
|
|
5
|
+
|
|
6
|
+
## Project Commands
|
|
7
|
+
|
|
8
|
+
Fill in these slots with your project's actual commands. If left empty, Buildwright
|
|
9
|
+
auto-detects from project files (package.json, Cargo.toml, go.mod, pyproject.toml,
|
|
10
|
+
Makefile) and populates this section on the first run.
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
typecheck: [command] # Examples: npx tsc --noEmit | cargo check | go build ./... | mypy .
|
|
14
|
+
lint: [command] # Examples: npx eslint . | cargo clippy | golangci-lint run | ruff check .
|
|
15
|
+
test: [command] # Examples: npm test | cargo test | go test ./... | pytest
|
|
16
|
+
build: [command] # Examples: npm run build | cargo build --release | go build ./...
|
|
17
|
+
dev: [command] # Examples: npm run dev | cargo run | go run ./... | uvicorn app:main
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Architecture
|
|
21
|
+
[High-level architecture notes]
|
|
22
|
+
|
|
23
|
+
## Code Patterns
|
|
24
|
+
[Patterns used in this codebase]
|
|
25
|
+
|
|
26
|
+
## Dependencies
|
|
27
|
+
[Key dependencies and why]
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Task: [Feature Name]
|
|
2
|
+
|
|
3
|
+
## Quick Reference
|
|
4
|
+
- **Status**: DRAFTING | SPEC_REVIEW | IMPLEMENTING | CODE_REVIEW | COMPLETE | BLOCKED
|
|
5
|
+
- **Branch**: feature/[name]
|
|
6
|
+
- **Spec**: docs/specs/[name]/spec.md
|
|
7
|
+
- **Current Owner**: [agent-role or "unassigned"]
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Status: DRAFTING
|
|
12
|
+
|
|
13
|
+
## Branch: feature/[name]
|
|
14
|
+
|
|
15
|
+
## Current Owner: unassigned
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Phases
|
|
20
|
+
|
|
21
|
+
### Phase 1: Specification
|
|
22
|
+
| Field | Value |
|
|
23
|
+
|-------|-------|
|
|
24
|
+
| Owner | architect-agent |
|
|
25
|
+
| Status | ⏳ PENDING |
|
|
26
|
+
| Output | docs/specs/[name]/spec.md |
|
|
27
|
+
| Started | - |
|
|
28
|
+
| Completed | - |
|
|
29
|
+
|
|
30
|
+
### Phase 2: Implementation
|
|
31
|
+
| Field | Value |
|
|
32
|
+
|-------|-------|
|
|
33
|
+
| Owner | implementer-agent |
|
|
34
|
+
| Status | ⏳ WAITING |
|
|
35
|
+
| Branch | feature/[name] |
|
|
36
|
+
| Started | - |
|
|
37
|
+
| Completed | - |
|
|
38
|
+
|
|
39
|
+
**Milestones**:
|
|
40
|
+
- [ ] Milestone 1: [description]
|
|
41
|
+
- [ ] Milestone 2: [description]
|
|
42
|
+
- [ ] Milestone 3: [description]
|
|
43
|
+
|
|
44
|
+
### Phase 3: Review & Ship
|
|
45
|
+
| Field | Value |
|
|
46
|
+
|-------|-------|
|
|
47
|
+
| Owner | reviewer-agent |
|
|
48
|
+
| Status | ⏳ WAITING |
|
|
49
|
+
| PR | - |
|
|
50
|
+
| Started | - |
|
|
51
|
+
| Completed | - |
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Context for Next Agent
|
|
56
|
+
|
|
57
|
+
### Decisions Made
|
|
58
|
+
-
|
|
59
|
+
|
|
60
|
+
### Key Files Modified
|
|
61
|
+
-
|
|
62
|
+
|
|
63
|
+
### Known Issues / TODOs
|
|
64
|
+
-
|
|
65
|
+
|
|
66
|
+
### Test Commands
|
|
67
|
+
```bash
|
|
68
|
+
npm run test
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Blockers
|
|
74
|
+
None currently.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Communication Log
|
|
79
|
+
- [timestamp] [agent]: Starting work
|
package/templates/.env.example
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
# Buildwright Environment Variables
|
|
2
|
+
# Copy to .env or export in your shell: source .env.example
|
|
3
|
+
|
|
4
|
+
# Autonomous mode — skip human approval, fail gracefully on errors
|
|
5
|
+
# true (default): Pipeline runs fully autonomous. Failures commit + push + create failed PR + exit(1).
|
|
6
|
+
# false: Pipeline stops on failure and waits for human input.
|
|
7
|
+
BUILDWRIGHT_AUTO_APPROVE=true
|
|
8
|
+
|
|
9
|
+
# Number of verify retries (typecheck, lint, test, build) before giving up
|
|
10
|
+
# Default: 2
|
|
11
|
+
BUILDWRIGHT_AGENT_RETRIES=2
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
name: Quality Gates
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
push:
|
|
7
|
+
branches: [main, master]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
quality:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
|
|
15
|
+
# Verify sync script runs without errors (catches broken scripts or missing deps)
|
|
16
|
+
- name: Verify sync script
|
|
17
|
+
run: make sync
|
|
18
|
+
|
|
19
|
+
# Detect package manager and project type
|
|
20
|
+
- name: Detect project type
|
|
21
|
+
id: detect
|
|
22
|
+
run: |
|
|
23
|
+
if [ -f "package.json" ]; then
|
|
24
|
+
echo "type=node" >> $GITHUB_OUTPUT
|
|
25
|
+
if [ -f "pnpm-lock.yaml" ]; then
|
|
26
|
+
echo "pm=pnpm" >> $GITHUB_OUTPUT
|
|
27
|
+
elif [ -f "yarn.lock" ]; then
|
|
28
|
+
echo "pm=yarn" >> $GITHUB_OUTPUT
|
|
29
|
+
elif [ -f "bun.lockb" ]; then
|
|
30
|
+
echo "pm=bun" >> $GITHUB_OUTPUT
|
|
31
|
+
else
|
|
32
|
+
echo "pm=npm" >> $GITHUB_OUTPUT
|
|
33
|
+
fi
|
|
34
|
+
elif [ -f "Cargo.toml" ]; then
|
|
35
|
+
echo "type=rust" >> $GITHUB_OUTPUT
|
|
36
|
+
elif [ -f "go.mod" ]; then
|
|
37
|
+
echo "type=go" >> $GITHUB_OUTPUT
|
|
38
|
+
elif [ -f "pyproject.toml" ] || [ -f "setup.py" ]; then
|
|
39
|
+
echo "type=python" >> $GITHUB_OUTPUT
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
# Node.js setup
|
|
43
|
+
- name: Setup Node.js
|
|
44
|
+
if: steps.detect.outputs.type == 'node'
|
|
45
|
+
uses: actions/setup-node@v4
|
|
46
|
+
with:
|
|
47
|
+
node-version: '20'
|
|
48
|
+
|
|
49
|
+
- name: Setup pnpm
|
|
50
|
+
if: steps.detect.outputs.pm == 'pnpm'
|
|
51
|
+
uses: pnpm/action-setup@v2
|
|
52
|
+
with:
|
|
53
|
+
version: 8
|
|
54
|
+
|
|
55
|
+
- name: Install dependencies (Node)
|
|
56
|
+
if: steps.detect.outputs.type == 'node'
|
|
57
|
+
run: |
|
|
58
|
+
case "${{ steps.detect.outputs.pm }}" in
|
|
59
|
+
pnpm) pnpm install --frozen-lockfile ;;
|
|
60
|
+
yarn) yarn install --frozen-lockfile ;;
|
|
61
|
+
bun) bun install ;;
|
|
62
|
+
*) npm ci ;;
|
|
63
|
+
esac
|
|
64
|
+
|
|
65
|
+
# Rust setup
|
|
66
|
+
- name: Setup Rust
|
|
67
|
+
if: steps.detect.outputs.type == 'rust'
|
|
68
|
+
uses: dtolnay/rust-toolchain@stable
|
|
69
|
+
with:
|
|
70
|
+
components: clippy
|
|
71
|
+
|
|
72
|
+
# Go setup
|
|
73
|
+
- name: Setup Go
|
|
74
|
+
if: steps.detect.outputs.type == 'go'
|
|
75
|
+
uses: actions/setup-go@v5
|
|
76
|
+
with:
|
|
77
|
+
go-version: '1.21'
|
|
78
|
+
|
|
79
|
+
# Python setup
|
|
80
|
+
- name: Setup Python
|
|
81
|
+
if: steps.detect.outputs.type == 'python'
|
|
82
|
+
uses: actions/setup-python@v5
|
|
83
|
+
with:
|
|
84
|
+
python-version: '3.11'
|
|
85
|
+
|
|
86
|
+
- name: Install dependencies (Python)
|
|
87
|
+
if: steps.detect.outputs.type == 'python'
|
|
88
|
+
run: |
|
|
89
|
+
pip install -e ".[dev]" || pip install -r requirements.txt
|
|
90
|
+
|
|
91
|
+
# Quality checks
|
|
92
|
+
- name: Type Check
|
|
93
|
+
run: |
|
|
94
|
+
case "${{ steps.detect.outputs.type }}" in
|
|
95
|
+
node) ${{ steps.detect.outputs.pm }} run typecheck || npx tsc --noEmit ;;
|
|
96
|
+
rust) cargo check ;;
|
|
97
|
+
go) go build ./... ;;
|
|
98
|
+
python) mypy . || pyright || echo "No type checker configured" ;;
|
|
99
|
+
esac
|
|
100
|
+
|
|
101
|
+
- name: Lint
|
|
102
|
+
run: |
|
|
103
|
+
case "${{ steps.detect.outputs.type }}" in
|
|
104
|
+
node) ${{ steps.detect.outputs.pm }} run lint || npx eslint . ;;
|
|
105
|
+
rust) cargo clippy -- -D warnings ;;
|
|
106
|
+
go) golangci-lint run || echo "golangci-lint not installed" ;;
|
|
107
|
+
python) ruff check . || flake8 ;;
|
|
108
|
+
esac
|
|
109
|
+
|
|
110
|
+
- name: Test
|
|
111
|
+
run: |
|
|
112
|
+
case "${{ steps.detect.outputs.type }}" in
|
|
113
|
+
node) ${{ steps.detect.outputs.pm }} test ;;
|
|
114
|
+
rust) cargo test ;;
|
|
115
|
+
go) go test ./... ;;
|
|
116
|
+
python) pytest ;;
|
|
117
|
+
esac
|
|
118
|
+
|
|
119
|
+
- name: Build
|
|
120
|
+
run: |
|
|
121
|
+
case "${{ steps.detect.outputs.type }}" in
|
|
122
|
+
node) ${{ steps.detect.outputs.pm }} run build ;;
|
|
123
|
+
rust) cargo build --release ;;
|
|
124
|
+
go) go build ./... ;;
|
|
125
|
+
python) echo "No build step" ;;
|
|
126
|
+
esac
|
|
127
|
+
|
|
128
|
+
- name: Security Audit
|
|
129
|
+
run: |
|
|
130
|
+
case "${{ steps.detect.outputs.type }}" in
|
|
131
|
+
node) ${{ steps.detect.outputs.pm }} audit --audit-level=high || true ;;
|
|
132
|
+
rust) cargo audit || echo "cargo-audit not installed" ;;
|
|
133
|
+
go) govulncheck ./... || echo "govulncheck not installed" ;;
|
|
134
|
+
python) pip-audit || safety check || echo "No Python audit tool" ;;
|
|
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/BUILDWRIGHT.md
CHANGED
|
@@ -1 +1,99 @@
|
|
|
1
|
-
|
|
1
|
+
# Buildwright Development Workflow
|
|
2
|
+
|
|
3
|
+
This project uses agent-first autonomous development. See [README.md](README.md) for full setup, concepts, and workflow details.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# After cloning, generate tool-specific configs from .buildwright/
|
|
9
|
+
make sync
|
|
10
|
+
|
|
11
|
+
# Install git hooks to auto-sync on .buildwright/ changes
|
|
12
|
+
make install-hooks
|
|
13
|
+
|
|
14
|
+
# Start your agent tool
|
|
15
|
+
claude
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Commands
|
|
19
|
+
|
|
20
|
+
| Command | Purpose |
|
|
21
|
+
|---------|---------|
|
|
22
|
+
| `/bw-new-feature` | Full pipeline: research → spec → approve → build → ship |
|
|
23
|
+
| `/bw-quick` | Fast path for bug fixes, small tasks |
|
|
24
|
+
| `/bw-claw` | Cross-domain features: Architect decomposes → claws execute per domain → integrate → ship |
|
|
25
|
+
| `/bw-ship` | Quality gates + release: verify → security → review → push → PR |
|
|
26
|
+
| `/bw-verify` | Quick checks: typecheck, lint, test, build |
|
|
27
|
+
| `/bw-analyse` | Analyse existing codebase → write structured docs to `.buildwright/codebase/` → update tech.md |
|
|
28
|
+
| `/bw-help` | Show available commands |
|
|
29
|
+
|
|
30
|
+
## Environment Variables
|
|
31
|
+
|
|
32
|
+
| Variable | Default | Required | Purpose |
|
|
33
|
+
|----------|---------|----------|---------|
|
|
34
|
+
| `GITHUB_TOKEN` | — | Yes | Push branches and open PRs via `gh`. Needs `repo` scope. |
|
|
35
|
+
| `BUILDWRIGHT_AUTO_APPROVE` | `true` | No | Autonomous mode — skip human approval, fail gracefully on errors |
|
|
36
|
+
| `BUILDWRIGHT_AGENT_RETRIES` | `2` | No | Number of verify retries before giving up |
|
|
37
|
+
|
|
38
|
+
## Failure Behavior
|
|
39
|
+
|
|
40
|
+
| Mode | Any Failure | Behavior |
|
|
41
|
+
|------|-------------|----------|
|
|
42
|
+
| Autonomous (`BUILDWRIGHT_AUTO_APPROVE=true`, default) | Commit + push + failed PR + exit(1) | CI/CD fails, PR shows failure details |
|
|
43
|
+
| Interactive (`BUILDWRIGHT_AUTO_APPROVE=false`) | STOP, show error | Human fixes in-session |
|
|
44
|
+
|
|
45
|
+
**Autonomous failure path** (verify retries exhausted / critical security / review blocked):
|
|
46
|
+
1. Commit all completed work to feature branch
|
|
47
|
+
2. Push branch
|
|
48
|
+
3. Create PR with failure summary (see template below)
|
|
49
|
+
4. Exit with error code (pipeline fails in CI/CD)
|
|
50
|
+
|
|
51
|
+
**Interactive failure path**: STOP and report blocker.
|
|
52
|
+
|
|
53
|
+
### PR Failure Summary Template
|
|
54
|
+
|
|
55
|
+
```markdown
|
|
56
|
+
## BUILDWRIGHT: Pipeline Failed
|
|
57
|
+
|
|
58
|
+
**Feature:** [name]
|
|
59
|
+
**Mode:** Autonomous
|
|
60
|
+
**Failed at:** [Verify / Security / Review]
|
|
61
|
+
**Reason:** [Retries exhausted / Critical vulnerability / Changes requested]
|
|
62
|
+
|
|
63
|
+
### Pipeline Status
|
|
64
|
+
| Step | Status | Details |
|
|
65
|
+
|------|--------|---------|
|
|
66
|
+
| Verify | [pass/fail] | [details] |
|
|
67
|
+
| Security | [pass/fail/skipped] | [details] |
|
|
68
|
+
| Review | [pass/fail/skipped] | [details] |
|
|
69
|
+
|
|
70
|
+
### Completed Work
|
|
71
|
+
- [list of completed milestones/steps]
|
|
72
|
+
|
|
73
|
+
### Failure Details
|
|
74
|
+
- [error summary, specific findings, or review feedback]
|
|
75
|
+
|
|
76
|
+
### Skipped
|
|
77
|
+
- [steps that were blocked by the failure]
|
|
78
|
+
|
|
79
|
+
### To Resume
|
|
80
|
+
Fix the issue on this branch, then re-run the relevant command.
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Severity Triage
|
|
84
|
+
|
|
85
|
+
| Severity | Action | Example |
|
|
86
|
+
|----------|--------|---------|
|
|
87
|
+
| **Critical / High** | Block — must fix before merge | SQL injection, exposed secrets, auth bypass |
|
|
88
|
+
| **Medium** | Fix in this PR if feasible, otherwise track | Missing rate limiting, verbose error messages |
|
|
89
|
+
| **Low / Info** | Advisory — log and move on | Minor header hardening, informational findings |
|
|
90
|
+
|
|
91
|
+
Only Critical/High findings block the pipeline. Medium and Low findings are reported but don't prevent shipping.
|
|
92
|
+
|
|
93
|
+
## Agent Personas
|
|
94
|
+
|
|
95
|
+
| Agent | File | Purpose |
|
|
96
|
+
|-------|------|---------|
|
|
97
|
+
| Staff Engineer | `.buildwright/agents/staff-engineer.md` | Spec & code review, confidence scoring (≥80) |
|
|
98
|
+
| Security Engineer | `.buildwright/agents/security-engineer.md` | Security review, exploit scenarios, hard exclusions |
|
|
99
|
+
| Architect | `.buildwright/agents/architect.md` | Claw Architecture — decomposes cross-domain features |
|
package/templates/CLAUDE.md
CHANGED
|
@@ -1 +1,150 @@
|
|
|
1
|
-
|
|
1
|
+
# Buildwright Development
|
|
2
|
+
|
|
3
|
+
## Mission
|
|
4
|
+
Agent-first autonomous development. Humans approve specs; agents implement, test, and ship.
|
|
5
|
+
|
|
6
|
+
## Steering Documents
|
|
7
|
+
|
|
8
|
+
At the start of every session, read **all** `.md` files in `.buildwright/steering/`.
|
|
9
|
+
Also read all `.md` files in `.buildwright/codebase/` if that directory exists — these
|
|
10
|
+
are codebase analysis docs (stack, architecture, conventions, concerns) generated by
|
|
11
|
+
/bw-analyse. Do not assume a fixed set of files; discover what is there.
|
|
12
|
+
|
|
13
|
+
## Agents & Claws
|
|
14
|
+
- Agent personas in `.buildwright/agents/` — Architect, Staff Engineer, Security Engineer
|
|
15
|
+
- Domain-specialist claws in `.buildwright/claws/` — Frontend, Backend, Database (+ TEMPLATE for custom)
|
|
16
|
+
- Use `/bw-claw` for cross-domain features that need the Claw Architecture
|
|
17
|
+
- For multi-claw work: use the best available model for Architect and Security review; lighter models suffice for Database and API claws.
|
|
18
|
+
|
|
19
|
+
## Project Structure
|
|
20
|
+
|
|
21
|
+
`.buildwright/` is the canonical configuration directory (committed to git). Tool-specific directories are generated from it and gitignored:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
.buildwright/ ← Canonical source (committed)
|
|
25
|
+
agents/ ← Architect, Staff Engineer, Security Engineer
|
|
26
|
+
claws/ ← Frontend, Backend, Database, TEMPLATE
|
|
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
|
|
29
|
+
steering/ ← product.md, tech.md, quality-gates.md, naming-conventions.md
|
|
30
|
+
tasks/
|
|
31
|
+
|
|
32
|
+
.claude/ ← Generated by `make sync` (gitignored, except settings.json)
|
|
33
|
+
.opencode/ ← Generated by `make sync` (gitignored)
|
|
34
|
+
.cursor/rules/ ← Generated by `make sync` (gitignored)
|
|
35
|
+
AGENTS.md ← Generated by `make sync` (gitignored)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
After cloning or editing `.buildwright/`, run `make sync` to regenerate tool-specific configs.
|
|
39
|
+
|
|
40
|
+
## Operating Mode
|
|
41
|
+
|
|
42
|
+
### Default Behavior
|
|
43
|
+
- AUTONOMOUS mode: Execute fully without asking for confirmation
|
|
44
|
+
- Verify your own work through tests and checks
|
|
45
|
+
- Commit when verification passes
|
|
46
|
+
- Only stop if genuinely blocked (missing info, failing tests after retries)
|
|
47
|
+
- **Autonomous failure handling**: When `BUILDWRIGHT_AUTO_APPROVE=true` (default) and any step fails after retries, commit completed work, push, create PR with failure details, and exit(1). In interactive mode (`BUILDWRIGHT_AUTO_APPROVE=false`), STOP and report blocker as before.
|
|
48
|
+
|
|
49
|
+
### Workflow Priority
|
|
50
|
+
1. **New features (single domain)**: /bw-new-feature → Research → Spec → Approval → Implement → Ship
|
|
51
|
+
2. **Cross-domain features**: /bw-claw → Architect decomposes → Claws execute per domain → Integrate → Ship
|
|
52
|
+
3. **Small tasks/bugs**: /bw-quick → Quick research → Implement → Verify → Commit
|
|
53
|
+
4. **Refactors**: /bw-new-feature (if scope unclear) or /bw-quick (if scope clear)
|
|
54
|
+
5. **Ship existing work**: /bw-ship → Verify → Security → Review → Push → PR
|
|
55
|
+
6. **Quick quality check**: /bw-verify → typecheck, lint, test, build
|
|
56
|
+
7. **Show commands**: /bw-help
|
|
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
|
+
|
|
59
|
+
## Command Discovery
|
|
60
|
+
|
|
61
|
+
Run once per session. Cache the result — do not re-detect on every step.
|
|
62
|
+
|
|
63
|
+
1. Read `.buildwright/steering/tech.md`. If "Project Commands" has real commands (not template placeholders) → use them. STOP.
|
|
64
|
+
2. Auto-detect from project files in priority order: `package.json` → Node.js (check lock files: `pnpm-lock.yaml`→pnpm, `yarn.lock`→yarn, `bun.lockb`→bun, else→npm) | `Cargo.toml` → cargo | `go.mod` → go | `pyproject.toml` → check `poetry.lock`→poetry, `uv.lock`→uv, else→pip/hatch | `setup.py` → pip | `requirements.txt` → pip | `Makefile` → read targets.
|
|
65
|
+
3. Derive four commands — typecheck, lint, test, build. If a stack has no equivalent for an operation, mark it SKIP (not a failure). Python has no build step; that's fine.
|
|
66
|
+
4. Write discovered commands to tech.md so future runs use step 1.
|
|
67
|
+
5. If still ambiguous: in a greenfield context go to the Greenfield Path (see bw-new-feature). Otherwise ask: "What commands run your tests, linter, and build?"
|
|
68
|
+
|
|
69
|
+
## Credentials & Environment Variables
|
|
70
|
+
|
|
71
|
+
| Variable | Default | Required | Purpose |
|
|
72
|
+
|----------|---------|----------|---------|
|
|
73
|
+
| `GITHUB_TOKEN` | — | Yes | Push branches and open PRs via `gh`. Needs `repo` scope. |
|
|
74
|
+
| `BUILDWRIGHT_AUTO_APPROVE` | `true` | No | Autonomous mode — skip human approval, fail gracefully on errors |
|
|
75
|
+
| `BUILDWRIGHT_AGENT_RETRIES` | `2` | No | Number of verify retries before giving up |
|
|
76
|
+
|
|
77
|
+
`GITHUB_TOKEN` is the only credential. Use a fine-grained personal access token scoped to a single repository with "Contents: Read and write" and "Pull requests: Read and write" permissions. `BUILDWRIGHT_AUTO_APPROVE` is a configuration flag, not a secret.
|
|
78
|
+
|
|
79
|
+
## Verification Loop (CRITICAL)
|
|
80
|
+
|
|
81
|
+
Before EVERY commit, discover commands first (see Command Discovery above), then run:
|
|
82
|
+
|
|
83
|
+
1. **Type check** — run DISCOVERED_TYPECHECK (SKIP gracefully if this stack has none)
|
|
84
|
+
2. **Lint** — run DISCOVERED_LINT (SKIP gracefully if this stack has none)
|
|
85
|
+
3. **Test** — run DISCOVERED_TEST
|
|
86
|
+
4. **Build** — run DISCOVERED_BUILD (SKIP gracefully if this stack has no build step, e.g. Python)
|
|
87
|
+
|
|
88
|
+
If ANY required step fails: fix and retry (max 2 attempts). If same error repeats or still failing: STOP and report blocker.
|
|
89
|
+
|
|
90
|
+
## Git Rules
|
|
91
|
+
- Atomic commits: only commit files you changed
|
|
92
|
+
- Conventional commits: feat:, fix:, refactor:, test:, docs:, chore:
|
|
93
|
+
- List each file explicitly in commit message
|
|
94
|
+
- Never edit .env files
|
|
95
|
+
- Never run destructive git operations without explicit instruction
|
|
96
|
+
- Multi-agent safety: NEVER use git stash (other agents may be working)
|
|
97
|
+
- Only `.buildwright/` is committed — never commit `.claude/` or `.opencode/` content files
|
|
98
|
+
- After editing any file in `.buildwright/`, run `make sync` before committing
|
|
99
|
+
- Before committing, update README.md, docs/, or CHANGELOG.md if the change affects user-facing behavior
|
|
100
|
+
|
|
101
|
+
## Cross-Domain Features (Claw Architecture)
|
|
102
|
+
When a feature touches multiple domains (e.g., DB + API + UI):
|
|
103
|
+
1. `/bw-claw` triggers the Architect persona (`.buildwright/agents/architect.md`)
|
|
104
|
+
2. Architect registers new fields in `.buildwright/steering/naming-conventions.md` BEFORE spawning claws
|
|
105
|
+
3. Each claw (`.buildwright/claws/*.md`) executes its domain task using TDD
|
|
106
|
+
4. Claws derive naming from the conventions registry — they never invent their own
|
|
107
|
+
5. Architect integrates and runs quality gates
|
|
108
|
+
|
|
109
|
+
## Design Principles (ALWAYS APPLY)
|
|
110
|
+
|
|
111
|
+
1. **KISS (Keep It Simple, Stupid)**
|
|
112
|
+
- Prefer simple solutions over clever ones
|
|
113
|
+
- If it feels complex, step back and simplify
|
|
114
|
+
- Code should be readable by a junior developer
|
|
115
|
+
|
|
116
|
+
2. **YAGNI (You Aren't Gonna Need It)**
|
|
117
|
+
- Build only what's required NOW
|
|
118
|
+
- No speculative features "for later"
|
|
119
|
+
- Avoid abstractions until they're proven needed
|
|
120
|
+
|
|
121
|
+
3. **No Premature Optimization**
|
|
122
|
+
- Make it work first, then make it fast (if needed)
|
|
123
|
+
- Optimize only with profiling data
|
|
124
|
+
- Readability > micro-optimizations
|
|
125
|
+
|
|
126
|
+
4. **Boring Technology**
|
|
127
|
+
- Prefer proven, well-documented solutions
|
|
128
|
+
- New tech only when it solves a real problem
|
|
129
|
+
- Consider maintenance burden
|
|
130
|
+
|
|
131
|
+
5. **Fail Fast, Fail Loud**
|
|
132
|
+
- Validate inputs at boundaries
|
|
133
|
+
- Throw errors early with clear messages
|
|
134
|
+
- No silent failures
|
|
135
|
+
|
|
136
|
+
## Code Standards
|
|
137
|
+
- Follow existing patterns in the codebase exactly
|
|
138
|
+
- Keep files under 500 lines; split proactively
|
|
139
|
+
- Write tests for all new functionality (TDD preferred)
|
|
140
|
+
- Avoid type system escape hatches (`any` in TypeScript, untyped `interface{}` in Go, `Any` in Python) — use proper types
|
|
141
|
+
- Use Decimal/BigDecimal for financial calculations, NEVER floating point
|
|
142
|
+
- All user inputs must be validated
|
|
143
|
+
|
|
144
|
+
## Self-Improvement
|
|
145
|
+
When you discover a pattern, gotcha, or better approach:
|
|
146
|
+
- Add it below under "Learned Patterns"
|
|
147
|
+
- Keep entries concise (one line each)
|
|
148
|
+
|
|
149
|
+
## Learned Patterns
|
|
150
|
+
<!-- Agent adds entries here as it learns -->
|
package/templates/Makefile
CHANGED
|
@@ -1 +1,82 @@
|
|
|
1
|
-
|
|
1
|
+
.PHONY: dist clean sync sync-check cursor opencode openclaw validate install-hooks uninstall-hooks bump test-cli
|
|
2
|
+
|
|
3
|
+
# ============================================================================
|
|
4
|
+
# Sync — Generate .claude/, .opencode/, .cursor/rules/ from .buildwright/ (canonical)
|
|
5
|
+
# Source of truth: .buildwright/ → .claude/ + .opencode/ + .cursor/rules/ + AGENTS.md + dist/
|
|
6
|
+
# ============================================================================
|
|
7
|
+
|
|
8
|
+
sync:
|
|
9
|
+
@chmod +x scripts/sync-agents.sh
|
|
10
|
+
@scripts/sync-agents.sh
|
|
11
|
+
|
|
12
|
+
sync-check:
|
|
13
|
+
@chmod +x scripts/sync-agents.sh
|
|
14
|
+
@scripts/sync-agents.sh --check
|
|
15
|
+
|
|
16
|
+
# ============================================================================
|
|
17
|
+
# Package for distribution
|
|
18
|
+
# ============================================================================
|
|
19
|
+
|
|
20
|
+
# ClawHub — upload dist/buildwright/ folder to https://clawhub.ai/upload
|
|
21
|
+
dist: sync
|
|
22
|
+
@echo "dist/buildwright/ ready — upload this folder to ClawHub"
|
|
23
|
+
|
|
24
|
+
# Cursor — print setup instructions (rules generated by make sync)
|
|
25
|
+
cursor: sync
|
|
26
|
+
@echo "Cursor rules generated at .cursor/rules/"
|
|
27
|
+
@echo "Open this project in Cursor — rules are applied automatically."
|
|
28
|
+
@echo "Settings > Rules shows steering rules as 'Always' and commands/agents/claws as 'Intelligent'."
|
|
29
|
+
|
|
30
|
+
# OpenCode — install skill to user global config
|
|
31
|
+
opencode: sync
|
|
32
|
+
@mkdir -p ~/.config/opencode/skills/buildwright
|
|
33
|
+
@cp SKILL.md ~/.config/opencode/skills/buildwright/SKILL.md
|
|
34
|
+
@echo "Installed to ~/.config/opencode/skills/buildwright/"
|
|
35
|
+
|
|
36
|
+
# OpenClaw — install skill to user skills directory
|
|
37
|
+
openclaw: sync
|
|
38
|
+
@mkdir -p ~/.openclaw/skills/buildwright
|
|
39
|
+
@cp SKILL.md ~/.openclaw/skills/buildwright/SKILL.md
|
|
40
|
+
@echo "Installed to ~/.openclaw/skills/buildwright/"
|
|
41
|
+
|
|
42
|
+
# ============================================================================
|
|
43
|
+
# Validate SKILL.md against Agent Skills spec (agentskills.io)
|
|
44
|
+
# ============================================================================
|
|
45
|
+
|
|
46
|
+
validate:
|
|
47
|
+
@chmod +x scripts/validate-skill.sh
|
|
48
|
+
@scripts/validate-skill.sh SKILL.md
|
|
49
|
+
|
|
50
|
+
# ============================================================================
|
|
51
|
+
# Git Hooks — keep .buildwright/ ↔ generated files in sync automatically
|
|
52
|
+
# ============================================================================
|
|
53
|
+
|
|
54
|
+
install-hooks:
|
|
55
|
+
@chmod +x scripts/install-hooks.sh
|
|
56
|
+
@scripts/install-hooks.sh
|
|
57
|
+
|
|
58
|
+
uninstall-hooks:
|
|
59
|
+
@rm -f .git/hooks/pre-commit .git/hooks/post-merge .git/hooks/post-checkout
|
|
60
|
+
@echo "Buildwright hooks removed."
|
|
61
|
+
|
|
62
|
+
# ============================================================================
|
|
63
|
+
# Clean
|
|
64
|
+
# ============================================================================
|
|
65
|
+
|
|
66
|
+
bump: ## Bump version: make bump [BUMP=patch|minor|major]
|
|
67
|
+
@chmod +x scripts/bump-version.sh
|
|
68
|
+
@scripts/bump-version.sh $(or $(BUMP),patch)
|
|
69
|
+
|
|
70
|
+
test-cli: ## Pack and install CLI globally for local testing
|
|
71
|
+
@echo "Packing cli/..."
|
|
72
|
+
@cd cli && npm pack
|
|
73
|
+
@TARBALL=$$(ls cli/buildwright-*.tgz | tail -1) && \
|
|
74
|
+
npm install -g "./$$TARBALL" && \
|
|
75
|
+
rm -f "$$TARBALL"
|
|
76
|
+
@echo ""
|
|
77
|
+
@echo "✓ buildwright installed globally from local pack"
|
|
78
|
+
@echo " Test it: cd /tmp && mkdir test-bw && cd test-bw && buildwright init"
|
|
79
|
+
@echo " Uninstall: npm uninstall -g buildwright"
|
|
80
|
+
|
|
81
|
+
clean:
|
|
82
|
+
rm -rf dist/
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Feature: [Name]
|
|
2
|
+
|
|
3
|
+
## Problem Statement
|
|
4
|
+
[What problem are we solving? Who has this problem?]
|
|
5
|
+
|
|
6
|
+
## Success Metrics
|
|
7
|
+
- [Metric]: [Target]
|
|
8
|
+
|
|
9
|
+
## User Stories
|
|
10
|
+
As a [role], I want [capability] so that [benefit].
|
|
11
|
+
|
|
12
|
+
## Functional Requirements
|
|
13
|
+
|
|
14
|
+
### Must Have (MVP)
|
|
15
|
+
1. [Requirement]
|
|
16
|
+
- Acceptance: [Criteria]
|
|
17
|
+
|
|
18
|
+
### Should Have
|
|
19
|
+
1. [Requirement]
|
|
20
|
+
|
|
21
|
+
### Out of Scope
|
|
22
|
+
- [What NOT to build]
|
|
23
|
+
|
|
24
|
+
## Constraints
|
|
25
|
+
- Timeline: [Deadline]
|
|
26
|
+
- Technical: [Integrations, platforms]
|
|
27
|
+
- Regulatory: [Compliance]
|
|
28
|
+
|
|
29
|
+
## Examples / Edge Cases
|
|
30
|
+
1. [Scenario]: [Expected behavior]
|
|
31
|
+
|
|
32
|
+
## Open Questions
|
|
33
|
+
[Questions needing answers]
|