carrick 0.3.131 → 0.3.133
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/cli.d.ts +13 -1
- package/dist/cli.js +24 -3
- package/dist/cli.js.map +1 -1
- package/dist/contract.d.ts +12 -0
- package/dist/contract.js +18 -0
- package/dist/contract.js.map +1 -1
- package/dist/hook/post-edit.d.ts +5 -0
- package/dist/hook/post-edit.js +48 -15
- package/dist/hook/post-edit.js.map +1 -1
- package/dist/hook/session-start.d.ts +10 -1
- package/dist/hook/session-start.js +54 -4
- package/dist/hook/session-start.js.map +1 -1
- package/dist/init/agents-section.d.ts +17 -0
- package/dist/init/agents-section.js +88 -0
- package/dist/init/agents-section.js.map +1 -0
- package/dist/init/codex.js +13 -2
- package/dist/init/codex.js.map +1 -1
- package/dist/init/hosted.js +3 -1
- package/dist/init/hosted.js.map +1 -1
- package/dist/init/remove.d.ts +2 -0
- package/dist/init/remove.js +18 -0
- package/dist/init/remove.js.map +1 -1
- package/dist/init/run.js +12 -3
- package/dist/init/run.js.map +1 -1
- package/dist/init/settings.d.ts +2 -1
- package/dist/init/settings.js +32 -6
- package/dist/init/settings.js.map +1 -1
- package/package.json +6 -6
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/sidecar/dist/src/absent-body.d.ts +41 -0
- package/sidecar/dist/src/absent-body.js +224 -0
- package/sidecar/dist/src/capture/api.d.ts +20 -0
- package/sidecar/dist/src/capture/check-probe.d.ts +5 -1
- package/sidecar/dist/src/capture/check-probe.js +38 -4
- package/sidecar/dist/src/capture/check-scrub.js +2 -0
- package/sidecar/dist/src/capture/check.js +8 -1
- package/sidecar/dist/src/capture/self-check.js +16 -6
- package/sidecar/dist/src/stated-params.d.ts +1 -1
- package/sidecar/dist/src/type-inferrer.d.ts +12 -0
- package/sidecar/dist/src/type-inferrer.js +47 -2
- package/sidecar/dist/src/types.d.ts +8 -0
- package/sidecar/dist/src/validators.d.ts +598 -578
- package/sidecar/dist/src/validators.js +2 -0
package/dist/cli.d.ts
CHANGED
|
@@ -33,8 +33,20 @@ export declare function check(file: string, options: RunOptions & {
|
|
|
33
33
|
* The limit for a `--recheck` call: the caller's own if it set one, and
|
|
34
34
|
* otherwise long enough to outlast the binary's budget and still return inside
|
|
35
35
|
* the hook's fifteen seconds.
|
|
36
|
+
*
|
|
37
|
+
* A call about several files (`files` > 1, only ever a Codex patch) gets ten
|
|
38
|
+
* more seconds per further file, inside the 60 s Codex gives the hook. The
|
|
39
|
+
* binary stops re-checking a repo after its first miss, so a patch on a repo
|
|
40
|
+
* where the re-check does not fit waits out one budget, not one per file.
|
|
41
|
+
*/
|
|
42
|
+
export declare function recheckTimeoutMs(env?: NodeJS.ProcessEnv, files?: number): string;
|
|
43
|
+
/**
|
|
44
|
+
* `carrick check --each <files...> --json --recheck`: every file of one patch
|
|
45
|
+
* in one binary call (each answered as `check <file> --recheck` would), so a
|
|
46
|
+
* patch that touches six files starts one process rather than six. The
|
|
47
|
+
* answers come back in the order asked; `null` for a file the binary refused.
|
|
36
48
|
*/
|
|
37
|
-
export declare function
|
|
49
|
+
export declare function checkEach(files: string[], options: RunOptions): Promise<RunOutcome<Array<CheckResult | null>>>;
|
|
38
50
|
/**
|
|
39
51
|
* `carrick status --json`: the workspace, with no file in the question.
|
|
40
52
|
*
|
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// a missing binary, a crash, a timeout and unparseable stdout all read as "no
|
|
5
5
|
// answer", because neither an edit nor a session start may fail on Carrick.
|
|
6
6
|
import { execFile } from "node:child_process";
|
|
7
|
-
import { parseCheckResult, parseStatusResult, } from "./contract.js";
|
|
7
|
+
import { parseCheckResult, parseCheckResults, parseStatusResult, } from "./contract.js";
|
|
8
8
|
/** Binary to run. `carrick` on PATH unless CARRICK_BIN names another. */
|
|
9
9
|
export function binary(env = process.env) {
|
|
10
10
|
return env["CARRICK_BIN"] || "carrick";
|
|
@@ -62,9 +62,30 @@ export async function check(file, options) {
|
|
|
62
62
|
* The limit for a `--recheck` call: the caller's own if it set one, and
|
|
63
63
|
* otherwise long enough to outlast the binary's budget and still return inside
|
|
64
64
|
* the hook's fifteen seconds.
|
|
65
|
+
*
|
|
66
|
+
* A call about several files (`files` > 1, only ever a Codex patch) gets ten
|
|
67
|
+
* more seconds per further file, inside the 60 s Codex gives the hook. The
|
|
68
|
+
* binary stops re-checking a repo after its first miss, so a patch on a repo
|
|
69
|
+
* where the re-check does not fit waits out one budget, not one per file.
|
|
70
|
+
*/
|
|
71
|
+
export function recheckTimeoutMs(env = process.env, files = 1) {
|
|
72
|
+
const own = env["CARRICK_TIMEOUT_MS"];
|
|
73
|
+
if (own)
|
|
74
|
+
return own;
|
|
75
|
+
return String(Math.min(12000 + 10000 * Math.max(files - 1, 0), 55000));
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* `carrick check --each <files...> --json --recheck`: every file of one patch
|
|
79
|
+
* in one binary call (each answered as `check <file> --recheck` would), so a
|
|
80
|
+
* patch that touches six files starts one process rather than six. The
|
|
81
|
+
* answers come back in the order asked; `null` for a file the binary refused.
|
|
65
82
|
*/
|
|
66
|
-
export function
|
|
67
|
-
|
|
83
|
+
export async function checkEach(files, options) {
|
|
84
|
+
const env = {
|
|
85
|
+
...(options.env ?? process.env),
|
|
86
|
+
CARRICK_TIMEOUT_MS: recheckTimeoutMs(options.env, files.length),
|
|
87
|
+
};
|
|
88
|
+
return await run(["check", "--each", ...files, "--json", "--recheck"], { ...options, env }, parseCheckResults);
|
|
68
89
|
}
|
|
69
90
|
/**
|
|
70
91
|
* `carrick status --json`: the workspace, with no file in the question.
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,EAAE;AACF,+EAA+E;AAC/E,8EAA8E;AAC9E,4EAA4E;AAE5E,OAAO,EAAE,QAAQ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,CAAC;QACxD,CAAC,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACzB,OAAO,MAAM,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC;AACrD,CAAC"}
|
package/dist/contract.d.ts
CHANGED
|
@@ -166,6 +166,12 @@ export type Recheck = {
|
|
|
166
166
|
* commit is the one the last scan of that repo ran on.
|
|
167
167
|
*/
|
|
168
168
|
new_functions?: NewFunction[];
|
|
169
|
+
/**
|
|
170
|
+
* True on a `none` that did not try: a re-check of this repo already missed
|
|
171
|
+
* its budget against this index, so the re-scan was skipped and the verdicts
|
|
172
|
+
* are the indexed ones until the next `carrick refresh`. Absent otherwise.
|
|
173
|
+
*/
|
|
174
|
+
known_miss?: boolean;
|
|
169
175
|
};
|
|
170
176
|
/** One function the working tree declares and the index does not. */
|
|
171
177
|
export type NewFunction = {
|
|
@@ -357,6 +363,12 @@ export type StatusResult = {
|
|
|
357
363
|
* "no locations", which is what an unindexed file returns, and is not an error.
|
|
358
364
|
*/
|
|
359
365
|
export declare function parseCheckResult(stdout: string): CheckResult | null;
|
|
366
|
+
/**
|
|
367
|
+
* Parse `carrick check --each --json` output: one array, one element per file
|
|
368
|
+
* in the order asked, each read as {@link parseCheckResult} reads one answer.
|
|
369
|
+
* `null` when stdout is not an array at all.
|
|
370
|
+
*/
|
|
371
|
+
export declare function parseCheckResults(stdout: string): Array<CheckResult | null> | null;
|
|
360
372
|
/**
|
|
361
373
|
* Parse `carrick status --json` output, or `null` when it is not that shape.
|
|
362
374
|
*
|
package/dist/contract.js
CHANGED
|
@@ -26,6 +26,24 @@ export function parseCheckResult(stdout) {
|
|
|
26
26
|
catch {
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
29
|
+
return checkResultOf(parsed);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Parse `carrick check --each --json` output: one array, one element per file
|
|
33
|
+
* in the order asked, each read as {@link parseCheckResult} reads one answer.
|
|
34
|
+
* `null` when stdout is not an array at all.
|
|
35
|
+
*/
|
|
36
|
+
export function parseCheckResults(stdout) {
|
|
37
|
+
let parsed;
|
|
38
|
+
try {
|
|
39
|
+
parsed = JSON.parse(stdout);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
return Array.isArray(parsed) ? parsed.map(checkResultOf) : null;
|
|
45
|
+
}
|
|
46
|
+
function checkResultOf(parsed) {
|
|
29
47
|
if (!isRecord(parsed))
|
|
30
48
|
return null;
|
|
31
49
|
if (typeof parsed["schema"] !== "string")
|
package/dist/contract.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,EAAE;AACF,yDAAyD;AACzD,+EAA+E;AAC/E,4DAA4D;AAC5D,6EAA6E;AAC7E,6EAA6E;AAC7E,+EAA+E;AAC/E,0CAA0C;
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,EAAE;AACF,yDAAyD;AACzD,+EAA+E;AAC/E,4DAA4D;AAC5D,6EAA6E;AAC7E,6EAA6E;AAC7E,+EAA+E;AAC/E,0CAA0C;AAmM1C,MAAM,CAAC,MAAM,MAAM,GAAG,iBAAiB,CAAC;AACxC,MAAM,CAAC,MAAM,aAAa,GAAG,kBAAkB,CAAC;AA4LhD,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MA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,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACrF,CAAC"}
|
package/dist/hook/post-edit.d.ts
CHANGED
|
@@ -39,4 +39,9 @@ export declare function newFunctions(result: CheckResult, file: string): NewFunc
|
|
|
39
39
|
* the same terms as one run as a tool.
|
|
40
40
|
*/
|
|
41
41
|
export declare function filesFromPayload(payload: Payload): string[];
|
|
42
|
+
/**
|
|
43
|
+
* Said once per session on a repo where a re-check already missed its budget
|
|
44
|
+
* against this index: the per-edit verdicts there are the index's.
|
|
45
|
+
*/
|
|
46
|
+
export declare const KNOWN_MISS_LINE: string;
|
|
42
47
|
export {};
|
package/dist/hook/post-edit.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
// It exits 0 whatever happens. An edit never fails because Carrick had nothing
|
|
16
16
|
// to say, could not find its binary, or timed out.
|
|
17
17
|
import path from "node:path";
|
|
18
|
-
import { check } from "../cli.js";
|
|
18
|
+
import { check, checkEach } from "../cli.js";
|
|
19
19
|
import { resolveChannel } from "../channel.js";
|
|
20
20
|
import { createLogger } from "../log.js";
|
|
21
21
|
import { renderPostToolUse } from "../render.js";
|
|
@@ -64,6 +64,27 @@ export function filesFromPayload(payload) {
|
|
|
64
64
|
return [named];
|
|
65
65
|
return typeof input.command === "string" ? patchedFiles(input.command) : [];
|
|
66
66
|
}
|
|
67
|
+
/** The `told` key the known-miss line is remembered under, per repo. */
|
|
68
|
+
const KNOWN_MISS_PREFIX = "known-miss::";
|
|
69
|
+
/**
|
|
70
|
+
* Said once per session on a repo where a re-check already missed its budget
|
|
71
|
+
* against this index: the per-edit verdicts there are the index's.
|
|
72
|
+
*/
|
|
73
|
+
export const KNOWN_MISS_LINE = "On this repo a re-check does not fit the per-edit budget, so verdicts after an edit are " +
|
|
74
|
+
"the index's until the next `carrick refresh`. Run `carrick check --changed` for fresh ones.";
|
|
75
|
+
/**
|
|
76
|
+
* Every edited file's answer, in order, from one binary call: the
|
|
77
|
+
* single-file `check` for one file (what Claude Code's edits always are), and
|
|
78
|
+
* `check --each` for a patch that touches several.
|
|
79
|
+
*/
|
|
80
|
+
async function answersFor(relatives, cwd) {
|
|
81
|
+
if (relatives.length === 1) {
|
|
82
|
+
const outcome = await check(relatives[0], { cwd, recheck: true });
|
|
83
|
+
return { results: [outcome.result], failure: outcome.failure, ms: outcome.ms };
|
|
84
|
+
}
|
|
85
|
+
const outcome = await checkEach(relatives, { cwd });
|
|
86
|
+
return { results: outcome.result ?? [], failure: outcome.failure, ms: outcome.ms };
|
|
87
|
+
}
|
|
67
88
|
function emit(context) {
|
|
68
89
|
process.stdout.write(JSON.stringify({
|
|
69
90
|
hookSpecificOutput: {
|
|
@@ -119,28 +140,40 @@ async function main() {
|
|
|
119
140
|
// Files whose uses lines this message carries, remembered only once it is
|
|
120
141
|
// delivered: who uses a file is shown once per file per session (carrick#2067).
|
|
121
142
|
const told = [];
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
143
|
+
const relatives = edited.map((file) => path.relative(choice.root, file));
|
|
144
|
+
// The edit just landed, so the index describes the file as it was before
|
|
145
|
+
// it. This is the one surface that asks for the file to be re-judged from
|
|
146
|
+
// the working tree; it fires once per completed edit, where the language
|
|
147
|
+
// server fires on every save (carrick#1036). A patch of several files is
|
|
148
|
+
// one binary call, not one per file: each call re-reads the index and, on a
|
|
149
|
+
// repo whose re-check does not fit, would wait out a budget of its own.
|
|
150
|
+
const answers = await answersFor(relatives, choice.root);
|
|
151
|
+
for (const [index, relative] of relatives.entries()) {
|
|
152
|
+
const result = answers.results[index] ?? null;
|
|
153
|
+
if (!result) {
|
|
130
154
|
// One unreadable file in a patch of four is not a reason to say nothing
|
|
131
155
|
// about the other three.
|
|
132
|
-
log("no answer for", relative,
|
|
156
|
+
log("no answer for", relative, answers.failure ?? "");
|
|
133
157
|
continue;
|
|
134
158
|
}
|
|
135
|
-
found.push(...newFunctions(
|
|
136
|
-
const key = toldKey(
|
|
159
|
+
found.push(...newFunctions(result, relative));
|
|
160
|
+
const key = toldKey(result, relative);
|
|
137
161
|
const show = !payload.session_id || !wasTold(payload.session_id, key);
|
|
138
|
-
if (show &&
|
|
162
|
+
if (show && result.uses_lines?.length)
|
|
139
163
|
told.push(key);
|
|
140
|
-
const context = renderPostToolUse(
|
|
141
|
-
log(`check ${relative} -> ${context ? "context" : "nothing to say"} in ${
|
|
164
|
+
const context = renderPostToolUse(result, relative, { uses: show });
|
|
165
|
+
log(`check ${relative} -> ${context ? "context" : "nothing to say"} in ${answers.ms}ms`);
|
|
142
166
|
if (context)
|
|
143
167
|
contexts.push(context);
|
|
168
|
+
// A repo whose re-check is known not to fit answers from the index on
|
|
169
|
+
// every edit; the reader is told so once per session, not once per edit.
|
|
170
|
+
if (result.recheck?.known_miss) {
|
|
171
|
+
const missKey = `${KNOWN_MISS_PREFIX}${result.repo ?? ""}`;
|
|
172
|
+
if (!told.includes(missKey) && !(payload.session_id && wasTold(payload.session_id, missKey))) {
|
|
173
|
+
told.push(missKey);
|
|
174
|
+
contexts.push(KNOWN_MISS_LINE);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
144
177
|
}
|
|
145
178
|
// Silent and local: the names go to a file under the user's home directory
|
|
146
179
|
// and nothing about them is printed here.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post-edit.js","sourceRoot":"","sources":["../../src/hook/post-edit.ts"],"names":[],"mappings":";AACA,oDAAoD;AACpD,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,oEAAoE;AACpE,EAAE;AACF,sEAAsE;AACtE,8EAA8E;AAC9E,sEAAsE;AACtE,+EAA+E;AAC/E,4DAA4D;AAC5D,EAAE;AACF,+EAA+E;AAC/E,mDAAmD;AAEnD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;
|
|
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-1,2 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Whether Codex, not Claude Code, is running this hook.
|
|
4
|
+
*
|
|
5
|
+
* Claude Code sets `CLAUDE_PROJECT_DIR` for every hook and Codex does not (its
|
|
6
|
+
* hook environment is the plugin variables only). A by-hand run has no payload
|
|
7
|
+
* on stdin, so it reads as neither and keeps the plain print.
|
|
8
|
+
*/
|
|
9
|
+
export declare function runByCodex(env: NodeJS.ProcessEnv, stdin: string): boolean;
|
|
10
|
+
/** The shape Codex's `parse_session_start` takes the model context from. */
|
|
11
|
+
export declare function codexEmission(context: string): string;
|
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
// service could not classify, and nothing about whether a contract holds, so
|
|
12
12
|
// the line cannot be confused with the hook or LSP delivery of a verdict.
|
|
13
13
|
// `CARRICK_CHANNEL=off` silences it along with everything else.
|
|
14
|
+
//
|
|
15
|
+
// Codex runs the same entry (`codexHooks`, carrick#2848). Its parser reads a
|
|
16
|
+
// SessionStart hook's context from `hookSpecificOutput.additionalContext`
|
|
17
|
+
// (`codex-rs/hooks/src/engine/output_parser.rs`, `parse_session_start`), so
|
|
18
|
+
// there the lines go out as that JSON. Claude Code keeps the plain print.
|
|
14
19
|
import { status } from "../cli.js";
|
|
15
20
|
import { resolveChannel } from "../channel.js";
|
|
16
21
|
import { createLogger } from "../log.js";
|
|
@@ -37,11 +42,45 @@ function versionLine() {
|
|
|
37
42
|
const state = readUpdateState(process.env);
|
|
38
43
|
return updateNotice(currentVersion(), state?.latest ?? null, { env: process.env });
|
|
39
44
|
}
|
|
45
|
+
async function readStdin() {
|
|
46
|
+
if (process.stdin.isTTY)
|
|
47
|
+
return "";
|
|
48
|
+
const chunks = [];
|
|
49
|
+
for await (const chunk of process.stdin)
|
|
50
|
+
chunks.push(Buffer.from(chunk));
|
|
51
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Whether Codex, not Claude Code, is running this hook.
|
|
55
|
+
*
|
|
56
|
+
* Claude Code sets `CLAUDE_PROJECT_DIR` for every hook and Codex does not (its
|
|
57
|
+
* hook environment is the plugin variables only). A by-hand run has no payload
|
|
58
|
+
* on stdin, so it reads as neither and keeps the plain print.
|
|
59
|
+
*/
|
|
60
|
+
export function runByCodex(env, stdin) {
|
|
61
|
+
if (env["CLAUDE_PROJECT_DIR"])
|
|
62
|
+
return false;
|
|
63
|
+
try {
|
|
64
|
+
const payload = JSON.parse(stdin);
|
|
65
|
+
return payload.hook_event_name === "SessionStart";
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/** The shape Codex's `parse_session_start` takes the model context from. */
|
|
72
|
+
export function codexEmission(context) {
|
|
73
|
+
return JSON.stringify({
|
|
74
|
+
hookSpecificOutput: { hookEventName: "SessionStart", additionalContext: context },
|
|
75
|
+
});
|
|
76
|
+
}
|
|
40
77
|
async function main() {
|
|
41
78
|
if (resolveChannel({ hooksInstalled: true }).channel === "off") {
|
|
42
79
|
log("CARRICK_CHANNEL=off; printing nothing");
|
|
43
80
|
return;
|
|
44
81
|
}
|
|
82
|
+
const lines = [];
|
|
83
|
+
const codex = runByCodex(process.env, await readStdin());
|
|
45
84
|
const choice = resolveRoot({
|
|
46
85
|
clientRoot: process.cwd(),
|
|
47
86
|
projectDir: process.env["CLAUDE_PROJECT_DIR"] ?? null,
|
|
@@ -55,7 +94,7 @@ async function main() {
|
|
|
55
94
|
// run its first scan, which is the worst moment to be on a stale build.
|
|
56
95
|
const version = versionLine();
|
|
57
96
|
if (version)
|
|
58
|
-
|
|
97
|
+
lines.push(version);
|
|
59
98
|
// And the other mismatch: not "a newer one is published" but "the one
|
|
60
99
|
// answering this hook is not the one that wrote these files". Unthrottled,
|
|
61
100
|
// because this runs once per session and the agent about to work here is the
|
|
@@ -63,16 +102,17 @@ async function main() {
|
|
|
63
102
|
if (choice.markerFound) {
|
|
64
103
|
const mismatch = versionMismatch(choice.root, currentVersion());
|
|
65
104
|
if (mismatch)
|
|
66
|
-
|
|
105
|
+
lines.push(mismatch);
|
|
67
106
|
}
|
|
68
107
|
const outcome = await status({ cwd: choice.root, workspace: choice.markerFound ? choice.root : null });
|
|
69
108
|
if (!outcome.result) {
|
|
70
109
|
log("no answer", outcome.failure ?? "");
|
|
110
|
+
flush(lines, codex);
|
|
71
111
|
return;
|
|
72
112
|
}
|
|
73
113
|
// Ends with a newline: this is a line a developer also runs by hand and
|
|
74
114
|
// compares against `carrick status`, and that one ends its output properly.
|
|
75
|
-
|
|
115
|
+
lines.push(renderSessionStart(outcome.result));
|
|
76
116
|
// The hosted index the first CI scan writes is picked up here rather than by
|
|
77
117
|
// a command the developer has to remember (carrick#955). Detached and
|
|
78
118
|
// unwaited: a refresh is minutes of work and a hook is not.
|
|
@@ -84,7 +124,17 @@ async function main() {
|
|
|
84
124
|
log("background refresh not started", String(error));
|
|
85
125
|
}
|
|
86
126
|
if (started)
|
|
87
|
-
|
|
127
|
+
lines.push(started);
|
|
128
|
+
flush(lines, codex);
|
|
129
|
+
}
|
|
130
|
+
/** One write at the end, so the Codex form is a single JSON document. */
|
|
131
|
+
function flush(lines, codex) {
|
|
132
|
+
if (lines.length === 0)
|
|
133
|
+
return;
|
|
134
|
+
if (codex)
|
|
135
|
+
process.stdout.write(codexEmission(lines.join("\n")));
|
|
136
|
+
else
|
|
137
|
+
process.stdout.write(`${lines.join("\n")}\n`);
|
|
88
138
|
}
|
|
89
139
|
await main();
|
|
90
140
|
process.exit(0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-start.js","sourceRoot":"","sources":["../../src/hook/session-start.ts"],"names":[],"mappings":";AACA,8EAA8E;AAC9E,EAAE;AACF,gFAAgF;AAChF,8EAA8E;AAC9E,gFAAgF;AAChF,4EAA4E;AAC5E,mDAAmD;AACnD,EAAE;AACF,+EAA+E;AAC/E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AAkB,IAAI,CAAC;IAClC,IAAI,CAAC;QACH,OAAO,GAAG,mBAAmB,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,gCAAgC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACvD,CAAC;IACD,IAAI,OAAO;QAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACjC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACtB,CAAC;AAED,yEAAyE;AACzE,SAAS,KAAK,CAAC,KAAe,EAAE,KAAc;IAC5C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAC/B,IAAI,KAAK;QAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;QAC5D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,IAAI,EAAE,CAAC;AACb,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const AGENTS_FILE = "AGENTS.md";
|
|
2
|
+
/** The section as written, markers included. Ends in one newline. */
|
|
3
|
+
export declare const CHECK_SECTION: string;
|
|
4
|
+
/** The body with our section written in: replaced where it is, appended where it is not. */
|
|
5
|
+
export declare function withCheckSection(existing: string | null): string;
|
|
6
|
+
/** The body with our section taken out; `empty` where nothing else was in it. */
|
|
7
|
+
export declare function withoutCheckSection(existing: string): {
|
|
8
|
+
body: string;
|
|
9
|
+
changed: boolean;
|
|
10
|
+
empty: boolean;
|
|
11
|
+
};
|
|
12
|
+
/** Write our section into the folder's AGENTS.md. */
|
|
13
|
+
export declare function writeAgentsSection(workspace: string): "written" | "unchanged";
|
|
14
|
+
/** True where the folder's AGENTS.md holds our section. */
|
|
15
|
+
export declare function hasAgentsSection(workspace: string): boolean;
|
|
16
|
+
/** Take our section out. The file goes too only where nothing else was in it. */
|
|
17
|
+
export declare function removeAgentsSection(workspace: string): "section removed" | "file removed" | null;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// The "Carrick check" section `carrick init` keeps in a folder's AGENTS.md
|
|
2
|
+
// (carrick#2828), so an agent in Codex or Claude Code runs the local check
|
|
3
|
+
// before it says a change is done.
|
|
4
|
+
//
|
|
5
|
+
// The section sits between two marker comments. Those markers are the whole
|
|
6
|
+
// ownership rule: a re-run replaces what is between them and nothing else,
|
|
7
|
+
// `carrick remove` deletes that span and nothing else, and every other line of
|
|
8
|
+
// the file is somebody's and is never read for meaning. The file is created
|
|
9
|
+
// when it is missing, and deleted again on remove only when our section was
|
|
10
|
+
// all it held.
|
|
11
|
+
//
|
|
12
|
+
// carrick-cloud's scaffold (cloud#2289) must write this same block.
|
|
13
|
+
import fs from "node:fs";
|
|
14
|
+
import path from "node:path";
|
|
15
|
+
import { writeIfChanged } from "./files.js";
|
|
16
|
+
export const AGENTS_FILE = "AGENTS.md";
|
|
17
|
+
const START = "<!-- carrick:check start -->";
|
|
18
|
+
const END = "<!-- carrick:check end -->";
|
|
19
|
+
/** The section as written, markers included. Ends in one newline. */
|
|
20
|
+
export const CHECK_SECTION = [
|
|
21
|
+
START,
|
|
22
|
+
"## Carrick check",
|
|
23
|
+
"",
|
|
24
|
+
"Before you say a change is done, run `carrick check --changed` alongside the tests. It checks the files changed on this branch against the other services. If it exits non-zero, fix what it reports, or say why it is wrong. When you added functions, use the carrick-reuse skill on them.",
|
|
25
|
+
END,
|
|
26
|
+
"",
|
|
27
|
+
].join("\n");
|
|
28
|
+
/** The span of our section in a body, end included; null where there is none. */
|
|
29
|
+
function span(body) {
|
|
30
|
+
const from = body.indexOf(START);
|
|
31
|
+
if (from === -1)
|
|
32
|
+
return null;
|
|
33
|
+
const end = body.indexOf(END, from);
|
|
34
|
+
if (end === -1)
|
|
35
|
+
return null;
|
|
36
|
+
const after = end + END.length;
|
|
37
|
+
return { from, to: body[after] === "\n" ? after + 1 : after };
|
|
38
|
+
}
|
|
39
|
+
/** The body with our section written in: replaced where it is, appended where it is not. */
|
|
40
|
+
export function withCheckSection(existing) {
|
|
41
|
+
if (existing === null || existing.trim() === "")
|
|
42
|
+
return CHECK_SECTION;
|
|
43
|
+
const found = span(existing);
|
|
44
|
+
if (found !== null)
|
|
45
|
+
return existing.slice(0, found.from) + CHECK_SECTION + existing.slice(found.to);
|
|
46
|
+
const lf = existing.endsWith("\n") ? existing : `${existing}\n`;
|
|
47
|
+
return `${lf}\n${CHECK_SECTION}`;
|
|
48
|
+
}
|
|
49
|
+
/** The body with our section taken out; `empty` where nothing else was in it. */
|
|
50
|
+
export function withoutCheckSection(existing) {
|
|
51
|
+
const found = span(existing);
|
|
52
|
+
if (found === null)
|
|
53
|
+
return { body: existing, changed: false, empty: false };
|
|
54
|
+
// The blank line `withCheckSection` put before the section goes with it.
|
|
55
|
+
let from = found.from;
|
|
56
|
+
const before = existing.slice(0, from);
|
|
57
|
+
if (/\n\n$/.test(before))
|
|
58
|
+
from -= 1;
|
|
59
|
+
const body = existing.slice(0, from) + existing.slice(found.to);
|
|
60
|
+
return { body, changed: true, empty: body.trim() === "" };
|
|
61
|
+
}
|
|
62
|
+
/** Write our section into the folder's AGENTS.md. */
|
|
63
|
+
export function writeAgentsSection(workspace) {
|
|
64
|
+
const target = path.join(workspace, AGENTS_FILE);
|
|
65
|
+
const existing = fs.existsSync(target) ? fs.readFileSync(target, "utf8") : null;
|
|
66
|
+
return writeIfChanged(target, withCheckSection(existing));
|
|
67
|
+
}
|
|
68
|
+
/** True where the folder's AGENTS.md holds our section. */
|
|
69
|
+
export function hasAgentsSection(workspace) {
|
|
70
|
+
const target = path.join(workspace, AGENTS_FILE);
|
|
71
|
+
return fs.existsSync(target) && span(fs.readFileSync(target, "utf8")) !== null;
|
|
72
|
+
}
|
|
73
|
+
/** Take our section out. The file goes too only where nothing else was in it. */
|
|
74
|
+
export function removeAgentsSection(workspace) {
|
|
75
|
+
const target = path.join(workspace, AGENTS_FILE);
|
|
76
|
+
if (!fs.existsSync(target))
|
|
77
|
+
return null;
|
|
78
|
+
const cleaned = withoutCheckSection(fs.readFileSync(target, "utf8"));
|
|
79
|
+
if (!cleaned.changed)
|
|
80
|
+
return null;
|
|
81
|
+
if (cleaned.empty) {
|
|
82
|
+
fs.rmSync(target);
|
|
83
|
+
return "file removed";
|
|
84
|
+
}
|
|
85
|
+
fs.writeFileSync(target, cleaned.body);
|
|
86
|
+
return "section removed";
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=agents-section.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents-section.js","sourceRoot":"","sources":["../../src/init/agents-section.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,2EAA2E;AAC3E,mCAAmC;AACnC,EAAE;AACF,4EAA4E;AAC5E,2EAA2E;AAC3E,+EAA+E;AAC/E,4EAA4E;AAC5E,4EAA4E;AAC5E,eAAe;AACf,EAAE;AACF,oEAAoE;AAEpE,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAC;AAEvC,MAAM,KAAK,GAAG,8BAA8B,CAAC;AAC7C,MAAM,GAAG,GAAG,4BAA4B,CAAC;AAEzC,qEAAqE;AACrE,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,KAAK;IACL,kBAAkB;IAClB,EAAE;IACF,8RAA8R;IAC9R,GAAG;IACH,EAAE;CACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,iFAAiF;AACjF,SAAS,IAAI,CAAC,IAA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;AACjF,MAAM,UAAU,mBAAmB,CAAC,SAAiB;IACnD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IACjD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAC;IACxC,MAAM,OAAO,GAAG,mBAAmB,CAAC,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACrE,IAAI,CAAC,OAAO,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAClC,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAClB,OAAO,cAAc,CAAC;IACxB,CAAC;IACD,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,iBAAiB,CAAC;AAC3B,CAAC"}
|
package/dist/init/codex.js
CHANGED
|
@@ -15,8 +15,11 @@
|
|
|
15
15
|
// the same reason: entries whose command is this CLI are the only ones touched,
|
|
16
16
|
// and a hooks file a user already has keeps everything else in it.
|
|
17
17
|
//
|
|
18
|
-
//
|
|
18
|
+
// Three entries, which is the whole nudge on this host:
|
|
19
19
|
//
|
|
20
|
+
// * `SessionStart`, which puts the index map in front of the agent before its
|
|
21
|
+
// first move (carrick#2848). `hook session-start` prints it as
|
|
22
|
+
// `hookSpecificOutput.additionalContext` when Codex runs it.
|
|
20
23
|
// * `PostToolUse` on `apply_patch`, which records what an edit added. The
|
|
21
24
|
// matcher is a regex (`codex-rs/hooks/src/engine/dispatcher.rs`) and
|
|
22
25
|
// `apply_patch` is the canonical tool name Codex puts on the payload.
|
|
@@ -28,7 +31,8 @@
|
|
|
28
31
|
// One thing this file cannot do for the user: a project hook is untrusted until
|
|
29
32
|
// Codex records its hash, and an untrusted hook is discovered and not run
|
|
30
33
|
// (`hook_trust_status` in `discovery.rs`). Codex asks about it at its next
|
|
31
|
-
// start
|
|
34
|
+
// start in the TUI only; `codex exec` and the editor extensions skip it without
|
|
35
|
+
// a message. `carrick init` says so; nothing here can answer it.
|
|
32
36
|
//
|
|
33
37
|
// Reference: `docs/reference/task-skills.md`, "The reuse nudge".
|
|
34
38
|
import fs from "node:fs";
|
|
@@ -42,6 +46,13 @@ export const CODEX_HOOKS_FILE = path.join(CODEX_DIR, "hooks.json");
|
|
|
42
46
|
/** What this package registers with Codex, and the only entries it removes. */
|
|
43
47
|
export function codexHooks(command = "carrick") {
|
|
44
48
|
return {
|
|
49
|
+
// No matcher, timeout 30 as the Claude entry has it. Without this entry the
|
|
50
|
+
// agent is never told the index exists and starts without calling Carrick.
|
|
51
|
+
SessionStart: [
|
|
52
|
+
{
|
|
53
|
+
hooks: [{ type: "command", command: `${command} hook session-start`, timeout: 30 }],
|
|
54
|
+
},
|
|
55
|
+
],
|
|
45
56
|
// One call can carry a patch touching several files, and each one is a
|
|
46
57
|
// separate `carrick check`, so this timeout is not the single-file 15 the
|
|
47
58
|
// Claude entry uses. Codex applies the value as written for this event
|
package/dist/init/codex.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/init/codex.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,kBAAkB;AAClB,EAAE;AACF,uEAAuE;AACvE,iEAAiE;AACjE,+EAA+E;AAC/E,4EAA4E;AAC5E,sCAAsC;AACtC,EAAE;AACF,8EAA8E;AAC9E,+EAA+E;AAC/E,wEAAwE;AACxE,0EAA0E;AAC1E,8EAA8E;AAC9E,gFAAgF;AAChF,mEAAmE;AACnE,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/init/codex.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,kBAAkB;AAClB,EAAE;AACF,uEAAuE;AACvE,iEAAiE;AACjE,+EAA+E;AAC/E,4EAA4E;AAC5E,sCAA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Aa,CAAC,SAAS,CAAC,CAAC;IAC1C,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACnC,MAAM,OAAO,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC7C,IAAI,CAAC,OAAO,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAClC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IACtD,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACvC,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAClB,IAAI,CAAC;QACH,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,sEAAsE;IACxE,CAAC;IACD,OAAO,cAAc,CAAC;AACxB,CAAC"}
|
package/dist/init/hosted.js
CHANGED
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
// hosted read this machine has not yet made signed in and connected. On a
|
|
20
20
|
// workspace `carrick index` has just indexed, nothing is re-read.
|
|
21
21
|
// carrick#985 is the other half of that saving, inside `refresh`: a repo whose
|
|
22
|
-
//
|
|
22
|
+
// tree has not moved under any file a scan reads since the hosted commit is
|
|
23
|
+
// read in from the hosted index rather than re-read (`current_hosted_blobs`
|
|
24
|
+
// in `src/local_mode/index.rs`), so a fresh clone of main costs the download.
|
|
23
25
|
//
|
|
24
26
|
// What it reports is read back from `carrick status`, not assumed from an
|
|
25
27
|
// exit code: a refresh that scanned fine can still have been refused the
|