@ai-dossier/cli 0.87.0 → 0.88.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/dist/cap-git.d.ts +38 -0
- package/dist/cap-git.d.ts.map +1 -0
- package/dist/cap-git.js +114 -0
- package/dist/cap-git.js.map +1 -0
- package/dist/cap-log.d.ts +31 -0
- package/dist/cap-log.d.ts.map +1 -1
- package/dist/cap-log.js +67 -0
- package/dist/cap-log.js.map +1 -1
- package/dist/commands/cap.d.ts +1 -0
- package/dist/commands/cap.d.ts.map +1 -1
- package/dist/commands/cap.js +81 -0
- package/dist/commands/cap.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git state of a capability run's working directory (#941).
|
|
3
|
+
*
|
|
4
|
+
* `caps.jsonl` rows record what was verified: the HEAD commit, its tree, and
|
|
5
|
+
* whether the working tree was dirty. A dirty run's verdict describes code
|
|
6
|
+
* that was never committed, so `cap last-ok` refuses to reuse it.
|
|
7
|
+
*
|
|
8
|
+
* The probe is deliberately paranoid: it must not be fooled by repo/user git
|
|
9
|
+
* config (`status.showUntrackedFiles=no`, submodule ignore), by index flags
|
|
10
|
+
* that hide edits (`--assume-unchanged`, `--skip-worktree`), or by an
|
|
11
|
+
* inherited `GIT_DIR`/`GIT_WORK_TREE`/`GIT_INDEX_FILE` pointing elsewhere. When
|
|
12
|
+
* the probe itself fails it says so (`git_probe`) and reports dirty — an
|
|
13
|
+
* unknown tree is never a reusable one.
|
|
14
|
+
*/
|
|
15
|
+
export interface CapGitState {
|
|
16
|
+
git_head: string;
|
|
17
|
+
git_tree: string;
|
|
18
|
+
/** `git rev-parse --show-prefix`: where in the repo the run happened ('' = root, else `sub/dir/`). */
|
|
19
|
+
git_prefix: string;
|
|
20
|
+
dirty: boolean;
|
|
21
|
+
/** Set when the probe timed out or errored mid-way; `dirty` is then forced true. */
|
|
22
|
+
git_probe?: 'timeout' | 'error';
|
|
23
|
+
}
|
|
24
|
+
/** Total wall-clock budget for one probe (all git calls together). */
|
|
25
|
+
export declare const GIT_PROBE_BUDGET_MS = 10000;
|
|
26
|
+
/**
|
|
27
|
+
* Null when `cwd` is not inside a git work tree, has no commit yet, or git is
|
|
28
|
+
* not installed. A probe that fails after the repo was recognised returns the
|
|
29
|
+
* head/tree it has with `dirty: true` and `git_probe` set (plus a stderr note).
|
|
30
|
+
*/
|
|
31
|
+
export declare function captureGitState(cwd: string): CapGitState | null;
|
|
32
|
+
/**
|
|
33
|
+
* Combine the probes taken before and after a run: the row describes the tree
|
|
34
|
+
* the run STARTED on, and is dirty if either probe was, or if the run moved
|
|
35
|
+
* HEAD or changed the tree under test.
|
|
36
|
+
*/
|
|
37
|
+
export declare function mergeGitStates(before: CapGitState | null, after: CapGitState | null): CapGitState | null;
|
|
38
|
+
//# sourceMappingURL=cap-git.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cap-git.d.ts","sourceRoot":"","sources":["../src/cap-git.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,sGAAsG;IACtG,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,oFAAoF;IACpF,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;CACjC;AAED,sEAAsE;AACtE,eAAO,MAAM,mBAAmB,QAAS,CAAC;AAgD1C;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAmC/D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,WAAW,GAAG,IAAI,EAC1B,KAAK,EAAE,WAAW,GAAG,IAAI,GACxB,WAAW,GAAG,IAAI,CAYpB"}
|
package/dist/cap-git.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Git state of a capability run's working directory (#941).
|
|
4
|
+
*
|
|
5
|
+
* `caps.jsonl` rows record what was verified: the HEAD commit, its tree, and
|
|
6
|
+
* whether the working tree was dirty. A dirty run's verdict describes code
|
|
7
|
+
* that was never committed, so `cap last-ok` refuses to reuse it.
|
|
8
|
+
*
|
|
9
|
+
* The probe is deliberately paranoid: it must not be fooled by repo/user git
|
|
10
|
+
* config (`status.showUntrackedFiles=no`, submodule ignore), by index flags
|
|
11
|
+
* that hide edits (`--assume-unchanged`, `--skip-worktree`), or by an
|
|
12
|
+
* inherited `GIT_DIR`/`GIT_WORK_TREE`/`GIT_INDEX_FILE` pointing elsewhere. When
|
|
13
|
+
* the probe itself fails it says so (`git_probe`) and reports dirty — an
|
|
14
|
+
* unknown tree is never a reusable one.
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.GIT_PROBE_BUDGET_MS = void 0;
|
|
18
|
+
exports.captureGitState = captureGitState;
|
|
19
|
+
exports.mergeGitStates = mergeGitStates;
|
|
20
|
+
const node_child_process_1 = require("node:child_process");
|
|
21
|
+
/** Total wall-clock budget for one probe (all git calls together). */
|
|
22
|
+
exports.GIT_PROBE_BUDGET_MS = 10_000;
|
|
23
|
+
/** GIT_* vars redirect git at another repo/index; the probe must see `cwd`'s own. */
|
|
24
|
+
function probeEnv() {
|
|
25
|
+
const env = {};
|
|
26
|
+
for (const [k, v] of Object.entries(process.env)) {
|
|
27
|
+
if (!k.startsWith('GIT_'))
|
|
28
|
+
env[k] = v;
|
|
29
|
+
}
|
|
30
|
+
return env;
|
|
31
|
+
}
|
|
32
|
+
function git(cwd, args, deadline) {
|
|
33
|
+
const remaining = deadline - Date.now();
|
|
34
|
+
if (remaining <= 0)
|
|
35
|
+
return { ok: false, kind: 'timeout', detail: 'probe budget exhausted' };
|
|
36
|
+
const res = (0, node_child_process_1.spawnSync)('git', ['--no-optional-locks', '-c', 'core.fsmonitor=false', '-c', 'core.fileMode=true', ...args], {
|
|
37
|
+
cwd,
|
|
38
|
+
env: probeEnv(),
|
|
39
|
+
encoding: 'utf8',
|
|
40
|
+
timeout: remaining,
|
|
41
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
42
|
+
});
|
|
43
|
+
if (res.error) {
|
|
44
|
+
const code = res.error.code;
|
|
45
|
+
return {
|
|
46
|
+
ok: false,
|
|
47
|
+
kind: code === 'ETIMEDOUT' ? 'timeout' : 'error',
|
|
48
|
+
detail: res.error.message,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
if (res.status !== 0) {
|
|
52
|
+
return { ok: false, kind: 'exit', detail: (res.stderr ?? '').trim() };
|
|
53
|
+
}
|
|
54
|
+
return { ok: true, stdout: res.stdout ?? '' };
|
|
55
|
+
}
|
|
56
|
+
/** `ls-files -v` tags: lowercase = assume-unchanged, `S`/`s` = skip-worktree. */
|
|
57
|
+
function hasHiddenIndexFlags(lsFilesV) {
|
|
58
|
+
return lsFilesV.split('\0').some((entry) => /^[a-zS]/.test(entry));
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Null when `cwd` is not inside a git work tree, has no commit yet, or git is
|
|
62
|
+
* not installed. A probe that fails after the repo was recognised returns the
|
|
63
|
+
* head/tree it has with `dirty: true` and `git_probe` set (plus a stderr note).
|
|
64
|
+
*/
|
|
65
|
+
function captureGitState(cwd) {
|
|
66
|
+
const deadline = Date.now() + exports.GIT_PROBE_BUDGET_MS;
|
|
67
|
+
const ids = git(cwd, ['rev-parse', '--is-inside-work-tree', 'HEAD', 'HEAD^{tree}', '--show-prefix'], deadline);
|
|
68
|
+
if (!ids.ok) {
|
|
69
|
+
if (ids.kind === 'exit')
|
|
70
|
+
return null;
|
|
71
|
+
if (ids.kind === 'error')
|
|
72
|
+
return null; // git missing / not spawnable
|
|
73
|
+
process.stderr.write(`cap: git probe ${ids.kind}: ${ids.detail}\n`);
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
const [inside, git_head, git_tree, git_prefix = ''] = ids.stdout.replace(/\n$/, '').split('\n');
|
|
77
|
+
if (inside !== 'true' || !git_head || !git_tree)
|
|
78
|
+
return null;
|
|
79
|
+
const fail = (r) => {
|
|
80
|
+
const probe = r.kind === 'timeout' ? 'timeout' : 'error';
|
|
81
|
+
process.stderr.write(`cap: git dirty check ${probe}: ${r.detail} — recording the run as dirty\n`);
|
|
82
|
+
return { git_head, git_tree, git_prefix, dirty: true, git_probe: probe };
|
|
83
|
+
};
|
|
84
|
+
const status = git(cwd, ['status', '--porcelain', '--untracked-files=normal', '--ignore-submodules=none'], deadline);
|
|
85
|
+
if (!status.ok)
|
|
86
|
+
return fail(status);
|
|
87
|
+
if (status.stdout.length > 0)
|
|
88
|
+
return { git_head, git_tree, git_prefix, dirty: true };
|
|
89
|
+
const flags = git(cwd, ['ls-files', '-v', '-z', '--', ':/'], deadline);
|
|
90
|
+
if (!flags.ok)
|
|
91
|
+
return fail(flags);
|
|
92
|
+
return { git_head, git_tree, git_prefix, dirty: hasHiddenIndexFlags(flags.stdout) };
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Combine the probes taken before and after a run: the row describes the tree
|
|
96
|
+
* the run STARTED on, and is dirty if either probe was, or if the run moved
|
|
97
|
+
* HEAD or changed the tree under test.
|
|
98
|
+
*/
|
|
99
|
+
function mergeGitStates(before, after) {
|
|
100
|
+
if (!before)
|
|
101
|
+
return null;
|
|
102
|
+
if (!after)
|
|
103
|
+
return { ...before, dirty: true, git_probe: before.git_probe ?? 'error' };
|
|
104
|
+
const moved = before.git_head !== after.git_head || before.git_tree !== after.git_tree;
|
|
105
|
+
const probe = before.git_probe ?? after.git_probe;
|
|
106
|
+
return {
|
|
107
|
+
git_head: before.git_head,
|
|
108
|
+
git_tree: before.git_tree,
|
|
109
|
+
git_prefix: before.git_prefix,
|
|
110
|
+
dirty: before.dirty || after.dirty || moved,
|
|
111
|
+
...(probe ? { git_probe: probe } : {}),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=cap-git.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cap-git.js","sourceRoot":"","sources":["../src/cap-git.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAoEH,0CAmCC;AAOD,wCAeC;AA3HD,2DAA+C;AAY/C,sEAAsE;AACzD,QAAA,mBAAmB,GAAG,MAAM,CAAC;AAE1C,qFAAqF;AACrF,SAAS,QAAQ;IACf,MAAM,GAAG,GAAsB,EAAE,CAAC;IAClC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACjD,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC;YAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAMD,SAAS,GAAG,CAAC,GAAW,EAAE,IAAc,EAAE,QAAgB;IACxD,MAAM,SAAS,GAAG,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACxC,IAAI,SAAS,IAAI,CAAC;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,wBAAwB,EAAE,CAAC;IAC5F,MAAM,GAAG,GAAG,IAAA,8BAAS,EACnB,KAAK,EACL,CAAC,qBAAqB,EAAE,IAAI,EAAE,sBAAsB,EAAE,IAAI,EAAE,oBAAoB,EAAE,GAAG,IAAI,CAAC,EAC1F;QACE,GAAG;QACH,GAAG,EAAE,QAAQ,EAAE;QACf,QAAQ,EAAE,MAAM;QAChB,OAAO,EAAE,SAAS;QAClB,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI;KAC5B,C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1/AC3). */
|
|
24
24
|
output_tail?: string;
|
|
25
|
+
/** `git rev-parse HEAD` when cwd is a git work tree (#941). */
|
|
26
|
+
git_head?: string;
|
|
27
|
+
/** `git rev-parse HEAD^{tree}` when cwd is a git work tree (#941). */
|
|
28
|
+
git_tree?: string;
|
|
29
|
+
/** Tree was dirty before or after the run, or HEAD/tree moved during it (#941). */
|
|
30
|
+
dirty?: boolean;
|
|
31
|
+
/** Directory inside the repo the run happened in (`--show-prefix`); part of the match key. */
|
|
32
|
+
git_prefix?: string;
|
|
33
|
+
/** The git probe timed out or errored; `dirty` is then true (#941). */
|
|
34
|
+
git_probe?: 'timeout' | 'error';
|
|
35
|
+
/** Args passed after `--` to `cap run` (#941): `--only smoke` is not a full gate. */
|
|
36
|
+
args?: string[];
|
|
37
|
+
/** sha256 of the manifest `command` string that ran — a changed command never matches. */
|
|
38
|
+
command_hash?: string;
|
|
39
|
+
/** sha256 of the JSON args array — the match key for `cap last-ok`. */
|
|
40
|
+
args_hash?: string;
|
|
25
41
|
}
|
|
42
|
+
/** Stable digest of a capability's extra args (order-sensitive). */
|
|
43
|
+
export declare function hashCapCommand(command: string): string;
|
|
44
|
+
export declare function hashCapArgs(args: string[]): string;
|
|
26
45
|
declare const CAP_LOG_FILE: string;
|
|
27
46
|
/**
|
|
28
47
|
* Append one JSONL line to ~/.dossier/caps.jsonl.
|
|
29
48
|
* Respects auditLog config flag. Never crashes the run.
|
|
30
49
|
*/
|
|
31
50
|
export declare function appendCapLog(entry: CapLogEntry): void;
|
|
51
|
+
/**
|
|
52
|
+
* Latest `ok` row for `capability` invoked with exactly `args` (from `scope.prefix`, with `scope.commandHash`, when given) that verified
|
|
53
|
+
* exactly `tree` on a clean working tree. Not part of the match key (by
|
|
54
|
+
* design): git-ignored files, toolchain/CLI versions, env, nested repos.
|
|
55
|
+
* A dirty row, a probe-failed row, or one without `args_hash` (pre-args
|
|
56
|
+
* schema) never matches. Null when nothing qualifies; a missing file is
|
|
57
|
+
* "nothing", any other read error throws.
|
|
58
|
+
*/
|
|
59
|
+
export declare function findLastOk(capability: string, tree: string, args?: string[], file?: string, scope?: {
|
|
60
|
+
prefix?: string;
|
|
61
|
+
commandHash?: string;
|
|
62
|
+
}): CapLogEntry | null;
|
|
32
63
|
export { CAP_LOG_FILE };
|
|
33
64
|
//# sourceMappingURL=cap-log.d.ts.map
|
package/dist/cap-log.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cap-log.d.ts","sourceRoot":"","sources":["../src/cap-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"cap-log.d.ts","sourceRoot":"","sources":["../src/cap-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAItD,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,sFAAsF;IACtF,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,0EAA0E;IAC1E,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,+EAA+E;IAC/E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mFAAmF;IACnF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8FAA8F;IAC9F,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAChC,qFAAqF;IACrF,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,0FAA0F;IAC1F,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,oEAAoE;AACpE,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAElD;AAED,QAAA,MAAM,YAAY,QAAsC,CAAC;AAEzD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAErD;AAiBD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,MAAM,EAAO,EACnB,IAAI,GAAE,MAAqB,EAC3B,KAAK,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO,GACpD,WAAW,GAAG,IAAI,CA4BpB;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
package/dist/cap-log.js
CHANGED
|
@@ -14,10 +14,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
};
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.CAP_LOG_FILE = void 0;
|
|
17
|
+
exports.hashCapCommand = hashCapCommand;
|
|
18
|
+
exports.hashCapArgs = hashCapArgs;
|
|
17
19
|
exports.appendCapLog = appendCapLog;
|
|
20
|
+
exports.findLastOk = findLastOk;
|
|
21
|
+
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
22
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
18
23
|
const node_path_1 = __importDefault(require("node:path"));
|
|
19
24
|
const config_1 = require("./config");
|
|
20
25
|
const jsonl_log_1 = require("./jsonl-log");
|
|
26
|
+
/** Stable digest of a capability's extra args (order-sensitive). */
|
|
27
|
+
function hashCapCommand(command) {
|
|
28
|
+
return node_crypto_1.default.createHash('sha256').update(command).digest('hex');
|
|
29
|
+
}
|
|
30
|
+
function hashCapArgs(args) {
|
|
31
|
+
return node_crypto_1.default.createHash('sha256').update(JSON.stringify(args)).digest('hex');
|
|
32
|
+
}
|
|
21
33
|
const CAP_LOG_FILE = node_path_1.default.join(config_1.CONFIG_DIR, 'caps.jsonl');
|
|
22
34
|
exports.CAP_LOG_FILE = CAP_LOG_FILE;
|
|
23
35
|
/**
|
|
@@ -27,4 +39,59 @@ exports.CAP_LOG_FILE = CAP_LOG_FILE;
|
|
|
27
39
|
function appendCapLog(entry) {
|
|
28
40
|
(0, jsonl_log_1.appendAuditJsonl)(CAP_LOG_FILE, entry);
|
|
29
41
|
}
|
|
42
|
+
/** A torn append can leave `{"timestamp"...garbage` glued to the next row; salvage the tail. */
|
|
43
|
+
function parseRow(line) {
|
|
44
|
+
try {
|
|
45
|
+
return JSON.parse(line);
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
const at = line.lastIndexOf('{"timestamp"');
|
|
49
|
+
if (at <= 0)
|
|
50
|
+
return null;
|
|
51
|
+
try {
|
|
52
|
+
return JSON.parse(line.slice(at));
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Latest `ok` row for `capability` invoked with exactly `args` (from `scope.prefix`, with `scope.commandHash`, when given) that verified
|
|
61
|
+
* exactly `tree` on a clean working tree. Not part of the match key (by
|
|
62
|
+
* design): git-ignored files, toolchain/CLI versions, env, nested repos.
|
|
63
|
+
* A dirty row, a probe-failed row, or one without `args_hash` (pre-args
|
|
64
|
+
* schema) never matches. Null when nothing qualifies; a missing file is
|
|
65
|
+
* "nothing", any other read error throws.
|
|
66
|
+
*/
|
|
67
|
+
function findLastOk(capability, tree, args = [], file = CAP_LOG_FILE, scope = {}) {
|
|
68
|
+
let raw;
|
|
69
|
+
try {
|
|
70
|
+
raw = node_fs_1.default.readFileSync(file, 'utf8');
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
if (err.code === 'ENOENT')
|
|
74
|
+
return null;
|
|
75
|
+
throw err;
|
|
76
|
+
}
|
|
77
|
+
const want = hashCapArgs(args);
|
|
78
|
+
const lines = raw.split('\n');
|
|
79
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
80
|
+
if (!lines[i])
|
|
81
|
+
continue;
|
|
82
|
+
const row = parseRow(lines[i]);
|
|
83
|
+
if (row &&
|
|
84
|
+
row.capability === capability &&
|
|
85
|
+
row.outcome === 'ok' &&
|
|
86
|
+
row.git_tree === tree &&
|
|
87
|
+
row.dirty === false &&
|
|
88
|
+
!row.git_probe &&
|
|
89
|
+
row.args_hash === want &&
|
|
90
|
+
(scope.prefix === undefined || row.git_prefix === scope.prefix) &&
|
|
91
|
+
(scope.commandHash === undefined || row.command_hash === scope.commandHash)) {
|
|
92
|
+
return row;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
30
97
|
//# sourceMappingURL=cap-log.js.map
|
package/dist/cap-log.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cap-log.js","sourceRoot":"","sources":["../src/cap-log.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;
|
|
1
|
+
{"version":3,"file":"cap-log.js","sourceRoot":"","sources":["../src/cap-log.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;AAyCH,wCAEC;AAED,kCAEC;AAQD,oCAEC;AAyBD,gCAkCC;AAlHD,8DAAiC;AACjC,sDAAyB;AACzB,0DAA6B;AAE7B,qCAAsC;AACtC,2CAA+C;AAiC/C,oEAAoE;AACpE,SAAgB,cAAc,CAAC,OAAe;IAC5C,OAAO,qBAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAA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AAQ;YAAE,OAAO,IAAI,CAAC;QAClE,MAAM,GAAG,CAAC;IACZ,CAAC;IACD,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9B,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YAAE,SAAS;QACxB,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/B,IACE,GAAG;YACH,GAAG,CAAC,UAAU,KAAK,UAAU;YAC7B,GAAG,CAAC,OAAO,KAAK,IAAI;YACpB,GAAG,CAAC,QAAQ,KAAK,IAAI;YACrB,GAAG,CAAC,KAAK,KAAK,KAAK;YACnB,CAAC,GAAG,CAAC,SAAS;YACd,GAAG,CAAC,SAAS,KAAK,IAAI;YACtB,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,IAAI,GAAG,CAAC,UAAU,KAAK,KAAK,CAAC,MAAM,CAAC;YAC/D,CAAC,KAAK,CAAC,WAAW,KAAK,SAAS,IAAI,GAAG,CAAC,YAAY,KAAK,KAAK,CAAC,WAAW,CAAC,EAC3E,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/commands/cap.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* cap init [--print] scaffold a manifest from the detected project (#645)
|
|
5
5
|
* cap list [--json] inspect .dossier/automation/manifest.yaml
|
|
6
6
|
* cap run <id> [-- args] execute one capability
|
|
7
|
+
* cap last-ok <id> --tree <sha> [-- args] did this exact tree already pass? (#941)
|
|
7
8
|
*
|
|
8
9
|
* `cap run` owns its exit codes (the four-way outcome contract):
|
|
9
10
|
* 0 ok · 1 task-failed · 2 automation-broken · 3 capability-unavailable
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cap.d.ts","sourceRoot":"","sources":["../../src/commands/cap.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cap.d.ts","sourceRoot":"","sources":["../../src/commands/cap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqFzC,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwOzD"}
|
package/dist/commands/cap.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* cap init [--print] scaffold a manifest from the detected project (#645)
|
|
6
6
|
* cap list [--json] inspect .dossier/automation/manifest.yaml
|
|
7
7
|
* cap run <id> [-- args] execute one capability
|
|
8
|
+
* cap last-ok <id> --tree <sha> [-- args] did this exact tree already pass? (#941)
|
|
8
9
|
*
|
|
9
10
|
* `cap run` owns its exit codes (the four-way outcome contract):
|
|
10
11
|
* 0 ok · 1 task-failed · 2 automation-broken · 3 capability-unavailable
|
|
@@ -17,9 +18,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
18
|
exports.registerCapCommand = registerCapCommand;
|
|
18
19
|
const sched_1 = require("@ai-dossier/sched");
|
|
19
20
|
const cap_envelope_1 = require("../cap-envelope");
|
|
21
|
+
const cap_git_1 = require("../cap-git");
|
|
20
22
|
const cap_init_1 = require("../cap-init");
|
|
21
23
|
const cap_log_1 = require("../cap-log");
|
|
22
24
|
const capability_1 = require("../capability");
|
|
25
|
+
const config_1 = require("../config");
|
|
23
26
|
const helpers_1 = require("../helpers");
|
|
24
27
|
const table_1 = require("../table");
|
|
25
28
|
/**
|
|
@@ -41,6 +44,8 @@ function drain(stream) {
|
|
|
41
44
|
}
|
|
42
45
|
});
|
|
43
46
|
}
|
|
47
|
+
/** `cap last-ok` exit codes: distinct so a caller can tell "run it" from "could not ask". */
|
|
48
|
+
const LAST_OK_EXIT = { match: 0, noMatch: 1, error: 2, auditDisabled: 3 };
|
|
44
49
|
function loadOrFail() {
|
|
45
50
|
try {
|
|
46
51
|
return (0, capability_1.loadCapabilityManifest)(process.cwd());
|
|
@@ -133,6 +138,65 @@ function registerCapCommand(program) {
|
|
|
133
138
|
console.log(`Capabilities (${manifest.path}):`);
|
|
134
139
|
console.log((0, table_1.renderTable)(['capability', 'lifecycle', 'command', 'description'], rows));
|
|
135
140
|
});
|
|
141
|
+
cap
|
|
142
|
+
.command('last-ok <id> [args...]')
|
|
143
|
+
.description('Did this exact tree already pass? Prints the latest clean `ok` caps.jsonl row for <id> run with exactly [args] (after --) at --tree. ' +
|
|
144
|
+
`Exit codes: ${LAST_OK_EXIT.match} match, ${LAST_OK_EXIT.noMatch} no match (no output; dirty, failed and different-args runs never match), ` +
|
|
145
|
+
`${LAST_OK_EXIT.error} error (bad --tree, unreadable log), ${LAST_OK_EXIT.auditDisabled} audit log disabled (cannot answer) (#941)`)
|
|
146
|
+
.option('--tree <sha>', 'git tree sha, 40 or 64 hex (`git rev-parse HEAD^{tree}`); must come from a CLEAN tree')
|
|
147
|
+
.option('--here', 'Probe the current directory instead: use its tree and prefix, exit 1 if the tree is dirty')
|
|
148
|
+
.option('--prefix <path>', "Directory inside the repo the run happened in (default: the current directory's own prefix)")
|
|
149
|
+
.allowUnknownOption(true)
|
|
150
|
+
.action((id, args, opts) => {
|
|
151
|
+
const cwd = process.cwd();
|
|
152
|
+
const here = (0, cap_git_1.captureGitState)(cwd);
|
|
153
|
+
let tree = opts.tree;
|
|
154
|
+
if (opts.here) {
|
|
155
|
+
if (here === null) {
|
|
156
|
+
process.stderr.write('cap last-ok --here: not inside a git work tree with a commit\n');
|
|
157
|
+
process.exit(LAST_OK_EXIT.error);
|
|
158
|
+
}
|
|
159
|
+
if (here.dirty)
|
|
160
|
+
process.exit(LAST_OK_EXIT.noMatch);
|
|
161
|
+
tree = here.git_tree;
|
|
162
|
+
}
|
|
163
|
+
if (tree === undefined || !/^([0-9a-f]{40}|[0-9a-f]{64})$/.test(tree)) {
|
|
164
|
+
process.stderr.write(`cap last-ok: --tree must be a 40- or 64-hex git tree sha (or use --here), got '${tree}'\n`);
|
|
165
|
+
process.exit(LAST_OK_EXIT.error);
|
|
166
|
+
}
|
|
167
|
+
let commandHash;
|
|
168
|
+
try {
|
|
169
|
+
const entry = (0, capability_1.loadCapabilityManifest)(cwd).capabilities[id];
|
|
170
|
+
if (!entry)
|
|
171
|
+
process.exit(LAST_OK_EXIT.noMatch);
|
|
172
|
+
commandHash = (0, cap_log_1.hashCapCommand)(entry.command);
|
|
173
|
+
}
|
|
174
|
+
catch (err) {
|
|
175
|
+
if (err instanceof capability_1.CapManifestError) {
|
|
176
|
+
process.stderr.write(`cap last-ok: ${err.message}\n`);
|
|
177
|
+
process.exit(LAST_OK_EXIT.error);
|
|
178
|
+
}
|
|
179
|
+
throw err;
|
|
180
|
+
}
|
|
181
|
+
if ((0, config_1.getConfig)('auditLog') === false) {
|
|
182
|
+
process.stderr.write('cap last-ok: auditLog is disabled — no caps.jsonl to consult\n');
|
|
183
|
+
process.exit(LAST_OK_EXIT.auditDisabled);
|
|
184
|
+
}
|
|
185
|
+
let row;
|
|
186
|
+
try {
|
|
187
|
+
row = (0, cap_log_1.findLastOk)(id, tree, args, undefined, {
|
|
188
|
+
prefix: opts.prefix ?? here?.git_prefix ?? '',
|
|
189
|
+
commandHash,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
catch (err) {
|
|
193
|
+
process.stderr.write(`cap last-ok: could not read caps.jsonl: ${err.message}\n`);
|
|
194
|
+
process.exit(LAST_OK_EXIT.error);
|
|
195
|
+
}
|
|
196
|
+
if (!row)
|
|
197
|
+
process.exit(LAST_OK_EXIT.noMatch);
|
|
198
|
+
console.log(JSON.stringify(row));
|
|
199
|
+
});
|
|
136
200
|
cap
|
|
137
201
|
.command('run <id> [args...]')
|
|
138
202
|
.description('Execute one capability; extra args after -- are shell-quoted and appended to the command. ' +
|
|
@@ -146,7 +210,20 @@ function registerCapCommand(program) {
|
|
|
146
210
|
if (!Number.isFinite(tailBytes) || tailBytes < 0) {
|
|
147
211
|
(0, helpers_1.fail)([`--tail-bytes must be a non-negative number, got '${opts.tailBytes}'`]);
|
|
148
212
|
}
|
|
213
|
+
// Probed before AND after: the row names the tree the run started on and
|
|
214
|
+
// is dirty if the run (or anything before it) changed the work tree.
|
|
215
|
+
let commandHash;
|
|
216
|
+
try {
|
|
217
|
+
const entry = (0, capability_1.loadCapabilityManifest)(cwd).capabilities[id];
|
|
218
|
+
if (entry)
|
|
219
|
+
commandHash = (0, cap_log_1.hashCapCommand)(entry.command);
|
|
220
|
+
}
|
|
221
|
+
catch {
|
|
222
|
+
// runCapabilityFromCwd reports a bad manifest as the run's own outcome
|
|
223
|
+
}
|
|
224
|
+
const gitBefore = (0, cap_git_1.captureGitState)(cwd);
|
|
149
225
|
const result = (0, capability_1.runCapabilityFromCwd)(id, args, cwd, tailBytes);
|
|
226
|
+
const gitState = (0, cap_git_1.mergeGitStates)(gitBefore, gitBefore ? (0, cap_git_1.captureGitState)(cwd) : null);
|
|
150
227
|
// The verdict channel is written FIRST: nothing after this point (the
|
|
151
228
|
// telemetry append, stdout) may prevent a consumer from reading it.
|
|
152
229
|
const json = envelope(result);
|
|
@@ -171,6 +248,10 @@ function registerCapCommand(program) {
|
|
|
171
248
|
reason: result.reason,
|
|
172
249
|
signal: result.signal,
|
|
173
250
|
cwd,
|
|
251
|
+
args,
|
|
252
|
+
args_hash: (0, cap_log_1.hashCapArgs)(args),
|
|
253
|
+
...(commandHash ? { command_hash: commandHash } : {}),
|
|
254
|
+
...(gitState ?? {}),
|
|
174
255
|
...(result.output_tail !== undefined ? { output_tail: result.output_tail } : {}),
|
|
175
256
|
});
|
|
176
257
|
}
|
package/dist/commands/cap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cap.js","sourceRoot":"","sources":["../../src/commands/cap.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"cap.js","sourceRoot":"","sources":["../../src/commands/cap.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAwFH,gDAwOC;AA9TD,6CAAoD;AAEpD,kDAAmG;AACnG,wCAA6D;AAC7D,0CAAsF;AACtF,wCAAmF;AACnF,8CAUuB;AACvB,sCAAsC;AACtC,wCAAkC;AAClC,oCAAuC;AAevC;;;;;;GAMG;AACH,SAAS,KAAK,CAAC,MAA0B;IACvC,IAAI,MAAM,CAAC,cAAc,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC1D,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAI,CAAC;YACH,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QACpC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,6FAA6F;AAC7F,MAAM,YAAY,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,EAAW,CAAC;AAEnF,SAAS,UAAU;IACjB,IAAI,CAAC;QACH,OAAO,IAAA,mCAAsB,EAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,6BAAgB,EAAE,CAAC;YACpC,IAAA,cAAI,EAAC,CAAC,mCAAmC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC3D,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,SAAS,QAAQ,CAA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C,MAAM,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAClE,OAAO,CAAC,IAAI,CAAC,kCAAqB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-dossier/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.88.0",
|
|
4
4
|
"description": "Create, verify, sign, publish, and run dossiers — portable, signed, versioned skills for any LLM tool. The dossier ⇄ Claude Code skill bridge (install-skill / skill-export).",
|
|
5
5
|
"main": "dist/cli.js",
|
|
6
6
|
"bin": {
|