cohorte 2.10.1 → 3.0.0-dev.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/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 +155 -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 +50 -0
- package/dist/agent-host.mjs.map +1 -0
- package/dist/bundle-manifest.json +102 -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-D8rCVY33.mjs +84 -0
- package/dist/chunks/auth-D8rCVY33.mjs.map +1 -0
- package/dist/chunks/brainstorm-CU10T1tm.mjs +7 -0
- package/dist/chunks/brainstorm-CU10T1tm.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-Cr0hP0qm.mjs +7303 -0
- package/dist/chunks/compose-Cr0hP0qm.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-B0ra2-bm.mjs +295 -0
- package/dist/chunks/contract-B0ra2-bm.mjs.map +1 -0
- package/dist/chunks/contract-vYbwYr0Y.mjs +123 -0
- package/dist/chunks/contract-vYbwYr0Y.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-30Ciya_0.mjs +20 -0
- package/dist/chunks/discover-30Ciya_0.mjs.map +1 -0
- package/dist/chunks/doctor-DfCrKpfT.mjs +222 -0
- package/dist/chunks/doctor-DfCrKpfT.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-Okz4mlhW.mjs +30 -0
- package/dist/chunks/init-Okz4mlhW.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-DRoFUg53.mjs +19 -0
- package/dist/chunks/migrate-DRoFUg53.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-BfD785gd.mjs +26 -0
- package/dist/chunks/reconcile-BfD785gd.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/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-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-JxawBQBn.mjs +446 -0
- package/dist/chunks/src-JxawBQBn.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,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,19 @@
|
|
|
1
|
+
//#region src/commands/migrate/index.ts
|
|
2
|
+
const migrate = {
|
|
3
|
+
verb: "migrate",
|
|
4
|
+
async run(ctx, args) {
|
|
5
|
+
const store = await (ctx.openMigrationStore ?? ctx.openStore)();
|
|
6
|
+
try {
|
|
7
|
+
const apply = args.positionals.includes("--apply");
|
|
8
|
+
const report = await store.migrate(apply ? "apply" : "check");
|
|
9
|
+
ctx.stdio.stdout.write(`${JSON.stringify(report)}\n`);
|
|
10
|
+
return !apply && report.pending.length > 0 ? 3 : 0;
|
|
11
|
+
} finally {
|
|
12
|
+
await store.close();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { migrate as default };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=migrate-DRoFUg53.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate-DRoFUg53.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 type { CommandModule } from '../../contract/index.ts';\n\nconst migrate: CommandModule = {\n verb: 'migrate',\n async run(ctx, args) {\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":";AAMA,MAAM,UAAyB;CAC7B,MAAM;CACN,MAAM,IAAI,KAAK,MAAM;EACnB,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":"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"}
|
|
@@ -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,26 @@
|
|
|
1
|
+
import { N as errorOf, j as CohorteError } from "./src-Cu3TxNob.mjs";
|
|
2
|
+
import { n as planReconcile, t as scanRepository } from "./src-JxawBQBn.mjs";
|
|
3
|
+
//#region src/commands/reconcile/index.ts
|
|
4
|
+
const reconcile = {
|
|
5
|
+
verb: "reconcile",
|
|
6
|
+
async run(ctx, args) {
|
|
7
|
+
if (args.positionals.includes("--apply")) throw new CohorteError(errorOf("configuration/phase-not-available", "reconcile --apply is not available in V3.0"));
|
|
8
|
+
if (!args.positionals.includes("--plan")) return 2;
|
|
9
|
+
const plan = await planReconcile({
|
|
10
|
+
root: ctx.cwd,
|
|
11
|
+
scan: (root) => scanRepository(root, {
|
|
12
|
+
clock: ctx.clock,
|
|
13
|
+
toolVersion: "3.0.0"
|
|
14
|
+
}),
|
|
15
|
+
cohorteVersion: "3.0.0",
|
|
16
|
+
clock: ctx.clock
|
|
17
|
+
});
|
|
18
|
+
if (args.json) ctx.stdio.stdout.write(`${JSON.stringify(plan)}\n`);
|
|
19
|
+
else ctx.stdio.stdout.write(`${plan.operations.length} operation(s) planned\n`);
|
|
20
|
+
return 0;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { reconcile as default };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=reconcile-BfD785gd.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconcile-BfD785gd.mjs","names":[],"sources":["../../../../apps/cli/src/commands/reconcile/index.ts"],"sourcesContent":["import { CohorteError, errorOf } from '@cohorte/base';\nimport { 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 if (args.positionals.includes('--apply')) {\n throw new CohorteError(\n errorOf('configuration/phase-not-available', 'reconcile --apply is not available in V3.0'),\n );\n }\n if (!args.positionals.includes('--plan')) return 2;\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.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,IAAI,KAAK,YAAY,SAAS,SAAS,GACrC,MAAM,IAAI,aACR,QAAQ,qCAAqC,4CAA4C,CAC3F;EAEF,IAAI,CAAC,KAAK,YAAY,SAAS,QAAQ,GAAG,OAAO;EACjD,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,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"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { n as sha256Hex } 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 { join } from "node:path";
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
7
|
+
//#region src/commands/run/index.ts
|
|
8
|
+
const run = {
|
|
9
|
+
verb: "run",
|
|
10
|
+
async run(ctx, args) {
|
|
11
|
+
const valueAfter = (flag) => {
|
|
12
|
+
const index = args.positionals.indexOf(flag);
|
|
13
|
+
return index >= 0 ? args.positionals[index + 1] : void 0;
|
|
14
|
+
};
|
|
15
|
+
const profile = valueAfter("--profile") ?? args.positionals.find((value) => [
|
|
16
|
+
"feature",
|
|
17
|
+
"bugfix",
|
|
18
|
+
"review"
|
|
19
|
+
].includes(value)) ?? "feature";
|
|
20
|
+
if (![
|
|
21
|
+
"feature",
|
|
22
|
+
"bugfix",
|
|
23
|
+
"review"
|
|
24
|
+
].includes(profile)) return 2;
|
|
25
|
+
const spec = args.positionals.find((value, index) => !value.startsWith("--") && args.positionals[index - 1] !== "--profile" && args.positionals[index - 1] !== "--runtime" && args.positionals[index - 1] !== "--script" && args.positionals[index - 1] !== "--model" && ![
|
|
26
|
+
"feature",
|
|
27
|
+
"bugfix",
|
|
28
|
+
"review"
|
|
29
|
+
].includes(value));
|
|
30
|
+
const model = valueAfter("--model");
|
|
31
|
+
const waitValue = valueAfter("--wait");
|
|
32
|
+
const waitMs = waitValue === void 0 ? void 0 : Number(waitValue) * 1e3;
|
|
33
|
+
if (waitValue !== void 0 && (!Number.isFinite(waitMs) || waitMs < 0)) return 2;
|
|
34
|
+
const trustProjectConfig = args.positionals.includes("--trust-project-config");
|
|
35
|
+
let consent;
|
|
36
|
+
if (ctx.env.HOME && existsSync(join(ctx.cwd, ".cohorte", "config.yaml"))) {
|
|
37
|
+
const home = ctx.env.HOME ?? ctx.cwd;
|
|
38
|
+
const loaded = await loadConfig({
|
|
39
|
+
cwd: ctx.cwd,
|
|
40
|
+
home
|
|
41
|
+
});
|
|
42
|
+
const keys = createKeyStore({ directory: join(home, ".cohorte", "keys") });
|
|
43
|
+
const trustStore = createTrustStore({
|
|
44
|
+
directory: join(home, ".cohorte", "trust"),
|
|
45
|
+
keys
|
|
46
|
+
});
|
|
47
|
+
const resolved = await resolveConfig(loaded, {
|
|
48
|
+
trustStore,
|
|
49
|
+
projectKeyId: sha256Hex(loaded.projectRoot).slice(0, 24)
|
|
50
|
+
});
|
|
51
|
+
if (resolved.status === "untrusted" && !trustProjectConfig) throw new CohorteError(errorOf("security/project-policy-untrusted", `project policy is untrusted (${resolved.loosenedKeys.join(", ") || "unknown key"})`));
|
|
52
|
+
if (resolved.status === "untrusted") consent = {
|
|
53
|
+
policySha256: resolved.policySha256,
|
|
54
|
+
via: "cli-flag"
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const payload = {
|
|
58
|
+
profile,
|
|
59
|
+
unattended: false,
|
|
60
|
+
...spec ? { spec: { path: spec } } : {},
|
|
61
|
+
...valueAfter("--runtime") ? { runtime: valueAfter("--runtime") } : {},
|
|
62
|
+
...valueAfter("--script") ? { fakeScript: valueAfter("--script") } : {},
|
|
63
|
+
...model ? { modelOverrides: { implementer: {
|
|
64
|
+
provider: "default",
|
|
65
|
+
model
|
|
66
|
+
} } } : {},
|
|
67
|
+
...consent ? { consent } : {}
|
|
68
|
+
};
|
|
69
|
+
const result = waitMs === void 0 ? await ctx.controller.send("start", payload) : await ctx.controller.send("start", payload, { waitMs });
|
|
70
|
+
if (result.status === "pending" && result.result && typeof result.result === "object" && "runId" in result.result) {
|
|
71
|
+
const runId = result.result.runId;
|
|
72
|
+
if (runId) await ctx.hostSpawner.spawnDetached(runId);
|
|
73
|
+
}
|
|
74
|
+
if (args.json) ctx.stdio.stdout.write(`${JSON.stringify(result)}\n`);
|
|
75
|
+
else ctx.stdio.stdout.write(`${result.status}\n`);
|
|
76
|
+
return result.status === "rejected" ? 3 : result.status === "pending" ? 4 : 0;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
//#endregion
|
|
80
|
+
export { run as default };
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=run-CgTWYlcd.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-CgTWYlcd.mjs","names":[],"sources":["../../../../apps/cli/src/commands/run/index.ts"],"sourcesContent":["// apps/cli/src/commands/run/index.ts — DESIGN §9 verb `run` (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/run/**`.\nimport { existsSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { CohorteError, errorOf, type Sha256, sha256Hex } from '@cohorte/base';\nimport { loadConfig, resolveConfig } from '@cohorte/config';\nimport { createKeyStore, createTrustStore } from '@cohorte/security/auth';\nimport type { CommandModule } from '../../contract/index.ts';\n\nconst run: CommandModule = {\n verb: 'run',\n async run(ctx, args) {\n const valueAfter = (flag: string): string | undefined => {\n const index = args.positionals.indexOf(flag);\n return index >= 0 ? args.positionals[index + 1] : undefined;\n };\n const profile = (valueAfter('--profile') ??\n args.positionals.find((value) => ['feature', 'bugfix', 'review'].includes(value)) ??\n 'feature') as 'feature' | 'bugfix' | 'review';\n if (!['feature', 'bugfix', 'review'].includes(profile)) return 2;\n const spec = args.positionals.find(\n (value, index) =>\n !value.startsWith('--') &&\n args.positionals[index - 1] !== '--profile' &&\n args.positionals[index - 1] !== '--runtime' &&\n args.positionals[index - 1] !== '--script' &&\n args.positionals[index - 1] !== '--model' &&\n !['feature', 'bugfix', 'review'].includes(value),\n );\n const model = valueAfter('--model');\n const waitValue = valueAfter('--wait');\n const waitMs = waitValue === undefined ? undefined : Number(waitValue) * 1000;\n if (waitValue !== undefined && (!Number.isFinite(waitMs) || (waitMs as number) < 0)) return 2;\n const trustProjectConfig = args.positionals.includes('--trust-project-config');\n let consent: { policySha256: Sha256; via: 'cli-flag' } | undefined;\n // Test/fake contexts intentionally omit HOME; a real CLI invocation always\n // supplies it and is the only context allowed to resolve project trust.\n if (ctx.env.HOME && existsSync(join(ctx.cwd, '.cohorte', 'config.yaml'))) {\n const home = ctx.env.HOME ?? ctx.cwd;\n const loaded = await loadConfig({ cwd: ctx.cwd, home });\n const keys = createKeyStore({ directory: join(home, '.cohorte', 'keys') });\n const trustStore = createTrustStore({ directory: join(home, '.cohorte', 'trust'), keys });\n const resolved = await resolveConfig(loaded, {\n trustStore,\n projectKeyId: sha256Hex(loaded.projectRoot).slice(0, 24),\n });\n if (resolved.status === 'untrusted' && !trustProjectConfig) {\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 if (resolved.status === 'untrusted') consent = { policySha256: resolved.policySha256, via: 'cli-flag' };\n }\n const payload = {\n profile,\n unattended: false,\n ...(spec ? { spec: { path: spec } } : {}),\n ...(valueAfter('--runtime') ? { runtime: valueAfter('--runtime') as string } : {}),\n ...(valueAfter('--script') ? { fakeScript: valueAfter('--script') as string } : {}),\n ...(model ? { modelOverrides: { implementer: { provider: 'default', model } } } : {}),\n ...(consent ? { consent } : {}),\n };\n const result =\n waitMs === undefined\n ? await ctx.controller.send('start', payload)\n : await ctx.controller.send('start', payload, { waitMs });\n if (result.status === 'pending' && result.result && typeof result.result === 'object' && 'runId' in result.result) {\n const runId = (result.result as { runId?: string }).runId;\n if (runId) await ctx.hostSpawner.spawnDetached(runId);\n }\n if (args.json) ctx.stdio.stdout.write(`${JSON.stringify(result)}\\n`);\n else ctx.stdio.stdout.write(`${result.status}\\n`);\n return result.status === 'rejected' ? 3 : result.status === 'pending' ? 4 : 0;\n },\n};\n\nexport default run;\n"],"mappings":"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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region src/commands/run-tool/index.ts
|
|
2
|
+
const runTool = {
|
|
3
|
+
verb: "run-tool",
|
|
4
|
+
async run(ctx, args) {
|
|
5
|
+
const [runId, tool, inputText, ...justificationParts] = args.positionals;
|
|
6
|
+
if (!runId || !tool || !inputText || justificationParts.length === 0) return 2;
|
|
7
|
+
let input;
|
|
8
|
+
try {
|
|
9
|
+
input = JSON.parse(inputText);
|
|
10
|
+
} catch {
|
|
11
|
+
return 2;
|
|
12
|
+
}
|
|
13
|
+
const result = await ctx.controller.send("run-tool", {
|
|
14
|
+
tool,
|
|
15
|
+
input,
|
|
16
|
+
justification: justificationParts.join(" ")
|
|
17
|
+
}, { runId });
|
|
18
|
+
if (args.json) ctx.stdio.stdout.write(`${JSON.stringify(result)}\n`);
|
|
19
|
+
else ctx.stdio.stdout.write(`${result.status}\n`);
|
|
20
|
+
return result.status === "rejected" ? 3 : result.status === "pending" ? 4 : 0;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { runTool as default };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=run-tool-C3rAv4XF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-tool-C3rAv4XF.mjs","names":[],"sources":["../../../../apps/cli/src/commands/run-tool/index.ts"],"sourcesContent":["import type { CommandModule } from '../../contract/index.ts';\n\nconst runTool: CommandModule = {\n verb: 'run-tool',\n async run(ctx, args) {\n const [runId, tool, inputText, ...justificationParts] = args.positionals;\n if (!runId || !tool || !inputText || justificationParts.length === 0) return 2;\n let input: unknown;\n try {\n input = JSON.parse(inputText);\n } catch {\n return 2;\n }\n const result = await ctx.controller.send(\n 'run-tool',\n { tool, input: input as never, justification: justificationParts.join(' ') },\n { runId },\n );\n if (args.json) ctx.stdio.stdout.write(`${JSON.stringify(result)}\\n`);\n else ctx.stdio.stdout.write(`${result.status}\\n`);\n return result.status === 'rejected' ? 3 : result.status === 'pending' ? 4 : 0;\n },\n};\n\nexport default runTool;\n"],"mappings":";AAEA,MAAM,UAAyB;CAC7B,MAAM;CACN,MAAM,IAAI,KAAK,MAAM;EACnB,MAAM,CAAC,OAAO,MAAM,WAAW,GAAG,sBAAsB,KAAK;EAC7D,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,aAAa,mBAAmB,WAAW,GAAG,OAAO;EAC7E,IAAI;EACJ,IAAI;GACF,QAAQ,KAAK,MAAM,SAAS;EAC9B,QAAQ;GACN,OAAO;EACT;EACA,MAAM,SAAS,MAAM,IAAI,WAAW,KAClC,YACA;GAAE;GAAa;GAAgB,eAAe,mBAAmB,KAAK,GAAG;EAAE,GAC3E,EAAE,MAAM,CACV;EACA,IAAI,KAAK,MAAM,IAAI,MAAM,OAAO,MAAM,GAAG,KAAK,UAAU,MAAM,EAAE,GAAG;OAC9D,IAAI,MAAM,OAAO,MAAM,GAAG,OAAO,OAAO,GAAG;EAChD,OAAO,OAAO,WAAW,aAAa,IAAI,OAAO,WAAW,YAAY,IAAI;CAC9E;AACF"}
|