Skip to content

Commit 1b9471c

Browse files
committed
chore(tools/prim): add pnpm prim script + fix install docs
Adds a `prim` script to root package.json so `pnpm prim <subcommand>` runs the tool from inside socket-lib without typing the full bin path. This is the canonical way to invoke the tool during fleet development. Why a script instead of relying on pnpm's bin-linking: pnpm doesn't auto-link bins of workspace packages that no other workspace depends on. `prim` is a no-consumer tool (it audits sibling repos), so `node_modules/.bin/prim` never gets created and `pnpm exec prim` fails with "Command not found." A root script side-steps that. README fixes: - Drop the misleading `pnpm dlx prim` line. The package is `"private": true` and won't ever be on npm. - Document `pnpm prim` as the in-repo entry point, with `node /path/to/socket-lib/tools/prim/bin/prim.mts` as the out-of-repo fallback. - Update all inline examples to use `pnpm prim` (was `prim`).
1 parent 2e0c074 commit 1b9471c

2 files changed

Lines changed: 19 additions & 10 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,7 @@
699699
"dev": "node scripts/build/main.mts --watch",
700700
"fix": "node scripts/fix.mts",
701701
"lint": "node scripts/lint.mts",
702+
"prim": "node tools/prim/bin/prim.mts",
702703
"security": "agentshield scan && { command -v zizmor >/dev/null && zizmor .github/ || echo 'zizmor not installed — run pnpm run setup to install'; }",
703704
"prepare": "husky && node scripts/build/main.mts --quiet",
704705
"prepublishOnly": "pnpm run build",

tools/prim/README.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,42 +23,50 @@ use primordials, and a state file for tracking progress across runs.
2323

2424
## Install
2525

26+
`prim` is a workspace-only tool — it isn't published to npm and never will be (`"private": true`). Two ways to run it:
27+
2628
```sh
27-
# Local checkout, run directly:
29+
# From inside socket-lib, use the root pnpm script:
30+
pnpm prim --help
31+
pnpm prim coverage --target ../socket-cli
32+
33+
# From outside socket-lib (e.g. when auditing a sibling repo), invoke
34+
# the bin directly:
2835
node /path/to/socket-lib/tools/prim/bin/prim.mts --help
2936
```
3037

31-
Once published to npm, `pnpm dlx prim` will work too.
38+
The `pnpm prim` form is the canonical way to run it during fleet
39+
development — it always picks up the live source under `tools/prim/`.
3240

3341
## Usage
3442

3543
`prim` is a multi-command CLI. Each subcommand does one thing.
3644

3745
```sh
3846
# Show help
39-
prim --help
47+
pnpm prim --help
4048

4149
# Find call sites you could migrate today (existing primordials)
42-
prim coverage --target ./socket-cli --dir dist
50+
pnpm prim coverage --target ../socket-cli --dir dist
4351

4452
# Find gaps in the primordials surface (need socket-lib expansion)
45-
prim gaps --target ./socket-cli
53+
pnpm prim gaps --target ../socket-cli
4654

4755
# Both at once, as a snapshot
48-
prim audit --target ./socket-cli --update-state
56+
pnpm prim audit --target ../socket-cli --update-state
4957

5058
# Inspect persisted state
51-
prim state
59+
pnpm prim state
5260

5361
# Dry-run a codemod over your source tree
54-
prim mod --target . --dir src
62+
pnpm prim mod --target . --dir src
5563

5664
# Apply for real (only after reviewing the dry-run!)
57-
prim mod --target . --dir src --apply
65+
pnpm prim mod --target . --dir src --apply
5866

5967
# Also rewrite prototype-method calls where the receiver type is
6068
# guessed from the variable name (more aggressive — needs review)
61-
prim mod --target . --dir src --include-guessed --apply
69+
pnpm prim mod --target . --dir src --include-guessed --apply
6270
```
6371

6472
### Subcommands

0 commit comments

Comments
 (0)