carrick 0.3.132 → 0.3.134
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 +18 -0
- package/dist/contract.js +18 -0
- package/dist/contract.js.map +1 -1
- package/dist/hook/post-edit.d.ts +10 -0
- package/dist/hook/post-edit.js +109 -19
- package/dist/hook/post-edit.js.map +1 -1
- package/dist/hook/refresh.d.ts +23 -3
- package/dist/hook/refresh.js +48 -6
- package/dist/hook/refresh.js.map +1 -1
- package/dist/hook/reuse.d.ts +7 -21
- package/dist/hook/reuse.js +23 -36
- package/dist/hook/reuse.js.map +1 -1
- package/dist/hook/session-start.d.ts +10 -1
- package/dist/hook/session-start.js +69 -6
- package/dist/hook/session-start.js.map +1 -1
- package/dist/hook/stop.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/doctor.js +4 -0
- package/dist/init/doctor.js.map +1 -1
- package/dist/init/hosted.d.ts +1 -0
- package/dist/init/hosted.js +4 -1
- package/dist/init/hosted.js.map +1 -1
- package/dist/init/remove.d.ts +2 -0
- package/dist/init/remove.js +25 -1
- package/dist/init/remove.js.map +1 -1
- package/dist/init/repo-copies.js +3 -1
- package/dist/init/repo-copies.js.map +1 -1
- package/dist/init/run.d.ts +1 -1
- package/dist/init/run.js +22 -5
- 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/dist/init/task-skills.d.ts +22 -1
- package/dist/init/task-skills.js +65 -1
- package/dist/init/task-skills.js.map +1 -1
- package/dist/render.d.ts +41 -16
- package/dist/render.js +91 -102
- package/dist/render.js.map +1 -1
- package/package.json +10 -9
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/sidecar/dist/src/capture/anchors.js +18 -1
- package/sidecar/dist/src/capture/api.d.ts +17 -4
- package/sidecar/dist/src/capture/check-workspace.js +1 -1
- package/sidecar/dist/src/capture/check.d.ts +44 -0
- package/sidecar/dist/src/capture/check.js +112 -10
- package/sidecar/dist/src/capture/installed-package.d.ts +5 -0
- package/sidecar/dist/src/capture/installed-package.js +64 -6
- package/sidecar/dist/src/capture/paths-rewrite.js +3 -3
- package/sidecar/dist/src/capture/result-label.d.ts +42 -0
- package/sidecar/dist/src/capture/result-label.js +91 -0
- package/sidecar/dist/src/capture/self-check.js +13 -2
- package/sidecar/dist/src/index.js +116 -4
- package/sidecar/dist/src/infer-cache.d.ts +125 -0
- package/sidecar/dist/src/infer-cache.js +244 -0
- package/sidecar/dist/src/library-claims.js +42 -4
- package/sidecar/dist/src/node-index.d.ts +53 -0
- package/sidecar/dist/src/node-index.js +100 -0
- package/sidecar/dist/src/project-loader.d.ts +11 -0
- package/sidecar/dist/src/project-loader.js +15 -0
- package/sidecar/dist/src/result-candidates.d.ts +28 -0
- package/sidecar/dist/src/result-candidates.js +209 -0
- package/sidecar/dist/src/type-inferrer.d.ts +27 -0
- package/sidecar/dist/src/type-inferrer.js +175 -43
- package/sidecar/dist/src/types.d.ts +52 -0
- package/sidecar/dist/src/unwidened.js +10 -1
- package/sidecar/dist/src/validators.d.ts +919 -197
- package/sidecar/dist/src/validators.js +32 -0
- package/templates/skills/carrick-reuse.md +11 -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,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EACL,gBAAgB,EAChB,iBAAiB,GAGlB,MAAM,eAAe,CAAC;AAEvB,yEAAyE;AACzE,MAAM,UAAU,MAAM,CAAC,MAAyB,OAAO,CAAC,GAAG;IACzD,OAAO,GAAG,CAAC,aAAa,CAAC,IAAI,SAAS,CAAC;AACzC,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,SAAS,CAAC,MAAyB,OAAO,CAAC,GAAG;IAC5D,MAAM,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AG,CAAC;IAC9E,MAAM,GAAG,GAAG,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACtC,IAAI,GAAG;QAAE,OAAO,GAAG,CAAC;IACpB,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AACzE,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,KAAe,EACf,OAAmB;IAEnB,MAAM,GAAG,GAAG;QACV,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;QAC/B,kBAAkB,EAAE,gBAAgB,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC;KAChE,CAAC;IACF,OAAO,MAAM,GAAG,CACd,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,WAAW,CAAC,EACpD,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,EACnB,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,OAAmD;IAEnD,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS;QAC5B,CAAC,CAAC,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,CAAC,SAAS,EAAE,QAAQ,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 = {
|
|
@@ -234,6 +240,12 @@ export type StatusRepo = {
|
|
|
234
240
|
/** Up to 50 of the ones outside every service, repo-relative. */
|
|
235
241
|
stale_files?: string[];
|
|
236
242
|
stale_files_truncated?: boolean;
|
|
243
|
+
/**
|
|
244
|
+
* The repo's services were read in from the hosted index, not scanned on this
|
|
245
|
+
* machine, so their types are the hosted scan's (carrick#2839). Absent when
|
|
246
|
+
* false.
|
|
247
|
+
*/
|
|
248
|
+
read_from_hosted?: boolean;
|
|
237
249
|
};
|
|
238
250
|
/**
|
|
239
251
|
* A scan running on this machine right now, as `carrick status` reports it.
|
|
@@ -357,6 +369,12 @@ export type StatusResult = {
|
|
|
357
369
|
* "no locations", which is what an unindexed file returns, and is not an error.
|
|
358
370
|
*/
|
|
359
371
|
export declare function parseCheckResult(stdout: string): CheckResult | null;
|
|
372
|
+
/**
|
|
373
|
+
* Parse `carrick check --each --json` output: one array, one element per file
|
|
374
|
+
* in the order asked, each read as {@link parseCheckResult} reads one answer.
|
|
375
|
+
* `null` when stdout is not an array at all.
|
|
376
|
+
*/
|
|
377
|
+
export declare function parseCheckResults(stdout: string): Array<CheckResult | null> | null;
|
|
360
378
|
/**
|
|
361
379
|
* Parse `carrick status --json` output, or `null` when it is not that shape.
|
|
362
380
|
*
|
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;AAkMhD,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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AC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACrF,CAAC"}
|
package/dist/hook/post-edit.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import type { CheckResult } from "../contract.ts";
|
|
3
3
|
import type { NewFunction } from "./reuse.ts";
|
|
4
|
+
/** Whether `carrick check --changed` would judge this edited file: source, and not a test or story. */
|
|
5
|
+
export declare function isCheckedSource(file: string): boolean;
|
|
4
6
|
type Payload = {
|
|
5
7
|
cwd?: string;
|
|
6
8
|
session_id?: string;
|
|
@@ -24,6 +26,14 @@ type Payload = {
|
|
|
24
26
|
* this does is put the names somewhere the Stop hook can find them.
|
|
25
27
|
*/
|
|
26
28
|
export declare function newFunctions(result: CheckResult, file: string): NewFunction[];
|
|
29
|
+
/**
|
|
30
|
+
* `file` relative to the nearest checkout top at or below `root`: the nearest
|
|
31
|
+
* directory holding `.git` (a folder, or the file a linked worktree has). An
|
|
32
|
+
* edit inside a nested worktree is then keyed as the index keys it, not with
|
|
33
|
+
* the worktree's own prefix (carrick#2936). With no nested checkout it is
|
|
34
|
+
* relative to `root`, as before.
|
|
35
|
+
*/
|
|
36
|
+
export declare function checkoutRelative(root: string, file: string): string;
|
|
27
37
|
/**
|
|
28
38
|
* Every file one tool call left on disk, whichever host made it.
|
|
29
39
|
*
|
package/dist/hook/post-edit.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
// PostToolUse hook for a file edit, on either host.
|
|
3
3
|
//
|
|
4
4
|
// Reads the tool payload on stdin, runs `carrick check <file> --json` from the
|
|
5
|
-
// workspace root and prints the
|
|
5
|
+
// workspace root and prints what the edit needs acted on (`renderPostToolUse`:
|
|
6
|
+
// its problems, or a pointer to `carrick check --changed` when the file could
|
|
7
|
+
// not be re-checked) as `additionalContext`, which the host
|
|
6
8
|
// attaches to the tool result. Attaching to the result rather than to the next
|
|
7
9
|
// turn is why this channel has no "the run ended on the edit" hole.
|
|
8
10
|
//
|
|
@@ -14,17 +16,53 @@
|
|
|
14
16
|
//
|
|
15
17
|
// It exits 0 whatever happens. An edit never fails because Carrick had nothing
|
|
16
18
|
// to say, could not find its binary, or timed out.
|
|
19
|
+
import fs from "node:fs";
|
|
17
20
|
import path from "node:path";
|
|
18
|
-
import { check } from "../cli.js";
|
|
21
|
+
import { check, checkEach } from "../cli.js";
|
|
19
22
|
import { resolveChannel } from "../channel.js";
|
|
20
23
|
import { createLogger } from "../log.js";
|
|
21
|
-
import { renderPostToolUse } from "../render.js";
|
|
24
|
+
import { answersTheEdit, notedLine, renderPostToolUse } from "../render.js";
|
|
22
25
|
import { resolveRoot, rootNote } from "../root.js";
|
|
23
26
|
import { patchedFiles } from "./apply-patch.js";
|
|
24
27
|
import { throttledVersionMismatch } from "../init/outdated.js";
|
|
25
28
|
import { currentVersion } from "../update.js";
|
|
26
|
-
import { markTold, record, toldKey, wasTold } from "./reuse.js";
|
|
29
|
+
import { markTold, NOTED_KEY, record, toldKey, wasTold } from "./reuse.js";
|
|
27
30
|
const log = createLogger("carrick-hook");
|
|
31
|
+
/**
|
|
32
|
+
* The files `carrick check --changed` judges: the scanner's own source
|
|
33
|
+
* extensions (`SOURCE_EXTENSIONS` in `src/file_finder.rs`, carrick#904). An API
|
|
34
|
+
* spec file is not counted: the hook cannot tell a spec the scan reads from any
|
|
35
|
+
* other `.json` or `.yaml` without reading the repo, and a config file that
|
|
36
|
+
* moves no contract is what the line used to be wrong about.
|
|
37
|
+
*/
|
|
38
|
+
const CHECKED_EXTENSIONS = new Set([".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs"]);
|
|
39
|
+
/** `TEST_FILE_INFIXES` in `src/file_finder.rs`: a test or story file name ends its stem in one. */
|
|
40
|
+
const TEST_FILE_INFIXES = [".test", ".spec", ".stories"];
|
|
41
|
+
/** `TEST_DIR_NAMES` in `src/file_finder.rs` (plus `.storybook`): trees the scan does not read. */
|
|
42
|
+
const TEST_DIR_NAMES = new Set([
|
|
43
|
+
"__tests__",
|
|
44
|
+
"__mocks__",
|
|
45
|
+
"__fixtures__",
|
|
46
|
+
"tests",
|
|
47
|
+
"test",
|
|
48
|
+
"fixtures",
|
|
49
|
+
"e2e",
|
|
50
|
+
".storybook",
|
|
51
|
+
]);
|
|
52
|
+
/** Whether `carrick check --changed` would judge this edited file: source, and not a test or story. */
|
|
53
|
+
export function isCheckedSource(file) {
|
|
54
|
+
const extension = path.extname(file).toLowerCase();
|
|
55
|
+
if (!CHECKED_EXTENSIONS.has(extension))
|
|
56
|
+
return false;
|
|
57
|
+
const stem = path.basename(file, extension).toLowerCase();
|
|
58
|
+
if (TEST_FILE_INFIXES.some((infix) => stem.endsWith(infix)))
|
|
59
|
+
return false;
|
|
60
|
+
// Directory names above the file. The scanner reads them relative to the
|
|
61
|
+
// scan root; the hook does not know it, so a checkout under a directory
|
|
62
|
+
// named `test` hides its source here: the line is then missing, not wrong.
|
|
63
|
+
const directories = path.dirname(file).split(/[\\/]/);
|
|
64
|
+
return !directories.some((name) => TEST_DIR_NAMES.has(name.toLowerCase()));
|
|
65
|
+
}
|
|
28
66
|
/** The files the index has rows for. */
|
|
29
67
|
const CHECKED = /\.(ts|tsx|mts|cts)$/;
|
|
30
68
|
/**
|
|
@@ -37,12 +75,36 @@ const CHECKED = /\.(ts|tsx|mts|cts)$/;
|
|
|
37
75
|
* this does is put the names somewhere the Stop hook can find them.
|
|
38
76
|
*/
|
|
39
77
|
export function newFunctions(result, file) {
|
|
78
|
+
// Test, spec and story files never warrant a reuse check (carrick#2936).
|
|
79
|
+
if (!isCheckedSource(file))
|
|
80
|
+
return [];
|
|
40
81
|
return (result.recheck?.new_functions ?? []).map((entry) => ({
|
|
41
82
|
name: entry.name,
|
|
42
|
-
|
|
83
|
+
// The path this hook computed, not the one the binary echoes: it is the
|
|
84
|
+
// checkout-relative path the index holds, whatever root the edit ran from.
|
|
85
|
+
file,
|
|
43
86
|
indexCommit: result.index_commit ?? "",
|
|
44
87
|
}));
|
|
45
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* `file` relative to the nearest checkout top at or below `root`: the nearest
|
|
91
|
+
* directory holding `.git` (a folder, or the file a linked worktree has). An
|
|
92
|
+
* edit inside a nested worktree is then keyed as the index keys it, not with
|
|
93
|
+
* the worktree's own prefix (carrick#2936). With no nested checkout it is
|
|
94
|
+
* relative to `root`, as before.
|
|
95
|
+
*/
|
|
96
|
+
export function checkoutRelative(root, file) {
|
|
97
|
+
let dir = path.dirname(file);
|
|
98
|
+
while (dir !== root && path.relative(root, dir) && !path.relative(root, dir).startsWith("..")) {
|
|
99
|
+
if (fs.existsSync(path.join(dir, ".git")))
|
|
100
|
+
return path.relative(dir, file);
|
|
101
|
+
const parent = path.dirname(dir);
|
|
102
|
+
if (parent === dir)
|
|
103
|
+
break;
|
|
104
|
+
dir = parent;
|
|
105
|
+
}
|
|
106
|
+
return path.relative(root, file);
|
|
107
|
+
}
|
|
46
108
|
/**
|
|
47
109
|
* Every file one tool call left on disk, whichever host made it.
|
|
48
110
|
*
|
|
@@ -64,6 +126,19 @@ export function filesFromPayload(payload) {
|
|
|
64
126
|
return [named];
|
|
65
127
|
return typeof input.command === "string" ? patchedFiles(input.command) : [];
|
|
66
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Every edited file's answer, in order, from one binary call: the
|
|
131
|
+
* single-file `check` for one file (what Claude Code's edits always are), and
|
|
132
|
+
* `check --each` for a patch that touches several.
|
|
133
|
+
*/
|
|
134
|
+
async function answersFor(relatives, cwd) {
|
|
135
|
+
if (relatives.length === 1) {
|
|
136
|
+
const outcome = await check(relatives[0], { cwd, recheck: true });
|
|
137
|
+
return { results: [outcome.result], failure: outcome.failure, ms: outcome.ms };
|
|
138
|
+
}
|
|
139
|
+
const outcome = await checkEach(relatives, { cwd });
|
|
140
|
+
return { results: outcome.result ?? [], failure: outcome.failure, ms: outcome.ms };
|
|
141
|
+
}
|
|
67
142
|
function emit(context) {
|
|
68
143
|
process.stdout.write(JSON.stringify({
|
|
69
144
|
hookSpecificOutput: {
|
|
@@ -119,29 +194,44 @@ async function main() {
|
|
|
119
194
|
// Files whose uses lines this message carries, remembered only once it is
|
|
120
195
|
// delivered: who uses a file is shown once per file per session (carrick#2067).
|
|
121
196
|
const told = [];
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
197
|
+
const relatives = edited.map((file) => path.relative(choice.root, file));
|
|
198
|
+
// The edit just landed, so the index describes the file as it was before
|
|
199
|
+
// it. This is the one surface that asks for the file to be re-judged from
|
|
200
|
+
// the working tree; it fires once per completed edit, where the language
|
|
201
|
+
// server fires on every save (carrick#1036). A patch of several files is
|
|
202
|
+
// one binary call, not one per file: each call re-reads the index and, on a
|
|
203
|
+
// repo whose re-check does not fit, would wait out a budget of its own.
|
|
204
|
+
const answers = await answersFor(relatives, choice.root);
|
|
205
|
+
// Files of this call the re-check did not answer for: one line names them
|
|
206
|
+
// all, rather than the same sentence once per file of a patch.
|
|
207
|
+
const unchecked = [];
|
|
208
|
+
for (const [index, relative] of relatives.entries()) {
|
|
209
|
+
const result = answers.results[index] ?? null;
|
|
210
|
+
if (!result) {
|
|
130
211
|
// One unreadable file in a patch of four is not a reason to say nothing
|
|
131
212
|
// about the other three.
|
|
132
|
-
log("no answer for", relative,
|
|
213
|
+
log("no answer for", relative, answers.failure ?? "");
|
|
133
214
|
continue;
|
|
134
215
|
}
|
|
135
|
-
found.push(...newFunctions(
|
|
136
|
-
const key = toldKey(
|
|
216
|
+
found.push(...newFunctions(result, checkoutRelative(choice.root, edited[index])));
|
|
217
|
+
const key = toldKey(result, relative);
|
|
137
218
|
const show = !payload.session_id || !wasTold(payload.session_id, key);
|
|
138
|
-
if (show &&
|
|
219
|
+
if (show && result.uses_lines?.length)
|
|
139
220
|
told.push(key);
|
|
140
|
-
|
|
141
|
-
|
|
221
|
+
if (!result.error && !answersTheEdit(result))
|
|
222
|
+
unchecked.push(relative);
|
|
223
|
+
const context = renderPostToolUse(result, relative, { uses: show, noted: false });
|
|
224
|
+
log(`check ${relative} -> ${context ? "context" : "nothing to say"} in ${answers.ms}ms`);
|
|
142
225
|
if (context)
|
|
143
226
|
contexts.push(context);
|
|
144
227
|
}
|
|
228
|
+
// Said once per session: the sentence is the same on every edit, and the
|
|
229
|
+
// Stop hook asks again if the check never ran.
|
|
230
|
+
const notedAlready = payload.session_id ? wasTold(payload.session_id, NOTED_KEY) : false;
|
|
231
|
+
if (unchecked.length > 0 && !notedAlready) {
|
|
232
|
+
contexts.unshift(notedLine(unchecked));
|
|
233
|
+
told.push(NOTED_KEY);
|
|
234
|
+
}
|
|
145
235
|
// Silent and local: the names go to a file under the user's home directory
|
|
146
236
|
// and nothing about them is printed here.
|
|
147
237
|
if (found.length > 0 && payload.session_id) {
|
|
@@ -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,
|
|
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,+EAA+E;AAC/E,8EAA8E;AAC9E,4DAA4D;AAC5D,+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,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EA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AC;IACzE,IAAI,QAAQ;QAAE,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,UAAU;QAAE,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAC9E,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,IAAI,EAAE,CAAC;AACb,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC"}
|
package/dist/hook/refresh.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { StatusResult } from "../contract.ts";
|
|
2
2
|
/** Default gap between unattended refreshes of one workspace. */
|
|
3
3
|
export declare const REFRESH_COOLDOWN_MS: number;
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
/**
|
|
5
|
+
* A claim file, inside the ignored directory the index already owns. Each
|
|
6
|
+
* background job has its own, so one never holds the other back.
|
|
7
|
+
*/
|
|
8
|
+
export declare function markerPath(root: string, name?: string): string;
|
|
9
|
+
/** A job's cooldown: `variable` from the environment, or `fallback`. */
|
|
10
|
+
export declare function cooldownMs(env?: NodeJS.ProcessEnv, variable?: string, fallback?: number): number;
|
|
7
11
|
/** Whether this workspace is waiting for a hosted index that may now exist. */
|
|
8
12
|
export declare function awaitingHostedIndex(status: StatusResult): boolean;
|
|
9
13
|
/** The last time anything read the hosted side, from the marker or the index. */
|
|
@@ -30,3 +34,19 @@ export type RefreshOptions = {
|
|
|
30
34
|
* hosted index and has not asked recently. Returns the line to print, or null.
|
|
31
35
|
*/
|
|
32
36
|
export declare function refreshInBackground(root: string, status: StatusResult, options?: RefreshOptions): string | null;
|
|
37
|
+
/**
|
|
38
|
+
* Default gap between two background moves of one workspace: shorter than the
|
|
39
|
+
* refresh's hour, because main moves many times a day and a move that finds
|
|
40
|
+
* nothing new costs one metadata request.
|
|
41
|
+
*/
|
|
42
|
+
export declare const FORWARD_COOLDOWN_MS: number;
|
|
43
|
+
/** The move's claim file, apart from the refresh's. */
|
|
44
|
+
export declare const FORWARD_MARKER = "last-hook-forward";
|
|
45
|
+
/** Whether this workspace reads any service from a hosted index. */
|
|
46
|
+
export declare function readsHostedIndex(status: StatusResult): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Start a background `carrick refresh --hosted-only` when this workspace reads
|
|
49
|
+
* a hosted index and has not asked within the cooldown. Prints nothing:
|
|
50
|
+
* returns whether it started.
|
|
51
|
+
*/
|
|
52
|
+
export declare function forwardInBackground(root: string, status: StatusResult, options?: RefreshOptions): boolean;
|
package/dist/hook/refresh.js
CHANGED
|
@@ -30,14 +30,18 @@ import { spawn } from "node:child_process";
|
|
|
30
30
|
import { binary } from "../cli.js";
|
|
31
31
|
/** Default gap between unattended refreshes of one workspace. */
|
|
32
32
|
export const REFRESH_COOLDOWN_MS = 60 * 60_000;
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
/**
|
|
34
|
+
* A claim file, inside the ignored directory the index already owns. Each
|
|
35
|
+
* background job has its own, so one never holds the other back.
|
|
36
|
+
*/
|
|
37
|
+
export function markerPath(root, name = "last-hook-refresh") {
|
|
38
|
+
return path.join(root, ".carrick", name);
|
|
36
39
|
}
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
/** A job's cooldown: `variable` from the environment, or `fallback`. */
|
|
41
|
+
export function cooldownMs(env = process.env, variable = "CARRICK_REFRESH_COOLDOWN_MS", fallback = REFRESH_COOLDOWN_MS) {
|
|
42
|
+
const raw = env[variable];
|
|
39
43
|
const parsed = raw ? Number.parseInt(raw, 10) : Number.NaN;
|
|
40
|
-
return Number.isFinite(parsed) && parsed >= 0 ? parsed :
|
|
44
|
+
return Number.isFinite(parsed) && parsed >= 0 ? parsed : fallback;
|
|
41
45
|
}
|
|
42
46
|
/** Whether this workspace is waiting for a hosted index that may now exist. */
|
|
43
47
|
export function awaitingHostedIndex(status) {
|
|
@@ -142,4 +146,42 @@ export function refreshInBackground(root, status, options = {}) {
|
|
|
142
146
|
});
|
|
143
147
|
return "Carrick: a repo here is connected with no hosted index yet, so a refresh is running in the background. Its rows arrive in the next session.";
|
|
144
148
|
}
|
|
149
|
+
// Moving the hosted index forward.
|
|
150
|
+
//
|
|
151
|
+
// `carrick check --changed` re-reads every service a change since the hosted
|
|
152
|
+
// index's commit can reach, and a manifest or lockfile reaches all of them. On
|
|
153
|
+
// a busy main branch that commit falls behind within hours, so a branch's
|
|
154
|
+
// one-line edit re-read the whole repository.
|
|
155
|
+
// `carrick refresh --hosted-only` moves this machine's copy of the hosted index to the cloud's newer one when
|
|
156
|
+
// that commit is in HEAD's history: one metadata request, a download only when
|
|
157
|
+
// it moves, no scan. Detached like the refresh above, and silent: nothing is
|
|
158
|
+
// waiting on it, and the next check simply starts from the newer base.
|
|
159
|
+
/**
|
|
160
|
+
* Default gap between two background moves of one workspace: shorter than the
|
|
161
|
+
* refresh's hour, because main moves many times a day and a move that finds
|
|
162
|
+
* nothing new costs one metadata request.
|
|
163
|
+
*/
|
|
164
|
+
export const FORWARD_COOLDOWN_MS = 15 * 60_000;
|
|
165
|
+
/** The move's claim file, apart from the refresh's. */
|
|
166
|
+
export const FORWARD_MARKER = "last-hook-forward";
|
|
167
|
+
/** Whether this workspace reads any service from a hosted index. */
|
|
168
|
+
export function readsHostedIndex(status) {
|
|
169
|
+
return status.services.some((service) => service.hosted_state === "enriched");
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Start a background `carrick refresh --hosted-only` when this workspace reads
|
|
173
|
+
* a hosted index and has not asked within the cooldown. Prints nothing:
|
|
174
|
+
* returns whether it started.
|
|
175
|
+
*/
|
|
176
|
+
export function forwardInBackground(root, status, options = {}) {
|
|
177
|
+
const env = options.env ?? process.env;
|
|
178
|
+
const now = options.now ?? Date.now();
|
|
179
|
+
if (!readsHostedIndex(status))
|
|
180
|
+
return false;
|
|
181
|
+
const cooldown = cooldownMs(env, "CARRICK_FORWARD_COOLDOWN_MS", FORWARD_COOLDOWN_MS);
|
|
182
|
+
if (!claimRefresh(markerPath(root, FORWARD_MARKER), now, cooldown))
|
|
183
|
+
return false;
|
|
184
|
+
(options.start ?? startDetached)(binary(env), ["refresh", "--hosted-only", "--workspace", root], { ...env, CARRICK_NO_KEEP_AWAKE: "1" });
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
145
187
|
//# sourceMappingURL=refresh.js.map
|
package/dist/hook/refresh.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refresh.js","sourceRoot":"","sources":["../../src/hook/refresh.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,EAAE;AACF,0EAA0E;AAC1E,0EAA0E;AAC1E,8EAA8E;AAC9E,6EAA6E;AAC7E,8CAA8C;AAC9C,EAAE;AACF,qEAAqE;AACrE,iCAAiC;AACjC,EAAE;AACF,+EAA+E;AAC/E,qEAAqE;AACrE,4EAA4E;AAC5E,4EAA4E;AAC5E,sBAAsB;AACtB,wEAAwE;AACxE,6EAA6E;AAC7E,6EAA6E;AAC7E,+EAA+E;AAC/E,+EAA+E;AAC/E,mCAAmC;AACnC,EAAE;AACF,0EAA0E;AAC1E,6EAA6E;AAC7E,oEAAoE;AAEpE,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,iEAAiE;AACjE,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,GAAG,MAAM,CAAC;AAE/C
|
|
1
|
+
{"version":3,"file":"refresh.js","sourceRoot":"","sources":["../../src/hook/refresh.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,EAAE;AACF,0E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FC 3339, when this file was last written. Drives the prune below. */
|
|
28
28
|
updated: string;
|
|
29
29
|
};
|
|
30
|
-
/**
|
|
31
|
-
* How many entries one nudge names.
|
|
32
|
-
*
|
|
33
|
-
* `find_similar` takes twenty, so a longer list would be cut by the agent
|
|
34
|
-
* making the call. Cutting it here keeps the cut in one place and keeps the
|
|
35
|
-
* line readable.
|
|
36
|
-
*/
|
|
37
|
-
export declare const MAX_ENTRIES = 20;
|
|
38
30
|
/** Where one session's record lives. */
|
|
39
31
|
export declare function sessionFile(sessionId: string, home?: string): string | null;
|
|
40
32
|
/** The directory `carrick uninstall` deletes. */
|
|
@@ -78,6 +70,8 @@ export declare function markNudged(sessionId: string, entries: NewFunction[], ho
|
|
|
78
70
|
* repo-relative path, so one path in two repos is two files.
|
|
79
71
|
*/
|
|
80
72
|
export declare function toldKey(result: CheckResult, fallbackFile: string): string;
|
|
73
|
+
/** The `told` key for the post-edit "not re-checked here" line, said once per session. */
|
|
74
|
+
export declare const NOTED_KEY = "carrick::noted-line";
|
|
81
75
|
/** Whether this session has already been shown the uses lines under `key`. */
|
|
82
76
|
export declare function wasTold(sessionId: string, key: string, home?: string): boolean;
|
|
83
77
|
/** Remember that this session has been shown the uses lines under `keys`. */
|
|
@@ -109,18 +103,10 @@ export type Drained = {
|
|
|
109
103
|
*/
|
|
110
104
|
export declare function drain(sessionId: string, home?: string): Drained | null;
|
|
111
105
|
/**
|
|
112
|
-
* The one line the Stop hook hands the model
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
* * `description` entries rather than `name`, because `find_similar` resolves
|
|
118
|
-
* a `name` against the index and these are exactly the functions it does not
|
|
119
|
-
* hold — a `name` entry for one of them comes back as an error;
|
|
120
|
-
* * the two limits, because they decide what an empty answer means. The
|
|
121
|
-
* comparison is against the index's commit, which is this repo's default
|
|
122
|
-
* branch as the last scan saw it, so a function written earlier on this
|
|
123
|
-
* branch is listed here too. And the index holds no body hash: the match is
|
|
124
|
-
* on what a function is described as doing, not on its source.
|
|
106
|
+
* The one line the Stop hook hands the model: how many functions, at most two
|
|
107
|
+
* names, and the ask. Short on purpose, and it starts with "Carrick:" so the
|
|
108
|
+
* user can tell where it came from. The two limits on the answer (what the
|
|
109
|
+
* index was taken at, and that the match is on what a function is described as
|
|
110
|
+
* doing) live in the `carrick-reuse` skill, where the answer is read.
|
|
125
111
|
*/
|
|
126
112
|
export declare function nudge(entries: NewFunction[]): string;
|