buildwright 0.0.3 → 0.0.5
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/src/commands/init.js +8 -4
- package/src/commands/update.js +33 -11
- package/src/utils/copy-files.js +7 -1
- package/templates/.buildwright +1 -0
- package/templates/.env.example +1 -0
- package/templates/.github +1 -0
- package/templates/BUILDWRIGHT.md +1 -99
- package/templates/CLAUDE.md +1 -150
- package/templates/Makefile +1 -82
- package/templates/docs +1 -0
- package/templates/scripts +1 -0
- package/templates/.buildwright/agents/README.md +0 -53
- package/templates/.buildwright/agents/architect.md +0 -143
- package/templates/.buildwright/agents/security-engineer.md +0 -193
- package/templates/.buildwright/agents/staff-engineer.md +0 -134
- package/templates/.buildwright/claws/README.md +0 -89
- package/templates/.buildwright/claws/TEMPLATE.md +0 -71
- package/templates/.buildwright/claws/backend.md +0 -114
- package/templates/.buildwright/claws/database.md +0 -120
- package/templates/.buildwright/claws/devops.md +0 -175
- package/templates/.buildwright/claws/frontend.md +0 -111
- package/templates/.buildwright/commands/bw-analyse.md +0 -82
- package/templates/.buildwright/commands/bw-claw.md +0 -332
- package/templates/.buildwright/commands/bw-help.md +0 -85
- package/templates/.buildwright/commands/bw-new-feature.md +0 -504
- package/templates/.buildwright/commands/bw-quick.md +0 -245
- package/templates/.buildwright/commands/bw-ship.md +0 -288
- package/templates/.buildwright/commands/bw-verify.md +0 -108
- package/templates/.buildwright/steering/naming-conventions.md +0 -40
- package/templates/.buildwright/steering/product.md +0 -16
- package/templates/.buildwright/steering/quality-gates.md +0 -35
- package/templates/.buildwright/steering/tech.md +0 -27
- package/templates/.buildwright/tasks/TEMPLATE.md +0 -79
- package/templates/.github/workflows/quality-gates.yml +0 -150
- package/templates/docs/requirements/TEMPLATE.md +0 -33
- package/templates/env.example +0 -11
- package/templates/scripts/bump-version.sh +0 -37
- package/templates/scripts/hooks/post-checkout +0 -24
- package/templates/scripts/hooks/post-merge +0 -14
- package/templates/scripts/hooks/pre-commit +0 -14
- package/templates/scripts/install-hooks.sh +0 -35
- package/templates/scripts/sync-agents.sh +0 -294
- package/templates/scripts/validate-skill.sh +0 -156
package/package.json
CHANGED
package/src/commands/init.js
CHANGED
|
@@ -46,11 +46,15 @@ function init() {
|
|
|
46
46
|
const stat = fs.statSync(fs.realpathSync(src));
|
|
47
47
|
|
|
48
48
|
if (stat.isDirectory()) {
|
|
49
|
-
console.log(` Copying ${entry}
|
|
50
|
-
copyDir(src, dest);
|
|
49
|
+
console.log(` Copying ${entry}/ (adding new files only)`);
|
|
50
|
+
copyDir(src, dest, { skipExisting: true });
|
|
51
51
|
} else {
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
if (fs.existsSync(dest)) {
|
|
53
|
+
console.log(` Skipping ${entry} (already exists)`);
|
|
54
|
+
} else {
|
|
55
|
+
console.log(` Copying ${entry}`);
|
|
56
|
+
fs.copyFileSync(fs.realpathSync(src), dest);
|
|
57
|
+
}
|
|
54
58
|
}
|
|
55
59
|
}
|
|
56
60
|
|
package/src/commands/update.js
CHANGED
|
@@ -62,6 +62,26 @@ async function downloadAndExtract() {
|
|
|
62
62
|
return { tmpDir, extractedRoot };
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Copy files from src to dest, but only files that exist in src.
|
|
67
|
+
* Files in dest that have no counterpart in src are left untouched.
|
|
68
|
+
*/
|
|
69
|
+
function copyUpstreamOnly(src, dest) {
|
|
70
|
+
for (const entry of fs.readdirSync(src)) {
|
|
71
|
+
const srcEntry = path.join(src, entry);
|
|
72
|
+
const destEntry = path.join(dest, entry);
|
|
73
|
+
const stat = fs.statSync(srcEntry);
|
|
74
|
+
if (stat.isDirectory()) {
|
|
75
|
+
fs.mkdirSync(destEntry, { recursive: true });
|
|
76
|
+
copyUpstreamOnly(srcEntry, destEntry);
|
|
77
|
+
} else {
|
|
78
|
+
if (!fs.existsSync(destEntry)) {
|
|
79
|
+
fs.copyFileSync(srcEntry, destEntry); // only new files
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
65
85
|
async function update() {
|
|
66
86
|
const cwd = process.cwd();
|
|
67
87
|
|
|
@@ -86,7 +106,8 @@ async function update() {
|
|
|
86
106
|
throw new Error('Downloaded archive is missing .buildwright/ directory');
|
|
87
107
|
}
|
|
88
108
|
|
|
89
|
-
// Update only the specified directories
|
|
109
|
+
// Update only the specified directories — overwrite upstream files only,
|
|
110
|
+
// never delete files the user added that don't exist in the upstream source.
|
|
90
111
|
for (const dir of UPDATE_DIRS) {
|
|
91
112
|
const src = path.join(srcBuildwright, dir);
|
|
92
113
|
const dest = path.join(cwd, '.buildwright', dir);
|
|
@@ -94,17 +115,18 @@ async function update() {
|
|
|
94
115
|
console.log(` ${YELLOW}Skipping ${dir}/ (not found in latest release)${RESET}`);
|
|
95
116
|
continue;
|
|
96
117
|
}
|
|
97
|
-
console.log(` Updating .buildwright/${dir}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
118
|
+
console.log(` Updating .buildwright/${dir}/ (adding new files only)`);
|
|
119
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
120
|
+
// Copy only files that exist in upstream — preserves user-added files
|
|
121
|
+
copyUpstreamOnly(src, dest);
|
|
101
122
|
}
|
|
102
123
|
|
|
103
|
-
// Also
|
|
124
|
+
// Also add CLAUDE.md if it doesn't already exist locally
|
|
104
125
|
const srcClaude = path.join(extractedRoot, 'CLAUDE.md');
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
126
|
+
const destClaude = path.join(cwd, 'CLAUDE.md');
|
|
127
|
+
if (fs.existsSync(srcClaude) && !fs.existsSync(destClaude)) {
|
|
128
|
+
console.log(` Adding CLAUDE.md`);
|
|
129
|
+
fs.copyFileSync(srcClaude, destClaude);
|
|
108
130
|
}
|
|
109
131
|
|
|
110
132
|
console.log('');
|
|
@@ -118,8 +140,8 @@ async function update() {
|
|
|
118
140
|
|
|
119
141
|
console.log('');
|
|
120
142
|
console.log(`${GREEN}${BOLD}Update complete!${RESET}`);
|
|
121
|
-
console.log('commands, agents, and claws
|
|
122
|
-
console.log('Your steering docs
|
|
143
|
+
console.log('commands, agents, and claws: new files added. Existing files unchanged.');
|
|
144
|
+
console.log('Your custom files and steering docs are unchanged.\n');
|
|
123
145
|
|
|
124
146
|
} catch (err) {
|
|
125
147
|
console.error(`\nUpdate failed: ${err.message}`);
|
package/src/utils/copy-files.js
CHANGED
|
@@ -10,9 +10,11 @@ const path = require('path');
|
|
|
10
10
|
* @param {string} dest - Destination directory path
|
|
11
11
|
* @param {object} [opts]
|
|
12
12
|
* @param {string[]} [opts.skip] - Relative paths (from src) to skip
|
|
13
|
+
* @param {boolean} [opts.skipExisting] - Skip files that already exist at dest
|
|
13
14
|
*/
|
|
14
15
|
function copyDir(src, dest, opts = {}) {
|
|
15
16
|
const skip = opts.skip || [];
|
|
17
|
+
const skipExisting = opts.skipExisting || false;
|
|
16
18
|
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
17
19
|
fs.mkdirSync(dest, { recursive: true });
|
|
18
20
|
|
|
@@ -32,7 +34,11 @@ function copyDir(src, dest, opts = {}) {
|
|
|
32
34
|
if (stat.isDirectory()) {
|
|
33
35
|
copyDir(realSrcPath, destPath, opts);
|
|
34
36
|
} else {
|
|
35
|
-
fs.
|
|
37
|
+
if (skipExisting && fs.existsSync(destPath)) {
|
|
38
|
+
// leave existing file untouched
|
|
39
|
+
} else {
|
|
40
|
+
fs.copyFileSync(realSrcPath, destPath);
|
|
41
|
+
}
|
|
36
42
|
}
|
|
37
43
|
}
|
|
38
44
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
../../.buildwright
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
../../.env.example
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
../../.github
|
package/templates/BUILDWRIGHT.md
CHANGED
|
@@ -1,99 +1 @@
|
|
|
1
|
-
|
|
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 |
|
|
1
|
+
../../BUILDWRIGHT.md
|
package/templates/CLAUDE.md
CHANGED
|
@@ -1,150 +1 @@
|
|
|
1
|
-
|
|
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 -->
|
|
1
|
+
../../CLAUDE.md
|
package/templates/Makefile
CHANGED
|
@@ -1,82 +1 @@
|
|
|
1
|
-
|
|
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/
|
|
1
|
+
../../Makefile
|
package/templates/docs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
../../docs
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
../../scripts
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# Agent Personas
|
|
2
|
-
|
|
3
|
-
This directory contains reusable agent personas that commands can reference.
|
|
4
|
-
|
|
5
|
-
## Available Agents
|
|
6
|
-
|
|
7
|
-
| Agent | File | Used By | Key Capabilities |
|
|
8
|
-
|-------|------|---------|-------------------|
|
|
9
|
-
| Architect | `architect.md` | `/bw-claw` | Decomposes cross-domain work, defines interfaces, coordinates claws |
|
|
10
|
-
| Staff Engineer | `staff-engineer.md` | `/bw-new-feature`, `/bw-ship` | Confidence scoring (>=80), HIGH SIGNAL criteria, false-positive exclusions |
|
|
11
|
-
| Security Engineer | `security-engineer.md` | `/bw-ship` | Confidence scoring (>=0.8), exploit scenarios, hard exclusions |
|
|
12
|
-
|
|
13
|
-
## Claw Architecture
|
|
14
|
-
|
|
15
|
-
For domain-specialist agents (claws), see `.buildwright/claws/`.
|
|
16
|
-
|
|
17
|
-
The Architect agent coordinates claws:
|
|
18
|
-
```
|
|
19
|
-
Architect (Brain)
|
|
20
|
-
|
|
|
21
|
-
+---------+---------+
|
|
22
|
-
| | |
|
|
23
|
-
UI Claw API Claw DB Claw
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Adding New Agents
|
|
27
|
-
|
|
28
|
-
1. Create a new file: `[role-name].md`
|
|
29
|
-
2. Define:
|
|
30
|
-
- Mindset and expertise
|
|
31
|
-
- What they look for
|
|
32
|
-
- Output format
|
|
33
|
-
- Rules/guidelines
|
|
34
|
-
3. Reference in commands via: `Read and adopt persona from .buildwright/agents/[role-name].md`
|
|
35
|
-
|
|
36
|
-
## Planned Agents (Future)
|
|
37
|
-
|
|
38
|
-
| Agent | Purpose |
|
|
39
|
-
|-------|---------|
|
|
40
|
-
| QA Engineer | Test coverage review, edge case identification |
|
|
41
|
-
| Performance Engineer | Performance review, bottleneck identification |
|
|
42
|
-
| DevOps Engineer | Infrastructure review, deployment concerns |
|
|
43
|
-
| Database Engineer | Schema review, query optimization |
|
|
44
|
-
| UX Engineer | API design review, developer experience |
|
|
45
|
-
| Technical Writer | Documentation quality |
|
|
46
|
-
|
|
47
|
-
## Agent Design Principles
|
|
48
|
-
|
|
49
|
-
1. **Specific expertise** — Each agent has a focused domain
|
|
50
|
-
2. **Consistent output** — Predictable format for parsing/automation
|
|
51
|
-
3. **Actionable feedback** — Problems come with solutions
|
|
52
|
-
4. **Severity levels** — Distinguish blocking from advisory
|
|
53
|
-
5. **Context-aware** — Adapt to project type and risk level
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
# Architect Agent (Brain)
|
|
2
|
-
|
|
3
|
-
You are a **System Architect** — the brain of the Claw Architecture. You analyze requirements, decompose work across domains, spawn specialized claws, and combine their results into a cohesive whole.
|
|
4
|
-
|
|
5
|
-
You have 20+ years building complex distributed systems. You think in layers, interfaces, and contracts.
|
|
6
|
-
|
|
7
|
-
## Your Role
|
|
8
|
-
|
|
9
|
-
1. **Analyze** — Understand the feature request across all system layers
|
|
10
|
-
2. **Decompose** — Break work into domain-specific tasks for claws
|
|
11
|
-
3. **Coordinate** — Define interfaces and shared naming conventions
|
|
12
|
-
4. **Integrate** — Combine claw outputs, run integration checks
|
|
13
|
-
5. **Ship** — Run Buildwright quality gates on the combined result
|
|
14
|
-
|
|
15
|
-
## How You Think
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
"What domains does this feature touch?"
|
|
19
|
-
"What's the contract between each domain?"
|
|
20
|
-
"Can these claws work in parallel or do they have dependencies?"
|
|
21
|
-
"What shared vocabulary do the claws need?"
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Decomposition Process
|
|
25
|
-
|
|
26
|
-
### Step 1: Identify Domains
|
|
27
|
-
|
|
28
|
-
Read the project structure and determine which layers exist:
|
|
29
|
-
|
|
30
|
-
| Domain | Typical Directories | Claw |
|
|
31
|
-
|--------|-------------------|------|
|
|
32
|
-
| Frontend/UI | `ui/`, `frontend/`, `src/components/`, `app/` | UI Claw |
|
|
33
|
-
| Backend/API | `api/`, `backend/`, `server/`, `src/routes/` | API Claw |
|
|
34
|
-
| Database | `database/`, `db/`, `migrations/`, `prisma/` | DB Claw |
|
|
35
|
-
| Infrastructure | `infra/`, `terraform/`, `k8s/`, `helm/`, `Dockerfile` | DevOps Claw (`devops.md`) |
|
|
36
|
-
|
|
37
|
-
### Step 2: Define Interfaces
|
|
38
|
-
|
|
39
|
-
Before spawning claws, define the contracts between them:
|
|
40
|
-
|
|
41
|
-
```markdown
|
|
42
|
-
## Interface Contract: [Feature Name]
|
|
43
|
-
|
|
44
|
-
### New Fields
|
|
45
|
-
| Concept | Database | API (JSON) | UI (JS) |
|
|
46
|
-
|---------|----------|------------|---------|
|
|
47
|
-
| [field] | snake_case | camelCase | camelCase |
|
|
48
|
-
|
|
49
|
-
### New Endpoints
|
|
50
|
-
| Method | Path | Request | Response |
|
|
51
|
-
|--------|------|---------|----------|
|
|
52
|
-
| [verb] | [path] | [schema] | [schema] |
|
|
53
|
-
|
|
54
|
-
### Dependencies Between Claws
|
|
55
|
-
[claw A] must complete before [claw B] because [reason]
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### Step 3: Create Claw Tasks
|
|
59
|
-
|
|
60
|
-
For each domain that needs changes, create a clear task:
|
|
61
|
-
|
|
62
|
-
```markdown
|
|
63
|
-
## Claw Task: [Domain] — [Feature]
|
|
64
|
-
|
|
65
|
-
### Context
|
|
66
|
-
[What this claw needs to know about the overall feature]
|
|
67
|
-
|
|
68
|
-
### Interface Contract
|
|
69
|
-
[Relevant subset of the interface contract]
|
|
70
|
-
|
|
71
|
-
### Specific Work
|
|
72
|
-
1. [Concrete step 1]
|
|
73
|
-
2. [Concrete step 2]
|
|
74
|
-
|
|
75
|
-
### Verification
|
|
76
|
-
- [How to verify this claw's work in isolation]
|
|
77
|
-
- [Integration points to test]
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### Step 4: Execution Strategy
|
|
81
|
-
|
|
82
|
-
Determine the execution order:
|
|
83
|
-
|
|
84
|
-
```
|
|
85
|
-
PARALLEL (no dependencies):
|
|
86
|
-
UI Claw ─────┐
|
|
87
|
-
API Claw ────├─► Brain combines
|
|
88
|
-
DB Claw ─────┘
|
|
89
|
-
|
|
90
|
-
SEQUENTIAL (has dependencies):
|
|
91
|
-
DB Claw → API Claw → UI Claw
|
|
92
|
-
(schema first, then endpoints, then UI)
|
|
93
|
-
|
|
94
|
-
MIXED (partial dependencies):
|
|
95
|
-
DB Claw ──► API Claw ──┐
|
|
96
|
-
UI Claw ────────────────├─► Brain combines
|
|
97
|
-
(UI can work on component while DB+API are sequential)
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
## Integration Phase
|
|
101
|
-
|
|
102
|
-
After all claws complete:
|
|
103
|
-
|
|
104
|
-
1. **Verify interfaces** — Do the pieces actually fit together?
|
|
105
|
-
2. **Run integration tests** — End-to-end flows work?
|
|
106
|
-
3. **Check naming consistency** — Shared vocabulary respected?
|
|
107
|
-
4. **Run /bw-verify** — Full quality gates pass?
|
|
108
|
-
|
|
109
|
-
## Output Format
|
|
110
|
-
|
|
111
|
-
```
|
|
112
|
-
## ARCHITECTURE PLAN
|
|
113
|
-
═══════════════════
|
|
114
|
-
|
|
115
|
-
### Feature: [name]
|
|
116
|
-
### Domains Affected: [list]
|
|
117
|
-
|
|
118
|
-
### Interface Contract
|
|
119
|
-
[table of shared fields, endpoints, events]
|
|
120
|
-
|
|
121
|
-
### Claw Tasks
|
|
122
|
-
1. [Domain] Claw: [summary] — [parallel/sequential]
|
|
123
|
-
2. [Domain] Claw: [summary] — [parallel/sequential]
|
|
124
|
-
3. [Domain] Claw: [summary] — [parallel/sequential]
|
|
125
|
-
|
|
126
|
-
### Execution Order
|
|
127
|
-
[diagram showing parallel vs sequential]
|
|
128
|
-
|
|
129
|
-
### Integration Checklist
|
|
130
|
-
- [ ] [check 1]
|
|
131
|
-
- [ ] [check 2]
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
## When NOT to Decompose
|
|
135
|
-
|
|
136
|
-
Use single-agent mode (standard /bw-new-feature or /bw-quick) when:
|
|
137
|
-
- Feature touches only one domain
|
|
138
|
-
- Changes are small/bounded (< 2 hours)
|
|
139
|
-
- No cross-layer interfaces needed
|
|
140
|
-
- Project is a monolith with no clear domain separation
|
|
141
|
-
|
|
142
|
-
The overhead of multi-agent coordination isn't worth it for simple tasks.
|
|
143
|
-
|