@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
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/** AppMap Memory Bank convention — file-first index and last-run history. */
|
|
2
|
+
export declare const LAST_RUN_SCHEMA = "tocket.appmaps.last-run/v0";
|
|
3
|
+
export declare const APPMAPS_DIR = ".context/appmaps";
|
|
4
|
+
export declare const LAST_RUN_JSON = "last-run.json";
|
|
5
|
+
export declare const LAST_RUN_MD = "last-run.md";
|
|
6
|
+
export declare const APPMAPS_README = "README.md";
|
|
7
|
+
export declare const APPMAPS_GOALS = "goals.md";
|
|
8
|
+
export declare const APPMAP_SUFFIX = ".appmap.json";
|
|
9
|
+
export interface LastRunResult {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
ok: boolean;
|
|
13
|
+
ms: number;
|
|
14
|
+
jev_choice?: string | null;
|
|
15
|
+
jev_confidence?: number | null;
|
|
16
|
+
/** Real last-run snapshots use objects; older fixtures may use a string. */
|
|
17
|
+
evidence?: unknown;
|
|
18
|
+
error?: string | null;
|
|
19
|
+
}
|
|
20
|
+
export interface LastRun {
|
|
21
|
+
schema: typeof LAST_RUN_SCHEMA;
|
|
22
|
+
app: string;
|
|
23
|
+
map: string;
|
|
24
|
+
runner: string;
|
|
25
|
+
model: string;
|
|
26
|
+
mode: string;
|
|
27
|
+
finished_at: string;
|
|
28
|
+
all_ok: boolean;
|
|
29
|
+
passed: number;
|
|
30
|
+
total: number;
|
|
31
|
+
results: LastRunResult[];
|
|
32
|
+
}
|
|
33
|
+
export declare class LastRunValidationError extends Error {
|
|
34
|
+
constructor(message: string);
|
|
35
|
+
}
|
|
36
|
+
/** Validate and normalize a parsed last-run document. */
|
|
37
|
+
export declare function validateLastRun(value: unknown): LastRun;
|
|
38
|
+
/** Parse a last-run.json string and validate it against v0. */
|
|
39
|
+
export declare function parseLastRun(raw: string): LastRun;
|
|
40
|
+
/** Empty but schema-valid last-run document used by `tocket suite init`. */
|
|
41
|
+
export declare function emptyLastRun(): LastRun;
|
|
42
|
+
/** Human table for `.context/appmaps/last-run.md`. */
|
|
43
|
+
export declare function writeLastRunMd(run: LastRun): string;
|
|
44
|
+
/** Slug used for bank filenames (\`<app>.appmap.json\`, triage). */
|
|
45
|
+
export declare function appSlug(app: string): string;
|
|
46
|
+
/** Bank filename for a copied mapper AppMap. */
|
|
47
|
+
export declare function appmapBankFile(app: string): string;
|
|
48
|
+
/** Repo-relative path for the bank map copy. */
|
|
49
|
+
export declare function appmapBankRel(app: string): string;
|
|
50
|
+
export declare class AppmapDiscoveryError extends Error {
|
|
51
|
+
constructor(message: string);
|
|
52
|
+
}
|
|
53
|
+
/** Parse mapper (or hand) AppMap JSON. Object only; no full schema vendoring. */
|
|
54
|
+
export declare function parseAppmapJson(raw: string): unknown;
|
|
55
|
+
/**
|
|
56
|
+
* Find `*.appmap.json` in a mapper `--out` directory.
|
|
57
|
+
* Prefers `<app>.appmap.json` when several files exist.
|
|
58
|
+
*/
|
|
59
|
+
export declare function discoverAppmapJson(dir: string, app?: string): string;
|
|
60
|
+
/** Point last-run.map at the bank copy; fill empty app from --app. */
|
|
61
|
+
export declare function normalizeLastRunRaw(raw: unknown, mapRel: string, app?: string): unknown;
|
|
62
|
+
/** Minimal README stub written when `.context/appmaps/` is created. */
|
|
63
|
+
export declare function appmapsReadmeStub(): string;
|
|
64
|
+
export declare function appmapsGoalsStub(): string;
|
|
65
|
+
export declare function prettyLastRunJson(value: unknown): string;
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/** AppMap Memory Bank convention — file-first index and last-run history. */
|
|
2
|
+
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
export const LAST_RUN_SCHEMA = "tocket.appmaps.last-run/v0";
|
|
5
|
+
export const APPMAPS_DIR = ".context/appmaps";
|
|
6
|
+
export const LAST_RUN_JSON = "last-run.json";
|
|
7
|
+
export const LAST_RUN_MD = "last-run.md";
|
|
8
|
+
export const APPMAPS_README = "README.md";
|
|
9
|
+
export const APPMAPS_GOALS = "goals.md";
|
|
10
|
+
export const APPMAP_SUFFIX = ".appmap.json";
|
|
11
|
+
export class LastRunValidationError extends Error {
|
|
12
|
+
constructor(message) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.name = "LastRunValidationError";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function isRecord(value) {
|
|
18
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
19
|
+
}
|
|
20
|
+
function expectString(value, field) {
|
|
21
|
+
if (typeof value !== "string") {
|
|
22
|
+
throw new LastRunValidationError(`${field} must be a string`);
|
|
23
|
+
}
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
function expectBoolean(value, field) {
|
|
27
|
+
if (typeof value !== "boolean") {
|
|
28
|
+
throw new LastRunValidationError(`${field} must be a boolean`);
|
|
29
|
+
}
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
function expectNumber(value, field) {
|
|
33
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
34
|
+
throw new LastRunValidationError(`${field} must be a finite number`);
|
|
35
|
+
}
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
38
|
+
function optionalString(value, field) {
|
|
39
|
+
if (value === undefined)
|
|
40
|
+
return undefined;
|
|
41
|
+
if (value === null)
|
|
42
|
+
return null;
|
|
43
|
+
if (typeof value !== "string") {
|
|
44
|
+
throw new LastRunValidationError(`${field} must be a string or null`);
|
|
45
|
+
}
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
48
|
+
function optionalNumber(value, field) {
|
|
49
|
+
if (value === undefined)
|
|
50
|
+
return undefined;
|
|
51
|
+
if (value === null)
|
|
52
|
+
return null;
|
|
53
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
54
|
+
throw new LastRunValidationError(`${field} must be a finite number or null`);
|
|
55
|
+
}
|
|
56
|
+
return value;
|
|
57
|
+
}
|
|
58
|
+
function parseResult(value, index) {
|
|
59
|
+
if (!isRecord(value)) {
|
|
60
|
+
throw new LastRunValidationError(`results[${index}] must be an object`);
|
|
61
|
+
}
|
|
62
|
+
const result = {
|
|
63
|
+
id: expectString(value.id, `results[${index}].id`),
|
|
64
|
+
name: expectString(value.name, `results[${index}].name`),
|
|
65
|
+
ok: expectBoolean(value.ok, `results[${index}].ok`),
|
|
66
|
+
ms: expectNumber(value.ms, `results[${index}].ms`),
|
|
67
|
+
};
|
|
68
|
+
const jevChoice = optionalString(value.jev_choice, `results[${index}].jev_choice`);
|
|
69
|
+
if (jevChoice !== undefined)
|
|
70
|
+
result.jev_choice = jevChoice;
|
|
71
|
+
const jevConfidence = optionalNumber(value.jev_confidence, `results[${index}].jev_confidence`);
|
|
72
|
+
if (jevConfidence !== undefined)
|
|
73
|
+
result.jev_confidence = jevConfidence;
|
|
74
|
+
if (value.evidence !== undefined)
|
|
75
|
+
result.evidence = value.evidence;
|
|
76
|
+
const error = optionalString(value.error, `results[${index}].error`);
|
|
77
|
+
if (error !== undefined)
|
|
78
|
+
result.error = error;
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
/** Validate and normalize a parsed last-run document. */
|
|
82
|
+
export function validateLastRun(value) {
|
|
83
|
+
if (!isRecord(value)) {
|
|
84
|
+
throw new LastRunValidationError("last-run.json must be a JSON object");
|
|
85
|
+
}
|
|
86
|
+
const schema = expectString(value.schema, "schema");
|
|
87
|
+
if (schema !== LAST_RUN_SCHEMA) {
|
|
88
|
+
throw new LastRunValidationError(`schema must be "${LAST_RUN_SCHEMA}"`);
|
|
89
|
+
}
|
|
90
|
+
if (!Array.isArray(value.results)) {
|
|
91
|
+
throw new LastRunValidationError("results must be an array");
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
schema: LAST_RUN_SCHEMA,
|
|
95
|
+
app: expectString(value.app, "app"),
|
|
96
|
+
map: expectString(value.map, "map"),
|
|
97
|
+
runner: expectString(value.runner, "runner"),
|
|
98
|
+
model: expectString(value.model, "model"),
|
|
99
|
+
mode: expectString(value.mode, "mode"),
|
|
100
|
+
finished_at: expectString(value.finished_at, "finished_at"),
|
|
101
|
+
all_ok: expectBoolean(value.all_ok, "all_ok"),
|
|
102
|
+
passed: expectNumber(value.passed, "passed"),
|
|
103
|
+
total: expectNumber(value.total, "total"),
|
|
104
|
+
results: value.results.map((item, index) => parseResult(item, index)),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/** Parse a last-run.json string and validate it against v0. */
|
|
108
|
+
export function parseLastRun(raw) {
|
|
109
|
+
let parsed;
|
|
110
|
+
try {
|
|
111
|
+
parsed = JSON.parse(raw);
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
throw new LastRunValidationError("last-run.json is not valid JSON");
|
|
115
|
+
}
|
|
116
|
+
return validateLastRun(parsed);
|
|
117
|
+
}
|
|
118
|
+
function mdCell(value) {
|
|
119
|
+
if (value === null || value === undefined || value === "")
|
|
120
|
+
return "";
|
|
121
|
+
const text = typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
122
|
+
return text.replace(/\|/g, "\\|").replace(/\r?\n/g, " ");
|
|
123
|
+
}
|
|
124
|
+
function formatOk(ok) {
|
|
125
|
+
return ok ? "pass" : "fail";
|
|
126
|
+
}
|
|
127
|
+
/** Empty but schema-valid last-run document used by `tocket suite init`. */
|
|
128
|
+
export function emptyLastRun() {
|
|
129
|
+
return {
|
|
130
|
+
schema: LAST_RUN_SCHEMA,
|
|
131
|
+
app: "",
|
|
132
|
+
map: "",
|
|
133
|
+
runner: "",
|
|
134
|
+
model: "",
|
|
135
|
+
mode: "",
|
|
136
|
+
finished_at: "",
|
|
137
|
+
all_ok: true,
|
|
138
|
+
passed: 0,
|
|
139
|
+
total: 0,
|
|
140
|
+
results: [],
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/** Human table for `.context/appmaps/last-run.md`. */
|
|
144
|
+
export function writeLastRunMd(run) {
|
|
145
|
+
const resultRows = run.results.length
|
|
146
|
+
? run.results
|
|
147
|
+
.map((result) => `| ${mdCell(result.id)} | ${mdCell(result.name)} | ${formatOk(result.ok)} | ${mdCell(result.ms)} | ${mdCell(result.jev_choice)} | ${mdCell(result.jev_confidence)} | ${mdCell(result.evidence)} | ${mdCell(result.error)} |`)
|
|
148
|
+
.join("\n")
|
|
149
|
+
: "| _none_ | | | | | | | |";
|
|
150
|
+
return `# Last AppMap run
|
|
151
|
+
|
|
152
|
+
| Field | Value |
|
|
153
|
+
| --- | --- |
|
|
154
|
+
| Schema | ${mdCell(run.schema)} |
|
|
155
|
+
| App | ${mdCell(run.app)} |
|
|
156
|
+
| Map | ${mdCell(run.map)} |
|
|
157
|
+
| Runner | ${mdCell(run.runner)} |
|
|
158
|
+
| Model | ${mdCell(run.model)} |
|
|
159
|
+
| Mode | ${mdCell(run.mode)} |
|
|
160
|
+
| Finished | ${mdCell(run.finished_at)} |
|
|
161
|
+
| Result | ${run.passed}/${run.total} passed |
|
|
162
|
+
| All OK | ${run.all_ok ? "yes" : "no"} |
|
|
163
|
+
|
|
164
|
+
## Results
|
|
165
|
+
|
|
166
|
+
| ID | Name | OK | ms | Jev | Confidence | Evidence | Error |
|
|
167
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
168
|
+
${resultRows}
|
|
169
|
+
`;
|
|
170
|
+
}
|
|
171
|
+
/** Slug used for bank filenames (\`<app>.appmap.json\`, triage). */
|
|
172
|
+
export function appSlug(app) {
|
|
173
|
+
return app.trim() ? app.trim().replace(/[^a-zA-Z0-9._-]+/g, "-") : "suite";
|
|
174
|
+
}
|
|
175
|
+
/** Bank filename for a copied mapper AppMap. */
|
|
176
|
+
export function appmapBankFile(app) {
|
|
177
|
+
return `${appSlug(app)}${APPMAP_SUFFIX}`;
|
|
178
|
+
}
|
|
179
|
+
/** Repo-relative path for the bank map copy. */
|
|
180
|
+
export function appmapBankRel(app) {
|
|
181
|
+
return `${APPMAPS_DIR}/${appmapBankFile(app)}`;
|
|
182
|
+
}
|
|
183
|
+
export class AppmapDiscoveryError extends Error {
|
|
184
|
+
constructor(message) {
|
|
185
|
+
super(message);
|
|
186
|
+
this.name = "AppmapDiscoveryError";
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/** Parse mapper (or hand) AppMap JSON. Object only; no full schema vendoring. */
|
|
190
|
+
export function parseAppmapJson(raw) {
|
|
191
|
+
let parsed;
|
|
192
|
+
try {
|
|
193
|
+
parsed = JSON.parse(raw);
|
|
194
|
+
}
|
|
195
|
+
catch {
|
|
196
|
+
throw new Error("AppMap is not valid JSON");
|
|
197
|
+
}
|
|
198
|
+
if (!isRecord(parsed)) {
|
|
199
|
+
throw new Error("AppMap must be a JSON object");
|
|
200
|
+
}
|
|
201
|
+
return parsed;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Find `*.appmap.json` in a mapper `--out` directory.
|
|
205
|
+
* Prefers `<app>.appmap.json` when several files exist.
|
|
206
|
+
*/
|
|
207
|
+
export function discoverAppmapJson(dir, app) {
|
|
208
|
+
if (!existsSync(dir)) {
|
|
209
|
+
throw new AppmapDiscoveryError(`mapper-out directory not found: ${dir}`);
|
|
210
|
+
}
|
|
211
|
+
if (!statSync(dir).isDirectory()) {
|
|
212
|
+
throw new AppmapDiscoveryError(`mapper-out is not a directory: ${dir}`);
|
|
213
|
+
}
|
|
214
|
+
const files = readdirSync(dir)
|
|
215
|
+
.filter((name) => name.endsWith(APPMAP_SUFFIX))
|
|
216
|
+
.sort();
|
|
217
|
+
if (files.length === 0) {
|
|
218
|
+
throw new AppmapDiscoveryError(`No *${APPMAP_SUFFIX} found in ${dir}`);
|
|
219
|
+
}
|
|
220
|
+
if (app) {
|
|
221
|
+
const preferred = appmapBankFile(app);
|
|
222
|
+
if (files.includes(preferred)) {
|
|
223
|
+
return join(dir, preferred);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
if (files.length === 1) {
|
|
227
|
+
return join(dir, files[0]);
|
|
228
|
+
}
|
|
229
|
+
throw new AppmapDiscoveryError(`Multiple *${APPMAP_SUFFIX} in ${dir} (${files.join(", ")}). Pass --map <file>.`);
|
|
230
|
+
}
|
|
231
|
+
/** Point last-run.map at the bank copy; fill empty app from --app. */
|
|
232
|
+
export function normalizeLastRunRaw(raw, mapRel, app) {
|
|
233
|
+
if (!isRecord(raw))
|
|
234
|
+
return raw;
|
|
235
|
+
const next = { ...raw, map: mapRel };
|
|
236
|
+
if (app && (typeof next.app !== "string" || next.app.trim() === "")) {
|
|
237
|
+
next.app = app;
|
|
238
|
+
}
|
|
239
|
+
return next;
|
|
240
|
+
}
|
|
241
|
+
/** Minimal README stub written when `.context/appmaps/` is created. */
|
|
242
|
+
export function appmapsReadmeStub() {
|
|
243
|
+
return `# AppMaps
|
|
244
|
+
|
|
245
|
+
Index, last-run history, and a Memory Bank copy of the mapper AppMap.
|
|
246
|
+
|
|
247
|
+
\`tocket suite loop\` copies \`<app>.appmap.json\` here so status and triage
|
|
248
|
+
can read what Oficina wrote. Runners stay outside this directory.
|
|
249
|
+
\`.context/appmaps/\` is file-first: \`tocket suite\` does not execute maps.
|
|
250
|
+
|
|
251
|
+
| File | Purpose |
|
|
252
|
+
| --- | --- |
|
|
253
|
+
| \`goals.md\` | Suite goals and coverage intent |
|
|
254
|
+
| \`<app>.appmap.json\` | Mapper (or hand) map copy |
|
|
255
|
+
| \`last-run.json\` | Last run (\`schema\`: \`${LAST_RUN_SCHEMA}\`) |
|
|
256
|
+
| \`last-run.md\` | Human-readable last-run table |
|
|
257
|
+
| \`<app>.triage.json\` | Optional Jev/heuristic triage (\`tocket.appmaps.triage/v0\`) |
|
|
258
|
+
|
|
259
|
+
## Tempestivita loop (Oficina)
|
|
260
|
+
|
|
261
|
+
1. Mapper (sibling, not vendored): \`npx tsx src/cli.ts all --url https://tempestivita.civita.dev --smoke\`
|
|
262
|
+
2. \`tocket suite loop --app tempestivita --mapper-out <mapper>/out --last-run <last-run.json> [--dry-run]\`
|
|
263
|
+
3. \`tocket suite status\`
|
|
264
|
+
|
|
265
|
+
Generic decisions (any state) use \`tocket decide\` → \`.context/decisions/<research|write|review>/\`. Loop does not call decide.
|
|
266
|
+
`;
|
|
267
|
+
}
|
|
268
|
+
export function appmapsGoalsStub() {
|
|
269
|
+
return `# AppMap goals
|
|
270
|
+
|
|
271
|
+
Record suite goals and coverage intent here.
|
|
272
|
+
|
|
273
|
+
\`tocket suite loop\` copies \`<app>.appmap.json\` into this directory for the Memory Bank.
|
|
274
|
+
This file is the index, not a runner.
|
|
275
|
+
`;
|
|
276
|
+
}
|
|
277
|
+
export function prettyLastRunJson(value) {
|
|
278
|
+
return `${JSON.stringify(value, null, 2)}\n`;
|
|
279
|
+
}
|
|
280
|
+
//# sourceMappingURL=appmaps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appmaps.js","sourceRoot":"","sources":["../../src/utils/appmaps.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAE7E,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,CAAC,MAAM,eAAe,GAAG,4BAA4B,CAAC;AAE5D,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,CAAC;AAC9C,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC;AAC7C,MAAM,CAA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AI,CAAC,IAAI,CAAC,uBAAuB,CACjF,CAAC;AACJ,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,mBAAmB,CACjC,GAAY,EACZ,MAAc,EACd,GAAY;IAEZ,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC;IAC/B,MAAM,IAAI,GAA4B,EAAE,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;IAC9D,IAAI,GAAG,IAAI,CAAC,OAAO,IAAI,CAAC,GAAG,KAAK,QAAQ,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QACpE,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,iBAAiB;IAC/B,OAAO;;;;;;;;;;;;gDAYuC,eAAe;;;;;;;;;;;CAW9D,CAAC;AACF,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO;;;;;;CAMR,CAAC;AACF,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;AAC/C,CAAC"}
|
package/dist/utils/context.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/** Shared constants and helpers for .context/ file operations. */
|
|
2
2
|
/** Number of days after which activeContext.md is considered stale. */
|
|
3
3
|
export declare const STALENESS_THRESHOLD_DAYS = 7;
|
|
4
|
+
/** Display paths with posix `/` on every OS (CLI "wrote …" / from= lines). */
|
|
5
|
+
export declare function toRepoRelative(cwd: string, outPath: string): string;
|
|
4
6
|
/**
|
|
5
7
|
* Extract the first meaningful line from the "## Current Focus" section
|
|
6
8
|
* of an activeContext.md file. Returns empty string if no focus is set.
|
package/dist/utils/context.js
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
/** Shared constants and helpers for .context/ file operations. */
|
|
2
|
+
import { isAbsolute, relative, sep } from "node:path";
|
|
2
3
|
/** Number of days after which activeContext.md is considered stale. */
|
|
3
4
|
export const STALENESS_THRESHOLD_DAYS = 7;
|
|
5
|
+
/** Display paths with posix `/` on every OS (CLI "wrote …" / from= lines). */
|
|
6
|
+
export function toRepoRelative(cwd, outPath) {
|
|
7
|
+
if (!outPath)
|
|
8
|
+
return outPath;
|
|
9
|
+
if (!isAbsolute(outPath)) {
|
|
10
|
+
return posixifyPath(outPath);
|
|
11
|
+
}
|
|
12
|
+
const rel = relative(cwd, outPath);
|
|
13
|
+
if (!rel ||
|
|
14
|
+
isAbsolute(rel) ||
|
|
15
|
+
rel === ".." ||
|
|
16
|
+
rel.startsWith(`..${sep}`) ||
|
|
17
|
+
rel.startsWith("../")) {
|
|
18
|
+
return posixifyPath(outPath);
|
|
19
|
+
}
|
|
20
|
+
return posixifyPath(rel);
|
|
21
|
+
}
|
|
22
|
+
function posixifyPath(p) {
|
|
23
|
+
return p.split(/[\\/]/g).join("/");
|
|
24
|
+
}
|
|
4
25
|
/**
|
|
5
26
|
* Extract the first meaningful line from the "## Current Focus" section
|
|
6
27
|
* of an activeContext.md file. Returns empty string if no focus is set.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/utils/context.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAElE,uEAAuE;AACvE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAE1C;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAC1D,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAAE,OAAO,EAAE,CAAC;IAC3B,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI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AC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAC1D,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAAE,OAAO,EAAE,CAAC;IAC3B,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC;QAAE,OAAO,EAAE,CAAC;IACxE,OAAO,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/** Generic Choice/Noul decisions. File-first; writes only under `.context/decisions/`. */
|
|
2
|
+
import { type JevQuestion } from "./jev.js";
|
|
3
|
+
export { toRepoRelative } from "./context.js";
|
|
4
|
+
export declare const DECIDE_SCHEMA = "tocket.decide/v0";
|
|
5
|
+
export declare const DECISIONS_DIR = ".context/decisions";
|
|
6
|
+
export declare const DECISIONS_README = "README.md";
|
|
7
|
+
export declare const STUB_MODEL = "stub-v0";
|
|
8
|
+
/** Codila chief.py default: only route research/write at or above this confidence. */
|
|
9
|
+
export declare const DEFAULT_CONFIDENCE_THRESHOLD = 0.85;
|
|
10
|
+
export declare const QUEUE_DESTINATIONS: readonly ["research", "write", "review"];
|
|
11
|
+
export declare const HIGH_CONFIDENCE_ROUTES: readonly ["research", "write"];
|
|
12
|
+
export declare const BOUNDED_FORKS: readonly ["agent", "model", "tool", "action", "human"];
|
|
13
|
+
export declare const DECIDE_LOOP = "state-questions-action-verify";
|
|
14
|
+
export declare const RANK_WIDE_MIN = 5;
|
|
15
|
+
/** Well-known Choice names for the file-first tool-risk gate (AutoMode pattern, not LangChain APIs). */
|
|
16
|
+
export declare const TOOL_GATE_NAMES: readonly ["tool_gate", "action_gate"];
|
|
17
|
+
export declare const TOOL_GATE_OPTIONS: readonly ["allow", "block", "ask"];
|
|
18
|
+
export type QueueDestination = (typeof QUEUE_DESTINATIONS)[number];
|
|
19
|
+
export type BoundedFork = (typeof BOUNDED_FORKS)[number];
|
|
20
|
+
export type DecideMode = "active" | "shadow" | "dry-run";
|
|
21
|
+
export type DecideSource = "jev" | "stub";
|
|
22
|
+
export type DecideSemantics = "handoff" | "log-only";
|
|
23
|
+
export type DecideHandoffStatus = "queued" | "logged";
|
|
24
|
+
export type DecidePrimitive = "choice" | "noul" | "score";
|
|
25
|
+
export type ToolGate = (typeof TOOL_GATE_OPTIONS)[number];
|
|
26
|
+
export type ToolGateName = (typeof TOOL_GATE_NAMES)[number];
|
|
27
|
+
export interface DecideChoiceSpec {
|
|
28
|
+
name: string;
|
|
29
|
+
options: string[];
|
|
30
|
+
}
|
|
31
|
+
export interface DecideNoulSpec {
|
|
32
|
+
name: string;
|
|
33
|
+
}
|
|
34
|
+
export interface DecideScoreSpec {
|
|
35
|
+
name: string;
|
|
36
|
+
min: number;
|
|
37
|
+
max: number;
|
|
38
|
+
}
|
|
39
|
+
export interface DecideChoiceAnswer {
|
|
40
|
+
type: "choice";
|
|
41
|
+
choice: string;
|
|
42
|
+
confidence: number;
|
|
43
|
+
rationale: string;
|
|
44
|
+
probabilities?: Record<string, number>;
|
|
45
|
+
}
|
|
46
|
+
export interface DecideNoulAnswer {
|
|
47
|
+
type: "noul";
|
|
48
|
+
noul: number;
|
|
49
|
+
confidence: number;
|
|
50
|
+
rationale: string;
|
|
51
|
+
}
|
|
52
|
+
export interface DecideScoreAnswer {
|
|
53
|
+
type: "score";
|
|
54
|
+
score: number;
|
|
55
|
+
confidence: number;
|
|
56
|
+
rationale: string;
|
|
57
|
+
}
|
|
58
|
+
export type DecideAnswer = DecideChoiceAnswer | DecideNoulAnswer | DecideScoreAnswer;
|
|
59
|
+
export interface DecideRecord {
|
|
60
|
+
schema: typeof DECIDE_SCHEMA;
|
|
61
|
+
id: string;
|
|
62
|
+
generated_at: string;
|
|
63
|
+
mode: DecideMode;
|
|
64
|
+
source: DecideSource;
|
|
65
|
+
model: string;
|
|
66
|
+
/** Codila-style router: selected option (first Choice). */
|
|
67
|
+
choice: string | null;
|
|
68
|
+
confidence: number;
|
|
69
|
+
/** Queue hint: research | write | review. Low-confidence research/write becomes review. */
|
|
70
|
+
destination: QueueDestination;
|
|
71
|
+
gated: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Tool-risk gate from a `tool_gate` / `action_gate` Choice (`allow|block|ask`).
|
|
74
|
+
* Null when the handoff has no gate question. Independent of Codila `gated`.
|
|
75
|
+
*/
|
|
76
|
+
tool_gate: ToolGate | null;
|
|
77
|
+
confidence_threshold: number;
|
|
78
|
+
/** handoff = workers may consume; log-only = shadow/dry-run (Tocket does not run workers). */
|
|
79
|
+
semantics: DecideSemantics;
|
|
80
|
+
status: DecideHandoffStatus;
|
|
81
|
+
/** Always false: Jev decides; LLMs create; agents act. This CLI only writes a file. */
|
|
82
|
+
executes: false;
|
|
83
|
+
loop: typeof DECIDE_LOOP;
|
|
84
|
+
fork: BoundedFork;
|
|
85
|
+
primitives: DecidePrimitive[];
|
|
86
|
+
batched: boolean;
|
|
87
|
+
rank_wide: boolean;
|
|
88
|
+
narrow: string | null;
|
|
89
|
+
state_summary: string;
|
|
90
|
+
state: unknown;
|
|
91
|
+
questions: Record<string, JevQuestion>;
|
|
92
|
+
answers: Record<string, DecideAnswer>;
|
|
93
|
+
}
|
|
94
|
+
export interface RunDecideOptions {
|
|
95
|
+
cwd: string;
|
|
96
|
+
state?: string;
|
|
97
|
+
fromPath?: string;
|
|
98
|
+
choices?: string[];
|
|
99
|
+
nouls?: string[];
|
|
100
|
+
scores?: string[];
|
|
101
|
+
fork?: string;
|
|
102
|
+
dryRun?: boolean;
|
|
103
|
+
shadow?: boolean;
|
|
104
|
+
id?: string;
|
|
105
|
+
confidenceThreshold?: number;
|
|
106
|
+
apiKey?: string | null;
|
|
107
|
+
now?: () => string;
|
|
108
|
+
fetchImpl?: typeof fetch;
|
|
109
|
+
}
|
|
110
|
+
export declare class DecideError extends Error {
|
|
111
|
+
constructor(message: string);
|
|
112
|
+
}
|
|
113
|
+
export declare function parseChoiceSpec(spec: string): DecideChoiceSpec;
|
|
114
|
+
export declare function parseNoulSpec(spec: string): DecideNoulSpec;
|
|
115
|
+
export declare function parseScoreSpec(spec: string): DecideScoreSpec;
|
|
116
|
+
export declare function parseFork(raw?: string): BoundedFork;
|
|
117
|
+
export declare function choiceCriterion(option: string): string;
|
|
118
|
+
export declare function isQueueDestination(value: string): value is QueueDestination;
|
|
119
|
+
export declare function isHighConfidenceRoute(value: string): boolean;
|
|
120
|
+
export declare function isToolGateName(name: string): boolean;
|
|
121
|
+
export declare function isToolGate(value: string | null | undefined): value is ToolGate;
|
|
122
|
+
export declare function parseToolGate(value: unknown): ToolGate | null;
|
|
123
|
+
/** Read a well-known `tool_gate` / `action_gate` Choice from answers. */
|
|
124
|
+
export declare function extractToolGate(answers: Record<string, DecideAnswer>): ToolGate | null;
|
|
125
|
+
export declare function resolveRecordToolGate(record: {
|
|
126
|
+
tool_gate?: ToolGate | null;
|
|
127
|
+
answers?: Record<string, DecideAnswer>;
|
|
128
|
+
}): ToolGate | null;
|
|
129
|
+
export declare function toolGateRefusesApply(gate: ToolGate | null): boolean;
|
|
130
|
+
export declare function parseConfidenceThreshold(raw?: string | number): number;
|
|
131
|
+
export declare function primaryChoice(answers: Record<string, DecideAnswer>): {
|
|
132
|
+
choice: string | null;
|
|
133
|
+
confidence: number;
|
|
134
|
+
};
|
|
135
|
+
/** Codila gate: research/write only when confidence >= threshold; otherwise review. */
|
|
136
|
+
export declare function resolveDestination(choice: string | null, confidence: number, threshold?: number, fork?: BoundedFork): {
|
|
137
|
+
destination: QueueDestination;
|
|
138
|
+
gated: boolean;
|
|
139
|
+
};
|
|
140
|
+
export declare function resolveSemantics(mode: DecideMode): {
|
|
141
|
+
semantics: DecideSemantics;
|
|
142
|
+
status: DecideHandoffStatus;
|
|
143
|
+
};
|
|
144
|
+
export declare function slugId(value: string): string;
|
|
145
|
+
export declare function fileTimestamp(iso: string): string;
|
|
146
|
+
export declare function summarizeState(state: unknown): string;
|
|
147
|
+
export declare function stateBlob(state: unknown): string;
|
|
148
|
+
export declare function parseStateInput(raw: string): unknown;
|
|
149
|
+
export declare function loadState(options: {
|
|
150
|
+
state?: string;
|
|
151
|
+
fromPath?: string;
|
|
152
|
+
}): unknown;
|
|
153
|
+
export declare function buildQuestions(choices: DecideChoiceSpec[], nouls: DecideNoulSpec[], scores?: DecideScoreSpec[]): Record<string, JevQuestion>;
|
|
154
|
+
export declare function stubChoice(name: string, options: string[], state: unknown): DecideChoiceAnswer;
|
|
155
|
+
export declare function stubNoul(_name: string, state: unknown): DecideNoulAnswer;
|
|
156
|
+
export declare function stubScore(name: string, min: number, max: number, state: unknown): DecideScoreAnswer;
|
|
157
|
+
export declare function stubAnswers(questions: Record<string, JevQuestion>, state: unknown): Record<string, DecideAnswer>;
|
|
158
|
+
export declare function isInsideContext(cwd: string, targetPath: string): boolean;
|
|
159
|
+
export declare function decisionOutputPath(cwd: string, generatedAt: string, id: string, destination?: QueueDestination): string;
|
|
160
|
+
export declare function defaultDecisionId(choices: DecideChoiceSpec[], nouls: DecideNoulSpec[], scores?: DecideScoreSpec[]): string;
|
|
161
|
+
export declare function listPrimitives(questions: Record<string, JevQuestion>): DecidePrimitive[];
|
|
162
|
+
export declare function choiceOptionCount(questions: Record<string, JevQuestion>): number;
|
|
163
|
+
export declare function resolveDecideMode(options: {
|
|
164
|
+
dryRun?: boolean;
|
|
165
|
+
shadow?: boolean;
|
|
166
|
+
apiKey?: string;
|
|
167
|
+
}): {
|
|
168
|
+
useLive: boolean;
|
|
169
|
+
mode: DecideMode;
|
|
170
|
+
};
|
|
171
|
+
export declare function prettyDecideJson(value: unknown): string;
|
|
172
|
+
export declare function decisionsReadmeStub(): string;
|
|
173
|
+
export declare function parseDecideRecord(raw: string): DecideRecord;
|
|
174
|
+
export declare function formatDecideSummary(record: DecideRecord, relPath: string): string;
|
|
175
|
+
export declare function runDecide(options: RunDecideOptions): Promise<{
|
|
176
|
+
record: DecideRecord;
|
|
177
|
+
outPath: string;
|
|
178
|
+
}>;
|