carrick 0.3.162 → 0.3.163
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/held/early.js +62 -3
- package/dist/held/early.js.map +1 -1
- package/dist/held/runtime.js +29 -1
- package/dist/held/runtime.js.map +1 -1
- package/dist/init/task-skills.d.ts +1 -1
- package/dist/init/task-skills.js +1 -0
- package/dist/init/task-skills.js.map +1 -1
- package/package.json +6 -6
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/sidecar/dist/src/capture/check-probe.d.ts +9 -4
- package/sidecar/dist/src/capture/check-probe.js +11 -5
- package/sidecar/dist/src/engine-stamp.json +1 -1
- package/sidecar/dist/src/type-inferrer.d.ts +76 -0
- package/sidecar/dist/src/type-inferrer.js +267 -5
- package/templates/skills/carrick-audit.md +97 -0
- package/templates/skills/carrick-census.md +73 -87
|
@@ -1,117 +1,103 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: carrick-census
|
|
3
|
-
description: Use
|
|
3
|
+
description: Use when the ask is which endpoints do X, such as every route that checks an admin role, every endpoint that sends an email or writes to a table, and which apps call them, and before changing a shared helper, to see which endpoints and apps depend on it. Finds the helper by meaning, walks the call graph up to the endpoints, and names each endpoint's callers in other services.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Which endpoints do X, and who calls them
|
|
7
7
|
|
|
8
8
|
{{SCOPE_NOTE}}
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
Grep finds the lines that do X. This skill answers what grep cannot: which
|
|
11
|
+
endpoints reach those lines, and which apps call those endpoints. Grep for the
|
|
12
|
+
raw lines as well; the two answers go side by side.
|
|
12
13
|
|
|
13
|
-
## 1.
|
|
14
|
+
## 1. Find the shared function that does X
|
|
14
15
|
|
|
15
|
-
Ask in two wordings
|
|
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.
|
|
16
|
+
Ask in two wordings, one for what the code is for and one for how it does it:
|
|
18
17
|
|
|
19
18
|
```
|
|
20
19
|
search_by_intent({{SCOPE}}, query: "<what it is for>", also_phrased_as: ["<how it does it>"], compact: true, top_k: 20)
|
|
21
20
|
```
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
`matched_phrasings` on each row saying which ones reached it. Page it while
|
|
26
|
-
`has_more` is true:
|
|
22
|
+
Where the answer carries no `phrasings`, run the second wording as its own
|
|
23
|
+
search.
|
|
27
24
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
paged search.
|
|
35
|
-
|
|
36
|
-
Stop when `has_more` is false. Lower `similarity_threshold` where the tail of a
|
|
37
|
-
page is still on topic.
|
|
38
|
-
|
|
39
|
-
## 2. Union
|
|
40
|
-
|
|
41
|
-
One answer over both wordings is already deduped, and `matched_phrasings` says
|
|
42
|
-
which wordings reached each row. Two answers are joined here, on `file_path` and
|
|
43
|
-
`line_number`, and a row both wordings found is one row. Either way keep
|
|
44
|
-
`retrieved_by` and `similarity`, and keep which wording found each row. A row
|
|
45
|
-
only one wording reached is the row a single search would have lost.
|
|
46
|
-
|
|
47
|
-
## 3. Receipt
|
|
48
|
-
|
|
49
|
-
Report these numbers before the list, per query where the field is per query:
|
|
25
|
+
Read each row at `file_path` from `line_number` to `end_line`. Keep the rows that
|
|
26
|
+
do X, and among them find the lowest: the function the others call to do it,
|
|
27
|
+
such as the function that builds the mail client and sends, or the role check
|
|
28
|
+
itself. Stop paging when a page holds no row that does X. Do not change
|
|
29
|
+
`similarity_threshold` while paging: a new threshold is a new list, so start it
|
|
30
|
+
again at offset 0.
|
|
50
31
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
the case for one more search at a lower `similarity_threshold`;
|
|
56
|
-
- `hidden_by_lexical_floor` where the answer carries it: how many rows matched a
|
|
57
|
-
word of the query but too little of its word weight to rank, and `best` where
|
|
58
|
-
it names the nearest of them, with the weight it reached against the bar it
|
|
59
|
-
had to clear. A lower `similarity_threshold` does not reach these rows. The
|
|
60
|
-
search that does names the identifier or the rare term itself;
|
|
61
|
-
- `total_without_intent`, which is index-wide: functions carrying no intent
|
|
62
|
-
text, which the search ranked on their name, signature and body tokens
|
|
63
|
-
alone, so a query that names one finds it and a query that describes what
|
|
64
|
-
it does without naming it does not;
|
|
65
|
-
- `total_intent_carried_forward` where the response states it, which are intents
|
|
66
|
-
describing the code as of an earlier scan.
|
|
32
|
+
Where the question names an identifier (a function, an env var, a table, a
|
|
33
|
+
header, a package), grep for it too. For each grep hit inside a function, find
|
|
34
|
+
that function with `list_function_intents({{SCOPE}}, file: "<file>", compact: true)`:
|
|
35
|
+
the row whose line span holds the hit.
|
|
67
36
|
|
|
68
|
-
|
|
69
|
-
main branch, so a change on a branch is outside it. It indexes functions that
|
|
70
|
-
carry an intent, so a match inside a config file, a template or generated output
|
|
71
|
-
is outside it as well.
|
|
37
|
+
## 2. Walk up to the endpoints
|
|
72
38
|
|
|
73
|
-
|
|
39
|
+
For each shared function from step 1, one call:
|
|
74
40
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
handler or a client, and a route handler for a different operation is not a hit.
|
|
79
|
-
|
|
80
|
-
## 5. Follow helpers to callers
|
|
41
|
+
```
|
|
42
|
+
get_callers({{SCOPE}}, function_name: "<name>", file: "<file>", depth: 3)
|
|
43
|
+
```
|
|
81
44
|
|
|
82
|
-
|
|
83
|
-
the
|
|
84
|
-
|
|
45
|
+
Each row is a function that holds a call, and its `chain` runs from it down to
|
|
46
|
+
the function you asked about. Sort every row into one of these:
|
|
47
|
+
|
|
48
|
+
- **Route handler.** Confirm it with
|
|
49
|
+
`get_api_endpoints({{SCOPE}}, service: "<service>", path_contains: "<path fragment>")`:
|
|
50
|
+
the endpoint whose `file_location` and `handler_span` hold the row is the one.
|
|
51
|
+
Take the path from that endpoint, never from the handler's name.
|
|
52
|
+
- **GraphQL resolvers.** A row named `queryFields_handler` or
|
|
53
|
+
`mutationFields_handler` spans a whole file of resolvers. Read the source at
|
|
54
|
+
`call_site_line` to name the field, then confirm it with
|
|
55
|
+
`get_operation({{SCOPE}}, method: "QUERY" or "MUTATION", path: "<field>")`.
|
|
56
|
+
A `call_entries` above 1 means more than one field in that file makes the
|
|
57
|
+
call: read every call in the span, not only `call_site_line`.
|
|
58
|
+
- **Middleware.** A `use_handler` row gates a router. Grep that router's file
|
|
59
|
+
for `.route(` and `.use(` to find what is mounted behind it, list those routes
|
|
60
|
+
with `get_api_endpoints` and `path_contains` on the outermost mount path (one
|
|
61
|
+
call also returns the routers mounted under it), and give the count.
|
|
62
|
+
- **Uses the check without gating on it.** A handler that only branches on the
|
|
63
|
+
result, or lets some callers past it, is not a gate. List it apart, under
|
|
64
|
+
"uses X without enforcing it", with file:line and what it does instead.
|
|
65
|
+
- **Dead end.** A chain whose top is an anonymous callback (a name like
|
|
66
|
+
`andThen_handler`), a class method, a webhook or event registry, or `<module>`
|
|
67
|
+
(top-level code, whose result is passed around as a value the index does not
|
|
68
|
+
follow). Grep the repo for the top function's name and follow its importers,
|
|
69
|
+
one hop at a time, until you reach the router or registration call that runs
|
|
70
|
+
it. If that finds the route, add it, marked "found by grep". If not, list it under
|
|
71
|
+
"chains that stop", with file:line and where it stops.
|
|
72
|
+
|
|
73
|
+
Rows under `unfollowed_calls` may also call the function: read each one in
|
|
74
|
+
source and keep it if it does.
|
|
75
|
+
|
|
76
|
+
## 3. Who calls each endpoint
|
|
85
77
|
|
|
86
78
|
```
|
|
87
|
-
|
|
79
|
+
get_operation({{SCOPE}}, method: "<METHOD>", path: "<path>")
|
|
88
80
|
```
|
|
89
81
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
carries it, and list the helper itself apart as the mechanism.
|
|
94
|
-
|
|
95
|
-
Where the question names an identifier, such as an environment variable, a
|
|
96
|
-
table or a header, grep the source for that identifier as well and merge the two
|
|
97
|
-
lists on file and line. A match inside a config file, a template or generated
|
|
98
|
-
output reaches you only this way. Mark each row with how it was found: index,
|
|
99
|
-
callers, grep.
|
|
82
|
+
Read `consumers` only: service and `call_file_location`. Skip `unread_sites`.
|
|
83
|
+
Where more than 10 endpoints were reached, do this for the 10 the question
|
|
84
|
+
cares about most and say how many were not looked up.
|
|
100
85
|
|
|
101
|
-
##
|
|
86
|
+
## 4. Report
|
|
102
87
|
|
|
103
|
-
|
|
|
88
|
+
| endpoint | how it does X (call chain) | called by (service, file:line) | found by |
|
|
104
89
|
|---|---|---|---|
|
|
105
|
-
|
|
|
90
|
+
| GET /bills/:billId/file | handler → isAdminUser | web: src/pages/BillPage.tsx:40 | index |
|
|
106
91
|
|
|
107
|
-
|
|
108
|
-
searched.
|
|
92
|
+
Then, apart from the table:
|
|
109
93
|
|
|
110
|
-
|
|
94
|
+
- chains that stop, each with file:line and where it stops;
|
|
95
|
+
- handlers that use X without enforcing it, each with file:line;
|
|
96
|
+
- the lines that do X but reach no endpoint (scripts, top-level code, frontend
|
|
97
|
+
pages), from grep, each with file:line;
|
|
98
|
+
- for a question about frontend code only (pages, components), say that the
|
|
99
|
+
table stays empty because the index holds no route list for frontend routers,
|
|
100
|
+
and that the answer is the grep list plus the callers of the shared function;
|
|
101
|
+
- the counts: shared functions followed, endpoints reached, callers listed.
|
|
111
102
|
|
|
112
|
-
Change nothing unless you were asked to.
|
|
113
|
-
work, and file the ones accepted:
|
|
114
|
-
|
|
115
|
-
```
|
|
116
|
-
gh issue create --title "<concept>: <n> places, <m> need changing" --body "<the table, and the receipt>"
|
|
117
|
-
```
|
|
103
|
+
Change nothing unless you were asked to.
|