carrick 0.3.132 → 0.3.134
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.d.ts +13 -1
- package/dist/cli.js +24 -3
- package/dist/cli.js.map +1 -1
- package/dist/contract.d.ts +18 -0
- package/dist/contract.js +18 -0
- package/dist/contract.js.map +1 -1
- package/dist/hook/post-edit.d.ts +10 -0
- package/dist/hook/post-edit.js +109 -19
- package/dist/hook/post-edit.js.map +1 -1
- package/dist/hook/refresh.d.ts +23 -3
- package/dist/hook/refresh.js +48 -6
- package/dist/hook/refresh.js.map +1 -1
- package/dist/hook/reuse.d.ts +7 -21
- package/dist/hook/reuse.js +23 -36
- package/dist/hook/reuse.js.map +1 -1
- package/dist/hook/session-start.d.ts +10 -1
- package/dist/hook/session-start.js +69 -6
- package/dist/hook/session-start.js.map +1 -1
- package/dist/hook/stop.js.map +1 -1
- package/dist/init/agents-section.d.ts +17 -0
- package/dist/init/agents-section.js +88 -0
- package/dist/init/agents-section.js.map +1 -0
- package/dist/init/codex.js +13 -2
- package/dist/init/codex.js.map +1 -1
- package/dist/init/doctor.js +4 -0
- package/dist/init/doctor.js.map +1 -1
- package/dist/init/hosted.d.ts +1 -0
- package/dist/init/hosted.js +4 -1
- package/dist/init/hosted.js.map +1 -1
- package/dist/init/remove.d.ts +2 -0
- package/dist/init/remove.js +25 -1
- package/dist/init/remove.js.map +1 -1
- package/dist/init/repo-copies.js +3 -1
- package/dist/init/repo-copies.js.map +1 -1
- package/dist/init/run.d.ts +1 -1
- package/dist/init/run.js +22 -5
- package/dist/init/run.js.map +1 -1
- package/dist/init/settings.d.ts +2 -1
- package/dist/init/settings.js +32 -6
- package/dist/init/settings.js.map +1 -1
- package/dist/init/task-skills.d.ts +22 -1
- package/dist/init/task-skills.js +65 -1
- package/dist/init/task-skills.js.map +1 -1
- package/dist/render.d.ts +41 -16
- package/dist/render.js +91 -102
- package/dist/render.js.map +1 -1
- package/package.json +10 -9
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/sidecar/dist/src/capture/anchors.js +18 -1
- package/sidecar/dist/src/capture/api.d.ts +17 -4
- package/sidecar/dist/src/capture/check-workspace.js +1 -1
- package/sidecar/dist/src/capture/check.d.ts +44 -0
- package/sidecar/dist/src/capture/check.js +112 -10
- package/sidecar/dist/src/capture/installed-package.d.ts +5 -0
- package/sidecar/dist/src/capture/installed-package.js +64 -6
- package/sidecar/dist/src/capture/paths-rewrite.js +3 -3
- package/sidecar/dist/src/capture/result-label.d.ts +42 -0
- package/sidecar/dist/src/capture/result-label.js +91 -0
- package/sidecar/dist/src/capture/self-check.js +13 -2
- package/sidecar/dist/src/index.js +116 -4
- package/sidecar/dist/src/infer-cache.d.ts +125 -0
- package/sidecar/dist/src/infer-cache.js +244 -0
- package/sidecar/dist/src/library-claims.js +42 -4
- package/sidecar/dist/src/node-index.d.ts +53 -0
- package/sidecar/dist/src/node-index.js +100 -0
- package/sidecar/dist/src/project-loader.d.ts +11 -0
- package/sidecar/dist/src/project-loader.js +15 -0
- package/sidecar/dist/src/result-candidates.d.ts +28 -0
- package/sidecar/dist/src/result-candidates.js +209 -0
- package/sidecar/dist/src/type-inferrer.d.ts +27 -0
- package/sidecar/dist/src/type-inferrer.js +175 -43
- package/sidecar/dist/src/types.d.ts +52 -0
- package/sidecar/dist/src/unwidened.js +10 -1
- package/sidecar/dist/src/validators.d.ts +919 -197
- package/sidecar/dist/src/validators.js +32 -0
- package/templates/skills/carrick-reuse.md +11 -0
package/dist/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,EAAE;IACxE,MAAM,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;IAC7B,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AAC,MAAM,CAAC;IAC7B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7D,MAAM,IAAI,GAAG,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC;IAClC,MAAM,IAAI,GACR,IAAI,GAAG,CAAC;QACN,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,OAAO;QACxC,CAAC,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;YAClB,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,EAAE;YAC/B,CAAC,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC;IAClB,OAAO,4BAA4B,KAAK,gBAAgB,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,kHAAkH,CAAC;AAC5M,CAAC"}
|
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Whether Codex, not Claude Code, is running this hook.
|
|
4
|
+
*
|
|
5
|
+
* Claude Code sets `CLAUDE_PROJECT_DIR` for every hook and Codex does not (its
|
|
6
|
+
* hook environment is the plugin variables only). A by-hand run has no payload
|
|
7
|
+
* on stdin, so it reads as neither and keeps the plain print.
|
|
8
|
+
*/
|
|
9
|
+
export declare function runByCodex(env: NodeJS.ProcessEnv, stdin: string): boolean;
|
|
10
|
+
/** The shape Codex's `parse_session_start` takes the model context from. */
|
|
11
|
+
export declare function codexEmission(context: string): string;
|
|
@@ -11,13 +11,18 @@
|
|
|
11
11
|
// service could not classify, and nothing about whether a contract holds, so
|
|
12
12
|
// the line cannot be confused with the hook or LSP delivery of a verdict.
|
|
13
13
|
// `CARRICK_CHANNEL=off` silences it along with everything else.
|
|
14
|
+
//
|
|
15
|
+
// Codex runs the same entry (`codexHooks`, carrick#2848). Its parser reads a
|
|
16
|
+
// SessionStart hook's context from `hookSpecificOutput.additionalContext`
|
|
17
|
+
// (`codex-rs/hooks/src/engine/output_parser.rs`, `parse_session_start`), so
|
|
18
|
+
// there the lines go out as that JSON. Claude Code keeps the plain print.
|
|
14
19
|
import { status } from "../cli.js";
|
|
15
20
|
import { resolveChannel } from "../channel.js";
|
|
16
21
|
import { createLogger } from "../log.js";
|
|
17
|
-
import { renderSessionStart } from "../render.js";
|
|
22
|
+
import { CHECK_BEFORE_DONE, renderSessionStart } from "../render.js";
|
|
18
23
|
import { resolveRoot, rootNote } from "../root.js";
|
|
19
24
|
import { currentVersion, readUpdateState, suppressed, updateNotice } from "../update.js";
|
|
20
|
-
import { refreshInBackground } from "./refresh.js";
|
|
25
|
+
import { forwardInBackground, refreshInBackground } from "./refresh.js";
|
|
21
26
|
import { versionMismatch } from "../init/outdated.js";
|
|
22
27
|
const log = createLogger("carrick-session");
|
|
23
28
|
/**
|
|
@@ -37,11 +42,45 @@ function versionLine() {
|
|
|
37
42
|
const state = readUpdateState(process.env);
|
|
38
43
|
return updateNotice(currentVersion(), state?.latest ?? null, { env: process.env });
|
|
39
44
|
}
|
|
45
|
+
async function readStdin() {
|
|
46
|
+
if (process.stdin.isTTY)
|
|
47
|
+
return "";
|
|
48
|
+
const chunks = [];
|
|
49
|
+
for await (const chunk of process.stdin)
|
|
50
|
+
chunks.push(Buffer.from(chunk));
|
|
51
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Whether Codex, not Claude Code, is running this hook.
|
|
55
|
+
*
|
|
56
|
+
* Claude Code sets `CLAUDE_PROJECT_DIR` for every hook and Codex does not (its
|
|
57
|
+
* hook environment is the plugin variables only). A by-hand run has no payload
|
|
58
|
+
* on stdin, so it reads as neither and keeps the plain print.
|
|
59
|
+
*/
|
|
60
|
+
export function runByCodex(env, stdin) {
|
|
61
|
+
if (env["CLAUDE_PROJECT_DIR"])
|
|
62
|
+
return false;
|
|
63
|
+
try {
|
|
64
|
+
const payload = JSON.parse(stdin);
|
|
65
|
+
return payload.hook_event_name === "SessionStart";
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/** The shape Codex's `parse_session_start` takes the model context from. */
|
|
72
|
+
export function codexEmission(context) {
|
|
73
|
+
return JSON.stringify({
|
|
74
|
+
hookSpecificOutput: { hookEventName: "SessionStart", additionalContext: context },
|
|
75
|
+
});
|
|
76
|
+
}
|
|
40
77
|
async function main() {
|
|
41
78
|
if (resolveChannel({ hooksInstalled: true }).channel === "off") {
|
|
42
79
|
log("CARRICK_CHANNEL=off; printing nothing");
|
|
43
80
|
return;
|
|
44
81
|
}
|
|
82
|
+
const lines = [];
|
|
83
|
+
const codex = runByCodex(process.env, await readStdin());
|
|
45
84
|
const choice = resolveRoot({
|
|
46
85
|
clientRoot: process.cwd(),
|
|
47
86
|
projectDir: process.env["CLAUDE_PROJECT_DIR"] ?? null,
|
|
@@ -55,7 +94,7 @@ async function main() {
|
|
|
55
94
|
// run its first scan, which is the worst moment to be on a stale build.
|
|
56
95
|
const version = versionLine();
|
|
57
96
|
if (version)
|
|
58
|
-
|
|
97
|
+
lines.push(version);
|
|
59
98
|
// And the other mismatch: not "a newer one is published" but "the one
|
|
60
99
|
// answering this hook is not the one that wrote these files". Unthrottled,
|
|
61
100
|
// because this runs once per session and the agent about to work here is the
|
|
@@ -63,16 +102,19 @@ async function main() {
|
|
|
63
102
|
if (choice.markerFound) {
|
|
64
103
|
const mismatch = versionMismatch(choice.root, currentVersion());
|
|
65
104
|
if (mismatch)
|
|
66
|
-
|
|
105
|
+
lines.push(mismatch);
|
|
67
106
|
}
|
|
68
107
|
const outcome = await status({ cwd: choice.root, workspace: choice.markerFound ? choice.root : null });
|
|
69
108
|
if (!outcome.result) {
|
|
70
109
|
log("no answer", outcome.failure ?? "");
|
|
110
|
+
flush(lines, codex);
|
|
71
111
|
return;
|
|
72
112
|
}
|
|
73
113
|
// Ends with a newline: this is a line a developer also runs by hand and
|
|
74
114
|
// compares against `carrick status`, and that one ends its output properly.
|
|
75
|
-
|
|
115
|
+
lines.push(renderSessionStart(outcome.result));
|
|
116
|
+
if (!outcome.result.error)
|
|
117
|
+
lines.push(CHECK_BEFORE_DONE);
|
|
76
118
|
// The hosted index the first CI scan writes is picked up here rather than by
|
|
77
119
|
// a command the developer has to remember (carrick#955). Detached and
|
|
78
120
|
// unwaited: a refresh is minutes of work and a hook is not.
|
|
@@ -84,7 +126,28 @@ async function main() {
|
|
|
84
126
|
log("background refresh not started", String(error));
|
|
85
127
|
}
|
|
86
128
|
if (started)
|
|
87
|
-
|
|
129
|
+
lines.push(started);
|
|
130
|
+
// Otherwise move the hosted index forward along this checkout's history, so
|
|
131
|
+
// the next `check --changed` judges the branch and not every merge
|
|
132
|
+
// since. Silent and unwaited.
|
|
133
|
+
else {
|
|
134
|
+
try {
|
|
135
|
+
forwardInBackground(choice.root, outcome.result);
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
log("background hosted move not started", String(error));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
flush(lines, codex);
|
|
142
|
+
}
|
|
143
|
+
/** One write at the end, so the Codex form is a single JSON document. */
|
|
144
|
+
function flush(lines, codex) {
|
|
145
|
+
if (lines.length === 0)
|
|
146
|
+
return;
|
|
147
|
+
if (codex)
|
|
148
|
+
process.stdout.write(codexEmission(lines.join("\n")));
|
|
149
|
+
else
|
|
150
|
+
process.stdout.write(`${lines.join("\n")}\n`);
|
|
88
151
|
}
|
|
89
152
|
await main();
|
|
90
153
|
process.exit(0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-start.js","sourceRoot":"","sources":["../../src/hook/session-start.ts"],"names":[],"mappings":";AACA,8EA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CAAC,CAAC;AACrD,CAAC;AAED,MAAM,IAAI,EAAE,CAAC;AACb,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC"}
|
package/dist/hook/stop.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stop.js","sourceRoot":"","sources":["../../src/hook/stop.ts"],"names":[],"mappings":";AACA,yEAAyE;AACzE,EAAE;AACF,yEAAyE;AACzE,wEAAwE;AACxE,4EAA4E;AAC5E,8EAA8E;AAC9E,4EAA4E;AAC5E,8EAA8E;AAC9E,wEAAwE;AACxE,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,uEAAuE;AACvE,4EAA4E;AAC5E,yDAAyD;AACzD,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,4EAA4E;AAC5E,0EAA0E;AAE1E,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,GAAG,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"stop.js","sourceRoot":"","sources":["../../src/hook/stop.ts"],"names":[],"mappings":";AACA,yEAAyE;AACzE,EAAE;AACF,yEAAyE;AACzE,wEAAwE;AACxE,4EAA4E;AAC5E,8EAA8E;AAC9E,4EAA4E;AAC5E,8EAA8E;AAC9E,wEAAwE;AACxE,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,uEAAuE;AACvE,4EAA4E;AAC5E,yDAAyD;AACzD,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,4EAA4E;AAC5E,0EAA0E;AAE1E,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;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
|
|
|
1
|
+
export declare const AGENTS_FILE = "AGENTS.md";
|
|
2
|
+
/** The section as written, markers included. Ends in one newline. */
|
|
3
|
+
export declare const CHECK_SECTION: string;
|
|
4
|
+
/** The body with our section written in: replaced where it is, appended where it is not. */
|
|
5
|
+
export declare function withCheckSection(existing: string | null): string;
|
|
6
|
+
/** The body with our section taken out; `empty` where nothing else was in it. */
|
|
7
|
+
export declare function withoutCheckSection(existing: string): {
|
|
8
|
+
body: string;
|
|
9
|
+
changed: boolean;
|
|
10
|
+
empty: boolean;
|
|
11
|
+
};
|
|
12
|
+
/** Write our section into the folder's AGENTS.md. */
|
|
13
|
+
export declare function writeAgentsSection(workspace: string): "written" | "unchanged";
|
|
14
|
+
/** True where the folder's AGENTS.md holds our section. */
|
|
15
|
+
export declare function hasAgentsSection(workspace: string): boolean;
|
|
16
|
+
/** Take our section out. The file goes too only where nothing else was in it. */
|
|
17
|
+
export declare function removeAgentsSection(workspace: string): "section removed" | "file removed" | null;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// The "Carrick check" section `carrick init` keeps in a folder's AGENTS.md
|
|
2
|
+
// (carrick#2828), so an agent in Codex or Claude Code runs the local check
|
|
3
|
+
// before it says a change is done.
|
|
4
|
+
//
|
|
5
|
+
// The section sits between two marker comments. Those markers are the whole
|
|
6
|
+
// ownership rule: a re-run replaces what is between them and nothing else,
|
|
7
|
+
// `carrick remove` deletes that span and nothing else, and every other line of
|
|
8
|
+
// the file is somebody's and is never read for meaning. The file is created
|
|
9
|
+
// when it is missing, and deleted again on remove only when our section was
|
|
10
|
+
// all it held.
|
|
11
|
+
//
|
|
12
|
+
// carrick-cloud's scaffold (cloud#2289) must write this same block.
|
|
13
|
+
import fs from "node:fs";
|
|
14
|
+
import path from "node:path";
|
|
15
|
+
import { writeIfChanged } from "./files.js";
|
|
16
|
+
export const AGENTS_FILE = "AGENTS.md";
|
|
17
|
+
const START = "<!-- carrick:check start -->";
|
|
18
|
+
const END = "<!-- carrick:check end -->";
|
|
19
|
+
/** The section as written, markers included. Ends in one newline. */
|
|
20
|
+
export const CHECK_SECTION = [
|
|
21
|
+
START,
|
|
22
|
+
"## Carrick check",
|
|
23
|
+
"",
|
|
24
|
+
"Before you say a change is done, run `carrick check --changed` alongside the tests. The per-edit check covers only the file each edit touched; `check --changed` checks every changed file on this branch against the other services. It can take a few minutes: allow up to five. Then tell the user in one line what Carrick checked and found (for example \"Carrick checked 3 changed files against 35 services: no contract problems\"). If it exits non-zero, fix what it reports, or say why it is wrong. When you added functions, use the carrick-reuse skill on them.",
|
|
25
|
+
END,
|
|
26
|
+
"",
|
|
27
|
+
].join("\n");
|
|
28
|
+
/** The span of our section in a body, end included; null where there is none. */
|
|
29
|
+
function span(body) {
|
|
30
|
+
const from = body.indexOf(START);
|
|
31
|
+
if (from === -1)
|
|
32
|
+
return null;
|
|
33
|
+
const end = body.indexOf(END, from);
|
|
34
|
+
if (end === -1)
|
|
35
|
+
return null;
|
|
36
|
+
const after = end + END.length;
|
|
37
|
+
return { from, to: body[after] === "\n" ? after + 1 : after };
|
|
38
|
+
}
|
|
39
|
+
/** The body with our section written in: replaced where it is, appended where it is not. */
|
|
40
|
+
export function withCheckSection(existing) {
|
|
41
|
+
if (existing === null || existing.trim() === "")
|
|
42
|
+
return CHECK_SECTION;
|
|
43
|
+
const found = span(existing);
|
|
44
|
+
if (found !== null)
|
|
45
|
+
return existing.slice(0, found.from) + CHECK_SECTION + existing.slice(found.to);
|
|
46
|
+
const lf = existing.endsWith("\n") ? existing : `${existing}\n`;
|
|
47
|
+
return `${lf}\n${CHECK_SECTION}`;
|
|
48
|
+
}
|
|
49
|
+
/** The body with our section taken out; `empty` where nothing else was in it. */
|
|
50
|
+
export function withoutCheckSection(existing) {
|
|
51
|
+
const found = span(existing);
|
|
52
|
+
if (found === null)
|
|
53
|
+
return { body: existing, changed: false, empty: false };
|
|
54
|
+
// The blank line `withCheckSection` put before the section goes with it.
|
|
55
|
+
let from = found.from;
|
|
56
|
+
const before = existing.slice(0, from);
|
|
57
|
+
if (/\n\n$/.test(before))
|
|
58
|
+
from -= 1;
|
|
59
|
+
const body = existing.slice(0, from) + existing.slice(found.to);
|
|
60
|
+
return { body, changed: true, empty: body.trim() === "" };
|
|
61
|
+
}
|
|
62
|
+
/** Write our section into the folder's AGENTS.md. */
|
|
63
|
+
export function writeAgentsSection(workspace) {
|
|
64
|
+
const target = path.join(workspace, AGENTS_FILE);
|
|
65
|
+
const existing = fs.existsSync(target) ? fs.readFileSync(target, "utf8") : null;
|
|
66
|
+
return writeIfChanged(target, withCheckSection(existing));
|
|
67
|
+
}
|
|
68
|
+
/** True where the folder's AGENTS.md holds our section. */
|
|
69
|
+
export function hasAgentsSection(workspace) {
|
|
70
|
+
const target = path.join(workspace, AGENTS_FILE);
|
|
71
|
+
return fs.existsSync(target) && span(fs.readFileSync(target, "utf8")) !== null;
|
|
72
|
+
}
|
|
73
|
+
/** Take our section out. The file goes too only where nothing else was in it. */
|
|
74
|
+
export function removeAgentsSection(workspace) {
|
|
75
|
+
const target = path.join(workspace, AGENTS_FILE);
|
|
76
|
+
if (!fs.existsSync(target))
|
|
77
|
+
return null;
|
|
78
|
+
const cleaned = withoutCheckSection(fs.readFileSync(target, "utf8"));
|
|
79
|
+
if (!cleaned.changed)
|
|
80
|
+
return null;
|
|
81
|
+
if (cleaned.empty) {
|
|
82
|
+
fs.rmSync(target);
|
|
83
|
+
return "file removed";
|
|
84
|
+
}
|
|
85
|
+
fs.writeFileSync(target, cleaned.body);
|
|
86
|
+
return "section removed";
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=agents-section.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents-section.js","sourceRoot":"","sources":["../../src/init/agents-section.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,2EAA2E;AAC3E,mCAAmC;AACnC,EAAE;AACF,4EAA4E;AAC5E,2EAA2E;AAC3E,+EAA+E;AAC/E,4EAA4E;AAC5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,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAChF,OAAO,cAAc,CAAC,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC5D,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,gBAAgB,CAAC,SAAiB;IAChD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IACjD,OAAO,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAAK,IAAI,CAAC;AACjF,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,mBAAmB,CAAC,SAAiB;IACnD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IACjD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAC;IACxC,MAAM,OAAO,GAAG,mBAAmB,CAAC,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACrE,IAAI,CAAC,OAAO,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAClC,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAClB,OAAO,cAAc,CAAC;IACxB,CAAC;IACD,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,iBAAiB,CAAC;AAC3B,CAAC"}
|
package/dist/init/codex.js
CHANGED
|
@@ -15,8 +15,11 @@
|
|
|
15
15
|
// the same reason: entries whose command is this CLI are the only ones touched,
|
|
16
16
|
// and a hooks file a user already has keeps everything else in it.
|
|
17
17
|
//
|
|
18
|
-
//
|
|
18
|
+
// Three entries, which is the whole nudge on this host:
|
|
19
19
|
//
|
|
20
|
+
// * `SessionStart`, which puts the index map in front of the agent before its
|
|
21
|
+
// first move (carrick#2848). `hook session-start` prints it as
|
|
22
|
+
// `hookSpecificOutput.additionalContext` when Codex runs it.
|
|
20
23
|
// * `PostToolUse` on `apply_patch`, which records what an edit added. The
|
|
21
24
|
// matcher is a regex (`codex-rs/hooks/src/engine/dispatcher.rs`) and
|
|
22
25
|
// `apply_patch` is the canonical tool name Codex puts on the payload.
|
|
@@ -28,7 +31,8 @@
|
|
|
28
31
|
// One thing this file cannot do for the user: a project hook is untrusted until
|
|
29
32
|
// Codex records its hash, and an untrusted hook is discovered and not run
|
|
30
33
|
// (`hook_trust_status` in `discovery.rs`). Codex asks about it at its next
|
|
31
|
-
// start
|
|
34
|
+
// start in the TUI only; `codex exec` and the editor extensions skip it without
|
|
35
|
+
// a message. `carrick init` says so; nothing here can answer it.
|
|
32
36
|
//
|
|
33
37
|
// Reference: `docs/reference/task-skills.md`, "The reuse nudge".
|
|
34
38
|
import fs from "node:fs";
|
|
@@ -42,6 +46,13 @@ export const CODEX_HOOKS_FILE = path.join(CODEX_DIR, "hooks.json");
|
|
|
42
46
|
/** What this package registers with Codex, and the only entries it removes. */
|
|
43
47
|
export function codexHooks(command = "carrick") {
|
|
44
48
|
return {
|
|
49
|
+
// No matcher, timeout 30 as the Claude entry has it. Without this entry the
|
|
50
|
+
// agent is never told the index exists and starts without calling Carrick.
|
|
51
|
+
SessionStart: [
|
|
52
|
+
{
|
|
53
|
+
hooks: [{ type: "command", command: `${command} hook session-start`, timeout: 30 }],
|
|
54
|
+
},
|
|
55
|
+
],
|
|
45
56
|
// One call can carry a patch touching several files, and each one is a
|
|
46
57
|
// separate `carrick check`, so this timeout is not the single-file 15 the
|
|
47
58
|
// Claude entry uses. Codex applies the value as written for this event
|
package/dist/init/codex.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/init/codex.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,kBAAkB;AAClB,EAAE;AACF,uEAAuE;AACvE,iEAAiE;AACjE,+EAA+E;AAC/E,4EAA4E;AAC5E,sCAAsC;AACtC,EAAE;AACF,8EAA8E;AAC9E,+EAA+E;AAC/E,wEAAwE;AACxE,0EAA0E;AAC1E,8EAA8E;AAC9E,gFAAgF;AAChF,mEAAmE;AACnE,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/init/codex.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,kBAAkB;AAClB,EAAE;AACF,uEAAuE;AACvE,iEAAiE;AACjE,+EAA+E;AAC/E,4EAA4E;AAC5E,sCAAsC;AACtC,EAAE;AACF,8EAA8E;AAC9E,+EAA+E;AAC/E,wEAAwE;AACxE,0EAA0E;AAC1E,8EAA8E;AAC9E,gFAAgF;AAChF,mEAAmE;AACnE,EAAE;AACF,wDAAwD;AACxD,EAAE;AACF,8EAA8E;AAC9E,iEAAiE;AACjE,+DAA+D;AAC/D,0EAA0E;AAC1E,uEAAuE;AACvE,wEAAwE;AACxE,8EAA8E;AAC9E,sEAAsE;AACtE,8EAA8E;AAC9E,kCAAkC;AAClC,EAAE;AACF,gFAAgF;AAChF,0EAA0E;AAC1E,2EAA2E;AAC3E,gFAAgF;AAChF,iEAAiE;AACjE,EAAE;AACF,iEAAiE;AAEjE,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,YAAY,EACZ,kBAAkB,GAGnB,MAAM,eAAe,CAAC;AAEvB,gEAAgE;AAChE,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC;AAElC,uDAAuD;AACvD,MAAM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or.js
CHANGED
|
@@ -698,6 +698,7 @@ export function checkTaskSkills(installed) {
|
|
|
698
698
|
const missing = installed.filter((skill) => skill.state === "absent");
|
|
699
699
|
const stale = installed.filter((skill) => skill.state === "ours" && !skill.current);
|
|
700
700
|
const edited = installed.filter((skill) => skill.state === "edited");
|
|
701
|
+
const linked = installed.filter((skill) => skill.state === "linked");
|
|
701
702
|
// "and others" only when there are others: one missing file was named as the
|
|
702
703
|
// first of several (carrick#1574).
|
|
703
704
|
const named = (skills) => `${skills[0].path}${skills.length > 1 ? " and others" : ""}`;
|
|
@@ -707,6 +708,9 @@ export function checkTaskSkills(installed) {
|
|
|
707
708
|
if (stale.length > 0) {
|
|
708
709
|
lines.push(warn(`${stale.length} task skill file(s) here were written by an older version of carrick (${named(stale)}). Re-run \`carrick init\`: it rewrites the ones still untouched and leaves the rest.`));
|
|
709
710
|
}
|
|
711
|
+
if (linked.length > 0) {
|
|
712
|
+
lines.push(say(`${linked.length} task skill file(s) were not installed (${named(linked)}) because their folder is a link out of its harness folder, and a write would land in the folder it points to. This is not a fault.`));
|
|
713
|
+
}
|
|
710
714
|
for (const skill of edited) {
|
|
711
715
|
lines.push(say(`${skill.path} has been edited here, so \`carrick init\` leaves it as it is and it stays at the version you changed.`));
|
|
712
716
|
}
|