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
|
@@ -20,40 +20,6 @@
|
|
|
20
20
|
import { Project, SourceFile, type CallExpression } from 'ts-morph';
|
|
21
21
|
import type { InferRequestItem, InferResult, ModelSymbol, ExtractionConfig } from './types.js';
|
|
22
22
|
import { type LabelledMembers } from './library-claims.js';
|
|
23
|
-
/**
|
|
24
|
-
* Strongly-discriminating member names of HTTP transport machinery — the
|
|
25
|
-
* fetch/DOM `Response` & `Request`, a Node `http.ServerResponse`, a framework
|
|
26
|
-
* reply object. A type declared in a lib or installed-dependency origin that carries
|
|
27
|
-
* a subset of these is framework machinery, never a user contract: the
|
|
28
|
-
* PRODUCER-side structural mirror of the consumer `machineryIndicators`
|
|
29
|
-
* (ExtractionConfig), used to reject a wrapper envelope whose response field is
|
|
30
|
-
* a raw `Response` (carrick#371) instead of emitting it as a comparable type.
|
|
31
|
-
*
|
|
32
|
-
* Framework-agnostic by construction: no framework NAME appears here, only the
|
|
33
|
-
* shared HTTP-message surface. The names are deliberately the ones no
|
|
34
|
-
* JSON payload ever carries (`ok`, `redirected`, `bodyUsed`, `arrayBuffer`,
|
|
35
|
-
* `writeHead`, ...), so the origin gate + `MACHINERY_INDICATOR_THRESHOLD` never
|
|
36
|
-
* fire on real data. Kept in lockstep with the capture-seam mirror
|
|
37
|
-
* `capture/machinery.ts` (the seam forbids sharing a module across it, same as
|
|
38
|
-
* `BUILTIN_ANCHOR_SYMBOLS` mirrors `socket_io.rs`). Exported so a drift-guard
|
|
39
|
-
* test (`machinery-indicator-mirror.test.ts`) asserts the two sets stay equal.
|
|
40
|
-
*/
|
|
41
|
-
export declare const MACHINERY_MEMBER_INDICATORS: Set<string>;
|
|
42
|
-
/**
|
|
43
|
-
* `text` is `string`, alone or beside `null` and `undefined` in either order:
|
|
44
|
-
* the only payload a raw-text read publishes (carrick#1842).
|
|
45
|
-
*/
|
|
46
|
-
/**
|
|
47
|
-
* Source text with every plain string literal written in double quotes:
|
|
48
|
-
* `'/a'`, `"/a"` and an interpolation-free `` `/a` `` are one value, so text
|
|
49
|
-
* that differs only in its quotes compares equal (carrick#2056).
|
|
50
|
-
*
|
|
51
|
-
* The text is read left to right, pairing quotes the way the scanner does,
|
|
52
|
-
* so a template's closing backtick never pairs with the next template's
|
|
53
|
-
* opening one. A literal holding a quote, a backslash or an interpolation is
|
|
54
|
-
* copied as it is, and so is an unterminated one with everything after it.
|
|
55
|
-
*/
|
|
56
|
-
export declare function canonicalStringQuotes(text: string): string;
|
|
57
23
|
/**
|
|
58
24
|
* Options for TypeInferrer construction
|
|
59
25
|
*/
|
|
@@ -509,6 +475,18 @@ export declare class TypeInferrer {
|
|
|
509
475
|
*/
|
|
510
476
|
private withArgumentReads;
|
|
511
477
|
private addArgumentReads;
|
|
478
|
+
/** A call the service's labels name a body send; a labelled setter is not one (carrick#2472 C2). */
|
|
479
|
+
private isLabelledSend;
|
|
480
|
+
/**
|
|
481
|
+
* carrick#4081: a line-only row at a registration whose handler returns
|
|
482
|
+
* nothing. Its body is what the handler sends: every labelled send it makes
|
|
483
|
+
* as a statement, error and redirect sends dropped, the success bodies
|
|
484
|
+
* joined, as `inferFromResponseSites` reads them from a located send. Only
|
|
485
|
+
* labelled sends count; an unlabelled one leaves the row unread. A reply
|
|
486
|
+
* parameter that states its payload answers first (`withStatedReply`), so
|
|
487
|
+
* this yields to it.
|
|
488
|
+
*/
|
|
489
|
+
private labelledSendBodies;
|
|
512
490
|
/**
|
|
513
491
|
* The response sends `func` makes as statements (`res.status(409).json(e);`),
|
|
514
492
|
* for a handler that sends through a parameter and returns nothing. Only the
|
|
@@ -1161,72 +1139,37 @@ export declare class TypeInferrer {
|
|
|
1161
1139
|
* envelope `{ response: Response; error?: undefined } | { ...; error: Error }`
|
|
1162
1140
|
* was captured as the response contract. Machinery is never a comparable
|
|
1163
1141
|
* contract, so a response path that resolves here abstains (honest `unknown`)
|
|
1164
|
-
* rather than emit a concrete-but-false type.
|
|
1165
|
-
*
|
|
1166
|
-
*
|
|
1167
|
-
* 1. the type itself is machinery (`typeIsFrameworkMachinery`);
|
|
1168
|
-
* 2. a union/intersection member is machinery (the envelope union);
|
|
1169
|
-
* 3. a DIRECT property's type is machinery, ONE level of descent only
|
|
1170
|
-
* (`{ response: Response; error }`).
|
|
1171
|
-
*
|
|
1172
|
-
* DELIBERATELY NOT DETECTED — listed so this comment never overstates the
|
|
1173
|
-
* guarantee (an overstated safety comment is what bit sibling PR #442). Each is
|
|
1174
|
-
* a non-regression: it leaves the pre-existing verdict unchanged and never
|
|
1175
|
-
* manufactures a new wrong one, tracked as a follow-up:
|
|
1176
|
-
* - machinery nested deeper than one property level (a property whose type
|
|
1177
|
-
* is itself a nested object wrapping the machinery);
|
|
1178
|
-
* - a property typed `Promise<Response>` (the property type is NOT awaited /
|
|
1179
|
-
* Promise-unwrapped before the machinery check);
|
|
1180
|
-
* - an array element type: `Response[]` is not descended to its element;
|
|
1181
|
-
* - `interface X extends Response` declared in USER source — the origin gate
|
|
1182
|
-
* is lib/installed-dependency only, so a user-declared subtype reads as a real
|
|
1183
|
-
* contract, not machinery;
|
|
1184
|
-
* - a function / call-signature return type: the response paths that call
|
|
1185
|
-
* this resolve a handler's RETURN (an envelope/object), never a function
|
|
1186
|
-
* value, so no call-signature descent happens here. The capture-seam
|
|
1187
|
-
* mirror `capture/machinery.ts` DOES descend call signatures — that is
|
|
1188
|
-
* where the wrapper-FUNCTION type the Infer fallback resolves is caught.
|
|
1189
|
-
*
|
|
1190
|
-
* The origin gate in `typeIsFrameworkMachinery` keeps a user object whose
|
|
1191
|
-
* fields merely share a member name from tripping.
|
|
1142
|
+
* rather than emit a concrete-but-false type. The capture asks the same
|
|
1143
|
+
* question of the same function (`capture/site-node.ts`, carrick#3500), which
|
|
1144
|
+
* states what it detects and what it does not.
|
|
1192
1145
|
*/
|
|
1193
1146
|
private typeIsOrContainsResponseMachinery;
|
|
1194
|
-
private typeIsOrContainsMachinery;
|
|
1195
|
-
/**
|
|
1196
|
-
* True when `type` itself is an HTTP-machinery type: it structurally carries
|
|
1197
|
-
* at least `MACHINERY_INDICATOR_THRESHOLD` of the strongly-discriminating
|
|
1198
|
-
* `MACHINERY_MEMBER_INDICATORS`, AND its symbol is declared in a lib
|
|
1199
|
-
* (`lib.dom.d.ts`, ...) or installed-dependency origin. Both gates are required —
|
|
1200
|
-
* the indicator subset alone essentially never matches a JSON payload, and
|
|
1201
|
-
* the origin gate makes certain a user's own local type sharing those member
|
|
1202
|
-
* names is never mistaken for framework machinery (the advisor's guard).
|
|
1203
|
-
*/
|
|
1204
1147
|
/**
|
|
1205
1148
|
* Blueprint row N8: true when `type` is framework machinery by where it is
|
|
1206
1149
|
* declared, never by its name. Either it passes the structural test
|
|
1207
|
-
* (`
|
|
1208
|
-
* library or an installed package), or an installed
|
|
1209
|
-
* labels a server framework declares it
|
|
1210
|
-
* covers app and router instances that
|
|
1211
|
-
* service's own `Context` or `Router` is neither.
|
|
1150
|
+
* (`isFrameworkMachinery` in `capture/site-node.ts`: the transport's
|
|
1151
|
+
* members, declared by a library or an installed package), or an installed
|
|
1152
|
+
* package the store labels a server framework declares it
|
|
1153
|
+
* (`frameworkPackages`), which also covers app and router instances that
|
|
1154
|
+
* carry no reply members. A service's own `Context` or `Router` is neither.
|
|
1212
1155
|
*/
|
|
1213
1156
|
private isFrameworkMachinery;
|
|
1214
1157
|
private typeIsFrameworkMachinery;
|
|
1158
|
+
private checker;
|
|
1215
1159
|
/**
|
|
1216
|
-
*
|
|
1217
|
-
* `MACHINERY_MEMBER_INDICATORS` (own + apparent). Deduplicates by name (own and
|
|
1218
|
-
* apparent property lists overlap) and early-returns the moment the threshold
|
|
1219
|
-
* is reached — the callers only need the boolean, never the full count.
|
|
1220
|
-
*/
|
|
1221
|
-
private hasMachineryIndicatorThreshold;
|
|
1222
|
-
/**
|
|
1223
|
-
* True when the symbol is declared in a runtime/library origin
|
|
1160
|
+
* Whether a declaration's file is a runtime/library origin
|
|
1224
1161
|
* (`isExternalOrigin`): a TypeScript lib, an installed dependency however
|
|
1225
1162
|
* the program resolved it, or the runtime declarations Carrick materialises
|
|
1226
1163
|
* under `.carrick/deno/` — framework/runtime machinery, not user source.
|
|
1164
|
+
* The program is read per call: the project adds source files lazily and
|
|
1165
|
+
* rebuilds it.
|
|
1166
|
+
*/
|
|
1167
|
+
private readonly declaredOutside;
|
|
1168
|
+
/**
|
|
1169
|
+
* True when the symbol is declared in a runtime/library origin
|
|
1170
|
+
* (`declaredOutside`), itself or through the import alias it stands for.
|
|
1227
1171
|
* Works on a bare checkout: the DOM `Response`/`Request` resolve from the
|
|
1228
|
-
* bundled `lib.dom.d.ts` even with no installed dependencies.
|
|
1229
|
-
* read per call: the project adds source files lazily and rebuilds it.
|
|
1172
|
+
* bundled `lib.dom.d.ts` even with no installed dependencies.
|
|
1230
1173
|
*/
|
|
1231
1174
|
private symbolIsLibOrExternalOrigin;
|
|
1232
1175
|
/**
|
|
@@ -2683,70 +2626,15 @@ export declare class TypeInferrer {
|
|
|
2683
2626
|
*/
|
|
2684
2627
|
private standardSchemaType;
|
|
2685
2628
|
/**
|
|
2686
|
-
* Find a node by matching expression text near a target line
|
|
2687
|
-
*
|
|
2688
|
-
*
|
|
2689
|
-
* 1. Get all descendant nodes within [lineNumber - searchRadius, lineNumber + searchRadius]
|
|
2690
|
-
* 2. Normalize whitespace for comparison
|
|
2691
|
-
* 3. Try exact match first (after normalization), prefer closest to target line
|
|
2692
|
-
* 4. Fall back to substring match (LLM text in node text, or vice versa)
|
|
2693
|
-
* 5. Return smallest matching node closest to target line
|
|
2629
|
+
* Find a node by matching expression text near a target line: the shared
|
|
2630
|
+
* locator (`nodeByLocatorText`, carrick#3500) over every node that starts
|
|
2631
|
+
* within `searchRadius` lines of it, the one the capture runs too.
|
|
2694
2632
|
*/
|
|
2695
2633
|
private findNodeByText;
|
|
2696
2634
|
/**
|
|
2697
2635
|
* Find a CallExpression by matching expression text near a target line.
|
|
2698
2636
|
*/
|
|
2699
2637
|
private findCallExpressionByText;
|
|
2700
|
-
/**
|
|
2701
|
-
* Shared text-matching logic for node resolution.
|
|
2702
|
-
* Normalizes whitespace once per candidate, then tries exact match,
|
|
2703
|
-
* then substring match (preferring containing matches).
|
|
2704
|
-
*/
|
|
2705
|
-
private matchByText;
|
|
2706
|
-
/**
|
|
2707
|
-
* The text a locator opens with before an elision, or `undefined` when the
|
|
2708
|
-
* locator has none. An elision is `...` followed only by closing brackets
|
|
2709
|
-
* (`{ a: x, ... }`); `...rest` is a spread and source text. An opening too
|
|
2710
|
-
* short to tell nodes apart is judged by the caller.
|
|
2711
|
-
*/
|
|
2712
|
-
private elidedLocatorOpening;
|
|
2713
|
-
/**
|
|
2714
|
-
* What a locator's text names, read off its own parse (carrick#2056):
|
|
2715
|
-
*
|
|
2716
|
-
* - `texts`: the normalized text of the expression it names and of each
|
|
2717
|
-
* wrapper it carries around it (`return`, a `const x =` binding, a label,
|
|
2718
|
-
* `await`, parentheses, a cast, `satisfies`, `!`). A node strictly inside
|
|
2719
|
-
* that expression is not among them;
|
|
2720
|
-
* - `rootKind` and `rootStart`: the innermost of those, its kind, and where
|
|
2721
|
-
* its text starts in the locator.
|
|
2722
|
-
*
|
|
2723
|
-
* `null` when the text does not parse as one expression or one statement:
|
|
2724
|
-
* there is no structure to read, and the caller keeps its text rule.
|
|
2725
|
-
*/
|
|
2726
|
-
private locatorNames;
|
|
2727
|
-
/**
|
|
2728
|
-
* Pick the best match from a set of candidate nodes:
|
|
2729
|
-
* smallest range, then closest to target line.
|
|
2730
|
-
*/
|
|
2731
|
-
private pickBestMatch;
|
|
2732
|
-
/**
|
|
2733
|
-
* Normalize whitespace for text comparison:
|
|
2734
|
-
* collapse runs of whitespace into single spaces, trim.
|
|
2735
|
-
*
|
|
2736
|
-
* Also strips trailing commas before `}` `)` `]`: multi-line source
|
|
2737
|
-
* literals carry them but the LLM's single-line locator print does not,
|
|
2738
|
-
* and that one comma used to defeat exact AND containment matching for
|
|
2739
|
-
* the payload and every enclosing node (#335). Applied symmetrically to
|
|
2740
|
-
* node text and target, so both sides compare equal.
|
|
2741
|
-
*
|
|
2742
|
-
* Also strips the space left AFTER `(` `[` `{` by the collapse: a
|
|
2743
|
-
* multi-line call whose arguments start on the next line normalizes to
|
|
2744
|
-
* `f( x)` while the LLM's compact print is `f(x)`, and that one space
|
|
2745
|
-
* defeated exact matching for the call and every enclosing node — the
|
|
2746
|
-
* opening-delimiter mirror of the #335 trailing comma (#336). Symmetric
|
|
2747
|
-
* for the same reason.
|
|
2748
|
-
*/
|
|
2749
|
-
private normalizeWhitespace;
|
|
2750
2638
|
/**
|
|
2751
2639
|
* Format a human-readable location string for error messages.
|
|
2752
2640
|
*/
|