Skip to content

Commit 4f1b767

Browse files
committed
chore(sync): cascade fleet template@a8d9420
Auto-applied by socket-wheelhouse sync-scaffolding into cascade-socket-registry-52381. 263 file(s) touched: - .claude/hooks/_shared/acorn/README.md - .claude/hooks/_shared/acorn/acorn-bindgen.cjs - .claude/hooks/_shared/acorn/acorn-wasm-sync.mts - .claude/hooks/_shared/acorn/acorn.wasm - .claude/hooks/_shared/acorn/index.mts - .claude/hooks/_shared/bash-quote-mask.mts - .claude/hooks/_shared/hook-env.mts - .claude/hooks/_shared/payload.mts - .claude/hooks/_shared/stop-reminder.mts - .claude/hooks/_shared/test/transcript.test.mts - .claude/hooks/_shared/token-patterns.mts - .claude/hooks/_shared/transcript.mts - .claude/hooks/_shared/wheelhouse-root.mts - .claude/hooks/actionlint-on-workflow-edit/index.mts - .claude/hooks/actionlint-on-workflow-edit/test/index.test.mts - .claude/hooks/ask-suppression-reminder/index.mts - .claude/hooks/ask-suppression-reminder/test/index.test.mts - .claude/hooks/auth-rotation-reminder/index.mts - .claude/hooks/auth-rotation-reminder/services.mts - .claude/hooks/auth-rotation-reminder/test/auth-rotation-reminder.test.mts ... and 243 more
1 parent 07d0e22 commit 4f1b767

263 files changed

Lines changed: 9491 additions & 4521 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# acorn-wasm — shared parser for fleet hooks
2+
3+
Vendored from
4+
[`@ultrathink/acorn-monorepo`](https://github.com/SocketDev/ultrathink/tree/main/packages/acorn)'s
5+
Rust → WebAssembly prod build (path:
6+
`packages/acorn/lang/rust/build/prod/darwin-arm64/wasm/out/Final/`).
7+
Pending `@ultrathink/acorn` ship to the npm registry, fleet hooks
8+
that need AST-aware analysis `import` from here.
9+
10+
## Provenance
11+
12+
The three vendored files come straight from the ultrathink prod build:
13+
14+
- `acorn.wasm` — compiled Rust acorn parser, ~3.3 MB.
15+
- `acorn-bindgen.cjs` — wasm-bindgen JS glue.
16+
- `acorn-wasm-sync.mts` — sync ESM loader (no top-level await,
17+
`WebAssembly.Instance` constructed at module import).
18+
19+
The artifact is rebuilt in ultrathink with `pnpm run
20+
build:wasm:node:release` from `packages/acorn/lang/rust`.
21+
22+
## Refreshing
23+
24+
Hooks importing this directory don't need to do anything special —
25+
the cascade keeps the files byte-identical with the ultrathink
26+
canonical source. To pull a newer build:
27+
28+
```bash
29+
# Inside socket-wheelhouse (the canonical source for fleet template):
30+
node scripts/refresh-vendored-acorn.mts
31+
```
32+
33+
The script reads from
34+
`$ULTRATHINK_ROOT/packages/acorn/lang/rust/build/prod/darwin-arm64/wasm/out/Final/`,
35+
copies the three files into this directory, and updates this README's
36+
"Last refreshed" line.
37+
38+
Last refreshed: 2026-05-20 (ultrathink build dated 2026-05-20).
39+
40+
## Public surface
41+
42+
`template/.claude/hooks/_shared/acorn/index.mts` is the canonical
43+
import path for fleet hooks. It re-exports a narrow `tryParse` /
44+
`walkSimple` / `findBareCallsTo` surface — see the module's JSDoc for
45+
the parse-failure tolerance + visitor patterns hook authors rely on.
46+
47+
Don't import `acorn-wasm-sync.mts` directly from hooks; the `index.mts`
48+
wrapper provides the failure-handling + visitor adapters every hook
49+
needs.
50+
51+
## Why vendor instead of `import 'acorn'`
52+
53+
- **No JS parser in the npm dep graph.** Hooks fire on every Edit/Write.
54+
A 3-5 MB JS bundle in `node_modules` adds startup latency and Socket-
55+
score risk on every fleet repo.
56+
- **AST parity with the lint plugin.** Both surfaces (oxlint via plugin
57+
- hook via this loader) use the same acorn semantics — the rules can
58+
share visitor logic without divergence between commit-time and
59+
edit-time.
60+
- **wasm sandbox.** The parser runs in WebAssembly with no filesystem
61+
/ network access — even a malicious source file under analysis can't
62+
reach the host.
63+
64+
Retire this directory once `@ultrathink/acorn` ships and the wheelhouse
65+
catalog can pin it.

0 commit comments

Comments
 (0)