buildline 0.0.0-stage → 0.3.1
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/LICENSE +21 -0
- package/README.md +216 -2
- package/bin/buildline.js +131 -0
- package/package.json +49 -4
- package/src/cli.js +537 -0
- package/src/detect.js +228 -0
- package/src/features.js +157 -0
- package/src/files.js +107 -0
- package/src/install.js +280 -0
- package/src/models.js +66 -0
- package/src/render.js +9 -0
- package/src/server.js +143 -0
- package/src/ui/index.html +333 -0
- package/templates/AGENTS.block.md +48 -0
- package/templates/CLAUDE.block.md +20 -0
- package/templates/GEMINI.block.md +3 -0
- package/templates/agents/buildline-design-reviewer.md +21 -0
- package/templates/agents/buildline-mapper.md +23 -0
- package/templates/agents/buildline-reviewer.md +24 -0
- package/templates/agents/buildline-spec-critic.md +19 -0
- package/templates/agents/buildline-verifier.md +30 -0
- package/templates/bin/gates.mjs +65 -0
- package/templates/bin/hook.mjs +90 -0
- package/templates/buildline-readme.md +55 -0
- package/templates/ci/buildline.yml +71 -0
- package/templates/context/architecture.md +21 -0
- package/templates/context/design.md +22 -0
- package/templates/context/product.md +22 -0
- package/templates/cursor.mdc +11 -0
- package/templates/feature/progress.md +6 -0
- package/templates/feature/spec.md +34 -0
- package/templates/principles.md +23 -0
- package/templates/stations/autopilot.md +52 -0
- package/templates/stations/build.md +52 -0
- package/templates/stations/buildline.md +48 -0
- package/templates/stations/design.md +39 -0
- package/templates/stations/new.md +39 -0
- package/templates/stations/onboard.md +57 -0
- package/templates/stations/plan.md +44 -0
- package/templates/stations/review.md +37 -0
- package/templates/stations/ship.md +32 -0
- package/templates/stations/spec.md +46 -0
- package/templates/stations/verify.md +44 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Claude Code hooks for the factory. Managed by buildline.
|
|
3
|
+
//
|
|
4
|
+
// session-start prints a short factory briefing into the new session's context
|
|
5
|
+
// guard blocks edits to a spec's "## Acceptance" section while the
|
|
6
|
+
// feature is in build/verify/review, so agents can't move the goalposts
|
|
7
|
+
import fs from 'node:fs';
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
|
|
11
|
+
const root = process.env.CLAUDE_PROJECT_DIR || path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
|
|
12
|
+
const featuresDir = path.join(root, '.buildline', 'features');
|
|
13
|
+
const mode = process.argv[2];
|
|
14
|
+
|
|
15
|
+
function readJson(file) {
|
|
16
|
+
try {
|
|
17
|
+
return JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
18
|
+
} catch {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function features() {
|
|
24
|
+
if (!fs.existsSync(featuresDir)) return [];
|
|
25
|
+
return fs
|
|
26
|
+
.readdirSync(featuresDir)
|
|
27
|
+
.map((dir) => ({ dir, data: readJson(path.join(featuresDir, dir, 'feature.json')) }))
|
|
28
|
+
.filter((f) => f.data);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function sessionStart() {
|
|
32
|
+
const config = readJson(path.join(root, '.buildline', 'buildline.json')) || {};
|
|
33
|
+
const active = features().filter((f) => f.data.status !== 'done');
|
|
34
|
+
const lines = [`[buildline] autonomy L${config.autonomy ?? 2}. Rules: AGENTS.md › Software factory. Type /buildline for status and next steps.`];
|
|
35
|
+
for (const { dir, data } of active.slice(0, 8)) {
|
|
36
|
+
const tasks = data.tasks || [];
|
|
37
|
+
const done = tasks.filter((t) => t.passes).length;
|
|
38
|
+
const progress = tasks.length ? ` · ${done}/${tasks.length} tasks` : '';
|
|
39
|
+
const blocked = data.blocked ? ` · BLOCKED: ${data.blocked}` : '';
|
|
40
|
+
lines.push(` ${dir} · ${data.status}${progress}${blocked}`);
|
|
41
|
+
}
|
|
42
|
+
if (active.length > 8) lines.push(` …and ${active.length - 8} more`);
|
|
43
|
+
process.stdout.write(lines.join('\n') + '\n');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const acceptance = (text) => {
|
|
47
|
+
const m = /^## Acceptance\s*$([\s\S]*?)(?=^## |(?![\s\S]))/m.exec(text || '');
|
|
48
|
+
return m ? m[1].trim() : null;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
function guard(input) {
|
|
52
|
+
const tool = input.tool_name;
|
|
53
|
+
const ti = input.tool_input || {};
|
|
54
|
+
const file = ti.file_path ? path.resolve(root, ti.file_path) : null;
|
|
55
|
+
if (!file || !file.startsWith(featuresDir + path.sep) || path.basename(file) !== 'spec.md') return;
|
|
56
|
+
|
|
57
|
+
const feature = readJson(path.join(path.dirname(file), 'feature.json'));
|
|
58
|
+
if (!feature || !['build', 'verify', 'review'].includes(feature.status)) return;
|
|
59
|
+
|
|
60
|
+
const before = fs.existsSync(file) ? fs.readFileSync(file, 'utf8') : '';
|
|
61
|
+
let after = before;
|
|
62
|
+
if (tool === 'Write') after = ti.content ?? '';
|
|
63
|
+
else if (tool === 'Edit') after = before.replace(ti.old_string ?? '', ti.new_string ?? '');
|
|
64
|
+
else if (Array.isArray(ti.edits)) for (const e of ti.edits) after = after.replace(e.old_string ?? '', e.new_string ?? '');
|
|
65
|
+
|
|
66
|
+
if (acceptance(before) !== acceptance(after)) {
|
|
67
|
+
process.stderr.write(
|
|
68
|
+
`buildline guard: "## Acceptance" in ${path.relative(root, file)} is locked while the feature is in "${feature.status}". ` +
|
|
69
|
+
'If a scenario is wrong, stop and ask the spec owner; they can change it at the spec station.\n',
|
|
70
|
+
);
|
|
71
|
+
process.exit(2);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
let raw = '';
|
|
76
|
+
process.stdin.on('data', (c) => (raw += c));
|
|
77
|
+
process.stdin.on('end', () => {
|
|
78
|
+
let input = {};
|
|
79
|
+
try {
|
|
80
|
+
input = raw ? JSON.parse(raw) : {};
|
|
81
|
+
} catch {}
|
|
82
|
+
try {
|
|
83
|
+
if (mode === 'session-start') sessionStart();
|
|
84
|
+
else if (mode === 'guard') guard(input);
|
|
85
|
+
} catch (err) {
|
|
86
|
+
// A broken hook must never break the session.
|
|
87
|
+
process.stderr.write(`buildline hook error: ${err.message}\n`);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
if (process.stdin.isTTY) process.stdin.emit('end');
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# {{project}} software factory
|
|
2
|
+
|
|
3
|
+
This folder holds the factory: how ideas become shipped, verified changes in this project. It works with Claude Code, Codex, Cursor, Gemini CLI and any agent that reads `AGENTS.md`.
|
|
4
|
+
|
|
5
|
+
## 60-second tour
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
.buildline/
|
|
9
|
+
buildline.json config: autonomy level, quality gates, team, agents
|
|
10
|
+
principles.md the non-negotiables every change is checked against (yours to edit)
|
|
11
|
+
context/ product, architecture and design knowledge (yours to edit)
|
|
12
|
+
stations/ playbooks agents follow at each step (managed)
|
|
13
|
+
features/ one folder per change: feature.json, spec.md, progress.md
|
|
14
|
+
bin/gates.mjs runs the quality gates
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Every change is a **feature** that moves through stations:
|
|
18
|
+
`intake → spec → design → plan → build → verify → review → ship`. Fixes skip spec, design and plan.
|
|
19
|
+
|
|
20
|
+
## Start here, by role
|
|
21
|
+
|
|
22
|
+
### Product managers
|
|
23
|
+
- See everything: `npx buildline ui` opens a dashboard in your browser. Create features, edit specs, approve.
|
|
24
|
+
- In Claude Code: `/buildline-new <idea>`, then `/buildline-spec <id>`. Claude interviews you and writes the requirements and acceptance scenarios.
|
|
25
|
+
- You own `## Acceptance` in each spec. Agents can't change it during build (a hook enforces this).
|
|
26
|
+
- Approve specs in the dashboard or with `npx buildline approve <id> spec`.
|
|
27
|
+
|
|
28
|
+
### Designers
|
|
29
|
+
- Fill in `context/design.md` once: tokens, components, patterns, links to Figma or Storybook.
|
|
30
|
+
- `/buildline-design <id>`: share a Figma link or screenshots; Claude writes flows, states and copy into the spec, and the design reviewer checks it against the system.
|
|
31
|
+
- After build, screenshots land in `features/<id>/evidence/` for your review.
|
|
32
|
+
|
|
33
|
+
### Developers
|
|
34
|
+
- `/buildline` shows status and what's next. `/buildline-build <id>` works tasks one by one behind the gates.
|
|
35
|
+
- `npx buildline run <id>` starts an unattended build → verify → review loop with `/goal` (autonomy L3+).
|
|
36
|
+
- `node .buildline/bin/gates.mjs` runs lint, types, tests and build exactly as agents do.
|
|
37
|
+
|
|
38
|
+
## Autonomy levels
|
|
39
|
+
|
|
40
|
+
Set `autonomy` in `buildline.json`:
|
|
41
|
+
|
|
42
|
+
| Level | Humans approve | Agents do alone |
|
|
43
|
+
|---|---|---|
|
|
44
|
+
| 1 Assist | every station | nothing without a yes |
|
|
45
|
+
| 2 Guided | spec, plan, merge | build, verify, review |
|
|
46
|
+
| 3 Autopilot | spec, merge | plan, build, verify, review |
|
|
47
|
+
| 4 Dark factory | merge | everything up to a ready PR |
|
|
48
|
+
|
|
49
|
+
Start at 2. Move up once the gates and acceptance scenarios have earned your trust.
|
|
50
|
+
|
|
51
|
+
## Customising
|
|
52
|
+
|
|
53
|
+
- Edit `principles.md` and `context/*`; the factory never overwrites them.
|
|
54
|
+
- Edit station playbooks freely. `buildline update` won't overwrite files you've changed (it tells you instead).
|
|
55
|
+
- Change gates in `buildline.json`, then run `npx buildline update` to refresh AGENTS.md.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Buildline CI. Managed by buildline.
|
|
2
|
+
# - gates: runs the factory quality gates on every pull request
|
|
3
|
+
# - review: Claude reviews the PR against its factory spec (needs ANTHROPIC_API_KEY
|
|
4
|
+
# or CLAUDE_CODE_OAUTH_TOKEN as a repository secret; skipped if neither is set)
|
|
5
|
+
# - @claude mentions in PR/issue comments run Claude interactively
|
|
6
|
+
name: buildline
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
pull_request:
|
|
10
|
+
types: [opened, synchronize, ready_for_review]
|
|
11
|
+
issue_comment:
|
|
12
|
+
types: [created]
|
|
13
|
+
pull_request_review_comment:
|
|
14
|
+
types: [created]
|
|
15
|
+
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read
|
|
18
|
+
pull-requests: write
|
|
19
|
+
issues: write
|
|
20
|
+
id-token: write
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
gates:
|
|
24
|
+
if: github.event_name == 'pull_request'
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@v4
|
|
28
|
+
- uses: actions/setup-node@v4
|
|
29
|
+
with:
|
|
30
|
+
node-version: 22
|
|
31
|
+
{{ciSetup}}
|
|
32
|
+
- run: node .buildline/bin/gates.mjs
|
|
33
|
+
|
|
34
|
+
review:
|
|
35
|
+
if: github.event_name == 'pull_request' && !github.event.pull_request.draft
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
env:
|
|
38
|
+
HAS_KEY: ${{ secrets.ANTHROPIC_API_KEY != '' || secrets.CLAUDE_CODE_OAUTH_TOKEN != '' }}
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v4
|
|
41
|
+
with:
|
|
42
|
+
fetch-depth: 0
|
|
43
|
+
- if: env.HAS_KEY == 'true'
|
|
44
|
+
uses: anthropics/claude-code-action@v1
|
|
45
|
+
with:
|
|
46
|
+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
47
|
+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
|
48
|
+
prompt: |
|
|
49
|
+
Review pull request #${{ github.event.pull_request.number }} in ${{ github.repository }}.
|
|
50
|
+
Find the factory feature it implements (branch name or commit tags like [004/T1] → .buildline/features/004-*).
|
|
51
|
+
Follow .buildline/stations/review.md using the buildline-reviewer subagent against base origin/${{ github.base_ref }}.
|
|
52
|
+
Post one concise PR comment with the findings and verdict. Do not push commits.
|
|
53
|
+
claude_args: "--max-turns 30"
|
|
54
|
+
|
|
55
|
+
mention:
|
|
56
|
+
if: |
|
|
57
|
+
(github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment') &&
|
|
58
|
+
contains(github.event.comment.body, '@claude')
|
|
59
|
+
runs-on: ubuntu-latest
|
|
60
|
+
permissions:
|
|
61
|
+
contents: write
|
|
62
|
+
pull-requests: write
|
|
63
|
+
issues: write
|
|
64
|
+
id-token: write
|
|
65
|
+
steps:
|
|
66
|
+
- uses: actions/checkout@v4
|
|
67
|
+
- uses: anthropics/claude-code-action@v1
|
|
68
|
+
with:
|
|
69
|
+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
70
|
+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
|
71
|
+
claude_args: "--max-turns 30"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
> TODO: Run `/buildline-onboard` (or fill this in by hand). Prefer bullets and file paths over prose.
|
|
4
|
+
|
|
5
|
+
## Stack
|
|
6
|
+
{{stackBullets}}
|
|
7
|
+
|
|
8
|
+
## Module map
|
|
9
|
+
TODO: main folders/modules and what each is responsible for.
|
|
10
|
+
|
|
11
|
+
## Data flow
|
|
12
|
+
TODO: how a typical request or user action moves through the system.
|
|
13
|
+
|
|
14
|
+
## Conventions
|
|
15
|
+
TODO: naming, folder layout, state, errors, testing, with one real example path each.
|
|
16
|
+
|
|
17
|
+
## Key decisions
|
|
18
|
+
TODO: decision, then the reason (link ADRs if they exist).
|
|
19
|
+
|
|
20
|
+
## Hazards
|
|
21
|
+
TODO: generated code, fragile areas, things agents must not touch.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Design system
|
|
2
|
+
|
|
3
|
+
> TODO: Run `/buildline-onboard` (or fill this in by hand). Designers own this file.
|
|
4
|
+
|
|
5
|
+
## Principles
|
|
6
|
+
TODO: three to five principles that decide trade-offs (e.g. "clarity over density").
|
|
7
|
+
|
|
8
|
+
## Source of truth
|
|
9
|
+
TODO: Figma file, Storybook URL, token files (e.g. `src/styles/tokens.css`).
|
|
10
|
+
|
|
11
|
+
## Tokens
|
|
12
|
+
{{uiBullets}}
|
|
13
|
+
TODO: colour, type scale, spacing, radius, shadow, motion. Name the token, not the raw value.
|
|
14
|
+
|
|
15
|
+
## Components
|
|
16
|
+
TODO: core components and where they live; when to use which.
|
|
17
|
+
|
|
18
|
+
## Patterns
|
|
19
|
+
TODO: forms, tables, empty states, errors, notifications, navigation.
|
|
20
|
+
|
|
21
|
+
## Accessibility baseline
|
|
22
|
+
WCAG 2.2 AA. TODO: anything stricter or project-specific.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Product
|
|
2
|
+
|
|
3
|
+
> TODO: Run `/buildline-onboard` (or fill this in by hand). Keep it under ~120 lines.
|
|
4
|
+
|
|
5
|
+
## Vision
|
|
6
|
+
TODO: one or two sentences: what this is and why it exists.
|
|
7
|
+
|
|
8
|
+
## Users
|
|
9
|
+
TODO: primary users, what they're trying to get done, and their context.
|
|
10
|
+
|
|
11
|
+
## Problems we solve
|
|
12
|
+
TODO
|
|
13
|
+
|
|
14
|
+
## Success metrics
|
|
15
|
+
TODO: one to three measurable signals.
|
|
16
|
+
|
|
17
|
+
## Scope
|
|
18
|
+
- In: TODO
|
|
19
|
+
- Out (non-goals): TODO
|
|
20
|
+
|
|
21
|
+
## Glossary
|
|
22
|
+
TODO: domain terms and what they mean here.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Software factory pipeline and rules for this project
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
This project uses a software factory. Follow the rules in `AGENTS.md` (section "Software factory").
|
|
7
|
+
|
|
8
|
+
To run a station, read its playbook in `.buildline/stations/` and follow it:
|
|
9
|
+
intake (`new.md`), `spec.md`, `design.md`, `plan.md`, `build.md`, `verify.md`, `review.md`, `ship.md`, `autopilot.md`.
|
|
10
|
+
|
|
11
|
+
When the user says "buildline" or "factory" or asks what to do next, follow `.buildline/stations/buildline.md`.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# {{title}}
|
|
2
|
+
|
|
3
|
+
`{{id}}` · {{type}} · created {{date}}
|
|
4
|
+
|
|
5
|
+
## Brief
|
|
6
|
+
**Problem:** TODO: what's wrong or missing, and for whom.
|
|
7
|
+
**Outcome:** TODO: what's true when this ships.
|
|
8
|
+
**Open questions:** none yet.
|
|
9
|
+
|
|
10
|
+
## Requirements
|
|
11
|
+
- R1 TODO
|
|
12
|
+
|
|
13
|
+
## Acceptance
|
|
14
|
+
<!-- Owned by the spec author. Agents must not edit this section during build. -->
|
|
15
|
+
- A1 **Given** TODO **When** TODO **Then** TODO
|
|
16
|
+
|
|
17
|
+
## Out of scope
|
|
18
|
+
- TODO
|
|
19
|
+
|
|
20
|
+
## Design
|
|
21
|
+
### Experience
|
|
22
|
+
_Flows, screens and states, components, copy, accessibility. Skip for non-UI changes._
|
|
23
|
+
|
|
24
|
+
### Technical
|
|
25
|
+
_Approach, changes, risks, test strategy._
|
|
26
|
+
|
|
27
|
+
## Plan
|
|
28
|
+
_Written by the plan station. Tasks live in feature.json._
|
|
29
|
+
|
|
30
|
+
## Verification
|
|
31
|
+
_Written by the verify station._
|
|
32
|
+
|
|
33
|
+
## Review
|
|
34
|
+
_Written by the review station; becomes the PR description._
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Principles
|
|
2
|
+
|
|
3
|
+
The non-negotiables every change is checked against. Keep this list short; every line should earn its place. Edit freely, since the factory never overwrites this file.
|
|
4
|
+
|
|
5
|
+
## Product
|
|
6
|
+
|
|
7
|
+
1. **Outcomes over output.** Every feature names the user problem it solves and how we'll know it worked.
|
|
8
|
+
2. **Smallest valuable slice first.** Ship a thin version end to end, then improve it.
|
|
9
|
+
3. **Plain language.** UI copy says what happened and what to do next.
|
|
10
|
+
|
|
11
|
+
## Design
|
|
12
|
+
|
|
13
|
+
4. **Use the system.** Reuse existing components and tokens; new ones need a reason.
|
|
14
|
+
5. **Every state is designed.** Loading, empty, error, success and disabled are part of the feature, not polish.
|
|
15
|
+
6. **Accessible by default.** WCAG 2.2 AA: keyboard reachable, labelled, sufficient contrast.
|
|
16
|
+
|
|
17
|
+
## Engineering
|
|
18
|
+
|
|
19
|
+
7. **Evidence, not claims.** Nothing is done until its verification has been run and observed.
|
|
20
|
+
8. **Tests protect behaviour.** Tests assert what users and clients see; never weaken a test to make it pass.
|
|
21
|
+
9. **Follow the codebase.** Match existing conventions; if you break one, say why in the spec.
|
|
22
|
+
10. **No secrets in code.** Configuration and credentials come from the environment.
|
|
23
|
+
11. **Reversible changes.** Prefer small commits, feature flags for risky changes, and migrations that can roll back.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Station: autopilot
|
|
2
|
+
|
|
3
|
+
Goal: run **build → verify → review** in a loop, unattended, until the feature is ready to ship or genuinely blocked. This is the long-running harness: progress lives in files and git, not in the conversation, so it survives context compaction and restarts.
|
|
4
|
+
|
|
5
|
+
Resolve the feature from `$ARGUMENTS`.
|
|
6
|
+
|
|
7
|
+
## Preconditions (check, don't assume)
|
|
8
|
+
|
|
9
|
+
- `buildline.json → autonomy` is 3 or 4. At L1–L2, explain that autopilot needs a higher autonomy level and offer `/buildline-build` instead.
|
|
10
|
+
- `approvals.spec` is recorded (unless autonomy is 4 or the type is `fix`).
|
|
11
|
+
- `feature.json → tasks` exists. If not, run the `plan` station first.
|
|
12
|
+
- The working tree is clean, and you're on a feature branch (create `feat/<id>-<slug>` if not).
|
|
13
|
+
|
|
14
|
+
## The loop
|
|
15
|
+
|
|
16
|
+
Repeat until done or blocked:
|
|
17
|
+
|
|
18
|
+
1. **Build**: follow `.buildline/stations/build.md` for the next failing task. One task, gates, evidence, commit, `progress.md`.
|
|
19
|
+
2. When all tasks pass → **verify**: follow `.buildline/stations/verify.md` using the `buildline-verifier` subagent. Failures become new tasks; loop back to 1.
|
|
20
|
+
3. When verification passes → **review**: follow `.buildline/stations/review.md` using the `buildline-reviewer` subagent. Blockers become new tasks; loop back to 1.
|
|
21
|
+
4. When review is clean → set status `ship`, write the `## Review` packet, and stop. Do **not** push or open a PR unless autonomy is 4 *and* the person asked for it.
|
|
22
|
+
|
|
23
|
+
If `buildline.json → models` routes verify or review to another CLI (`codex…`, `gemini…`), run that step with `npx buildline step <station> <id> --headless` instead of the subagent, then read its output and the updated `feature.json` to decide the next loop.
|
|
24
|
+
|
|
25
|
+
After each step, print a one-line status so progress is visible, e.g. `[autopilot 004] T3 passing · 4/6 tasks · gates green`.
|
|
26
|
+
|
|
27
|
+
## Stop conditions (blocked)
|
|
28
|
+
|
|
29
|
+
Stop and summarise instead of continuing if:
|
|
30
|
+
|
|
31
|
+
- the same task fails after two genuinely different approaches,
|
|
32
|
+
- a requirement or acceptance scenario looks wrong or contradictory,
|
|
33
|
+
- the change needs a secret, a paid service, a production system or a destructive action,
|
|
34
|
+
- `metrics.reworks` reaches 5 (the spec or plan probably needs a human).
|
|
35
|
+
|
|
36
|
+
Write the blocker to `progress.md` and set `feature.json → blocked` to a one-line reason.
|
|
37
|
+
|
|
38
|
+
## Running it with `/goal` (Claude Code)
|
|
39
|
+
|
|
40
|
+
`/goal` keeps Claude working across turns until a condition is met. Its evaluator only sees the conversation, so the condition must be provable from printed output. From the terminal:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npx buildline run 004 # opens Claude Code with the goal below
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
or type it yourself:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
/goal Feature 004 reaches status "ship": following .buildline/stations/autopilot.md, every task in its feature.json has "passes": true, the last `node .buildline/bin/gates.mjs` run printed "ALL GATES PASSED", and the verifier reported every acceptance scenario as PASS. Stop early if blocked as defined in the playbook, or after 60 turns.
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Use auto-accept or auto permission mode for unattended runs, inside a sandbox, container or worktree if you can. Headless: `claude -p "/goal …" --permission-mode acceptEdits --output-format stream-json --verbose`.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Station: build
|
|
2
|
+
|
|
3
|
+
Goal: implement the plan **one task at a time**, each behind the gates, each with evidence. This playbook is written so that any fresh session can resume exactly where the last one stopped.
|
|
4
|
+
|
|
5
|
+
Resolve the feature from `$ARGUMENTS`, or use the most recent feature with status `build`.
|
|
6
|
+
|
|
7
|
+
## 0. Check approvals
|
|
8
|
+
|
|
9
|
+
- Autonomy ≤ 3 and `approvals.spec` missing → stop and ask for spec approval first (fixes are exempt).
|
|
10
|
+
- Autonomy ≤ 2 and `approvals.plan` missing → stop and ask for plan approval first.
|
|
11
|
+
|
|
12
|
+
## 1. Get your bearings (every session)
|
|
13
|
+
|
|
14
|
+
1. `git status` and `git log --oneline -10`: know what's already there; don't build on uncommitted mystery changes without asking.
|
|
15
|
+
2. Read `progress.md` (the last entry tells you where things stand) and `feature.json → tasks`.
|
|
16
|
+
3. Read `spec.md`: Requirements, Acceptance, Design, Plan.
|
|
17
|
+
4. Run `node .buildline/bin/gates.mjs`. If gates fail **before** you change anything, record it in `progress.md` and fix or report it first. Don't stack new work on a red baseline.
|
|
18
|
+
|
|
19
|
+
For `fix` features with no tasks: create a single task `T1` ("Reproduce with a failing test, then fix") plus `T2` ("Gates pass and A1 verified").
|
|
20
|
+
|
|
21
|
+
## 2. Work the next task
|
|
22
|
+
|
|
23
|
+
Pick the first task with `"passes": false`.
|
|
24
|
+
|
|
25
|
+
1. If the task adds behaviour, **write the failing test first** and run it to see it fail for the right reason.
|
|
26
|
+
2. Implement the smallest change that makes it pass. Follow the conventions in `.buildline/context/architecture.md` and reuse existing components and utilities before making new ones.
|
|
27
|
+
3. Run the task's `verify` step **and** the gates. Read the output; don't assume.
|
|
28
|
+
4. For UI work, run the app and look at it (a screenshot via the browser tools if available). Check the states listed in the design.
|
|
29
|
+
5. Only when everything above is green, set `"passes": true` and write in `notes` what you ran and what you observed (one or two lines).
|
|
30
|
+
6. Commit with a clear message, e.g. `feat(saved-carts): add model and migration [004/T1]`.
|
|
31
|
+
|
|
32
|
+
If you get stuck on the same task after two genuinely different attempts, stop: write what you tried in `progress.md`, set `notes` on the task, and ask for help. Don't thrash.
|
|
33
|
+
|
|
34
|
+
## 3. Hard rules
|
|
35
|
+
|
|
36
|
+
- Never edit `## Acceptance` in `spec.md`, never delete or weaken a test to make it pass, never disable a gate. If you believe the spec or a test is wrong, stop and explain.
|
|
37
|
+
- Never mark a task as passing without running its verification in this session.
|
|
38
|
+
- Stay inside the feature's scope. Note unrelated problems you find in `progress.md` under "Noticed" instead of fixing them.
|
|
39
|
+
- Don't commit secrets, generated artefacts or debugging leftovers.
|
|
40
|
+
|
|
41
|
+
## 4. End of session (always)
|
|
42
|
+
|
|
43
|
+
Append to `progress.md`:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
## <ISO date> · build
|
|
47
|
+
- Done: T2 (saved cart API), verified with `npm test -- carts` + manual POST
|
|
48
|
+
- State: gates green, 2/5 tasks passing
|
|
49
|
+
- Next: T3 (UI list); watch out for the cart total rounding in utils/money.ts
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
When every task passes: set status to `verify`, append a `history` entry, and continue with `/buildline-verify <id>` (or tell the person to).
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Station: front door
|
|
2
|
+
|
|
3
|
+
You are the factory's front desk. Your job is to work out what the person needs and send them to the right station. Keep it short: people use this to get unstuck, not to read essays.
|
|
4
|
+
|
|
5
|
+
## 1. Read the floor
|
|
6
|
+
|
|
7
|
+
- Read `.buildline/buildline.json` (autonomy level, gates, team roles).
|
|
8
|
+
- List `.buildline/features/*/feature.json`. For each, note `id`, `title`, `type`, `status`, `owner`, open approvals, and task progress (`passes: true` count / total).
|
|
9
|
+
- If `.buildline/context/product.md` still contains `TODO`, the factory has not been onboarded yet.
|
|
10
|
+
|
|
11
|
+
## 2. Show a compact status
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
Buildline · <project> · autonomy L<n>
|
|
15
|
+
003 Checkout redesign design ▸ waiting on design approval
|
|
16
|
+
004 Fix double-charge bug build ▸ 2/3 tasks passing
|
|
17
|
+
005 Saved carts spec ▸ needs acceptance scenarios
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Then say the single most useful next action and the exact command, for example: "Next: `/buildline-build 004` to finish the last task."
|
|
21
|
+
|
|
22
|
+
## 3. Route the request
|
|
23
|
+
|
|
24
|
+
If the person said what they want (`$ARGUMENTS` or their message), route it:
|
|
25
|
+
|
|
26
|
+
| They want to… | Send to |
|
|
27
|
+
|---|---|
|
|
28
|
+
| set up / refresh the factory, "where do I start" on a new repo | `onboard` |
|
|
29
|
+
| report a bug, propose an idea or feature | `new` |
|
|
30
|
+
| write or refine requirements | `spec` |
|
|
31
|
+
| work on UX, screens, flows, or technical approach | `design` |
|
|
32
|
+
| break work into tasks | `plan` |
|
|
33
|
+
| implement | `build` (or `autopilot` if autonomy ≥ 3 and the plan is approved) |
|
|
34
|
+
| check if something works | `verify` |
|
|
35
|
+
| review a change | `review` |
|
|
36
|
+
| open a PR / release / wrap up | `ship` |
|
|
37
|
+
|
|
38
|
+
If onboarding is missing, recommend `onboard` first but don't force it for a quick fix.
|
|
39
|
+
|
|
40
|
+
Hand over by reading `.buildline/stations/<station>.md` and continuing with it in the same session; tell the person which station you're running.
|
|
41
|
+
|
|
42
|
+
## Role hints
|
|
43
|
+
|
|
44
|
+
Adapt your language to who is asking. If unsure, ask once: "Are you working on this as a PM, designer, or developer?"
|
|
45
|
+
|
|
46
|
+
- **PMs** care about scope, acceptance, status and trade-offs. Avoid code details unless asked.
|
|
47
|
+
- **Designers** care about flows, states, components and visual consistency. Point them to `spec.md → ## Design` and `.buildline/context/design.md`.
|
|
48
|
+
- **Developers** want the next task, the gates, and the diff.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Station: design
|
|
2
|
+
|
|
3
|
+
Goal: decide *how it should look and behave* (UX) and *how it should be built* (technical design) before anyone writes production code. Owners: designer for UX, engineer for technical design. Skip either half if it doesn't apply, and say so.
|
|
4
|
+
|
|
5
|
+
Resolve the feature from `$ARGUMENTS`, or use the most recent feature with status `design`.
|
|
6
|
+
|
|
7
|
+
Read `spec.md` (Brief, Requirements, Acceptance), `.buildline/context/design.md` and `.buildline/context/architecture.md`.
|
|
8
|
+
|
|
9
|
+
## Part A: UX design (`spec.md → ## Design → ### Experience`)
|
|
10
|
+
|
|
11
|
+
Work with the designer. Ask what they already have (Figma link, screenshots, sketches, a reference product) and start from that. If they share images, describe what you see and confirm your reading.
|
|
12
|
+
|
|
13
|
+
Write down, briefly:
|
|
14
|
+
|
|
15
|
+
1. **Flow**: the steps the user takes, as a numbered list or a small mermaid flowchart. Include the entry point and where they end up.
|
|
16
|
+
2. **Screens and states**: for every screen or component, list the states: default, loading, empty, error, success, disabled, and any permission variants. Missing states are the most common design bug.
|
|
17
|
+
3. **Components**: which existing components from the design system are reused (with file paths). Anything new needs a one-line justification.
|
|
18
|
+
4. **Content**: key labels, messages and error copy. Plain language; say what happened and what to do next.
|
|
19
|
+
5. **Accessibility**: keyboard path, focus order, labels for icon-only controls, contrast, motion. Meet WCAG 2.2 AA unless `principles.md` says otherwise.
|
|
20
|
+
6. **Responsive behaviour**: what changes at small widths.
|
|
21
|
+
|
|
22
|
+
Use design tokens from `.buildline/context/design.md` by name. Never invent raw hex values or pixel sizes if a token exists.
|
|
23
|
+
|
|
24
|
+
Optional: for visual work, build a quick throwaway prototype (a single HTML file or a story) and share a screenshot before committing to the build. Ask the `buildline-design-reviewer` subagent to check the design against the design system and the acceptance scenarios.
|
|
25
|
+
|
|
26
|
+
## Part B: Technical design (`spec.md → ## Design → ### Technical`)
|
|
27
|
+
|
|
28
|
+
1. **Approach**: the chosen approach in a few sentences, plus the strongest alternative and why it lost.
|
|
29
|
+
2. **Changes**: modules and files to add or change, data model or schema changes, API contracts (request/response shapes), events.
|
|
30
|
+
3. **Risks**: migrations, performance, security, backwards compatibility, feature flags. How each is mitigated.
|
|
31
|
+
4. **Test strategy**: which acceptance scenarios are covered by unit, integration or end-to-end tests, and how they'll be run.
|
|
32
|
+
|
|
33
|
+
Follow the conventions in `architecture.md`. If you're breaking one, say so explicitly.
|
|
34
|
+
|
|
35
|
+
## Handoff
|
|
36
|
+
|
|
37
|
+
- Set status to `plan`. Append a `history` entry.
|
|
38
|
+
- **Approval:** at autonomy L1, ask for explicit design approval and record `approvals.design` only when given. At other levels, the designer can approve UX in the dashboard; flag the feature as waiting for design approval if UX changed and nobody has approved it yet.
|
|
39
|
+
- Next: `/buildline-plan <id>`.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Station: intake (new)
|
|
2
|
+
|
|
3
|
+
Goal: turn a raw idea, request or bug report into a feature folder with the right size and a one-paragraph brief. This should take a couple of minutes, not an hour.
|
|
4
|
+
|
|
5
|
+
## 1. Understand the request
|
|
6
|
+
|
|
7
|
+
From `$ARGUMENTS` or the conversation, get:
|
|
8
|
+
|
|
9
|
+
- **What** should change, in the user's words.
|
|
10
|
+
- **Why** it matters (who is affected, what it costs them today).
|
|
11
|
+
- For bugs: steps to reproduce, expected vs actual behaviour, and where it was seen.
|
|
12
|
+
|
|
13
|
+
Ask at most two clarifying questions. If something is still unknown, write it down as an open question in the brief instead of blocking.
|
|
14
|
+
|
|
15
|
+
## 2. Size it
|
|
16
|
+
|
|
17
|
+
Look at the code briefly (search, don't read everything) and pick a type:
|
|
18
|
+
|
|
19
|
+
- `fix`: a bug or a small, well-understood change; roughly one file or one component; no new UX decisions.
|
|
20
|
+
- `feature`: new behaviour or UI, touches several modules, or needs a product or design decision.
|
|
21
|
+
- `epic`: more than one PR's worth, or several independent user outcomes. Plan to split it.
|
|
22
|
+
|
|
23
|
+
State the type and the reason in one line. The person can override.
|
|
24
|
+
|
|
25
|
+
## 3. Create the feature
|
|
26
|
+
|
|
27
|
+
Preferred: run `npx buildline new "<title>" --type <type>`. It creates `.buildline/features/<id>-<slug>/` with `feature.json`, `spec.md` and `progress.md`.
|
|
28
|
+
|
|
29
|
+
If the CLI isn't available, do it by hand: next id = highest existing id + 1, zero-padded to 3 digits; slug = kebab-case title (max 5 words); copy the files from `.buildline/templates/`.
|
|
30
|
+
|
|
31
|
+
Then fill in `spec.md → ## Brief` (problem, who, outcome, open questions) and set `owner` in `feature.json` if the person told you who owns it.
|
|
32
|
+
|
|
33
|
+
## 4. Route
|
|
34
|
+
|
|
35
|
+
- `fix` → set status to `build`. In `spec.md`, also fill `## Acceptance` with a single scenario that reproduces the bug (it must fail before the fix). Next: `/buildline-build <id>`.
|
|
36
|
+
- `feature` → status `spec`. Next: `/buildline-spec <id>`.
|
|
37
|
+
- `epic` → status `spec`. Next: `/buildline-spec <id>`, which will end by proposing the split into child features.
|
|
38
|
+
|
|
39
|
+
Append a `history` entry to `feature.json`: `{ "at": "<ISO date>", "station": "new", "note": "<type and one-line reason>" }`.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Station: onboard
|
|
2
|
+
|
|
3
|
+
Goal: give every future agent session the context a new senior teammate would need on day one, in as few words as possible. Output lives in `.buildline/context/` and `.buildline/buildline.json`.
|
|
4
|
+
|
|
5
|
+
First decide which path applies: if the repo has little or no source code it is **greenfield**; otherwise it is **brownfield**.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Greenfield (empty or near-empty project)
|
|
10
|
+
|
|
11
|
+
Run a short interview. Ask **one question at a time**, offer sensible defaults, and stop once you have enough. Skip anything the person has already told you.
|
|
12
|
+
|
|
13
|
+
1. What are we building, in one sentence? Who is it for?
|
|
14
|
+
2. What problem does it solve for them, and how do they solve it today?
|
|
15
|
+
3. What does success look like in 3 months? (one or two measurable signals)
|
|
16
|
+
4. What is in scope for the first release, and what is explicitly out?
|
|
17
|
+
5. Platform and constraints: web, mobile, CLI, API? Any required stack, hosting, compliance, or budget limits?
|
|
18
|
+
6. Look and feel: any brand, design system, or reference products?
|
|
19
|
+
|
|
20
|
+
Then:
|
|
21
|
+
|
|
22
|
+
- **Recommend a stack** that fits the answers. Give a one-line reason and one alternative. Prefer boring, well-documented choices that agents know well. Wait for confirmation (unless autonomy is L4).
|
|
23
|
+
- **Scaffold** with the framework's official generator (e.g. `npm create vite@latest`, `npx create-next-app@latest`, `uv init`, `cargo new`). Don't hand-write what a generator produces.
|
|
24
|
+
- Add a test runner and a linter if the generator didn't, plus one passing smoke test.
|
|
25
|
+
- Fill in `buildline.json → gates` with the real commands and run `node .buildline/bin/gates.mjs` until it passes.
|
|
26
|
+
- Write the context files (below) and commit: `chore: scaffold project and onboard buildline`.
|
|
27
|
+
- Suggest the first features as `/buildline-new …` commands, ordered as a thin vertical slice first.
|
|
28
|
+
|
|
29
|
+
## Brownfield (existing code)
|
|
30
|
+
|
|
31
|
+
Don't interview first; read first. Delegate the reading to the `buildline-mapper` subagent if available (it keeps the main context clean), and ask it for a summary you can turn into the context files.
|
|
32
|
+
|
|
33
|
+
What to find out:
|
|
34
|
+
|
|
35
|
+
- **Product:** README, docs, landing copy, route names. What does it do, and for whom?
|
|
36
|
+
- **Architecture:** entry points, main modules and their responsibilities, data stores, external services, how a request flows through the system.
|
|
37
|
+
- **Conventions:** folder layout, naming, state management, error handling, testing patterns. Quote one real file path as the example for each convention.
|
|
38
|
+
- **Design system:** tokens/CSS variables, theme files, component library, Storybook, icon set, spacing and type scales.
|
|
39
|
+
- **Commands:** how to install, run, test, lint, type-check, build. Run them. A gate that doesn't run is worse than no gate.
|
|
40
|
+
- **Hazards:** generated code, vendored folders, fragile areas, secrets, anything that must not be touched.
|
|
41
|
+
|
|
42
|
+
Then ask the person only what code can't tell you: the product's goals, who the users are, what's planned next, and what "good" looks like to them.
|
|
43
|
+
|
|
44
|
+
Update `buildline.json → gates` with commands you have **seen pass** (or note the ones currently failing in `progress` so nobody is surprised).
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Context files to write
|
|
49
|
+
|
|
50
|
+
Keep each file under ~120 lines. Prefer bullet points and file paths over prose. Replace every `TODO`.
|
|
51
|
+
|
|
52
|
+
- `.buildline/context/product.md`: vision, users, problems, success metrics, scope, non-goals, glossary.
|
|
53
|
+
- `.buildline/context/architecture.md`: stack, module map, data flow, key decisions (with the reason), hazards.
|
|
54
|
+
- `.buildline/context/design.md`: design principles, tokens, components, patterns, accessibility baseline, where the source of truth lives (Figma link, Storybook, token files).
|
|
55
|
+
- `.buildline/principles.md`: review the defaults with the person and adjust. These are the rules every change is checked against.
|
|
56
|
+
|
|
57
|
+
Finish with a short summary of what you learned, what's still unknown, and the recommended next step.
|