carrick 0.3.80 → 0.3.82

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/scan.js ADDED
@@ -0,0 +1,415 @@
1
+ // What a build of the index looks like from the outside (carrick#1315).
2
+ //
3
+ // `carrick index`, `resume` and `refresh` are the Rust binary, and the binary
4
+ // writes for two readers at once: a person, and a log file. Run under this
5
+ // package with the two streams inherited, a first run opened on a tracing
6
+ // banner with eleven `<unset>` fields, then a pair of indicatif spinners
7
+ // rewriting a pipe — which arrive as padded fragments sharing one line — and
8
+ // closed on the boundary block, which is a per-package census of what the
9
+ // deterministic passes could not classify. All three are diagnostics.
10
+ //
11
+ // So the binary is spawned as a child whose streams this process holds, and
12
+ // what it states as a marker is rendered here, through the renderer `carrick
13
+ // init` already uses: clack in a terminal, the same lines plain in a pipe.
14
+ // Nothing else is drawn. The unparsed text is kept for exactly two readers:
15
+ // a run that failed, which prints it, and `--verbose`, which does not come
16
+ // through here at all — it inherits the streams and gets the binary's own
17
+ // output, banner included.
18
+ //
19
+ // Two rules decide what a line is, and neither reads its words:
20
+ //
21
+ // - A marker (`@carrick-…`) is rendered. `src/progress.rs` is the other
22
+ // half of each of these shapes.
23
+ // - Everything else is buffered. A stdout line that arrives BEFORE the
24
+ // first phase is the command's own answer — what `resume` collected, what
25
+ // it is still waiting for — and is shown. After the first phase, stdout
26
+ // is the map, and the summary marker carries what a person needs of it.
27
+ //
28
+ // A child that states no phase and no summary was not building anything: a
29
+ // refusal, a `resume` with nothing to collect, a help text. Its output is
30
+ // written through untouched, because the alternative is swallowing the answer.
31
+ import { spawn } from "node:child_process";
32
+ import { createOutput, } from "./init/output.js";
33
+ const PREFIXES = {
34
+ phase: "@carrick-phase ",
35
+ progress: "@carrick-progress ",
36
+ summary: "@carrick-summary ",
37
+ notice: "@carrick-notice ",
38
+ };
39
+ /**
40
+ * Read one line of a build's output as a marker, or answer null.
41
+ *
42
+ * Longest prefix wins, so a family whose names share a word cannot be read as
43
+ * one another — the same property `src/progress.rs` holds itself to. A marker
44
+ * whose payload is not the JSON this version expects is not a marker: the
45
+ * renderer draws nothing rather than drawing a guess.
46
+ */
47
+ export function parseMarker(line) {
48
+ const text = line.trimStart();
49
+ for (const [kind, prefix] of Object.entries(PREFIXES)) {
50
+ if (!text.startsWith(prefix))
51
+ continue;
52
+ let payload;
53
+ try {
54
+ payload = JSON.parse(text.slice(prefix.length));
55
+ }
56
+ catch {
57
+ return null;
58
+ }
59
+ if (payload === null || typeof payload !== "object")
60
+ return null;
61
+ if (kind === "phase") {
62
+ const phase = payload;
63
+ if (typeof phase.label !== "string")
64
+ return null;
65
+ return { kind: "phase", phase };
66
+ }
67
+ if (kind === "progress") {
68
+ const update = payload;
69
+ if (typeof update.total !== "number")
70
+ return null;
71
+ return { kind: "progress", update };
72
+ }
73
+ if (kind === "summary") {
74
+ const summary = payload;
75
+ if (!Array.isArray(summary.services))
76
+ return null;
77
+ return { kind: "summary", summary };
78
+ }
79
+ const notice = payload;
80
+ if (typeof notice.text !== "string")
81
+ return null;
82
+ return { kind: "notice", text: notice.text };
83
+ }
84
+ return null;
85
+ }
86
+ /** The commands this renders. Everything else runs with its streams inherited. */
87
+ export const RENDERED = new Set(["index", "resume", "refresh"]);
88
+ /**
89
+ * Whether this invocation is rendered, or run as the binary writes it.
90
+ *
91
+ * `--verbose` is the escape hatch the closing line names, so it must hand the
92
+ * terminal straight to the binary. `--detach` answers with an id and leaves a
93
+ * log file behind — there is no run here to draw. `--help` is text.
94
+ */
95
+ export function isRendered(command, args) {
96
+ if (!command || !RENDERED.has(command))
97
+ return false;
98
+ return !args.some((arg) => arg === "--verbose" ||
99
+ arg === "-v" ||
100
+ arg === "--detach" ||
101
+ arg === "--help" ||
102
+ arg === "-h");
103
+ }
104
+ /** `169.4` as `2m49s`, `32.7` as `32.7s`. Under a minute keeps its tenth. */
105
+ export function elapsed(seconds) {
106
+ if (!Number.isFinite(seconds) || seconds < 0)
107
+ return "0.0s";
108
+ if (seconds < 60)
109
+ return `${seconds.toFixed(1)}s`;
110
+ const minutes = Math.floor(seconds / 60);
111
+ return `${minutes}m${Math.round(seconds - minutes * 60)}s`;
112
+ }
113
+ function plural(count, noun) {
114
+ return `${count} ${noun}${count === 1 ? "" : "s"}`;
115
+ }
116
+ /**
117
+ * The one line a finished build is worth: what the index holds, then the one
118
+ * shortfall in it.
119
+ *
120
+ * Routes and calls alone were the whole line, and a service of 111 routes,
121
+ * 363 functions and 175 types read as `111 routes · 1 call` — which to a
122
+ * developer, and to an agent, is a nearly empty index (carrick#1321). The two
123
+ * largest things it holds are named before the shortfall, because the line's
124
+ * subject is what was built.
125
+ *
126
+ * The shortfall is dropped when it is zero. A line states how many, of which
127
+ * thing, and what to do about it; nothing to do is nothing to say
128
+ * (carrick#1284).
129
+ */
130
+ export function summaryLine(summary) {
131
+ const total = (pick) => summary.services.reduce((sum, service) => sum + (pick(service) ?? 0), 0);
132
+ const untyped = total((service) => service.routes_without_response_type);
133
+ const functions = total((service) => service.functions);
134
+ const types = total((service) => service.types);
135
+ const parts = [plural(total((service) => service.routes), "route")];
136
+ if (functions > 0)
137
+ parts.push(plural(functions, "function"));
138
+ if (types > 0)
139
+ parts.push(plural(types, "type"));
140
+ // Named for what it is. Every call in the index crosses a service boundary,
141
+ // and "1 call" beside 363 functions reads as one function call.
142
+ parts.push(plural(total((service) => service.calls), "external call"));
143
+ if (untyped > 0)
144
+ parts.push(`${plural(untyped, "route")} without a response type`);
145
+ return parts.join(" · ");
146
+ }
147
+ /** What a rendered run closes on: the next step, and nothing about cost. */
148
+ export function outroLine(summary) {
149
+ const next = summary.next ?? [];
150
+ if (next.length > 0)
151
+ return next.join(" ");
152
+ return "Your agents can query it now. `carrick index --verbose` shows the full report.";
153
+ }
154
+ /**
155
+ * The renderer, as a state machine over the child's lines.
156
+ *
157
+ * Separated from the spawn so a test drives it with a written stream and reads
158
+ * the interactive markers back — a terminal's own bytes are not capturable,
159
+ * and the plain rendering is a different renderer with different lines
160
+ * (carrick#1032).
161
+ */
162
+ export class ScanRender {
163
+ output;
164
+ version;
165
+ /** Renders run in order, whichever event scheduled them. */
166
+ chain = Promise.resolve();
167
+ /**
168
+ * The open step's own promise.
169
+ *
170
+ * Awaited at the head of every scheduled render and never inside the chain
171
+ * that starts it: a step ends when its phase ends, and a chain that waited
172
+ * on the step before running the line that ends it would wait forever.
173
+ */
174
+ stepDone = Promise.resolve();
175
+ open = null;
176
+ /** The fraction the open phase last stated, for its spinner only. */
177
+ running = null;
178
+ /** A finished phase whose line is not drawn yet: the summary may replace it. */
179
+ held = null;
180
+ opened = false;
181
+ summarised = false;
182
+ /** Lines nobody rendered, for a failure and for nothing else. */
183
+ buffered = [];
184
+ /** The command's own answer, said before any phase began. */
185
+ answered = [];
186
+ constructor(output, version) {
187
+ this.output = output;
188
+ this.version = version;
189
+ }
190
+ /** Whether anything at all was rendered. */
191
+ get rendered() {
192
+ return this.opened;
193
+ }
194
+ /** What was not rendered, in the order it arrived. */
195
+ get unrendered() {
196
+ return [...this.answered, ...this.buffered];
197
+ }
198
+ /** One line of the child's stdout. */
199
+ stdout(line) {
200
+ if (this.consume(line))
201
+ return;
202
+ // Before the first phase this is the command answering — what `resume`
203
+ // collected, what it is still waiting on. After it, it is the map.
204
+ if (!this.opened && line.trim().length > 0) {
205
+ this.answered.push(line);
206
+ return;
207
+ }
208
+ this.buffered.push(line);
209
+ }
210
+ /** One line of the child's stderr. */
211
+ stderr(line) {
212
+ if (this.consume(line))
213
+ return;
214
+ this.buffered.push(line);
215
+ }
216
+ consume(line) {
217
+ const marker = parseMarker(line);
218
+ if (!marker)
219
+ return false;
220
+ if (marker.kind === "phase")
221
+ this.phase(marker.phase);
222
+ else if (marker.kind === "progress")
223
+ this.progress(marker.update);
224
+ else if (marker.kind === "notice")
225
+ this.notice(marker.text);
226
+ else
227
+ this.summary(marker.summary);
228
+ return true;
229
+ }
230
+ begin() {
231
+ if (this.opened)
232
+ return;
233
+ this.opened = true;
234
+ this.schedule(() => {
235
+ this.output.intro(`carrick ${this.version}`);
236
+ for (const line of this.answered)
237
+ this.output.say(line);
238
+ this.answered.length = 0;
239
+ });
240
+ }
241
+ phase(update) {
242
+ if (update.state === "started") {
243
+ this.begin();
244
+ this.close();
245
+ const label = update.label;
246
+ const startedAt = Date.now();
247
+ let resolve = () => { };
248
+ const finished = new Promise((settle) => {
249
+ resolve = settle;
250
+ });
251
+ const phase = {
252
+ label,
253
+ startedAt,
254
+ resolve,
255
+ say: () => { },
256
+ counted: null,
257
+ notice: null,
258
+ };
259
+ this.open = phase;
260
+ this.schedule(() => {
261
+ this.stepDone = this.output.step(label, (say) => {
262
+ phase.say = say;
263
+ return finished;
264
+ }, (report) => report);
265
+ });
266
+ return;
267
+ }
268
+ // Finished, but not drawn: a summary arriving next is this phase's real
269
+ // outcome, and the join phase has no line of its own.
270
+ this.held = {
271
+ kind: update.state === "warned" ? "warn" : "done",
272
+ text: this.phaseText(),
273
+ };
274
+ }
275
+ phaseText() {
276
+ if (!this.open)
277
+ return "";
278
+ const spent = elapsed((Date.now() - this.open.startedAt) / 1000);
279
+ return this.open.counted
280
+ ? `${this.open.label} ${this.open.counted}, ${spent}`
281
+ : `${this.open.label} ${spent}`;
282
+ }
283
+ /** Draw the held line, if there is one, and free the phase it belongs to. */
284
+ close(report) {
285
+ const open = this.open;
286
+ if (!open)
287
+ return;
288
+ const outcome = report ?? this.held ?? { kind: "done", text: this.phaseText() };
289
+ this.open = null;
290
+ this.held = null;
291
+ this.running = null;
292
+ // Settling the step's promise is not a render, so it does not queue behind
293
+ // one: it is what lets the render already in the chain finish.
294
+ open.resolve(outcome);
295
+ }
296
+ progress(update) {
297
+ if (!this.open)
298
+ return;
299
+ // The spinner says how far through; the line it stops on says how much
300
+ // there was. A fraction is the answer to "is this moving", and the wrong
301
+ // answer to "what did it cover".
302
+ this.open.counted = `${update.total} ${update.phase}`;
303
+ this.running = `${update.done} of ${update.total} ${update.phase}`;
304
+ this.redraw();
305
+ }
306
+ notice(text) {
307
+ if (!this.open) {
308
+ this.buffered.push(text);
309
+ return;
310
+ }
311
+ this.open.notice = text;
312
+ this.redraw();
313
+ }
314
+ /** Say where an open phase is while it runs, without ending it. */
315
+ redraw() {
316
+ const open = this.open;
317
+ if (!open)
318
+ return;
319
+ const counted = this.running ? `: ${this.running}` : "";
320
+ const notice = open.notice ? ` (${open.notice})` : "";
321
+ open.say(`${open.label}${counted}${notice}`);
322
+ }
323
+ summary(summary) {
324
+ this.summarised = true;
325
+ this.begin();
326
+ // The counts ARE the closing phase's outcome, so they take its line
327
+ // rather than adding one under it.
328
+ if (summary.services.length > 0) {
329
+ this.close({ kind: "done", text: summaryLine(summary) });
330
+ }
331
+ else {
332
+ this.close();
333
+ }
334
+ this.schedule(() => this.output.outro(outroLine(summary)));
335
+ }
336
+ /**
337
+ * The child is over. Answer whether anything was rendered, so a caller that
338
+ * rendered nothing can write the output through instead of eating it.
339
+ */
340
+ async finish(failed) {
341
+ if (this.open) {
342
+ this.close(failed
343
+ ? { kind: "refuse", text: `${this.open.label} — the scan stopped` }
344
+ : undefined);
345
+ if (failed)
346
+ this.summarised = false;
347
+ }
348
+ // One last link, so the chain waits on whatever step is still open.
349
+ this.schedule(() => { });
350
+ await this.chain;
351
+ return this.opened && this.summarised;
352
+ }
353
+ schedule(work) {
354
+ this.chain = this.chain
355
+ .then(() => this.stepDone)
356
+ .then(work)
357
+ .then(() => { }, () => { });
358
+ }
359
+ }
360
+ /** Where a rendered run writes the lines it did not draw. */
361
+ function writeThrough(lines) {
362
+ if (lines.length === 0)
363
+ return;
364
+ process.stderr.write(`${lines.join("\n")}\n`);
365
+ }
366
+ /**
367
+ * Run the binary and render it.
368
+ *
369
+ * stdin stays inherited: a build asks nothing, but a child holding no stdin
370
+ * would break the moment one of them does.
371
+ */
372
+ export async function renderScan(options) {
373
+ const render = new ScanRender(options.output ?? createOutput(), options.version);
374
+ const child = spawn(options.binary, options.args, {
375
+ stdio: ["inherit", "pipe", "pipe"],
376
+ // The markers are written only when a parent asks for them, so a run
377
+ // nobody is rendering — a CI scan, a direct `carrick index` — is unchanged.
378
+ env: { ...options.env, CARRICK_PROGRESS: "1" },
379
+ });
380
+ const read = (stream, take) => new Promise((resolve) => {
381
+ let rest = "";
382
+ stream.setEncoding("utf8");
383
+ stream.on("data", (chunk) => {
384
+ const lines = (rest + chunk).split("\n");
385
+ rest = lines.pop() ?? "";
386
+ for (const line of lines)
387
+ take(line);
388
+ });
389
+ stream.on("end", () => {
390
+ if (rest.length > 0)
391
+ take(rest);
392
+ resolve();
393
+ });
394
+ stream.on("error", () => resolve());
395
+ });
396
+ const ended = new Promise((resolve, reject) => {
397
+ child.on("error", reject);
398
+ child.on("exit", (code, signal) => resolve({ code: code ?? 1, signal }));
399
+ });
400
+ const [, , outcome] = await Promise.all([
401
+ read(child.stdout, (line) => render.stdout(line)),
402
+ read(child.stderr, (line) => render.stderr(line)),
403
+ ended,
404
+ ]);
405
+ const failed = outcome.code !== 0 || outcome.signal !== null;
406
+ const drew = await render.finish(failed);
407
+ // A run that drew nothing was not a build: a refusal, a `resume` with
408
+ // nothing to collect, a help text. Its output IS the answer.
409
+ if (!drew)
410
+ writeThrough(render.unrendered);
411
+ else if (failed)
412
+ writeThrough(render.unrendered);
413
+ return outcome;
414
+ }
415
+ //# sourceMappingURL=scan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scan.js","sourceRoot":"","sources":["../src/scan.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,EAAE;AACF,8EAA8E;AAC9E,2EAA2E;AAC3E,0EAA0E;AAC1E,yEAAyE;AACzE,6EAA6E;AAC7E,0EAA0E;AAC1E,sEAAsE;AACtE,EAAE;AACF,4EAA4E;AAC5E,6EAA6E;AAC7E,2EAA2E;AAC3E,4EAA4E;AAC5E,2EAA2E;AAC3E,0EAA0E;AAC1E,2BAA2B;AAC3B,EAAE;AACF,gEAAgE;AAChE,EAAE;AACF,0EAA0E;AAC1E,oCAA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;IAEH,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,KAAK,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,IAAI,CAAC;IAC7D,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACzC,sEAAsE;IACtE,6DAA6D;IAC7D,IAAI,CAAC,IAAI;QAAE,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;SACtC,IAAI,MAAM;QAAE,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACjD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -3,6 +3,15 @@ export declare const TEMPLATE_NAMES: TemplateName[];
3
3
  /** Where a repo puts each one. */
