cohorte 2.10.1 → 3.0.0-dev.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/README.md +7 -0
- package/assets/manifest.json +193 -0
- package/assets/migrations/config/README.md +12 -0
- package/assets/migrations/state/0001_init.sql +154 -0
- package/assets/prompts/README.md +11 -0
- package/assets/prompts/agents/fixer.md +7 -0
- package/assets/prompts/agents/implementer.md +12 -0
- package/assets/prompts/agents/reviewer.md +8 -0
- package/assets/prompts/agents/security-reviewer.md +7 -0
- package/assets/prompts/phases/build.md +5 -0
- package/assets/prompts/phases/review.md +5 -0
- package/assets/prompts/phases/test.md +5 -0
- package/assets/prompts/system.md +11 -0
- package/assets/schemas/agent-output.schema.json +225 -0
- package/assets/schemas/auth-status.schema.json +87 -0
- package/assets/schemas/command-result.schema.json +192 -0
- package/assets/schemas/commands.schema.json +952 -0
- package/assets/schemas/config.schema.json +2259 -0
- package/assets/schemas/doctor-report.schema.json +104 -0
- package/assets/schemas/events.schema.json +8514 -0
- package/assets/schemas/fake-script.schema.json +549 -0
- package/assets/schemas/inspect.schema.json +3133 -0
- package/assets/schemas/manifest.schema.json +79 -0
- package/assets/schemas/ownership.schema.json +52 -0
- package/assets/schemas/policy-verdict.schema.json +282 -0
- package/assets/schemas/project-model.schema.json +783 -0
- package/assets/schemas/project-status.schema.json +217 -0
- package/assets/schemas/reconcile-plan.schema.json +154 -0
- package/assets/schemas/run-diff.schema.json +177 -0
- package/assets/schemas/run-snapshot-manifest.schema.json +2104 -0
- package/assets/schemas/run-state.schema.json +1755 -0
- package/assets/schemas/runtime-capabilities.schema.json +1545 -0
- package/assets/schemas/sandbox-capabilities.schema.json +116 -0
- package/assets/schemas/skill.schema.json +87 -0
- package/assets/schemas/spec.schema.json +202 -0
- package/assets/schemas/tool-catalogue.schema.json +655 -0
- package/assets/schemas/trust-record.schema.json +38 -0
- package/assets/skills/README.md +9 -0
- package/assets/skills/inspect-surface.md +4 -0
- package/dist/agent-host.mjs +2187 -0
- package/dist/agent-host.mjs.map +1 -0
- package/dist/bundle-manifest.json +104 -0
- package/dist/chunks/__host-DgGPyco9.mjs +18 -0
- package/dist/chunks/__host-DgGPyco9.mjs.map +1 -0
- package/dist/chunks/approve-Cv135UqI.mjs +19 -0
- package/dist/chunks/approve-Cv135UqI.mjs.map +1 -0
- package/dist/chunks/auth-BT5oVp76.mjs +132 -0
- package/dist/chunks/auth-BT5oVp76.mjs.map +1 -0
- package/dist/chunks/auth-CYOh60KG.mjs +93 -0
- package/dist/chunks/auth-CYOh60KG.mjs.map +1 -0
- package/dist/chunks/brainstorm-BwKA6yZP.mjs +7 -0
- package/dist/chunks/brainstorm-BwKA6yZP.mjs.map +1 -0
- package/dist/chunks/cancel-KV_cpsqS.mjs +15 -0
- package/dist/chunks/cancel-KV_cpsqS.mjs.map +1 -0
- package/dist/chunks/canonical-C8UxeEmB.mjs +57 -0
- package/dist/chunks/canonical-C8UxeEmB.mjs.map +1 -0
- package/dist/chunks/catalogue-BvwSrM_j.mjs +1549 -0
- package/dist/chunks/catalogue-BvwSrM_j.mjs.map +1 -0
- package/dist/chunks/compose-Dvxunpto.mjs +7307 -0
- package/dist/chunks/compose-Dvxunpto.mjs.map +1 -0
- package/dist/chunks/config-DefHA2Lw.mjs +96 -0
- package/dist/chunks/config-DefHA2Lw.mjs.map +1 -0
- package/dist/chunks/contract-BkMjU1kR.mjs +295 -0
- package/dist/chunks/contract-BkMjU1kR.mjs.map +1 -0
- package/dist/chunks/contract-bQ9FJl4N.mjs +123 -0
- package/dist/chunks/contract-bQ9FJl4N.mjs.map +1 -0
- package/dist/chunks/deny-ClTxSvHJ.mjs +15 -0
- package/dist/chunks/deny-ClTxSvHJ.mjs.map +1 -0
- package/dist/chunks/diff-Qw0II0sj.mjs +101 -0
- package/dist/chunks/diff-Qw0II0sj.mjs.map +1 -0
- package/dist/chunks/discover-eS01-me1.mjs +21 -0
- package/dist/chunks/discover-eS01-me1.mjs.map +1 -0
- package/dist/chunks/doctor-B-H2UK5e.mjs +222 -0
- package/dist/chunks/doctor-B-H2UK5e.mjs.map +1 -0
- package/dist/chunks/fix-D4Tj8RVA.mjs +18 -0
- package/dist/chunks/fix-D4Tj8RVA.mjs.map +1 -0
- package/dist/chunks/gc-BBXlBF5w.mjs +161 -0
- package/dist/chunks/gc-BBXlBF5w.mjs.map +1 -0
- package/dist/chunks/init-BUnzIkeE.mjs +63 -0
- package/dist/chunks/init-BUnzIkeE.mjs.map +1 -0
- package/dist/chunks/inspect-Buby4cQD.mjs +22 -0
- package/dist/chunks/inspect-Buby4cQD.mjs.map +1 -0
- package/dist/chunks/logs-Giq5sUau.mjs +25 -0
- package/dist/chunks/logs-Giq5sUau.mjs.map +1 -0
- package/dist/chunks/migrate-DybihKzZ.mjs +33 -0
- package/dist/chunks/migrate-DybihKzZ.mjs.map +1 -0
- package/dist/chunks/models-Btp6X2YZ.mjs +24 -0
- package/dist/chunks/models-Btp6X2YZ.mjs.map +1 -0
- package/dist/chunks/pause-BASBfKLO.mjs +16 -0
- package/dist/chunks/pause-BASBfKLO.mjs.map +1 -0
- package/dist/chunks/policy-DUIgzF3W.mjs +139 -0
- package/dist/chunks/policy-DUIgzF3W.mjs.map +1 -0
- package/dist/chunks/providers-Dx78imKj.mjs +19 -0
- package/dist/chunks/providers-Dx78imKj.mjs.map +1 -0
- package/dist/chunks/reconcile-Bhy3IIYo.mjs +50 -0
- package/dist/chunks/reconcile-Bhy3IIYo.mjs.map +1 -0
- package/dist/chunks/render-DyZr5Lgi.mjs +53 -0
- package/dist/chunks/render-DyZr5Lgi.mjs.map +1 -0
- package/dist/chunks/resume-GJQRb2Eb.mjs +15 -0
- package/dist/chunks/resume-GJQRb2Eb.mjs.map +1 -0
- package/dist/chunks/retry-CLrUem1H.mjs +15 -0
- package/dist/chunks/retry-CLrUem1H.mjs.map +1 -0
- package/dist/chunks/review-BDdjb6kB.mjs +17 -0
- package/dist/chunks/review-BDdjb6kB.mjs.map +1 -0
- package/dist/chunks/run-CgTWYlcd.mjs +82 -0
- package/dist/chunks/run-CgTWYlcd.mjs.map +1 -0
- package/dist/chunks/run-tool-C3rAv4XF.mjs +26 -0
- package/dist/chunks/run-tool-C3rAv4XF.mjs.map +1 -0
- package/dist/chunks/scan-8Gy_B6kI.mjs +122 -0
- package/dist/chunks/scan-8Gy_B6kI.mjs.map +1 -0
- package/dist/chunks/schema-C9QbUW4H.mjs +578 -0
- package/dist/chunks/schema-C9QbUW4H.mjs.map +1 -0
- package/dist/chunks/send-BdnJ85Nz.mjs +19 -0
- package/dist/chunks/send-BdnJ85Nz.mjs.map +1 -0
- package/dist/chunks/ship-DTuLGoaJ.mjs +19 -0
- package/dist/chunks/ship-DTuLGoaJ.mjs.map +1 -0
- package/dist/chunks/shutdown-BM92Iyv2.mjs +15 -0
- package/dist/chunks/shutdown-BM92Iyv2.mjs.map +1 -0
- package/dist/chunks/skip-DZG5kpcH.mjs +18 -0
- package/dist/chunks/skip-DZG5kpcH.mjs.map +1 -0
- package/dist/chunks/spec-Bq0P3jVh.mjs +20 -0
- package/dist/chunks/spec-Bq0P3jVh.mjs.map +1 -0
- package/dist/chunks/src-CId6kMsY.mjs +1689 -0
- package/dist/chunks/src-CId6kMsY.mjs.map +1 -0
- package/dist/chunks/src-CfAOde7C.mjs +5403 -0
- package/dist/chunks/src-CfAOde7C.mjs.map +1 -0
- package/dist/chunks/src-CmFjh4M0.mjs +928 -0
- package/dist/chunks/src-CmFjh4M0.mjs.map +1 -0
- package/dist/chunks/src-Cu3TxNob.mjs +783 -0
- package/dist/chunks/src-Cu3TxNob.mjs.map +1 -0
- package/dist/chunks/src-DcU4IXMe.mjs +117 -0
- package/dist/chunks/src-DcU4IXMe.mjs.map +1 -0
- package/dist/chunks/src-s7YRvk0t.mjs +2116 -0
- package/dist/chunks/src-s7YRvk0t.mjs.map +1 -0
- package/dist/chunks/status-SMjiOMYy.mjs +29 -0
- package/dist/chunks/status-SMjiOMYy.mjs.map +1 -0
- package/dist/chunks/tail-BuhT-2PH.mjs +25 -0
- package/dist/chunks/tail-BuhT-2PH.mjs.map +1 -0
- package/dist/chunks/update-BXIppsbi.mjs +16 -0
- package/dist/chunks/update-BXIppsbi.mjs.map +1 -0
- package/dist/cli.mjs +175 -0
- package/dist/cli.mjs.map +1 -0
- package/package.json +17 -32
- package/CHANGELOG.md +0 -1461
- package/bin/cli.js +0 -817
- package/bin/report.js +0 -141
- package/core/adapter/render.js +0 -415
- package/core/agents/implementer.template.md +0 -142
- package/core/agents/profile-reader.md +0 -50
- package/core/agents/release.md +0 -58
- package/core/agents/review.md +0 -179
- package/core/commands/cohorte-align-ds.md +0 -33
- package/core/commands/cohorte-audit.md +0 -58
- package/core/commands/cohorte-brainstorm.md +0 -70
- package/core/commands/cohorte-build.md +0 -219
- package/core/commands/cohorte-doctor.md +0 -194
- package/core/commands/cohorte-fix.md +0 -80
- package/core/commands/cohorte-fleet.md +0 -103
- package/core/commands/cohorte-init-pipeline.md +0 -31
- package/core/commands/cohorte-intake.md +0 -92
- package/core/commands/cohorte-patch.md +0 -118
- package/core/commands/cohorte-refactor.md +0 -59
- package/core/commands/cohorte-retro.md +0 -85
- package/core/commands/cohorte-review.md +0 -270
- package/core/commands/cohorte-ship.md +0 -122
- package/core/commands/cohorte-spec.md +0 -101
- package/core/commands/cohorte-update-pipeline.md +0 -165
- package/core/hooks/gate.py +0 -588
- package/core/runtimes/claude.json +0 -74
- package/core/runtimes/codex.json +0 -85
- package/core/runtimes/cursor.json +0 -76
- package/core/runtimes/gemini.json +0 -76
- package/core/runtimes/opencode.json +0 -73
- package/core/templates/agent-handoff.md +0 -34
- package/core/templates/brainstorm-return.md +0 -36
- package/core/templates/decisions.template.md +0 -42
- package/core/templates/design-brief.md +0 -44
- package/core/templates/patch.template.md +0 -86
- package/core/templates/pr-body.md +0 -25
- package/core/templates/review-feedback.md +0 -38
- package/core/templates/spec.template.md +0 -87
- package/core/templates/steps/init-pipeline/01-detect-stack.md +0 -44
- package/core/templates/steps/init-pipeline/02-interview-gaps.md +0 -55
- package/core/templates/steps/init-pipeline/03-draft-profile.md +0 -10
- package/core/templates/steps/init-pipeline/04-write-render.md +0 -145
- package/core/templates/steps/init-pipeline/05-report.md +0 -12
- package/core/workflows/audit.js +0 -240
- package/core/workflows/loop.js +0 -641
- package/core/workflows/refactor.js +0 -276
- package/core/workflows/review.js +0 -456
- package/install.ps1 +0 -103
- package/install.sh +0 -114
- package/lib/doctor.js +0 -534
- package/lib/runtime.js +0 -139
- package/lib/versions.js +0 -149
- package/lib/yaml.js +0 -129
- package/profile/PIPELINE.template.md +0 -259
- package/profile/SCHEMA.md +0 -735
- package/profile/cohorte.config.template.yaml +0 -43
- package/scripts/assert-gate-hook.mjs +0 -75
- package/scripts/kanban-move.sh +0 -313
- package/scripts/metrics/collect.mjs +0 -531
- package/scripts/metrics/prices.json +0 -42
- package/scripts/new-feature.sh.template +0 -98
- package/scripts/preflight.sh +0 -124
- package/scripts/remove-feature.sh.template +0 -56
- package/scripts/test-adapter.mjs +0 -437
- package/scripts/test-gate.mjs +0 -443
- package/scripts/test-kanban.mjs +0 -304
- package/scripts/test-lib.mjs +0 -356
- package/scripts/test-metrics.mjs +0 -156
- package/scripts/test-workflows.mjs +0 -758
- package/scripts/validate-core.mjs +0 -325
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { a as applyV2Import, i as planInit, o as exportV2, r as applyInit, s as planV2Import } from "./src-CmFjh4M0.mjs";
|
|
2
|
+
import { t as scanRepository } from "./scan-8Gy_B6kI.mjs";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
//#region src/commands/init/index.ts
|
|
5
|
+
const init = {
|
|
6
|
+
verb: "init",
|
|
7
|
+
async run(ctx, args) {
|
|
8
|
+
const fromV2 = args.positionals.indexOf("--from-v2");
|
|
9
|
+
const exportV2At = args.positionals.indexOf("--export-v2");
|
|
10
|
+
const optionValues = new Set([fromV2, exportV2At].filter((index) => index !== -1).map((index) => args.positionals[index + 1]).filter((value) => value !== void 0));
|
|
11
|
+
const requestedRoot = args.positionals.find((value) => !value.startsWith("--") && !optionValues.has(value));
|
|
12
|
+
const root = requestedRoot === void 0 ? ctx.cwd : resolve(ctx.cwd, requestedRoot);
|
|
13
|
+
if (fromV2 !== -1) {
|
|
14
|
+
const bundle = args.positionals[fromV2 + 1];
|
|
15
|
+
if (!bundle) throw new Error("configuration/import-invalid: init --from-v2 requires a bundle directory");
|
|
16
|
+
const model = await scanRepository(root, {
|
|
17
|
+
clock: ctx.clock,
|
|
18
|
+
toolVersion: "3.0.0-v2-import"
|
|
19
|
+
});
|
|
20
|
+
const plan = await planV2Import(resolve(ctx.cwd, bundle), root, { model });
|
|
21
|
+
if (!args.positionals.includes("--yes")) {
|
|
22
|
+
ctx.stdio.stdout.write(`${JSON.stringify(plan, null, 2)}\n`);
|
|
23
|
+
return plan.conflicts.length ? 3 : 0;
|
|
24
|
+
}
|
|
25
|
+
const result = await applyV2Import(plan, {
|
|
26
|
+
confirm: args.positionals.includes("--yes"),
|
|
27
|
+
backupRoot: resolve(root, "..", ".cohorte-migration-backups")
|
|
28
|
+
});
|
|
29
|
+
ctx.stdio.stdout.write(`${JSON.stringify(result)}\n`);
|
|
30
|
+
return 0;
|
|
31
|
+
}
|
|
32
|
+
if (exportV2At !== -1) {
|
|
33
|
+
const destination = args.positionals[exportV2At + 1];
|
|
34
|
+
if (!destination) throw new Error("configuration/import-invalid: init --export-v2 requires a destination");
|
|
35
|
+
const result = await exportV2({
|
|
36
|
+
root,
|
|
37
|
+
destination: resolve(ctx.cwd, destination)
|
|
38
|
+
});
|
|
39
|
+
ctx.stdio.stdout.write(`${JSON.stringify(result)}\n`);
|
|
40
|
+
return result.manifest.warnings.some((item) => item.blocking) ? 3 : 0;
|
|
41
|
+
}
|
|
42
|
+
const model = await scanRepository(root, {
|
|
43
|
+
clock: ctx.clock,
|
|
44
|
+
toolVersion: "3.0.0"
|
|
45
|
+
});
|
|
46
|
+
const plan = await planInit({
|
|
47
|
+
root,
|
|
48
|
+
model,
|
|
49
|
+
cohorteVersion: "3.0.0"
|
|
50
|
+
});
|
|
51
|
+
if (args.positionals.includes("--plan") || args.json) {
|
|
52
|
+
ctx.stdio.stdout.write(`${JSON.stringify(plan)}\n`);
|
|
53
|
+
return 0;
|
|
54
|
+
}
|
|
55
|
+
const result = await applyInit(plan);
|
|
56
|
+
ctx.stdio.stdout.write(`written: ${result.written.join(", ") || "none"}\n`);
|
|
57
|
+
return 0;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
//#endregion
|
|
61
|
+
export { init as default };
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=init-BUnzIkeE.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-BUnzIkeE.mjs","names":[],"sources":["../../../../apps/cli/src/commands/init/index.ts"],"sourcesContent":["// apps/cli/src/commands/init/index.ts — DESIGN §9 verb `init` (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/init/**`.\nimport { resolve } from 'node:path';\nimport { applyInit, applyV2Import, exportV2, planInit, planV2Import, scanRepository } from '@cohorte/project-model';\nimport type { CommandModule } from '../../contract/index.ts';\n\nconst init: CommandModule = {\n verb: 'init',\n async run(ctx, args) {\n const fromV2 = args.positionals.indexOf('--from-v2');\n const exportV2At = args.positionals.indexOf('--export-v2');\n const optionValues = new Set(\n [fromV2, exportV2At]\n .filter((index) => index !== -1)\n .map((index) => args.positionals[index + 1])\n .filter((value): value is string => value !== undefined),\n );\n const requestedRoot = args.positionals.find((value) => !value.startsWith('--') && !optionValues.has(value));\n const root = requestedRoot === undefined ? ctx.cwd : resolve(ctx.cwd, requestedRoot);\n if (fromV2 !== -1) {\n const bundle = args.positionals[fromV2 + 1];\n if (!bundle) throw new Error('configuration/import-invalid: init --from-v2 requires a bundle directory');\n const model = await scanRepository(root, { clock: ctx.clock, toolVersion: '3.0.0-v2-import' });\n const plan = await planV2Import(resolve(ctx.cwd, bundle), root, { model });\n if (!args.positionals.includes('--yes')) {\n ctx.stdio.stdout.write(`${JSON.stringify(plan, null, 2)}\\n`);\n return plan.conflicts.length ? 3 : 0;\n }\n const result = await applyV2Import(plan, {\n confirm: args.positionals.includes('--yes'),\n backupRoot: resolve(root, '..', '.cohorte-migration-backups'),\n });\n ctx.stdio.stdout.write(`${JSON.stringify(result)}\\n`);\n return 0;\n }\n if (exportV2At !== -1) {\n const destination = args.positionals[exportV2At + 1];\n if (!destination) throw new Error('configuration/import-invalid: init --export-v2 requires a destination');\n const result = await exportV2({ root, destination: resolve(ctx.cwd, destination) });\n ctx.stdio.stdout.write(`${JSON.stringify(result)}\\n`);\n return result.manifest.warnings.some((item) => item.blocking) ? 3 : 0;\n }\n const model = await scanRepository(root, { clock: ctx.clock, toolVersion: '3.0.0' });\n const plan = await planInit({ root, model, cohorteVersion: '3.0.0' });\n if (args.positionals.includes('--plan') || args.json) {\n ctx.stdio.stdout.write(`${JSON.stringify(plan)}\\n`);\n return 0;\n }\n const result = await applyInit(plan);\n ctx.stdio.stdout.write(`written: ${result.written.join(', ') || 'none'}\\n`);\n return 0;\n },\n};\n\nexport default init;\n"],"mappings":";;;;AAQA,MAAM,OAAsB;CAC1B,MAAM;CACN,MAAM,IAAI,KAAK,MAAM;EACnB,MAAM,SAAS,KAAK,YAAY,QAAQ,WAAW;EACnD,MAAM,aAAa,KAAK,YAAY,QAAQ,aAAa;EACzD,MAAM,eAAe,IAAI,IACvB,CAAC,QAAQ,UAAU,CAAC,CACjB,QAAQ,UAAU,UAAU,EAAE,CAAC,CAC/B,KAAK,UAAU,KAAK,YAAY,QAAQ,EAAE,CAAC,CAC3C,QAAQ,UAA2B,UAAU,KAAA,CAAS,CAC3D;EACA,MAAM,gBAAgB,KAAK,YAAY,MAAM,UAAU,CAAC,MAAM,WAAW,IAAI,KAAK,CAAC,aAAa,IAAI,KAAK,CAAC;EAC1G,MAAM,OAAO,kBAAkB,KAAA,IAAY,IAAI,MAAM,QAAQ,IAAI,KAAK,aAAa;EACnF,IAAI,WAAW,IAAI;GACjB,MAAM,SAAS,KAAK,YAAY,SAAS;GACzC,IAAI,CAAC,QAAQ,MAAM,IAAI,MAAM,0EAA0E;GACvG,MAAM,QAAQ,MAAM,eAAe,MAAM;IAAE,OAAO,IAAI;IAAO,aAAa;GAAkB,CAAC;GAC7F,MAAM,OAAO,MAAM,aAAa,QAAQ,IAAI,KAAK,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC;GACzE,IAAI,CAAC,KAAK,YAAY,SAAS,OAAO,GAAG;IACvC,IAAI,MAAM,OAAO,MAAM,GAAG,KAAK,UAAU,MAAM,MAAM,CAAC,EAAE,GAAG;IAC3D,OAAO,KAAK,UAAU,SAAS,IAAI;GACrC;GACA,MAAM,SAAS,MAAM,cAAc,MAAM;IACvC,SAAS,KAAK,YAAY,SAAS,OAAO;IAC1C,YAAY,QAAQ,MAAM,MAAM,4BAA4B;GAC9D,CAAC;GACD,IAAI,MAAM,OAAO,MAAM,GAAG,KAAK,UAAU,MAAM,EAAE,GAAG;GACpD,OAAO;EACT;EACA,IAAI,eAAe,IAAI;GACrB,MAAM,cAAc,KAAK,YAAY,aAAa;GAClD,IAAI,CAAC,aAAa,MAAM,IAAI,MAAM,uEAAuE;GACzG,MAAM,SAAS,MAAM,SAAS;IAAE;IAAM,aAAa,QAAQ,IAAI,KAAK,WAAW;GAAE,CAAC;GAClF,IAAI,MAAM,OAAO,MAAM,GAAG,KAAK,UAAU,MAAM,EAAE,GAAG;GACpD,OAAO,OAAO,SAAS,SAAS,MAAM,SAAS,KAAK,QAAQ,IAAI,IAAI;EACtE;EACA,MAAM,QAAQ,MAAM,eAAe,MAAM;GAAE,OAAO,IAAI;GAAO,aAAa;EAAQ,CAAC;EACnF,MAAM,OAAO,MAAM,SAAS;GAAE;GAAM;GAAO,gBAAgB;EAAQ,CAAC;EACpE,IAAI,KAAK,YAAY,SAAS,QAAQ,KAAK,KAAK,MAAM;GACpD,IAAI,MAAM,OAAO,MAAM,GAAG,KAAK,UAAU,IAAI,EAAE,GAAG;GAClD,OAAO;EACT;EACA,MAAM,SAAS,MAAM,UAAU,IAAI;EACnC,IAAI,MAAM,OAAO,MAAM,YAAY,OAAO,QAAQ,KAAK,IAAI,KAAK,OAAO,GAAG;EAC1E,OAAO;CACT;AACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { n as writeHuman } from "./render-DyZr5Lgi.mjs";
|
|
2
|
+
//#region src/commands/inspect/index.ts
|
|
3
|
+
const inspect = {
|
|
4
|
+
verb: "inspect",
|
|
5
|
+
async run(ctx, args) {
|
|
6
|
+
const runId = args.positionals[0];
|
|
7
|
+
if (!runId) return 2;
|
|
8
|
+
const store = await ctx.openStore();
|
|
9
|
+
const value = await store.readRunTree(runId);
|
|
10
|
+
try {
|
|
11
|
+
if (args.json) ctx.stdio.stdout.write(`${JSON.stringify(value)}\n`);
|
|
12
|
+
else writeHuman(ctx, JSON.stringify(value, null, 2));
|
|
13
|
+
return 0;
|
|
14
|
+
} finally {
|
|
15
|
+
await store.close();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { inspect as default };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=inspect-Buby4cQD.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect-Buby4cQD.mjs","names":[],"sources":["../../../../apps/cli/src/commands/inspect/index.ts"],"sourcesContent":["// apps/cli/src/commands/inspect/index.ts — DESIGN §9 verb `inspect` (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/inspect/**`.\nimport type { CommandModule } from '../../contract/index.ts';\nimport { writeHuman } from '../../render/index.ts';\n\nconst inspect: CommandModule = {\n verb: 'inspect',\n async run(ctx, args) {\n const runId = args.positionals[0];\n if (!runId) return 2;\n const store = await ctx.openStore();\n const value = await store.readRunTree(runId as never);\n try {\n if (args.json) ctx.stdio.stdout.write(`${JSON.stringify(value)}\\n`);\n else writeHuman(ctx, JSON.stringify(value, null, 2));\n return 0;\n } finally {\n await store.close();\n }\n },\n};\n\nexport default inspect;\n"],"mappings":";;AAOA,MAAM,UAAyB;CAC7B,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,QAAQ,MAAM,MAAM,YAAY,KAAc;EACpD,IAAI;GACF,IAAI,KAAK,MAAM,IAAI,MAAM,OAAO,MAAM,GAAG,KAAK,UAAU,KAAK,EAAE,GAAG;QAC7D,WAAW,KAAK,KAAK,UAAU,OAAO,MAAM,CAAC,CAAC;GACnD,OAAO;EACT,UAAU;GACR,MAAM,MAAM,MAAM;EACpB;CACF;AACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { c as rollbackV2Import } from "./src-CmFjh4M0.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-DybihKzZ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate-DybihKzZ.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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/commands/pause/index.ts
|
|
2
|
+
const pause = {
|
|
3
|
+
verb: "pause",
|
|
4
|
+
async run(ctx, args) {
|
|
5
|
+
const runId = args.positionals[0];
|
|
6
|
+
if (!runId) return 2;
|
|
7
|
+
const reason = args.positionals.slice(1).join(" ");
|
|
8
|
+
const result = await ctx.controller.send("pause", reason ? { reason } : {}, { runId });
|
|
9
|
+
ctx.stdio.stdout.write(`${JSON.stringify(result)}\n`);
|
|
10
|
+
return result.status === "rejected" ? 3 : result.status === "pending" ? 4 : 0;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { pause as default };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=pause-BASBfKLO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pause-BASBfKLO.mjs","names":[],"sources":["../../../../apps/cli/src/commands/pause/index.ts"],"sourcesContent":["// apps/cli/src/commands/pause/index.ts — DESIGN §9 verb `pause` (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/pause/**`.\nimport type { CommandModule } from '../../contract/index.ts';\n\nconst pause: CommandModule = {\n verb: 'pause',\n async run(ctx, args) {\n const runId = args.positionals[0];\n if (!runId) return 2;\n const reason = args.positionals.slice(1).join(' ');\n const result = await ctx.controller.send('pause', reason ? { reason } : {}, { runId });\n ctx.stdio.stdout.write(`${JSON.stringify(result)}\\n`);\n return result.status === 'rejected' ? 3 : result.status === 'pending' ? 4 : 0;\n },\n};\n\nexport default pause;\n"],"mappings":";AAMA,MAAM,QAAuB;CAC3B,MAAM;CACN,MAAM,IAAI,KAAK,MAAM;EACnB,MAAM,QAAQ,KAAK,YAAY;EAC/B,IAAI,CAAC,OAAO,OAAO;EACnB,MAAM,SAAS,KAAK,YAAY,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG;EACjD,MAAM,SAAS,MAAM,IAAI,WAAW,KAAK,SAAS,SAAS,EAAE,OAAO,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC;EACrF,IAAI,MAAM,OAAO,MAAM,GAAG,KAAK,UAAU,MAAM,EAAE,GAAG;EACpD,OAAO,OAAO,WAAW,aAAa,IAAI,OAAO,WAAW,YAAY,IAAI;CAC9E;AACF"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { n as sha256Hex, t as canonicalJson } from "./canonical-C8UxeEmB.mjs";
|
|
2
|
+
import { N as errorOf, j as CohorteError } from "./src-Cu3TxNob.mjs";
|
|
3
|
+
import { n as createKeyStore, r as createTrustStore } from "./auth-BT5oVp76.mjs";
|
|
4
|
+
import { i as resolveConfig, n as loadConfig } from "./src-DcU4IXMe.mjs";
|
|
5
|
+
import "./src-CId6kMsY.mjs";
|
|
6
|
+
import { a as buildPolicySnapshot, c as createCommandPolicy, i as createGlobMatcher, l as createProgramResolver, n as toolIntrospection, o as createPolicyEngine, r as createPathResolver, s as explainPolicy } from "./catalogue-BvwSrM_j.mjs";
|
|
7
|
+
import { join, resolve } from "node:path";
|
|
8
|
+
import { realpathSync } from "node:fs";
|
|
9
|
+
//#region src/commands/policy/index.ts
|
|
10
|
+
function canonical(path) {
|
|
11
|
+
const absolute = resolve(path);
|
|
12
|
+
try {
|
|
13
|
+
return realpathSync.native(absolute);
|
|
14
|
+
} catch {
|
|
15
|
+
return absolute;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function grantFor(root, argv) {
|
|
19
|
+
const tools = ["run_command"];
|
|
20
|
+
return {
|
|
21
|
+
agentId: "agt_policy_explain",
|
|
22
|
+
role: "policy-explain",
|
|
23
|
+
digest: sha256Hex(canonicalJson({
|
|
24
|
+
root,
|
|
25
|
+
argv: [...argv]
|
|
26
|
+
})),
|
|
27
|
+
tools,
|
|
28
|
+
roots: {
|
|
29
|
+
workspace: root,
|
|
30
|
+
readOnly: []
|
|
31
|
+
},
|
|
32
|
+
read: {
|
|
33
|
+
include: ["**"],
|
|
34
|
+
exclude: []
|
|
35
|
+
},
|
|
36
|
+
write: {
|
|
37
|
+
include: ["**"],
|
|
38
|
+
exclude: []
|
|
39
|
+
},
|
|
40
|
+
denyRead: {
|
|
41
|
+
include: ["**/.cohorte/**", "**/.git/**"],
|
|
42
|
+
exclude: []
|
|
43
|
+
},
|
|
44
|
+
denyWrite: {
|
|
45
|
+
include: ["**/.cohorte/**", "**/.git/**"],
|
|
46
|
+
exclude: []
|
|
47
|
+
},
|
|
48
|
+
commands: {
|
|
49
|
+
default: "deny",
|
|
50
|
+
rules: []
|
|
51
|
+
},
|
|
52
|
+
secrets: [],
|
|
53
|
+
temporary: [],
|
|
54
|
+
limits: {
|
|
55
|
+
maxToolCalls: 1,
|
|
56
|
+
maxCallsPerMinute: 1,
|
|
57
|
+
perTool: { run_command: {
|
|
58
|
+
timeoutMs: 12e4,
|
|
59
|
+
maxOutputBytes: 1048576
|
|
60
|
+
} }
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const policy = {
|
|
65
|
+
verb: "policy",
|
|
66
|
+
async run(ctx, args) {
|
|
67
|
+
if (args.subVerb !== "explain") return 2;
|
|
68
|
+
const argv = args.positionals.filter((value) => value !== "--");
|
|
69
|
+
if (argv.length === 0) return 2;
|
|
70
|
+
const home = ctx.env.HOME ?? ctx.cwd;
|
|
71
|
+
const projectKeyId = sha256Hex(ctx.cwd).slice(0, 24);
|
|
72
|
+
const keys = createKeyStore({ directory: join(home, ".cohorte", "keys") });
|
|
73
|
+
const trustStore = createTrustStore({
|
|
74
|
+
directory: join(home, ".cohorte", "trust"),
|
|
75
|
+
keys
|
|
76
|
+
});
|
|
77
|
+
const loaded = await loadConfig({
|
|
78
|
+
cwd: ctx.cwd,
|
|
79
|
+
home
|
|
80
|
+
});
|
|
81
|
+
const resolved = await resolveConfig(loaded, {
|
|
82
|
+
trustStore,
|
|
83
|
+
projectKeyId
|
|
84
|
+
});
|
|
85
|
+
if (resolved.status === "untrusted") throw new CohorteError(errorOf("security/project-policy-untrusted", `project policy is untrusted (${resolved.loosenedKeys.join(", ") || "unknown key"})`));
|
|
86
|
+
const root = canonical(loaded.projectRoot);
|
|
87
|
+
const pathResolver = createPathResolver({
|
|
88
|
+
roots: [root],
|
|
89
|
+
protectedRoots: [canonical(join(root, ".cohorte"))],
|
|
90
|
+
symlinks: resolved.config.policy.symlinks
|
|
91
|
+
});
|
|
92
|
+
const pathDirs = (ctx.env.PATH ?? "").split(":").filter(Boolean).map(canonical);
|
|
93
|
+
const programs = createProgramResolver({ pathDirs });
|
|
94
|
+
const branches = { branchOf: () => ({
|
|
95
|
+
kind: "detached-or-unknown",
|
|
96
|
+
protected: true
|
|
97
|
+
}) };
|
|
98
|
+
const commands = createCommandPolicy({
|
|
99
|
+
programs,
|
|
100
|
+
branches
|
|
101
|
+
});
|
|
102
|
+
const engine = createPolicyEngine({
|
|
103
|
+
tools: toolIntrospection,
|
|
104
|
+
globs: createGlobMatcher(),
|
|
105
|
+
commands
|
|
106
|
+
});
|
|
107
|
+
const policySnapshot = buildPolicySnapshot(resolved.config, loaded.ownership, { sandboxLevel: "L0-process" });
|
|
108
|
+
const ports = {
|
|
109
|
+
paths: pathResolver,
|
|
110
|
+
branches,
|
|
111
|
+
budgets: {
|
|
112
|
+
remaining: () => ({}),
|
|
113
|
+
callsInLastMinute: () => 0
|
|
114
|
+
},
|
|
115
|
+
programs,
|
|
116
|
+
clock: ctx.clock
|
|
117
|
+
};
|
|
118
|
+
const verdict = explainPolicy(engine, {
|
|
119
|
+
runId: "run_policy_explain",
|
|
120
|
+
agentId: "agt_policy_explain",
|
|
121
|
+
incarnation: 1,
|
|
122
|
+
toolCallId: "tool_policy_explain",
|
|
123
|
+
tool: "run_command",
|
|
124
|
+
input: {
|
|
125
|
+
argv,
|
|
126
|
+
cwd: root,
|
|
127
|
+
timeoutMs: 12e4
|
|
128
|
+
},
|
|
129
|
+
phase: "PREFLIGHT",
|
|
130
|
+
role: "policy-explain"
|
|
131
|
+
}, grantFor(root, argv), policySnapshot, ports);
|
|
132
|
+
ctx.stdio.stdout.write(`${JSON.stringify(verdict)}\n`);
|
|
133
|
+
return 0;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
//#endregion
|
|
137
|
+
export { policy as default };
|
|
138
|
+
|
|
139
|
+
//# sourceMappingURL=policy-DUIgzF3W.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy-DUIgzF3W.mjs","names":[],"sources":["../../../../apps/cli/src/commands/policy/index.ts"],"sourcesContent":["// apps/cli/src/commands/policy/index.ts — DESIGN §9 verb `policy` (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/policy/**`.\nimport { realpathSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport { CohorteError, canonicalJson, errorOf, sha256Hex } from '@cohorte/base';\nimport { loadConfig, resolveConfig } from '@cohorte/config';\nimport {\n buildPolicySnapshot,\n createCommandPolicy,\n createGlobMatcher,\n createPathResolver,\n createPolicyEngine,\n createProgramResolver,\n explainPolicy,\n} from '@cohorte/security';\nimport { createKeyStore, createTrustStore } from '@cohorte/security/auth';\nimport type { AgentGrant, GateCall, PolicyPorts } from '@cohorte/security/contract';\nimport { toolIntrospection } from '@cohorte/tools/catalogue';\nimport type { CommandModule } from '../../contract/index.ts';\n\nfunction canonical(path: string): string {\n const absolute = resolve(path);\n try {\n return realpathSync.native(absolute);\n } catch {\n return absolute;\n }\n}\n\nfunction grantFor(root: string, argv: readonly string[]): AgentGrant {\n const tools = ['run_command'];\n const digest = sha256Hex(canonicalJson({ root, argv: [...argv] }));\n return {\n agentId: 'agt_policy_explain' as AgentGrant['agentId'],\n role: 'policy-explain',\n digest,\n tools,\n roots: { workspace: root as AgentGrant['roots']['workspace'], readOnly: [] },\n read: { include: ['**'], exclude: [] },\n write: { include: ['**'], exclude: [] },\n denyRead: { include: ['**/.cohorte/**', '**/.git/**'], exclude: [] },\n denyWrite: { include: ['**/.cohorte/**', '**/.git/**'], exclude: [] },\n commands: { default: 'deny', rules: [] },\n secrets: [],\n temporary: [],\n limits: {\n maxToolCalls: 1,\n maxCallsPerMinute: 1,\n perTool: { run_command: { timeoutMs: 120_000, maxOutputBytes: 1024 * 1024 } },\n },\n };\n}\n\nconst policy: CommandModule = {\n verb: 'policy',\n async run(ctx, args) {\n if (args.subVerb !== 'explain') return 2;\n const argv = args.positionals.filter((value) => value !== '--');\n if (argv.length === 0) return 2;\n\n const home = ctx.env.HOME ?? ctx.cwd;\n const projectKeyId = sha256Hex(ctx.cwd).slice(0, 24);\n const keys = createKeyStore({ directory: join(home, '.cohorte', 'keys') });\n const trustStore = createTrustStore({ directory: join(home, '.cohorte', 'trust'), keys });\n const loaded = await loadConfig({ cwd: ctx.cwd, home });\n const resolved = await resolveConfig(loaded, { trustStore, projectKeyId });\n if (resolved.status === 'untrusted') {\n throw new CohorteError(\n errorOf(\n 'security/project-policy-untrusted',\n `project policy is untrusted (${resolved.loosenedKeys.join(', ') || 'unknown key'})`,\n ),\n );\n }\n\n const root = canonical(loaded.projectRoot);\n const pathResolver = createPathResolver({\n roots: [root as never],\n protectedRoots: [canonical(join(root, '.cohorte')) as never],\n symlinks: resolved.config.policy.symlinks,\n });\n const pathDirs = (ctx.env.PATH ?? '').split(':').filter(Boolean).map(canonical);\n const programs = createProgramResolver({ pathDirs });\n const branches: PolicyPorts['branches'] = {\n branchOf: () => ({ kind: 'detached-or-unknown', protected: true }),\n };\n const commands = createCommandPolicy({ programs, branches });\n const engine = createPolicyEngine({ tools: toolIntrospection, globs: createGlobMatcher(), commands });\n const policySnapshot = buildPolicySnapshot(resolved.config, loaded.ownership, { sandboxLevel: 'L0-process' });\n const ports: PolicyPorts = {\n paths: pathResolver,\n branches,\n budgets: { remaining: () => ({}), callsInLastMinute: () => 0 },\n programs,\n clock: ctx.clock,\n };\n const call: GateCall = {\n runId: 'run_policy_explain' as GateCall['runId'],\n agentId: 'agt_policy_explain' as GateCall['agentId'],\n incarnation: 1,\n toolCallId: 'tool_policy_explain' as GateCall['toolCallId'],\n tool: 'run_command',\n input: { argv, cwd: root, timeoutMs: 120_000 },\n phase: 'PREFLIGHT',\n role: 'policy-explain',\n };\n const verdict = explainPolicy(engine, call, grantFor(root, argv), policySnapshot, ports);\n ctx.stdio.stdout.write(`${JSON.stringify(verdict)}\\n`);\n return 0;\n },\n};\n\nexport default policy;\n"],"mappings":";;;;;;;;;AAsBA,SAAS,UAAU,MAAsB;CACvC,MAAM,WAAW,QAAQ,IAAI;CAC7B,IAAI;EACF,OAAO,aAAa,OAAO,QAAQ;CACrC,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,SAAS,MAAc,MAAqC;CACnE,MAAM,QAAQ,CAAC,aAAa;CAE5B,OAAO;EACL,SAAS;EACT,MAAM;EACN,QAJa,UAAU,cAAc;GAAE;GAAM,MAAM,CAAC,GAAG,IAAI;EAAE,CAAC,CAIzD;EACL;EACA,OAAO;GAAE,WAAW;GAA0C,UAAU,CAAC;EAAE;EAC3E,MAAM;GAAE,SAAS,CAAC,IAAI;GAAG,SAAS,CAAC;EAAE;EACrC,OAAO;GAAE,SAAS,CAAC,IAAI;GAAG,SAAS,CAAC;EAAE;EACtC,UAAU;GAAE,SAAS,CAAC,kBAAkB,YAAY;GAAG,SAAS,CAAC;EAAE;EACnE,WAAW;GAAE,SAAS,CAAC,kBAAkB,YAAY;GAAG,SAAS,CAAC;EAAE;EACpE,UAAU;GAAE,SAAS;GAAQ,OAAO,CAAC;EAAE;EACvC,SAAS,CAAC;EACV,WAAW,CAAC;EACZ,QAAQ;GACN,cAAc;GACd,mBAAmB;GACnB,SAAS,EAAE,aAAa;IAAE,WAAW;IAAS,gBAAgB;GAAY,EAAE;EAC9E;CACF;AACF;AAEA,MAAM,SAAwB;CAC5B,MAAM;CACN,MAAM,IAAI,KAAK,MAAM;EACnB,IAAI,KAAK,YAAY,WAAW,OAAO;EACvC,MAAM,OAAO,KAAK,YAAY,QAAQ,UAAU,UAAU,IAAI;EAC9D,IAAI,KAAK,WAAW,GAAG,OAAO;EAE9B,MAAM,OAAO,IAAI,IAAI,QAAQ,IAAI;EACjC,MAAM,eAAe,UAAU,IAAI,GAAG,CAAC,CAAC,MAAM,GAAG,EAAE;EACnD,MAAM,OAAO,eAAe,EAAE,WAAW,KAAK,MAAM,YAAY,MAAM,EAAE,CAAC;EACzE,MAAM,aAAa,iBAAiB;GAAE,WAAW,KAAK,MAAM,YAAY,OAAO;GAAG;EAAK,CAAC;EACxF,MAAM,SAAS,MAAM,WAAW;GAAE,KAAK,IAAI;GAAK;EAAK,CAAC;EACtD,MAAM,WAAW,MAAM,cAAc,QAAQ;GAAE;GAAY;EAAa,CAAC;EACzE,IAAI,SAAS,WAAW,aACtB,MAAM,IAAI,aACR,QACE,qCACA,gCAAgC,SAAS,aAAa,KAAK,IAAI,KAAK,cAAc,EACpF,CACF;EAGF,MAAM,OAAO,UAAU,OAAO,WAAW;EACzC,MAAM,eAAe,mBAAmB;GACtC,OAAO,CAAC,IAAa;GACrB,gBAAgB,CAAC,UAAU,KAAK,MAAM,UAAU,CAAC,CAAU;GAC3D,UAAU,SAAS,OAAO,OAAO;EACnC,CAAC;EACD,MAAM,YAAY,IAAI,IAAI,QAAQ,GAAA,CAAI,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,IAAI,SAAS;EAC9E,MAAM,WAAW,sBAAsB,EAAE,SAAS,CAAC;EACnD,MAAM,WAAoC,EACxC,iBAAiB;GAAE,MAAM;GAAuB,WAAW;EAAK,GAClE;EACA,MAAM,WAAW,oBAAoB;GAAE;GAAU;EAAS,CAAC;EAC3D,MAAM,SAAS,mBAAmB;GAAE,OAAO;GAAmB,OAAO,kBAAkB;GAAG;EAAS,CAAC;EACpG,MAAM,iBAAiB,oBAAoB,SAAS,QAAQ,OAAO,WAAW,EAAE,cAAc,aAAa,CAAC;EAC5G,MAAM,QAAqB;GACzB,OAAO;GACP;GACA,SAAS;IAAE,kBAAkB,CAAC;IAAI,yBAAyB;GAAE;GAC7D;GACA,OAAO,IAAI;EACb;EAWA,MAAM,UAAU,cAAc,QAAQ;GATpC,OAAO;GACP,SAAS;GACT,aAAa;GACb,YAAY;GACZ,MAAM;GACN,OAAO;IAAE;IAAM,KAAK;IAAM,WAAW;GAAQ;GAC7C,OAAO;GACP,MAAM;EAEiC,GAAG,SAAS,MAAM,IAAI,GAAG,gBAAgB,KAAK;EACvF,IAAI,MAAM,OAAO,MAAM,GAAG,KAAK,UAAU,OAAO,EAAE,GAAG;EACrD,OAAO;CACT;AACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/commands/providers/index.ts
|
|
2
|
+
const PROVIDERS = ["openai-codex", "anthropic"];
|
|
3
|
+
const providers = {
|
|
4
|
+
verb: "providers",
|
|
5
|
+
async run(ctx, args) {
|
|
6
|
+
if (args.subVerb !== "list" && args.subVerb !== "test" && args.subVerb !== void 0) return 10;
|
|
7
|
+
const statuses = await ctx.runtime.resolve().authStatus([...PROVIDERS]);
|
|
8
|
+
if (args.subVerb === "test") {
|
|
9
|
+
for (const status of statuses) ctx.stdio.stdout.write(`${status.provider}: ${status.state}\n`);
|
|
10
|
+
return statuses.every((status) => status.state !== "unknown-transient") ? 0 : 1;
|
|
11
|
+
}
|
|
12
|
+
for (const provider of PROVIDERS) ctx.stdio.stdout.write(`${provider}\n`);
|
|
13
|
+
return 0;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { providers as default };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=providers-Dx78imKj.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers-Dx78imKj.mjs","names":[],"sources":["../../../../apps/cli/src/commands/providers/index.ts"],"sourcesContent":["// apps/cli/src/commands/providers/index.ts — DESIGN §9 verb `providers` (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/providers/**`.\nimport type { CommandModule } from '../../contract/index.ts';\n\nconst PROVIDERS = ['openai-codex', 'anthropic'] as const;\n\nconst providers: CommandModule = {\n verb: 'providers',\n async run(ctx, args) {\n if (args.subVerb !== 'list' && args.subVerb !== 'test' && args.subVerb !== undefined) return 10;\n const statuses = await ctx.runtime.resolve().authStatus([...PROVIDERS]);\n if (args.subVerb === 'test') {\n for (const status of statuses) ctx.stdio.stdout.write(`${status.provider}: ${status.state}\\n`);\n return statuses.every((status) => status.state !== 'unknown-transient') ? 0 : 1;\n }\n for (const provider of PROVIDERS) ctx.stdio.stdout.write(`${provider}\\n`);\n return 0;\n },\n};\n\nexport default providers;\n"],"mappings":";AAMA,MAAM,YAAY,CAAC,gBAAgB,WAAW;AAE9C,MAAM,YAA2B;CAC/B,MAAM;CACN,MAAM,IAAI,KAAK,MAAM;EACnB,IAAI,KAAK,YAAY,UAAU,KAAK,YAAY,UAAU,KAAK,YAAY,KAAA,GAAW,OAAO;EAC7F,MAAM,WAAW,MAAM,IAAI,QAAQ,QAAQ,CAAC,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC;EACtE,IAAI,KAAK,YAAY,QAAQ;GAC3B,KAAK,MAAM,UAAU,UAAU,IAAI,MAAM,OAAO,MAAM,GAAG,OAAO,SAAS,IAAI,OAAO,MAAM,GAAG;GAC7F,OAAO,SAAS,OAAO,WAAW,OAAO,UAAU,mBAAmB,IAAI,IAAI;EAChF;EACA,KAAK,MAAM,YAAY,WAAW,IAAI,MAAM,OAAO,MAAM,GAAG,SAAS,GAAG;EACxE,OAAO;CACT;AACF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { s as DEFAULT_CONFIG } from "./schema-C9QbUW4H.mjs";
|
|
2
|
+
import { l as deriveDesiredState, n as planReconcile, t as applyReconcile } from "./src-CmFjh4M0.mjs";
|
|
3
|
+
import { t as scanRepository } from "./scan-8Gy_B6kI.mjs";
|
|
4
|
+
//#region src/commands/reconcile/index.ts
|
|
5
|
+
const reconcile = {
|
|
6
|
+
verb: "reconcile",
|
|
7
|
+
async run(ctx, args) {
|
|
8
|
+
const model = await scanRepository(ctx.cwd, {
|
|
9
|
+
clock: ctx.clock,
|
|
10
|
+
toolVersion: "3.0.0"
|
|
11
|
+
});
|
|
12
|
+
const plan = await planReconcile({
|
|
13
|
+
root: ctx.cwd,
|
|
14
|
+
scan: (root) => scanRepository(root, {
|
|
15
|
+
clock: ctx.clock,
|
|
16
|
+
toolVersion: "3.0.0"
|
|
17
|
+
}),
|
|
18
|
+
cohorteVersion: "3.0.0",
|
|
19
|
+
clock: ctx.clock
|
|
20
|
+
});
|
|
21
|
+
if (args.positionals.includes("--apply")) {
|
|
22
|
+
const result = await applyReconcile({
|
|
23
|
+
root: ctx.cwd,
|
|
24
|
+
plan,
|
|
25
|
+
desired: deriveDesiredState({
|
|
26
|
+
model,
|
|
27
|
+
config: DEFAULT_CONFIG,
|
|
28
|
+
cohorteVersion: "3.0.0",
|
|
29
|
+
skills: {}
|
|
30
|
+
}),
|
|
31
|
+
backup: !args.positionals.includes("--no-backup"),
|
|
32
|
+
clock: ctx.clock
|
|
33
|
+
});
|
|
34
|
+
if (args.json) ctx.stdio.stdout.write(`${JSON.stringify({
|
|
35
|
+
plan,
|
|
36
|
+
result
|
|
37
|
+
})}\n`);
|
|
38
|
+
else ctx.stdio.stdout.write(`applied: ${result.applied.join(", ") || "none"}\n`);
|
|
39
|
+
return 0;
|
|
40
|
+
}
|
|
41
|
+
if (!args.positionals.includes("--plan")) return 2;
|
|
42
|
+
if (args.json) ctx.stdio.stdout.write(`${JSON.stringify(plan)}\n`);
|
|
43
|
+
else ctx.stdio.stdout.write(`${plan.operations.length} operation(s) planned\n`);
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
export { reconcile as default };
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=reconcile-Bhy3IIYo.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconcile-Bhy3IIYo.mjs","names":[],"sources":["../../../../apps/cli/src/commands/reconcile/index.ts"],"sourcesContent":["import { DEFAULT_CONFIG } from '@cohorte/config/schema';\nimport { applyReconcile, deriveDesiredState, planReconcile, scanRepository } from '@cohorte/project-model';\nimport type { CommandModule } from '../../contract/index.ts';\n\nconst reconcile: CommandModule = {\n verb: 'reconcile',\n async run(ctx, args) {\n const model = await scanRepository(ctx.cwd, { clock: ctx.clock, toolVersion: '3.0.0' });\n const plan = await planReconcile({\n root: ctx.cwd,\n scan: (root) => scanRepository(root, { clock: ctx.clock, toolVersion: '3.0.0' }),\n cohorteVersion: '3.0.0',\n clock: ctx.clock,\n });\n if (args.positionals.includes('--apply')) {\n const result = await applyReconcile({\n root: ctx.cwd,\n plan,\n desired: deriveDesiredState({ model, config: DEFAULT_CONFIG, cohorteVersion: '3.0.0', skills: {} }),\n backup: !args.positionals.includes('--no-backup'),\n clock: ctx.clock,\n });\n if (args.json) ctx.stdio.stdout.write(`${JSON.stringify({ plan, result })}\\n`);\n else ctx.stdio.stdout.write(`applied: ${result.applied.join(', ') || 'none'}\\n`);\n return 0;\n }\n if (!args.positionals.includes('--plan')) return 2;\n if (args.json) ctx.stdio.stdout.write(`${JSON.stringify(plan)}\\n`);\n else ctx.stdio.stdout.write(`${plan.operations.length} operation(s) planned\\n`);\n return 0;\n },\n};\n\nexport default reconcile;\n"],"mappings":";;;;AAIA,MAAM,YAA2B;CAC/B,MAAM;CACN,MAAM,IAAI,KAAK,MAAM;EACnB,MAAM,QAAQ,MAAM,eAAe,IAAI,KAAK;GAAE,OAAO,IAAI;GAAO,aAAa;EAAQ,CAAC;EACtF,MAAM,OAAO,MAAM,cAAc;GAC/B,MAAM,IAAI;GACV,OAAO,SAAS,eAAe,MAAM;IAAE,OAAO,IAAI;IAAO,aAAa;GAAQ,CAAC;GAC/E,gBAAgB;GAChB,OAAO,IAAI;EACb,CAAC;EACD,IAAI,KAAK,YAAY,SAAS,SAAS,GAAG;GACxC,MAAM,SAAS,MAAM,eAAe;IAClC,MAAM,IAAI;IACV;IACA,SAAS,mBAAmB;KAAE;KAAO,QAAQ;KAAgB,gBAAgB;KAAS,QAAQ,CAAC;IAAE,CAAC;IAClG,QAAQ,CAAC,KAAK,YAAY,SAAS,aAAa;IAChD,OAAO,IAAI;GACb,CAAC;GACD,IAAI,KAAK,MAAM,IAAI,MAAM,OAAO,MAAM,GAAG,KAAK,UAAU;IAAE;IAAM;GAAO,CAAC,EAAE,GAAG;QACxE,IAAI,MAAM,OAAO,MAAM,YAAY,OAAO,QAAQ,KAAK,IAAI,KAAK,OAAO,GAAG;GAC/E,OAAO;EACT;EACA,IAAI,CAAC,KAAK,YAAY,SAAS,QAAQ,GAAG,OAAO;EACjD,IAAI,KAAK,MAAM,IAAI,MAAM,OAAO,MAAM,GAAG,KAAK,UAAU,IAAI,EAAE,GAAG;OAC5D,IAAI,MAAM,OAAO,MAAM,GAAG,KAAK,WAAW,OAAO,wBAAwB;EAC9E,OAAO;CACT;AACF"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//#region src/panels/index.ts
|
|
2
|
+
const PANELS = Object.freeze({ status: async (ctx) => {
|
|
3
|
+
const store = await ctx.openStore();
|
|
4
|
+
try {
|
|
5
|
+
const runs = await store.listRuns({
|
|
6
|
+
limit: 20,
|
|
7
|
+
offset: 0
|
|
8
|
+
});
|
|
9
|
+
for (const run of runs) ctx.stdio.stdout.write(`${run.runId} ${run.state}\n`);
|
|
10
|
+
return 0;
|
|
11
|
+
} finally {
|
|
12
|
+
await store.close();
|
|
13
|
+
}
|
|
14
|
+
} });
|
|
15
|
+
function resolvePanel(kind) {
|
|
16
|
+
const panel = PANELS[kind];
|
|
17
|
+
if (!panel) throw new RangeError(`unknown panel kind: ${kind}`);
|
|
18
|
+
return panel;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/render/sanitize.ts
|
|
22
|
+
/** Escape terminal control bytes for human-facing output. JSON is never passed here. */
|
|
23
|
+
function sanitizeHuman(value) {
|
|
24
|
+
let result = "";
|
|
25
|
+
for (const char of value) {
|
|
26
|
+
const code = char.codePointAt(0) ?? 0;
|
|
27
|
+
if (char === "\n" || char === " " || code >= 32 && code !== 127 && !(code >= 128 && code <= 159)) result += char;
|
|
28
|
+
else result += `\\x${code.toString(16).padStart(2, "0").toUpperCase()}`;
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/render/index.ts
|
|
34
|
+
function createRenderer() {
|
|
35
|
+
return {
|
|
36
|
+
json(value) {
|
|
37
|
+
process.stdout.write(`${JSON.stringify(value)}\n`);
|
|
38
|
+
},
|
|
39
|
+
line(text) {
|
|
40
|
+
process.stdout.write(`${sanitizeHuman(text)}\n`);
|
|
41
|
+
},
|
|
42
|
+
async panel(kind, ctx) {
|
|
43
|
+
return resolvePanel(kind)(ctx);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function writeHuman(ctx, text) {
|
|
48
|
+
ctx.stdio.stdout.write(`${sanitizeHuman(text)}\n`);
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
export { writeHuman as n, createRenderer as t };
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=render-DyZr5Lgi.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-DyZr5Lgi.mjs","names":[],"sources":["../../../../apps/cli/src/panels/index.ts","../../../../apps/cli/src/render/sanitize.ts","../../../../apps/cli/src/render/index.ts"],"sourcesContent":["// apps/cli/src/panels/index.ts — AREA barrel: the `--panel` interactive views (francois.md), one function per\n// panel kind, looked up by `render/index.ts`. Wave-0 stub: filled by `U4.04`, which owns `apps/cli/src/panels/**`.\nimport type { CliContext } from '../contract/index.ts';\n\nexport type Panel = (ctx: CliContext) => Promise<number>;\n\nexport const PANELS: Readonly<Record<string, Panel>> = Object.freeze({\n status: async (ctx) => {\n const store = await ctx.openStore();\n try {\n const runs = await store.listRuns({ limit: 20, offset: 0 });\n for (const run of runs) ctx.stdio.stdout.write(`${run.runId} ${run.state}\\n`);\n return 0;\n } finally {\n await store.close();\n }\n },\n});\n\nexport function resolvePanel(kind: string): Panel {\n const panel = PANELS[kind];\n if (!panel) throw new RangeError(`unknown panel kind: ${kind}`);\n return panel;\n}\n","/** Escape terminal control bytes for human-facing output. JSON is never passed here. */\nexport function sanitizeHuman(value: string): string {\n let result = '';\n for (const char of value) {\n const code = char.codePointAt(0) ?? 0;\n if (char === '\\n' || char === '\\t' || (code >= 0x20 && code !== 0x7f && !(code >= 0x80 && code <= 0x9f))) {\n result += char;\n } else {\n result += `\\\\x${code.toString(16).padStart(2, '0').toUpperCase()}`;\n }\n }\n return result;\n}\n","// apps/cli/src/render/index.ts — AREA barrel: the `Renderer` port (document / NDJSON-line / `--panel` output,\n// francois.md \"10 s / 4 MiB\" one-shot budget). Wave-0 stub: filled by `U4.04`, which owns `apps/cli/src/render/**`.\nimport type { Renderer } from '../contract/index.ts';\nimport { resolvePanel } from '../panels/index.ts';\nimport { sanitizeHuman } from './sanitize.ts';\n\nexport function createRenderer(): Renderer {\n return {\n json(value) {\n process.stdout.write(`${JSON.stringify(value)}\\n`);\n },\n line(text) {\n process.stdout.write(`${sanitizeHuman(text)}\\n`);\n },\n async panel(kind, ctx) {\n return resolvePanel(kind)(ctx);\n },\n };\n}\n\nexport function writeHuman(ctx: { readonly stdio: { readonly stdout: NodeJS.WritableStream } }, text: string): void {\n ctx.stdio.stdout.write(`${sanitizeHuman(text)}\\n`);\n}\n"],"mappings":";AAMA,MAAa,SAA0C,OAAO,OAAO,EACnE,QAAQ,OAAO,QAAQ;CACrB,MAAM,QAAQ,MAAM,IAAI,UAAU;CAClC,IAAI;EACF,MAAM,OAAO,MAAM,MAAM,SAAS;GAAE,OAAO;GAAI,QAAQ;EAAE,CAAC;EAC1D,KAAK,MAAM,OAAO,MAAM,IAAI,MAAM,OAAO,MAAM,GAAG,IAAI,MAAM,GAAG,IAAI,MAAM,GAAG;EAC5E,OAAO;CACT,UAAU;EACR,MAAM,MAAM,MAAM;CACpB;AACF,EACF,CAAC;AAED,SAAgB,aAAa,MAAqB;CAChD,MAAM,QAAQ,OAAO;CACrB,IAAI,CAAC,OAAO,MAAM,IAAI,WAAW,uBAAuB,MAAM;CAC9D,OAAO;AACT;;;;ACtBA,SAAgB,cAAc,OAAuB;CACnD,IAAI,SAAS;CACb,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,OAAO,KAAK,YAAY,CAAC,KAAK;EACpC,IAAI,SAAS,QAAQ,SAAS,OAAS,QAAQ,MAAQ,SAAS,OAAQ,EAAE,QAAQ,OAAQ,QAAQ,MAChG,UAAU;OAEV,UAAU,MAAM,KAAK,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,YAAY;CAEnE;CACA,OAAO;AACT;;;ACNA,SAAgB,iBAA2B;CACzC,OAAO;EACL,KAAK,OAAO;GACV,QAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,KAAK,EAAE,GAAG;EACnD;EACA,KAAK,MAAM;GACT,QAAQ,OAAO,MAAM,GAAG,cAAc,IAAI,EAAE,GAAG;EACjD;EACA,MAAM,MAAM,MAAM,KAAK;GACrB,OAAO,aAAa,IAAI,CAAC,CAAC,GAAG;EAC/B;CACF;AACF;AAEA,SAAgB,WAAW,KAAqE,MAAoB;CAClH,IAAI,MAAM,OAAO,MAAM,GAAG,cAAc,IAAI,EAAE,GAAG;AACnD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/commands/resume/index.ts
|
|
2
|
+
const resume = {
|
|
3
|
+
verb: "resume",
|
|
4
|
+
async run(ctx, args) {
|
|
5
|
+
const runId = args.positionals[0];
|
|
6
|
+
if (!runId) return 2;
|
|
7
|
+
const result = await ctx.controller.send("resume", {}, { runId });
|
|
8
|
+
ctx.stdio.stdout.write(`${JSON.stringify(result)}\n`);
|
|
9
|
+
return result.status === "rejected" ? 3 : result.status === "pending" ? 4 : 0;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { resume as default };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=resume-GJQRb2Eb.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resume-GJQRb2Eb.mjs","names":[],"sources":["../../../../apps/cli/src/commands/resume/index.ts"],"sourcesContent":["// apps/cli/src/commands/resume/index.ts — DESIGN §9 verb `resume` (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/resume/**`.\nimport type { CommandModule } from '../../contract/index.ts';\n\nconst resume: CommandModule = {\n verb: 'resume',\n async run(ctx, args) {\n const runId = args.positionals[0];\n if (!runId) return 2;\n const result = await ctx.controller.send('resume', {}, { runId });\n ctx.stdio.stdout.write(`${JSON.stringify(result)}\\n`);\n return result.status === 'rejected' ? 3 : result.status === 'pending' ? 4 : 0;\n },\n};\n\nexport default resume;\n"],"mappings":";AAMA,MAAM,SAAwB;CAC5B,MAAM;CACN,MAAM,IAAI,KAAK,MAAM;EACnB,MAAM,QAAQ,KAAK,YAAY;EAC/B,IAAI,CAAC,OAAO,OAAO;EACnB,MAAM,SAAS,MAAM,IAAI,WAAW,KAAK,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC;EAChE,IAAI,MAAM,OAAO,MAAM,GAAG,KAAK,UAAU,MAAM,EAAE,GAAG;EACpD,OAAO,OAAO,WAAW,aAAa,IAAI,OAAO,WAAW,YAAY,IAAI;CAC9E;AACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/commands/retry/index.ts
|
|
2
|
+
const retry = {
|
|
3
|
+
verb: "retry",
|
|
4
|
+
async run(ctx, args) {
|
|
5
|
+
const runId = args.positionals[0];
|
|
6
|
+
if (!runId) return 2;
|
|
7
|
+
const result = await ctx.controller.send("retry", { target: { kind: "phase" } }, { runId });
|
|
8
|
+
ctx.stdio.stdout.write(`${JSON.stringify(result)}\n`);
|
|
9
|
+
return result.status === "rejected" ? 3 : result.status === "pending" ? 4 : 0;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { retry as default };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=retry-CLrUem1H.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry-CLrUem1H.mjs","names":[],"sources":["../../../../apps/cli/src/commands/retry/index.ts"],"sourcesContent":["// apps/cli/src/commands/retry/index.ts — DESIGN §9 verb `retry` (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/retry/**`.\nimport type { CommandModule } from '../../contract/index.ts';\n\nconst retry: CommandModule = {\n verb: 'retry',\n async run(ctx, args) {\n const runId = args.positionals[0];\n if (!runId) return 2;\n const result = await ctx.controller.send('retry', { target: { kind: 'phase' } }, { runId });\n ctx.stdio.stdout.write(`${JSON.stringify(result)}\\n`);\n return result.status === 'rejected' ? 3 : result.status === 'pending' ? 4 : 0;\n },\n};\n\nexport default retry;\n"],"mappings":";AAMA,MAAM,QAAuB;CAC3B,MAAM;CACN,MAAM,IAAI,KAAK,MAAM;EACnB,MAAM,QAAQ,KAAK,YAAY;EAC/B,IAAI,CAAC,OAAO,OAAO;EACnB,MAAM,SAAS,MAAM,IAAI,WAAW,KAAK,SAAS,EAAE,QAAQ,EAAE,MAAM,QAAQ,EAAE,GAAG,EAAE,MAAM,CAAC;EAC1F,IAAI,MAAM,OAAO,MAAM,GAAG,KAAK,UAAU,MAAM,EAAE,GAAG;EACpD,OAAO,OAAO,WAAW,aAAa,IAAI,OAAO,WAAW,YAAY,IAAI;CAC9E;AACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/commands/review/index.ts
|
|
2
|
+
const review = {
|
|
3
|
+
verb: "review",
|
|
4
|
+
async run(ctx, args) {
|
|
5
|
+
const result = await ctx.controller.send("start", {
|
|
6
|
+
profile: "review",
|
|
7
|
+
unattended: false,
|
|
8
|
+
...args.positionals[0] ? { reviewTarget: { ref: args.positionals[0] } } : {}
|
|
9
|
+
});
|
|
10
|
+
ctx.stdio.stdout.write(`${JSON.stringify(result)}\n`);
|
|
11
|
+
return result.status === "rejected" ? 3 : result.status === "pending" ? 4 : 0;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { review as default };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=review-BDdjb6kB.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-BDdjb6kB.mjs","names":[],"sources":["../../../../apps/cli/src/commands/review/index.ts"],"sourcesContent":["// apps/cli/src/commands/review/index.ts — DESIGN §9 verb `review` (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/review/**`.\nimport type { CommandModule } from '../../contract/index.ts';\n\nconst review: CommandModule = {\n verb: 'review',\n async run(ctx, args) {\n const result = await ctx.controller.send('start', {\n profile: 'review',\n unattended: false,\n ...(args.positionals[0] ? { reviewTarget: { ref: args.positionals[0] } } : {}),\n });\n ctx.stdio.stdout.write(`${JSON.stringify(result)}\\n`);\n return result.status === 'rejected' ? 3 : result.status === 'pending' ? 4 : 0;\n },\n};\n\nexport default review;\n"],"mappings":";AAMA,MAAM,SAAwB;CAC5B,MAAM;CACN,MAAM,IAAI,KAAK,MAAM;EACnB,MAAM,SAAS,MAAM,IAAI,WAAW,KAAK,SAAS;GAChD,SAAS;GACT,YAAY;GACZ,GAAI,KAAK,YAAY,KAAK,EAAE,cAAc,EAAE,KAAK,KAAK,YAAY,GAAG,EAAE,IAAI,CAAC;EAC9E,CAAC;EACD,IAAI,MAAM,OAAO,MAAM,GAAG,KAAK,UAAU,MAAM,EAAE,GAAG;EACpD,OAAO,OAAO,WAAW,aAAa,IAAI,OAAO,WAAW,YAAY,IAAI;CAC9E;AACF"}
|