buildwright 0.0.7 → 0.0.9
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/bin/buildwright.js +8 -0
- package/package.json +1 -1
- package/src/commands/commands.js +81 -0
- package/templates/.buildwright/commands/bw-help.md +4 -1
- package/templates/.buildwright/commands/bw-new-feature.md +23 -0
- package/templates/.buildwright/commands/bw-plan.md +210 -0
- package/templates/.buildwright/commands/bw-quick.md +11 -0
- package/templates/CLAUDE.md +4 -2
- package/templates/Makefile +8 -1
- package/templates/scripts/sync-agents.sh +22 -1
- package/templates/scripts/validate-docs.sh +67 -0
package/bin/buildwright.js
CHANGED
|
@@ -5,6 +5,7 @@ const { Command } = require('commander');
|
|
|
5
5
|
const { init } = require('../src/commands/init');
|
|
6
6
|
const { update } = require('../src/commands/update');
|
|
7
7
|
const { sync } = require('../src/commands/sync');
|
|
8
|
+
const { commands } = require('../src/commands/commands');
|
|
8
9
|
|
|
9
10
|
const pkg = require('../package.json');
|
|
10
11
|
|
|
@@ -36,4 +37,11 @@ program
|
|
|
36
37
|
sync();
|
|
37
38
|
});
|
|
38
39
|
|
|
40
|
+
program
|
|
41
|
+
.command('commands')
|
|
42
|
+
.description('List available agent slash commands (/bw-*)')
|
|
43
|
+
.action(() => {
|
|
44
|
+
commands();
|
|
45
|
+
});
|
|
46
|
+
|
|
39
47
|
program.parse(process.argv);
|
package/package.json
CHANGED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
const CYAN = '\x1b[36m';
|
|
7
|
+
const BOLD = '\x1b[1m';
|
|
8
|
+
const RESET = '\x1b[0m';
|
|
9
|
+
const DIM = '\x1b[2m';
|
|
10
|
+
|
|
11
|
+
const HARDCODED = [
|
|
12
|
+
{ name: 'bw-analyse', description: 'Analyse codebase: writes stack, architecture, conventions, concerns to .buildwright/codebase/' },
|
|
13
|
+
{ name: 'bw-claw', description: 'Multi-agent: architect decomposes → claws execute per domain' },
|
|
14
|
+
{ name: 'bw-new-feature', description: 'Full pipeline: research → spec → approve → build → ship' },
|
|
15
|
+
{ name: 'bw-plan', description: 'Research a question, produce a written deliverable — no implementation, no commits' },
|
|
16
|
+
{ name: 'bw-quick', description: 'Fast path for bug fixes, small tasks, config changes' },
|
|
17
|
+
{ name: 'bw-ship', description: 'Quality gates + release: verify → security → review → push → PR' },
|
|
18
|
+
{ name: 'bw-verify', description: 'Quick checks: typecheck, lint, test, build' },
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
function parseFrontmatter(content) {
|
|
22
|
+
const parts = content.split('---');
|
|
23
|
+
if (parts.length < 3) return null;
|
|
24
|
+
const front = parts[1];
|
|
25
|
+
const name = front.match(/^name:\s*(.+)$/m)?.[1]?.trim();
|
|
26
|
+
const description = front.match(/^description:\s*(.+)$/m)?.[1]?.trim();
|
|
27
|
+
return name && description ? { name, description } : null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function loadFromDir(dir) {
|
|
31
|
+
const files = fs.readdirSync(dir).filter(f => f.startsWith('bw-') && f.endsWith('.md') && f !== 'bw-help.md');
|
|
32
|
+
const entries = [];
|
|
33
|
+
for (const file of files) {
|
|
34
|
+
const content = fs.readFileSync(path.join(dir, file), 'utf8');
|
|
35
|
+
const parsed = parseFrontmatter(content);
|
|
36
|
+
if (parsed) entries.push(parsed);
|
|
37
|
+
}
|
|
38
|
+
return entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function formatList(entries) {
|
|
42
|
+
const maxLen = Math.max(...entries.map(e => e.name.length));
|
|
43
|
+
return entries.map(({ name, description }) => {
|
|
44
|
+
const padded = `/${name}`.padEnd(maxLen + 2);
|
|
45
|
+
return ` ${BOLD}${padded}${RESET} ${DIM}${description}${RESET}`;
|
|
46
|
+
}).join('\n');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function commands() {
|
|
50
|
+
const cwd = process.cwd();
|
|
51
|
+
const commandsDir = path.join(cwd, '.buildwright', 'commands');
|
|
52
|
+
|
|
53
|
+
let entries;
|
|
54
|
+
let source;
|
|
55
|
+
|
|
56
|
+
if (fs.existsSync(commandsDir)) {
|
|
57
|
+
entries = loadFromDir(commandsDir);
|
|
58
|
+
source = 'project';
|
|
59
|
+
} else {
|
|
60
|
+
entries = HARDCODED;
|
|
61
|
+
source = 'default';
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
console.log('');
|
|
65
|
+
console.log(`${CYAN}${BOLD}╔═══════════════════════════════════════════════════════════════╗${RESET}`);
|
|
66
|
+
console.log(`${CYAN}${BOLD}║ AGENT SLASH COMMANDS ║${RESET}`);
|
|
67
|
+
console.log(`${CYAN}${BOLD}╚═══════════════════════════════════════════════════════════════╝${RESET}`);
|
|
68
|
+
console.log('');
|
|
69
|
+
console.log('Use these inside Claude Code, Cursor, or OpenCode:');
|
|
70
|
+
console.log('');
|
|
71
|
+
console.log(formatList(entries));
|
|
72
|
+
console.log('');
|
|
73
|
+
if (source === 'default') {
|
|
74
|
+
console.log(`${DIM}(Showing default commands. Run inside a Buildwright project to see project-specific commands.)${RESET}`);
|
|
75
|
+
console.log('');
|
|
76
|
+
}
|
|
77
|
+
console.log(`Run ${BOLD}buildwright help${RESET} for CLI setup commands.`);
|
|
78
|
+
console.log('');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
module.exports = { commands };
|
|
@@ -18,6 +18,7 @@ WORKFLOW
|
|
|
18
18
|
/bw-ship Quality gates + release: verify → security → review → push → PR
|
|
19
19
|
/bw-verify Quick checks: typecheck, lint, test, build
|
|
20
20
|
/bw-analyse Analyse codebase: writes stack, architecture, conventions, concerns to .buildwright/codebase/
|
|
21
|
+
/bw-plan <question> Research a question, produce a written deliverable — no implementation, no commits
|
|
21
22
|
/bw-help Show this command list
|
|
22
23
|
|
|
23
24
|
╔═══════════════════════════════════════════════════════════════╗
|
|
@@ -49,6 +50,7 @@ SHIP EXISTING WORK:
|
|
|
49
50
|
╚═══════════════════════════════════════════════════════════════╝
|
|
50
51
|
|
|
51
52
|
Brownfield, need codebase context → /bw-analyse
|
|
53
|
+
Question/analysis, no coding → /bw-plan
|
|
52
54
|
Single domain, needs planning → /bw-new-feature
|
|
53
55
|
Crosses multiple domains/layers → /bw-claw
|
|
54
56
|
Small task, clear scope → /bw-quick
|
|
@@ -74,7 +76,8 @@ SHIP EXISTING WORK:
|
|
|
74
76
|
║ TIPS ║
|
|
75
77
|
╚═══════════════════════════════════════════════════════════════╝
|
|
76
78
|
|
|
77
|
-
• Use /bw-
|
|
79
|
+
• Use /bw-plan for research, analysis, or planning without implementation
|
|
80
|
+
• Use /bw-new-feature for anything that needs planning + implementation
|
|
78
81
|
• Use /bw-claw when feature crosses domain boundaries
|
|
79
82
|
• Use /bw-quick for clear, bounded tasks
|
|
80
83
|
• Verify retries 2x automatically; security/review stops immediately
|
|
@@ -110,6 +110,29 @@ Extract:
|
|
|
110
110
|
- Existing patterns to follow
|
|
111
111
|
- Commands to use
|
|
112
112
|
|
|
113
|
+
### 2.1b Read Codebase Analysis Docs (if present)
|
|
114
|
+
|
|
115
|
+
If `.buildwright/codebase/` exists (generated by `/bw-analyse`), read all docs there:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
ls .buildwright/codebase/ 2>/dev/null && cat .buildwright/codebase/*.md
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
These docs contain pre-mapped context:
|
|
122
|
+
- `STACK.md` — confirmed tech stack and dependencies
|
|
123
|
+
- `ARCHITECTURE.md` — layer structure, entry points, data flow
|
|
124
|
+
- `CONVENTIONS.md` — naming patterns, import style, test framework
|
|
125
|
+
- `CONCERNS.md` — known issues and gaps to avoid repeating
|
|
126
|
+
|
|
127
|
+
**If codebase docs exist:** they replace most of the general scanning in 2.2. Focus your
|
|
128
|
+
deep-read (2.2) on the specific files relevant to this feature only. Follow the
|
|
129
|
+
conventions and architecture exactly — do not invent new patterns.
|
|
130
|
+
|
|
131
|
+
**If not present:** proceed with 2.2 as written. Consider running `/bw-analyse` first on
|
|
132
|
+
brownfield projects for faster, more accurate results.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
113
136
|
### 2.2 Deep-Read Relevant Codebase
|
|
114
137
|
|
|
115
138
|
Based on the requirements, identify and deeply read relevant areas:
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bw-plan
|
|
3
|
+
description: Research a question or topic and produce a written deliverable — no implementation, no commits
|
|
4
|
+
arguments:
|
|
5
|
+
- name: question
|
|
6
|
+
description: A question, topic, or path to a structured task file (.md)
|
|
7
|
+
required: true
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# /bw-plan — Research and Planning Without Implementation
|
|
11
|
+
|
|
12
|
+
## When to use
|
|
13
|
+
|
|
14
|
+
Research and planning tasks where the output is a written deliverable — not
|
|
15
|
+
implementation. Use when someone asks a question, wants an analysis, or needs
|
|
16
|
+
a structured plan/report before (or instead of) writing code.
|
|
17
|
+
|
|
18
|
+
Examples:
|
|
19
|
+
- "What are the performance risks in this Flutter app?"
|
|
20
|
+
- "Plan a migration from monolith to microservices"
|
|
21
|
+
- "Evaluate which payment provider we should use"
|
|
22
|
+
- "Produce a static analysis report for this codebase"
|
|
23
|
+
|
|
24
|
+
**Contrast with other commands:**
|
|
25
|
+
- `/bw-new-feature` — research + spec + implement + ship
|
|
26
|
+
- `/bw-quick` — implement immediately (no planning doc)
|
|
27
|
+
- `/bw-analyse` — analyse this project's own codebase for Buildwright context
|
|
28
|
+
- `/bw-plan` — research a question, write a deliverable, stop there
|
|
29
|
+
|
|
30
|
+
## Invocation
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
/bw-plan [question or topic | path/to/task.md]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Inline question:**
|
|
37
|
+
```
|
|
38
|
+
/bw-plan "what are the performance risks in this Flutter app?"
|
|
39
|
+
/bw-plan "plan a migration from REST to GraphQL"
|
|
40
|
+
/bw-plan "compare Redis vs Memcached for our session cache"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Structured task file:**
|
|
44
|
+
```
|
|
45
|
+
/bw-plan tasks/flutter-perf-review.md
|
|
46
|
+
/bw-plan .buildwright/tasks/architecture-review.md
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Phase 1 — Understand
|
|
52
|
+
|
|
53
|
+
If a **task file** is provided, read it. Extract:
|
|
54
|
+
- `Inputs` block — variable names, descriptions, defaults
|
|
55
|
+
- `Rules` block — constraints on evidence, scope, output format
|
|
56
|
+
- `Research Areas` block — what categories to investigate
|
|
57
|
+
- `Outputs` block — file names and content requirements
|
|
58
|
+
|
|
59
|
+
Substitute any `<placeholder>` tokens from invocation args or sensible defaults
|
|
60
|
+
(e.g. `<date>` → today's date, `<repo_path>` → current working directory).
|
|
61
|
+
|
|
62
|
+
If **inline text** is provided, infer:
|
|
63
|
+
- The question or goal
|
|
64
|
+
- Likely research areas from the question
|
|
65
|
+
- Default output location: `docs/plans/<kebab-slug>/<YYYY-MM-DD>/plan.md`
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Phase 2 — Clarify
|
|
70
|
+
|
|
71
|
+
In **interactive mode** (`BUILDWRIGHT_AUTO_APPROVE=false`): if a critical input
|
|
72
|
+
is ambiguous (e.g. target repository path is unknown), ask one focused question
|
|
73
|
+
before proceeding.
|
|
74
|
+
|
|
75
|
+
In **autonomous mode** (`BUILDWRIGHT_AUTO_APPROVE=true`, default): apply
|
|
76
|
+
sensible defaults and proceed. Note any assumptions in the deliverable.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Phase 3 — Research
|
|
81
|
+
|
|
82
|
+
**First, check for pre-analysed codebase docs:**
|
|
83
|
+
|
|
84
|
+
If `.buildwright/codebase/` exists (generated by `/bw-analyse`), read it before scanning files:
|
|
85
|
+
- `STACK.md` — confirmed tech stack for context
|
|
86
|
+
- `ARCHITECTURE.md` — layer structure to reference in findings
|
|
87
|
+
- `CONVENTIONS.md` — patterns to cite as "current standard" in recommendations
|
|
88
|
+
- `CONCERNS.md` — known issues; findings that overlap get higher severity/priority
|
|
89
|
+
|
|
90
|
+
These docs accelerate research and improve accuracy of recommendations.
|
|
91
|
+
|
|
92
|
+
Read relevant code, config, and documentation. Run read-only tools listed in
|
|
93
|
+
the task (e.g. `flutter analyze`, `dart analyze`, `npm audit`, `cargo audit`,
|
|
94
|
+
`semgrep --config auto`). Capture all stdout/stderr as labeled evidence.
|
|
95
|
+
|
|
96
|
+
**Evidence labels (use exactly these):**
|
|
97
|
+
- `inferred from code` — finding comes from reading source files
|
|
98
|
+
- `backed by tool output` — finding is confirmed by a tool's output
|
|
99
|
+
- `backed by docs/external source` — finding references documentation
|
|
100
|
+
|
|
101
|
+
**Do NOT:**
|
|
102
|
+
- Modify any source file
|
|
103
|
+
- Run commands that write to the target repository
|
|
104
|
+
- Run build steps unless the task explicitly requires them
|
|
105
|
+
|
|
106
|
+
If a tool is unavailable, note it as a blocker in the summary; skip and continue.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Phase 4 — Synthesize
|
|
111
|
+
|
|
112
|
+
Organize findings into structured sections per the task's Research Areas (or
|
|
113
|
+
inferred categories for inline questions).
|
|
114
|
+
|
|
115
|
+
**For analysis/audit tasks**, each finding includes:
|
|
116
|
+
- `title` — short descriptive name
|
|
117
|
+
- `category` — from the task's research areas
|
|
118
|
+
- `severity` — critical / high / medium / low
|
|
119
|
+
- `confidence` — high / medium / low
|
|
120
|
+
- `evidence_type` — one of the three labels above
|
|
121
|
+
- `evidence` — file path + line number, or tool command + output excerpt
|
|
122
|
+
- `why it matters` — impact on users or system
|
|
123
|
+
- `recommended action` — concrete fix or next step
|
|
124
|
+
- `estimated effort` — hours/days rough estimate
|
|
125
|
+
- `needs_runtime_verification` — true/false
|
|
126
|
+
|
|
127
|
+
**For planning/decision tasks**, structure around:
|
|
128
|
+
- Options considered
|
|
129
|
+
- Recommendation
|
|
130
|
+
- Rationale
|
|
131
|
+
- Risks and mitigations
|
|
132
|
+
- Next steps
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Phase 5 — Write Deliverable
|
|
137
|
+
|
|
138
|
+
Write artifact files to `output_dir`. Must write at minimum:
|
|
139
|
+
- `plan.md` — or the task-specified primary document
|
|
140
|
+
|
|
141
|
+
May also write supporting files if the task specifies them:
|
|
142
|
+
- `.csv` — comma-separated with a header row
|
|
143
|
+
- `.json` — valid JSON, schema as specified in task
|
|
144
|
+
- Additional `.md` files (e.g. `top10.md`, `backlog.md`)
|
|
145
|
+
|
|
146
|
+
Create `output_dir` if it does not exist.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Phase 6 — Summarize
|
|
151
|
+
|
|
152
|
+
Print to stdout:
|
|
153
|
+
- Output directory path and files written
|
|
154
|
+
- Top 3–5 findings or key recommendations
|
|
155
|
+
- Any blockers that prevented complete research (tools unavailable, files inaccessible)
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Hard Constraints (always enforced)
|
|
160
|
+
|
|
161
|
+
- **NEVER** modify source files in any target repository
|
|
162
|
+
- **NEVER** commit, push, or create PRs
|
|
163
|
+
- **NEVER** claim something is "measured" or "confirmed" without direct evidence
|
|
164
|
+
- Every finding must cite evidence (file + line, or tool output excerpt)
|
|
165
|
+
- The task's `Rules` block can add constraints; it cannot remove these hard constraints
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Task File Format
|
|
170
|
+
|
|
171
|
+
Structured task files follow this template:
|
|
172
|
+
|
|
173
|
+
```markdown
|
|
174
|
+
## Inputs
|
|
175
|
+
- `<variable_name>`: description [default: value]
|
|
176
|
+
- `<repo_path>`: path to the repository to analyse [default: current directory]
|
|
177
|
+
- `<output_dir>`: where to write artifacts [default: docs/plans/<slug>/<date>/]
|
|
178
|
+
|
|
179
|
+
## Rules
|
|
180
|
+
1. This is a read-only pass. Do not modify any source files.
|
|
181
|
+
2. Separate findings by evidence type: inferred / tool-backed / doc-backed.
|
|
182
|
+
3. Every finding must include a file path and line reference or tool output.
|
|
183
|
+
|
|
184
|
+
## Research Areas
|
|
185
|
+
1. Category A — what to look for
|
|
186
|
+
2. Category B — what to look for
|
|
187
|
+
3. ...
|
|
188
|
+
|
|
189
|
+
## Outputs
|
|
190
|
+
- `plan.md` — primary report with executive summary and all findings
|
|
191
|
+
- `top10.md` — top 10 prioritized findings
|
|
192
|
+
- `backlog.csv` — all findings as CSV with columns: title,category,severity,confidence,effort
|
|
193
|
+
- `summary.json` — machine-readable summary: { findings_count, top_findings[], blockers[] }
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Example
|
|
199
|
+
|
|
200
|
+
The Flutter performance review task maps directly to this format:
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
/bw-plan tasks/flutter-perf-review.md
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Where `tasks/flutter-perf-review.md` defines:
|
|
207
|
+
- Inputs: repo_path, main package, entrypoints, target platforms, output_dir
|
|
208
|
+
- Rules: static analysis only, evidence required, no source modification
|
|
209
|
+
- Research Areas: rebuild risks, list/grid risks, rendering, CPU, data/arch, images, deps, code health
|
|
210
|
+
- Outputs: performance-static-review.md, performance-static-top10.md, performance-static-backlog.csv, performance-static-summary.json
|
|
@@ -71,6 +71,17 @@ Continue with /bw-quick anyway? (say "continue" or use /bw-new-feature)
|
|
|
71
71
|
|
|
72
72
|
**Lightweight research - only what's needed for this task.**
|
|
73
73
|
|
|
74
|
+
**First, check for pre-analysed codebase docs:**
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
ls .buildwright/codebase/ 2>/dev/null
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
If present, read `CONVENTIONS.md` and `ARCHITECTURE.md` — they give you naming patterns
|
|
81
|
+
and layer boundaries without scanning the whole codebase. Check `CONCERNS.md` to avoid
|
|
82
|
+
introducing more of the same issues. Then narrow your search to the specific files for
|
|
83
|
+
this task.
|
|
84
|
+
|
|
74
85
|
```bash
|
|
75
86
|
# Find directly relevant files
|
|
76
87
|
grep -r "[relevant terms]" --include="*.ts" --include="*.tsx" -l .
|
package/templates/CLAUDE.md
CHANGED
|
@@ -25,7 +25,7 @@ are codebase analysis docs (stack, architecture, conventions, concerns) generate
|
|
|
25
25
|
agents/ ← Architect, Staff Engineer, Security Engineer
|
|
26
26
|
claws/ ← Frontend, Backend, Database, TEMPLATE
|
|
27
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
|
|
28
|
+
commands/ ← bw-new-feature, bw-claw, bw-quick, bw-ship, bw-verify, bw-plan, bw-help
|
|
29
29
|
steering/ ← product.md, tech.md, quality-gates.md, naming-conventions.md
|
|
30
30
|
tasks/
|
|
31
31
|
|
|
@@ -55,6 +55,7 @@ After cloning or editing `.buildwright/`, run `make sync` to regenerate tool-spe
|
|
|
55
55
|
6. **Quick quality check**: /bw-verify → typecheck, lint, test, build
|
|
56
56
|
7. **Show commands**: /bw-help
|
|
57
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
|
+
9. **Research/planning without implementation**: /bw-plan → Understand question → Research (read-only) → Synthesize → Write deliverable. No code changes, no commits.
|
|
58
59
|
|
|
59
60
|
## Command Discovery
|
|
60
61
|
|
|
@@ -96,7 +97,8 @@ If ANY required step fails: fix and retry (max 2 attempts). If same error repeat
|
|
|
96
97
|
- Multi-agent safety: NEVER use git stash (other agents may be working)
|
|
97
98
|
- Only `.buildwright/` is committed — never commit `.claude/` or `.opencode/` content files
|
|
98
99
|
- 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
|
+
- Before committing, update README.md, SKILL.md, docs/, or CHANGELOG.md if the change affects user-facing behavior
|
|
101
|
+
- After editing any `.buildwright/commands/` file, run `make sync` — it automatically checks that every command is documented in README.md and SKILL.md and warns about gaps
|
|
100
102
|
|
|
101
103
|
## Cross-Domain Features (Claw Architecture)
|
|
102
104
|
When a feature touches multiple domains (e.g., DB + API + UI):
|
package/templates/Makefile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.PHONY: dist clean sync sync-check cursor opencode openclaw validate install-hooks uninstall-hooks bump release test-cli
|
|
1
|
+
.PHONY: dist clean sync sync-check cursor opencode openclaw codex validate install-hooks uninstall-hooks bump release test-cli
|
|
2
2
|
|
|
3
3
|
# ============================================================================
|
|
4
4
|
# Sync — Generate .claude/, .opencode/, .cursor/rules/ from .buildwright/ (canonical)
|
|
@@ -39,6 +39,13 @@ openclaw: sync
|
|
|
39
39
|
@cp SKILL.md ~/.openclaw/skills/buildwright/SKILL.md
|
|
40
40
|
@echo "Installed to ~/.openclaw/skills/buildwright/"
|
|
41
41
|
|
|
42
|
+
# Codex CLI — install skills for native skill discovery
|
|
43
|
+
codex: sync
|
|
44
|
+
@mkdir -p ~/.agents/skills
|
|
45
|
+
@ln -sfn $(PWD)/skills ~/.agents/skills/buildwright
|
|
46
|
+
@echo "Installed to ~/.agents/skills/buildwright"
|
|
47
|
+
@echo "Restart Codex to discover Buildwright skills."
|
|
48
|
+
|
|
42
49
|
# ============================================================================
|
|
43
50
|
# Validate SKILL.md against Agent Skills spec (agentskills.io)
|
|
44
51
|
# ============================================================================
|
|
@@ -261,7 +261,21 @@ sync_cursor_dir ".buildwright/agents" "agents" "agent"
|
|
|
261
261
|
sync_cursor_dir ".buildwright/claws" "claws" "claw"
|
|
262
262
|
|
|
263
263
|
# ============================================================================
|
|
264
|
-
# 5.
|
|
264
|
+
# 5. .buildwright/commands/ → skills/ (Codex CLI skill discovery)
|
|
265
|
+
# ============================================================================
|
|
266
|
+
|
|
267
|
+
if [ "$CHECK_ONLY" = false ]; then
|
|
268
|
+
for file in .buildwright/commands/bw-*.md; do
|
|
269
|
+
[ -f "$file" ] || continue
|
|
270
|
+
name=$(basename "$file" .md)
|
|
271
|
+
mkdir -p "skills/$name"
|
|
272
|
+
cp "$file" "skills/$name/SKILL.md"
|
|
273
|
+
echo " synced $file → skills/$name/SKILL.md"
|
|
274
|
+
done
|
|
275
|
+
fi
|
|
276
|
+
|
|
277
|
+
# ============================================================================
|
|
278
|
+
# 6. Package for ClawHub (dist/)
|
|
265
279
|
# ============================================================================
|
|
266
280
|
|
|
267
281
|
if [ "$CHECK_ONLY" = false ] && [ -f "SKILL.md" ]; then
|
|
@@ -291,4 +305,11 @@ else
|
|
|
291
305
|
echo " .buildwright/ → .cursor/rules/ (.mdc with frontmatter)"
|
|
292
306
|
echo " CLAUDE.md → AGENTS.md"
|
|
293
307
|
echo " SKILL.md → dist/buildwright/SKILL.md"
|
|
308
|
+
echo " .buildwright/commands/ → skills/ (Codex CLI skill discovery)"
|
|
309
|
+
|
|
310
|
+
# Validate all commands are documented in SKILL.md and README.md
|
|
311
|
+
if [ -f "scripts/validate-docs.sh" ]; then
|
|
312
|
+
echo ""
|
|
313
|
+
bash scripts/validate-docs.sh || true
|
|
314
|
+
fi
|
|
294
315
|
fi
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# validate-docs.sh — checks that every bw-* command is documented in SKILL.md and README.md
|
|
3
|
+
# Run automatically by sync-agents.sh after each sync.
|
|
4
|
+
# Exit code 1 if any commands are missing from documentation.
|
|
5
|
+
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
COMMANDS_DIR=".buildwright/commands"
|
|
9
|
+
SKILL_MD="SKILL.md"
|
|
10
|
+
README_MD="README.md"
|
|
11
|
+
|
|
12
|
+
RED='\033[0;31m'
|
|
13
|
+
YELLOW='\033[1;33m'
|
|
14
|
+
GREEN='\033[0;32m'
|
|
15
|
+
BOLD='\033[1m'
|
|
16
|
+
RESET='\033[0m'
|
|
17
|
+
|
|
18
|
+
if [ ! -d "$COMMANDS_DIR" ]; then
|
|
19
|
+
echo " validate-docs: $COMMANDS_DIR not found, skipping"
|
|
20
|
+
exit 0
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
missing=0
|
|
24
|
+
|
|
25
|
+
for file in "$COMMANDS_DIR"/bw-*.md; do
|
|
26
|
+
[ -f "$file" ] || continue
|
|
27
|
+
|
|
28
|
+
# Skip bw-help.md — it IS the help output, doesn't need its own docs section
|
|
29
|
+
basename=$(basename "$file")
|
|
30
|
+
[ "$basename" = "bw-help.md" ] && continue
|
|
31
|
+
|
|
32
|
+
# Extract name from YAML frontmatter
|
|
33
|
+
name=$(awk '/^---/{f=!f;next} f && /^name:/{print $2;exit}' "$file" 2>/dev/null | tr -d '\r')
|
|
34
|
+
|
|
35
|
+
if [ -z "$name" ]; then
|
|
36
|
+
echo -e " ${YELLOW}validate-docs: $basename has no 'name' in frontmatter — skipping${RESET}"
|
|
37
|
+
continue
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
cmd="/$name"
|
|
41
|
+
file_missing=0
|
|
42
|
+
|
|
43
|
+
# Check SKILL.md
|
|
44
|
+
if [ -f "$SKILL_MD" ] && ! grep -qi "### $cmd" "$SKILL_MD" 2>/dev/null; then
|
|
45
|
+
echo -e " ${RED}${BOLD}validate-docs: $cmd missing from SKILL.md${RESET}"
|
|
46
|
+
file_missing=1
|
|
47
|
+
missing=$((missing + 1))
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
# Check README.md
|
|
51
|
+
if [ -f "$README_MD" ] && ! grep -q "$cmd" "$README_MD" 2>/dev/null; then
|
|
52
|
+
echo -e " ${RED}${BOLD}validate-docs: $cmd missing from README.md${RESET}"
|
|
53
|
+
file_missing=1
|
|
54
|
+
missing=$((missing + 1))
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
if [ "$file_missing" -eq 0 ]; then
|
|
58
|
+
echo -e " ${GREEN}validate-docs: $cmd ✓${RESET}"
|
|
59
|
+
fi
|
|
60
|
+
done
|
|
61
|
+
|
|
62
|
+
if [ "$missing" -gt 0 ]; then
|
|
63
|
+
echo ""
|
|
64
|
+
echo -e " ${RED}${BOLD}validate-docs: $missing documentation gap(s) found.${RESET}"
|
|
65
|
+
echo -e " Update README.md and SKILL.md, then re-run 'make sync'."
|
|
66
|
+
exit 1
|
|
67
|
+
fi
|