plumbbob 0.8.12 → 0.8.13
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/.claude-plugin/plugin.json +1 -1
- package/dist/cli-core.js +1 -1
- package/dist/lib/buildlog.js +49 -2
- package/dist/lib/buildlogsync.js +34 -0
- package/dist/lib/sidecar.js +25 -0
- package/dist/lib/templates.js +19 -0
- package/dist/verbs/build.js +5 -0
- package/dist/verbs/checkpoint.js +5 -0
- package/dist/verbs/revert.js +5 -0
- package/dist/verbs/spike.js +80 -6
- package/dist/verbs/start.js +10 -11
- package/package.json +1 -1
- package/skills/pb-build/SKILL.md +8 -1
- package/skills/pb-spike/SKILL.md +14 -5
- package/templates/build-log.md +7 -4
- package/templates/spike-report.md +38 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plumbbob",
|
|
3
3
|
"displayName": "PlumbBob",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.13",
|
|
5
5
|
"description": "Attention-first build process — driver skills + a CLI that keep you the decider: guidance on the work, a latch on the record.",
|
|
6
6
|
"author": { "name": "Rob McLarty", "email": "hello@robmclarty.com", "url": "https://robmclarty.com" },
|
|
7
7
|
"homepage": "https://github.com/robmclarty/plumbbob#readme",
|
package/dist/cli-core.js
CHANGED
|
@@ -29,7 +29,7 @@ const VERBS = [
|
|
|
29
29
|
{ name: 'checkpoint', summary: 'checkpoint [<n>]: gate on green, commit/record SHA, mark step done (executor-agnostic)' },
|
|
30
30
|
{ name: 'revert', summary: 'revert [--to n]: git reset --hard to a checkpoint SHA' },
|
|
31
31
|
{ name: 'park', summary: 'park "<text>": append a raw line to the park list' },
|
|
32
|
-
{ name: 'spike', summary: 'spike "<slug>" | spike done:
|
|
32
|
+
{ name: 'spike', summary: 'spike "<slug>" | spike report "<slug>" | spike done: worktree experiment + report' },
|
|
33
33
|
{ name: 'use', summary: 'use <slug>: re-point the active-build cursor and resume that build' },
|
|
34
34
|
{ name: 'finish', summary: 'close-out: report + final commit (no gate), clear the control state, close the session' },
|
|
35
35
|
{ name: 'init', summary: 'link plumbbob into Claude Code as an in-place plugin (~/.claude/skills/plumbbob); --uninstall to undo' },
|
package/dist/lib/buildlog.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
// Mutations to the active build-log.md — the human-facing ledger. `park` appends to
|
|
2
2
|
// its Park list; `checkpoint` appends to its Log so the build's history accrues
|
|
3
3
|
// line-by-line *as it happens* rather than being reconstructed at finish (D-history).
|
|
4
|
-
//
|
|
5
|
-
//
|
|
4
|
+
// `build`/`checkpoint`/`revert` keep its `## Steps` mirror and `**Current step:**`
|
|
5
|
+
// line in sync with intent.md (D69), so the ledger's top half tracks reality without
|
|
6
|
+
// a model turn. Pure string transforms (no fs, no classes — C1/C2); callers own the
|
|
7
|
+
// IO so these stay trivially testable.
|
|
6
8
|
// Append `line` after the last non-blank line of the `## <heading>` section — i.e.
|
|
7
9
|
// just before the next `## ` heading or EOF. Returns null when the section is absent
|
|
8
10
|
// so the caller can report rather than silently corrupt the doc.
|
|
@@ -25,6 +27,51 @@ export function appendToSection(content, heading, line) {
|
|
|
25
27
|
lines.splice(insertAt, 0, line);
|
|
26
28
|
return lines.join('\n');
|
|
27
29
|
}
|
|
30
|
+
// Replace the `**Current step:**` line with `**Current step:** <label>` — `build`
|
|
31
|
+
// sets it to `<n> — <title>` when a step opens; `checkpoint`/`revert` reset it to
|
|
32
|
+
// `none (at the boundary)`. Returns null when the line is absent so the caller skips
|
|
33
|
+
// rather than corrupting the doc (C3).
|
|
34
|
+
export function setCurrentStep(content, label) {
|
|
35
|
+
const lines = content.split('\n');
|
|
36
|
+
const idx = lines.findIndex((l) => /^\*\*Current step:\*\*/.test(l.trim()));
|
|
37
|
+
if (idx === -1) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
lines[idx] = `**Current step:** ${label}`;
|
|
41
|
+
return lines.join('\n');
|
|
42
|
+
}
|
|
43
|
+
// Regenerate the `## Steps` mirror from intent.md's parsed steps — one
|
|
44
|
+
// `- ☑/☐ N. <title>` line each, in order. Only the mirror's own `- ☑/☐` list lines
|
|
45
|
+
// are owned; the italic instructions paragraph (and any other prose) is preserved,
|
|
46
|
+
// and exactly one blank line separates it from the list. Returns null when the
|
|
47
|
+
// section is absent (C3). With no steps the mirror renders empty — the plan is not
|
|
48
|
+
// authored yet — rather than inventing a placeholder.
|
|
49
|
+
export function syncStepsSection(content, steps) {
|
|
50
|
+
const lines = content.split('\n');
|
|
51
|
+
const headingIdx = lines.findIndex((l) => l.trim() === '## Steps');
|
|
52
|
+
if (headingIdx === -1) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
let end = lines.findIndex((l, i) => i > headingIdx && l.startsWith('## '));
|
|
56
|
+
if (end === -1) {
|
|
57
|
+
end = lines.length;
|
|
58
|
+
}
|
|
59
|
+
// The section body minus the mirror list lines, with trailing blanks trimmed, is
|
|
60
|
+
// the prose to preserve (the instructions paragraph). Rebuild: prose, one blank,
|
|
61
|
+
// the fresh list, one blank before the next heading.
|
|
62
|
+
const prose = lines.slice(headingIdx + 1, end).filter((l) => !isMirrorLine(l));
|
|
63
|
+
while (prose.length > 0 && (prose.at(-1) ?? '').trim() === '') {
|
|
64
|
+
prose.pop();
|
|
65
|
+
}
|
|
66
|
+
const list = steps.map((s) => `- ${s.done ? '☑' : '☐'} ${s.n}. ${s.title}`);
|
|
67
|
+
const body = [...prose, ...(prose.length > 0 ? [''] : []), ...list, ''];
|
|
68
|
+
return [...lines.slice(0, headingIdx + 1), ...body, ...lines.slice(end)].join('\n');
|
|
69
|
+
}
|
|
70
|
+
// A mirror list line the CLI owns: `- ☑ …` / `- ☐ …`. The template's initial
|
|
71
|
+
// `- ☐ 1. <step>` placeholder matches, so the first sync replaces it in place.
|
|
72
|
+
function isMirrorLine(line) {
|
|
73
|
+
return /^-\s+[☑☐]/.test(line);
|
|
74
|
+
}
|
|
28
75
|
// The Log line `checkpoint` writes for a landed step: dated, names the step (its
|
|
29
76
|
// title when intent.md still carries it), and carries the short SHA. One line of the
|
|
30
77
|
// build's history — `/pb-finish` reads these instead of re-narrating the build.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Keep the build-log's top half — the `**Current step:**` line and the `## Steps`
|
|
2
|
+
// mirror — in sync with intent.md (D69). `build` sets the current-step label when a
|
|
3
|
+
// step opens; `checkpoint` and `revert` reset it to the boundary; all three re-render
|
|
4
|
+
// the mirror from intent.md's parsed steps so it tracks reality without a model turn.
|
|
5
|
+
// The write is best-effort (a missing or hand-edited build-log never fails a verb —
|
|
6
|
+
// the checkpoints ledger and intent.md stay the source of truth), matching how
|
|
7
|
+
// `checkpoint`'s Log append already behaves.
|
|
8
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
9
|
+
import { buildLogPath, intentPath } from "./sidecar.js";
|
|
10
|
+
import { parseSteps } from "./orient.js";
|
|
11
|
+
import { setCurrentStep, syncStepsSection } from "./buildlog.js";
|
|
12
|
+
export const AT_BOUNDARY = 'none (at the boundary)';
|
|
13
|
+
// The current-step label for an open step: `<n> — <title>`, or a bare `<n>` when the
|
|
14
|
+
// step carries no title. `build` passes this; the boundary verbs pass AT_BOUNDARY.
|
|
15
|
+
export function stepLabel(n, title) {
|
|
16
|
+
return title !== null && title.trim().length > 0 ? `${n} — ${title.trim()}` : String(n);
|
|
17
|
+
}
|
|
18
|
+
// Rewrite the active build's build-log top half: set the Current step line to `label`
|
|
19
|
+
// and re-render the `## Steps` mirror from intent.md. Each transform is skipped when
|
|
20
|
+
// its target is absent (null), and the whole thing swallows any IO error — the ledger
|
|
21
|
+
// must never block the verb.
|
|
22
|
+
export function syncBuildLogState(root, slug, label) {
|
|
23
|
+
try {
|
|
24
|
+
const path = buildLogPath(root, slug);
|
|
25
|
+
const steps = parseSteps(readFileSync(intentPath(root, slug), 'utf8'));
|
|
26
|
+
let content = readFileSync(path, 'utf8');
|
|
27
|
+
content = setCurrentStep(content, label) ?? content;
|
|
28
|
+
content = syncStepsSection(content, steps) ?? content;
|
|
29
|
+
writeFileSync(path, content);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// best-effort ledger; never fail a verb over the build-log.
|
|
33
|
+
}
|
|
34
|
+
}
|
package/dist/lib/sidecar.js
CHANGED
|
@@ -158,6 +158,31 @@ export function buildLogPath(root, slug) {
|
|
|
158
158
|
export function reportPath(root, slug) {
|
|
159
159
|
return join(artifactDir(root, slug), 'report.md');
|
|
160
160
|
}
|
|
161
|
+
// Spike reports (D70): `spike-NN-<slug>.md` in the build folder, beside report.md.
|
|
162
|
+
// One per spike — an explicit `/pb-spike` or a planned `spike:` step — so a build with
|
|
163
|
+
// several forks tells its decision history through the folder listing. NN is
|
|
164
|
+
// CLI-allocated (the human never numbers them), zero-padded for a stable sort.
|
|
165
|
+
// The existing spike-report filenames in the build folder, sorted. Empty when the
|
|
166
|
+
// folder is absent or holds none.
|
|
167
|
+
export function listSpikeReports(root, slug) {
|
|
168
|
+
try {
|
|
169
|
+
return readdirSync(artifactDir(root, slug))
|
|
170
|
+
.filter((name) => /^spike-\d\d-.+\.md$/.test(name))
|
|
171
|
+
.sort();
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
return [];
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// The path for a NEW spike report: the next free zero-padded index (one past the
|
|
178
|
+
// highest existing NN, so a gap never reallocates a number) and the sanitized spike
|
|
179
|
+
// slug. Pure allocation — the caller writes the stamped template there.
|
|
180
|
+
export function nextSpikeReportPath(root, slug, spikeSlug) {
|
|
181
|
+
const used = listSpikeReports(root, slug).map((name) => Number(name.slice('spike-'.length, 'spike-'.length + 2)));
|
|
182
|
+
const next = (used.length > 0 ? Math.max(...used) : 0) + 1;
|
|
183
|
+
const nn = String(next).padStart(2, '0');
|
|
184
|
+
return join(artifactDir(root, slug), `spike-${nn}-${spikeSlug}.md`);
|
|
185
|
+
}
|
|
161
186
|
// handoff.json is the agent-run ledger (D47): each `agent run` appends its
|
|
162
187
|
// validated envelope here so a later invocation can thread earlier results into
|
|
163
188
|
// the next call's `context[]` — the CLI itself is memoryless between runs, and
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Scaffold templates live at `<pkg-root>/templates/*.md` and carry `{{PLACEHOLDER}}`
|
|
2
|
+
// tokens the verbs fill in. `start` stamps intent.md / build-log.md; `spike` stamps
|
|
3
|
+
// spike-report.md. Shared here so both resolve the template dir the same way (relative
|
|
4
|
+
// to the compiled module URL) and substitute with one mechanism. Pure/procedural,
|
|
5
|
+
// node-builtins-only (C1/C2).
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
import { readFileSync } from 'node:fs';
|
|
8
|
+
export function readTemplate(name) {
|
|
9
|
+
return readFileSync(fileURLToPath(new URL(`../../templates/${name}`, import.meta.url)), 'utf8');
|
|
10
|
+
}
|
|
11
|
+
// Replace every `{{KEY}}` with its value. Generic over the placeholder set so a new
|
|
12
|
+
// template can add tokens (spike-report's `{{VIA}}`/`{{DATE}}`) without touching this.
|
|
13
|
+
export function stampTemplate(template, subs) {
|
|
14
|
+
let out = template;
|
|
15
|
+
for (const [key, value] of Object.entries(subs)) {
|
|
16
|
+
out = out.split(`{{${key}}}`).join(value);
|
|
17
|
+
}
|
|
18
|
+
return out;
|
|
19
|
+
}
|
package/dist/verbs/build.js
CHANGED
|
@@ -6,6 +6,7 @@ import { findRepoRoot } from "../lib/git.js";
|
|
|
6
6
|
import { hasSession, intentPath, resolveBuild, seamPath, stampStepStat, stampTick, stepPath } from "../lib/sidecar.js";
|
|
7
7
|
import { parseStepSeam } from "../lib/intent.js";
|
|
8
8
|
import { parseSteps } from "../lib/orient.js";
|
|
9
|
+
import { stepLabel, syncBuildLogState } from "../lib/buildlogsync.js";
|
|
9
10
|
export function build(cwd, args) {
|
|
10
11
|
const root = findRepoRoot(cwd);
|
|
11
12
|
if (root === null || !hasSession(root)) {
|
|
@@ -55,6 +56,10 @@ export function build(cwd, args) {
|
|
|
55
56
|
// The wall-clock receipt starts here (research/07 Build 2b): checkpoint stamps
|
|
56
57
|
// landedAt, and the pair becomes the step's duration in the finish report.
|
|
57
58
|
stampStepStat(root, slug, step, 'startedAt', new Date().toISOString());
|
|
59
|
+
// The build-log's top half now shows this step in flight (D69): Current step +
|
|
60
|
+
// the ☐/☑ mirror, re-rendered from intent.md. Best-effort — never blocks the build.
|
|
61
|
+
const title = parseSteps(intent).find((s) => s.n === step)?.title ?? null;
|
|
62
|
+
syncBuildLogState(root, slug, stepLabel(step, title));
|
|
58
63
|
const picked = raw === undefined ? ' (next undone)' : '';
|
|
59
64
|
process.stdout.write(`plumbbob: building step ${step}${picked}. Seam (for orientation; not a lock):\n${parsed.seam.map((p) => ` ${p}`).join('\n')}\n`);
|
|
60
65
|
return 0;
|
package/dist/verbs/checkpoint.js
CHANGED
|
@@ -16,6 +16,7 @@ import { markStepDone, parseSteps } from "../lib/orient.js";
|
|
|
16
16
|
import { parseStepSeam, scopeDrift } from "../lib/intent.js";
|
|
17
17
|
import { conventionalSubject, subjectFromTitle, withMarker } from "../lib/commitmsg.js";
|
|
18
18
|
import { appendToSection, checkpointLogLine } from "../lib/buildlog.js";
|
|
19
|
+
import { AT_BOUNDARY, syncBuildLogState } from "../lib/buildlogsync.js";
|
|
19
20
|
export async function checkpoint(cwd, args) {
|
|
20
21
|
const root = findRepoRoot(cwd);
|
|
21
22
|
if (root === null || !hasSession(root)) {
|
|
@@ -64,6 +65,10 @@ export async function checkpoint(cwd, args) {
|
|
|
64
65
|
flipIntent(root, step);
|
|
65
66
|
stampStepStat(root, undefined, step, 'landedAt', new Date().toISOString());
|
|
66
67
|
logCheckpoint(root, step, sha);
|
|
68
|
+
// The step landed: the build-log's mirror flips to ☑ and Current step returns to
|
|
69
|
+
// the boundary (D69), re-read from the intent.md `flipIntent` just wrote. The
|
|
70
|
+
// artifact-plane whitelist keeps this build-log write from ever reading as drift.
|
|
71
|
+
syncBuildLogState(root, activeBuild(root), AT_BOUNDARY);
|
|
67
72
|
rmSync(seamPath(root), { force: true });
|
|
68
73
|
rmSync(stepPath(root), { force: true });
|
|
69
74
|
clearHandoff(root); // the agent-run ledger is step-scoped (D47) — clear it with the markers.
|
package/dist/verbs/revert.js
CHANGED
|
@@ -20,6 +20,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
20
20
|
import { findRepoRoot, resetHard, untrackedPaths } from "../lib/git.js";
|
|
21
21
|
import { bumpStepStat, checkpointsPath, hasSession, resolveBuild, seamPath, sidecarDir, stepPath } from "../lib/sidecar.js";
|
|
22
22
|
import { isArtifactPath, matchesSeam } from "../lib/intent.js";
|
|
23
|
+
import { AT_BOUNDARY, syncBuildLogState } from "../lib/buildlogsync.js";
|
|
23
24
|
export function revert(cwd, args) {
|
|
24
25
|
const root = findRepoRoot(cwd);
|
|
25
26
|
if (root === null || !hasSession(root)) {
|
|
@@ -66,6 +67,10 @@ export function revert(cwd, args) {
|
|
|
66
67
|
if (inFlight !== null) {
|
|
67
68
|
bumpStepStat(root, slug, inFlight, 'reverts');
|
|
68
69
|
}
|
|
70
|
+
// The step is abandoned: the build-log returns to the boundary and its mirror
|
|
71
|
+
// re-renders from the preserved intent.md (D69) — revert keeps intent edits (D26),
|
|
72
|
+
// so intent's checkboxes stay the truth to reflect. Best-effort, like the rest.
|
|
73
|
+
syncBuildLogState(root, slug, AT_BOUNDARY);
|
|
69
74
|
process.stdout.write(`plumbbob: reverted to ${sha.slice(0, 9)} — back at the boundary. Park lines and intent edits were preserved.\n`);
|
|
70
75
|
return 0;
|
|
71
76
|
}
|
package/dist/verbs/spike.js
CHANGED
|
@@ -10,11 +10,15 @@
|
|
|
10
10
|
// shared additive read/commit helpers): worktree management is spike-local, and
|
|
11
11
|
// this is the only place Plumbbob creates branches.
|
|
12
12
|
import { execFileSync } from 'node:child_process';
|
|
13
|
-
import { existsSync } from 'node:fs';
|
|
14
|
-
import { basename, dirname, join } from 'node:path';
|
|
13
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
14
|
+
import { basename, dirname, join, relative } from 'node:path';
|
|
15
15
|
import { findRepoRoot } from "../lib/git.js";
|
|
16
|
-
import { hasSession, inSpike, markSpike,
|
|
16
|
+
import { buildFolder, clearSpike, hasSession, inSpike, listSpikeReports, markSpike, nextSpikeReportPath, resolveBuild, stepPath, } from "../lib/sidecar.js";
|
|
17
|
+
import { readTemplate, stampTemplate } from "../lib/templates.js";
|
|
17
18
|
const DEFAULT_OPTIONS = ['a', 'b'];
|
|
19
|
+
// The verbatim Verdict placeholder from templates/spike-report.md — its presence means
|
|
20
|
+
// the spike's call was never recorded, which `spike done` nudges on (D70).
|
|
21
|
+
const VERDICT_PLACEHOLDER = '*(viable | not viable | partial';
|
|
18
22
|
export function spike(cwd, args) {
|
|
19
23
|
const root = findRepoRoot(cwd);
|
|
20
24
|
if (root === null || !hasSession(root)) {
|
|
@@ -26,8 +30,49 @@ export function spike(cwd, args) {
|
|
|
26
30
|
if (positionals[0] === 'done') {
|
|
27
31
|
return spikeDone(root, buildSlug);
|
|
28
32
|
}
|
|
33
|
+
if (positionals[0] === 'report') {
|
|
34
|
+
return spikeReport(root, buildSlug, positionals.slice(1));
|
|
35
|
+
}
|
|
29
36
|
return spikeStart(root, buildSlug, positionals);
|
|
30
37
|
}
|
|
38
|
+
// `spike report "<slug>"` (D70) — scaffold a spike report WITHOUT worktrees, for the
|
|
39
|
+
// spike-as-step case (a planned step titled `spike: …`, where the increment itself is
|
|
40
|
+
// the experiment). No boundary requirement and no SPIKE marker: a step in flight is
|
|
41
|
+
// exactly when this runs. Provenance is `step <n>` when a STEP is in flight, else
|
|
42
|
+
// `/pb-spike`.
|
|
43
|
+
function spikeReport(root, buildSlug, positionals) {
|
|
44
|
+
const slug = sanitize(positionals[0] ?? '');
|
|
45
|
+
if (slug.length === 0) {
|
|
46
|
+
process.stderr.write('plumbbob: spike report needs a slug. Try: plumbbob spike report "auth-store".\n');
|
|
47
|
+
return 1;
|
|
48
|
+
}
|
|
49
|
+
const inFlight = readInFlightStep(root, buildSlug);
|
|
50
|
+
const via = inFlight !== null ? `step ${inFlight}` : '/pb-spike';
|
|
51
|
+
const path = scaffoldSpikeReport(root, buildSlug, slug, via);
|
|
52
|
+
process.stdout.write(`plumbbob: spike report scaffolded — ${relative(root, path)}. Fill Findings and the Verdict as you go; ` +
|
|
53
|
+
`a recorded Verdict is what closes a spike step.\n`);
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
56
|
+
// Write a fresh spike report from the template at the next free `spike-NN-<slug>.md`
|
|
57
|
+
// in the build folder, and return its path. Shared by the explicit `/pb-spike` open
|
|
58
|
+
// and the spike-as-step `spike report` — one artifact, two entry points (D70).
|
|
59
|
+
function scaffoldSpikeReport(root, buildSlug, spikeSlug, via) {
|
|
60
|
+
const path = nextSpikeReportPath(root, buildSlug, spikeSlug);
|
|
61
|
+
const date = new Date().toISOString().slice(0, 10);
|
|
62
|
+
writeFileSync(path, stampTemplate(readTemplate('spike-report.md'), { TITLE: spikeSlug, VIA: via, DATE: date }));
|
|
63
|
+
return path;
|
|
64
|
+
}
|
|
65
|
+
// The in-flight STEP number for the build, or null — reads the STEP marker `build`
|
|
66
|
+
// writes. Used to stamp a spike-as-step report's provenance.
|
|
67
|
+
function readInFlightStep(root, buildSlug) {
|
|
68
|
+
try {
|
|
69
|
+
const raw = readFileSync(stepPath(root, buildSlug), 'utf8').trim();
|
|
70
|
+
return /^\d+$/.test(raw) ? Number(raw) : null;
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
31
76
|
function spikeStart(root, buildSlug, positionals) {
|
|
32
77
|
if (inSpike(root, buildSlug)) {
|
|
33
78
|
process.stderr.write('plumbbob: already in a spike. Run `plumbbob spike done` to close it first.\n');
|
|
@@ -56,9 +101,12 @@ function spikeStart(root, buildSlug, positionals) {
|
|
|
56
101
|
created.push(path);
|
|
57
102
|
}
|
|
58
103
|
markSpike(root, buildSlug);
|
|
104
|
+
// Scaffold the report NOW, while the worktrees live (D70): findings accrue during the
|
|
105
|
+
// experiment, not from memory after the teardown. Provenance names the worktrees.
|
|
106
|
+
const report = scaffoldSpikeReport(root, buildSlug, slug, `/pb-spike — worktrees (${options.join(', ')})`);
|
|
59
107
|
process.stdout.write(`plumbbob: spiking — the main tree stays put. Experiment in the throwaway worktrees:\n${created
|
|
60
108
|
.map((p) => ` ${p}`)
|
|
61
|
-
.join('\n')}\
|
|
109
|
+
.join('\n')}\nRecord findings and the Verdict in ${relative(root, report)} as you go, then run \`plumbbob spike done\`.\n`);
|
|
62
110
|
return 0;
|
|
63
111
|
}
|
|
64
112
|
function spikeDone(root, buildSlug) {
|
|
@@ -66,6 +114,10 @@ function spikeDone(root, buildSlug) {
|
|
|
66
114
|
process.stderr.write('plumbbob: no active spike to close.\n');
|
|
67
115
|
return 1;
|
|
68
116
|
}
|
|
117
|
+
// Check for an unrecorded verdict BEFORE teardown (D70). The reports live in the
|
|
118
|
+
// build folder, not the spike worktrees, so they survive the removal — but the
|
|
119
|
+
// learning that fills them does not, so this is the moment to nudge.
|
|
120
|
+
const unfilled = spikeReportsMissingVerdict(root, buildSlug);
|
|
69
121
|
for (const path of spikeWorktrees(root)) {
|
|
70
122
|
git(root, ['worktree', 'remove', '--force', path]);
|
|
71
123
|
}
|
|
@@ -74,10 +126,32 @@ function spikeDone(root, buildSlug) {
|
|
|
74
126
|
git(root, ['branch', '-D', branch]);
|
|
75
127
|
}
|
|
76
128
|
clearSpike(root, buildSlug);
|
|
77
|
-
|
|
78
|
-
|
|
129
|
+
// Guidance, not a gate (the enforce→guide pivot): a missing verdict is a nudge, and
|
|
130
|
+
// the spike still closes. Name the reports so the human knows where to write it.
|
|
131
|
+
if (unfilled.length > 0) {
|
|
132
|
+
process.stderr.write(`plumbbob: heads-up — no verdict recorded in ${unfilled.join(', ')}. ` +
|
|
133
|
+
`The worktrees are gone; capture the call there before it fades.\n`);
|
|
134
|
+
}
|
|
135
|
+
const reports = listSpikeReports(root, buildSlug);
|
|
136
|
+
const where = reports.length > 0 ? `the spike report${reports.length === 1 ? '' : 's'} (${reports.join(', ')})` : 'intent.md';
|
|
137
|
+
process.stdout.write(`plumbbob: spike closed — worktrees and branches removed, back at the boundary. ` +
|
|
138
|
+
`Record the verdict (which option won, and why) in ${where} before you \`build\`.\n`);
|
|
79
139
|
return 0;
|
|
80
140
|
}
|
|
141
|
+
// The spike-report filenames in the build folder whose Verdict is still the template
|
|
142
|
+
// placeholder — the ones `spike done` nudges on. Best-effort per file: an unreadable
|
|
143
|
+
// report is skipped rather than blocking the close.
|
|
144
|
+
function spikeReportsMissingVerdict(root, buildSlug) {
|
|
145
|
+
const dir = buildFolder(root, buildSlug);
|
|
146
|
+
return listSpikeReports(root, buildSlug).filter((name) => {
|
|
147
|
+
try {
|
|
148
|
+
return readFileSync(join(dir, name), 'utf8').includes(VERDICT_PLACEHOLDER);
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
}
|
|
81
155
|
// Worktree paths whose checked-out branch is under spike/ — parsed from the
|
|
82
156
|
// porcelain output (blank-line-separated `worktree <path>` / `branch <ref>` blocks).
|
|
83
157
|
function spikeWorktrees(root) {
|
package/dist/verbs/start.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// `plumbbob start "<title>"` — scaffold the sidecar, record the baseline, open
|
|
2
2
|
// the session. Refuses on a dirty tree (D22), an existing session, or a non-git dir.
|
|
3
|
-
import {
|
|
4
|
-
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
3
|
+
import { existsSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
5
4
|
import { join } from 'node:path';
|
|
6
5
|
import { detectGate } from "../lib/check.js";
|
|
6
|
+
import { readTemplate, stampTemplate } from "../lib/templates.js";
|
|
7
7
|
import { findRepoRoot, hasCommit, headSha, isDirty } from "../lib/git.js";
|
|
8
8
|
import { sidecarDir, buildDir, listBuilds, slugify, checkpointsPath, intentPath, buildLogPath, beginSession, hasSession, excludeControl, excludeSidecar, setGrant, stampTick, } from "../lib/sidecar.js";
|
|
9
9
|
import { settingsPath } from "../lib/settings.js";
|
|
@@ -73,8 +73,8 @@ export async function start(cwd, args) {
|
|
|
73
73
|
let intentLocation;
|
|
74
74
|
if (local) {
|
|
75
75
|
writeFileSync(checkpointsPath(root), `baseline ${sha}\n`);
|
|
76
|
-
writeFileSync(intentPath(root),
|
|
77
|
-
writeFileSync(buildLogPath(root),
|
|
76
|
+
writeFileSync(intentPath(root), stampBuild(readTemplate('intent.md'), title));
|
|
77
|
+
writeFileSync(buildLogPath(root), stampBuild(readTemplate('build-log.md'), title));
|
|
78
78
|
excludeSidecar(root);
|
|
79
79
|
intentLocation = '.plumbbob/intent.md';
|
|
80
80
|
}
|
|
@@ -82,8 +82,8 @@ export async function start(cwd, args) {
|
|
|
82
82
|
const dir = buildDir(root, slug);
|
|
83
83
|
mkdirSync(dir, { recursive: true });
|
|
84
84
|
writeFileSync(join(dir, 'checkpoints'), `baseline ${sha}\n`);
|
|
85
|
-
writeFileSync(join(dir, 'intent.md'),
|
|
86
|
-
writeFileSync(join(dir, 'build-log.md'),
|
|
85
|
+
writeFileSync(join(dir, 'intent.md'), stampBuild(readTemplate('intent.md'), title));
|
|
86
|
+
writeFileSync(join(dir, 'build-log.md'), stampBuild(readTemplate('build-log.md'), title));
|
|
87
87
|
excludeControl(root);
|
|
88
88
|
intentLocation = `.plumbbob/builds/${slug}/intent.md`;
|
|
89
89
|
}
|
|
@@ -128,9 +128,8 @@ function flagValue(args, flag) {
|
|
|
128
128
|
const i = args.indexOf(flag);
|
|
129
129
|
return i >= 0 ? args[i + 1] : undefined;
|
|
130
130
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return template.split('{{TITLE}}').join(title).split('{{CHECK}}').join(check);
|
|
131
|
+
// Stamp a build template's `{{TITLE}}`/`{{CHECK}}` — the check is always the echo
|
|
132
|
+
// constant (absence of a `check` setting IS the default, D24/D32).
|
|
133
|
+
function stampBuild(template, title) {
|
|
134
|
+
return stampTemplate(template, { TITLE: title, CHECK: CHECK_ECHO });
|
|
136
135
|
}
|
package/package.json
CHANGED
package/skills/pb-build/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: pb-build
|
|
|
3
3
|
description: The default engine — read the next planned step from intent, implement it (its done-when, seam, Decisions, Constraints), then verify it through to the approval pause. Swappable — build by hand/vibed/another harness and run /pb-verify instead. `--auto` self-approves and chains to done; a step range like `1-3` self-approves through step 3, then pauses.
|
|
4
4
|
argument-hint: "[step-number | step-range] [--auto]"
|
|
5
5
|
disable-model-invocation: true
|
|
6
|
-
allowed-tools: Read, Edit, Write, Bash(plumbbob status:*), Bash(plumbbob build:*), Bash(plumbbob handoff:*), Bash(plumbbob check:*), Bash(plumbbob checkpoint:*), Bash(plumbbob park:*), Bash(plumbbob agent:*), Bash(git diff:*)
|
|
6
|
+
allowed-tools: Read, Edit, Write, Bash(plumbbob status:*), Bash(plumbbob build:*), Bash(plumbbob handoff:*), Bash(plumbbob check:*), Bash(plumbbob checkpoint:*), Bash(plumbbob park:*), Bash(plumbbob agent:*), Bash(plumbbob spike:*), Bash(git diff:*)
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# PlumbBob — build a step (the default engine)
|
|
@@ -36,6 +36,13 @@ differs from the model you're running as, say so before implementing — the hum
|
|
|
36
36
|
2. **Enter the step.** Run `plumbbob build <n>` — or bare `plumbbob build` to enter the
|
|
37
37
|
next undone step (records the in-flight STEP + SEAM so `/pb-status` shows the step in
|
|
38
38
|
flight; the seam is awareness, not a lock).
|
|
39
|
+
- **Spike-as-step.** If the step's title opens with `spike:` / `Spike:`, the increment
|
|
40
|
+
*is* the experiment — resolving a fork the plan couldn't settle on paper. After
|
|
41
|
+
entering it, run `plumbbob spike report "<slug>"` (the CLI scaffolds a
|
|
42
|
+
`spike-NN-<slug>.md` in the build folder, stamped `via: step <n>`), then work the
|
|
43
|
+
experiment and record your **Findings** and **Verdict** there. A recorded verdict is
|
|
44
|
+
what the step's done-when should check — the report, not just the code, is the
|
|
45
|
+
deliverable. This is the same artifact `/pb-spike` produces for a mid-build fork (D70).
|
|
39
46
|
3. **Read the plan.** Read the step's **done-when**, its **seam**, and the
|
|
40
47
|
**Decisions** and **Constraints** in `intent.md`. Build to *that* — the deciding
|
|
41
48
|
already happened, off the chat.
|
package/skills/pb-spike/SKILL.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pb-spike
|
|
3
|
-
description: Human-triggered driver for `plumbbob spike` — open a throwaway worktree experiment for a genuine fork, or tear it down with `spike done`.
|
|
4
|
-
argument-hint: "<slug> | done"
|
|
3
|
+
description: Human-triggered driver for `plumbbob spike` — open a throwaway worktree experiment for a genuine fork, scaffold a spike report for a spike-as-step, or tear it down with `spike done`.
|
|
4
|
+
argument-hint: "<slug> | report <slug> | done"
|
|
5
5
|
disable-model-invocation: true
|
|
6
6
|
model: haiku
|
|
7
7
|
allowed-tools: Bash(plumbbob status:*), Bash(plumbbob spike:*)
|
|
@@ -15,6 +15,15 @@ This is a **driver skill** — a chat-side trigger for the mechanical `plumbbob
|
|
|
15
15
|
|
|
16
16
|
## What it does
|
|
17
17
|
|
|
18
|
-
1. Read the spike target from the way you were invoked: a slug to open one (e.g. `/pb-spike redis-cache`), or the literal `done` to tear the current spike down (`/pb-spike done`). If
|
|
19
|
-
2. Run `plumbbob spike "<slug>"` or `plumbbob spike done` via Bash.
|
|
20
|
-
3. Report the verb's output verbatim — the worktree it created or removed, or any refusal.
|
|
18
|
+
1. Read the spike target from the way you were invoked: a slug to open one (e.g. `/pb-spike redis-cache`), `report <slug>` to scaffold a report without worktrees (`/pb-spike report auth-store`), or the literal `done` to tear the current spike down (`/pb-spike done`). If none is present, ask which and run nothing.
|
|
19
|
+
2. Run `plumbbob spike "<slug>"`, `plumbbob spike report "<slug>"`, or `plumbbob spike done` via Bash.
|
|
20
|
+
3. Report the verb's output verbatim — the worktree it created or removed, the spike report it scaffolded, or any refusal. When the verb names a `spike-NN-<slug>.md` report, point the human at it; when `spike done` nudges that a verdict is unrecorded, relay that nudge verbatim.
|
|
21
|
+
|
|
22
|
+
## The spike report (D70)
|
|
23
|
+
|
|
24
|
+
Every spike leaves a durable `spike-NN-<slug>.md` in the build folder, beside `intent.md`/`report.md`, so the fork's verdict rides the branch into the PR instead of evaporating. The CLI scaffolds it from a template and numbers it — you never create or number the file:
|
|
25
|
+
|
|
26
|
+
- **`/pb-spike <slug>`** scaffolds the report *at open*, so findings accrue while the throwaway worktrees are still live. Fill its **Findings** and **Verdict** before `/pb-spike done`.
|
|
27
|
+
- **`/pb-spike report <slug>`** is for a *spike-as-step* — a planned step titled `spike: …`, where the increment itself is the experiment and there are no worktrees. It stamps the report's provenance as `step <n>` when a step is in flight.
|
|
28
|
+
|
|
29
|
+
This skill stays Write-less: the CLI owns the file. Your job is to run the verb and, between runs, help the human fill the report's prose — but the edits land through the normal build flow, not this driver.
|
package/templates/build-log.md
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
build-log.md — your live ledger for execution. Append constantly; reorganize at
|
|
3
3
|
step boundaries. The antidote to "my plan got lost in the noise."
|
|
4
4
|
|
|
5
|
-
Steps : where you are. One step in flight at a time.
|
|
5
|
+
Steps : where you are. One step in flight at a time. CLI-maintained: `build`,
|
|
6
|
+
`checkpoint`, and `revert` keep this mirror and the Current step line
|
|
7
|
+
in sync with intent.md — you never hand-edit them.
|
|
6
8
|
Park list : where ideas go so you do not chase them. CAPTURE, never act inline.
|
|
7
9
|
Harvest : the boundary ritual that keeps you on one branch.
|
|
8
10
|
Log : the build's history. `plumbbob checkpoint` appends a line per step as it
|
|
@@ -16,9 +18,10 @@ step boundaries. The antidote to "my plan got lost in the noise."
|
|
|
16
18
|
|
|
17
19
|
## Steps
|
|
18
20
|
|
|
19
|
-
*(Mirror of intent.md's Steps, with live status
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
*(Mirror of intent.md's Steps, with live status — CLI-maintained, not hand-edited.
|
|
22
|
+
`build`/`checkpoint`/`revert` re-render this from intent.md, and set the Current step
|
|
23
|
+
line above. Only ONE step is in flight; a step is done only after a checkpoint —
|
|
24
|
+
check green + checkpoint taken, via `/pb-verify` or `/pb-build`.)*
|
|
22
25
|
|
|
23
26
|
- ☐ 1. <step>
|
|
24
27
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
spike-report.md — the durable receipt for a spike (a fork the plan couldn't settle
|
|
3
|
+
on paper). One per spike, numbered and named `spike-NN-<slug>.md`, riding the build
|
|
4
|
+
folder into the PR beside intent.md / report.md. Fill it while the experiment is live
|
|
5
|
+
— the worktrees and their learnings are torn down at `spike done`, but this stays.
|
|
6
|
+
|
|
7
|
+
Two ways a spike is born, both landing here:
|
|
8
|
+
- `/pb-spike <slug>` — an explicit mid-build fork with throwaway worktrees.
|
|
9
|
+
- a planned step titled `spike: …` — the increment IS the experiment.
|
|
10
|
+
Record the Verdict before you close the spike (or check off the step).
|
|
11
|
+
-->
|
|
12
|
+
|
|
13
|
+
# Spike — {{TITLE}}
|
|
14
|
+
|
|
15
|
+
**Via:** {{VIA}}
|
|
16
|
+
**Opened:** {{DATE}}
|
|
17
|
+
|
|
18
|
+
## Question
|
|
19
|
+
|
|
20
|
+
*(The fork this resolves, in one or two lines. What are we uncertain about, and what
|
|
21
|
+
would each answer commit us to?)*
|
|
22
|
+
|
|
23
|
+
## Options tried
|
|
24
|
+
|
|
25
|
+
*(Each path you actually ran, and what it took — one bullet each.)*
|
|
26
|
+
|
|
27
|
+
## Findings
|
|
28
|
+
|
|
29
|
+
*(What the experiment showed — evidence, not opinion. Numbers, errors, surprises.)*
|
|
30
|
+
|
|
31
|
+
## Verdict
|
|
32
|
+
|
|
33
|
+
**Verdict:** *(viable | not viable | partial — replace this line with the call and why)*
|
|
34
|
+
|
|
35
|
+
## What this decides
|
|
36
|
+
|
|
37
|
+
*(The intent.md Decision this feeds — which option won, what dies, and the one reason
|
|
38
|
+
that settled it. Copy the call into intent.md's Decisions / Verdicts too.)*
|