Commit fc64033
committed
feat(prim): AI-deferred disambiguator + programmatic-Claude lockdown
Adds an AI-deferred receiver-type classifier to the `prim` audit/codemod
for the duck-typed prototype methods (`.test`, `.then`, `.exec`,
`.catch`, `.finally`) that the static heuristic can't classify
(semver Range.test → not RegExp; PromiseLike .then → not Promise).
Opt-in via `--ai-disambiguate`; cached on disk so re-runs are free.
Reference impl for the new fleet-wide
"Programmatic Claude Invocation Lockdown" pattern:
- src/disambiguate.mts: SDK-form `query()` callsite with all four
lockdown flags wired (tools, allowedTools, disallowedTools,
permissionMode: 'dontAsk') per the official permission flow at
https://code.claude.com/docs/en/agent-sdk/permissions.
- src/ambiguous-methods.mts: the hard-cases table.
- test/disambiguate.test.mts: 10 tests including source-text
guards that fail if BASE_TOOLS widens, if `tools: BASE_TOOLS`
is unwired, or if permissionMode drifts from 'dontAsk'.
CLAUDE.md gains one bullet pointing at the new
.claude/skills/programmatic-claude-lockdown/SKILL.md (cascaded from
socket-repo-template), which holds the four-flag table, both
recipes (read-only and Bash-needing), and the never-do list.
Tools/prim package additions: peer dep on @anthropic-ai/claude-agent-sdk
(optional via peerDependenciesMeta), test script, README section.
.gitignore: .prim-cache/.
Drive-by: fix releases-socket-btm.test.mts mock to resolve undefined
(not null) — fallout from the prior null→undefined migration.1 parent ec2d3d4 commit fc64033
14 files changed
Lines changed: 1986 additions & 49 deletions
File tree
- .claude/skills/programmatic-claude-lockdown
- test/unit
- tools/prim
- src
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
26 | 32 | | |
27 | 33 | | |
28 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| 149 | + | |
149 | 150 | | |
150 | 151 | | |
151 | 152 | | |
| |||
0 commit comments