4
4
  export declare const TEMPLATE_PATHS: Record<TemplateName, string>;
5
5
  export declare const DEFAULTS: Record<string, string>;
6
+ /**
7
+ * The directory the shipped template files sit in.
8
+ *
9
+ * Resolved from this module rather than from the process, because the same
10
+ * resolution has to hold in the checkout (`src/../templates`) and in the
11
+ * published emit (`dist/../templates`). `init/task-skills.ts` reads the skill
12
+ * bodies from a subdirectory of it.
13
+ */
14
+ export declare function templatesDir(): string;
6
15
  export declare function templateSource(name: TemplateName): string;
7
16
  /**
8
17
  * Render one template.
package/dist/templates.js CHANGED
@@ -27,7 +27,15 @@ export const DEFAULTS = {
27
27
  ACTION_REF: "carrick-tools/carrick@v1",
28
28
  DEFAULT_BRANCH: "main",
29
29
  };
30
- function templatesDir() {
30
+ /**
31
+ * The directory the shipped template files sit in.
32
+ *
33
+ * Resolved from this module rather than from the process, because the same
34
+ * resolution has to hold in the checkout (`src/../templates`) and in the
35
+ * published emit (`dist/../templates`). `init/task-skills.ts` reads the skill
36
+ * bodies from a subdirectory of it.
37
+ */
38
+ export function templatesDir() {
31
39
  return path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "templates");
