@psimona/darkf 0.6.0 → 0.7.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/docs/concepts/failure-modes.md +18 -5
- package/docs/concepts/node-types.md +4 -2
- package/docs/guides/plan-with-a-task-queue.md +6 -5
- package/docs/guides/write-your-first-workflow.md +8 -2
- package/docs/index.mdx +4 -0
- package/docs/reference/core-types.md +5 -0
- package/docs/reference/package-map.md +12 -8
- package/docs/start-here/quickstart.md +12 -5
- package/package.json +9 -2
- package/skills/darkf-writing-workflows/SKILL.md +131 -6
- package/src/cli/doctor.test.ts +1 -1
- package/src/cli/index.ts +25 -15
- package/src/cli/setup.ts +4 -9
- package/src/cli/state-file.ts +14 -0
- package/src/cli/tarball.test.ts +3 -1
- package/src/cli/update.ts +4 -9
- package/src/core/tasks.ts +1 -1
- package/src/core/types.test.ts +52 -0
- package/src/core/types.ts +27 -18
- package/src/engine/run.test.ts +286 -4
- package/src/engine/run.ts +51 -9
- package/src/exports.ts +4 -0
- package/src/kit/agents/claude-code.ts +4 -34
- package/src/kit/agents/handoff.test.ts +12 -0
- package/src/kit/agents/handoff.ts +32 -8
- package/src/kit/agents/opencode.test.ts +1 -1
- package/src/kit/agents/opencode.ts +14 -28
- package/src/kit/specs.test.ts +247 -0
- package/src/kit/specs.ts +344 -0
- package/src/kit/status.ts +6 -6
- package/src/kit/validation/zod.test.ts +42 -0
- package/src/kit/validation/zod.ts +20 -0
- package/workflows/dev-loop/scripts/begin.ts +9 -6
- package/workflows/dev-loop/scripts/dispatch.ts +50 -0
- package/workflows/dev-loop/scripts/finish.ts +23 -21
- package/workflows/dev-loop/scripts/mark-done.ts +22 -0
- package/workflows/dev-loop/scripts/validate-plan.ts +30 -0
- package/workflows/dev-loop/workflow.ts +164 -68
- /package/workflows/dev-loop/scripts/{check.ts → test.ts} +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import type { DispatchInfo, NodeResult, TaskList } from "@psimona/darkf/src/core/index.ts";
|
|
4
|
+
|
|
5
|
+
// The deterministic half of Review's approval: Review judges whether the
|
|
6
|
+
// in-progress task's claim actually holds (it never touches files to do
|
|
7
|
+
// so); this script does the one mechanical write that follows — agent for
|
|
8
|
+
// judgment, script for the bookkeeping, per darkf-writing-workflows. Only
|
|
9
|
+
// Dispatch and this script ever write tasks.json, and Dispatch always
|
|
10
|
+
// just wrote a valid one before handing off, so there is nothing here to
|
|
11
|
+
// re-validate.
|
|
12
|
+
export default async function markDone(
|
|
13
|
+
_handoff: NodeResult,
|
|
14
|
+
info: DispatchInfo,
|
|
15
|
+
): Promise<NodeResult> {
|
|
16
|
+
const path = join(info.rootDir, ".darkf", "run", info.runId, "tasks.json");
|
|
17
|
+
const list = JSON.parse(await readFile(path, "utf8")) as TaskList;
|
|
18
|
+
const current = list.tasks.find((t) => t.status === "in-progress");
|
|
19
|
+
if (current) current.status = "done";
|
|
20
|
+
await writeFile(path, JSON.stringify(list, null, 2));
|
|
21
|
+
return { event: "marked", output: {} };
|
|
22
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import {
|
|
4
|
+
type DispatchInfo,
|
|
5
|
+
type NodeResult,
|
|
6
|
+
parseTaskList,
|
|
7
|
+
} from "@psimona/darkf/src/core/index.ts";
|
|
8
|
+
|
|
9
|
+
// Plan (agent) distills the spec into a candidate TaskList and hands it on
|
|
10
|
+
// as its own output — judgment work, free-form prose in, structured JSON
|
|
11
|
+
// out, not something a deterministic script could do. Persisting it to the
|
|
12
|
+
// canonical .darkf/run/<runId>/tasks.json path (docs/specs/_built/task-list-json/spec.md,
|
|
13
|
+
// Decisions: Colocation) needs info.rootDir/info.runId — only a script
|
|
14
|
+
// gets those; a static agent prompt can't interpolate a per-dispatch runId.
|
|
15
|
+
// Validating once here with parseTaskList means every downstream node
|
|
16
|
+
// (Implement, Fix, Review) trusts the file on disk instead of re-checking
|
|
17
|
+
// Plan's own judgment call.
|
|
18
|
+
export default async function validatePlan(
|
|
19
|
+
handoff: NodeResult,
|
|
20
|
+
info: DispatchInfo,
|
|
21
|
+
): Promise<NodeResult> {
|
|
22
|
+
const parsed = parseTaskList(handoff.output);
|
|
23
|
+
if ("error" in parsed) {
|
|
24
|
+
return { event: "invalid", output: { error: parsed.error } };
|
|
25
|
+
}
|
|
26
|
+
const dir = join(info.rootDir, ".darkf", "run", info.runId);
|
|
27
|
+
await mkdir(dir, { recursive: true });
|
|
28
|
+
await writeFile(join(dir, "tasks.json"), JSON.stringify(parsed, null, 2));
|
|
29
|
+
return { event: "valid", output: parsed };
|
|
30
|
+
}
|
|
@@ -1,41 +1,105 @@
|
|
|
1
1
|
import { DONE, type WorkflowDef } from "@psimona/darkf/src/core/index.ts";
|
|
2
2
|
import { opencodeRunner } from "@psimona/darkf/src/kit/agents/opencode.ts";
|
|
3
3
|
|
|
4
|
-
// dev-loop — begin →
|
|
5
|
-
//
|
|
4
|
+
// dev-loop — begin → PlanPhase{plan → validate} → (dispatch →
|
|
5
|
+
// Task{implement → test → [fix → test]* → review → mark done})* →
|
|
6
|
+
// document → finish(squash) → feedback.
|
|
6
7
|
//
|
|
7
8
|
// The darkf-on-darkf pilot, expanded after its first real run built the CLI
|
|
8
|
-
// self-update feature (docs/specs/self-update/). Shape ported from
|
|
9
|
-
// blueprint's build-backend: Begin cuts the feature branch,
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
// darkf/feedback/.
|
|
9
|
+
// self-update feature (docs/specs/_built/self-update/). Shape ported from
|
|
10
|
+
// blueprint's build-backend: Begin cuts the feature branch, Finish
|
|
11
|
+
// squash-merges onto master with blueprint's rails, Feedback writes the run
|
|
12
|
+
// retrospective under darkf/feedback/.
|
|
13
13
|
//
|
|
14
|
-
// Run from the target repo root with
|
|
15
|
-
// workspace symlink — doctor's selfRoot guard fails
|
|
14
|
+
// Run from the target repo root with the released engine from the npm
|
|
15
|
+
// registry (never the workspace symlink — doctor's selfRoot guard fails
|
|
16
|
+
// inside the checkout; never a source-tarball install — repeated
|
|
17
|
+
// install:global runs corrupt bun's global manifest with duplicate
|
|
18
|
+
// dependency keys):
|
|
16
19
|
//
|
|
17
|
-
// bun
|
|
20
|
+
// bun install -g @psimona/darkf@latest # released engine; the working
|
|
21
|
+
// # tree's workflow rides the branch
|
|
18
22
|
// darkf validate darkf/workflows/dev-loop
|
|
19
23
|
// darkf start darkf/workflows/dev-loop "message" --allow-dirty-workflow
|
|
20
24
|
//
|
|
21
25
|
// Editing the FEATURE / RUN_DATE constants at the top of the begin/finish
|
|
22
|
-
// scripts and this file
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
//
|
|
26
|
+
// scripts and this file is the per-feature contract until engine-side input
|
|
27
|
+
// plumbing exists — but the agent prompts below are feature-agnostic, so
|
|
28
|
+
// that's the only edit a new dispatch needs. Resume is the fresh-run
|
|
29
|
+
// semantics: a second run on an already-implemented tree verifies and ships
|
|
30
|
+
// it. No other git automation: the human curates what the workflow leaves
|
|
31
|
+
// behind (spec archive, roadmap entry, feedback note).
|
|
27
32
|
//
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
+
// Two bounded-loop composites, not one shared "whole build" composite,
|
|
34
|
+
// because they bound two unrelated kinds of backward routing (Bounded
|
|
35
|
+
// loops rule, darkf-writing-workflows) and need very different maxCycles
|
|
36
|
+
// budgets:
|
|
37
|
+
//
|
|
38
|
+
// - PlanPhase: Plan (an agent — distilling free-form spec prose into a
|
|
39
|
+
// task list takes judgment, not parsing) emits a candidate TaskList in
|
|
40
|
+
// its output, reusing darkf-core's existing shared vocabulary
|
|
41
|
+
// (docs/specs/_built/task-list-json/spec.md) rather than a one-off
|
|
42
|
+
// shape. ValidatePlan (a script) runs parseTaskList on it and, once
|
|
43
|
+
// valid, persists it at the canonical .darkf/run/<runId>/tasks.json — a
|
|
44
|
+
// script gets info.rootDir/info.runId to compute that path; a static
|
|
45
|
+
// agent prompt cannot interpolate a per-dispatch runId, only a
|
|
46
|
+
// compile-time constant like FEATURE. An invalid candidate loops back to
|
|
47
|
+
// Plan; budget is a small, fixed number of retry rounds.
|
|
48
|
+
//
|
|
49
|
+
// - Dispatch/Task is darkf's item-loop-convention shape
|
|
50
|
+
// (docs/specs/item-loop-convention/spec.md — a design, not shipped code
|
|
51
|
+
// yet, so this hand-rolls the algorithm rather than importing it), with
|
|
52
|
+
// Dispatch kept OUTSIDE the Task composite on purpose. Dispatch (a
|
|
53
|
+
// script) is the node that actually walks the plan — it picks the
|
|
54
|
+
// first "pending" task out of tasks.json, flips it "in-progress", and
|
|
55
|
+
// hands it to Implement as the one thing to build this pass. Task is
|
|
56
|
+
// the per-task lane: Implement → Test → (Fix → Test)* → Review →
|
|
57
|
+
// MarkDone. Review (an agent, reads tasks.json itself to find the
|
|
58
|
+
// in-progress task — it never receives it via handoff, which is
|
|
59
|
+
// several hops away by the time Review runs) verifies the task's claim
|
|
60
|
+
// against the actual working tree and never edits anything; MarkDone
|
|
61
|
+
// (a script) does the one mechanical write that follows an approval,
|
|
62
|
+
// then routes back out to Dispatch for the next task — a flat edge
|
|
63
|
+
// across the composite boundary (buildRegistry is one flat map keyed
|
|
64
|
+
// by state id; routing doesn't care which composite either side lives
|
|
65
|
+
// in).
|
|
66
|
+
//
|
|
67
|
+
// That flat edge is what makes the sizing per-task instead of
|
|
68
|
+
// per-plan: every time Dispatch (outside Task) hands off into Task
|
|
69
|
+
// again, that is a fresh entry into the composite, because the engine
|
|
70
|
+
// resets a composite's cycle counter whenever the immediately
|
|
71
|
+
// preceding dispatch's scope did not already include it
|
|
72
|
+
// (CompositeStateDef.maxCycles's doc, src/core/types.ts). Task's
|
|
73
|
+
// maxCycles below therefore budgets one task's worst case only, never
|
|
74
|
+
// multiplied by how many tasks the plan turns out to have. Dispatch
|
|
75
|
+
// itself carries no maxCycles of its own — the engine-wide maxSteps is
|
|
76
|
+
// the only backstop on the item-to-item loop, matching
|
|
77
|
+
// item-loop-convention's own Non-goals ("automatic maxCycles wiring"
|
|
78
|
+
// is explicitly out of scope: a workflow author still sizes a lane's
|
|
79
|
+
// own budget by hand, but never has to also guess the plan's total
|
|
80
|
+
// size to do it). This replaces the pilot's original shape, where
|
|
81
|
+
// Dispatch lived inside the same composite as the lane and the budget
|
|
82
|
+
// had to cover the whole plan — sized for "≤8 tasks × ≤9 dispatches,"
|
|
83
|
+
// it crashed on cycle-limit the first time a real plan came out to 17
|
|
84
|
+
// tasks, even though no single task was anywhere near a runaway.
|
|
85
|
+
//
|
|
86
|
+
// Every node's only shared channels are the repo itself (files, git diff,
|
|
87
|
+
// the spec docs, the run's tasks.json) and the one-hop handoff — matching
|
|
88
|
+
// PHILOSOPHY.md: nothing rides along for free. A node several hops past
|
|
89
|
+
// whoever produced something it needs (Review past Dispatch; Document past
|
|
90
|
+
// everything) rediscovers it from disk — "the task with status
|
|
91
|
+
// in-progress," "the directory under .darkf/run/ with the latest mtime" —
|
|
92
|
+
// never by a value hand-threaded through every intervening node's output.
|
|
93
|
+
// See darkf-writing-workflows's "Keep prompts feature-agnostic". The same
|
|
94
|
+
// tasks.json also feeds the OpenCode plugin's live "tasks nn/mm" tab for
|
|
95
|
+
// free, since MarkDone flips a task's status the moment its claim is
|
|
96
|
+
// actually verified, not merely claimed.
|
|
33
97
|
|
|
34
98
|
export const agentRunner = opencodeRunner;
|
|
35
99
|
|
|
36
100
|
const MODEL = "zai-coding-plan/glm-5.3-flash";
|
|
37
|
-
const RUN_DATE = "2026-11-
|
|
38
|
-
const FEATURE = "
|
|
101
|
+
const RUN_DATE = "2026-11-19";
|
|
102
|
+
const FEATURE = "opencode-overlay-tiles";
|
|
39
103
|
|
|
40
104
|
export const workflow: WorkflowDef = {
|
|
41
105
|
initial: "Begin",
|
|
@@ -44,43 +108,75 @@ export const workflow: WorkflowDef = {
|
|
|
44
108
|
type: "script",
|
|
45
109
|
file: "begin.ts",
|
|
46
110
|
retries: 1,
|
|
47
|
-
on: { started: "
|
|
111
|
+
on: { started: "Plan", branch_failed: DONE },
|
|
112
|
+
},
|
|
113
|
+
PlanPhase: {
|
|
114
|
+
initial: "Plan",
|
|
115
|
+
// Two dispatches per round (Plan, ValidatePlan); budget three full
|
|
116
|
+
// retry rounds. Unrelated to Task's budget — see the top comment
|
|
117
|
+
// on why these are two composites, not one.
|
|
118
|
+
maxCycles: 6,
|
|
119
|
+
states: {
|
|
120
|
+
Plan: {
|
|
121
|
+
type: "agent",
|
|
122
|
+
agent: { model: MODEL },
|
|
123
|
+
retries: 1,
|
|
124
|
+
prompt: `You are planning the ${FEATURE} run. Do not write or modify any code.
|
|
125
|
+
|
|
126
|
+
Read docs/specs/${FEATURE}/. It holds the contract as either a single spec.md, or a split prd.md (requirements) + design.md (implementation) pair — read whichever is present.
|
|
127
|
+
|
|
128
|
+
Distill the contract into one TaskList JSON object (shape: id, optional spec: { prd?, design? }, requirements?: TaskRequirement[], tasks: Task[] — TaskRequirement is { id, kind: "req"|"nfr"|"ng", text, priority? }; Task is { id, title, status, satisfies?, priority? }; priority is one of "must"|"should"|"could"|"won't"; status starts "pending" for every task):
|
|
129
|
+
|
|
130
|
+
- requirements: one entry per concrete requirement, NFR, or non-goal in the contract, kind "req"/"nfr"/"ng" accordingly, text stated the way the contract states it — don't paraphrase, don't add anything beyond it.
|
|
131
|
+
- tasks: one entry per concrete file to create or change and concrete behavior to add that the contract calls for. Each task's satisfies lists the requirement ids it implements. id is a short kebab-case slug; title is one line.
|
|
132
|
+
|
|
133
|
+
Put this object directly in your output — do not write any file yourself; the next step persists and validates it.
|
|
134
|
+
|
|
135
|
+
Finish with event "planned". If the contract is missing, contradictory, or too vague to distill a concrete task list from, finish with event "blocked" and the reason.`,
|
|
136
|
+
on: { planned: "ValidatePlan", blocked: DONE },
|
|
137
|
+
},
|
|
138
|
+
ValidatePlan: {
|
|
139
|
+
type: "script",
|
|
140
|
+
file: "validate-plan.ts",
|
|
141
|
+
retries: 1,
|
|
142
|
+
on: { valid: "Dispatch", invalid: "Plan" },
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
Dispatch: {
|
|
147
|
+
type: "script",
|
|
148
|
+
file: "dispatch.ts",
|
|
149
|
+
retries: 1,
|
|
150
|
+
on: { next_item: "Implement", plan_exhausted: "Document", blocked: DONE },
|
|
48
151
|
},
|
|
49
|
-
|
|
152
|
+
Task: {
|
|
50
153
|
initial: "Implement",
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
|
|
154
|
+
// Sized for one task's worst case only (Implement + Test + 2
|
|
155
|
+
// Fix/Test rounds + Review + MarkDone = 8), with item-loop-
|
|
156
|
+
// convention's own estimateMaxCycles(n, slack=1.5) rounding: 8 *
|
|
157
|
+
// 1.5 = 12. Dispatch is deliberately outside this composite (see
|
|
158
|
+
// the top comment) so this budget resets fresh on every task,
|
|
159
|
+
// never multiplied by the plan's task count.
|
|
160
|
+
maxCycles: 12,
|
|
56
161
|
states: {
|
|
57
162
|
Implement: {
|
|
58
163
|
type: "agent",
|
|
59
164
|
agent: { model: MODEL },
|
|
60
165
|
retries: 1,
|
|
61
|
-
prompt: `Implement the ${FEATURE} feature
|
|
62
|
-
|
|
63
|
-
First read docs/specs/${FEATURE}/spec.md. It is the contract: its Decisions and Non-goals sections are locked — implement exactly what they specify, nothing more. The spec is the only contract artifact; no design.md exists for this feature.
|
|
166
|
+
prompt: `Implement exactly the one task you were handed for the ${FEATURE} feature — see "Input from the previous step" below for its id, title, and which requirements it satisfies. Nothing else.
|
|
64
167
|
|
|
65
|
-
|
|
168
|
+
First read docs/specs/${FEATURE}/. It holds the contract as either a single spec.md, or a split prd.md (requirements) + design.md (implementation) pair — read whichever is present. Use it to understand what the handed-off task actually requires; its locked decisions and explicit non-goals bound the work.
|
|
66
169
|
|
|
67
|
-
|
|
68
|
-
- darkf/src/cli/setup.ts (new): \`darkf setup\` — sync both bundled skills into every detected host's skills dir. Hosts are a table in code per the spec: claude code (~/.claude/skills, binary claude), opencode (~/.opencode/skills, opencode), codex cli (~/.codex/skills, codex), gemini cli (~/.gemini/skills, gemini), cursor (~/.cursor/skills, cursor-agent); a host is detected when its skills dir exists OR its binary is on PATH. Write policy: darkf-* is darkf's namespace — copy when missing; when present, replace the whole dir (copy bundled to a dot-prefixed temp dir inside the skills dir, remove the installed dir, rename into place) so the destination is an exact mirror. States missing/ok/differs per skill. Output: one host-detection line, then one line per host per skill. Creates a missing skills dir (mode 0755) for a detected host; skips an undetected host without creating anything. Exits non-zero when a present host still ends missing/differs after the sync attempt. Takes no flags and no positional args; never prompts.
|
|
69
|
-
- \`darkf upgrade\` (darkf/src/cli/update.ts) runs the same sync after self-update, under a "skills:" header, best-effort: a sync failure is reported and exits non-zero but never masks the upgrade itself.
|
|
70
|
-
- doctor/validate split in darkf/src/cli/index.ts: \`darkf doctor\` with no ref checks the environment only — agent binaries, cwd sanity, skills section. \`darkf validate <ref>\` inherits the workflow checks doctor has today (resolves, loads, exports, structure), unchanged lines and exit codes. Back-compat: \`darkf doctor <ref>\` prints the new usage and exits 1. The skills section names every known harness: per skill ok/missing/differs for a present harness, \`harness not present\` for an absent one; it writes nothing and exits non-zero only for missing/differs on a present harness, with \`run darkf setup\` as the fix hint. All three (doctor skills section, validate checks, setup sync) share one skills-check function. Fix doctor's stale runner hint while there: "built-ins live in src/agents/" — the real location is src/kit/agents/.
|
|
71
|
-
- Daily probe: once per calendar day, the first darkf invocation after the update gate runs a skills-only check via the same shared function. State file per the spec (XDG state semantics like updateStateFile) stores the last probe date; missing or corrupt counts as never probed. Silent when every present harness is ok. On missing/differs, print one compact block (the failing lines plus "fix: run darkf setup") before the invoked command's own output. Never fatal — the probe never changes the invoking command's exit code. \`setup\` and \`upgrade\` skip the probe and refresh the state file.
|
|
72
|
-
- Packaging: darkf/package.json gains "files": ["src", "workflows", "skills", "docs"].
|
|
73
|
-
- Docs move: move site/src/content/docs/** to darkf/docs/** and rebase the site's content loading onto darkf/docs/ (site/src/content.config.ts, starlight docsLoader — rebase it, or if the loader cannot rebase, a prepack copy with a drift check per the spec). bun run build in site/ must still succeed.
|
|
74
|
-
- Tests per the spec's Testing section: setup tests with deps injected like update.ts's UpdateDeps (home, bundledDir, existsBinary) covering host detection by dir alone / by binary / absent, copy and mirror semantics including leftover-file wipe and crashed-temp-dir replacement, state reporting, and exit codes; doctor/validate split tests; daily-probe tests (first-of-day runs, same-day skip, corrupt state file, silent-ok, block-on-failure, exemptions); the tarball smoke check (npm pack, temp-prefix install, run setup/doctor/render and the skill-referenced docs paths).
|
|
170
|
+
Resume semantics: if the working tree already implements this task, verify it instead of re-implementing.
|
|
75
171
|
|
|
76
|
-
|
|
172
|
+
Do not commit. Do not touch tasks.json — Review verifies your claim and MarkDone updates it once that verification passes.
|
|
77
173
|
|
|
78
|
-
Finish with event "implemented". If the
|
|
79
|
-
on: { implemented: "
|
|
174
|
+
Finish with event "implemented". If the task cannot be implemented as specified, finish with event "blocked" and put the reason in the output. If a review demand contradicts the spec, finish with event "disputed" and ground the objection in the spec text.`,
|
|
175
|
+
on: { implemented: "Test", blocked: DONE, disputed: DONE },
|
|
80
176
|
},
|
|
81
|
-
|
|
177
|
+
Test: {
|
|
82
178
|
type: "script",
|
|
83
|
-
file: "
|
|
179
|
+
file: "test.ts",
|
|
84
180
|
retries: 1,
|
|
85
181
|
on: { passed: "Review", failed: "Fix" },
|
|
86
182
|
},
|
|
@@ -90,10 +186,10 @@ Finish with event "implemented". If the spec cannot be implemented as written, f
|
|
|
90
186
|
retries: 1,
|
|
91
187
|
prompt: `You are repairing the ${FEATURE} implementation after a failed gate.
|
|
92
188
|
|
|
93
|
-
The handoff you received carries either the failing tail of "bun run check" or the reviewer's change list. Read docs/specs/${FEATURE}/spec.md
|
|
189
|
+
The handoff you received carries either the failing tail of "bun run check" or the reviewer's change list. Read docs/specs/${FEATURE}/'s contract (spec.md if present, otherwise prd.md + design.md). Fix the code minimally. Do not redesign. Do not commit.
|
|
94
190
|
|
|
95
191
|
Finish with event "fixed". If the failure exposes a spec defect you cannot resolve in code, finish with event "blocked" and the reason. If the demand contradicts the spec, finish with event "disputed" and ground the objection in the spec text.`,
|
|
96
|
-
on: { fixed: "
|
|
192
|
+
on: { fixed: "Test", blocked: DONE, disputed: DONE },
|
|
97
193
|
},
|
|
98
194
|
Review: {
|
|
99
195
|
type: "agent",
|
|
@@ -101,28 +197,30 @@ Finish with event "fixed". If the failure exposes a spec defect you cannot resol
|
|
|
101
197
|
retries: 1,
|
|
102
198
|
prompt: `You are an independent reviewer. Do not modify any files.
|
|
103
199
|
|
|
104
|
-
|
|
200
|
+
Find the run directory under .darkf/run/ with the latest mtime and read its tasks.json. Find the one task whose status is "in-progress" — that is the task just implemented and tested. A task reaching you is a claim to verify, not a fact to trust:
|
|
201
|
+
|
|
105
202
|
- inspect git status --porcelain in addition to git diff — agent-authored new files are invisible to git diff alone
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
- check the daily probe: once per calendar day on first invocation after the update gate, skills-only via the shared function, spec state file with missing/corrupt treated as never probed, silent on ok, compact block plus fix hint on missing/differs, never fatal, setup/upgrade exempt and refreshing the state file
|
|
111
|
-
- check packaging: package.json files allowlist exactly ["src", "workflows", "skills", "docs"]; docs moved to darkf/docs/; the site still builds from the moved docs (loader rebase or prepack copy with drift check)
|
|
112
|
-
- check the bundled skills are byte-unchanged: darkf/skills/darkf-usage/SKILL.md and darkf/skills/darkf-writing-workflows/SKILL.md
|
|
113
|
-
- check the tests cover the spec's Testing section: setup deps-injection fixtures, mirror semantics, doctor/validate split, daily probe behaviors, tarball smoke check
|
|
114
|
-
- you may run "bun test darkf/src" and "bun run lint" yourself
|
|
115
|
-
|
|
116
|
-
Approve only if the implementation fulfills the spec. Otherwise list every required change concretely in the output.
|
|
203
|
+
- read docs/specs/${FEATURE}/'s contract (spec.md if present, otherwise prd.md + design.md) for what each id in the task's "satisfies" list actually requires, and confirm the working tree genuinely satisfies every one of them
|
|
204
|
+
- you may run the project's own test/lint commands yourself
|
|
205
|
+
|
|
206
|
+
Approve only if the task's claim holds in full. Otherwise list every required change concretely in the output.
|
|
117
207
|
|
|
118
208
|
Finish with event "approved" or event "changes_requested".`,
|
|
119
|
-
on: { approved: "
|
|
209
|
+
on: { approved: "MarkDone", changes_requested: "Fix" },
|
|
120
210
|
},
|
|
121
|
-
|
|
122
|
-
type: "
|
|
123
|
-
|
|
211
|
+
MarkDone: {
|
|
212
|
+
type: "script",
|
|
213
|
+
file: "mark-done.ts",
|
|
124
214
|
retries: 1,
|
|
125
|
-
|
|
215
|
+
on: { marked: "Dispatch" },
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
Document: {
|
|
220
|
+
type: "agent",
|
|
221
|
+
agent: { model: MODEL },
|
|
222
|
+
retries: 1,
|
|
223
|
+
prompt: `You are updating user-facing documentation for the ${FEATURE} feature, after every task in its plan was implemented and independently reviewed. Do not modify code or tests.
|
|
126
224
|
|
|
127
225
|
Read docs/specs/${FEATURE}/spec.md (or prd.md/design.md when present) for what the feature does, and run git diff master plus git status --porcelain to see what shipped.
|
|
128
226
|
|
|
@@ -137,9 +235,7 @@ Docs must match the spec when this run lands — drift accumulates one stale pag
|
|
|
137
235
|
Do NOT touch: ROADMAP.md, darkf/feedback/, docs/specs/ (the spec archive move and roadmap entry are post-merge human curation), any file under darkf/src/ or darkf-opencode-plugin/.
|
|
138
236
|
|
|
139
237
|
If nothing user-facing changed and no doc drifted, finish with event "skipped" and put the one-line reason in the output. Otherwise make the edits and finish with event "documented". If the docs cannot be updated (for example the site is broken), finish with event "blocked" and the reason.`,
|
|
140
|
-
|
|
141
|
-
},
|
|
142
|
-
},
|
|
238
|
+
on: { documented: "Finish", skipped: "Finish", blocked: DONE },
|
|
143
239
|
},
|
|
144
240
|
Finish: {
|
|
145
241
|
type: "script",
|
|
File without changes
|