@pedrocivita/tocket 2.5.0 → 2.6.4
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 +233 -18
- package/dist/commands/agents-md.cmd.d.ts +2 -0
- package/dist/commands/agents-md.cmd.js +166 -0
- package/dist/commands/agents-md.cmd.js.map +1 -0
- package/dist/commands/decide.cmd.d.ts +2 -0
- package/dist/commands/decide.cmd.js +70 -0
- package/dist/commands/decide.cmd.js.map +1 -0
- package/dist/commands/doctor.cmd.d.ts +13 -0
- package/dist/commands/doctor.cmd.js +135 -11
- package/dist/commands/doctor.cmd.js.map +1 -1
- package/dist/commands/eject.cmd.d.ts +1 -1
- package/dist/commands/eject.cmd.js +3 -1
- package/dist/commands/eject.cmd.js.map +1 -1
- package/dist/commands/init.cmd.js +67 -13
- package/dist/commands/init.cmd.js.map +1 -1
- package/dist/commands/scaffold.cmd.d.ts +2 -0
- package/dist/commands/scaffold.cmd.js +118 -0
- package/dist/commands/scaffold.cmd.js.map +1 -0
- package/dist/commands/suite.cmd.d.ts +2 -0
- package/dist/commands/suite.cmd.js +387 -0
- package/dist/commands/suite.cmd.js.map +1 -0
- package/dist/commands/validate.cmd.js +1 -0
- package/dist/commands/validate.cmd.js.map +1 -1
- package/dist/commands/work.cmd.d.ts +2 -0
- package/dist/commands/work.cmd.js +48 -0
- package/dist/commands/work.cmd.js.map +1 -0
- package/dist/eval/decide-eval.d.ts +28 -0
- package/dist/eval/decide-eval.js +34 -0
- package/dist/eval/decide-eval.js.map +1 -0
- package/dist/eval/triage-eval.d.ts +46 -0
- package/dist/eval/triage-eval.js +175 -0
- package/dist/eval/triage-eval.js.map +1 -0
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.d.ts +2 -0
- package/dist/mcp/index.js +7 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/server.d.ts +4 -0
- package/dist/mcp/server.js +360 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/templates/memory-bank.d.ts +11 -0
- package/dist/templates/memory-bank.js +456 -329
- package/dist/templates/memory-bank.js.map +1 -1
- package/dist/tests/agents.test.js +73 -1
- package/dist/tests/agents.test.js.map +1 -1
- package/dist/tests/context.test.js +10 -1
- package/dist/tests/context.test.js.map +1 -1
- package/dist/tests/decide.test.d.ts +1 -0
- package/dist/tests/decide.test.js +483 -0
- package/dist/tests/decide.test.js.map +1 -0
- package/dist/tests/doctor.test.js +74 -1
- package/dist/tests/doctor.test.js.map +1 -1
- package/dist/tests/eject.test.js +3 -0
- package/dist/tests/eject.test.js.map +1 -1
- package/dist/tests/git.test.js +17 -0
- package/dist/tests/git.test.js.map +1 -1
- package/dist/tests/helpers.d.ts +6 -0
- package/dist/tests/helpers.js +13 -0
- package/dist/tests/helpers.js.map +1 -0
- package/dist/tests/helpers.test.d.ts +1 -0
- package/dist/tests/helpers.test.js +23 -0
- package/dist/tests/helpers.test.js.map +1 -0
- package/dist/tests/init.test.js +85 -5
- package/dist/tests/init.test.js.map +1 -1
- package/dist/tests/loop.test.d.ts +1 -0
- package/dist/tests/loop.test.js +153 -0
- package/dist/tests/loop.test.js.map +1 -0
- package/dist/tests/memory-bank.test.js +53 -1
- package/dist/tests/memory-bank.test.js.map +1 -1
- package/dist/tests/suite.test.d.ts +1 -0
- package/dist/tests/suite.test.js +199 -0
- package/dist/tests/suite.test.js.map +1 -0
- package/dist/tests/triage.test.d.ts +1 -0
- package/dist/tests/triage.test.js +152 -0
- package/dist/tests/triage.test.js.map +1 -0
- package/dist/tests/work.test.d.ts +1 -0
- package/dist/tests/work.test.js +276 -0
- package/dist/tests/work.test.js.map +1 -0
- package/dist/utils/agents.d.ts +25 -0
- package/dist/utils/agents.js +92 -0
- package/dist/utils/agents.js.map +1 -1
- package/dist/utils/appmaps.d.ts +65 -0
- package/dist/utils/appmaps.js +280 -0
- package/dist/utils/appmaps.js.map +1 -0
- package/dist/utils/context.d.ts +2 -0
- package/dist/utils/context.js +21 -0
- package/dist/utils/context.js.map +1 -1
- package/dist/utils/decide.d.ts +178 -0
- package/dist/utils/decide.js +614 -0
- package/dist/utils/decide.js.map +1 -0
- package/dist/utils/git.js +8 -1
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/jev.d.ts +83 -0
- package/dist/utils/jev.js +190 -0
- package/dist/utils/jev.js.map +1 -0
- package/dist/utils/triage.d.ts +87 -0
- package/dist/utils/triage.js +241 -0
- package/dist/utils/triage.js.map +1 -0
- package/dist/utils/work.d.ts +72 -0
- package/dist/utils/work.js +225 -0
- package/dist/utils/work.js.map +1 -0
- package/package.json +53 -50
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-bank.js","sourceRoot":"","sources":["../../src/templates/memory-bank.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,WAAmB,EACnB,WAAmB,EACnB,YAAY,GAAG,aAAa,EAC5B,aAAa,GAAG,WAAW,EAC3B,EAAE,CACF,KAAK,WAAW;;8CAE4B,YAAY;;;;;4BAK9B,YAAY,WAAW,WAAW;EAC5D,WAAW,CAAC,CAAC,CAAC,OAAO,WAAW,IAAI,CAAC,CAAC,CAAC,EAAE;;;;;;;;4EAQiC,aAAa
|
|
1
|
+
{"version":3,"file":"memory-bank.js","sourceRoot":"","sources":["../../src/templates/memory-bank.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,WAAmB,EACnB,WAAmB,EACnB,YAAY,GAAG,aAAa,EAC5B,aAAa,GAAG,WAAW,EAC3B,EAAE,CACF,KAAK,WAAW;;8CAE4B,YAAY;;;;;4BAK9B,YAAY,WAAW,WAAW;EAC5D,WAAW,CAAC,CAAC,CAAC,OAAO,WAAW,IAAI,CAAC,CAAC,CAAC,EAAE;;;;;;;;4EAQiC,aAAa;;;;;;;;;;;;;;;MAenF,aAAa;;;;;;;;;CASlB,CAAC;AAEF,yCAAyC;AACzC,MAAM,CAAC,MAAM,QAA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AAC;;;;;;;;;IAS/B,mBAAmB;;;;;;;;;;;;;;EAcrB,iBAAiB;;;;;;;;;;;;;CAalB,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { describe, it } from "node:test";
|
|
2
2
|
import assert from "node:assert/strict";
|
|
3
|
-
import {
|
|
3
|
+
import { mkdtempSync, rmSync, writeFileSync, mkdirSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { getExecutorFileName, getArchitectFileName, getExecutorDisplayName, getArchitectDisplayName, detectPreferredAgents, resolveInitAgents, envFlag, DEFAULT_EXECUTOR, DEFAULT_ARCHITECT, EXECUTOR_FILE_MAP, ARCHITECT_FILE_MAP, } from "../utils/agents.js";
|
|
4
7
|
// ─── getExecutorFileName ────────────────────────────────────────────
|
|
5
8
|
describe("getExecutorFileName", () => {
|
|
6
9
|
it("returns CLAUDE.md for 'Claude Code'", () => {
|
|
@@ -99,4 +102,73 @@ describe("agent constants", () => {
|
|
|
99
102
|
assert.ok("gemini" in ARCHITECT_FILE_MAP);
|
|
100
103
|
});
|
|
101
104
|
});
|
|
105
|
+
describe("envFlag", () => {
|
|
106
|
+
it("is case-insensitive and treats blank values as unset", () => {
|
|
107
|
+
assert.equal(envFlag({ cursor_trace_id: "abc" }, "CURSOR_TRACE_ID"), true);
|
|
108
|
+
assert.equal(envFlag({ CURSOR_TRACE_ID: "abc" }, "cursor_trace_id"), true);
|
|
109
|
+
assert.equal(envFlag({ CURSOR_TRACE_ID: "" }, "CURSOR_TRACE_ID"), false);
|
|
110
|
+
assert.equal(envFlag({ CURSOR_TRACE_ID: " " }, "CURSOR_TRACE_ID"), false);
|
|
111
|
+
assert.equal(envFlag({}, "CURSOR_TRACE_ID"), false);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
describe("detectPreferredAgents", () => {
|
|
115
|
+
it("detects Cursor from .cursorrules and Claude from env", () => {
|
|
116
|
+
const dir = mkdtempSync(join(tmpdir(), "tocket-detect-"));
|
|
117
|
+
try {
|
|
118
|
+
writeFileSync(join(dir, ".cursorrules"), "rules\n", "utf-8");
|
|
119
|
+
const fromFile = detectPreferredAgents(dir, {});
|
|
120
|
+
assert.equal(fromFile.executor, "Cursor");
|
|
121
|
+
assert.equal(fromFile.executorSource, "file");
|
|
122
|
+
const empty = mkdtempSync(join(tmpdir(), "tocket-detect-empty-"));
|
|
123
|
+
try {
|
|
124
|
+
const fromEnv = detectPreferredAgents(empty, { CURSOR_TRACE_ID: "abc" });
|
|
125
|
+
assert.equal(fromEnv.executor, "Cursor");
|
|
126
|
+
assert.equal(fromEnv.executorSource, "env");
|
|
127
|
+
const fromEnvCasing = detectPreferredAgents(empty, { cursor_trace_id: "abc" });
|
|
128
|
+
assert.equal(fromEnvCasing.executor, "Cursor");
|
|
129
|
+
assert.equal(fromEnvCasing.executorSource, "env");
|
|
130
|
+
const emptyCursor = detectPreferredAgents(empty, { CURSOR_TRACE_ID: " " });
|
|
131
|
+
assert.equal(emptyCursor.executor, undefined);
|
|
132
|
+
const claude = detectPreferredAgents(empty, { CLAUDECODE: "1" });
|
|
133
|
+
assert.equal(claude.executor, "Claude Code");
|
|
134
|
+
}
|
|
135
|
+
finally {
|
|
136
|
+
rmSync(empty, { recursive: true, force: true });
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
finally {
|
|
140
|
+
rmSync(dir, { recursive: true, force: true });
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
it("detects Copilot and Gemini from files", () => {
|
|
144
|
+
const dir = mkdtempSync(join(tmpdir(), "tocket-detect-copilot-"));
|
|
145
|
+
try {
|
|
146
|
+
mkdirSync(join(dir, ".github"), { recursive: true });
|
|
147
|
+
writeFileSync(join(dir, ".github", "copilot-instructions.md"), "hi\n", "utf-8");
|
|
148
|
+
writeFileSync(join(dir, "GEMINI.md"), "arch\n", "utf-8");
|
|
149
|
+
const detected = detectPreferredAgents(dir, {});
|
|
150
|
+
assert.equal(detected.executor, "Copilot");
|
|
151
|
+
assert.equal(detected.architect, "Gemini");
|
|
152
|
+
}
|
|
153
|
+
finally {
|
|
154
|
+
rmSync(dir, { recursive: true, force: true });
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
describe("resolveInitAgents", () => {
|
|
159
|
+
it("prefers flag, then config, then detected, then default", () => {
|
|
160
|
+
const detected = {
|
|
161
|
+
executor: "Cursor",
|
|
162
|
+
architect: "Gemini",
|
|
163
|
+
executorSource: "file",
|
|
164
|
+
architectSource: "file",
|
|
165
|
+
};
|
|
166
|
+
assert.equal(resolveInitAgents({ executorFlag: "Copilot", detected }).executor, "Copilot");
|
|
167
|
+
assert.equal(resolveInitAgents({ configExecutor: "Windsurf", detected }).executor, "Windsurf");
|
|
168
|
+
assert.equal(resolveInitAgents({ detected }).executor, "Cursor");
|
|
169
|
+
assert.equal(resolveInitAgents({
|
|
170
|
+
detected: { executorSource: "none", architectSource: "none" },
|
|
171
|
+
}).executor, DEFAULT_EXECUTOR);
|
|
172
|
+
});
|
|
173
|
+
});
|
|
102
174
|
//# sourceMappingURL=agents.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.test.js","sourceRoot":"","sources":["../../src/tests/agents.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAE5B,uEAAuE;AAEvE,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;QAC7C,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,aAAa,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C,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EACjE,SAAS,CACV,CAAC;QACF,MAAM,CAAC,KAAK,CACV,iBAAiB,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EACpE,UAAU,CACX,CAAC;QACF,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACjE,MAAM,CAAC,KAAK,CACV,iBAAiB,CAAC;YAChB,QAAQ,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE;SAC9D,CAAC,CAAC,QAAQ,EACX,gBAAgB,CACjB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, it } from "node:test";
|
|
2
2
|
import assert from "node:assert/strict";
|
|
3
|
-
import { extractFocus, STALENESS_THRESHOLD_DAYS } from "../utils/context.js";
|
|
3
|
+
import { extractFocus, STALENESS_THRESHOLD_DAYS, toRepoRelative } from "../utils/context.js";
|
|
4
4
|
describe("extractFocus", () => {
|
|
5
5
|
it("extracts the first line after ## Current Focus", () => {
|
|
6
6
|
const content = "# Active Context\n\n## Current Focus\n\nWorking on feature X.\n\n## Recent Changes\n";
|
|
@@ -39,4 +39,13 @@ describe("STALENESS_THRESHOLD_DAYS", () => {
|
|
|
39
39
|
assert.equal(STALENESS_THRESHOLD_DAYS, 7);
|
|
40
40
|
});
|
|
41
41
|
});
|
|
42
|
+
describe("toRepoRelative", () => {
|
|
43
|
+
it("emits posix display paths for absolute files under cwd", () => {
|
|
44
|
+
const cwd = "/tmp/tocket-rel";
|
|
45
|
+
assert.equal(toRepoRelative(cwd, "/tmp/tocket-rel/.context/appmaps/tempestivita.triage.json"), ".context/appmaps/tempestivita.triage.json");
|
|
46
|
+
});
|
|
47
|
+
it("posixifies already-relative Windows separators", () => {
|
|
48
|
+
assert.equal(toRepoRelative("/tmp/proj", ".context\\appmaps\\tempestivita.triage.json"), ".context/appmaps/tempestivita.triage.json");
|
|
49
|
+
});
|
|
50
|
+
});
|
|
42
51
|
//# sourceMappingURL=context.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.test.js","sourceRoot":"","sources":["../../src/tests/context.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"context.test.js","sourceRoot":"","sources":["../../src/tests/context.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE7F,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACxD,MAAM,OAAO,GAAG,sFAAsF,CAAC;QACvG,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,uBAAuB,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;QAC3D,MAAM,OAAO,GAAG,2CAA2C,CAAC;QAC5D,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qEAAqE,EAAE,GAAG,EAAE;QAC7E,MAAM,OAAO,GAAG,0DAA0D,CAAC;QAC3E,MAA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,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;QAChE,MAAM,GAAG,GAAG,iBAAiB,CAAC;QAC9B,MAAM,CAAC,KAAK,CACV,cAAc,CAAC,GAAG,EAAE,2DAA2D,CAAC,EAChF,2CAA2C,CAC5C,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACxD,MAAM,CAAC,KAAK,CACV,cAAc,CAAC,WAAW,EAAE,6CAA6C,CAAC,EAC1E,2CAA2C,CAC5C,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
import { describe, it, after } from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { mkdtempSync, rmSync, mkdirSync, writeFileSync, readFileSync, existsSync, copyFileSync, readdirSync, } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { execFileSync } from "node:child_process";
|
|
7
|
+
import { DECIDE_SCHEMA, DECISIONS_DIR, STUB_MODEL, decisionOutputPath, isInsideContext, parseChoiceSpec, parseDecideRecord, parseConfidenceThreshold, parseFork, parseScoreSpec, parseToolGate, extractToolGate, resolveDecideMode, resolveDestination, resolveRecordToolGate, runDecide, toRepoRelative, stubChoice, stubNoul, stubScore, toolGateRefusesApply, } from "../utils/decide.js";
|
|
8
|
+
import { askJev, buildTriageQuestions } from "../utils/jev.js";
|
|
9
|
+
import { evaluateDecideStub } from "../eval/decide-eval.js";
|
|
10
|
+
import { posixPath, includesPath } from "./helpers.js";
|
|
11
|
+
const cliPath = join(import.meta.dirname, "..", "index.js");
|
|
12
|
+
const fixturesDir = join(import.meta.dirname, "..", "..", "fixtures");
|
|
13
|
+
const stateFixture = join(fixturesDir, "decide", "state.json");
|
|
14
|
+
const toolGateStateFixture = join(fixturesDir, "decide", "tool-gate-state.json");
|
|
15
|
+
const expectedFixture = join(fixturesDir, "decide-expected.json");
|
|
16
|
+
function runCli(args, cwd, env) {
|
|
17
|
+
try {
|
|
18
|
+
const stdout = execFileSync(process.execPath, [cliPath, ...args], {
|
|
19
|
+
cwd,
|
|
20
|
+
encoding: "utf-8",
|
|
21
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
22
|
+
env: { ...process.env, TYPESAFE_API_KEY: "", ...env },
|
|
23
|
+
});
|
|
24
|
+
return { stdout, stderr: "", status: 0 };
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
const failed = err;
|
|
28
|
+
return {
|
|
29
|
+
stdout: failed.stdout ?? "",
|
|
30
|
+
stderr: failed.stderr ?? "",
|
|
31
|
+
status: failed.status ?? 1,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
describe("decide parsers", () => {
|
|
36
|
+
it("parses --choice name:opt1,opt2", () => {
|
|
37
|
+
assert.deepEqual(parseChoiceSpec("next:research,write,review"), {
|
|
38
|
+
name: "next",
|
|
39
|
+
options: ["research", "write", "review"],
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
it("rejects a choice with one option", () => {
|
|
43
|
+
assert.throws(() => parseChoiceSpec("next:only"), /at least two options/);
|
|
44
|
+
});
|
|
45
|
+
it("keeps writes under .context/", () => {
|
|
46
|
+
const cwd = "/tmp/tocket-decide-root";
|
|
47
|
+
const inside = decisionOutputPath(cwd, "2026-09-20T14:52:00.000Z", "next", "write");
|
|
48
|
+
assert.equal(isInsideContext(cwd, inside), true);
|
|
49
|
+
assert.match(posixPath(inside), /\.context\/decisions\/write\/20260920T145200Z-next\.json$/);
|
|
50
|
+
assert.equal(isInsideContext(cwd, join(cwd, "tmp", "out.json")), false);
|
|
51
|
+
});
|
|
52
|
+
it("emits posix-style repo-relative paths for CLI display", () => {
|
|
53
|
+
const cwd = join(tmpdir(), "tocket-posix-rel");
|
|
54
|
+
const outPath = join(cwd, ".context", "decisions", "write", "20260920T150130Z-next.json");
|
|
55
|
+
assert.equal(toRepoRelative(cwd, outPath), ".context/decisions/write/20260920T150130Z-next.json");
|
|
56
|
+
});
|
|
57
|
+
it("gates research/write below the Codila 0.85 threshold to review", () => {
|
|
58
|
+
assert.deepEqual(resolveDestination("write", 0.78), { destination: "review", gated: true });
|
|
59
|
+
assert.deepEqual(resolveDestination("research", 0.9), { destination: "research", gated: false });
|
|
60
|
+
assert.deepEqual(resolveDestination("write", 0.85), { destination: "write", gated: false });
|
|
61
|
+
assert.deepEqual(resolveDestination("review", 0.99), { destination: "review", gated: false });
|
|
62
|
+
assert.deepEqual(resolveDestination("retry", 0.99), { destination: "review", gated: false });
|
|
63
|
+
assert.deepEqual(resolveDestination("write", 0.99, 0.85, "human"), {
|
|
64
|
+
destination: "review",
|
|
65
|
+
gated: true,
|
|
66
|
+
});
|
|
67
|
+
assert.equal(parseFork(), "action");
|
|
68
|
+
assert.equal(parseFork("human"), "human");
|
|
69
|
+
assert.throws(() => parseFork("graph"), /agent, model, tool, action, human/);
|
|
70
|
+
assert.deepEqual(parseScoreSpec("relevance"), { name: "relevance", min: 0, max: 1 });
|
|
71
|
+
assert.deepEqual(parseScoreSpec("relevance:0,10"), { name: "relevance", min: 0, max: 10 });
|
|
72
|
+
assert.equal(parseConfidenceThreshold(), 0.85);
|
|
73
|
+
assert.equal(parseConfidenceThreshold("0.7"), 0.7);
|
|
74
|
+
assert.throws(() => parseConfidenceThreshold("2"), /0 and 1/);
|
|
75
|
+
});
|
|
76
|
+
it("parses the file-first tool-risk gate", () => {
|
|
77
|
+
assert.equal(parseToolGate("allow"), "allow");
|
|
78
|
+
assert.equal(parseToolGate("BLOCK"), "block");
|
|
79
|
+
assert.equal(parseToolGate("ask"), "ask");
|
|
80
|
+
assert.equal(parseToolGate("write"), null);
|
|
81
|
+
assert.equal(parseToolGate(null), null);
|
|
82
|
+
assert.equal(extractToolGate({
|
|
83
|
+
tool_gate: { type: "choice", choice: "block", confidence: 0.8, rationale: "r" },
|
|
84
|
+
}), "block");
|
|
85
|
+
assert.equal(extractToolGate({
|
|
86
|
+
action_gate: { type: "choice", choice: "ask", confidence: 0.7, rationale: "r" },
|
|
87
|
+
}), "ask");
|
|
88
|
+
assert.equal(extractToolGate({
|
|
89
|
+
next: { type: "choice", choice: "write", confidence: 0.9, rationale: "r" },
|
|
90
|
+
}), null);
|
|
91
|
+
assert.equal(resolveRecordToolGate({
|
|
92
|
+
answers: {
|
|
93
|
+
next: { type: "choice", choice: "write", confidence: 0.9, rationale: "r" },
|
|
94
|
+
},
|
|
95
|
+
}), null);
|
|
96
|
+
assert.equal(toolGateRefusesApply("block"), true);
|
|
97
|
+
assert.equal(toolGateRefusesApply("ask"), true);
|
|
98
|
+
assert.equal(toolGateRefusesApply("allow"), false);
|
|
99
|
+
assert.equal(toolGateRefusesApply(null), false);
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
describe("decide stub", () => {
|
|
103
|
+
it("picks a choice keyword from state and a low noul for clear/ready", () => {
|
|
104
|
+
const state = { task: "write the handoff docs", status: "ready", notes: "draft is clear" };
|
|
105
|
+
assert.equal(stubChoice("next", ["research", "write", "review"], state).choice, "write");
|
|
106
|
+
assert.ok(stubNoul("needs_human_review", state).noul <= 0.4);
|
|
107
|
+
assert.ok(stubScore("relevance", 0, 1, state).score <= 0.4);
|
|
108
|
+
});
|
|
109
|
+
it("is deterministic across two calls", () => {
|
|
110
|
+
const state = { note: "no matching option keywords here" };
|
|
111
|
+
const first = stubChoice("next", ["research", "write", "review"], state);
|
|
112
|
+
const second = stubChoice("next", ["research", "write", "review"], state);
|
|
113
|
+
assert.equal(first.choice, second.choice);
|
|
114
|
+
assert.equal(first.confidence, second.confidence);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
describe("resolveDecideMode", () => {
|
|
118
|
+
it("dry-run always stubs; shadow calls Jev only with a key", () => {
|
|
119
|
+
assert.deepEqual(resolveDecideMode({ dryRun: true, apiKey: "k" }), {
|
|
120
|
+
useLive: false,
|
|
121
|
+
mode: "dry-run",
|
|
122
|
+
});
|
|
123
|
+
assert.deepEqual(resolveDecideMode({ shadow: true, apiKey: "k" }), {
|
|
124
|
+
useLive: true,
|
|
125
|
+
mode: "shadow",
|
|
126
|
+
});
|
|
127
|
+
assert.deepEqual(resolveDecideMode({ shadow: true }), {
|
|
128
|
+
useLive: false,
|
|
129
|
+
mode: "shadow",
|
|
130
|
+
});
|
|
131
|
+
assert.deepEqual(resolveDecideMode({ apiKey: "k" }), { useLive: true, mode: "active" });
|
|
132
|
+
assert.deepEqual(resolveDecideMode({}), { useLive: false, mode: "shadow" });
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
describe("askJev generic Choice + Noul", () => {
|
|
136
|
+
it("parses arbitrary questions from a System One-shaped response", async () => {
|
|
137
|
+
const result = await askJev({
|
|
138
|
+
apiKey: "test-key",
|
|
139
|
+
state: { task: "write" },
|
|
140
|
+
questions: {
|
|
141
|
+
next: {
|
|
142
|
+
type: "choice",
|
|
143
|
+
criteria: { research: "r", write: "w", review: "v" },
|
|
144
|
+
},
|
|
145
|
+
needs_human_review: {
|
|
146
|
+
type: "noul",
|
|
147
|
+
criteria: { true: "yes", false: "no" },
|
|
148
|
+
},
|
|
149
|
+
relevance: {
|
|
150
|
+
type: "score",
|
|
151
|
+
min: 0,
|
|
152
|
+
max: 1,
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
fetchImpl: async () => new Response(JSON.stringify({
|
|
156
|
+
model: "jev-1.13.0",
|
|
157
|
+
answers: {
|
|
158
|
+
next: { type: "choice", choice: "write", confidence: 0.8 },
|
|
159
|
+
needs_human_review: { type: "noul", noul: 0.2, confidence: 0.7 },
|
|
160
|
+
relevance: { type: "score", score: 0.4, confidence: 0.6 },
|
|
161
|
+
},
|
|
162
|
+
}), { status: 200 }),
|
|
163
|
+
});
|
|
164
|
+
assert.equal(result.model, "jev-1.13.0");
|
|
165
|
+
assert.equal(result.answers.next.type, "choice");
|
|
166
|
+
if (result.answers.next.type === "choice") {
|
|
167
|
+
assert.equal(result.answers.next.choice, "write");
|
|
168
|
+
}
|
|
169
|
+
assert.equal(result.answers.relevance.type, "score");
|
|
170
|
+
if (result.answers.relevance.type === "score") {
|
|
171
|
+
assert.equal(result.answers.relevance.score, 0.4);
|
|
172
|
+
}
|
|
173
|
+
assert.ok(buildTriageQuestions().action);
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
describe("tocket decide help", () => {
|
|
177
|
+
it("frames the notebook and 5-minute setup", () => {
|
|
178
|
+
const result = runCli(["decide", "--help"], process.cwd());
|
|
179
|
+
assert.equal(result.status, 0, result.stderr);
|
|
180
|
+
assert.match(result.stdout, /workers execute, Tocket does not/i);
|
|
181
|
+
assert.match(result.stdout, /5-minute setup/);
|
|
182
|
+
assert.match(result.stdout, /TYPESAFE_API_KEY/);
|
|
183
|
+
assert.match(result.stdout, /--backend laya/);
|
|
184
|
+
assert.match(result.stdout, /npx skills add pedrocivita\/tocket --skill tocket/);
|
|
185
|
+
assert.match(result.stdout, /Before expensive tools: tocket decide --dry-run, or read \.context\/decisions\/\./);
|
|
186
|
+
assert.match(result.stdout, /tool_gate:allow,block,ask/);
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
describe("tocket decide", () => {
|
|
190
|
+
const tempDir = mkdtempSync(join(tmpdir(), "tocket-decide-"));
|
|
191
|
+
after(() => {
|
|
192
|
+
rmSync(tempDir, { recursive: true, force: true });
|
|
193
|
+
});
|
|
194
|
+
it("dry-run writes .context/decisions/ with source=stub", () => {
|
|
195
|
+
const incoming = join(tempDir, "state.json");
|
|
196
|
+
copyFileSync(stateFixture, incoming);
|
|
197
|
+
const result = runCli([
|
|
198
|
+
"decide",
|
|
199
|
+
"--from",
|
|
200
|
+
incoming,
|
|
201
|
+
"--choice",
|
|
202
|
+
"next:research,write,review",
|
|
203
|
+
"--noul",
|
|
204
|
+
"needs_human_review",
|
|
205
|
+
"--dry-run",
|
|
206
|
+
"--id",
|
|
207
|
+
"next",
|
|
208
|
+
], tempDir);
|
|
209
|
+
assert.equal(result.status, 0, result.stderr);
|
|
210
|
+
assert.match(result.stdout, /decide next=write/);
|
|
211
|
+
assert.match(result.stdout, /dest=review/);
|
|
212
|
+
assert.match(result.stdout, /gated/);
|
|
213
|
+
assert.match(result.stdout, /source=stub/);
|
|
214
|
+
assert.match(result.stdout, /mode=dry-run/);
|
|
215
|
+
assert.match(result.stdout, /\.context\/decisions\/review\/.+\-next\.json/);
|
|
216
|
+
const dir = join(tempDir, ".context", "decisions", "review");
|
|
217
|
+
assert.ok(existsSync(dir));
|
|
218
|
+
const files = readdirSync(dir).filter((name) => name.endsWith(".json"));
|
|
219
|
+
assert.equal(files.length, 1);
|
|
220
|
+
const record = parseDecideRecord(readFileSync(join(dir, files[0]), "utf-8"));
|
|
221
|
+
assert.equal(record.schema, DECIDE_SCHEMA);
|
|
222
|
+
assert.equal(record.source, "stub");
|
|
223
|
+
assert.equal(record.mode, "dry-run");
|
|
224
|
+
assert.equal(record.model, STUB_MODEL);
|
|
225
|
+
assert.equal(record.choice, "write");
|
|
226
|
+
assert.equal(record.destination, "review");
|
|
227
|
+
assert.equal(record.gated, true);
|
|
228
|
+
assert.equal(record.semantics, "log-only");
|
|
229
|
+
assert.equal(record.status, "logged");
|
|
230
|
+
assert.equal(record.executes, false);
|
|
231
|
+
assert.equal(record.loop, "state-questions-action-verify");
|
|
232
|
+
assert.equal(record.fork, "action");
|
|
233
|
+
assert.equal(record.batched, true);
|
|
234
|
+
assert.equal(record.rank_wide, false);
|
|
235
|
+
assert.equal(record.narrow, "write");
|
|
236
|
+
assert.ok(record.primitives.includes("choice"));
|
|
237
|
+
assert.ok(record.state && typeof record.state === "object");
|
|
238
|
+
assert.equal(record.answers.next.type, "choice");
|
|
239
|
+
if (record.answers.next.type === "choice") {
|
|
240
|
+
assert.equal(record.answers.next.choice, "write");
|
|
241
|
+
}
|
|
242
|
+
assert.ok(!files[0].includes(".."));
|
|
243
|
+
assert.ok(isInsideContext(tempDir, join(dir, files[0])));
|
|
244
|
+
assert.ok(!existsSync(join(tempDir, "tmp", "decision.json")));
|
|
245
|
+
});
|
|
246
|
+
it("shadow without a key stays stub and does not claim execution", async () => {
|
|
247
|
+
const cwd = join(tempDir, "shadow");
|
|
248
|
+
mkdirSync(cwd, { recursive: true });
|
|
249
|
+
const incoming = join(cwd, "state.json");
|
|
250
|
+
copyFileSync(stateFixture, incoming);
|
|
251
|
+
const { record, outPath } = await runDecide({
|
|
252
|
+
cwd,
|
|
253
|
+
fromPath: incoming,
|
|
254
|
+
choices: ["next:research,write,review"],
|
|
255
|
+
nouls: ["needs_human_review"],
|
|
256
|
+
shadow: true,
|
|
257
|
+
apiKey: null,
|
|
258
|
+
now: () => "2026-09-20T15:00:00.000Z",
|
|
259
|
+
id: "next",
|
|
260
|
+
});
|
|
261
|
+
assert.equal(record.source, "stub");
|
|
262
|
+
assert.equal(record.mode, "shadow");
|
|
263
|
+
assert.equal(record.semantics, "log-only");
|
|
264
|
+
assert.equal(record.destination, "review");
|
|
265
|
+
assert.equal(record.gated, true);
|
|
266
|
+
assert.ok(includesPath(outPath, `${DECISIONS_DIR}/review`));
|
|
267
|
+
assert.ok(isInsideContext(cwd, outPath));
|
|
268
|
+
});
|
|
269
|
+
it("shadow with a key calls Jev and marks mode=shadow", async () => {
|
|
270
|
+
const cwd = join(tempDir, "shadow-live");
|
|
271
|
+
mkdirSync(cwd, { recursive: true });
|
|
272
|
+
let called = false;
|
|
273
|
+
const { record } = await runDecide({
|
|
274
|
+
cwd,
|
|
275
|
+
state: '{"goal":"review the map"}',
|
|
276
|
+
choices: ["next:research,write,review"],
|
|
277
|
+
shadow: true,
|
|
278
|
+
apiKey: "test-key",
|
|
279
|
+
now: () => "2026-09-20T15:01:00.000Z",
|
|
280
|
+
id: "next",
|
|
281
|
+
fetchImpl: async () => {
|
|
282
|
+
called = true;
|
|
283
|
+
return new Response(JSON.stringify({
|
|
284
|
+
model: "jev-latest",
|
|
285
|
+
answers: {
|
|
286
|
+
next: { type: "choice", choice: "review", confidence: 0.91 },
|
|
287
|
+
},
|
|
288
|
+
}), { status: 200 });
|
|
289
|
+
},
|
|
290
|
+
});
|
|
291
|
+
assert.equal(called, true);
|
|
292
|
+
assert.equal(record.source, "jev");
|
|
293
|
+
assert.equal(record.mode, "shadow");
|
|
294
|
+
assert.equal(record.semantics, "log-only");
|
|
295
|
+
assert.equal(record.model, "jev-latest");
|
|
296
|
+
assert.equal(record.choice, "review");
|
|
297
|
+
assert.equal(record.destination, "review");
|
|
298
|
+
if (record.answers.next.type === "choice") {
|
|
299
|
+
assert.equal(record.answers.next.choice, "review");
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
it("high-confidence write routes to the write handoff folder", async () => {
|
|
303
|
+
const cwd = join(tempDir, "high-conf-write");
|
|
304
|
+
mkdirSync(cwd, { recursive: true });
|
|
305
|
+
const { record, outPath } = await runDecide({
|
|
306
|
+
cwd,
|
|
307
|
+
state: '{"task":"write docs"}',
|
|
308
|
+
choices: ["next:research,write,review"],
|
|
309
|
+
apiKey: "test-key",
|
|
310
|
+
now: () => "2026-09-20T15:01:30.000Z",
|
|
311
|
+
id: "next",
|
|
312
|
+
fetchImpl: async () => new Response(JSON.stringify({
|
|
313
|
+
model: "jev-1.13.0",
|
|
314
|
+
answers: {
|
|
315
|
+
next: { type: "choice", choice: "write", confidence: 0.91 },
|
|
316
|
+
},
|
|
317
|
+
}), { status: 200 }),
|
|
318
|
+
});
|
|
319
|
+
assert.equal(record.mode, "active");
|
|
320
|
+
assert.equal(record.semantics, "handoff");
|
|
321
|
+
assert.equal(record.status, "queued");
|
|
322
|
+
assert.equal(record.choice, "write");
|
|
323
|
+
assert.equal(record.confidence, 0.91);
|
|
324
|
+
assert.equal(record.destination, "write");
|
|
325
|
+
assert.equal(record.gated, false);
|
|
326
|
+
assert.ok(includesPath(outPath, `${DECISIONS_DIR}/write`));
|
|
327
|
+
assert.ok(isInsideContext(cwd, outPath));
|
|
328
|
+
});
|
|
329
|
+
it("confidence-threshold override can ungate a stub write", async () => {
|
|
330
|
+
const cwd = join(tempDir, "threshold");
|
|
331
|
+
mkdirSync(cwd, { recursive: true });
|
|
332
|
+
const { record, outPath } = await runDecide({
|
|
333
|
+
cwd,
|
|
334
|
+
fromPath: stateFixture,
|
|
335
|
+
choices: ["next:research,write,review"],
|
|
336
|
+
dryRun: true,
|
|
337
|
+
confidenceThreshold: 0.7,
|
|
338
|
+
now: () => "2026-09-20T15:03:00.000Z",
|
|
339
|
+
id: "next",
|
|
340
|
+
});
|
|
341
|
+
assert.equal(record.choice, "write");
|
|
342
|
+
assert.ok(record.confidence >= 0.7);
|
|
343
|
+
assert.equal(record.destination, "write");
|
|
344
|
+
assert.equal(record.gated, false);
|
|
345
|
+
assert.ok(includesPath(outPath, `${DECISIONS_DIR}/write`));
|
|
346
|
+
});
|
|
347
|
+
it("dry-run ignores TYPESAFE_API_KEY and does not call Jev", async () => {
|
|
348
|
+
const cwd = join(tempDir, "dry-ignores-key");
|
|
349
|
+
mkdirSync(cwd, { recursive: true });
|
|
350
|
+
let called = false;
|
|
351
|
+
const { record } = await runDecide({
|
|
352
|
+
cwd,
|
|
353
|
+
state: '{"task":"write docs"}',
|
|
354
|
+
choices: ["next:research,write,review"],
|
|
355
|
+
dryRun: true,
|
|
356
|
+
apiKey: "should-not-be-used",
|
|
357
|
+
now: () => "2026-09-20T15:02:00.000Z",
|
|
358
|
+
id: "next",
|
|
359
|
+
fetchImpl: async () => {
|
|
360
|
+
called = true;
|
|
361
|
+
throw new Error("Jev should not be called in dry-run");
|
|
362
|
+
},
|
|
363
|
+
});
|
|
364
|
+
assert.equal(called, false);
|
|
365
|
+
assert.equal(record.source, "stub");
|
|
366
|
+
assert.equal(record.mode, "dry-run");
|
|
367
|
+
});
|
|
368
|
+
it("requires state and at least one question", () => {
|
|
369
|
+
const cwd = join(tempDir, "errors");
|
|
370
|
+
mkdirSync(cwd, { recursive: true });
|
|
371
|
+
const missingState = runCli(["decide", "--choice", "next:research,write", "--dry-run"], cwd);
|
|
372
|
+
assert.equal(missingState.status, 2);
|
|
373
|
+
assert.match(missingState.stderr, /--state|--from/);
|
|
374
|
+
writeFileSync(join(cwd, "state.json"), "{\"ok\":true}\n", "utf-8");
|
|
375
|
+
const missingQ = runCli(["decide", "--from", join(cwd, "state.json"), "--dry-run"], cwd);
|
|
376
|
+
assert.equal(missingQ.status, 2);
|
|
377
|
+
assert.match(missingQ.stderr, /--choice|--noul|--score/);
|
|
378
|
+
});
|
|
379
|
+
it("batches Choice + Noul + Score and marks executes=false", async () => {
|
|
380
|
+
const cwd = join(tempDir, "batch");
|
|
381
|
+
mkdirSync(cwd, { recursive: true });
|
|
382
|
+
const { record } = await runDecide({
|
|
383
|
+
cwd,
|
|
384
|
+
state: '{"task":"write docs","status":"ready"}',
|
|
385
|
+
choices: ["next:research,write,review"],
|
|
386
|
+
nouls: ["needs_human_review"],
|
|
387
|
+
scores: ["relevance"],
|
|
388
|
+
dryRun: true,
|
|
389
|
+
now: () => "2026-09-20T15:04:00.000Z",
|
|
390
|
+
id: "next",
|
|
391
|
+
});
|
|
392
|
+
assert.equal(record.batched, true);
|
|
393
|
+
assert.deepEqual(record.primitives.slice().sort(), ["choice", "noul", "score"]);
|
|
394
|
+
assert.equal(record.executes, false);
|
|
395
|
+
assert.equal(record.answers.relevance.type, "score");
|
|
396
|
+
});
|
|
397
|
+
it("human fork always queues review (escalate)", async () => {
|
|
398
|
+
const cwd = join(tempDir, "human-fork");
|
|
399
|
+
mkdirSync(cwd, { recursive: true });
|
|
400
|
+
const { record, outPath } = await runDecide({
|
|
401
|
+
cwd,
|
|
402
|
+
state: '{"task":"write docs"}',
|
|
403
|
+
choices: ["next:research,write,review"],
|
|
404
|
+
fork: "human",
|
|
405
|
+
dryRun: true,
|
|
406
|
+
confidenceThreshold: 0.5,
|
|
407
|
+
now: () => "2026-09-20T15:05:00.000Z",
|
|
408
|
+
id: "next",
|
|
409
|
+
});
|
|
410
|
+
assert.equal(record.fork, "human");
|
|
411
|
+
assert.equal(record.destination, "review");
|
|
412
|
+
assert.equal(record.gated, true);
|
|
413
|
+
assert.ok(includesPath(outPath, "/review/"));
|
|
414
|
+
});
|
|
415
|
+
it("records tool_gate from a well-known Choice (stub, no network)", async () => {
|
|
416
|
+
const cwd = join(tempDir, "tool-gate");
|
|
417
|
+
mkdirSync(cwd, { recursive: true });
|
|
418
|
+
const { record } = await runDecide({
|
|
419
|
+
cwd,
|
|
420
|
+
fromPath: toolGateStateFixture,
|
|
421
|
+
choices: ["tool_gate:allow,block,ask"],
|
|
422
|
+
fork: "tool",
|
|
423
|
+
dryRun: true,
|
|
424
|
+
now: () => "2026-09-21T00:20:00.000Z",
|
|
425
|
+
id: "tool_gate",
|
|
426
|
+
});
|
|
427
|
+
assert.equal(record.choice, "block");
|
|
428
|
+
assert.equal(record.tool_gate, "block");
|
|
429
|
+
assert.equal(record.fork, "tool");
|
|
430
|
+
assert.equal(record.executes, false);
|
|
431
|
+
assert.equal(record.answers.tool_gate.type, "choice");
|
|
432
|
+
if (record.answers.tool_gate.type === "choice") {
|
|
433
|
+
assert.equal(record.answers.tool_gate.choice, "block");
|
|
434
|
+
}
|
|
435
|
+
const actionCwd = join(tempDir, "action-gate");
|
|
436
|
+
mkdirSync(actionCwd, { recursive: true });
|
|
437
|
+
const action = await runDecide({
|
|
438
|
+
cwd: actionCwd,
|
|
439
|
+
state: '{"tool":"browser","note":"ask a human first"}',
|
|
440
|
+
choices: ["action_gate:allow,block,ask"],
|
|
441
|
+
dryRun: true,
|
|
442
|
+
now: () => "2026-09-21T00:21:00.000Z",
|
|
443
|
+
id: "action_gate",
|
|
444
|
+
});
|
|
445
|
+
assert.equal(action.record.tool_gate, "ask");
|
|
446
|
+
assert.equal(action.record.choice, "ask");
|
|
447
|
+
const noneCwd = join(tempDir, "no-gate");
|
|
448
|
+
mkdirSync(noneCwd, { recursive: true });
|
|
449
|
+
const none = await runDecide({
|
|
450
|
+
cwd: noneCwd,
|
|
451
|
+
state: '{"task":"write docs"}',
|
|
452
|
+
choices: ["next:research,write,review"],
|
|
453
|
+
dryRun: true,
|
|
454
|
+
now: () => "2026-09-21T00:22:00.000Z",
|
|
455
|
+
id: "next",
|
|
456
|
+
});
|
|
457
|
+
assert.equal(none.record.tool_gate, null);
|
|
458
|
+
});
|
|
459
|
+
it("marks rank_wide when Choice lists many options", async () => {
|
|
460
|
+
const cwd = join(tempDir, "rank-wide");
|
|
461
|
+
mkdirSync(cwd, { recursive: true });
|
|
462
|
+
const { record } = await runDecide({
|
|
463
|
+
cwd,
|
|
464
|
+
state: '{"task":"alpha"}',
|
|
465
|
+
choices: ["next:alpha,bravo,charlie,delta,echo"],
|
|
466
|
+
dryRun: true,
|
|
467
|
+
now: () => "2026-09-20T15:06:00.000Z",
|
|
468
|
+
id: "next",
|
|
469
|
+
});
|
|
470
|
+
assert.equal(record.rank_wide, true);
|
|
471
|
+
assert.equal(record.narrow, "alpha");
|
|
472
|
+
assert.equal(record.executes, false);
|
|
473
|
+
});
|
|
474
|
+
});
|
|
475
|
+
describe("decide fixture eval", () => {
|
|
476
|
+
it("optional stub eval agrees with the fixture label", () => {
|
|
477
|
+
const result = evaluateDecideStub(stateFixture, expectedFixture);
|
|
478
|
+
assert.equal(result.ok, true, `${result.choice} vs ${result.expectedChoice}; noul=${result.noul}`);
|
|
479
|
+
assert.equal(result.choice, "write");
|
|
480
|
+
assert.ok(result.noul <= result.expectedMax);
|
|
481
|
+
});
|
|
482
|
+
});
|
|
483
|
+
//# sourceMappingURL=decide.test.js.map
|