32
40
  }
33
41
  export function templateSource(name) {
@@ -1 +1 @@
1
- {"version":3,"file":"templates.js","sourceRoot":"","sources":["../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"description": "The API contract index for a TypeScript workspace: what the other services do with the routes and calls in the file you are editing, in your editor and in your agent's context",
5
5
  "keywords": [
6
6
  "typescript",
@@ -57,11 +57,11 @@
57
57
  "zod": "^3.23.0"
58
58
  },
59
59
  "optionalDependencies": {
60
- "@carrick-tools/cli-darwin-arm64": "0.3.80",
61
- "@carrick-tools/cli-darwin-x64": "0.3.80",
62
- "@carrick-tools/cli-linux-arm64": "0.3.80",
63
- "@carrick-tools/cli-linux-x64": "0.3.80",
64
- "@carrick-tools/cli-win32-x64": "0.3.80"
60
+ "@carrick-tools/cli-darwin-arm64": "0.3.82",
61
+ "@carrick-tools/cli-darwin-x64": "0.3.82",
62
+ "@carrick-tools/cli-linux-arm64": "0.3.82",
63
+ "@carrick-tools/cli-linux-x64": "0.3.82",
64
+ "@carrick-tools/cli-win32-x64": "0.3.82"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@types/node": "^24.13.3",
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: carrick-census
3
+ description: Use for every place that does X questions, such as every service that reads this environment variable, every handler that checks a permission, or every client of this queue. Pages the Carrick intent index under two wordings and reports what it read and what it could not see.
4
+ ---
5
+
6
+ # Every place that does X
7
+
8
+ {{SCOPE_NOTE}}
9
+
10
+ The index produces the list. Your work is to open each row and confirm what it
11
+ does.
12
+
13
+ ## 1. Two wordings
14
+
15
+ Search twice. One query says what the code is for, the other says how it does
16
+ it. A purpose wording misses a helper whose description names only its
17
+ mechanism, and a mechanism wording misses one described only by its job.
18
+
19
+ ```
20
+ search_by_intent({{SCOPE}}, query: "<what it is for>", compact: true, top_k: 20)
21
+ search_by_intent({{SCOPE}}, query: "<how it does it>", compact: true, top_k: 20)
22
+ ```
23
+
24
+ `compact: true` returns locator-only rows, which is the shape a census needs.
25
+ Page each query while `has_more` is true:
26
+
27
+ ```
28
+ search_by_intent({{SCOPE}}, query: "<the same query>", compact: true, top_k: 20, offset: <next_offset>)
29
+ ```
30
+
31
+ Stop when `has_more` is false. Lower `similarity_threshold` where the tail of a
32
+ page is still on topic.
33
+
34
+ ## 2. Union
35
+
36
+ Join the two result sets on `file_path` and `line_number`. A row both wordings
37
+ found is one row. Keep `retrieved_by` and `similarity` on each row, and keep
38
+ which wording found it: a row only one wording reached is the row a single
39
+ search would have lost.
40
+
41
+ ## 3. Receipt
42
+
43
+ Report these numbers before the list, per query where the field is per query:
44
+
45
+ - rows read, which is the count you paged to;
46
+ - `total_candidates`, the exact size of the ranked list for that query;
47
+ - `total_without_intent`, which is index-wide: functions carrying no intent
48
+ text, which no search looked at;
49
+ - `total_intent_carried_forward` where the response states it, which are intents
50
+ describing the code as of an earlier scan.
51
+
52
+ Then say what the index does not hold for this question. It covers each repo's
53
+ main branch, so a change on a branch is outside it. It indexes functions that
54
+ carry an intent, so a match inside a config file, a template or generated output
55
+ is outside it as well.
56
+
57
+ ## 4. Confirm
58
+
59
+ Read each row at `file_path`, from `line_number` to `end_line`. Keep the rows
60
+ that do the thing, and drop the rest with one line each saying what they turned
61
+ out to be. `role` on a row says what the scan joined it to, such as a route
62
+ handler or a client, and a route handler for a different operation is not a hit.
63
+
64
+ ## 5. Report
65
+
66
+ | file:line | function | what it does | found by |
67
+ |---|---|---|---|
68
+ | src/billing/charge.ts:88 | chargeCard | reads the billing key | purpose, mechanism |
69
+
70
+ Close with the receipt from step 3, so the list is read against what was
71
+ searched.
72
+
73
+ ## 6. Act
74
+
75
+ Change nothing unless you were asked to. Offer one issue per finding that needs
76
+ work, and file the ones accepted:
77
+
78
+ ```
79
+ gh issue create --title "<concept>: <n> places, <m> need changing" --body "<the table, and the receipt>"
80
+ ```