carrick 0.3.154 → 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 +10 -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 +31 -122
- 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/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 +2 -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/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/library-claims.js +211 -20
- 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 +39 -4
- package/sidecar/dist/src/position-rows.js +233 -16
- package/sidecar/dist/src/project-loader.js +13 -5
- 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 +33 -145
- package/sidecar/dist/src/type-inferrer.js +68 -524
- package/sidecar/dist/src/types.d.ts +55 -2
- package/sidecar/dist/src/validators.d.ts +800 -142
- package/sidecar/dist/src/validators.js +11 -1
package/dist/hook/stop.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stop.js","sourceRoot":"","sources":["../../src/hook/stop.ts"],"names":[],"mappings":";AACA,6EAA6E;AAC7E,
|
|
1
|
+
{"version":3,"file":"stop.js","sourceRoot":"","sources":["../../src/hook/stop.ts"],"names":[],"mappings":";AACA,6EAA6E;AAC7E,iFAAiF;AACjF,2EAA2E;AAC3E,qDAAqD;AACrD,EAAE;AACF,yEAAyE;AACzE,wEAAwE;AACxE,4EAA4E;AAC5E,8EAA8E;AAC9E,4EAA4E;AAC5E,8EAA8E;AAC9E,kDAAkD;AAClD,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,2EAA2E;AAC3E,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,wEAAwE;AAExE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,cAAc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CAAC;IAED,0EAA0E;IAC1E,4EAA4E;IAC5E,0CAA0C;IAC1C,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC/B,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IAClC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,WAAW,CAAC;IAC3C,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAE1B,yEAAyE;IACzE,0EAA0E;IAC1E,wEAAwE;IACxE,wDAAwD;IACxD,MAAM,IAAI,GAAG,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACjF,MAAM,QAAQ,GAAG,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,wBAAwB,CAAC,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;IACzF,IAAI,QAAQ;QAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAEnC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAC/B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC1B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// SubagentStop hook: marks a sub-agent as ended (carrick#4074).
|
|
3
|
+
//
|
|
4
|
+
// A sub-agent's background re-checks are filed under `<session>.<agent>`, and
|
|
5
|
+
// none of its own hooks runs once it has ended, so an answer landing after
|
|
6
|
+
// that was never read. This writes `<session>.<agent>.ended` in the sessions
|
|
7
|
+
// folder; the main session's carriers and Stop then deliver what the ended
|
|
8
|
+
// agent is owed (`rechecks.ts` `owedFor`, `late.ts` `adoptedLine`). A sub-agent
|
|
9
|
+
// resumed later deletes its own marker with its next hook.
|
|
10
|
+
//
|
|
11
|
+
// It prints nothing and exits 0 on every path. Codex has no sub-agent-end
|
|
12
|
+
// event, so nothing here applies to it.
|
|
13
|
+
//
|
|
14
|
+
// Reference: `docs/reference/task-skills.md`, "What the hooks deliver".
|
|
15
|
+
import { readStdin } from "./stdin.js";
|
|
16
|
+
import { sessionKey } from "./session-key.js";
|
|
17
|
+
import { createLogger } from "../log.js";
|
|
18
|
+
import { markEnded } from "./rechecks.js";
|
|
19
|
+
import { timed } from "./timings.js";
|
|
20
|
+
const log = createLogger("carrick-subagent-stop");
|
|
21
|
+
async function main() {
|
|
22
|
+
let payload;
|
|
23
|
+
try {
|
|
24
|
+
payload = JSON.parse((await readStdin()) || "{}");
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
log("unparseable payload", String(error));
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
// Only a payload that names an agent ends one: the key is then
|
|
31
|
+
// `<session>.<agent>`, never the main session's.
|
|
32
|
+
if (typeof payload.agent_id !== "string" || payload.agent_id === "") {
|
|
33
|
+
log("no agent id in the payload; nothing to mark");
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const key = sessionKey(payload);
|
|
37
|
+
if (!key) {
|
|
38
|
+
log("no session id in the payload; nothing to mark");
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
markEnded(key);
|
|
42
|
+
}
|
|
43
|
+
await timed("subagent-stop", main);
|
|
44
|
+
process.exit(0);
|
|
45
|
+
//# sourceMappingURL=subagent-stop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subagent-stop.js","sourceRoot":"","sources":["../../src/hook/subagent-stop.ts"],"names":[],"mappings":";A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,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export type TimedHook = "session-start" | "post-read" | "post-edit" | "prompt-submit" | "stop" | "subagent-stop";
|
|
2
|
+
export type Outcome = "printed" | "silent" | "error";
|
|
3
|
+
/** One line of the file. */
|
|
4
|
+
export type TimingRecord = {
|
|
5
|
+
hook: TimedHook;
|
|
6
|
+
/** ISO time the hook started. */
|
|
7
|
+
start: string;
|
|
8
|
+
duration_ms: number;
|
|
9
|
+
/** Time spent blocking on a check or re-check, inside `duration_ms`. */
|
|
10
|
+
waited_ms: number;
|
|
11
|
+
outcome: Outcome;
|
|
12
|
+
/** Post-edit only: the edited file, relative to the workspace. */
|
|
13
|
+
file?: string;
|
|
14
|
+
/** Post-edit only: time spent opening the fact file and matching (`facts/lines.ts`), inside `duration_ms`. */
|
|
15
|
+
facts_ms?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Post-edit only, and only when true: the probe's uses-count line was
|
|
18
|
+
* printed because no fact file covered the edited file (counts the
|
|
19
|
+
* fallback carrick#3966 retires).
|
|
20
|
+
*/
|
|
21
|
+
uses_fallback?: true;
|
|
22
|
+
};
|
|
23
|
+
/** The file keeps this many of its last lines. */
|
|
24
|
+
export declare const MAX_LINES = 2000;
|
|
25
|
+
/** The window the status line and the session-start warning read. */
|
|
26
|
+
export declare const WINDOW_MS: number;
|
|
27
|
+
/** A hook whose p90 is above this is named at session start. */
|
|
28
|
+
export declare const SLOW_HOOK_MS = 1000;
|
|
29
|
+
export declare function timingsPath(root: string): string;
|
|
30
|
+
/** What a hook fills in while it runs. */
|
|
31
|
+
export type Timing = {
|
|
32
|
+
/** Where to write; found from the environment when the hook leaves it null. */
|
|
33
|
+
root: string | null;
|
|
34
|
+
/** Post-edit: the edited file, absolute or relative to `root`. */
|
|
35
|
+
file: string | null;
|
|
36
|
+
waitedMs: number;
|
|
37
|
+
/** Time spent on fact lines, when the hook read the fact file. */
|
|
38
|
+
factsMs?: number;
|
|
39
|
+
/** The uses-count line was printed because no fact file covered the file. */
|
|
40
|
+
usesFallback?: boolean;
|
|
41
|
+
};
|
|
42
|
+
/** Append `record` to the file under `root` and trim it to `MAX_LINES`. Never throws. */
|
|
43
|
+
export declare function appendTiming(root: string, record: TimingRecord): void;
|
|
44
|
+
/** The records in the file, oldest first; unreadable lines are skipped. */
|
|
45
|
+
export declare function readTimings(root: string): TimingRecord[];
|
|
46
|
+
/** Nearest-rank percentile of `values` (not empty). */
|
|
47
|
+
export declare function percentile(values: number[], p: number): number;
|
|
48
|
+
export type HookSpeed = {
|
|
49
|
+
hook: TimedHook;
|
|
50
|
+
runs: number;
|
|
51
|
+
p50: number;
|
|
52
|
+
p90: number;
|
|
53
|
+
};
|
|
54
|
+
/** Each hook's own duration over the window, for the hooks that ran in it. */
|
|
55
|
+
export declare function hookSpeeds(root: string, now?: number): HookSpeed[];
|
|
56
|
+
/** The `carrick status` line, or null where no hook has run in the window. */
|
|
57
|
+
export declare function statusTimingsLine(from: string, now?: number): string | null;
|
|
58
|
+
/** Session-start lines: one per hook whose p90 is above `SLOW_HOOK_MS`. Empty when none is. */
|
|
59
|
+
export declare function slowHookLines(root: string, now?: number): string[];
|
|
60
|
+
/**
|
|
61
|
+
* Whether what a hook wrote gave the agent text: any text that is not an empty
|
|
62
|
+
* `additionalContext` emission or whitespace.
|
|
63
|
+
*/
|
|
64
|
+
export declare function gaveText(output: string): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Run one hook's `main` and write its timing line, whether it printed, stayed
|
|
67
|
+
* silent or threw (the error is rethrown). What it printed is read off stdout,
|
|
68
|
+
* so no hook has to report it. The clock starts at `origin`, the process start
|
|
69
|
+
* by default, so Node's start-up and module loading count: the agent waits on
|
|
70
|
+
* them too.
|
|
71
|
+
*/
|
|
72
|
+
export declare function timed(hook: TimedHook, run: (timing: Timing) => Promise<void>, origin?: number): Promise<void>;
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
// How long each hook held the agent, written down so a slow one is seen.
|
|
2
|
+
//
|
|
3
|
+
// Every hook invocation appends one line to `<root>/.carrick/hook-timings.jsonl`:
|
|
4
|
+
// which hook, when it started, how long it ran, how much of that it spent
|
|
5
|
+
// blocking on a check, and what it did. No code, no file contents, no path
|
|
6
|
+
// beyond the workspace-relative edited file. The file keeps its last
|
|
7
|
+
// `MAX_LINES` lines. `carrick status` prints the p50/p90 per hook from it, and
|
|
8
|
+
// the session start names a hook whose p90 over the last 7 days is above
|
|
9
|
+
// `SLOW_HOOK_MS`.
|
|
10
|
+
//
|
|
11
|
+
// A write that fails is dropped: a hook never fails because its own timing
|
|
12
|
+
// could not be kept.
|
|
13
|
+
import fs from "node:fs";
|
|
14
|
+
import path from "node:path";
|
|
15
|
+
import { performance } from "node:perf_hooks";
|
|
16
|
+
import { initialisedRoot } from "../init/outdated.js";
|
|
17
|
+
import { writeAtomic } from "./reuse.js";
|
|
18
|
+
/** The file keeps this many of its last lines. */
|
|
19
|
+
export const MAX_LINES = 2000;
|
|
20
|
+
/** The window the status line and the session-start warning read. */
|
|
21
|
+
export const WINDOW_MS = 7 * 24 * 60 * 60_000;
|
|
22
|
+
/** A hook whose p90 is above this is named at session start. */
|
|
23
|
+
export const SLOW_HOOK_MS = 1000;
|
|
24
|
+
const ORDER = ["session-start", "post-read", "post-edit", "prompt-submit", "stop", "subagent-stop"];
|
|
25
|
+
export function timingsPath(root) {
|
|
26
|
+
return path.join(root, ".carrick", "hook-timings.jsonl");
|
|
27
|
+
}
|
|
28
|
+
/** Append `record` to the file under `root` and trim it to `MAX_LINES`. Never throws. */
|
|
29
|
+
export function appendTiming(root, record) {
|
|
30
|
+
const file = timingsPath(root);
|
|
31
|
+
try {
|
|
32
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
33
|
+
fs.appendFileSync(file, `${JSON.stringify(record)}\n`);
|
|
34
|
+
const lines = fs.readFileSync(file, "utf8").split("\n").filter(Boolean);
|
|
35
|
+
if (lines.length > MAX_LINES)
|
|
36
|
+
writeAtomic(file, `${lines.slice(-MAX_LINES).join("\n")}\n`);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
// Dropped, as above.
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** The records in the file, oldest first; unreadable lines are skipped. */
|
|
43
|
+
export function readTimings(root) {
|
|
44
|
+
let text;
|
|
45
|
+
try {
|
|
46
|
+
text = fs.readFileSync(timingsPath(root), "utf8");
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
const out = [];
|
|
52
|
+
for (const line of text.split("\n")) {
|
|
53
|
+
if (!line)
|
|
54
|
+
continue;
|
|
55
|
+
try {
|
|
56
|
+
const row = JSON.parse(line);
|
|
57
|
+
if (typeof row.hook === "string" && typeof row.duration_ms === "number" && typeof row.start === "string") {
|
|
58
|
+
out.push(row);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// A torn line.
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
67
|
+
/** Nearest-rank percentile of `values` (not empty). */
|
|
68
|
+
export function percentile(values, p) {
|
|
69
|
+
const sorted = [...values].sort((a, b) => a - b);
|
|
70
|
+
return sorted[Math.max(0, Math.ceil((p / 100) * sorted.length) - 1)];
|
|
71
|
+
}
|
|
72
|
+
/** Each hook's own duration over the window, for the hooks that ran in it. */
|
|
73
|
+
export function hookSpeeds(root, now = Date.now()) {
|
|
74
|
+
const byHook = new Map();
|
|
75
|
+
for (const row of readTimings(root)) {
|
|
76
|
+
const at = Date.parse(row.start);
|
|
77
|
+
if (!Number.isFinite(at) || now - at > WINDOW_MS)
|
|
78
|
+
continue;
|
|
79
|
+
byHook.set(row.hook, [...(byHook.get(row.hook) ?? []), row.duration_ms]);
|
|
80
|
+
}
|
|
81
|
+
return ORDER.filter((hook) => byHook.has(hook)).map((hook) => {
|
|
82
|
+
const values = byHook.get(hook);
|
|
83
|
+
return { hook, runs: values.length, p50: percentile(values, 50), p90: percentile(values, 90) };
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function seconds(ms) {
|
|
87
|
+
return (ms / 1000).toFixed(1);
|
|
88
|
+
}
|
|
89
|
+
/** The `carrick status` line, or null where no hook has run in the window. */
|
|
90
|
+
export function statusTimingsLine(from, now = Date.now()) {
|
|
91
|
+
const root = initialisedRoot(from);
|
|
92
|
+
if (!root)
|
|
93
|
+
return null;
|
|
94
|
+
const speeds = hookSpeeds(root, now);
|
|
95
|
+
if (speeds.length === 0)
|
|
96
|
+
return null;
|
|
97
|
+
const each = speeds.map((s) => `${s.hook} ${seconds(s.p50)}/${seconds(s.p90)}`);
|
|
98
|
+
return `Hook run time, last 7 days (p50/p90, seconds): ${each.join(", ")}`;
|
|
99
|
+
}
|
|
100
|
+
/** Session-start lines: one per hook whose p90 is above `SLOW_HOOK_MS`. Empty when none is. */
|
|
101
|
+
export function slowHookLines(root, now = Date.now()) {
|
|
102
|
+
return hookSpeeds(root, now)
|
|
103
|
+
.filter((s) => s.p90 > SLOW_HOOK_MS)
|
|
104
|
+
.map((s) => `Carrick's ${s.hook} hook has taken ${seconds(s.p90)} s (p90) in recent turns; run \`carrick status\`.`);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Whether what a hook wrote gave the agent text: any text that is not an empty
|
|
108
|
+
* `additionalContext` emission or whitespace.
|
|
109
|
+
*/
|
|
110
|
+
export function gaveText(output) {
|
|
111
|
+
const text = output.trim();
|
|
112
|
+
if (!text)
|
|
113
|
+
return false;
|
|
114
|
+
try {
|
|
115
|
+
const context = JSON.parse(text)
|
|
116
|
+
?.hookSpecificOutput?.additionalContext;
|
|
117
|
+
if (typeof context === "string")
|
|
118
|
+
return context.trim().length > 0;
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
// Not JSON: plain text, which is text.
|
|
122
|
+
}
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Run one hook's `main` and write its timing line, whether it printed, stayed
|
|
127
|
+
* silent or threw (the error is rethrown). What it printed is read off stdout,
|
|
128
|
+
* so no hook has to report it. The clock starts at `origin`, the process start
|
|
129
|
+
* by default, so Node's start-up and module loading count: the agent waits on
|
|
130
|
+
* them too.
|
|
131
|
+
*/
|
|
132
|
+
export async function timed(hook, run, origin = performance.timeOrigin) {
|
|
133
|
+
const timing = { root: null, file: null, waitedMs: 0 };
|
|
134
|
+
let output = "";
|
|
135
|
+
const write = process.stdout.write;
|
|
136
|
+
process.stdout.write = ((...args) => {
|
|
137
|
+
const chunk = args[0];
|
|
138
|
+
output += typeof chunk === "string" ? chunk : Buffer.from(chunk).toString("utf8");
|
|
139
|
+
return write.apply(process.stdout, args);
|
|
140
|
+
});
|
|
141
|
+
let failed = false;
|
|
142
|
+
try {
|
|
143
|
+
await run(timing);
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
failed = true;
|
|
147
|
+
throw error;
|
|
148
|
+
}
|
|
149
|
+
finally {
|
|
150
|
+
process.stdout.write = write;
|
|
151
|
+
try {
|
|
152
|
+
const root = timing.root ?? initialisedRoot(process.env["CLAUDE_PROJECT_DIR"] ?? process.cwd());
|
|
153
|
+
if (root) {
|
|
154
|
+
const record = {
|
|
155
|
+
hook,
|
|
156
|
+
start: new Date(origin).toISOString(),
|
|
157
|
+
duration_ms: Math.max(0, Math.round(Date.now() - origin)),
|
|
158
|
+
waited_ms: Math.round(timing.waitedMs),
|
|
159
|
+
outcome: failed ? "error" : gaveText(output) ? "printed" : "silent",
|
|
160
|
+
};
|
|
161
|
+
if (timing.factsMs !== undefined)
|
|
162
|
+
record.facts_ms = timing.factsMs;
|
|
163
|
+
if (timing.usesFallback)
|
|
164
|
+
record.uses_fallback = true;
|
|
165
|
+
if (timing.file)
|
|
166
|
+
record.file = path.isAbsolute(timing.file) ? path.relative(root, timing.file) : timing.file;
|
|
167
|
+
appendTiming(root, record);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
171
|
+
// Dropped.
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=timings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timings.js","sourceRoot":"","sources":["../../src/hook/timings.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,kFAAkF;AAClF,0EAA0E;AAC1E,2EAA2E;AAC3E,qEAAqE;AACrE,+EAA+E;AAC/E,yEAAyE;AACzE,kBAAkB;AAClB,EAAE;AACF,2EAA2E;AAC3E,qBAAqB;AAErB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AA2BzC,kDAAkD;AAClD,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC;AAC9B,qEAAqE;AACrE,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;AAC9C,gEAAgE;AAChE,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC;AAEjC,MAAM,KAAK,GAAgB,CAAC,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;AAEjH,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,oBAAoB,CAAC,CAAC;AAC3D,CAAC;AAeD,yFAAyF;AACzF,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,MAAoB;IAC7D,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,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,CAAC;gBACrD,IAAI,MAAM,CAAC,IAAI;oBAAE,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;gBAC7G,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,WAAW;QACb,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/hook/user-prompt.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// UserPromptSubmit hook
|
|
3
|
-
//
|
|
4
|
-
// task added (carrick#3436), as the Stop hook does not.
|
|
2
|
+
// UserPromptSubmit hook: the finished background re-checks no other hook has
|
|
3
|
+
// delivered yet. It names no function a task added (carrick#3436).
|
|
5
4
|
//
|
|
6
|
-
//
|
|
7
|
-
// `PreToolUse`, `PostToolUse`, `SessionStart`,
|
|
8
|
-
// `SubagentStart`, and warns "this event cannot emit
|
|
9
|
-
// every other one (`codex-rs/hooks/src/engine/discovery.rs`).
|
|
10
|
-
// hook can reach the model only by refusing to let the turn
|
|
11
|
-
//
|
|
12
|
-
//
|
|
5
|
+
// On Codex (carrick#1335) it stands in for Stop. Codex accepts
|
|
6
|
+
// `additionalContext` on `PreToolUse`, `PostToolUse`, `SessionStart`,
|
|
7
|
+
// `UserPromptSubmit` and `SubagentStart`, and warns "this event cannot emit
|
|
8
|
+
// additionalContext" for every other one (`codex-rs/hooks/src/engine/discovery.rs`).
|
|
9
|
+
// A Codex `Stop` hook can reach the model only by refusing to let the turn
|
|
10
|
+
// end, which is a block.
|
|
11
|
+
//
|
|
12
|
+
// On Claude Code it carries what landed after Stop returned: Stop never waits
|
|
13
|
+
// for a re-check (hook-wording audit T2), so an answer that lands later comes
|
|
14
|
+
// with the next prompt, unless a tool hook carried it first.
|
|
13
15
|
//
|
|
14
16
|
// What that costs: an answer arrives with the NEXT prompt rather than at the
|
|
15
17
|
// end of the task that earned it, and a run that ends on that task never sees
|
|
@@ -20,11 +22,13 @@
|
|
|
20
22
|
//
|
|
21
23
|
// Reference: `docs/reference/task-skills.md`, "What the hooks deliver".
|
|
22
24
|
import { readStdin } from "./stdin.js";
|
|
25
|
+
import { sessionKey } from "./session-key.js";
|
|
23
26
|
import { createLogger } from "../log.js";
|
|
24
27
|
import { resolveChannel } from "../channel.js";
|
|
25
28
|
import { deliverLate } from "./late.js";
|
|
26
29
|
import { initialisedRoot, throttledVersionMismatch } from "../init/outdated.js";
|
|
27
30
|
import { currentVersion } from "../update.js";
|
|
31
|
+
import { timed } from "./timings.js";
|
|
28
32
|
const log = createLogger("carrick-user-prompt");
|
|
29
33
|
/**
|
|
30
34
|
* The one channel a `UserPromptSubmit` hook has that the model reads.
|
|
@@ -55,12 +59,12 @@ async function main() {
|
|
|
55
59
|
log("unparseable payload", String(error));
|
|
56
60
|
return;
|
|
57
61
|
}
|
|
58
|
-
const session = payload
|
|
62
|
+
const session = sessionKey(payload);
|
|
59
63
|
if (!session) {
|
|
60
64
|
log("no session id in the payload; nothing to look up");
|
|
61
65
|
return;
|
|
62
66
|
}
|
|
63
|
-
// Finished background re-checks
|
|
67
|
+
// Finished background re-checks no hook has delivered yet.
|
|
64
68
|
const parts = [...deliverLate(session)];
|
|
65
69
|
const root = initialisedRoot(process.env["CLAUDE_PROJECT_DIR"] ?? process.cwd());
|
|
66
70
|
// The same backstop the other hooks carry: this `carrick` is not the one
|
|
@@ -72,6 +76,6 @@ async function main() {
|
|
|
72
76
|
return;
|
|
73
77
|
process.stdout.write(emission(parts.join("\n\n")));
|
|
74
78
|
}
|
|
75
|
-
await main
|
|
79
|
+
await timed("prompt-submit", main);
|
|
76
80
|
process.exit(0);
|
|
77
81
|
//# sourceMappingURL=user-prompt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-prompt.js","sourceRoot":"","sources":["../../src/hook/user-prompt.ts"],"names":[],"mappings":";AACA,
|
|
1
|
+
{"version":3,"file":"user-prompt.js","sourceRoot":"","sources":["../../src/hook/user-prompt.ts"],"names":[],"mappings":";AACA,6EAA6E;AAC7E,mEAAmE;AACnE,EAAE;AACF,+DAA+D;AAC/D,sEAAsE;AACtE,4EAA4E;AAC5E,qFAAqF;AACrF,2EAA2E;AAC3E,yBAAyB;AACzB,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,6DAA6D;AAC7D,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,qDAAqD;AACrD,EAAE;AACF,+EAA+E;AAC/E,8BAA8B;AAC9B,EAAE;AACF,wEAAwE;AAExE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,MAAM,GAAG,GAAG,YAAY,CAAC,qBAAqB,CAAC,CAAC;AAOhD;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAe;IACtC,OAAO,IAAI,CAAC,SAAS,CAAC;QACpB,kBAAkB,EAAE;YAClB,aAAa,EAAE,kBAAkB;YACjC,iBAAiB,EAAE,OAAO;SAC3B;KACF,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,0EAA0E;IAC1E,IAAI,cAAc,CAAC,EAAE,cAA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C,IAAI,CAAC,CAAC,CAAC,CAAC"}
|
package/dist/hook/worktree.d.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/** The nearest directory at or above `start` holding a `.git`, and whether it is a linked worktree (`.git` is a file). */
|
|
2
|
+
export declare function checkoutOf(start: string): {
|
|
3
|
+
top: string;
|
|
4
|
+
linked: boolean;
|
|
5
|
+
} | null;
|
|
6
|
+
/**
|
|
7
|
+
* The git directory every worktree of the checkout at `top` shares: `top/.git`
|
|
8
|
+
* itself, or for a linked worktree the one its `.git` file and `commondir`
|
|
9
|
+
* point at. Read from the files, no git run. Null when there is none.
|
|
10
|
+
*/
|
|
11
|
+
export declare function commonGitDir(top: string): string | null;
|
|
1
12
|
/** The top folder of the linked worktree `file` sits in, or null in the main checkout or none (carrick#3595). */
|
|
2
13
|
export declare function linkedCheckoutTop(file: string): string | null;
|
|
3
14
|
/** Whether a linked worktree top recorded at edit time has been removed. */
|
package/dist/hook/worktree.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import fs from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
/** The nearest directory at or above `start` holding a `.git`, and whether it is a linked worktree (`.git` is a file). */
|
|
8
|
-
function checkoutOf(start) {
|
|
8
|
+
export function checkoutOf(start) {
|
|
9
9
|
let dir = start;
|
|
10
10
|
for (;;) {
|
|
11
11
|
try {
|
|
@@ -21,6 +21,32 @@ function checkoutOf(start) {
|
|
|
21
21
|
dir = parent;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* The git directory every worktree of the checkout at `top` shares: `top/.git`
|
|
26
|
+
* itself, or for a linked worktree the one its `.git` file and `commondir`
|
|
27
|
+
* point at. Read from the files, no git run. Null when there is none.
|
|
28
|
+
*/
|
|
29
|
+
export function commonGitDir(top) {
|
|
30
|
+
try {
|
|
31
|
+
const dotGit = path.join(top, ".git");
|
|
32
|
+
if (fs.statSync(dotGit).isDirectory())
|
|
33
|
+
return dotGit;
|
|
34
|
+
const pointer = fs.readFileSync(dotGit, "utf8").match(/^gitdir:\s*(.+)$/m)?.[1]?.trim();
|
|
35
|
+
if (!pointer)
|
|
36
|
+
return null;
|
|
37
|
+
const gitdir = path.resolve(top, pointer);
|
|
38
|
+
try {
|
|
39
|
+
return path.resolve(gitdir, fs.readFileSync(path.join(gitdir, "commondir"), "utf8").trim());
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
const at = gitdir.lastIndexOf(`${path.sep}worktrees${path.sep}`);
|
|
43
|
+
return at >= 0 ? gitdir.slice(0, at) : null;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
24
50
|
/** The top folder of the linked worktree `file` sits in, or null in the main checkout or none (carrick#3595). */
|
|
25
51
|
export function linkedCheckoutTop(file) {
|
|
26
52
|
const own = checkoutOf(path.dirname(file));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worktree.js","sourceRoot":"","sources":["../../src/hook/worktree.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,6EAA6E;AAC7E,8EAA8E;AAC9E,4DAA4D;AAE5D,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,0HAA0H;AAC1H,
|
|
1
|
+
{"version":3,"file":"worktree.js","sourceRoot":"","sources":["../../src/hook/worktree.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,6EAA6E;AAC7E,8EAA8E;AAC9E,4DAA4D;AAE5D,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,0HAA0H;AAC1H,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,IAAI,GAAG,GAAG,KAAK,CAAC;IAChB,SAAS,CAAC;QACR,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,CA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C,GAAG,EAAE,CAAC,CAAC;YACjE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC9C,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,iHAAiH;AACjH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3C,OAAO,GAAG,KAAK,IAAI,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AACrD,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;AAChD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,GAAkB;IAC9D,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9C,IAAI,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IACpD,MAAM,GAAG,GAAG,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAClD,OAAO,GAAG,KAAK,IAAI,IAAI,GAAG,CAAC,GAAG,KAAK,MAAM,CAAC,GAAG,CAAC;AAChD,CAAC"}
|
|
@@ -28,6 +28,12 @@ export declare function withoutExcludeBlock(existing: string): {
|
|
|
28
28
|
* wrote, and taking it out leaves the owner's line where it was.
|
|
29
29
|
*/
|
|
30
30
|
export declare function withExcludeBlock(existing: string | null, relatives: string[]): string;
|
|
31
|
+
/**
|
|
32
|
+
* What `git` prints for these arguments in this folder, or null when it says
|
|
33
|
+
* nothing (or runs past `timeoutMs`). `env`, when given, is git's whole
|
|
34
|
+
* environment.
|
|
35
|
+
*/
|
|
36
|
+
export declare function git(repo: string, args: string[], timeoutMs?: number, env?: NodeJS.ProcessEnv): string | null;
|
|
31
37
|
/** Whether this folder is the top of a git repository, not a folder inside one. */
|
|
32
38
|
export declare function ownRepository(repo: string): boolean;
|
|
33
39
|
/**
|
package/dist/init/repo-copies.js
CHANGED
|
@@ -96,9 +96,13 @@ export function withExcludeBlock(existing, relatives) {
|
|
|
96
96
|
return body;
|
|
97
97
|
return `${EXCLUDE_BEGIN}\n${relatives.map(asPattern).join("\n")}\n${EXCLUDE_END}\n${body}`;
|
|
98
98
|
}
|
|
99
|
-
/**
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
/**
|
|
100
|
+
* What `git` prints for these arguments in this folder, or null when it says
|
|
101
|
+
* nothing (or runs past `timeoutMs`). `env`, when given, is git's whole
|
|
102
|
+
* environment.
|
|
103
|
+
*/
|
|
104
|
+
export function git(repo, args, timeoutMs = 5000, env) {
|
|
105
|
+
const result = spawnSync("git", ["-C", repo, ...args], { encoding: "utf8", timeout: timeoutMs, maxBuffer: 4 * 1024 * 1024, ...(env ? { env } : {}) });
|
|
102
106
|
if (result.status !== 0 || typeof result.stdout !== "string")
|
|
103
107
|
return null;
|
|
104
108
|
return result.stdout;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo-copies.js","sourceRoot":"","sources":["../../src/init/repo-copies.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,kBAAkB;AAClB,EAAE;AACF,2EAA2E;AAC3E,wEAAwE;AACxE,4EAA4E;AAC5E,8EAA8E;AAC9E,2EAA2E;AAC3E,oEAAoE;AACpE,2EAA2E;AAC3E,mEAAmE;AACnE,EAAE;AACF,0EA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ZodObject<{
|
|
|
97
97
|
directory: string;
|
|
98
98
|
}[];
|
|
99
99
|
}[];
|
|
100
|
+
missing: string[];
|
|
100
101
|
repos_detected_by: string;
|
|
101
102
|
repos_added: string[];
|
|
102
103
|
repos_excluded: string[];
|
|
103
|
-
missing: string[];
|
|
104
104
|
parent_proposal: {
|
|
105
105
|
repos: string[];
|
|
106
106
|
directory: string;
|
|
@@ -124,10 +124,10 @@ declare const proposal: z.ZodObject<{
|
|
|
124
124
|
directory: string;
|
|
125
125
|
}[];
|
|
126
126
|
}[];
|
|
127
|
+
missing: string[];
|
|
127
128
|
repos_detected_by: string;
|
|
128
129
|
repos_added: string[];
|
|
129
130
|
repos_excluded: string[];
|
|
130
|
-
missing: string[];
|
|
131
131
|
parent_proposal: {
|
|
132
132
|
repos: string[];
|
|
133
133
|
directory: string;
|
package/dist/init/repos.js
CHANGED
|
@@ -3,6 +3,7 @@ import fs from "node:fs";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { spawnSync } from "node:child_process";
|
|
5
5
|
import { z } from "zod";
|
|
6
|
+
import { splitRemote } from "../git-remote.js";
|
|
6
7
|
import { nativeEnv, resolveNativeBinary } from "../native.js";
|
|
7
8
|
import { versionFile } from "./outdated.js";
|
|
8
9
|
import { excludedRepos } from "./workspace-file.js";
|
|
@@ -225,40 +226,6 @@ function sshHostname(host) {
|
|
|
225
226
|
return line ? line[1] : null;
|
|
226
227
|
}
|
|
227
228
|
const DEFAULT_PROBE = { remote: gitOrigin, sshHostname };
|
|
228
|
-
/** The host and `owner/repo` a remote names, in either spelling git accepts. */
|
|
229
|
-
function splitRemote(remote) {
|
|
230
|
-
let host;
|
|
231
|
-
let repoPath;
|
|
232
|
-
let ssh;
|
|
233
|
-
// The two spellings are told apart by the `//`, not by whether `new URL`
|
|
234
|
-
// throws: a host alias with no user (`host-work:owner/repo`) parses as a URL
|
|
235
|
-
// whose scheme is the host, and would otherwise be read as neither form.
|
|
236
|
-
if (/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(remote)) {
|
|
237
|
-
let url;
|
|
238
|
-
try {
|
|
239
|
-
url = new URL(remote);
|
|
240
|
-
}
|
|
241
|
-
catch {
|
|
242
|
-
return null;
|
|
243
|
-
}
|
|
244
|
-
if (!["https:", "http:", "ssh:"].includes(url.protocol))
|
|
245
|
-
return null;
|
|
246
|
-
host = url.hostname;
|
|
247
|
-
repoPath = url.pathname;
|
|
248
|
-
ssh = url.protocol === "ssh:";
|
|
249
|
-
}
|
|
250
|
-
else {
|
|
251
|
-
// The scp spelling `[user@]host:owner/repo`, which is not a URL.
|
|
252
|
-
const scp = /^(?:[^@\s/]+@)?([^:/\s]+):(\S+)$/.exec(remote);
|
|
253
|
-
if (!scp)
|
|
254
|
-
return null;
|
|
255
|
-
host = scp[1];
|
|
256
|
-
repoPath = scp[2];
|
|
257
|
-
ssh = true;
|
|
258
|
-
}
|
|
259
|
-
const name = repoPath.replace(/^\/+/, "").replace(/\.git$/, "");
|
|
260
|
-
return { host, name: /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(name) ? name : null, ssh };
|
|
261
|
-
}
|
|
262
229
|
/**
|
|
263
230
|
* Only GitHub origin identities are sent to the workspace metadata read.
|
|
264
231
|
*
|