@stdd/plugin 0.9.0
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 +9 -0
- package/.codex-plugin/plugin.json +21 -0
- package/LICENSE +21 -0
- package/README.md +47 -0
- package/extensions/stdd.mjs +77 -0
- package/hooks/claude-hooks.json +28 -0
- package/hooks/codex-hooks.json +28 -0
- package/package.json +38 -0
- package/runtime/adapters/README.md +158 -0
- package/runtime/cli/check.mjs +555 -0
- package/runtime/cli/ci.mjs +190 -0
- package/runtime/cli/claude-hooks.mjs +689 -0
- package/runtime/cli/config.mjs +27 -0
- package/runtime/cli/evidence.mjs +249 -0
- package/runtime/cli/generated-files.mjs +1693 -0
- package/runtime/cli/held-fs.mjs +415 -0
- package/runtime/cli/init.mjs +883 -0
- package/runtime/cli/ledger.mjs +1470 -0
- package/runtime/cli/lib.mjs +909 -0
- package/runtime/cli/path-bytes.mjs +83 -0
- package/runtime/cli/policy.mjs +112 -0
- package/runtime/cli/recorders.mjs +188 -0
- package/runtime/cli/review-fs.mjs +825 -0
- package/runtime/cli/review.mjs +1065 -0
- package/runtime/cli/runtime.mjs +32 -0
- package/runtime/cli/scope.mjs +185 -0
- package/runtime/cli/snapshot.mjs +897 -0
- package/runtime/cli/state-validation.mjs +168 -0
- package/runtime/cli/status.mjs +580 -0
- package/runtime/cli/stdd.mjs +536 -0
- package/runtime/cli/worker-fs.mjs +971 -0
- package/runtime/cli/worker-metadata.mjs +139 -0
- package/runtime/cli/worker.mjs +779 -0
- package/runtime/method/README.md +634 -0
- package/runtime/method/reference-commands.md +147 -0
- package/runtime/method/reference-generated-state.md +151 -0
- package/runtime/method/reference-integration.md +233 -0
- package/runtime/package.json +65 -0
- package/runtime/playbooks/brainstorming.md +46 -0
- package/runtime/playbooks/debugging.md +36 -0
- package/runtime/playbooks/delegate-slice.md +129 -0
- package/runtime/playbooks/finish-change.md +46 -0
- package/runtime/playbooks/implement.md +26 -0
- package/runtime/playbooks/investigation.md +33 -0
- package/runtime/playbooks/managed-playbooks.json +14 -0
- package/runtime/playbooks/planning.md +177 -0
- package/runtime/playbooks/pr-green.md +50 -0
- package/runtime/playbooks/start-change.md +37 -0
- package/runtime/playbooks/worktrees.md +45 -0
- package/runtime/prebuilds/stdd-fs/darwin-arm64/stdd-fs +0 -0
- package/runtime/prebuilds/stdd-fs/darwin-x64/stdd-fs +0 -0
- package/runtime/prebuilds/stdd-fs/linux-arm64/stdd-fs +0 -0
- package/runtime/prebuilds/stdd-fs/linux-x64/stdd-fs +0 -0
- package/runtime/prebuilds/stdd-fs/manifest.json +47 -0
- package/runtime/prebuilds/stdd-fs/win32-arm64/stdd-fs.exe +0 -0
- package/runtime/prebuilds/stdd-fs/win32-x64/stdd-fs.exe +0 -0
- package/runtime/sdk/adapters.mjs +279 -0
- package/runtime/sdk/file-observation.mjs +12 -0
- package/runtime/sdk/index.d.ts +140 -0
- package/runtime/sdk/index.mjs +31 -0
- package/runtime/sdk/native-fs.mjs +1235 -0
- package/runtime/sdk/path.mjs +71 -0
- package/runtime/sdk/text.mjs +42 -0
- package/runtime/sdk/workflow.mjs +294 -0
- package/runtime/templates/deferred-design.md +47 -0
- package/runtime/templates/github-stdd.yml +42 -0
- package/runtime/templates/gitlab-stdd.yml +72 -0
- package/runtime/templates/pr-description.md +35 -0
- package/scripts/adopting-root.mjs +42 -0
- package/scripts/stdd-hook.mjs +72 -0
- package/skills/stdd-brainstorming/SKILL.md +48 -0
- package/skills/stdd-debugging/SKILL.md +38 -0
- package/skills/stdd-delegate-slice/SKILL.md +118 -0
- package/skills/stdd-finish-change/SKILL.md +40 -0
- package/skills/stdd-implement/SKILL.md +28 -0
- package/skills/stdd-investigation/SKILL.md +35 -0
- package/skills/stdd-planning/SKILL.md +165 -0
- package/skills/stdd-pr-green/SKILL.md +52 -0
- package/skills/stdd-start-change/SKILL.md +39 -0
- package/skills/stdd-worktrees/SKILL.md +46 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { resolveAdoptingRoot } from "./adopting-root.mjs";
|
|
7
|
+
|
|
8
|
+
const PLUGIN_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
9
|
+
const SESSION_RUNTIME_FAILURE =
|
|
10
|
+
"stdd plugin: bundled runtime failed — update the STDD plugin or re-run `stdd init`\n";
|
|
11
|
+
|
|
12
|
+
const mode = process.argv[2];
|
|
13
|
+
if (mode !== "session" && mode !== "stop" && mode !== "stop-claude") process.exit(0);
|
|
14
|
+
|
|
15
|
+
let stopOutput = null;
|
|
16
|
+
let exitCode = 0;
|
|
17
|
+
try {
|
|
18
|
+
const root = resolveAdoptingRoot(process.cwd());
|
|
19
|
+
const cli = path.join(PLUGIN_ROOT, "runtime", "cli", "stdd.mjs");
|
|
20
|
+
if (root && fs.existsSync(cli)) {
|
|
21
|
+
const input = mode === "session" ? undefined : fs.readFileSync(0);
|
|
22
|
+
const args =
|
|
23
|
+
mode === "session"
|
|
24
|
+
? ["status", "--local"]
|
|
25
|
+
: ["stop-hook", "--agent", mode === "stop" ? "codex" : "claude"];
|
|
26
|
+
const run = spawnSync(process.execPath, [cli, ...args], {
|
|
27
|
+
cwd: root,
|
|
28
|
+
encoding: "utf8",
|
|
29
|
+
input,
|
|
30
|
+
timeout: 9000,
|
|
31
|
+
});
|
|
32
|
+
if (!run.error && run.status === 0) {
|
|
33
|
+
if (mode === "session") {
|
|
34
|
+
if (run.stdout) process.stdout.write(run.stdout);
|
|
35
|
+
if (run.stderr) process.stderr.write(run.stderr);
|
|
36
|
+
} else if (mode === "stop") {
|
|
37
|
+
const text = run.stdout.trim();
|
|
38
|
+
if (text !== "") {
|
|
39
|
+
try {
|
|
40
|
+
const parsed = JSON.parse(text);
|
|
41
|
+
const object = typeof parsed === "object" && parsed !== null && !Array.isArray(parsed);
|
|
42
|
+
const keys = object ? Object.keys(parsed) : [];
|
|
43
|
+
const valid =
|
|
44
|
+
object &&
|
|
45
|
+
(keys.length === 0 ||
|
|
46
|
+
(keys.length === 2 &&
|
|
47
|
+
keys.includes("decision") &&
|
|
48
|
+
keys.includes("reason") &&
|
|
49
|
+
parsed.decision === "block" &&
|
|
50
|
+
typeof parsed.reason === "string" &&
|
|
51
|
+
parsed.reason.trim().length > 0));
|
|
52
|
+
if (valid) stopOutput = JSON.stringify(parsed);
|
|
53
|
+
} catch {
|
|
54
|
+
// Malformed child output is an internal failure: allow Stop.
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
} else if (mode === "session") {
|
|
59
|
+
process.stderr.write(SESSION_RUNTIME_FAILURE);
|
|
60
|
+
} else if (mode === "stop-claude" && !run.error && run.status === 2 && run.stderr.trim() !== "") {
|
|
61
|
+
process.stderr.write(run.stderr);
|
|
62
|
+
exitCode = 2;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
} catch {
|
|
66
|
+
// A lifecycle integration must never trap or abort the host agent.
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Lifecycle helpers fail open. Codex Stop always receives valid JSON:
|
|
70
|
+
// a verified block object, or {} to allow the turn to end.
|
|
71
|
+
if (mode === "stop") console.log(stopOutput ?? "{}");
|
|
72
|
+
process.exit(exitCode);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stdd-brainstorming
|
|
3
|
+
description: "Shape a fuzzy idea into an agreed behavior contract before any plan or code. Use when: A non-trivial change is requested and the requirements, scope, or approach are not yet pinned down."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- generated by stdd plugin build v0.9.0 — do not edit -->
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# Brainstorming
|
|
10
|
+
|
|
11
|
+
The goal is agreement on **what** and **why** before anyone invests in **how**.
|
|
12
|
+
The output is not a document — it is a shared understanding that becomes a
|
|
13
|
+
docs edit and a PR description.
|
|
14
|
+
|
|
15
|
+
## Process
|
|
16
|
+
|
|
17
|
+
1. **Understand the current state first.** Read the relevant docs and the code
|
|
18
|
+
the change will touch. Questions asked from ignorance waste the other
|
|
19
|
+
side's time; questions asked from knowledge sharpen the idea.
|
|
20
|
+
2. **Ask one question at a time.** Prefer questions that eliminate whole
|
|
21
|
+
branches of the design space: who is it for, what triggers it, what must
|
|
22
|
+
never happen, what is explicitly out of scope. When the answer space is
|
|
23
|
+
enumerable, offer it as a closed choice with your recommendation first —
|
|
24
|
+
a closed question costs the other side seconds, an open one minutes.
|
|
25
|
+
Keep open questions for genuinely open design space.
|
|
26
|
+
3. **Challenge scope creep in both directions.** If the idea is bigger than
|
|
27
|
+
the need, say so and propose the smaller version. If the stated need hides
|
|
28
|
+
a larger real problem, surface it.
|
|
29
|
+
4. **Propose 2–3 approaches with a recommendation.** For each: one paragraph,
|
|
30
|
+
the trade-off that actually matters, and what it costs later. Recommend
|
|
31
|
+
one; do not present a menu without an opinion.
|
|
32
|
+
5. **Converge on the behavior contract.** State the agreed behavior as rules
|
|
33
|
+
precise enough to test. Confirm them explicitly.
|
|
34
|
+
|
|
35
|
+
## Output
|
|
36
|
+
|
|
37
|
+
- The agreed rules become the **docs edit** (the spec) — the first commit of
|
|
38
|
+
the branch.
|
|
39
|
+
- The rationale, rejected alternatives, and scope decisions go into the
|
|
40
|
+
**PR description** when the branch opens.
|
|
41
|
+
- Nothing from this conversation is committed as a standalone file.
|
|
42
|
+
|
|
43
|
+
## Anti-patterns
|
|
44
|
+
|
|
45
|
+
- Jumping to implementation detail while behavior is still unsettled.
|
|
46
|
+
- Asking multiple stacked questions at once.
|
|
47
|
+
- Writing a "spec document" instead of editing the real docs.
|
|
48
|
+
- Agreeing silently: if you disagree with the direction, say so with reasons.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stdd-debugging
|
|
3
|
+
description: "Find and fix the root cause of a defect, not its symptom. Use when: A bug, crash, failing test, or unexplained behavior is reported."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- generated by stdd plugin build v0.9.0 — do not edit -->
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# Debugging
|
|
10
|
+
|
|
11
|
+
The discipline: no edit before a reproduction, no fix before a diagnosis.
|
|
12
|
+
|
|
13
|
+
## Process
|
|
14
|
+
|
|
15
|
+
1. **Reproduce first.** Turn the report into a deterministic reproduction —
|
|
16
|
+
ideally a failing test. If you cannot reproduce it, you are not debugging
|
|
17
|
+
yet; you are gathering facts.
|
|
18
|
+
2. **Read the actual error.** The full message, the stack, the logs around
|
|
19
|
+
it. Do not pattern-match a familiar-looking symptom to a known failure —
|
|
20
|
+
verify the evidence supports *this* cause.
|
|
21
|
+
3. **Form one hypothesis and test it cheaply.** Predict what you will observe
|
|
22
|
+
if the hypothesis is true, then look. One hypothesis at a time; a change
|
|
23
|
+
made under two hypotheses proves neither.
|
|
24
|
+
4. **Fix the root cause minimally.** The smallest change that removes the
|
|
25
|
+
cause. Resist drive-by cleanup — it obscures the fix in review.
|
|
26
|
+
5. **Keep the reproduction as a regression test.** Red before the fix, green
|
|
27
|
+
after, committed with it.
|
|
28
|
+
6. **Verify the fix in the original context**, not only in the reduced
|
|
29
|
+
reproduction.
|
|
30
|
+
|
|
31
|
+
## Stop rules
|
|
32
|
+
|
|
33
|
+
- Two failed fix attempts mean the diagnosis is wrong. Stop editing, go back
|
|
34
|
+
to step 2, and widen what you consider suspect — including your own
|
|
35
|
+
earlier changes and the test itself.
|
|
36
|
+
- If the evidence contradicts the reported story, surface the contradiction
|
|
37
|
+
instead of forcing a fix that matches the story.
|
|
38
|
+
- A fix you cannot explain is not a fix. Do not ship it.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stdd-delegate-slice
|
|
3
|
+
description: "Hand a slice of work to a worker session with a declared scope, a ledger handoff, and a reviewed result. Use when: Before implementing a multi-step change whose steps are independent — hand slices to worker sessions (subagent, second CLI, teammate) instead of implementing everything inline; also whenever a worker's result comes back for review."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- generated by stdd plugin build v0.9.0 — do not edit -->
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# Delegate a Slice
|
|
10
|
+
|
|
11
|
+
Roles are fixed. The orchestrator owns the docs edit, the commits, and the
|
|
12
|
+
PR. The worker owns red-green inside a declared scope. The handoff artifact
|
|
13
|
+
is the ledger, not prose — a worker's chat summary does not survive
|
|
14
|
+
compaction, its recorded events do.
|
|
15
|
+
|
|
16
|
+
## Before the worker starts (orchestrator)
|
|
17
|
+
|
|
18
|
+
1. Make the docs decision yourself and record it:
|
|
19
|
+
`stdd docs <decision> [paths…] [--reason <why>]`.
|
|
20
|
+
2. Choose the worker boundary and declare the scope. Prefer a managed gitless
|
|
21
|
+
sandbox when the worker does not need Git authority:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
stdd worker create ../stdd-worker-billing \
|
|
25
|
+
--frozen "docs/**,migrations/**" \
|
|
26
|
+
--allowed "src/billing/**,test/billing/**"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Use `stdd slice new --frozen ... --allowed ...` only when the worker must
|
|
30
|
+
operate in an existing isolated checkout. `--frozen` names globs the worker
|
|
31
|
+
must not touch. `--allowed` names the only paths it may change. At least one
|
|
32
|
+
is required. A managed sandbox contains no `.git`, ignored dependencies,
|
|
33
|
+
credentials, or build output; run the repository's readiness setup there.
|
|
34
|
+
3. Write the brief **to a file** (session scratchpad, never the repo) and
|
|
35
|
+
point the worker at it — pasted context stays resident in your window
|
|
36
|
+
for the rest of the session; a file does not. Template:
|
|
37
|
+
|
|
38
|
+
> **Task**: <one sentence>
|
|
39
|
+
> **Spec**: read <canonical doc paths> — the docs edit is already made.
|
|
40
|
+
> **Scope**: declared by `stdd worker create` or `stdd slice new`; check
|
|
41
|
+
> yours with `stdd scope`.
|
|
42
|
+
> **Loop**: failing test first — record it with `stdd red -- <cmd>`;
|
|
43
|
+
> verify with `stdd verify -- <narrowest command>`.
|
|
44
|
+
> **Do not**: commit, push, or edit docs — the orchestrator owns those.
|
|
45
|
+
> **Policy**: copy the `stdd policy show` notes that govern this area —
|
|
46
|
+
> a worker reads the brief, not the repository's standing decisions.
|
|
47
|
+
> **Questions**: ask them now, before starting — not mid-slice.
|
|
48
|
+
> **Report**: write it to <file>; end with exactly one status:
|
|
49
|
+
> `DONE | DONE_WITH_CONCERNS | BLOCKED | NEEDS_CONTEXT`.
|
|
50
|
+
|
|
51
|
+
4. Name the worker's model explicitly in the dispatch — an omitted model
|
|
52
|
+
silently inherits the orchestrator's tier. Mechanical transcription
|
|
53
|
+
tolerates a cheap tier; judgment does not.
|
|
54
|
+
|
|
55
|
+
## Parallel slices
|
|
56
|
+
|
|
57
|
+
Serial dispatch is the default; parallelism is safe only when every
|
|
58
|
+
precondition holds:
|
|
59
|
+
|
|
60
|
+
- **Independence** — no consumes/produces edge between the steps: neither
|
|
61
|
+
slice uses a name the other produces.
|
|
62
|
+
- **Isolation** — each worker runs in its own managed gitless sandbox or
|
|
63
|
+
worktree (see the worktrees playbook); two workers in one directory race on
|
|
64
|
+
files and test state.
|
|
65
|
+
- **Disjoint scopes** — the slices' `--allowed` globs must not overlap;
|
|
66
|
+
an overlap forces serialization, it is never "probably fine".
|
|
67
|
+
|
|
68
|
+
Dispatch the workers concurrently, then review results as they land —
|
|
69
|
+
never hold finished work hostage to the slowest slice. Integration stays
|
|
70
|
+
serial: merge one slice at a time into the orchestrator's checkout and
|
|
71
|
+
re-run its verification after each merge, so a conflict names the slice
|
|
72
|
+
that caused it.
|
|
73
|
+
|
|
74
|
+
While workers run, the orchestrator works too: review a landed slice,
|
|
75
|
+
prepare the next brief, draft the PR body from the ledger. Waiting idle
|
|
76
|
+
on a single dispatched worker is the delegation anti-pattern — if there
|
|
77
|
+
is truly nothing to do until the worker returns, the slice was too big.
|
|
78
|
+
|
|
79
|
+
## While the worker runs (worker)
|
|
80
|
+
|
|
81
|
+
- Ask blocking questions before the first edit, then run without
|
|
82
|
+
"should I continue?" pauses.
|
|
83
|
+
- Record the red before implementing: `stdd red -- <cmd>` (a genuine test
|
|
84
|
+
failure, not an environment error — the recorder tells you which).
|
|
85
|
+
- Record every meaningful verification: `stdd verify -- <cmd>`.
|
|
86
|
+
- Leave handoff context in the file, not the chat: `stdd note <text>`.
|
|
87
|
+
- End with one status. `BLOCKED` and `NEEDS_CONTEXT` are good outcomes:
|
|
88
|
+
bad work is worse than no work — escalating is never penalized.
|
|
89
|
+
|
|
90
|
+
## After the worker finishes (orchestrator)
|
|
91
|
+
|
|
92
|
+
1. Run `stdd scope` in the worker environment. For a managed sandbox, then run
|
|
93
|
+
`stdd worker collect <directory>` from the source checkout. Collection
|
|
94
|
+
fails before import on scope, identity, source-drift, or path conflicts and
|
|
95
|
+
never stages or commits. It imports worker red/verify/note evidence, but the
|
|
96
|
+
orchestrator still verifies the collected source checkout freshly.
|
|
97
|
+
2. `stdd status` — confirm the loop is complete (docs, genuine red, passing
|
|
98
|
+
verify).
|
|
99
|
+
3. **Review the diff, never the report alone.** The report is a claim, and
|
|
100
|
+
a stated rationale never downgrades a finding. Two verdicts, in order:
|
|
101
|
+
- *Spec compliance*: anything **missing** from the brief, anything
|
|
102
|
+
**extra** beyond it (unrequested work is a finding, not a bonus),
|
|
103
|
+
anything **misunderstood**.
|
|
104
|
+
- *Code quality* on what was built.
|
|
105
|
+
|
|
106
|
+
With subagents available, dispatch a fresh reviewer that sees the brief,
|
|
107
|
+
the diff, and the report — never your session history — and reviews
|
|
108
|
+
read-only.
|
|
109
|
+
|
|
110
|
+
Route the verdict through `stdd review` so it lands in the ledger
|
|
111
|
+
instead of evaporating with the chat.
|
|
112
|
+
|
|
113
|
+
4. A `BLOCKED` or `NEEDS_CONTEXT` slice is not retried unchanged: add
|
|
114
|
+
context, split the slice, or take it inline.
|
|
115
|
+
5. Assemble the PR body from the ledger, not from the worker's summary:
|
|
116
|
+
`stdd evidence` drafts the docs line from the recorded decision and the
|
|
117
|
+
diff. STDD never removes a managed sandbox automatically; delete it
|
|
118
|
+
explicitly only after reviewing the collected result.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stdd-finish-change
|
|
3
|
+
description: "Close an implemented change with independent review, PR evidence, terminal CI, and runtime verification when required. Use when: Implementation is locally verified and the change is ready for review, delivery, or handoff."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- generated by stdd plugin build v0.9.0 — do not edit -->
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# Finish change
|
|
10
|
+
|
|
11
|
+
Close the current checkout in this order:
|
|
12
|
+
|
|
13
|
+
1. Run the complete affected local verification.
|
|
14
|
+
2. Finish every plan item and run the independent closing review when the
|
|
15
|
+
capability profile supports it.
|
|
16
|
+
`stdd review --via subagent` prints the brief path for a fresh read-only
|
|
17
|
+
subagent; feed its JSON back with `stdd review --result <file>`.
|
|
18
|
+
3. Generate the PR evidence with `stdd evidence`; never hand-author a claim
|
|
19
|
+
contradicted by the diff.
|
|
20
|
+
4. Open or update the PR/MR and wait for terminal checks. On GitHub use
|
|
21
|
+
`stdd ci --watch`; on another forge use its adapter's equivalent.
|
|
22
|
+
5. If the change includes a deploy, migration, package publish, or other
|
|
23
|
+
runtime effect, verify that surface separately. Green CI is not runtime
|
|
24
|
+
proof.
|
|
25
|
+
6. Run `stdd task finish` only after the requested delivery boundary is
|
|
26
|
+
actually complete.
|
|
27
|
+
|
|
28
|
+
An `approved` verdict freezes the checkout. Anything you notice afterwards —
|
|
29
|
+
a stale comment, a better name, one more edge case — is deferred with
|
|
30
|
+
`stdd defer`, not edited in. Editing discards the approval rather than
|
|
31
|
+
improving on it, and buys a round that found nothing. Past the review
|
|
32
|
+
budget, `--force` needs `--reason <text>`: write what the extra round is
|
|
33
|
+
expected to settle, not that the reviewer asked again.
|
|
34
|
+
|
|
35
|
+
Do not merge, deploy, publish, or mutate an external system unless the user
|
|
36
|
+
has authorized that action. A permission that `stdd policy show` reports is
|
|
37
|
+
that authorization, but only once this session has verified the entry's
|
|
38
|
+
condition and said what it verified; an unverifiable condition leaves the rule
|
|
39
|
+
exactly as it stands. An entry the command lists as ignored grants nothing.
|
|
40
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stdd-implement
|
|
3
|
+
description: "Execute one agreed behavior slice through docs, genuine red, implementation, and fresh verification. Use when: The behavior contract is agreed and production changes are ready to begin."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- generated by stdd plugin build v0.9.0 — do not edit -->
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# Implement
|
|
10
|
+
|
|
11
|
+
Run one narrow vertical slice at a time:
|
|
12
|
+
|
|
13
|
+
1. Record the docs decision with `stdd docs`. For changed behavior, edit the
|
|
14
|
+
canonical docs first and record `updated-first`.
|
|
15
|
+
2. Add the smallest test that proves the agreed behavior. Run it through
|
|
16
|
+
`stdd red -- <command>` and confirm the failure is genuine.
|
|
17
|
+
3. Implement only enough production code to satisfy that contract.
|
|
18
|
+
4. Run the focused and affected verification through
|
|
19
|
+
`stdd verify -- <command>`.
|
|
20
|
+
5. Check `stdd status --local`; a later checkout change makes verification
|
|
21
|
+
stale and requires another verify.
|
|
22
|
+
|
|
23
|
+
Frontend visual composition follows the method's design-first exception.
|
|
24
|
+
Behavior embedded in the UI still follows the loop.
|
|
25
|
+
|
|
26
|
+
Do not batch unrelated rules behind one red. If the plan has multiple items,
|
|
27
|
+
update its checkboxes only after their named evidence exists.
|
|
28
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stdd-investigation
|
|
3
|
+
description: "Read-only diagnosis — evidence-backed findings, no changes. Use when: Asked to diagnose, triage, or explain behavior WITHOUT changing anything."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- generated by stdd plugin build v0.9.0 — do not edit -->
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# Investigation
|
|
10
|
+
|
|
11
|
+
The discipline: the deliverable is an evidence-backed diagnosis and an
|
|
12
|
+
explicit list of blockers — never an edit. For the fix that may follow,
|
|
13
|
+
switch to the debugging playbook; this one deliberately does not restate
|
|
14
|
+
it.
|
|
15
|
+
|
|
16
|
+
## Contract
|
|
17
|
+
|
|
18
|
+
- No file edits, no state-changing side effects — reads only.
|
|
19
|
+
- Every claim in the report is backed by evidence you actually observed,
|
|
20
|
+
or labeled as unverified with the blocker named.
|
|
21
|
+
|
|
22
|
+
## Process
|
|
23
|
+
|
|
24
|
+
1. **Inventory the evidence channels first.** Before forming any theory,
|
|
25
|
+
check what you can actually observe: forge CLI auth, container / DB /
|
|
26
|
+
log access, environment-key **presence** (never values). Report dead
|
|
27
|
+
channels as blockers immediately — do not silently work around a
|
|
28
|
+
channel you could not reach.
|
|
29
|
+
2. **A hypothesis is not a diagnosis.** Test it against runtime signals —
|
|
30
|
+
logs, states, reproductions — before reporting it as a finding. What
|
|
31
|
+
you could not test, report as an explicitly unverified hypothesis with
|
|
32
|
+
the blocker that prevented the test.
|
|
33
|
+
3. **Deliver the report**: the diagnosis (or ranked hypotheses) with its
|
|
34
|
+
evidence, the blockers, and the narrowest next step a fixing session
|
|
35
|
+
should take.
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stdd-planning
|
|
3
|
+
description: "Turn an agreed behavior contract into an executable, verifiable sequence of work. Use when: The behavior contract is agreed (docs edit drafted or committed) and the change is large enough to need ordered steps — before the first implementation edit, to fix the execution mode and delivery boundary."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- generated by stdd plugin build v0.9.0 — do not edit -->
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# Planning
|
|
10
|
+
|
|
11
|
+
A plan is a disposable working artifact: it guides one execution and is thrown
|
|
12
|
+
away. It is never committed as a file — its home is the PR description (for
|
|
13
|
+
the durable summary) and `.stdd/plan.md` (for the working copy: per checkout,
|
|
14
|
+
gitignored, read by `stdd status`, survives compaction).
|
|
15
|
+
|
|
16
|
+
Write the plan for an executor with zero context and questionable taste:
|
|
17
|
+
exact file paths, exact names, exact commands. The planning session's
|
|
18
|
+
memory does not survive delegation or compaction — whatever the plan does
|
|
19
|
+
not say, the executor does not know.
|
|
20
|
+
|
|
21
|
+
## Structure
|
|
22
|
+
|
|
23
|
+
A good plan has, in order:
|
|
24
|
+
|
|
25
|
+
1. **Intent** — one paragraph: the problem and the agreed direction.
|
|
26
|
+
2. **Docs delta** — which permanent docs change and how (added / modified /
|
|
27
|
+
removed rules, named per target file). This is the spec surface of the
|
|
28
|
+
plan; keep it exact so the docs edit is mechanical.
|
|
29
|
+
3. **Global constraints** — the agreement's project-wide requirements
|
|
30
|
+
(version floors, naming and copy rules, platform limits), one line
|
|
31
|
+
each, exact values verbatim. Every step implicitly includes this
|
|
32
|
+
section; a delegated worker gets it copied into the brief.
|
|
33
|
+
4. **Steps** — each step small enough to verify independently, written as
|
|
34
|
+
checkboxes (`- [ ]`) so `stdd status` can report progress and the next
|
|
35
|
+
open item. Per step:
|
|
36
|
+
- what changes (files, functions);
|
|
37
|
+
- the failing test that gates it (or the visual check, for frontend
|
|
38
|
+
visual work — see the design-first exception in the method);
|
|
39
|
+
- the verification command;
|
|
40
|
+
- for a step that may be delegated: its interfaces — **consumes**
|
|
41
|
+
(exact signatures it uses from earlier steps) and **produces**
|
|
42
|
+
(exact names and types later steps rely on). A worker sees only its
|
|
43
|
+
own slice; this block is how a neighbor's names reach it.
|
|
44
|
+
|
|
45
|
+
Tag a step whose gate is a failing test with `[red: <substring of the
|
|
46
|
+
test command>]` — it then closes only when a matching genuine red is
|
|
47
|
+
recorded via `stdd red`, not when the box is ticked.
|
|
48
|
+
|
|
49
|
+
The last step of a multi-step plan is always the independent review
|
|
50
|
+
(see "The closing review"). Write it into the plan at planning time —
|
|
51
|
+
the plan must carry the trigger, not the session's memory.
|
|
52
|
+
Tag it `[review:]`: like `[red:]`, the tag closes only through the
|
|
53
|
+
ledger (an approved verdict recorded by `stdd review`), never by
|
|
54
|
+
ticking the box.
|
|
55
|
+
5. **Out of scope** — what this change deliberately does not do.
|
|
56
|
+
6. **Risks** — what could invalidate the plan and how you would notice.
|
|
57
|
+
|
|
58
|
+
## Plan failures
|
|
59
|
+
|
|
60
|
+
These patterns void a step — rewrite it before presenting the plan:
|
|
61
|
+
|
|
62
|
+
- "TBD", "TODO", "fill in later", "details during implementation".
|
|
63
|
+
- "Add appropriate error handling" / "handle edge cases" — name the cases.
|
|
64
|
+
- "Write tests for the above" without naming the test and its assertion.
|
|
65
|
+
- "Similar to step N" — repeat the exact names; steps are read in
|
|
66
|
+
isolation.
|
|
67
|
+
- A check that names no runnable command — the visual-check exception
|
|
68
|
+
still names the command that brings the surface up.
|
|
69
|
+
- A reference to a type, function, or file that neither the repository
|
|
70
|
+
nor any step defines.
|
|
71
|
+
|
|
72
|
+
## Self-review before presenting
|
|
73
|
+
|
|
74
|
+
Re-read the docs delta with fresh eyes and check the plan against it:
|
|
75
|
+
|
|
76
|
+
1. **Coverage** — every agreed rule maps to a step; list any gap.
|
|
77
|
+
2. **Plan-failure scan** — search the plan for the patterns above.
|
|
78
|
+
3. **Name consistency** — signatures and names used by later steps match
|
|
79
|
+
where earlier steps define them.
|
|
80
|
+
|
|
81
|
+
Fix findings inline and present once — a plan that survives this check
|
|
82
|
+
gets approved in one round instead of three.
|
|
83
|
+
|
|
84
|
+
## Rules
|
|
85
|
+
|
|
86
|
+
- Order steps so the system stays green between them.
|
|
87
|
+
- Write verification per step, not one "run all tests" at the end.
|
|
88
|
+
- A step that cannot fail its check is not a step — merge it into another.
|
|
89
|
+
- When execution contradicts the plan, update the plan, do not force the
|
|
90
|
+
plan onto reality. If the *intent* changed, stop and re-enter
|
|
91
|
+
brainstorming.
|
|
92
|
+
- Keep the durable parts flowing to their homes as you go: rules → docs
|
|
93
|
+
edit, rationale → PR description. The plan itself must stay deletable at
|
|
94
|
+
any moment without information loss.
|
|
95
|
+
- Surface plan-invalidating discoveries as one batched question, not one
|
|
96
|
+
interrupt per finding.
|
|
97
|
+
- Cut scope explicitly: `stdd defer <text>` appends the cut to the plan's
|
|
98
|
+
`## Deferred` section. Deferred work is carried into the PR
|
|
99
|
+
description's out-of-scope, never silently dropped.
|
|
100
|
+
|
|
101
|
+
## Executing
|
|
102
|
+
|
|
103
|
+
Close planning with an explicit execution choice. When `stdd policy show`
|
|
104
|
+
reports an execution-mode default, adopt it and state the choice instead of
|
|
105
|
+
asking — the question exists to settle the mode, not to be asked twice.
|
|
106
|
+
Otherwise ask it as a closed question to the user, your recommendation
|
|
107
|
+
first. Template (recommend **inline** for
|
|
108
|
+
tightly coupled steps, **delegated** for independent ones; lead with
|
|
109
|
+
whichever you recommend):
|
|
110
|
+
|
|
111
|
+
> Plan ready (N steps). How should it run?
|
|
112
|
+
> 1. **Inline (recommended)** — this session implements the steps itself.
|
|
113
|
+
> 2. **Delegated** — independent steps go to workers via delegate-slice;
|
|
114
|
+
> this session orchestrates and reviews.
|
|
115
|
+
|
|
116
|
+
The modes differ only in who types: the loop and its recording stay
|
|
117
|
+
identical. Delegation is a context optimization, never a requirement —
|
|
118
|
+
it preserves the orchestrating session's window for coordination instead
|
|
119
|
+
of burning it on implementation detail.
|
|
120
|
+
Steps with no consumes/produces edge between them are candidates for
|
|
121
|
+
parallel delegation — see "Parallel slices" in delegate-slice for the
|
|
122
|
+
preconditions.
|
|
123
|
+
|
|
124
|
+
Record the answer as a `Mode: inline|delegated` line at the top of the
|
|
125
|
+
plan working copy — the plan carries the mode, not the session's memory,
|
|
126
|
+
so the choice survives compaction.
|
|
127
|
+
|
|
128
|
+
## The closing review
|
|
129
|
+
|
|
130
|
+
Every multi-step plan ends the same way, inline or delegated: an
|
|
131
|
+
independent review of the cumulative diff, before the evidence line and
|
|
132
|
+
the PR. Independence means a fresh context — the reviewer sees the
|
|
133
|
+
plan's intent, the docs delta, and the diff, never the implementing
|
|
134
|
+
session's history. A self-review by the session that wrote the code is
|
|
135
|
+
not independent: rationales in its own summary are the implementer
|
|
136
|
+
grading their own work. Two verdicts, in order: spec compliance against
|
|
137
|
+
the plan (missing / extra / misunderstood), then code quality on what
|
|
138
|
+
was built.
|
|
139
|
+
Use one of the route-specific commands below. Each invocation builds the brief
|
|
140
|
+
(plan + diff + governing docs + the method's quality rubric + output
|
|
141
|
+
contract), records the request, derives the verdict from the findings, and
|
|
142
|
+
closes the `[review:]` item on approval. After `changes-requested`, fix the
|
|
143
|
+
findings and repeat the same route-specific command; the newest verdict
|
|
144
|
+
controls the item.
|
|
145
|
+
`stdd review --via subagent` prints the brief path: hand it to a fresh
|
|
146
|
+
read-only subagent, then feed its JSON back through
|
|
147
|
+
`stdd review --result <file>`.
|
|
148
|
+
|
|
149
|
+
## The final report
|
|
150
|
+
|
|
151
|
+
When the plan is exhausted, report to the user —
|
|
152
|
+
in their language, for a human deciding what happens next, not as a
|
|
153
|
+
second copy of the ledger:
|
|
154
|
+
|
|
155
|
+
1. **Outcome first** — one or two sentences: what shipped and what
|
|
156
|
+
proves it (tests and gate).
|
|
157
|
+
Include the independent review verdict in that proof.
|
|
158
|
+
2. **Deviations from the plan** — deferred cuts, extra work, decisions
|
|
159
|
+
changed mid-flight. If there are none, say so in one line.
|
|
160
|
+
3. **The technical trail last** — commands, file:line references,
|
|
161
|
+
round counts, for the reader who wants them.
|
|
162
|
+
|
|
163
|
+
The machine record (findings JSON, ledger events, evidence line) already
|
|
164
|
+
exists; the report earns its place only by being readable — plain
|
|
165
|
+
sentences over verdict tables, terms spelled out over shorthand.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stdd-pr-green
|
|
3
|
+
description: "A PR is done only when its required checks settle terminal-green on the current head. Use when: A PR/MR exists, or is about to be opened, for the current branch."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- generated by stdd plugin build v0.9.0 — do not edit -->
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# PR Green
|
|
10
|
+
|
|
11
|
+
The discipline: local verification governs the inner loop; the PR's required
|
|
12
|
+
checks govern the definition of done. "CI started" and "pushed" are never
|
|
13
|
+
done.
|
|
14
|
+
|
|
15
|
+
## The one command
|
|
16
|
+
|
|
17
|
+
Do not hand-roll pollers, sleeps, or `gh pr checks` loops:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
stdd ci --watch # current branch's PR; stdd ci <n> --watch for another
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
It resolves the PR, pins the watch to the PR's **current head**, refuses to
|
|
24
|
+
settle until the check set is stable and fully terminal, restarts itself
|
|
25
|
+
when the head moves (amend, force-push, new commit), and exits 0 only on
|
|
26
|
+
terminal green — nonzero the moment a check fails terminally. On GitLab,
|
|
27
|
+
`glab ci status --live` is the nearest equivalent; the recognition table
|
|
28
|
+
below still applies.
|
|
29
|
+
|
|
30
|
+
## Recognition table
|
|
31
|
+
|
|
32
|
+
| You see | It means | Do |
|
|
33
|
+
| --- | --- | --- |
|
|
34
|
+
| Green summary seconds after a push, suspiciously few checks | The full check set has not registered yet | Trust only `stdd ci --watch` — it never settles on the first sighting of a set |
|
|
35
|
+
| A failure attached to an older SHA | Stale result, not a red | Nothing — the watch is pinned to the current head |
|
|
36
|
+
| `cancelled` on a superseded run | A concurrency twin, not a failure | Nothing to debug — `stdd ci` collapses same-named entries to the freshest run; re-run only if a ruleset still waits on that check |
|
|
37
|
+
| A required check failed on the current head | A real red — it outranks everything else | Pull the failed job's log (the error, not the job name), reproduce locally with the narrowest matching command, fix the root cause, push, re-watch |
|
|
38
|
+
| Checks green, but the change needs a deploy or migration to be observable | Green CI ≠ working | Verify the runtime surface the change touches before reporting done |
|
|
39
|
+
| The watch times out with checks still pending | Runner starvation or a hung job | Read the run page; re-run or escalate — never report green |
|
|
40
|
+
|
|
41
|
+
## After a real red
|
|
42
|
+
|
|
43
|
+
A fix-commit without a re-watch repeats the original mistake: every push
|
|
44
|
+
starts a new settlement, and only `stdd ci --watch` reaching terminal
|
|
45
|
+
green closes it.
|
|
46
|
+
|
|
47
|
+
## Before opening
|
|
48
|
+
|
|
49
|
+
Run the local lanes that cover the surfaces the diff touches — not only the
|
|
50
|
+
narrowest lane that proved the last edit. CI settlement stays the
|
|
51
|
+
authoritative backstop; pre-running the entire CI matrix locally is not the
|
|
52
|
+
goal.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stdd-start-change
|
|
3
|
+
description: "Classify a request, open durable task state only for changes, and route to the smallest applicable workflow. Use when: A new implementation, fix, refactor, investigation, or repository change is beginning."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- generated by stdd plugin build v0.9.0 — do not edit -->
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# Start change
|
|
10
|
+
|
|
11
|
+
Classify the request before writing task state:
|
|
12
|
+
|
|
13
|
+
- read-only question or diagnosis → invoke `stdd-investigation`; do not start a
|
|
14
|
+
task or write the ledger;
|
|
15
|
+
- uncertain behavior or scope → invoke `stdd-brainstorming`;
|
|
16
|
+
- agreed multi-step behavior → invoke `stdd-planning`;
|
|
17
|
+
- known defect without a diagnosis → invoke `stdd-debugging`;
|
|
18
|
+
- small agreed change → invoke `stdd-implement` directly.
|
|
19
|
+
|
|
20
|
+
Run `stdd policy show` before asking anything: it may already answer which
|
|
21
|
+
agent owns this area, which standing permission covers the work, and what this
|
|
22
|
+
repository treats as routine rather than a decision. Read it through the
|
|
23
|
+
command, never as raw markdown — the command is where the rules are applied.
|
|
24
|
+
|
|
25
|
+
For every route that may change the repository, open one task boundary before
|
|
26
|
+
carrying state across prompts:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
stdd task start "<short change name>"
|
|
30
|
+
stdd status --local
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
If another task is active, do not reset it silently. Finish it, continue it,
|
|
34
|
+
or ask the user which task owns the checkout.
|
|
35
|
+
|
|
36
|
+
For a change, read `.stdd/method.md` and the canonical docs governing the
|
|
37
|
+
touched behavior. The classification is a routing decision, not ceremony:
|
|
38
|
+
skip workflows that do not apply, but never skip a mechanical contract that
|
|
39
|
+
does.
|