carrick 0.3.133 → 0.3.135
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/contract.d.ts +6 -0
- package/dist/contract.js.map +1 -1
- package/dist/hook/post-edit.d.ts +10 -5
- package/dist/hook/post-edit.js +80 -23
- 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.js +15 -2
- package/dist/hook/session-start.js.map +1 -1
- package/dist/hook/stop.js.map +1 -1
- package/dist/init/agents-section.js +1 -1
- package/dist/init/agents-section.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.js +7 -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 +10 -2
- package/dist/init/run.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/index.js +18 -0
- 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/machine-paths.d.ts +44 -0
- package/sidecar/dist/src/capture/machine-paths.js +97 -0
- package/sidecar/dist/src/capture/node-builder.d.ts +2 -0
- package/sidecar/dist/src/capture/node-builder.js +1 -1
- 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 +117 -5
- 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.d.ts +35 -3
- package/sidecar/dist/src/library-claims.js +417 -61
- 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 +77 -1
- package/sidecar/dist/src/unwidened.js +10 -1
- package/sidecar/dist/src/validators.d.ts +931 -197
- package/sidecar/dist/src/validators.js +34 -0
- package/templates/skills/carrick-reuse.md +11 -0
package/dist/contract.d.ts
CHANGED
|
@@ -240,6 +240,12 @@ export type StatusRepo = {
|
|
|
240
240
|
/** Up to 50 of the ones outside every service, repo-relative. */
|
|
241
241
|
stale_files?: string[];
|
|
242
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;
|
|
243
249
|
};
|
|
244
250
|
/**
|
|
245
251
|
* A scan running on this machine right now, as `carrick status` reports it.
|
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;AAmM1C,MAAM,CAAC,MAAM,MAAM,GAAG,iBAAiB,CAAC;AACxC,MAAM,CAAC,MAAM,aAAa,GAAG,kBAAkB,CAAC;
|
|
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,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GA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,SAAS;QAC/B,IAAI,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,QAAQ;YAAE,SAAS;QACrF,IAAI,OAAO,KAAK,CAAC,uBAAuB,CAAC,KAAK,QAAQ;YAAE,SAAS;QACjE,CAAC,MAAM,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,KAA8B,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,WAAW,CAAC,IAAe;IACzC,OAAO,IAAI,CAAC,MAAM,KAAK,WAAW,CAAC;AACrC,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAAC,MAAmB;IAC9C,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;QAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC;QAC3B,OAAO,OAAO,CAAC,MAAM,IAAI,IAAI,IAAI,OAAO,CAAC,MAAM,KAAK,YAAY,CAAC;IACnE,CAAC,CAAC,CAAC;AACL,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,cAAc,CAAC,MAAmB;IAChD,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,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
|
*
|
|
@@ -39,9 +49,4 @@ export declare function newFunctions(result: CheckResult, file: string): NewFunc
|
|
|
39
49
|
* the same terms as one run as a tool.
|
|
40
50
|
*/
|
|
41
51
|
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;
|
|
47
52
|
export {};
|
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
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,14 +126,6 @@ export function filesFromPayload(payload) {
|
|
|
64
126
|
return [named];
|
|
65
127
|
return typeof input.command === "string" ? patchedFiles(input.command) : [];
|
|
66
128
|
}
|
|
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
129
|
/**
|
|
76
130
|
* Every edited file's answer, in order, from one binary call: the
|
|
77
131
|
* single-file `check` for one file (what Claude Code's edits always are), and
|
|
@@ -148,6 +202,9 @@ async function main() {
|
|
|
148
202
|
// one binary call, not one per file: each call re-reads the index and, on a
|
|
149
203
|
// repo whose re-check does not fit, would wait out a budget of its own.
|
|
150
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 = [];
|
|
151
208
|
for (const [index, relative] of relatives.entries()) {
|
|
152
209
|
const result = answers.results[index] ?? null;
|
|
153
210
|
if (!result) {
|
|
@@ -156,24 +213,24 @@ async function main() {
|
|
|
156
213
|
log("no answer for", relative, answers.failure ?? "");
|
|
157
214
|
continue;
|
|
158
215
|
}
|
|
159
|
-
found.push(...newFunctions(result,
|
|
216
|
+
found.push(...newFunctions(result, checkoutRelative(choice.root, edited[index])));
|
|
160
217
|
const key = toldKey(result, relative);
|
|
161
218
|
const show = !payload.session_id || !wasTold(payload.session_id, key);
|
|
162
219
|
if (show && result.uses_lines?.length)
|
|
163
220
|
told.push(key);
|
|
164
|
-
|
|
221
|
+
if (!result.error && !answersTheEdit(result))
|
|
222
|
+
unchecked.push(relative);
|
|
223
|
+
const context = renderPostToolUse(result, relative, { uses: show, noted: false });
|
|
165
224
|
log(`check ${relative} -> ${context ? "context" : "nothing to say"} in ${answers.ms}ms`);
|
|
166
225
|
if (context)
|
|
167
226
|
contexts.push(context);
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
}
|
|
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);
|
|
177
234
|
}
|
|
178
235
|
// Silent and local: the names go to a file under the user's home directory
|
|
179
236
|
// 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,
|
|
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,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAI3E,MAAM,GAAG,GAAG,YAAY,CAAC,cAAc,CAAC,CAA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space. */
|
|
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;AA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AI,OAAO,CAAC,GAAG,CAAC;IACvC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;IACtC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAC;IAC5C,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,EAAE,6BAA6B,EAAE,mBAAmB,CAAC,CAAC;IACrF,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,EAAE,cAAc,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC;QAAE,OAAO,KAAK,CAAC;IACjF,CAAC,OAAO,CAAC,KAAK,IAAI,aAAa,CAAC,CAC9B,MAAM,CAAC,GAAG,CAAC,EACX,CAAC,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,IAAI,CAAC,EACjD,EAAE,GAAG,GAAG,EAAE,qBAAqB,EAAE,GAAG,EAAE,CACvC,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/hook/reuse.d.ts
CHANGED
|
@@ -27,14 +27,6 @@ export type SessionRecord = {
|
|
|
27
27
|
/** RFC 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;
|
package/dist/hook/reuse.js
CHANGED
|
@@ -19,14 +19,6 @@
|
|
|
19
19
|
import fs from "node:fs";
|
|
20
20
|
import os from "node:os";
|
|
21
21
|
import path from "node:path";
|
|
22
|
-
/**
|
|
23
|
-
* How many entries one nudge names.
|
|
24
|
-
*
|
|
25
|
-
* `find_similar` takes twenty, so a longer list would be cut by the agent
|
|
26
|
-
* making the call. Cutting it here keeps the cut in one place and keeps the
|
|
27
|
-
* line readable.
|
|
28
|
-
*/
|
|
29
|
-
export const MAX_ENTRIES = 20;
|
|
30
22
|
/** Session files older than this are removed on the next write. */
|
|
31
23
|
const KEEP_DAYS = 7;
|
|
32
24
|
/** A file name a session id can never escape from. */
|
|
@@ -48,7 +40,13 @@ function key(entry) {
|
|
|
48
40
|
}
|
|
49
41
|
/** A session's record, or an empty one. Never throws. */
|
|
50
42
|
export function readSession(sessionId, home) {
|
|
51
|
-
const empty = {
|
|
43
|
+
const empty = {
|
|
44
|
+
found: [],
|
|
45
|
+
nudged: [],
|
|
46
|
+
told: [],
|
|
47
|
+
read: [],
|
|
48
|
+
updated: "",
|
|
49
|
+
};
|
|
52
50
|
const file = sessionFile(sessionId, home);
|
|
53
51
|
if (file === null)
|
|
54
52
|
return empty;
|
|
@@ -229,6 +227,8 @@ export function markNudged(sessionId, entries, home) {
|
|
|
229
227
|
export function toldKey(result, fallbackFile) {
|
|
230
228
|
return `${result.repo ?? ""}::${result.file ?? fallbackFile}`;
|
|
231
229
|
}
|
|
230
|
+
/** The `told` key for the post-edit "not re-checked here" line, said once per session. */
|
|
231
|
+
export const NOTED_KEY = "carrick::noted-line";
|
|
232
232
|
/** Whether this session has already been shown the uses lines under `key`. */
|
|
233
233
|
export function wasTold(sessionId, key, home) {
|
|
234
234
|
return readSession(sessionId, home).told.includes(key);
|
|
@@ -280,34 +280,21 @@ export function drain(sessionId, home) {
|
|
|
280
280
|
return { line, named: waiting.length, found: current.found.length };
|
|
281
281
|
}
|
|
282
282
|
/**
|
|
283
|
-
* The one line the Stop hook hands the model
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
* * `description` entries rather than `name`, because `find_similar` resolves
|
|
289
|
-
* a `name` against the index and these are exactly the functions it does not
|
|
290
|
-
* hold — a `name` entry for one of them comes back as an error;
|
|
291
|
-
* * the two limits, because they decide what an empty answer means. The
|
|
292
|
-
* comparison is against the index's commit, which is this repo's default
|
|
293
|
-
* branch as the last scan saw it, so a function written earlier on this
|
|
294
|
-
* branch is listed here too. And the index holds no body hash: the match is
|
|
295
|
-
* on what a function is described as doing, not on its source.
|
|
283
|
+
* The one line the Stop hook hands the model: how many functions, at most two
|
|
284
|
+
* names, and the ask. Short on purpose, and it starts with "Carrick:" so the
|
|
285
|
+
* user can tell where it came from. The two limits on the answer (what the
|
|
286
|
+
* index was taken at, and that the match is on what a function is described as
|
|
287
|
+
* doing) live in the `carrick-reuse` skill, where the answer is read.
|
|
296
288
|
*/
|
|
297
289
|
export function nudge(entries) {
|
|
298
|
-
const
|
|
299
|
-
const
|
|
300
|
-
const
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
return [
|
|
308
|
-
`This task added ${named.length} function${named.length === 1 ? "" : "s"} that ${at} does not hold: ${list}.${more}`,
|
|
309
|
-
`Run the carrick-reuse skill now: one find_similar call, one \`description\` entry per function (a \`name\` entry resolves against the index, and these are not in it).`,
|
|
310
|
-
`Two limits on the answer: the index was taken at ${commits.length === 1 ? commits[0].slice(0, 7) : "this workspace's last scan"} on the default branch, so anything added on this branch is compared against that; and the comparison is on what each function is described as doing, not on its source.`,
|
|
311
|
-
].join(" ");
|
|
290
|
+
const total = entries.length;
|
|
291
|
+
const shown = entries.slice(0, 2).map((entry) => entry.name);
|
|
292
|
+
const rest = total - shown.length;
|
|
293
|
+
const list = rest > 0
|
|
294
|
+
? `${shown.join(", ")} and ${rest} more`
|
|
295
|
+
: shown.length === 2
|
|
296
|
+
? `${shown[0]} and ${shown[1]}`
|
|
297
|
+
: shown[0];
|
|
298
|
+
return `Carrick: this task added ${total} new function${total === 1 ? "" : "s"} (${list}). Check them for existing copies with one find_similar call, then tell the user in one line what Carrick found.`;
|
|
312
299
|
}
|
|
313
300
|
//# sourceMappingURL=reuse.js.map
|
package/dist/hook/reuse.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reuse.js","sourceRoot":"","sources":["../../src/hook/reuse.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,oEAAoE;AACpE,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,+EAA+E;AAC/E,4EAA4E;AAC5E,gFAAgF;AAChF,6EAA6E;AAC7E,uEAAuE;AACvE,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,8EAA8E;AAC9E,4EAA4E;AAC5E,6CAA6C;AAC7C,EAAE;AACF,iEAAiE;AAEjE,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAiC7B
|
|
1
|
+
{"version":3,"file":"reuse.js","sourceRoot":"","sources":["../../src/hook/reuse.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,oEAAoE;AACpE,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,+EAA+E;AAC/E,4EAA4E;AAC5E,gFAAgF;AAChF,6EAA6E;AAC7E,uEAAuE;AACvE,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,8EAA8E;AAC9E,4EAA4E;AAC5E,6CAA6C;AAC7C,EAAE;AACF,iEAAiE;AAEjE,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAiC7B,mEAAmE;AACnE,MAAM,SAAS,GAAG,CAAC,CAAC;AAEpB,sDAAsD;AACtD,SAAS,MAAM,CAAC,SAAiB;IAC/B,OAAO,yBAAyB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;AACtE,CAAC;AAED,wCAAwC;AACxC,MAAM,UAAU,WAAW,CAAC,SAAiB,EAAE,OAAe,EAAE,CAAC,OAAO,EA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