cohorte 3.0.0-dev.8 → 3.0.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/CHANGELOG.md +1532 -0
- package/README.md +316 -62
- package/bin/cli.js +212 -0
- package/bin/report.js +141 -0
- package/core/agents/cohorte-profile-reader.md +50 -0
- package/core/agents/cohorte-release.md +58 -0
- package/core/agents/cohorte-review.md +174 -0
- package/core/agents/implementer.template.md +146 -0
- package/core/commands/cohorte-align-ds.md +33 -0
- package/core/commands/cohorte-audit.md +67 -0
- package/core/commands/cohorte-brainstorm.md +73 -0
- package/core/commands/cohorte-build.md +241 -0
- package/core/commands/cohorte-doctor.md +133 -0
- package/core/commands/cohorte-fix.md +80 -0
- package/core/commands/cohorte-fleet.md +111 -0
- package/core/commands/cohorte-init-pipeline.md +30 -0
- package/core/commands/cohorte-intake.md +92 -0
- package/core/commands/cohorte-patch.md +118 -0
- package/core/commands/cohorte-refactor.md +57 -0
- package/core/commands/cohorte-retro.md +85 -0
- package/core/commands/cohorte-review.md +224 -0
- package/core/commands/cohorte-ship.md +155 -0
- package/core/commands/cohorte-spec.md +105 -0
- package/core/commands/cohorte-update-pipeline.md +115 -0
- package/core/hooks/gate.py +2931 -0
- package/core/templates/agent-handoff.md +34 -0
- package/core/templates/brainstorm-return.md +42 -0
- package/core/templates/decisions.template.md +42 -0
- package/core/templates/design-brief.md +37 -0
- package/core/templates/patch.template.md +86 -0
- package/core/templates/pr-body.md +25 -0
- package/core/templates/review-feedback.md +46 -0
- package/core/templates/spec.template.md +88 -0
- package/core/templates/steps/init-pipeline/01-detect-stack.md +44 -0
- package/core/templates/steps/init-pipeline/02-interview-gaps.md +55 -0
- package/core/templates/steps/init-pipeline/03-draft-profile.md +9 -0
- package/core/templates/steps/init-pipeline/04-write-render.md +91 -0
- package/core/templates/steps/init-pipeline/05-report.md +11 -0
- package/core/templates/steps/review-pr/01-pr-mode.md +54 -0
- package/core/workflows/audit.js +306 -0
- package/core/workflows/loop.js +687 -0
- package/core/workflows/refactor.js +291 -0
- package/core/workflows/review.js +491 -0
- package/install.ps1 +72 -0
- package/install.sh +69 -0
- package/lib/doctor.js +472 -0
- package/lib/install.js +377 -0
- package/lib/project.js +322 -0
- package/lib/render.js +121 -0
- package/lib/versions.js +145 -0
- package/lib/yaml.js +174 -0
- package/package.json +36 -17
- package/profile/PIPELINE.template.md +250 -0
- package/profile/SCHEMA.md +749 -0
- package/profile/cohorte.config.template.yaml +43 -0
- package/scripts/feature-diff.sh +118 -0
- package/scripts/kanban-move.sh +307 -0
- package/scripts/metrics/collect.mjs +542 -0
- package/scripts/metrics/prices.json +42 -0
- package/scripts/new-feature.sh.template +122 -0
- package/scripts/preflight.sh +114 -0
- package/scripts/remove-feature.sh.template +56 -0
- package/assets/manifest.json +0 -203
- package/assets/migrations/config/README.md +0 -12
- package/assets/migrations/state/0001_init.sql +0 -154
- package/assets/prompts/README.md +0 -11
- package/assets/prompts/agents/brainstormer.md +0 -3
- package/assets/prompts/agents/fixer.md +0 -7
- package/assets/prompts/agents/implementer.md +0 -12
- package/assets/prompts/agents/reviewer.md +0 -8
- package/assets/prompts/agents/security-reviewer.md +0 -7
- package/assets/prompts/agents/spec-author.md +0 -3
- package/assets/prompts/phases/build.md +0 -5
- package/assets/prompts/phases/review.md +0 -5
- package/assets/prompts/phases/test.md +0 -5
- package/assets/prompts/system.md +0 -11
- package/assets/schemas/agent-output.schema.json +0 -225
- package/assets/schemas/auth-status.schema.json +0 -87
- package/assets/schemas/command-result.schema.json +0 -192
- package/assets/schemas/commands.schema.json +0 -959
- package/assets/schemas/config.schema.json +0 -2281
- package/assets/schemas/doctor-report.schema.json +0 -104
- package/assets/schemas/events.schema.json +0 -8514
- package/assets/schemas/fake-script.schema.json +0 -549
- package/assets/schemas/inspect.schema.json +0 -3133
- package/assets/schemas/manifest.schema.json +0 -79
- package/assets/schemas/ownership.schema.json +0 -52
- package/assets/schemas/policy-verdict.schema.json +0 -282
- package/assets/schemas/project-model.schema.json +0 -783
- package/assets/schemas/project-status.schema.json +0 -217
- package/assets/schemas/reconcile-plan.schema.json +0 -154
- package/assets/schemas/run-diff.schema.json +0 -177
- package/assets/schemas/run-snapshot-manifest.schema.json +0 -2104
- package/assets/schemas/run-state.schema.json +0 -1755
- package/assets/schemas/runtime-capabilities.schema.json +0 -1545
- package/assets/schemas/sandbox-capabilities.schema.json +0 -116
- package/assets/schemas/skill.schema.json +0 -87
- package/assets/schemas/spec.schema.json +0 -202
- package/assets/schemas/tool-catalogue.schema.json +0 -655
- package/assets/schemas/trust-record.schema.json +0 -38
- package/assets/skills/README.md +0 -9
- package/assets/skills/inspect-surface.md +0 -4
- package/dist/agent-host.mjs +0 -2187
- package/dist/agent-host.mjs.map +0 -1
- package/dist/bundle-manifest.json +0 -128
- package/dist/chunks/__host-DgGPyco9.mjs +0 -18
- package/dist/chunks/__host-DgGPyco9.mjs.map +0 -1
- package/dist/chunks/align-ds-r_X_1aQ_.mjs +0 -93
- package/dist/chunks/align-ds-r_X_1aQ_.mjs.map +0 -1
- package/dist/chunks/approve-Cv135UqI.mjs +0 -19
- package/dist/chunks/approve-Cv135UqI.mjs.map +0 -1
- package/dist/chunks/audit-B4ZWQ_DI.mjs +0 -179
- package/dist/chunks/audit-B4ZWQ_DI.mjs.map +0 -1
- package/dist/chunks/auth-BT5oVp76.mjs +0 -132
- package/dist/chunks/auth-BT5oVp76.mjs.map +0 -1
- package/dist/chunks/auth-Dnlksuo5.mjs +0 -141
- package/dist/chunks/auth-Dnlksuo5.mjs.map +0 -1
- package/dist/chunks/brainstorm-SJwOIEif.mjs +0 -123
- package/dist/chunks/brainstorm-SJwOIEif.mjs.map +0 -1
- package/dist/chunks/build-C_-mbZfD.mjs +0 -19
- package/dist/chunks/build-C_-mbZfD.mjs.map +0 -1
- package/dist/chunks/cancel-KV_cpsqS.mjs +0 -15
- package/dist/chunks/cancel-KV_cpsqS.mjs.map +0 -1
- package/dist/chunks/canonical-C8UxeEmB.mjs +0 -57
- package/dist/chunks/canonical-C8UxeEmB.mjs.map +0 -1
- package/dist/chunks/catalogue-IaCJdfB8.mjs +0 -1549
- package/dist/chunks/catalogue-IaCJdfB8.mjs.map +0 -1
- package/dist/chunks/compose-DRKjQcn0.mjs +0 -7333
- package/dist/chunks/compose-DRKjQcn0.mjs.map +0 -1
- package/dist/chunks/config-Cqu5XQoP.mjs +0 -96
- package/dist/chunks/config-Cqu5XQoP.mjs.map +0 -1
- package/dist/chunks/contract-DjssDPpS.mjs +0 -335
- package/dist/chunks/contract-DjssDPpS.mjs.map +0 -1
- package/dist/chunks/contract-bQ9FJl4N.mjs +0 -123
- package/dist/chunks/contract-bQ9FJl4N.mjs.map +0 -1
- package/dist/chunks/deny-ClTxSvHJ.mjs +0 -15
- package/dist/chunks/deny-ClTxSvHJ.mjs.map +0 -1
- package/dist/chunks/diff-Qw0II0sj.mjs +0 -101
- package/dist/chunks/diff-Qw0II0sj.mjs.map +0 -1
- package/dist/chunks/discover-BZPolSZG.mjs +0 -21
- package/dist/chunks/discover-BZPolSZG.mjs.map +0 -1
- package/dist/chunks/doctor-DcDFPvQM.mjs +0 -222
- package/dist/chunks/doctor-DcDFPvQM.mjs.map +0 -1
- package/dist/chunks/fix-C9roGiQz.mjs +0 -82
- package/dist/chunks/fix-C9roGiQz.mjs.map +0 -1
- package/dist/chunks/fleet-yWHQY2ya.mjs +0 -297
- package/dist/chunks/fleet-yWHQY2ya.mjs.map +0 -1
- package/dist/chunks/gc-BBXlBF5w.mjs +0 -161
- package/dist/chunks/gc-BBXlBF5w.mjs.map +0 -1
- package/dist/chunks/init--FxxkrcT.mjs +0 -63
- package/dist/chunks/init--FxxkrcT.mjs.map +0 -1
- package/dist/chunks/inspect-Buby4cQD.mjs +0 -22
- package/dist/chunks/inspect-Buby4cQD.mjs.map +0 -1
- package/dist/chunks/intake-C1pesxCJ.mjs +0 -12
- package/dist/chunks/intake-C1pesxCJ.mjs.map +0 -1
- package/dist/chunks/logs-Giq5sUau.mjs +0 -25
- package/dist/chunks/logs-Giq5sUau.mjs.map +0 -1
- package/dist/chunks/loop-BWsUpyus.mjs +0 -212
- package/dist/chunks/loop-BWsUpyus.mjs.map +0 -1
- package/dist/chunks/migrate-DuYCAbE3.mjs +0 -33
- package/dist/chunks/migrate-DuYCAbE3.mjs.map +0 -1
- package/dist/chunks/models-Btp6X2YZ.mjs +0 -24
- package/dist/chunks/models-Btp6X2YZ.mjs.map +0 -1
- package/dist/chunks/obsidian-BHLkXx_H.mjs +0 -235
- package/dist/chunks/obsidian-BHLkXx_H.mjs.map +0 -1
- package/dist/chunks/patch-sAgVqjpx.mjs +0 -50
- package/dist/chunks/patch-sAgVqjpx.mjs.map +0 -1
- package/dist/chunks/pause-BASBfKLO.mjs +0 -16
- package/dist/chunks/pause-BASBfKLO.mjs.map +0 -1
- package/dist/chunks/policy-Du7WVBFX.mjs +0 -139
- package/dist/chunks/policy-Du7WVBFX.mjs.map +0 -1
- package/dist/chunks/providers-Dx78imKj.mjs +0 -19
- package/dist/chunks/providers-Dx78imKj.mjs.map +0 -1
- package/dist/chunks/reconcile-BHn66X3C.mjs +0 -50
- package/dist/chunks/reconcile-BHn66X3C.mjs.map +0 -1
- package/dist/chunks/refactor-DV3RfGjk.mjs +0 -153
- package/dist/chunks/refactor-DV3RfGjk.mjs.map +0 -1
- package/dist/chunks/render-DyZr5Lgi.mjs +0 -53
- package/dist/chunks/render-DyZr5Lgi.mjs.map +0 -1
- package/dist/chunks/resume-GJQRb2Eb.mjs +0 -15
- package/dist/chunks/resume-GJQRb2Eb.mjs.map +0 -1
- package/dist/chunks/retro-Dr-2RTNN.mjs +0 -78
- package/dist/chunks/retro-Dr-2RTNN.mjs.map +0 -1
- package/dist/chunks/retry-CLrUem1H.mjs +0 -15
- package/dist/chunks/retry-CLrUem1H.mjs.map +0 -1
- package/dist/chunks/review-ZsBqp3vZ.mjs +0 -35
- package/dist/chunks/review-ZsBqp3vZ.mjs.map +0 -1
- package/dist/chunks/run-BGabwbDL.mjs +0 -109
- package/dist/chunks/run-BGabwbDL.mjs.map +0 -1
- package/dist/chunks/run-tool-C3rAv4XF.mjs +0 -26
- package/dist/chunks/run-tool-C3rAv4XF.mjs.map +0 -1
- package/dist/chunks/scan-C5uDr7Yq.mjs +0 -167
- package/dist/chunks/scan-C5uDr7Yq.mjs.map +0 -1
- package/dist/chunks/schema-Bq9qtgsd.mjs +0 -583
- package/dist/chunks/schema-Bq9qtgsd.mjs.map +0 -1
- package/dist/chunks/send-BdnJ85Nz.mjs +0 -19
- package/dist/chunks/send-BdnJ85Nz.mjs.map +0 -1
- package/dist/chunks/ship-BizfUe62.mjs +0 -140
- package/dist/chunks/ship-BizfUe62.mjs.map +0 -1
- package/dist/chunks/shutdown-BM92Iyv2.mjs +0 -15
- package/dist/chunks/shutdown-BM92Iyv2.mjs.map +0 -1
- package/dist/chunks/skip-DZG5kpcH.mjs +0 -18
- package/dist/chunks/skip-DZG5kpcH.mjs.map +0 -1
- package/dist/chunks/spec-C2h3U64g.mjs +0 -65
- package/dist/chunks/spec-C2h3U64g.mjs.map +0 -1
- package/dist/chunks/spec-path-tptqR7W8.mjs +0 -10
- package/dist/chunks/spec-path-tptqR7W8.mjs.map +0 -1
- package/dist/chunks/src-Bfr1yzsn.mjs +0 -1689
- package/dist/chunks/src-Bfr1yzsn.mjs.map +0 -1
- package/dist/chunks/src-CPW2_Ons.mjs +0 -5487
- package/dist/chunks/src-CPW2_Ons.mjs.map +0 -1
- package/dist/chunks/src-Cu3TxNob.mjs +0 -783
- package/dist/chunks/src-Cu3TxNob.mjs.map +0 -1
- package/dist/chunks/src-DNsLSxgm.mjs +0 -928
- package/dist/chunks/src-DNsLSxgm.mjs.map +0 -1
- package/dist/chunks/src-DbS9gkJy.mjs +0 -117
- package/dist/chunks/src-DbS9gkJy.mjs.map +0 -1
- package/dist/chunks/src-yi5whv3n.mjs +0 -2118
- package/dist/chunks/src-yi5whv3n.mjs.map +0 -1
- package/dist/chunks/status-SMjiOMYy.mjs +0 -29
- package/dist/chunks/status-SMjiOMYy.mjs.map +0 -1
- package/dist/chunks/tail-BuhT-2PH.mjs +0 -25
- package/dist/chunks/tail-BuhT-2PH.mjs.map +0 -1
- package/dist/chunks/update-BXIppsbi.mjs +0 -16
- package/dist/chunks/update-BXIppsbi.mjs.map +0 -1
- package/dist/chunks/update-pipeline-Du-Gu1Pl.mjs +0 -56
- package/dist/chunks/update-pipeline-Du-Gu1Pl.mjs.map +0 -1
- package/dist/cli.mjs +0 -186
- package/dist/cli.mjs.map +0 -1
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { n as writeHuman } from "./render-DyZr5Lgi.mjs";
|
|
2
|
-
//#region src/commands/logs/index.ts
|
|
3
|
-
const logs = {
|
|
4
|
-
verb: "logs",
|
|
5
|
-
async run(ctx, args) {
|
|
6
|
-
const runId = args.positionals[0];
|
|
7
|
-
if (!runId) return 2;
|
|
8
|
-
const store = await ctx.openStore();
|
|
9
|
-
const events = await store.readEvents(runId, {
|
|
10
|
-
afterSequence: 0,
|
|
11
|
-
limit: 1e3
|
|
12
|
-
});
|
|
13
|
-
try {
|
|
14
|
-
for (const event of events) if (args.json) ctx.stdio.stdout.write(`${JSON.stringify(event)}\n`);
|
|
15
|
-
else writeHuman(ctx, JSON.stringify(event));
|
|
16
|
-
return 0;
|
|
17
|
-
} finally {
|
|
18
|
-
await store.close();
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
//#endregion
|
|
23
|
-
export { logs as default };
|
|
24
|
-
|
|
25
|
-
//# sourceMappingURL=logs-Giq5sUau.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logs-Giq5sUau.mjs","names":[],"sources":["../../../../apps/cli/src/commands/logs/index.ts"],"sourcesContent":["// apps/cli/src/commands/logs/index.ts — DESIGN §9 verb `logs` (PLAN §3 rule 3 \"later units fill\n// stub files that lie inside their owned paths; they never edit ... the registry\"). Wave-0 stub: exits with the\n// documented not-available error (spec 24 `configuration/phase-not-available`); filled by the Wave-4/5\n// unit that owns `apps/cli/src/commands/logs/**`.\nimport type { CommandModule } from '../../contract/index.ts';\nimport { writeHuman } from '../../render/index.ts';\n\nconst logs: CommandModule = {\n verb: 'logs',\n async run(ctx, args) {\n const runId = args.positionals[0];\n if (!runId) return 2;\n const store = await ctx.openStore();\n const events = await store.readEvents(runId as never, { afterSequence: 0, limit: 1000 });\n try {\n for (const event of events) {\n if (args.json) ctx.stdio.stdout.write(`${JSON.stringify(event)}\\n`);\n else writeHuman(ctx, JSON.stringify(event));\n }\n return 0;\n } finally {\n await store.close();\n }\n },\n};\n\nexport default logs;\n"],"mappings":";;AAOA,MAAM,OAAsB;CAC1B,MAAM;CACN,MAAM,IAAI,KAAK,MAAM;EACnB,MAAM,QAAQ,KAAK,YAAY;EAC/B,IAAI,CAAC,OAAO,OAAO;EACnB,MAAM,QAAQ,MAAM,IAAI,UAAU;EAClC,MAAM,SAAS,MAAM,MAAM,WAAW,OAAgB;GAAE,eAAe;GAAG,OAAO;EAAK,CAAC;EACvF,IAAI;GACF,KAAK,MAAM,SAAS,QAClB,IAAI,KAAK,MAAM,IAAI,MAAM,OAAO,MAAM,GAAG,KAAK,UAAU,KAAK,EAAE,GAAG;QAC7D,WAAW,KAAK,KAAK,UAAU,KAAK,CAAC;GAE5C,OAAO;EACT,UAAU;GACR,MAAM,MAAM,MAAM;EACpB;CACF;AACF"}
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import { t as resolveSpecPath } from "./spec-path-tptqR7W8.mjs";
|
|
2
|
-
import { mkdir, readFile, stat, writeFile } from "node:fs/promises";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
//#region src/commands/loop/reducer.ts
|
|
5
|
-
/**
|
|
6
|
-
* The V2 loop reducer, kept pure so a CLI invocation and a resumed run apply
|
|
7
|
-
* exactly the same safety rules. A missing/invalid review never counts as a
|
|
8
|
-
* clean review.
|
|
9
|
-
*/
|
|
10
|
-
function decideLoop(review, lastKey, round, maxRounds) {
|
|
11
|
-
if (!review) return {
|
|
12
|
-
outcome: "abort",
|
|
13
|
-
reason: "review-died"
|
|
14
|
-
};
|
|
15
|
-
if (review.verdict === "needs-human" && review.unreviewed.length > 0) return {
|
|
16
|
-
outcome: "abort",
|
|
17
|
-
reason: "unreviewed"
|
|
18
|
-
};
|
|
19
|
-
if (review.unreviewed.length > 0) return {
|
|
20
|
-
outcome: "abort",
|
|
21
|
-
reason: "unreviewed"
|
|
22
|
-
};
|
|
23
|
-
if (review.verdict === "needs-human" || review.deferred.length > 0) return {
|
|
24
|
-
outcome: "abort",
|
|
25
|
-
reason: "approval-required"
|
|
26
|
-
};
|
|
27
|
-
if (review.clean && review.blocking === 0) return { outcome: "ship" };
|
|
28
|
-
if (!Number.isInteger(review.blocking) || review.blocking < 0) return {
|
|
29
|
-
outcome: "abort",
|
|
30
|
-
reason: "no-verdict"
|
|
31
|
-
};
|
|
32
|
-
if (review.blocking === 0) return { outcome: "ship" };
|
|
33
|
-
const key = review.blockingItems.join("\n");
|
|
34
|
-
if (!key) return {
|
|
35
|
-
outcome: "abort",
|
|
36
|
-
reason: "no-verdict"
|
|
37
|
-
};
|
|
38
|
-
if (lastKey !== void 0 && key === lastKey) return {
|
|
39
|
-
outcome: "abort",
|
|
40
|
-
reason: "treading-water"
|
|
41
|
-
};
|
|
42
|
-
if (round >= maxRounds) return {
|
|
43
|
-
outcome: "abort",
|
|
44
|
-
reason: "max-rounds"
|
|
45
|
-
};
|
|
46
|
-
return {
|
|
47
|
-
outcome: "continue",
|
|
48
|
-
key
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
/** Extract only a closed ReviewResult from a controller/report payload. */
|
|
52
|
-
function readReview(value) {
|
|
53
|
-
if (!value || typeof value !== "object") return null;
|
|
54
|
-
const candidate = value;
|
|
55
|
-
if (candidate.verdict !== "approved" && candidate.verdict !== "findings" && candidate.verdict !== "needs-human" || !Array.isArray(candidate.unreviewed) || !Array.isArray(candidate.deferred) || !Array.isArray(candidate.blockingItems) || typeof candidate.blocking !== "number" || typeof candidate.clean !== "boolean") return null;
|
|
56
|
-
return candidate;
|
|
57
|
-
}
|
|
58
|
-
//#endregion
|
|
59
|
-
//#region src/commands/loop/index.ts
|
|
60
|
-
const LOOP_PHASES = [
|
|
61
|
-
"PREFLIGHT",
|
|
62
|
-
"BUILD",
|
|
63
|
-
"TEST",
|
|
64
|
-
"REVIEW",
|
|
65
|
-
"FIX",
|
|
66
|
-
"TEST",
|
|
67
|
-
"REVIEW",
|
|
68
|
-
"SHIP"
|
|
69
|
-
];
|
|
70
|
-
const ACTIVE_STATES = /* @__PURE__ */ new Set([
|
|
71
|
-
"PREFLIGHT",
|
|
72
|
-
"BRAINSTORM",
|
|
73
|
-
"SPEC",
|
|
74
|
-
"BUILD",
|
|
75
|
-
"TEST",
|
|
76
|
-
"REVIEW",
|
|
77
|
-
"FIX",
|
|
78
|
-
"SHIP",
|
|
79
|
-
"SUSPENDED"
|
|
80
|
-
]);
|
|
81
|
-
function valueAfter(values, flag) {
|
|
82
|
-
const index = values.indexOf(flag);
|
|
83
|
-
return index < 0 ? void 0 : values[index + 1];
|
|
84
|
-
}
|
|
85
|
-
async function isFreshReview(cwd, feature) {
|
|
86
|
-
try {
|
|
87
|
-
const [spec, verdict] = await Promise.all([stat(join(cwd, "specs", `${feature}.md`)), stat(join(cwd, "specs", "reports", `${feature}.verdict.json`))]);
|
|
88
|
-
return verdict.mtimeMs >= spec.mtimeMs;
|
|
89
|
-
} catch {
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
const loop = {
|
|
94
|
-
verb: "loop",
|
|
95
|
-
async run(ctx, args) {
|
|
96
|
-
const feature = args.positionals.find((value, index) => !value.startsWith("--") && args.positionals[index - 1] !== "--max-rounds" && args.positionals[index - 1] !== "--wait");
|
|
97
|
-
if (!feature) return 2;
|
|
98
|
-
const parsedMax = Number(valueAfter(args.positionals, "--max-rounds") ?? 5);
|
|
99
|
-
const maxRounds = Number.isInteger(parsedMax) ? Math.min(10, Math.max(1, parsedMax)) : 5;
|
|
100
|
-
const surfaces = (valueAfter(args.positionals, "--surfaces") ?? "").split(",").map((value) => value.trim()).filter(Boolean);
|
|
101
|
-
const reportPath = join(ctx.cwd, "specs", "reports", `${feature}.loop.json`);
|
|
102
|
-
let previous;
|
|
103
|
-
try {
|
|
104
|
-
previous = JSON.parse(await readFile(reportPath, "utf8"));
|
|
105
|
-
} catch {}
|
|
106
|
-
const round = previous?.status === "completed" && !previous.outcome ? Math.max(1, Number(previous.round) || 1) + 1 : previous?.outcome ? 1 : Math.max(1, Number(previous?.round) || 1);
|
|
107
|
-
const now = ctx.clock.now();
|
|
108
|
-
const before = {
|
|
109
|
-
id: feature,
|
|
110
|
-
round,
|
|
111
|
-
maxRounds,
|
|
112
|
-
phase: round === 1 ? "build" : "fix",
|
|
113
|
-
status: "running",
|
|
114
|
-
...surfaces.length > 0 ? { surfaces } : previous?.surfaces ? { surfaces: previous.surfaces } : {},
|
|
115
|
-
...previous?.history ? { history: previous.history } : {},
|
|
116
|
-
startedAt: previous?.startedAt ?? now,
|
|
117
|
-
updatedAt: now
|
|
118
|
-
};
|
|
119
|
-
await mkdir(join(ctx.cwd, "specs", "reports"), { recursive: true });
|
|
120
|
-
await writeFile(reportPath, `${JSON.stringify(before, null, 2)}\n`, "utf8");
|
|
121
|
-
let result;
|
|
122
|
-
let controllerResult = before;
|
|
123
|
-
if (previous?.status === "pending" && previous.runId) {
|
|
124
|
-
controllerResult = {
|
|
125
|
-
...before,
|
|
126
|
-
runId: previous.runId
|
|
127
|
-
};
|
|
128
|
-
try {
|
|
129
|
-
const state = (await ctx.openStore().then(async (store) => {
|
|
130
|
-
try {
|
|
131
|
-
return await store.readRunTree(previous?.runId);
|
|
132
|
-
} finally {
|
|
133
|
-
await store.close();
|
|
134
|
-
}
|
|
135
|
-
})).run.state;
|
|
136
|
-
if (ACTIVE_STATES.has(state)) {
|
|
137
|
-
controllerResult = {
|
|
138
|
-
...controllerResult,
|
|
139
|
-
phase: previous.phase ?? "build",
|
|
140
|
-
status: "pending"
|
|
141
|
-
};
|
|
142
|
-
await writeFile(reportPath, `${JSON.stringify(controllerResult, null, 2)}\n`, "utf8");
|
|
143
|
-
if (args.json) ctx.stdio.stdout.write(`${JSON.stringify({
|
|
144
|
-
...controllerResult,
|
|
145
|
-
reportPath
|
|
146
|
-
})}\n`);
|
|
147
|
-
else ctx.stdio.stdout.write(`loop pending: ${reportPath}\n`);
|
|
148
|
-
return 4;
|
|
149
|
-
}
|
|
150
|
-
result = state === "COMPLETED" ? 0 : state === "CANCELLED" ? 16 : 3;
|
|
151
|
-
} catch {
|
|
152
|
-
result = 4;
|
|
153
|
-
}
|
|
154
|
-
} else {
|
|
155
|
-
const started = await ctx.controller.send("start", {
|
|
156
|
-
profile: "feature",
|
|
157
|
-
spec: { path: resolveSpecPath(ctx.cwd, feature) },
|
|
158
|
-
phases: [...LOOP_PHASES],
|
|
159
|
-
...surfaces.length > 0 ? { surfaces } : previous?.surfaces ? { surfaces: previous.surfaces } : {},
|
|
160
|
-
withFix: true,
|
|
161
|
-
unattended: true
|
|
162
|
-
});
|
|
163
|
-
const runId = started.result && typeof started.result === "object" && "runId" in started.result ? String(started.result.runId) : void 0;
|
|
164
|
-
if (runId && started.status === "pending") await ctx.hostSpawner.spawnDetached(runId);
|
|
165
|
-
controllerResult = {
|
|
166
|
-
...before,
|
|
167
|
-
...runId ? { runId } : {}
|
|
168
|
-
};
|
|
169
|
-
result = started.status === "rejected" ? 3 : started.status === "pending" ? 4 : 0;
|
|
170
|
-
}
|
|
171
|
-
let review = readReview(result && typeof result === "object" && "result" in result ? result.result : void 0);
|
|
172
|
-
if (!review && result === 0 && await isFreshReview(ctx.cwd, feature)) try {
|
|
173
|
-
review = readReview(JSON.parse(await readFile(join(ctx.cwd, "specs", "reports", `${feature}.verdict.json`), "utf8")));
|
|
174
|
-
} catch {}
|
|
175
|
-
else if (!review && result === 0) review = null;
|
|
176
|
-
const decision = result === 4 ? void 0 : decideLoop(review, previous?.blockingKey, round, maxRounds);
|
|
177
|
-
const output = {
|
|
178
|
-
...controllerResult,
|
|
179
|
-
status: result === 4 ? "pending" : result === 0 ? "completed" : "rejected",
|
|
180
|
-
phase: decision?.outcome === "ship" || decision?.outcome === "abort" ? "done" : controllerResult.phase,
|
|
181
|
-
...decision?.outcome === "ship" ? { outcome: "ship" } : decision?.outcome === "abort" ? {
|
|
182
|
-
outcome: "abort",
|
|
183
|
-
reason: decision.reason
|
|
184
|
-
} : result !== 4 ? {
|
|
185
|
-
outcome: "abort",
|
|
186
|
-
reason: "run-rejected"
|
|
187
|
-
} : {},
|
|
188
|
-
...decision?.outcome === "continue" ? { blockingKey: decision.key } : {},
|
|
189
|
-
updatedAt: ctx.clock.now(),
|
|
190
|
-
...result === 4 ? {} : { history: [...controllerResult.history ?? [], {
|
|
191
|
-
round,
|
|
192
|
-
...controllerResult.runId ? { runId: controllerResult.runId } : {},
|
|
193
|
-
status: result === 0 ? "completed" : "rejected",
|
|
194
|
-
...decision?.outcome ? { outcome: decision.outcome } : { outcome: "abort" },
|
|
195
|
-
...decision?.outcome === "abort" ? { reason: decision.reason } : result !== 0 ? { reason: "run-rejected" } : {},
|
|
196
|
-
...decision?.outcome === "continue" ? { blockingKey: decision.key } : {},
|
|
197
|
-
updatedAt: ctx.clock.now()
|
|
198
|
-
}] }
|
|
199
|
-
};
|
|
200
|
-
await writeFile(reportPath, `${JSON.stringify(output, null, 2)}\n`, "utf8");
|
|
201
|
-
if (args.json) ctx.stdio.stdout.write(`${JSON.stringify({
|
|
202
|
-
...output,
|
|
203
|
-
reportPath
|
|
204
|
-
})}\n`);
|
|
205
|
-
else ctx.stdio.stdout.write(`loop ${output.status}: ${reportPath}\n`);
|
|
206
|
-
return result;
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
//#endregion
|
|
210
|
-
export { loop as default };
|
|
211
|
-
|
|
212
|
-
//# sourceMappingURL=loop-BWsUpyus.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loop-BWsUpyus.mjs","names":[],"sources":["../../../../apps/cli/src/commands/loop/reducer.ts","../../../../apps/cli/src/commands/loop/index.ts"],"sourcesContent":["import type { ReviewResult } from '@cohorte/protocol';\n\nexport type LoopReducerDecision =\n | { outcome: 'ship' }\n | { outcome: 'continue'; key: string }\n | { outcome: 'abort'; reason: string };\n\n/**\n * The V2 loop reducer, kept pure so a CLI invocation and a resumed run apply\n * exactly the same safety rules. A missing/invalid review never counts as a\n * clean review.\n */\nexport function decideLoop(\n review: ReviewResult | null,\n lastKey: string | undefined,\n round: number,\n maxRounds: number,\n): LoopReducerDecision {\n if (!review) return { outcome: 'abort', reason: 'review-died' };\n if (review.verdict === 'needs-human' && review.unreviewed.length > 0) {\n return { outcome: 'abort', reason: 'unreviewed' };\n }\n if (review.unreviewed.length > 0) return { outcome: 'abort', reason: 'unreviewed' };\n if (review.verdict === 'needs-human' || review.deferred.length > 0) {\n return { outcome: 'abort', reason: 'approval-required' };\n }\n if (review.clean && review.blocking === 0) return { outcome: 'ship' };\n if (!Number.isInteger(review.blocking) || review.blocking < 0) {\n return { outcome: 'abort', reason: 'no-verdict' };\n }\n if (review.blocking === 0) return { outcome: 'ship' };\n const key = review.blockingItems.join('\\n');\n if (!key) return { outcome: 'abort', reason: 'no-verdict' };\n if (lastKey !== undefined && key === lastKey) return { outcome: 'abort', reason: 'treading-water' };\n if (round >= maxRounds) return { outcome: 'abort', reason: 'max-rounds' };\n return { outcome: 'continue', key };\n}\n\n/** Extract only a closed ReviewResult from a controller/report payload. */\nexport function readReview(value: unknown): ReviewResult | null {\n if (!value || typeof value !== 'object') return null;\n const candidate = value as Partial<ReviewResult>;\n if (\n (candidate.verdict !== 'approved' && candidate.verdict !== 'findings' && candidate.verdict !== 'needs-human') ||\n !Array.isArray(candidate.unreviewed) ||\n !Array.isArray(candidate.deferred) ||\n !Array.isArray(candidate.blockingItems) ||\n typeof candidate.blocking !== 'number' ||\n typeof candidate.clean !== 'boolean'\n ) {\n return null;\n }\n return candidate as ReviewResult;\n}\n","import { mkdir, readFile, stat, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport type { ActivePipelineState } from '@cohorte/protocol';\nimport type { CommandModule } from '../../contract/index.ts';\nimport { resolveSpecPath } from '../../project/spec-path.ts';\nimport { decideLoop, readReview } from './reducer.ts';\n\ntype LoopSnapshot = {\n id: string;\n round: number;\n maxRounds: number;\n phase: 'build' | 'review' | 'fix' | 'done';\n status: 'running' | 'pending' | 'completed' | 'rejected';\n runId?: string;\n outcome?: 'ship' | 'abort';\n reason?: string;\n blockingKey?: string;\n surfaces?: string[];\n history?: Array<{\n round: number;\n runId?: string;\n status: 'completed' | 'rejected';\n outcome?: 'ship' | 'abort' | 'continue';\n reason?: string;\n blockingKey?: string;\n updatedAt: string;\n }>;\n startedAt: string;\n updatedAt: string;\n};\n\nconst LOOP_PHASES = [\n 'PREFLIGHT',\n 'BUILD',\n 'TEST',\n 'REVIEW',\n 'FIX',\n 'TEST',\n 'REVIEW',\n 'SHIP',\n] as const satisfies readonly ActivePipelineState[];\n\nconst ACTIVE_STATES = new Set([\n 'PREFLIGHT',\n 'BRAINSTORM',\n 'SPEC',\n 'BUILD',\n 'TEST',\n 'REVIEW',\n 'FIX',\n 'SHIP',\n 'SUSPENDED',\n]);\n\nfunction valueAfter(values: readonly string[], flag: string): string | undefined {\n const index = values.indexOf(flag);\n return index < 0 ? undefined : values[index + 1];\n}\n\nasync function isFreshReview(cwd: string, feature: string): Promise<boolean> {\n try {\n const [spec, verdict] = await Promise.all([\n stat(join(cwd, 'specs', `${feature}.md`)),\n stat(join(cwd, 'specs', 'reports', `${feature}.verdict.json`)),\n ]);\n return verdict.mtimeMs >= spec.mtimeMs;\n } catch {\n return false;\n }\n}\n\nconst loop: CommandModule = {\n verb: 'loop',\n async run(ctx, args) {\n const feature = args.positionals.find(\n (value, index) =>\n !value.startsWith('--') &&\n args.positionals[index - 1] !== '--max-rounds' &&\n args.positionals[index - 1] !== '--wait',\n );\n if (!feature) return 2;\n const parsedMax = Number(valueAfter(args.positionals, '--max-rounds') ?? 5);\n const maxRounds = Number.isInteger(parsedMax) ? Math.min(10, Math.max(1, parsedMax)) : 5;\n const surfaces = (valueAfter(args.positionals, '--surfaces') ?? '')\n .split(',')\n .map((value) => value.trim())\n .filter(Boolean);\n const reportPath = join(ctx.cwd, 'specs', 'reports', `${feature}.loop.json`);\n let previous: Partial<LoopSnapshot> | undefined;\n try {\n previous = JSON.parse(await readFile(reportPath, 'utf8')) as Partial<LoopSnapshot>;\n } catch {}\n const round =\n previous?.status === 'completed' && !previous.outcome\n ? Math.max(1, Number(previous.round) || 1) + 1\n : previous?.outcome\n ? 1\n : Math.max(1, Number(previous?.round) || 1);\n const now = ctx.clock.now();\n const before: LoopSnapshot = {\n id: feature,\n round,\n maxRounds,\n phase: round === 1 ? 'build' : 'fix',\n status: 'running',\n ...(surfaces.length > 0 ? { surfaces } : previous?.surfaces ? { surfaces: previous.surfaces } : {}),\n ...(previous?.history ? { history: previous.history } : {}),\n startedAt: previous?.startedAt ?? now,\n updatedAt: now,\n };\n await mkdir(join(ctx.cwd, 'specs', 'reports'), { recursive: true });\n await writeFile(reportPath, `${JSON.stringify(before, null, 2)}\\n`, 'utf8');\n\n let result: number;\n let controllerResult: LoopSnapshot = before;\n if (previous?.status === 'pending' && previous.runId) {\n controllerResult = { ...before, runId: previous.runId };\n try {\n const tree = await ctx.openStore().then(async (store) => {\n try {\n return await store.readRunTree(previous?.runId as never);\n } finally {\n await store.close();\n }\n });\n const state = tree.run.state;\n if (ACTIVE_STATES.has(state)) {\n controllerResult = { ...controllerResult, phase: previous.phase ?? 'build', status: 'pending' };\n await writeFile(reportPath, `${JSON.stringify(controllerResult, null, 2)}\\n`, 'utf8');\n if (args.json) ctx.stdio.stdout.write(`${JSON.stringify({ ...controllerResult, reportPath })}\\n`);\n else ctx.stdio.stdout.write(`loop pending: ${reportPath}\\n`);\n return 4;\n }\n result = state === 'COMPLETED' ? 0 : state === 'CANCELLED' ? 16 : 3;\n } catch {\n // If the state store cannot be read, do not claim that a pending run is resumable.\n result = 4;\n }\n } else {\n const started = await ctx.controller.send('start', {\n profile: 'feature',\n spec: { path: resolveSpecPath(ctx.cwd, feature) },\n phases: [...LOOP_PHASES],\n ...(surfaces.length > 0\n ? { surfaces: surfaces as never }\n : previous?.surfaces\n ? { surfaces: previous.surfaces as never }\n : {}),\n withFix: true,\n unattended: true,\n });\n const runId =\n started.result && typeof started.result === 'object' && 'runId' in started.result\n ? String((started.result as { runId: string }).runId)\n : undefined;\n if (runId && started.status === 'pending') await ctx.hostSpawner.spawnDetached(runId as never);\n controllerResult = { ...before, ...(runId ? { runId } : {}) };\n result = started.status === 'rejected' ? 3 : started.status === 'pending' ? 4 : 0;\n }\n let review = readReview(\n result && typeof result === 'object' && 'result' in result ? (result as { result?: unknown }).result : undefined,\n );\n if (!review && result === 0 && (await isFreshReview(ctx.cwd, feature))) {\n try {\n review = readReview(\n JSON.parse(await readFile(join(ctx.cwd, 'specs', 'reports', `${feature}.verdict.json`), 'utf8')),\n );\n } catch {\n // A completed Pi command without a durable verdict is not a successful loop.\n }\n } else if (!review && result === 0) {\n // A stale verdict is deliberately ignored: V2 treats it as uncovered review,\n // never as evidence that the new build is clean.\n review = null;\n }\n const decision = result === 4 ? undefined : decideLoop(review, previous?.blockingKey, round, maxRounds);\n const output = {\n ...controllerResult,\n status: result === 4 ? 'pending' : result === 0 ? 'completed' : 'rejected',\n phase: decision?.outcome === 'ship' || decision?.outcome === 'abort' ? 'done' : controllerResult.phase,\n ...(decision?.outcome === 'ship'\n ? { outcome: 'ship' as const }\n : decision?.outcome === 'abort'\n ? { outcome: 'abort' as const, reason: decision.reason }\n : result !== 4\n ? { outcome: 'abort' as const, reason: 'run-rejected' }\n : {}),\n ...(decision?.outcome === 'continue' ? { blockingKey: decision.key } : {}),\n updatedAt: ctx.clock.now(),\n ...(result === 4\n ? {}\n : {\n history: [\n ...(controllerResult.history ?? []),\n {\n round,\n ...(controllerResult.runId ? { runId: controllerResult.runId } : {}),\n status: result === 0 ? ('completed' as const) : ('rejected' as const),\n ...(decision?.outcome ? { outcome: decision.outcome } : { outcome: 'abort' as const }),\n ...(decision?.outcome === 'abort'\n ? { reason: decision.reason }\n : result !== 0\n ? { reason: 'run-rejected' }\n : {}),\n ...(decision?.outcome === 'continue' ? { blockingKey: decision.key } : {}),\n updatedAt: ctx.clock.now(),\n },\n ],\n }),\n } satisfies LoopSnapshot;\n await writeFile(reportPath, `${JSON.stringify(output, null, 2)}\\n`, 'utf8');\n if (args.json) ctx.stdio.stdout.write(`${JSON.stringify({ ...output, reportPath })}\\n`);\n else ctx.stdio.stdout.write(`loop ${output.status}: ${reportPath}\\n`);\n return result;\n },\n};\n\nexport default loop;\n"],"mappings":";;;;;;;;;AAYA,SAAgB,WACd,QACA,SACA,OACA,WACqB;CACrB,IAAI,CAAC,QAAQ,OAAO;EAAE,SAAS;EAAS,QAAQ;CAAc;CAC9D,IAAI,OAAO,YAAY,iBAAiB,OAAO,WAAW,SAAS,GACjE,OAAO;EAAE,SAAS;EAAS,QAAQ;CAAa;CAElD,IAAI,OAAO,WAAW,SAAS,GAAG,OAAO;EAAE,SAAS;EAAS,QAAQ;CAAa;CAClF,IAAI,OAAO,YAAY,iBAAiB,OAAO,SAAS,SAAS,GAC/D,OAAO;EAAE,SAAS;EAAS,QAAQ;CAAoB;CAEzD,IAAI,OAAO,SAAS,OAAO,aAAa,GAAG,OAAO,EAAE,SAAS,OAAO;CACpE,IAAI,CAAC,OAAO,UAAU,OAAO,QAAQ,KAAK,OAAO,WAAW,GAC1D,OAAO;EAAE,SAAS;EAAS,QAAQ;CAAa;CAElD,IAAI,OAAO,aAAa,GAAG,OAAO,EAAE,SAAS,OAAO;CACpD,MAAM,MAAM,OAAO,cAAc,KAAK,IAAI;CAC1C,IAAI,CAAC,KA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,SAAS,QAAQ,IAAI,EAAE,SAAS,QAAiB;IACpF,GAAI,UAAU,YAAY,UACtB,EAAE,QAAQ,SAAS,OAAO,IAC1B,WAAW,IACT,EAAE,QAAQ,eAAe,IACzB,CAAC;IACP,GAAI,UAAU,YAAY,aAAa,EAAE,aAAa,SAAS,IAAI,IAAI,CAAC;IACxE,WAAW,IAAI,MAAM,IAAI;GAC3B,CACF,EACF;EACN;EACA,MAAM,UAAU,YAAY,GAAG,KAAK,UAAU,QAAQ,MAAM,CAAC,EAAE,KAAK,MAAM;EAC1E,IAAI,KAAK,MAAM,IAAI,MAAM,OAAO,MAAM,GAAG,KAAK,UAAU;GAAE,GAAG;GAAQ;EAAW,CAAC,EAAE,GAAG;OACjF,IAAI,MAAM,OAAO,MAAM,QAAQ,OAAO,OAAO,IAAI,WAAW,GAAG;EACpE,OAAO;CACT;AACF"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { c as rollbackV2Import } from "./src-DNsLSxgm.mjs";
|
|
2
|
-
import { readFile, writeFile } from "node:fs/promises";
|
|
3
|
-
import { join, resolve } from "node:path";
|
|
4
|
-
//#region src/commands/migrate/index.ts
|
|
5
|
-
const migrate = {
|
|
6
|
-
verb: "migrate",
|
|
7
|
-
async run(ctx, args) {
|
|
8
|
-
const rollback = args.positionals.indexOf("--rollback");
|
|
9
|
-
if (rollback !== -1) {
|
|
10
|
-
const reportId = args.positionals[rollback + 1];
|
|
11
|
-
if (!reportId) throw new Error("configuration/import-invalid: migrate --rollback requires a report id");
|
|
12
|
-
const reportPath = join(resolve(ctx.cwd), ".cohorte", "import-reports", `${reportId}.json`);
|
|
13
|
-
const report = JSON.parse(await readFile(reportPath, "utf8"));
|
|
14
|
-
const rolledBack = await rollbackV2Import(report);
|
|
15
|
-
await writeFile(reportPath, `${JSON.stringify(rolledBack, null, 2)}\n`, { mode: 384 });
|
|
16
|
-
ctx.stdio.stdout.write(`${JSON.stringify(rolledBack)}\n`);
|
|
17
|
-
return 0;
|
|
18
|
-
}
|
|
19
|
-
const store = await (ctx.openMigrationStore ?? ctx.openStore)();
|
|
20
|
-
try {
|
|
21
|
-
const apply = args.positionals.includes("--apply");
|
|
22
|
-
const report = await store.migrate(apply ? "apply" : "check");
|
|
23
|
-
ctx.stdio.stdout.write(`${JSON.stringify(report)}\n`);
|
|
24
|
-
return !apply && report.pending.length > 0 ? 3 : 0;
|
|
25
|
-
} finally {
|
|
26
|
-
await store.close();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
//#endregion
|
|
31
|
-
export { migrate as default };
|
|
32
|
-
|
|
33
|
-
//# sourceMappingURL=migrate-DuYCAbE3.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-DuYCAbE3.mjs","names":[],"sources":["../../../../apps/cli/src/commands/migrate/index.ts"],"sourcesContent":["// apps/cli/src/commands/migrate/index.ts — DESIGN §9 verb `migrate` (PLAN §3 rule 3 \"later units fill\n// stub files that lie inside their owned paths; they never edit ... the registry\"). Wave-0 stub: exits with the\n// documented not-available error (spec 24 `configuration/phase-not-available`); filled by the Wave-4/5\n// unit that owns `apps/cli/src/commands/migrate/**`.\nimport { readFile, writeFile } from 'node:fs/promises';\nimport { join, resolve } from 'node:path';\nimport { rollbackV2Import, type V2ImportReport } from '@cohorte/project-model';\nimport type { CommandModule } from '../../contract/index.ts';\n\nconst migrate: CommandModule = {\n verb: 'migrate',\n async run(ctx, args) {\n const rollback = args.positionals.indexOf('--rollback');\n if (rollback !== -1) {\n const reportId = args.positionals[rollback + 1];\n if (!reportId) throw new Error('configuration/import-invalid: migrate --rollback requires a report id');\n const reportPath = join(resolve(ctx.cwd), '.cohorte', 'import-reports', `${reportId}.json`);\n const report = JSON.parse(await readFile(reportPath, 'utf8')) as V2ImportReport;\n const rolledBack = await rollbackV2Import(report);\n await writeFile(reportPath, `${JSON.stringify(rolledBack, null, 2)}\\n`, { mode: 0o600 });\n ctx.stdio.stdout.write(`${JSON.stringify(rolledBack)}\\n`);\n return 0;\n }\n const store = await (ctx.openMigrationStore ?? ctx.openStore)();\n try {\n const apply = args.positionals.includes('--apply');\n const report = await store.migrate(apply ? 'apply' : 'check');\n ctx.stdio.stdout.write(`${JSON.stringify(report)}\\n`);\n return !apply && report.pending.length > 0 ? 3 : 0;\n } finally {\n await store.close();\n }\n },\n};\n\nexport default migrate;\n"],"mappings":";;;;AASA,MAAM,UAAyB;CAC7B,MAAM;CACN,MAAM,IAAI,KAAK,MAAM;EACnB,MAAM,WAAW,KAAK,YAAY,QAAQ,YAAY;EACtD,IAAI,aAAa,IAAI;GACnB,MAAM,WAAW,KAAK,YAAY,WAAW;GAC7C,IAAI,CAAC,UAAU,MAAM,IAAI,MAAM,uEAAuE;GACtG,MAAM,aAAa,KAAK,QAAQ,IAAI,GAAG,GAAG,YAAY,kBAAkB,GAAG,SAAS,MAAM;GAC1F,MAAM,SAAS,KAAK,MAAM,MAAM,SAAS,YAAY,MAAM,CAAC;GAC5D,MAAM,aAAa,MAAM,iBAAiB,MAAM;GAChD,MAAM,UAAU,YAAY,GAAG,KAAK,UAAU,YAAY,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,IAAM,CAAC;GACvF,IAAI,MAAM,OAAO,MAAM,GAAG,KAAK,UAAU,UAAU,EAAE,GAAG;GACxD,OAAO;EACT;EACA,MAAM,QAAQ,OAAO,IAAI,sBAAsB,IAAI,UAAA,CAAW;EAC9D,IAAI;GACF,MAAM,QAAQ,KAAK,YAAY,SAAS,SAAS;GACjD,MAAM,SAAS,MAAM,MAAM,QAAQ,QAAQ,UAAU,OAAO;GAC5D,IAAI,MAAM,OAAO,MAAM,GAAG,KAAK,UAAU,MAAM,EAAE,GAAG;GACpD,OAAO,CAAC,SAAS,OAAO,QAAQ,SAAS,IAAI,IAAI;EACnD,UAAU;GACR,MAAM,MAAM,MAAM;EACpB;CACF;AACF"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
//#region src/commands/models/index.ts
|
|
2
|
-
const MODELS = [{
|
|
3
|
-
provider: "openai-codex",
|
|
4
|
-
model: "gpt-5.5",
|
|
5
|
-
capabilities: ["coding", "reasoning"]
|
|
6
|
-
}, {
|
|
7
|
-
provider: "openai-codex",
|
|
8
|
-
model: "gpt-5.4-mini",
|
|
9
|
-
capabilities: ["fast", "cheap"]
|
|
10
|
-
}];
|
|
11
|
-
const models = {
|
|
12
|
-
verb: "models",
|
|
13
|
-
async run(ctx, args) {
|
|
14
|
-
if (args.subVerb !== "list" && args.subVerb !== void 0) return 10;
|
|
15
|
-
const value = { models: MODELS };
|
|
16
|
-
if (args.json) ctx.stdio.stdout.write(`${JSON.stringify(value)}\n`);
|
|
17
|
-
else for (const model of MODELS) ctx.stdio.stdout.write(`${model.provider}/${model.model}\n`);
|
|
18
|
-
return 0;
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
//#endregion
|
|
22
|
-
export { models as default };
|
|
23
|
-
|
|
24
|
-
//# sourceMappingURL=models-Btp6X2YZ.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"models-Btp6X2YZ.mjs","names":[],"sources":["../../../../apps/cli/src/commands/models/index.ts"],"sourcesContent":["// apps/cli/src/commands/models/index.ts — DESIGN §9 verb `models` (PLAN §3 rule 3 \"later units fill\n// stub files that lie inside their owned paths; they never edit ... the registry\"). Wave-0 stub: exits with the\n// documented not-available error (spec 24 `configuration/phase-not-available`); filled by the Wave-4/5\n// unit that owns `apps/cli/src/commands/models/**`.\nimport type { CommandModule } from '../../contract/index.ts';\n\nconst MODELS = [\n { provider: 'openai-codex', model: 'gpt-5.5', capabilities: ['coding', 'reasoning'] },\n { provider: 'openai-codex', model: 'gpt-5.4-mini', capabilities: ['fast', 'cheap'] },\n] as const;\n\nconst models: CommandModule = {\n verb: 'models',\n async run(ctx, args) {\n if (args.subVerb !== 'list' && args.subVerb !== undefined) return 10;\n const value = { models: MODELS };\n if (args.json) ctx.stdio.stdout.write(`${JSON.stringify(value)}\\n`);\n else for (const model of MODELS) ctx.stdio.stdout.write(`${model.provider}/${model.model}\\n`);\n return 0;\n },\n};\n\nexport default models;\n"],"mappings":";AAMA,MAAM,SAAS,CACb;CAAE,UAAU;CAAgB,OAAO;CAAW,cAAc,CAAC,UAAU,WAAW;AAAE,GACpF;CAAE,UAAU;CAAgB,OAAO;CAAgB,cAAc,CAAC,QAAQ,OAAO;AAAE,CACrF;AAEA,MAAM,SAAwB;CAC5B,MAAM;CACN,MAAM,IAAI,KAAK,MAAM;EACnB,IAAI,KAAK,YAAY,UAAU,KAAK,YAAY,KAAA,GAAW,OAAO;EAClE,MAAM,QAAQ,EAAE,QAAQ,OAAO;EAC/B,IAAI,KAAK,MAAM,IAAI,MAAM,OAAO,MAAM,GAAG,KAAK,UAAU,KAAK,EAAE,GAAG;OAC7D,KAAK,MAAM,SAAS,QAAQ,IAAI,MAAM,OAAO,MAAM,GAAG,MAAM,SAAS,GAAG,MAAM,MAAM,GAAG;EAC5F,OAAO;CACT;AACF"}
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import { access, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
2
|
-
import { dirname, join, resolve } from "node:path";
|
|
3
|
-
import { parse, stringify } from "yaml";
|
|
4
|
-
//#region \0rolldown/runtime.js
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __exportAll = (all, no_symbols) => {
|
|
7
|
-
let target = {};
|
|
8
|
-
for (var name in all) __defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: true
|
|
11
|
-
});
|
|
12
|
-
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
13
|
-
return target;
|
|
14
|
-
};
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region src/commands/obsidian/index.ts
|
|
17
|
-
var obsidian_exports = /* @__PURE__ */ __exportAll({
|
|
18
|
-
configuredIdeas: () => configuredIdeas,
|
|
19
|
-
default: () => obsidian,
|
|
20
|
-
moveConfiguredCard: () => moveConfiguredCard
|
|
21
|
-
});
|
|
22
|
-
const COLUMNS = [
|
|
23
|
-
"Ideas",
|
|
24
|
-
"Brainstorm",
|
|
25
|
-
"Spec",
|
|
26
|
-
"Ready to build",
|
|
27
|
-
"Building",
|
|
28
|
-
"Review",
|
|
29
|
-
"Fix",
|
|
30
|
-
"Ship",
|
|
31
|
-
"Shipped"
|
|
32
|
-
];
|
|
33
|
-
const STAGES = /* @__PURE__ */ new Map([
|
|
34
|
-
["ideas", "Ideas"],
|
|
35
|
-
["brainstorm", "Brainstorm"],
|
|
36
|
-
["spec", "Spec"],
|
|
37
|
-
["ready", "Ready to build"],
|
|
38
|
-
["building", "Building"],
|
|
39
|
-
["review", "Review"],
|
|
40
|
-
["fix", "Fix"],
|
|
41
|
-
["ship", "Ship"],
|
|
42
|
-
["shipped", "Shipped"]
|
|
43
|
-
]);
|
|
44
|
-
const BOARD_TEMPLATE = `---
|
|
45
|
-
kanban-plugin: board
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
${COLUMNS.map((column) => `## ${column}\n`).join("\n")}
|
|
49
|
-
%% kanban:settings
|
|
50
|
-
\`\`\`
|
|
51
|
-
{"kanban-plugin":"board","list-collapse":[false,false,false,false,false,false,false,false,false]}
|
|
52
|
-
\`\`\`
|
|
53
|
-
%%
|
|
54
|
-
`;
|
|
55
|
-
function parseCards(source) {
|
|
56
|
-
const lines = source.split(/\r?\n/);
|
|
57
|
-
let column = "";
|
|
58
|
-
const cards = [];
|
|
59
|
-
lines.forEach((line, lineIndex) => {
|
|
60
|
-
const heading = /^##\s+(.+?)\s*$/.exec(line);
|
|
61
|
-
if (heading) {
|
|
62
|
-
column = heading[1] ?? "";
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
const card = /^-\s+\[([ xX])\]\s+(.+)$/.exec(line);
|
|
66
|
-
if (!card || !column) return;
|
|
67
|
-
const title = card[2] ?? "";
|
|
68
|
-
const tag = /#([a-z0-9][a-z0-9-]*)\b/i.exec(title);
|
|
69
|
-
if (!tag) return;
|
|
70
|
-
cards.push({
|
|
71
|
-
id: (tag[1] ?? "").toLowerCase(),
|
|
72
|
-
title,
|
|
73
|
-
checked: (card[1] ?? "").toLowerCase() === "x",
|
|
74
|
-
column,
|
|
75
|
-
line: lineIndex
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
return cards;
|
|
79
|
-
}
|
|
80
|
-
async function configuredIdeas(home) {
|
|
81
|
-
const resolved = await boardPath(home);
|
|
82
|
-
return parseCards(await readFile(resolved.path, "utf8")).filter((card) => card.column === "Ideas");
|
|
83
|
-
}
|
|
84
|
-
async function loadUserConfig(home) {
|
|
85
|
-
const path = join(home, ".cohorte", "config.yaml");
|
|
86
|
-
try {
|
|
87
|
-
const value = parse(await readFile(path, "utf8"));
|
|
88
|
-
return {
|
|
89
|
-
path,
|
|
90
|
-
value: value && typeof value === "object" ? value : {}
|
|
91
|
-
};
|
|
92
|
-
} catch (error) {
|
|
93
|
-
if (error.code !== "ENOENT") throw error;
|
|
94
|
-
return {
|
|
95
|
-
path,
|
|
96
|
-
value: {}
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
function configured(value) {
|
|
101
|
-
const integrations = value.integrations;
|
|
102
|
-
if (!integrations || typeof integrations !== "object") return void 0;
|
|
103
|
-
const obsidian = integrations.obsidian;
|
|
104
|
-
if (!obsidian || typeof obsidian !== "object") return void 0;
|
|
105
|
-
const { vaultPath, board } = obsidian;
|
|
106
|
-
return typeof vaultPath === "string" && typeof board === "string" ? {
|
|
107
|
-
vaultPath,
|
|
108
|
-
board
|
|
109
|
-
} : void 0;
|
|
110
|
-
}
|
|
111
|
-
async function boardPath(home) {
|
|
112
|
-
const config = configured((await loadUserConfig(home)).value);
|
|
113
|
-
if (!config) throw new Error("Obsidian is not configured; run `cohorte obsidian connect <vault> <board>`");
|
|
114
|
-
const path = resolve(config.vaultPath, config.board);
|
|
115
|
-
await access(path);
|
|
116
|
-
return {
|
|
117
|
-
config,
|
|
118
|
-
path
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
function replaceCard(source, id, target, title = id) {
|
|
122
|
-
const lines = source.split(/\r?\n/);
|
|
123
|
-
const cards = parseCards(source);
|
|
124
|
-
if (!COLUMNS.includes(target)) throw new Error(`Unknown Obsidian column: ${target}`);
|
|
125
|
-
const matches = cards.filter((item) => item.id === id);
|
|
126
|
-
const card = matches[0];
|
|
127
|
-
if (!card) {
|
|
128
|
-
const heading = lines.indexOf(`## ${target}`);
|
|
129
|
-
if (heading < 0) throw new Error(`Obsidian column ${target} was not found`);
|
|
130
|
-
let insert = heading + 1;
|
|
131
|
-
while (insert < lines.length && !(lines[insert] ?? "").startsWith("## ")) insert++;
|
|
132
|
-
lines.splice(insert, 0, `- [ ] ${title} #${id}`);
|
|
133
|
-
return lines.join("\n");
|
|
134
|
-
}
|
|
135
|
-
for (const duplicate of matches.slice(1).sort((a, b) => b.line - a.line)) lines.splice(duplicate.line, 1);
|
|
136
|
-
if (card.column === target) return lines.join("\n");
|
|
137
|
-
const line = lines[card.line] ?? "";
|
|
138
|
-
lines.splice(card.line, 1);
|
|
139
|
-
let heading = lines.indexOf(`## ${target}`);
|
|
140
|
-
if (heading < 0) {
|
|
141
|
-
if (!source.endsWith("\n")) lines.push("");
|
|
142
|
-
lines.push(`## ${target}`, "");
|
|
143
|
-
heading = lines.length - 2;
|
|
144
|
-
}
|
|
145
|
-
let insert = heading + 1;
|
|
146
|
-
while (insert < lines.length && !(lines[insert] ?? "").startsWith("## ")) insert++;
|
|
147
|
-
lines.splice(insert, 0, line);
|
|
148
|
-
return lines.join("\n");
|
|
149
|
-
}
|
|
150
|
-
/** Best-effort V2-compatible board mirror used by phase entry points. A missing or unconfigured board is a no-op. */
|
|
151
|
-
async function moveConfiguredCard(home, id, stage, title = id) {
|
|
152
|
-
try {
|
|
153
|
-
const resolved = await boardPath(home);
|
|
154
|
-
const source = await readFile(resolved.path, "utf8");
|
|
155
|
-
const next = replaceCard(source, id, STAGES.get(stage) ?? stage, title);
|
|
156
|
-
if (next !== source) await writeFile(resolved.path, next, "utf8");
|
|
157
|
-
return true;
|
|
158
|
-
} catch (error) {
|
|
159
|
-
if (error.code === "ENOENT" || String(error).includes("not configured")) return false;
|
|
160
|
-
throw error;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
const obsidian = {
|
|
164
|
-
verb: "obsidian",
|
|
165
|
-
async run(ctx, args) {
|
|
166
|
-
const home = ctx.env.HOME ?? ctx.cwd;
|
|
167
|
-
if (args.subVerb === "create") {
|
|
168
|
-
const [vaultPath, board = "Weave/Tasks.md"] = args.positionals;
|
|
169
|
-
if (!vaultPath) return 2;
|
|
170
|
-
const path = resolve(vaultPath, board);
|
|
171
|
-
try {
|
|
172
|
-
await access(path);
|
|
173
|
-
throw new Error(`Obsidian board already exists: ${path}`);
|
|
174
|
-
} catch (error) {
|
|
175
|
-
if (error.code !== "ENOENT") throw error;
|
|
176
|
-
}
|
|
177
|
-
await mkdir(dirname(path), { recursive: true });
|
|
178
|
-
await writeFile(path, BOARD_TEMPLATE, "utf8");
|
|
179
|
-
const loaded = await loadUserConfig(home);
|
|
180
|
-
const integrations = loaded.value.integrations;
|
|
181
|
-
const nextIntegrations = integrations && typeof integrations === "object" ? { ...integrations } : {};
|
|
182
|
-
nextIntegrations.obsidian = {
|
|
183
|
-
vaultPath,
|
|
184
|
-
board
|
|
185
|
-
};
|
|
186
|
-
loaded.value.integrations = nextIntegrations;
|
|
187
|
-
await mkdir(dirname(loaded.path), { recursive: true });
|
|
188
|
-
await writeFile(loaded.path, stringify(loaded.value), "utf8");
|
|
189
|
-
ctx.stdio.stdout.write(`created and connected ${path}\n`);
|
|
190
|
-
return 0;
|
|
191
|
-
}
|
|
192
|
-
if (args.subVerb === "connect") {
|
|
193
|
-
const [vaultPath, board = "Weave/Tasks.md"] = args.positionals;
|
|
194
|
-
if (!vaultPath) return 2;
|
|
195
|
-
const loaded = await loadUserConfig(home);
|
|
196
|
-
const integrations = loaded.value.integrations;
|
|
197
|
-
const nextIntegrations = integrations && typeof integrations === "object" ? { ...integrations } : {};
|
|
198
|
-
nextIntegrations.obsidian = {
|
|
199
|
-
vaultPath,
|
|
200
|
-
board
|
|
201
|
-
};
|
|
202
|
-
loaded.value.integrations = nextIntegrations;
|
|
203
|
-
await mkdir(dirname(loaded.path), { recursive: true });
|
|
204
|
-
await writeFile(loaded.path, stringify(loaded.value), "utf8");
|
|
205
|
-
ctx.stdio.stdout.write(`connected ${resolve(vaultPath, board)}\n`);
|
|
206
|
-
return 0;
|
|
207
|
-
}
|
|
208
|
-
if (args.subVerb === "status") {
|
|
209
|
-
const resolved = await boardPath(home);
|
|
210
|
-
const cards = parseCards(await readFile(resolved.path, "utf8"));
|
|
211
|
-
if (args.json) ctx.stdio.stdout.write(`${JSON.stringify({
|
|
212
|
-
...resolved.config,
|
|
213
|
-
path: resolved.path,
|
|
214
|
-
cards
|
|
215
|
-
})}\n`);
|
|
216
|
-
else ctx.stdio.stdout.write(`${resolved.path}\n${cards.map((card) => `${card.id}\t${card.column}\t${card.title}`).join("\n")}\n`);
|
|
217
|
-
return 0;
|
|
218
|
-
}
|
|
219
|
-
if (args.subVerb === "move") {
|
|
220
|
-
const [id, stage] = args.positionals;
|
|
221
|
-
const target = stage ? STAGES.get(stage) ?? stage : void 0;
|
|
222
|
-
if (!id || !target) return 2;
|
|
223
|
-
const resolved = await boardPath(home);
|
|
224
|
-
const source = await readFile(resolved.path, "utf8");
|
|
225
|
-
await writeFile(resolved.path, replaceCard(source, id, target), "utf8");
|
|
226
|
-
ctx.stdio.stdout.write(`moved #${id} to ${target}\n`);
|
|
227
|
-
return 0;
|
|
228
|
-
}
|
|
229
|
-
return 2;
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
//#endregion
|
|
233
|
-
export { __exportAll as i, moveConfiguredCard as n, obsidian_exports as r, configuredIdeas as t };
|
|
234
|
-
|
|
235
|
-
//# sourceMappingURL=obsidian-BHLkXx_H.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"obsidian-BHLkXx_H.mjs","names":[],"sources":["../../../../apps/cli/src/commands/obsidian/index.ts"],"sourcesContent":["import { access, mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { dirname, join, resolve } from 'node:path';\nimport { parse, stringify } from 'yaml';\nimport type { CommandModule } from '../../contract/index.ts';\n\nexport type ObsidianCard = { id: string; title: string; checked: boolean; column: string; line: number };\ntype Card = ObsidianCard;\n\nconst COLUMNS = ['Ideas', 'Brainstorm', 'Spec', 'Ready to build', 'Building', 'Review', 'Fix', 'Ship', 'Shipped'];\nconst STAGES = new Map([\n ['ideas', 'Ideas'],\n ['brainstorm', 'Brainstorm'],\n ['spec', 'Spec'],\n ['ready', 'Ready to build'],\n ['building', 'Building'],\n ['review', 'Review'],\n ['fix', 'Fix'],\n ['ship', 'Ship'],\n ['shipped', 'Shipped'],\n]);\n\nconst BOARD_TEMPLATE = `---\nkanban-plugin: board\n---\n\n${COLUMNS.map((column) => `## ${column}\\n`).join('\\n')}\n%% kanban:settings\n\\`\\`\\`\n{\"kanban-plugin\":\"board\",\"list-collapse\":[false,false,false,false,false,false,false,false,false]}\n\\`\\`\\`\n%%\n`;\n\nfunction parseCards(source: string): Card[] {\n const lines = source.split(/\\r?\\n/);\n let column = '';\n const cards: Card[] = [];\n lines.forEach((line, lineIndex) => {\n const heading = /^##\\s+(.+?)\\s*$/.exec(line);\n if (heading) {\n column = heading[1] ?? '';\n return;\n }\n const card = /^-\\s+\\[([ xX])\\]\\s+(.+)$/.exec(line);\n if (!card || !column) return;\n const title = card[2] ?? '';\n const tag = /#([a-z0-9][a-z0-9-]*)\\b/i.exec(title);\n if (!tag) return;\n cards.push({\n id: (tag[1] ?? '').toLowerCase(),\n title,\n checked: (card[1] ?? '').toLowerCase() === 'x',\n column,\n line: lineIndex,\n });\n });\n return cards;\n}\n\nexport async function configuredIdeas(home: string): Promise<ObsidianCard[]> {\n const resolved = await boardPath(home);\n return parseCards(await readFile(resolved.path, 'utf8')).filter((card) => card.column === 'Ideas');\n}\n\nasync function loadUserConfig(home: string): Promise<{ path: string; value: Record<string, unknown> }> {\n const path = join(home, '.cohorte', 'config.yaml');\n try {\n const value = parse(await readFile(path, 'utf8')) as Record<string, unknown>;\n return { path, value: value && typeof value === 'object' ? value : {} };\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error;\n return { path, value: {} };\n }\n}\n\nfunction configured(value: Record<string, unknown>): { vaultPath: string; board: string } | undefined {\n const integrations = value.integrations;\n if (!integrations || typeof integrations !== 'object') return undefined;\n const obsidian = (integrations as Record<string, unknown>).obsidian;\n if (!obsidian || typeof obsidian !== 'object') return undefined;\n const { vaultPath, board } = obsidian as Record<string, unknown>;\n return typeof vaultPath === 'string' && typeof board === 'string' ? { vaultPath, board } : undefined;\n}\n\nasync function boardPath(home: string): Promise<{ config: { vaultPath: string; board: string }; path: string }> {\n const loaded = await loadUserConfig(home);\n const config = configured(loaded.value);\n if (!config) throw new Error('Obsidian is not configured; run `cohorte obsidian connect <vault> <board>`');\n const path = resolve(config.vaultPath, config.board);\n await access(path);\n return { config, path };\n}\n\nfunction replaceCard(source: string, id: string, target: string, title = id): string {\n const lines = source.split(/\\r?\\n/);\n const cards = parseCards(source);\n if (!COLUMNS.includes(target)) throw new Error(`Unknown Obsidian column: ${target}`);\n const matches = cards.filter((item) => item.id === id);\n const card = matches[0];\n if (!card) {\n const heading = lines.indexOf(`## ${target}`);\n if (heading < 0) throw new Error(`Obsidian column ${target} was not found`);\n let insert = heading + 1;\n while (insert < lines.length && !(lines[insert] ?? '').startsWith('## ')) insert++;\n lines.splice(insert, 0, `- [ ] ${title} #${id}`);\n return lines.join('\\n');\n }\n for (const duplicate of matches.slice(1).sort((a, b) => b.line - a.line)) lines.splice(duplicate.line, 1);\n if (card.column === target) return lines.join('\\n');\n const line = lines[card.line] ?? '';\n lines.splice(card.line, 1);\n let heading = lines.indexOf(`## ${target}`);\n if (heading < 0) {\n if (!source.endsWith('\\n')) lines.push('');\n lines.push(`## ${target}`, '');\n heading = lines.length - 2;\n }\n let insert = heading + 1;\n while (insert < lines.length && !(lines[insert] ?? '').startsWith('## ')) insert++;\n lines.splice(insert, 0, line);\n return lines.join('\\n');\n}\n\n/** Best-effort V2-compatible board mirror used by phase entry points. A missing or unconfigured board is a no-op. */\nexport async function moveConfiguredCard(home: string, id: string, stage: string, title = id): Promise<boolean> {\n try {\n const resolved = await boardPath(home);\n const source = await readFile(resolved.path, 'utf8');\n const target = STAGES.get(stage) ?? stage;\n const next = replaceCard(source, id, target, title);\n if (next !== source) await writeFile(resolved.path, next, 'utf8');\n return true;\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT' || String(error).includes('not configured')) return false;\n throw error;\n }\n}\n\nconst obsidian: CommandModule = {\n verb: 'obsidian',\n async run(ctx, args) {\n const home = ctx.env.HOME ?? ctx.cwd;\n if (args.subVerb === 'create') {\n const [vaultPath, board = 'Weave/Tasks.md'] = args.positionals;\n if (!vaultPath) return 2;\n const path = resolve(vaultPath, board);\n try {\n await access(path);\n throw new Error(`Obsidian board already exists: ${path}`);\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error;\n }\n await mkdir(dirname(path), { recursive: true });\n await writeFile(path, BOARD_TEMPLATE, 'utf8');\n const loaded = await loadUserConfig(home);\n const integrations = loaded.value.integrations;\n const nextIntegrations = integrations && typeof integrations === 'object' ? { ...(integrations as object) } : {};\n (nextIntegrations as Record<string, unknown>).obsidian = { vaultPath, board };\n loaded.value.integrations = nextIntegrations;\n await mkdir(dirname(loaded.path), { recursive: true });\n await writeFile(loaded.path, stringify(loaded.value), 'utf8');\n ctx.stdio.stdout.write(`created and connected ${path}\\n`);\n return 0;\n }\n if (args.subVerb === 'connect') {\n const [vaultPath, board = 'Weave/Tasks.md'] = args.positionals;\n if (!vaultPath) return 2;\n const loaded = await loadUserConfig(home);\n const integrations = loaded.value.integrations;\n const nextIntegrations = integrations && typeof integrations === 'object' ? { ...(integrations as object) } : {};\n (nextIntegrations as Record<string, unknown>).obsidian = { vaultPath, board };\n loaded.value.integrations = nextIntegrations;\n await mkdir(dirname(loaded.path), { recursive: true });\n await writeFile(loaded.path, stringify(loaded.value), 'utf8');\n ctx.stdio.stdout.write(`connected ${resolve(vaultPath, board)}\\n`);\n return 0;\n }\n if (args.subVerb === 'status') {\n const resolved = await boardPath(home);\n const cards = parseCards(await readFile(resolved.path, 'utf8'));\n if (args.json) ctx.stdio.stdout.write(`${JSON.stringify({ ...resolved.config, path: resolved.path, cards })}\\n`);\n else\n ctx.stdio.stdout.write(\n `${resolved.path}\\n${cards.map((card) => `${card.id}\\t${card.column}\\t${card.title}`).join('\\n')}\\n`,\n );\n return 0;\n }\n if (args.subVerb === 'move') {\n const [id, stage] = args.positionals;\n const target = stage ? (STAGES.get(stage) ?? stage) : undefined;\n if (!id || !target) return 2;\n const resolved = await boardPath(home);\n const source = await readFile(resolved.path, 'utf8');\n await writeFile(resolved.path, replaceCard(source, id, target), 'utf8');\n ctx.stdio.stdout.write(`moved #${id} to ${target}\\n`);\n return 0;\n }\n return 2;\n },\n};\n\nexport default obsidian;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAQA,MAAM,UAAU;CAAC;CAAS;CAAc;CAAQ;CAAkB;CAAY;CAAU;CAAO;CAAQ;AAAS;AAChH,MAAM,yBAAS,IAAI,IAAI;CACrB,CAAC,SAAS,OAAO;CACjB,CAAC,cAAc,YAAY;CAC3B,CAAC,QAAQ,MAAM;CACf,CAAC,SAAS,gBAAgB;CAC1B,CAAC,YAAY,UAAU;CACvB,CAAC,UAAU,QAAQ;CACnB,CAAC,OAAO,KAAK;CACb,CAAC,QAAQ,MAAM;CACf,CAAC,WAAW,SAAS;AACvB,CAAC;AAED,MAAM,iBAAiB;;;;EAIrB,QAAQ,KAAK,WAAW,MAAM,OAAO,G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