carrick 0.3.153 → 0.3.155
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/bin/carrick.mjs +26 -4
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +1 -0
- package/dist/cli.js.map +1 -1
- package/dist/contract.d.ts +37 -3
- package/dist/contract.js +8 -0
- package/dist/contract.js.map +1 -1
- package/dist/facts/diff.d.ts +27 -0
- package/dist/facts/diff.js +134 -0
- package/dist/facts/diff.js.map +1 -0
- package/dist/facts/enabled.d.ts +2 -0
- package/dist/facts/enabled.js +9 -0
- package/dist/facts/enabled.js.map +1 -0
- package/dist/facts/fetch.d.ts +48 -0
- package/dist/facts/fetch.js +235 -0
- package/dist/facts/fetch.js.map +1 -0
- package/dist/facts/files.d.ts +21 -0
- package/dist/facts/files.js +58 -0
- package/dist/facts/files.js.map +1 -0
- package/dist/facts/lines.d.ts +70 -0
- package/dist/facts/lines.js +335 -0
- package/dist/facts/lines.js.map +1 -0
- package/dist/facts/match.d.ts +91 -0
- package/dist/facts/match.js +1122 -0
- package/dist/facts/match.js.map +1 -0
- package/dist/facts/peers.d.ts +48 -0
- package/dist/facts/peers.js +143 -0
- package/dist/facts/peers.js.map +1 -0
- package/dist/facts/refresh-run.d.ts +2 -0
- package/dist/facts/refresh-run.js +18 -0
- package/dist/facts/refresh-run.js.map +1 -0
- package/dist/facts/rules/packages.d.ts +16 -0
- package/dist/facts/rules/packages.js +157 -0
- package/dist/facts/rules/packages.js.map +1 -0
- package/dist/facts/rules/same-name.d.ts +28 -0
- package/dist/facts/rules/same-name.js +131 -0
- package/dist/facts/rules/same-name.js.map +1 -0
- package/dist/facts/store.d.ts +119 -0
- package/dist/facts/store.js +341 -0
- package/dist/facts/store.js.map +1 -0
- package/dist/git-remote.d.ts +6 -0
- package/dist/git-remote.js +37 -0
- package/dist/git-remote.js.map +1 -0
- package/dist/hook/apply-patch.d.ts +23 -0
- package/dist/hook/apply-patch.js +92 -0
- package/dist/hook/apply-patch.js.map +1 -1
- package/dist/hook/bash-targets.d.ts +8 -0
- package/dist/hook/bash-targets.js +23 -11
- package/dist/hook/bash-targets.js.map +1 -1
- package/dist/hook/edit-flow.d.ts +29 -2
- package/dist/hook/edit-flow.js +80 -29
- package/dist/hook/edit-flow.js.map +1 -1
- package/dist/hook/late.d.ts +29 -0
- package/dist/hook/late.js +121 -26
- package/dist/hook/late.js.map +1 -1
- package/dist/hook/post-bash.js +45 -22
- package/dist/hook/post-bash.js.map +1 -1
- package/dist/hook/post-edit.d.ts +16 -1
- package/dist/hook/post-edit.js +177 -13
- package/dist/hook/post-edit.js.map +1 -1
- package/dist/hook/post-read.js +8 -12
- package/dist/hook/post-read.js.map +1 -1
- package/dist/hook/post-search.d.ts +2 -0
- package/dist/hook/post-search.js +25 -0
- package/dist/hook/post-search.js.map +1 -0
- package/dist/hook/probe.d.ts +18 -3
- package/dist/hook/probe.js +30 -6
- package/dist/hook/probe.js.map +1 -1
- package/dist/hook/rechecks.d.ts +66 -11
- package/dist/hook/rechecks.js +115 -29
- package/dist/hook/rechecks.js.map +1 -1
- package/dist/hook/refresh.d.ts +9 -0
- package/dist/hook/refresh.js +10 -0
- package/dist/hook/refresh.js.map +1 -1
- package/dist/hook/reuse.d.ts +16 -2
- package/dist/hook/reuse.js +49 -6
- package/dist/hook/reuse.js.map +1 -1
- package/dist/hook/session-key.d.ts +12 -0
- package/dist/hook/session-key.js +30 -0
- package/dist/hook/session-key.js.map +1 -0
- package/dist/hook/session-start.js +14 -7
- package/dist/hook/session-start.js.map +1 -1
- package/dist/hook/stop-wait.d.ts +2 -9
- package/dist/hook/stop-wait.js +96 -113
- package/dist/hook/stop-wait.js.map +1 -1
- package/dist/hook/stop.js +13 -8
- package/dist/hook/stop.js.map +1 -1
- package/dist/hook/subagent-stop.d.ts +2 -0
- package/dist/hook/subagent-stop.js +45 -0
- package/dist/hook/subagent-stop.js.map +1 -0
- package/dist/hook/timings.d.ts +72 -0
- package/dist/hook/timings.js +175 -0
- package/dist/hook/timings.js.map +1 -0
- package/dist/hook/user-prompt.js +17 -13
- package/dist/hook/user-prompt.js.map +1 -1
- package/dist/hook/worktree.d.ts +11 -0
- package/dist/hook/worktree.js +27 -1
- package/dist/hook/worktree.js.map +1 -1
- package/dist/init/repo-copies.d.ts +6 -0
- package/dist/init/repo-copies.js +7 -3
- package/dist/init/repo-copies.js.map +1 -1
- package/dist/init/repos.d.ts +2 -2
- package/dist/init/repos.js +1 -34
- package/dist/init/repos.js.map +1 -1
- package/dist/init/settings.js +25 -13
- package/dist/init/settings.js.map +1 -1
- package/dist/render.d.ts +8 -33
- package/dist/render.js +42 -120
- package/dist/render.js.map +1 -1
- package/package.json +6 -6
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/hooks/hooks.json +44 -3
- package/scripts/install-scanned-deps.sh +25 -2
- package/sidecar/dist/src/capture/anchors.d.ts +12 -1
- package/sidecar/dist/src/capture/anchors.js +28 -47
- package/sidecar/dist/src/capture/api.d.ts +41 -1
- package/sidecar/dist/src/capture/augmentations.d.ts +2 -0
- package/sidecar/dist/src/capture/augmentations.js +1 -1
- package/sidecar/dist/src/capture/check-classify.d.ts +12 -1
- package/sidecar/dist/src/capture/check-classify.js +43 -0
- package/sidecar/dist/src/capture/check-deep.d.ts +44 -1
- package/sidecar/dist/src/capture/check-deep.js +161 -2
- package/sidecar/dist/src/capture/check.js +23 -2
- package/sidecar/dist/src/capture/checkout.d.ts +9 -3
- package/sidecar/dist/src/capture/checkout.js +12 -5
- package/sidecar/dist/src/capture/deep-walk.d.ts +25 -0
- package/sidecar/dist/src/capture/deep-walk.js +41 -0
- package/sidecar/dist/src/capture/deno-project.d.ts +22 -0
- package/sidecar/dist/src/capture/deno-project.js +48 -1
- package/sidecar/dist/src/capture/index.d.ts +3 -1
- package/sidecar/dist/src/capture/index.js +14 -4
- package/sidecar/dist/src/capture/machinery.d.ts +8 -53
- package/sidecar/dist/src/capture/machinery.js +10 -157
- package/sidecar/dist/src/capture/node-builder.d.ts +6 -0
- package/sidecar/dist/src/capture/self-check.d.ts +7 -0
- package/sidecar/dist/src/capture/self-check.js +44 -1
- package/sidecar/dist/src/capture/site-node.d.ts +166 -0
- package/sidecar/dist/src/capture/site-node.js +570 -0
- package/sidecar/dist/src/capture/tool-env.d.ts +12 -0
- package/sidecar/dist/src/capture/tool-env.js +26 -0
- package/sidecar/dist/src/default-library.d.ts +39 -0
- package/sidecar/dist/src/default-library.js +132 -0
- package/sidecar/dist/src/definition-resolver.js +2 -0
- package/sidecar/dist/src/index.js +1 -1
- package/sidecar/dist/src/library-claims.d.ts +2 -0
- package/sidecar/dist/src/library-claims.js +387 -37
- package/sidecar/dist/src/node-index.d.ts +2 -0
- package/sidecar/dist/src/node-index.js +5 -1
- package/sidecar/dist/src/position-rows.d.ts +78 -7
- package/sidecar/dist/src/position-rows.js +343 -18
- package/sidecar/dist/src/project-loader.d.ts +3 -3
- package/sidecar/dist/src/project-loader.js +18 -9
- package/sidecar/dist/src/retype.d.ts +13 -0
- package/sidecar/dist/src/retype.js +126 -0
- package/sidecar/dist/src/type-inferrer.d.ts +47 -145
- package/sidecar/dist/src/type-inferrer.js +102 -529
- package/sidecar/dist/src/types.d.ts +64 -2
- package/sidecar/dist/src/validators.d.ts +806 -142
- package/sidecar/dist/src/validators.js +12 -1
package/bin/carrick.mjs
CHANGED
|
@@ -39,9 +39,11 @@ const HOOKS = {
|
|
|
39
39
|
"post-edit": "../dist/hook/post-edit.js",
|
|
40
40
|
"post-bash": "../dist/hook/post-bash.js",
|
|
41
41
|
"post-read": "../dist/hook/post-read.js",
|
|
42
|
+
"post-search": "../dist/hook/post-search.js",
|
|
42
43
|
"recheck-run": "../dist/hook/recheck-run.js",
|
|
43
44
|
"session-start": "../dist/hook/session-start.js",
|
|
44
45
|
stop: "../dist/hook/stop.js",
|
|
46
|
+
"subagent-stop": "../dist/hook/subagent-stop.js",
|
|
45
47
|
"user-prompt": "../dist/hook/user-prompt.js",
|
|
46
48
|
};
|
|
47
49
|
|
|
@@ -204,7 +206,7 @@ async function renderNative(args) {
|
|
|
204
206
|
}
|
|
205
207
|
|
|
206
208
|
/** Run the scanner binary, streaming its output and answering with its code. */
|
|
207
|
-
async function runNative(args) {
|
|
209
|
+
async function runNative(args, { after } = {}) {
|
|
208
210
|
const { resolveNativeBinary, nativeEnv, overrideLine } = await import("../dist/native.js");
|
|
209
211
|
const { relaySignals } = await import("../dist/scan.js");
|
|
210
212
|
const lookup = resolveNativeBinary();
|
|
@@ -236,6 +238,16 @@ async function runNative(args) {
|
|
|
236
238
|
process.kill(process.pid, signal);
|
|
237
239
|
return;
|
|
238
240
|
}
|
|
241
|
+
// `after` is this package's own line under the binary's answer.
|
|
242
|
+
if (after && code === 0) {
|
|
243
|
+
Promise.resolve(after())
|
|
244
|
+
.then((line) => {
|
|
245
|
+
if (line) process.stdout.write(`${line}\n`);
|
|
246
|
+
})
|
|
247
|
+
.catch(() => {})
|
|
248
|
+
.finally(() => process.exit(code));
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
239
251
|
process.exit(code ?? 1);
|
|
240
252
|
});
|
|
241
253
|
}
|
|
@@ -295,8 +307,8 @@ function extraHelp() {
|
|
|
295
307
|
" depends on the file, once per file per session)",
|
|
296
308
|
" hook session-start Claude Code SessionStart hook",
|
|
297
309
|
" hook stop Claude Code Stop hook (delivers background",
|
|
298
|
-
" re-checks
|
|
299
|
-
" hook user-prompt
|
|
310
|
+
" re-checks)",
|
|
311
|
+
" hook user-prompt UserPromptSubmit hook (finished",
|
|
300
312
|
" re-checks, delivered on the next prompt)",
|
|
301
313
|
" templates workflow print the GitHub Actions workflow file",
|
|
302
314
|
" --version the version of this package",
|
|
@@ -423,7 +435,17 @@ switch (command) {
|
|
|
423
435
|
}
|
|
424
436
|
default: {
|
|
425
437
|
const { isRendered } = await import("../dist/scan.js");
|
|
426
|
-
|
|
438
|
+
// The binary answers `status`; this package adds the hooks' own timing line
|
|
439
|
+
// under it (`hook/timings.ts`), never to `--json`, which a hook parses.
|
|
440
|
+
if (command === "status" && !rest.some((a) => a === "--json" || a === "--help" || a === "-h")) {
|
|
441
|
+
await runNative(argv, {
|
|
442
|
+
after: async () => {
|
|
443
|
+
const { statusTimingsLine } = await import("../dist/hook/timings.js");
|
|
444
|
+
const at = rest.indexOf("--workspace");
|
|
445
|
+
return statusTimingsLine((at >= 0 && rest[at + 1]) || process.cwd());
|
|
446
|
+
},
|
|
447
|
+
});
|
|
448
|
+
} else if (isRendered(command, rest)) await renderNative(argv);
|
|
427
449
|
else await runNative(argv);
|
|
428
450
|
}
|
|
429
451
|
}
|
package/dist/cli.d.ts
CHANGED
|
@@ -19,6 +19,12 @@ export type RunOptions = {
|
|
|
19
19
|
* (the environment's own value always wins). Absent: five seconds.
|
|
20
20
|
*/
|
|
21
21
|
limitMs?: number;
|
|
22
|
+
/**
|
|
23
|
+
* The signal that ends a call past its limit. Absent: SIGTERM, which lets the
|
|
24
|
+
* binary clean up. The hook's probe states SIGKILL, so a binary that ignores
|
|
25
|
+
* SIGTERM is not left running behind the edit.
|
|
26
|
+
*/
|
|
27
|
+
killSignal?: NodeJS.Signals;
|
|
22
28
|
};
|
|
23
29
|
/**
|
|
24
30
|
* What a `--recheck` call must state: its own limit. There is no default,
|
package/dist/cli.js
CHANGED
|
@@ -24,6 +24,7 @@ async function run(args, options, parse) {
|
|
|
24
24
|
cwd: options.cwd,
|
|
25
25
|
env,
|
|
26
26
|
timeout: env["CARRICK_TIMEOUT_MS"] ? timeoutMs(env) : (options.limitMs ?? timeoutMs(env)),
|
|
27
|
+
killSignal: options.killSignal ?? "SIGTERM",
|
|
27
28
|
maxBuffer: 32 * 1024 * 1024,
|
|
28
29
|
encoding: "utf8",
|
|
29
30
|
}, (error, stdout) => {
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,mEAAmE;A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ACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,KAAe,EACf,OAAwC;IAExC,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;IAClE,IAAI,OAAO,CAAC,QAAQ;QAAE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC/C,OAAO,MAAM,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC;AACrD,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;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAmB;IACpD,OAAO,MAAM,GAAG,CAAC,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC;AAClF,CAAC"}
|
package/dist/contract.d.ts
CHANGED
|
@@ -9,9 +9,8 @@ export type Boundary = {
|
|
|
9
9
|
commit_hash?: string;
|
|
10
10
|
files_attempted?: number;
|
|
11
11
|
files_lost?: Counted;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
unemitted_literal_sites?: string[];
|
|
12
|
+
/** Files the parser refused (`path: does_not_parse`); written by the scanner since carrick#3760. Absent reads as 0. */
|
|
13
|
+
files_not_parsed?: Counted;
|
|
15
14
|
/** Candidates no model has been asked about: what `carrick index` classifies. */
|
|
16
15
|
candidates_awaiting_model?: number;
|
|
17
16
|
/** Why this service's types are thin, when the scan recorded a reason. */
|
|
@@ -26,7 +25,14 @@ export type Boundary = {
|
|
|
26
25
|
/** Model endpoints whose echoed id names no listed site and whose file states no such route. */
|
|
27
26
|
model_endpoints_dropped_unanchored?: Counted;
|
|
28
27
|
routes_without_response_type?: Counted;
|
|
28
|
+
/** Routes that send no response body (`routes_without_body`). */
|
|
29
|
+
routes_without_body?: Counted;
|
|
29
30
|
calls_without_expected_type?: Counted;
|
|
31
|
+
/**
|
|
32
|
+
* Call sites the scan did not read: the exact total, and the first 200 as
|
|
33
|
+
* `file:line: <phrase>`. The CLI resolves the phrase; this port holds no table.
|
|
34
|
+
*/
|
|
35
|
+
unread_sites?: Counted;
|
|
30
36
|
types_degraded?: {
|
|
31
37
|
stage?: string;
|
|
32
38
|
detail?: string;
|
|
@@ -58,6 +64,11 @@ export type CheckItem = {
|
|
|
58
64
|
kind: "route" | "call" | string;
|
|
59
65
|
method?: string;
|
|
60
66
|
path?: string;
|
|
67
|
+
/**
|
|
68
|
+
* The dispatch case a row is, ready to append to `method path`:
|
|
69
|
+
* ` {action=start-scan}`. Absent on a plain route or call (carrick#3956).
|
|
70
|
+
*/
|
|
71
|
+
dispatch_label?: string;
|
|
61
72
|
line?: number;
|
|
62
73
|
col?: number;
|
|
63
74
|
/** R1: a row whose only source is the model is a candidate, never a fact. */
|
|
@@ -86,6 +97,18 @@ export type CheckItem = {
|
|
|
86
97
|
*/
|
|
87
98
|
actual_type?: string;
|
|
88
99
|
};
|
|
100
|
+
/** `UnreadItem` from src/local_mode/contract.rs: one call the scan did not read. */
|
|
101
|
+
export type UnreadItem = {
|
|
102
|
+
/** Relative to the repo owning the queried file. */
|
|
103
|
+
file: string;
|
|
104
|
+
line: number;
|
|
105
|
+
/** The stop word (`value_callee`, `recursion`, ...). */
|
|
106
|
+
reason: string;
|
|
107
|
+
/** The words for `reason`, from the CLI's table. */
|
|
108
|
+
phrase: string;
|
|
109
|
+
/** The line is one the working tree added or changed since the index commit. */
|
|
110
|
+
edited?: boolean;
|
|
111
|
+
};
|
|
89
112
|
export type CheckResult = {
|
|
90
113
|
schema: string;
|
|
91
114
|
/** Set instead of the payload, e.g. `not_indexed`. */
|
|
@@ -110,6 +133,12 @@ export type CheckResult = {
|
|
|
110
133
|
/** The index holds this file and it is no longer on disk. */
|
|
111
134
|
deleted?: boolean;
|
|
112
135
|
items?: CheckItem[];
|
|
136
|
+
/**
|
|
137
|
+
* Calls in this file the scan did not read, at the lines they have on disk.
|
|
138
|
+
* Absent when there are none, and when the file moved past the index with no
|
|
139
|
+
* re-check answer: absent is "not stated", never "none unread".
|
|
140
|
+
*/
|
|
141
|
+
unread?: UnreadItem[];
|
|
113
142
|
boundary?: Boundary;
|
|
114
143
|
/**
|
|
115
144
|
* One sentence about what a local index cannot hold at all. Always sent, so a
|
|
@@ -193,6 +222,11 @@ export type Recheck = {
|
|
|
193
222
|
* indexed ones. Absent otherwise.
|
|
194
223
|
*/
|
|
195
224
|
deferred?: boolean;
|
|
225
|
+
/**
|
|
226
|
+
* True on a `none` whose re-check started and ran past its budget: the rows
|
|
227
|
+
* are the indexed ones because time ran out (carrick#3860). Absent otherwise.
|
|
228
|
+
*/
|
|
229
|
+
deadline?: boolean;
|
|
196
230
|
/** Which services this re-check read and which it judged at another version. */
|
|
197
231
|
scope?: RecheckScope;
|
|
198
232
|
/**
|
package/dist/contract.js
CHANGED
|
@@ -86,6 +86,14 @@ function checkResultOf(parsed) {
|
|
|
86
86
|
if (lines.length)
|
|
87
87
|
result.boundary_lines = lines;
|
|
88
88
|
}
|
|
89
|
+
if (Array.isArray(parsed["unread"])) {
|
|
90
|
+
const unread = parsed["unread"].filter((item) => isRecord(item) &&
|
|
91
|
+
typeof item["file"] === "string" &&
|
|
92
|
+
typeof item["line"] === "number" &&
|
|
93
|
+
typeof item["phrase"] === "string");
|
|
94
|
+
if (unread.length)
|
|
95
|
+
result.unread = unread;
|
|
96
|
+
}
|
|
89
97
|
if (Array.isArray(parsed["uses_lines"])) {
|
|
90
98
|
const lines = parsed["uses_lines"].filter((line) => typeof line === "string");
|
|
91
99
|
if (lines.length)
|
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;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,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;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAyUxC,MAAM,CAAC,MAAM,MAAM,GAAG,iBAAiB,CAAC;AACxC,MAAM,CAAC,MAAM,aAAa,GAAG,kBAAkB,CAAC;AAuMhD;;;;;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,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD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,CAAC,GAAG,CAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvG,MAAM,MAAM,GAAkB;QAC5B,MAAM,EAAE,cAAc;QACtB,IAAI;QACJ,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;QACrB,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC;QACvB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;QACrB,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC;QAC3B,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;QACzB,YAAY,EAAE,KAAK,CAAC,cAAc,CAAC;QACnC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAE,MAAM,CAAC,UAAU,CAAsB,CAAC,CAAC,CAAC,EAAE;KAC5F,CAAC;IACF,IAAI,OAAO,MAAM,CAAC,aAAa,CAAC,KAAK,QAAQ;QAAE,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;IAC1F,OAAO,MAAM,CAAC;AAChB,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"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** A diff with more changed lines than this is a rewrite or a generated file: no lines. */
|
|
2
|
+
export declare const MAX_DIFF_LINES = 2000;
|
|
3
|
+
/** Each git call gets this long; a slower one is a silence, not a wait. `CARRICK_FACTS_DIFF_BUDGET_MS` overrides it (tests on a busy machine). */
|
|
4
|
+
export declare const DIFF_BUDGET_MS = 150;
|
|
5
|
+
export type DiffChange = {
|
|
6
|
+
lines?: number[];
|
|
7
|
+
removed?: number[];
|
|
8
|
+
whole?: boolean;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The fact path's one git runner (R40.4): `git` in `dir` under the budget,
|
|
12
|
+
* the output or null on any failure or overrun. Every git call the fact path
|
|
13
|
+
* makes runs through it: the diff and the tracked-file check below and the
|
|
14
|
+
* peer proof (`peers.ts`). In a partial clone, or a folder in no checkout, it
|
|
15
|
+
* runs nothing and answers null.
|
|
16
|
+
*/
|
|
17
|
+
export declare function gitFacts(dir: string, args: string[], env?: NodeJS.ProcessEnv): string | null;
|
|
18
|
+
/** Whether git, asked in the file's folder, says it does not track `file`; false when git cannot say. */
|
|
19
|
+
export declare function untrackedFile(file: string, env?: NodeJS.ProcessEnv): boolean;
|
|
20
|
+
/** How long each of the fact path's git calls may take. */
|
|
21
|
+
export declare function factsGitBudgetMs(env?: NodeJS.ProcessEnv): number;
|
|
22
|
+
/**
|
|
23
|
+
* Where `file` differs from `HEAD`, or null when that is not known (or there
|
|
24
|
+
* is no difference). An untracked file counts whole only when `created`: the
|
|
25
|
+
* session did not see the file before this call.
|
|
26
|
+
*/
|
|
27
|
+
export declare function changesAgainstHead(file: string, created: boolean, env?: NodeJS.ProcessEnv): DiffChange | null;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// The changed lines of one file against `HEAD`, for a write whose own call
|
|
2
|
+
// says nothing about them: a `Write` over an existing file, a shell write
|
|
3
|
+
// (`sed -i`, a heredoc, a script), a patch hunk that cannot be placed.
|
|
4
|
+
//
|
|
5
|
+
// `git diff --no-ext-diff -U0 HEAD -- <file>` runs in the file's own folder
|
|
6
|
+
// (so a linked worktree answers for itself), and its `@@ -a,b +c,d @@` headers
|
|
7
|
+
// give the same shape `post-edit.ts` reads from an Edit's patch: the lines now
|
|
8
|
+
// in the file that were added, and where lines were removed (the line now
|
|
9
|
+
// sitting where they were; `facts/match.ts` `gapsOfLines` and `touched` apply
|
|
10
|
+
// the "strictly inside" rule to them).
|
|
11
|
+
//
|
|
12
|
+
// Limitation: the diff is against HEAD, not against the file before this
|
|
13
|
+
// call, so lines the session changed earlier and has not committed also
|
|
14
|
+
// count as changed. Each fact line is said once per session (`markFacts`),
|
|
15
|
+
// which stops the repeats.
|
|
16
|
+
//
|
|
17
|
+
// Which lines changed is not known, and nothing is said, when: the folder is
|
|
18
|
+
// not a git repository, git is missing or answers an error, the diff holds
|
|
19
|
+
// more than `MAX_DIFF_LINES` changed lines, or git takes longer than
|
|
20
|
+
// `DIFF_BUDGET_MS`. Never throws.
|
|
21
|
+
import fs from "node:fs";
|
|
22
|
+
import path from "node:path";
|
|
23
|
+
import { cooldownMs } from "../hook/refresh.js";
|
|
24
|
+
import { checkoutOf, commonGitDir } from "../hook/worktree.js";
|
|
25
|
+
import { git } from "../init/repo-copies.js";
|
|
26
|
+
/** A diff with more changed lines than this is a rewrite or a generated file: no lines. */
|
|
27
|
+
export const MAX_DIFF_LINES = 2000;
|
|
28
|
+
/** Each git call gets this long; a slower one is a silence, not a wait. `CARRICK_FACTS_DIFF_BUDGET_MS` overrides it (tests on a busy machine). */
|
|
29
|
+
export const DIFF_BUDGET_MS = 150;
|
|
30
|
+
/**
|
|
31
|
+
* The fact path's one git runner (R40.4): `git` in `dir` under the budget,
|
|
32
|
+
* the output or null on any failure or overrun. Every git call the fact path
|
|
33
|
+
* makes runs through it: the diff and the tracked-file check below and the
|
|
34
|
+
* peer proof (`peers.ts`). In a partial clone, or a folder in no checkout, it
|
|
35
|
+
* runs nothing and answers null.
|
|
36
|
+
*/
|
|
37
|
+
export function gitFacts(dir, args, env = process.env) {
|
|
38
|
+
const checkout = checkoutOf(dir);
|
|
39
|
+
if (checkout === null || isPartialClone(checkout.top))
|
|
40
|
+
return null;
|
|
41
|
+
// Four fixed variables, set after both spreads so neither the process env
|
|
42
|
+
// nor the caller's can override them (R42.1): no replace ref answering for
|
|
43
|
+
// another tree, no lazy fetch of a missing object, no transport of any kind,
|
|
44
|
+
// and no credential prompt. A hook never uses the network. An explicit
|
|
45
|
+
// `core.useReplaceRefs=true` (repo, global or env config) outranks
|
|
46
|
+
// GIT_NO_REPLACE_OBJECTS, so the command line, read last, turns it off (R42.2).
|
|
47
|
+
return git(dir, ["-c", "core.useReplaceRefs=false", ...args], factsGitBudgetMs(env), {
|
|
48
|
+
...process.env,
|
|
49
|
+
...env,
|
|
50
|
+
GIT_NO_REPLACE_OBJECTS: "1",
|
|
51
|
+
GIT_ALLOW_PROTOCOL: "none",
|
|
52
|
+
GIT_NO_LAZY_FETCH: "1",
|
|
53
|
+
GIT_TERMINAL_PROMPT: "0",
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/** Whether each checkout is a partial clone, by its top, decided once per process. */
|
|
57
|
+
const partialClones = new Map();
|
|
58
|
+
/**
|
|
59
|
+
* Whether the checkout at `top` is a partial clone (or not known not to be,
|
|
60
|
+
* R40.3): its shared git dir holds a promisor pack (`objects/pack/*.promisor`),
|
|
61
|
+
* or its config includes another file (`[include]`, `[includeIf]`: what that
|
|
62
|
+
* file says is not read) or has any `promisor`, `partialclonefilter` or
|
|
63
|
+
* `partialclone` key, whatever its value. Git there could fetch a missing
|
|
64
|
+
* object over the network, which a hook never does on any git version. Read
|
|
65
|
+
* as files, no git run. A git dir, pack folder or config that cannot be read
|
|
66
|
+
* counts as partial.
|
|
67
|
+
*/
|
|
68
|
+
function isPartialClone(top) {
|
|
69
|
+
const known = partialClones.get(top);
|
|
70
|
+
if (known !== undefined)
|
|
71
|
+
return known;
|
|
72
|
+
const answer = (() => {
|
|
73
|
+
const common = commonGitDir(top);
|
|
74
|
+
if (common === null)
|
|
75
|
+
return true;
|
|
76
|
+
try {
|
|
77
|
+
if (fs.readdirSync(path.join(common, "objects", "pack")).some((name) => name.endsWith(".promisor")))
|
|
78
|
+
return true;
|
|
79
|
+
const config = fs.readFileSync(path.join(common, "config"), "utf8");
|
|
80
|
+
return /^\s*\[\s*include(?:if)?\b/im.test(config) || /^\s*(?:promisor|partialclonefilter|partialclone)\s*(?:[=;#]|$)/im.test(config);
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
})();
|
|
86
|
+
partialClones.set(top, answer);
|
|
87
|
+
return answer;
|
|
88
|
+
}
|
|
89
|
+
/** Whether git, asked in the file's folder, says it does not track `file`; false when git cannot say. */
|
|
90
|
+
export function untrackedFile(file, env = process.env) {
|
|
91
|
+
return gitFacts(path.dirname(file), ["ls-files", "-z", "--", path.basename(file)], env) === "";
|
|
92
|
+
}
|
|
93
|
+
/** How long each of the fact path's git calls may take. */
|
|
94
|
+
export function factsGitBudgetMs(env = process.env) {
|
|
95
|
+
return cooldownMs(env, "CARRICK_FACTS_DIFF_BUDGET_MS", DIFF_BUDGET_MS);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Where `file` differs from `HEAD`, or null when that is not known (or there
|
|
99
|
+
* is no difference). An untracked file counts whole only when `created`: the
|
|
100
|
+
* session did not see the file before this call.
|
|
101
|
+
*/
|
|
102
|
+
export function changesAgainstHead(file, created, env = process.env) {
|
|
103
|
+
try {
|
|
104
|
+
const dir = path.dirname(file);
|
|
105
|
+
const out = gitFacts(dir, ["diff", "--no-ext-diff", "--no-textconv", "--no-color", "-U0", "HEAD", "--", path.basename(file)], env);
|
|
106
|
+
if (out === null)
|
|
107
|
+
return null;
|
|
108
|
+
if (out === "") {
|
|
109
|
+
// No difference from HEAD: a tracked file that reads the same, or one git does not track.
|
|
110
|
+
return created && untrackedFile(file, env) ? { whole: true } : null;
|
|
111
|
+
}
|
|
112
|
+
const lines = [];
|
|
113
|
+
const removed = [];
|
|
114
|
+
let changed = 0;
|
|
115
|
+
for (const header of out.matchAll(/^@@ -\d+(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/gm)) {
|
|
116
|
+
const was = header[1] === undefined ? 1 : Number(header[1]);
|
|
117
|
+
const start = Number(header[2]);
|
|
118
|
+
const now = header[3] === undefined ? 1 : Number(header[3]);
|
|
119
|
+
changed += was + now;
|
|
120
|
+
if (changed > MAX_DIFF_LINES)
|
|
121
|
+
return null;
|
|
122
|
+
for (let at = 0; at < now; at += 1)
|
|
123
|
+
lines.push(start + at);
|
|
124
|
+
// With nothing added, `start` is the line before the removal.
|
|
125
|
+
if (was > 0)
|
|
126
|
+
removed.push(now > 0 ? start : start + 1);
|
|
127
|
+
}
|
|
128
|
+
return lines.length > 0 || removed.length > 0 ? { lines, removed } : null;
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/facts/diff.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,0EAA0E;AAC1E,uEAAuE;AACvE,EAAE;AACF,4EAA4E;AAC5E,+EAA+E;AAC/E,+EAA+E;AAC/E,0EAA0E;AAC1E,8EAA8E;AAC9E,uCAAuC;AACvC,EAAE;AACF,yEAAyE;AACzE,wEAAwE;AACxE,2EAA2E;AAC3E,2BAA2B;AAC3B,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,qEAAqE;AACrE,kCAAkC;AAElC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAE7C,2FAA2F;AAC3F,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC;AAEnC,kJAAkJ;AAClJ,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC;AAIlC;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAW,EAAE,IAAc,EAAE,MAAyB,OAAO,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MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// The off-switch for the fact file: its local reads (`lines.ts`) and its
|
|
2
|
+
// fetch (`fetch.ts`). On by default; off only when CARRICK_FACT_LINES is
|
|
3
|
+
// exactly "0". With it off no hook reads, fetches or writes anything under
|
|
4
|
+
// `.carrick/facts/`.
|
|
5
|
+
/** True unless `CARRICK_FACT_LINES` is exactly `"0"`; unset, empty or any other value is on. */
|
|
6
|
+
export function factsEnabled(env = process.env) {
|
|
7
|
+
return env["CARRICK_FACT_LINES"] !== "0";
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=enabled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enabled.js","sourceRoot":"","sources":["../../src/facts/enabled.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,yEAAyE;AACzE,2EAA2E;AAC3E,qBAAqB;AAErB,gGAAgG;AAChG,MAAM,UAAU,YAAY,CAAC,MAAyB,OAAO,CAAC,GAAG;IAC/D,OAAO,GAAG,CAAC,oBAAoB,CAAC,KAAK,GAAG,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { LocalRepo } from "./store.ts";
|
|
2
|
+
/** After a retriable error, the next trigger may ask again this soon. */
|
|
3
|
+
export declare const FACTS_BUILDING_RETRY_MS = 60000;
|
|
4
|
+
export declare const FACTS_MARKER = "last-facts-refresh";
|
|
5
|
+
/** `retry`: the cloud answered a retriable error (a build in flight). */
|
|
6
|
+
export type RefreshOutcome = "unchanged" | "written" | "retry" | "none";
|
|
7
|
+
export type FactsRefreshOptions = {
|
|
8
|
+
env?: NodeJS.ProcessEnv;
|
|
9
|
+
request?: typeof fetch;
|
|
10
|
+
now?: number;
|
|
11
|
+
};
|
|
12
|
+
/** Each repo of the local index and where it is checked out (`.carrick/index.json`). */
|
|
13
|
+
export declare function localRepos(root: string): Array<{
|
|
14
|
+
name: string;
|
|
15
|
+
path: string;
|
|
16
|
+
remote: string | null;
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* The fact file's repos matched to their checkouts here. A header repo that
|
|
20
|
+
* is a remote (`owner/name`, as the index stores a GitHub repo) maps only to
|
|
21
|
+
* the one checkout whose origin names exactly that; a bare name maps only to
|
|
22
|
+
* the one checkout of exactly that name. No match, or more than one, leaves
|
|
23
|
+
* the repo unmapped: its rows are never read. Two header repos that map to
|
|
24
|
+
* one checkout (`api` and `owner/api`) are both left unmapped.
|
|
25
|
+
*/
|
|
26
|
+
export declare function matchRepos(repos: readonly string[], local: ReturnType<typeof localRepos>): LocalRepo[];
|
|
27
|
+
/** Ask the cloud for the project's fact file and bring the local one up to date. Never throws. */
|
|
28
|
+
export declare function refreshFacts(root: string, options?: FactsRefreshOptions): Promise<RefreshOutcome>;
|
|
29
|
+
/**
|
|
30
|
+
* Start the refresh for `root` detached, at most once per `FACTS_STALE_MS`
|
|
31
|
+
* across every hook and session. Returns whether it started. Never throws.
|
|
32
|
+
*/
|
|
33
|
+
export declare function startFactsRefresh(root: string, options?: {
|
|
34
|
+
env?: NodeJS.ProcessEnv;
|
|
35
|
+
now?: number;
|
|
36
|
+
start?: (command: string, args: string[], env: NodeJS.ProcessEnv) => void;
|
|
37
|
+
}): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* One detached refresh (`refresh-run.ts`): bring the file up to date and,
|
|
40
|
+
* after a retriable error only, let the next trigger ask again a minute on.
|
|
41
|
+
* Every other outcome waits out the cooldown.
|
|
42
|
+
*/
|
|
43
|
+
export declare function runFactsRefresh(root: string, options?: FactsRefreshOptions): Promise<RefreshOutcome>;
|
|
44
|
+
/**
|
|
45
|
+
* After a retriable error, move the claim back so the next trigger, a minute
|
|
46
|
+
* on, asks again rather than waiting out the whole cooldown.
|
|
47
|
+
*/
|
|
48
|
+
export declare function allowEarlyRetry(root: string, env?: NodeJS.ProcessEnv, now?: number): void;
|