@primitive.ai/prim 0.1.0-alpha.93 → 0.1.0-alpha.96
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/README.md +57 -12
- package/SKILL.md +5 -2
- package/dist/{chunk-UKUAAAXE.js → chunk-27ADT6FQ.js} +2 -2
- package/dist/{chunk-OTHKG76J.js → chunk-35FMRWJH.js} +1 -1
- package/dist/{chunk-DXJQR4QI.js → chunk-4GHANPWQ.js} +2 -2
- package/dist/{chunk-DCJN6LZH.js → chunk-7KABYYWG.js} +747 -430
- package/dist/{chunk-LFFLHSQO.js → chunk-CU7RW7XU.js} +63 -6
- package/dist/{chunk-H4UNYFUC.js → chunk-DHOQGHKQ.js} +184 -1
- package/dist/{chunk-2GP5UFV7.js → chunk-DWRSEC34.js} +5 -3
- package/dist/{chunk-36TWVNBE.js → chunk-FVDBULGZ.js} +9 -11
- package/dist/{chunk-G2VMA2QO.js → chunk-LY6NJ7KL.js} +6 -4
- package/dist/{chunk-ZB4F75SZ.js → chunk-MXVCP33E.js} +5 -1
- package/dist/{chunk-TYAHC25F.js → chunk-QCBB5HFX.js} +1 -1
- package/dist/{chunk-C3VAA5CG.js → chunk-RK4ZS3HG.js} +2 -2
- package/dist/{chunk-ZU563PQI.js → chunk-ROLYLXJS.js} +2 -2
- package/dist/{chunk-OH3EZXYX.js → chunk-UO2U6IKF.js} +1 -1
- package/dist/{chunk-K7D2EYBS.js → chunk-URLLSALP.js} +2 -2
- package/dist/chunk-XEDJ5N3M.js +177 -0
- package/dist/{chunk-X64HTHUF.js → chunk-Y5W4TZM7.js} +202 -10
- package/dist/{chunk-ICM2XCXS.js → chunk-YYE2NLWX.js} +2 -2
- package/dist/{chunk-DSWT6BCC.js → chunk-Z6NPNLOT.js} +825 -665
- package/dist/daemon/server.js +836 -540
- package/dist/hook-runtime/daemon/server.js +836 -540
- package/dist/hook-runtime/hooks/post-commit.js +978 -566
- package/dist/hook-runtime/hooks/post-rewrite.js +836 -540
- package/dist/hook-runtime/hooks/post-tool-use.js +1215 -796
- package/dist/hook-runtime/hooks/pre-tool-use.js +2100 -1741
- package/dist/hook-runtime/hooks/prim-hook.js +1312 -861
- package/dist/hook-runtime/hooks/session-end.js +232 -134
- package/dist/hook-runtime/hooks/session-start.js +1799 -935
- package/dist/hook-runtime/index.js +3628 -2461
- package/dist/hooks/post-commit.js +14 -10
- package/dist/hooks/post-rewrite.js +10 -10
- package/dist/hooks/post-tool-use.js +20 -20
- package/dist/hooks/pre-commit.js +4 -4
- package/dist/hooks/pre-tool-use.js +29 -17
- package/dist/hooks/prim-hook.js +22 -18
- package/dist/hooks/session-end.js +11 -5
- package/dist/hooks/session-start.js +46 -28
- package/dist/index.js +623 -390
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -75,7 +75,7 @@ Install the Primitive CLI and activate passive decision capture for this reposit
|
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
That single command runs the whole install and current-repository activation in one
|
|
78
|
-
process (auth → session hooks → daemon → git hooks →
|
|
78
|
+
process (auth → session hooks → daemon → skill → activate this repository and wire its git hooks → welcome). The detailed
|
|
79
79
|
step-by-step the agent follows — and the manual fallback — live in
|
|
80
80
|
[`setup.md`](./setup.md).
|
|
81
81
|
|
|
@@ -89,12 +89,17 @@ prim setup --agent cursor # Same, for Cursor IDE and Cursor CLI
|
|
|
89
89
|
prim setup --agent codex # Same, for OpenAI Codex
|
|
90
90
|
prim setup --agent hermes # Same, for Hermes Agent (global-only config)
|
|
91
91
|
prim setup --no-daemon # Stop it and persistently opt out of supervised delivery
|
|
92
|
+
prim setup --global-hooks-path # Also route every repository's git hooks through prim
|
|
92
93
|
```
|
|
93
94
|
|
|
94
|
-
Orchestrates auth → session hooks → supervised daemon →
|
|
95
|
+
Orchestrates auth → session hooks → supervised daemon → git hooks (`--scope project`, or `--global-hooks-path`) → skill → activate this repo (which wires its git hooks) → capture-health gate → welcome,
|
|
95
96
|
re-running each underlying command so every step behaves exactly as if run by
|
|
96
97
|
hand (including the browser login). Idempotent — safe to re-run.
|
|
97
98
|
|
|
99
|
+
Setup wires the current repository's git hooks and never changes git's global
|
|
100
|
+
config on its own: a global `core.hooksPath` reroutes every repository on the
|
|
101
|
+
machine. Pass `--global-hooks-path` to opt in; `prim --yes setup` does not.
|
|
102
|
+
|
|
98
103
|
### Uninstall
|
|
99
104
|
|
|
100
105
|
```bash
|
|
@@ -143,9 +148,12 @@ graph, and presence is reported. Each hook
|
|
|
143
148
|
self-resolves the CLI at run time (PATH, then a local install, then
|
|
144
149
|
`npx --yes @latest`), so it keeps working with no global install.
|
|
145
150
|
|
|
146
|
-
Installs into the current project by default — the repo's `.claude/settings.json
|
|
147
|
-
|
|
148
|
-
pass `--scope user` to install machine-wide.
|
|
151
|
+
Installs into the current project by default — the repo's `.claude/settings.json`
|
|
152
|
+
or `.cursor/hooks.json`, resolved from the git root (so any subdirectory works);
|
|
153
|
+
pass `--scope user` to install machine-wide. Codex defaults to user scope
|
|
154
|
+
(`~/.codex/hooks.json`): Codex reads a project `.codex/hooks.json` only from the
|
|
155
|
+
checkout it lives in and trusts it by absolute path, so a project install covers
|
|
156
|
+
that checkout only, not the repo's other worktrees. Hermes is the exception: it reads
|
|
149
157
|
shell hooks only from the global `~/.hermes/config.yaml`, so `prim hermes install`
|
|
150
158
|
is always user-scoped — and prim merges in place, leaving the rest of that file
|
|
151
159
|
(providers, models, your own hooks) untouched.
|
|
@@ -155,7 +163,7 @@ prim claude install # Install Claude Code hooks (project scope; u
|
|
|
155
163
|
prim claude install --scope user # Install machine-wide instead
|
|
156
164
|
prim cursor install # Install native Cursor hooks (project scope)
|
|
157
165
|
prim cursor install --scope user # Install hooks, skill, and CLI footer machine-wide
|
|
158
|
-
prim codex install # Install OpenAI Codex hooks (project
|
|
166
|
+
prim codex install # Install OpenAI Codex hooks (user scope; --scope project for this checkout only)
|
|
159
167
|
prim hermes install # Install Hermes Agent hooks (global ~/.hermes/config.yaml)
|
|
160
168
|
```
|
|
161
169
|
|
|
@@ -321,15 +329,52 @@ authorizes one retry for the named decision.
|
|
|
321
329
|
### Hooks
|
|
322
330
|
|
|
323
331
|
```bash
|
|
324
|
-
prim hooks install
|
|
325
|
-
prim hooks
|
|
332
|
+
prim hooks install # Wire the pre-commit, post-commit, and post-rewrite hooks
|
|
333
|
+
prim hooks install --scope user --global-hooks-path # Route every repository through prim (exits 3, with the reason on STDERR, if it installs nothing; 1 if prim's hook runtime is not staged)
|
|
334
|
+
prim hooks snippet post-commit # Print the block that wires one hook, to place by hand
|
|
335
|
+
prim hooks uninstall # Remove prim's blocks (and any hook file prim created)
|
|
326
336
|
```
|
|
327
337
|
|
|
328
338
|
The pre-commit hook checks staged files against the live decision graph
|
|
329
|
-
(warn-only — it never blocks the commit). The post-commit
|
|
330
|
-
commit as
|
|
331
|
-
|
|
332
|
-
|
|
339
|
+
(warn-only — it never blocks the commit). The post-commit and post-rewrite hooks
|
|
340
|
+
record each commit and each amend/rebase as capture boundaries for
|
|
341
|
+
classification. All three act only in repos where prim is active (`prim enable`).
|
|
342
|
+
Supports [Husky](https://typicode.github.io/husky/) — `prim hooks install`
|
|
343
|
+
detects Husky and offers to install into `.husky/`.
|
|
344
|
+
|
|
345
|
+
Each hook file gets one short block, inserted right after the shebang so it runs
|
|
346
|
+
before any `exit` or `exec`. The block names no version and no machine path: it
|
|
347
|
+
runs prim's staged entrypoint (`~/.config/prim/prim-git-hook-v1`) and does
|
|
348
|
+
nothing on a machine without prim, so a tracked `.husky/*` file never changes
|
|
349
|
+
across prim releases. `prim enable` and `prim hooks install` write it once and
|
|
350
|
+
never move or rewrite a current block, reformatted or not. Agent session hooks
|
|
351
|
+
only repair Git-private hook files under `.git` and prim's own hooks dir, and
|
|
352
|
+
never add the pre-commit check. prim never edits a hooks dir outside the
|
|
353
|
+
repository, such as a global `core.hooksPath` every repository shares, unless
|
|
354
|
+
you run `prim hooks install --scope user --global-hooks-path` or answer yes at
|
|
355
|
+
its terminal prompt. In a Husky v8 hook the block goes
|
|
356
|
+
after the `husky.sh` line, so it runs once and honors `HUSKY=0`. `prim doctor`
|
|
357
|
+
only reports; it never rewrites a hook.
|
|
358
|
+
|
|
359
|
+
`prim doctor` also checks evidence rather than file contents: each post-commit
|
|
360
|
+
run that reaches prim leaves a stamp in the checkout's git dir, and doctor's
|
|
361
|
+
`hook-fired` check fails when a local commit made since the hooks were wired
|
|
362
|
+
never reached prim. That catches an `exit` before prim's block, hand wiring
|
|
363
|
+
that broke, or a git client whose environment cannot find prim. The check
|
|
364
|
+
applies in manual mode too: once a repository is enabled, doctor expects your
|
|
365
|
+
own wiring to reach prim. `prim disable` ends the expectation, so commits made
|
|
366
|
+
while disabled are never judged. Turning prim off with `git config prim.active
|
|
367
|
+
false` directly ends it too, once an agent session starts while it is off; if
|
|
368
|
+
doctor still flags a commit made while it was off, run `prim disable` then
|
|
369
|
+
`prim enable`.
|
|
370
|
+
|
|
371
|
+
To wire the hooks yourself (lefthook, a custom Husky layout, …), run
|
|
372
|
+
`git config prim.gitHooks manual` (or `--global`) first: prim then never writes
|
|
373
|
+
a hook file. That setting is the only signal prim honors. It does not guess
|
|
374
|
+
from a hook that already mentions prim, so without it, `prim enable` adds its
|
|
375
|
+
block. Paste the block from `prim hooks snippet <hook>`, or have your hook
|
|
376
|
+
manager run `~/.config/prim/prim-git-hook-v1 <hook> "$@"` (post-rewrite also
|
|
377
|
+
needs Git's stdin).
|
|
333
378
|
|
|
334
379
|
### Presence statusline
|
|
335
380
|
|
package/SKILL.md
CHANGED
|
@@ -223,7 +223,7 @@ With the daemon running (`npx --yes @primitive.ai/prim daemon start`), `npx --ye
|
|
|
223
223
|
|
|
224
224
|
## The git hooks
|
|
225
225
|
|
|
226
|
-
`npx --yes @primitive.ai/prim hooks install` installs
|
|
226
|
+
`npx --yes @primitive.ai/prim hooks install` installs three git hooks:
|
|
227
227
|
|
|
228
228
|
```
|
|
229
229
|
npx --yes @primitive.ai/prim hooks install # auto-detects Husky and prompts
|
|
@@ -234,8 +234,11 @@ npx --yes @primitive.ai/prim hooks uninstall
|
|
|
234
234
|
|
|
235
235
|
- **pre-commit** -- checks staged files against the live decision graph and prints any active decisions that reference them to stderr. It is **warn-only**: failures (auth, network, backend) or matches never block the commit; a successful `git commit` doesn't prove the check ran clean. When the check can't complete it says so ("not verified" / "truncated") rather than implying all-clear.
|
|
236
236
|
- **post-commit** -- records each commit as a capture boundary so the server can classify the surrounding work into decisions. It never blocks and runs in the background.
|
|
237
|
+
- **post-rewrite** -- records amend/rebase rewrites the same way, in the background.
|
|
237
238
|
|
|
238
|
-
|
|
239
|
+
All three act only where the repo is active (`prim enable`). Each hook file gets one version-stable block right after its shebang; `prim enable` and `hooks install` write it once and never rewrite a current block, while session hooks only repair Git-private files under `.git` (and never add the pre-commit check). prim never edits a hooks dir outside the repository, such as a shared global `core.hooksPath`: `hooks install --scope user` changes git's global hooks only with `--global-hooks-path` or a yes typed at a terminal. That changes every repository, so never pass the flag for the user without asking, and know that `--yes` does not count. `prim doctor`'s `hook-fired` check fails if a local commit since the hooks were wired never reached prim (in manual mode too, once the repo is enabled): surface it, since capture is silently missing. If the user wires the hooks themselves, they must set `git config prim.gitHooks manual` (prim does not infer hand wiring from what a hook mentions); prim then never edits their hook files; `npx --yes @primitive.ai/prim hooks snippet <hook>` prints the block to place.
|
|
240
|
+
|
|
241
|
+
Under `CI=1` (or with `--non-interactive`), `hooks install` fails fast in a Husky repo that Husky has not yet configured, unless `--yes` or `--target` is set; the error names both escapes. `hooks uninstall` removes prim's blocks from `.git/hooks` and `.husky/` alike and leaves the rest of each hook untouched. To suppress the hooks for one commit, use `git commit --no-verify`.
|
|
239
242
|
|
|
240
243
|
These git hooks are separate from the **session hooks** (`claude install` / `cursor install` / `codex install` / `hermes install`) that drive in-session capture (and Conflict Gates, when enabled).
|
|
241
244
|
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
getClient,
|
|
3
3
|
getSiteUrl,
|
|
4
4
|
terminalSafeLine
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-LY6NJ7KL.js";
|
|
6
6
|
import {
|
|
7
7
|
daemonRequest
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-35FMRWJH.js";
|
|
9
9
|
|
|
10
10
|
// src/daemon/proxy.ts
|
|
11
11
|
var DAEMON_HTTP_TIMEOUT_MS = 1e4;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getSiteUrl
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LY6NJ7KL.js";
|
|
4
4
|
import {
|
|
5
5
|
atomicWriteFile,
|
|
6
6
|
ensureDurableDirectory,
|
|
7
7
|
jwtOrganizationId,
|
|
8
8
|
primConfigDirectory,
|
|
9
9
|
resolveAuthCredential
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-DWRSEC34.js";
|
|
11
11
|
|
|
12
12
|
// src/journal.ts
|
|
13
13
|
import {
|