@primitive.ai/prim 0.1.0-alpha.117 → 0.1.0-alpha.119
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 +21 -21
- package/SKILL.md +3 -3
- package/dist/{chunk-FTW4ZCBA.js → chunk-2AKDX4RU.js} +1 -1
- package/dist/{chunk-D3ZDZZYS.js → chunk-2JA524SC.js} +31 -17
- package/dist/{chunk-I3J344DF.js → chunk-4L7TAM5S.js} +122 -287
- package/dist/{chunk-3TIKBQHV.js → chunk-5BQ2NEMP.js} +2741 -2540
- package/dist/{chunk-LEUZDTNT.js → chunk-A6M2M5A2.js} +1 -1
- package/dist/{chunk-JKJ22ONL.js → chunk-CCGFRNAA.js} +6 -6
- package/dist/{chunk-CXMLAWC2.js → chunk-CSE44DPA.js} +2 -2
- package/dist/{chunk-NEQI2VLM.js → chunk-D235RJNO.js} +5 -5
- package/dist/{chunk-4SN5BCIG.js → chunk-GYQOZGGF.js} +2 -2
- package/dist/{chunk-LLKJAET2.js → chunk-HXICZG5J.js} +8 -16
- package/dist/chunk-JSBRDJBE.js +30 -0
- package/dist/chunk-KZB4ABIB.js +13 -0
- package/dist/{chunk-KGBMU76T.js → chunk-LBCPRHNG.js} +1 -1
- package/dist/{chunk-HMD5K6W7.js → chunk-LTTF4MBE.js} +2 -2
- package/dist/{chunk-JKO6PZWQ.js → chunk-MWNRXAEB.js} +26 -48
- package/dist/{chunk-6IRAGUYK.js → chunk-NQFRQ56V.js} +2 -2
- package/dist/{chunk-XG7S3LIL.js → chunk-P2O7NLVN.js} +887 -918
- package/dist/{chunk-J5HBSRAV.js → chunk-SLDZJD6Q.js} +1 -1
- package/dist/{chunk-4OEJ2ONG.js → chunk-TC4FTRYO.js} +2 -13
- package/dist/{chunk-6JHKKLA2.js → chunk-U67RBNIZ.js} +46 -46
- package/dist/{chunk-S55JKCHQ.js → chunk-VOC4KOOP.js} +2 -2
- package/dist/chunk-W27EFR7W.js +271 -0
- package/dist/{chunk-RLBASQJD.js → chunk-XWAKFL3T.js} +9 -7
- package/dist/daemon/server.js +2733 -2531
- package/dist/hook-runtime/daemon/server.js +2734 -2531
- package/dist/hook-runtime/hooks/post-commit.js +2741 -2538
- package/dist/hook-runtime/hooks/post-rewrite.js +2741 -2538
- package/dist/hook-runtime/hooks/post-tool-use.js +2883 -2579
- package/dist/hook-runtime/hooks/pre-commit.js +1 -0
- package/dist/hook-runtime/hooks/pre-tool-use-worker.js +35089 -0
- package/dist/hook-runtime/hooks/pre-tool-use.js +109 -35539
- package/dist/hook-runtime/hooks/prim-hook.js +2875 -2571
- package/dist/hook-runtime/hooks/session-end.js +19 -16
- package/dist/hook-runtime/hooks/session-start.js +2834 -2632
- package/dist/hook-runtime/index.js +3030 -2830
- package/dist/hook-runtime/statusline-main.js +6 -2
- package/dist/hooks/post-commit.js +8 -7
- package/dist/hooks/post-rewrite.js +7 -6
- package/dist/hooks/post-tool-use.js +26 -22
- package/dist/hooks/pre-commit.js +5 -4
- package/dist/hooks/pre-tool-use-worker.js +264 -0
- package/dist/hooks/pre-tool-use.js +93 -250
- package/dist/hooks/prim-hook.js +26 -22
- package/dist/hooks/session-end.js +10 -7
- package/dist/hooks/session-start.js +22 -19
- package/dist/index.js +59 -54
- package/dist/statusline-main.js +5 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -19,34 +19,43 @@ import {
|
|
|
19
19
|
resolveRepositoryBinding,
|
|
20
20
|
uninstallGitHookAtPath,
|
|
21
21
|
uninstallProjectGitHook
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-CCGFRNAA.js";
|
|
23
23
|
import {
|
|
24
24
|
requireDurableIngestAcknowledgement
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-A6M2M5A2.js";
|
|
26
26
|
import {
|
|
27
27
|
checkAffectedDecisions,
|
|
28
28
|
daemonOrDirectGet,
|
|
29
29
|
formatDecisionsWarning
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-D235RJNO.js";
|
|
31
31
|
import {
|
|
32
32
|
hasCompleteCoverage,
|
|
33
33
|
requestPreflight,
|
|
34
34
|
waitForPreflight
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-2JA524SC.js";
|
|
36
36
|
import {
|
|
37
37
|
fetchFeedbackCapability
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-2AKDX4RU.js";
|
|
39
39
|
import {
|
|
40
40
|
POST_COMMIT_GRACE_MS,
|
|
41
41
|
clearHooksWired,
|
|
42
42
|
inspectPostCommitFiring,
|
|
43
43
|
lastConversationCaptured,
|
|
44
44
|
recordHooksWired
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-LBCPRHNG.js";
|
|
46
46
|
import {
|
|
47
47
|
isUnattended,
|
|
48
48
|
unattendedEnv
|
|
49
49
|
} from "./chunk-OYHYCK4K.js";
|
|
50
|
+
import {
|
|
51
|
+
MS_PER_SECOND,
|
|
52
|
+
deliveryBacklogState,
|
|
53
|
+
deliveryBacklogSummary,
|
|
54
|
+
formatPendingBacklog,
|
|
55
|
+
formatStatusline,
|
|
56
|
+
formatTeammates,
|
|
57
|
+
repositoryBindingDiagnosticLabel
|
|
58
|
+
} from "./chunk-GYQOZGGF.js";
|
|
50
59
|
import {
|
|
51
60
|
JOURNAL_DIR,
|
|
52
61
|
SESSIONS_DIR,
|
|
@@ -61,7 +70,11 @@ import {
|
|
|
61
70
|
rotationIdentity,
|
|
62
71
|
sweepOrphanedDrainProgress,
|
|
63
72
|
writeDrainCheckpoint
|
|
64
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-LTTF4MBE.js";
|
|
74
|
+
import {
|
|
75
|
+
daemonIsLive,
|
|
76
|
+
daemonRequest
|
|
77
|
+
} from "./chunk-SLDZJD6Q.js";
|
|
65
78
|
import {
|
|
66
79
|
RUN_ID,
|
|
67
80
|
demoCommand,
|
|
@@ -80,17 +93,34 @@ import {
|
|
|
80
93
|
readDemoJson,
|
|
81
94
|
readRun,
|
|
82
95
|
saveRun
|
|
83
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-4L7TAM5S.js";
|
|
84
97
|
import {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
98
|
+
MANAGED_GIT_HOOK_NAMES,
|
|
99
|
+
assertOwnedHookRuntime,
|
|
100
|
+
atomicWrite,
|
|
101
|
+
ensureRegistration,
|
|
102
|
+
entryHasCommand,
|
|
103
|
+
hookRuntimePaths,
|
|
104
|
+
inspectFailureProtection,
|
|
105
|
+
inspectGitHookEntrypoint,
|
|
106
|
+
inspectHookRuntime,
|
|
107
|
+
inspectHookRuntimeResolutions,
|
|
108
|
+
inspectHookRuntimeResolutions2,
|
|
109
|
+
makeRegistration,
|
|
110
|
+
managedHookBlock,
|
|
111
|
+
performStatus,
|
|
112
|
+
performStatus2,
|
|
113
|
+
projectRoot,
|
|
114
|
+
readSettings,
|
|
115
|
+
registerClaudeCommands,
|
|
116
|
+
registerCursorCommands,
|
|
117
|
+
removeHookRuntime,
|
|
118
|
+
reportFailureProtection,
|
|
119
|
+
stableNodePath,
|
|
120
|
+
stageHookRuntime,
|
|
121
|
+
stripCommand
|
|
122
|
+
} from "./chunk-MWNRXAEB.js";
|
|
123
|
+
import "./chunk-NQFRQ56V.js";
|
|
94
124
|
import {
|
|
95
125
|
bold,
|
|
96
126
|
boundedHealthError,
|
|
@@ -115,7 +145,7 @@ import {
|
|
|
115
145
|
isMoveIngestRequest,
|
|
116
146
|
isReconcileResolutionResponse,
|
|
117
147
|
stripAnsi
|
|
118
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-5BQ2NEMP.js";
|
|
119
149
|
import {
|
|
120
150
|
CliManagementResponseError,
|
|
121
151
|
HttpError,
|
|
@@ -133,37 +163,7 @@ import {
|
|
|
133
163
|
setStoredToken,
|
|
134
164
|
stripControlChars,
|
|
135
165
|
terminalSafeLine
|
|
136
|
-
} from "./chunk-
|
|
137
|
-
import {
|
|
138
|
-
MANAGED_GIT_HOOK_NAMES,
|
|
139
|
-
assertOwnedHookRuntime,
|
|
140
|
-
atomicWrite,
|
|
141
|
-
ensureRegistration,
|
|
142
|
-
entryHasCommand,
|
|
143
|
-
hookRuntimePaths,
|
|
144
|
-
inspectFailureProtection,
|
|
145
|
-
inspectGitHookEntrypoint,
|
|
146
|
-
inspectHookRuntime,
|
|
147
|
-
inspectHookRuntimeResolutions,
|
|
148
|
-
inspectHookRuntimeResolutions2,
|
|
149
|
-
makeRegistration,
|
|
150
|
-
managedHookBlock,
|
|
151
|
-
performStatus,
|
|
152
|
-
performStatus2,
|
|
153
|
-
projectRoot,
|
|
154
|
-
readSettings,
|
|
155
|
-
registerClaudeCommands,
|
|
156
|
-
registerCursorCommands,
|
|
157
|
-
removeHookRuntime,
|
|
158
|
-
reportFailureProtection,
|
|
159
|
-
stableNodePath,
|
|
160
|
-
stageHookRuntime,
|
|
161
|
-
stripCommand
|
|
162
|
-
} from "./chunk-JKO6PZWQ.js";
|
|
163
|
-
import {
|
|
164
|
-
daemonIsLive,
|
|
165
|
-
daemonRequest
|
|
166
|
-
} from "./chunk-J5HBSRAV.js";
|
|
166
|
+
} from "./chunk-U67RBNIZ.js";
|
|
167
167
|
import {
|
|
168
168
|
REFRESH_TOKEN_PATH,
|
|
169
169
|
TOKEN_FILE_PATH,
|
|
@@ -197,7 +197,9 @@ import {
|
|
|
197
197
|
syncDirectory,
|
|
198
198
|
withFileLock,
|
|
199
199
|
withFileLockSync
|
|
200
|
-
} from "./chunk-
|
|
200
|
+
} from "./chunk-P2O7NLVN.js";
|
|
201
|
+
import "./chunk-W27EFR7W.js";
|
|
202
|
+
import "./chunk-JSBRDJBE.js";
|
|
201
203
|
|
|
202
204
|
// src/index.ts
|
|
203
205
|
import { readFileSync as readFileSync12 } from "fs";
|
|
@@ -5918,6 +5920,7 @@ var DecisionRescopeResponseError = class extends Error {
|
|
|
5918
5920
|
};
|
|
5919
5921
|
function projectScope(scope) {
|
|
5920
5922
|
return {
|
|
5923
|
+
...scope.scopeResolution === "unresolved" ? { scopeResolution: "unresolved" } : {},
|
|
5921
5924
|
location: {
|
|
5922
5925
|
repository: scope.location.repository,
|
|
5923
5926
|
directories: scope.location.directories,
|
|
@@ -6199,7 +6202,9 @@ function formatShowHuman(result) {
|
|
|
6199
6202
|
lines.push(` area: ${color(area, colorForArea(area))}`);
|
|
6200
6203
|
}
|
|
6201
6204
|
if (result.scope) {
|
|
6202
|
-
lines.push(
|
|
6205
|
+
lines.push(
|
|
6206
|
+
` scope: ${result.scope.scopeResolution === "unresolved" ? "Scope unknown \u2014 not enforced" : describeScope(result.scope.location)}`
|
|
6207
|
+
);
|
|
6203
6208
|
const effectiveWindow = describeEffectiveWindow(result.scope.time);
|
|
6204
6209
|
if (effectiveWindow) {
|
|
6205
6210
|
lines.push(` effective: ${effectiveWindow}`);
|
|
@@ -7597,7 +7602,7 @@ var CAPTURE_EVENTS = [
|
|
|
7597
7602
|
"on_session_end",
|
|
7598
7603
|
"subagent_stop"
|
|
7599
7604
|
];
|
|
7600
|
-
var GATE_TIMEOUT_SECONDS =
|
|
7605
|
+
var GATE_TIMEOUT_SECONDS = 2;
|
|
7601
7606
|
var REGISTRATIONS = [
|
|
7602
7607
|
...CAPTURE_EVENTS.map((event) => ({ event, bin: CAPTURE_BIN2 })),
|
|
7603
7608
|
{ event: "pre_tool_call", matcher: EDIT_MATCHER, bin: GATE_BIN2, timeout: GATE_TIMEOUT_SECONDS },
|
|
@@ -7619,7 +7624,7 @@ function entryFor(reg) {
|
|
|
7619
7624
|
if (reg.timeout !== void 0) {
|
|
7620
7625
|
entry.timeout = reg.timeout;
|
|
7621
7626
|
}
|
|
7622
|
-
if (reg.bin === GATE_BIN2) entry.fail_closed =
|
|
7627
|
+
if (reg.bin === GATE_BIN2) entry.fail_closed = false;
|
|
7623
7628
|
return entry;
|
|
7624
7629
|
}
|
|
7625
7630
|
function stripBin(list, bin) {
|
|
@@ -8892,7 +8897,7 @@ function checkPreflightHosts() {
|
|
|
8892
8897
|
return hosts.map((host) => {
|
|
8893
8898
|
const protection = inspectFailureProtection(host);
|
|
8894
8899
|
return {
|
|
8895
|
-
name: `${host} gate failure
|
|
8900
|
+
name: `${host} gate timeout and failure behavior`,
|
|
8896
8901
|
status: protection.status === "supported" ? "ok" : protection.status === "limited" ? "warn" : "fail",
|
|
8897
8902
|
detail: protection.detail
|
|
8898
8903
|
};
|
package/dist/statusline-main.js
CHANGED
|
@@ -583,7 +583,7 @@ var GIT_TIMEOUT_MS2 = 1e3;
|
|
|
583
583
|
var REPO_SYNC_ID_RE = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;
|
|
584
584
|
var PROJECT_INSTALL_FILES = [".claude/settings.json", ".codex/hooks.json", ".cursor/hooks.json"];
|
|
585
585
|
var PRIM_HOOK_BINS = ["prim-hook", "prim-pre-tool-use", "prim-post-tool-use"];
|
|
586
|
-
function repoActiveFlag(cwd) {
|
|
586
|
+
function repoActiveFlag(cwd, strict = false) {
|
|
587
587
|
try {
|
|
588
588
|
const value = execFileSync2("git", ["config", "--get", PRIM_ACTIVE_KEY], {
|
|
589
589
|
cwd,
|
|
@@ -593,8 +593,11 @@ function repoActiveFlag(cwd) {
|
|
|
593
593
|
}).trim();
|
|
594
594
|
if (value === "true") return "true";
|
|
595
595
|
if (value === "false") return "false";
|
|
596
|
+
if (strict) throw new Error("Repository activation is invalid");
|
|
596
597
|
return void 0;
|
|
597
|
-
} catch {
|
|
598
|
+
} catch (error) {
|
|
599
|
+
if (strict && !(typeof error === "object" && error !== null && "status" in error && error.status === 1))
|
|
600
|
+
throw error;
|
|
598
601
|
return void 0;
|
|
599
602
|
}
|
|
600
603
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primitive.ai/prim",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.119",
|
|
4
4
|
"description": "CLI for Primitive's decision graph — passive decision capture, conflict gate, and team presence",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"SKILL.md"
|
|
50
50
|
],
|
|
51
51
|
"scripts": {
|
|
52
|
-
"build": "tsup src/index.ts src/hooks/pre-commit.ts src/hooks/post-commit.ts src/hooks/post-rewrite.ts src/hooks/prim-hook.ts src/hooks/pre-tool-use.ts src/hooks/post-tool-use.ts src/hooks/session-start.ts src/hooks/session-end.ts --format esm --clean && tsup src/statusline-main.ts src/daemon/server.ts --format esm --splitting false && tsup --config tsup.hook-runtime.config.ts",
|
|
52
|
+
"build": "tsup src/index.ts src/hooks/pre-commit.ts src/hooks/post-commit.ts src/hooks/post-rewrite.ts src/hooks/prim-hook.ts src/hooks/pre-tool-use.ts src/hooks/pre-tool-use-worker.ts src/hooks/post-tool-use.ts src/hooks/session-start.ts src/hooks/session-end.ts --format esm --clean && tsup src/statusline-main.ts src/daemon/server.ts --format esm --splitting false && tsup --config tsup.hook-runtime.config.ts",
|
|
53
53
|
"contracts:generate": "node scripts/generate-cli-contract.mjs --write",
|
|
54
54
|
"contracts:check": "node scripts/generate-cli-contract.mjs --check",
|
|
55
55
|
"contracts:provenance": "node scripts/update-cli-contract.mjs --check",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"check:approval-copy-golden": "node scripts/check-approval-copy-golden.mjs",
|
|
61
61
|
"contracts:update": "node scripts/update-cli-contract.mjs",
|
|
62
62
|
"postbuild": "chmod +x ./dist/index.js ./dist/statusline-main.js ./dist/hooks/pre-commit.js ./dist/hooks/post-commit.js ./dist/hooks/post-rewrite.js ./dist/hooks/prim-hook.js ./dist/hooks/pre-tool-use.js ./dist/hooks/post-tool-use.js ./dist/hooks/session-start.js ./dist/hooks/session-end.js ./dist/daemon/server.js && node scripts/check-hook-runtime.mjs",
|
|
63
|
-
"dev": "tsup src/index.ts src/statusline-main.ts src/hooks/pre-commit.ts src/hooks/post-commit.ts src/hooks/post-rewrite.ts src/hooks/prim-hook.ts src/hooks/pre-tool-use.ts src/hooks/post-tool-use.ts src/hooks/session-start.ts src/hooks/session-end.ts src/daemon/server.ts --format esm --watch --clean --splitting false",
|
|
63
|
+
"dev": "tsup src/index.ts src/statusline-main.ts src/hooks/pre-commit.ts src/hooks/post-commit.ts src/hooks/post-rewrite.ts src/hooks/prim-hook.ts src/hooks/pre-tool-use.ts src/hooks/pre-tool-use-worker.ts src/hooks/post-tool-use.ts src/hooks/session-start.ts src/hooks/session-end.ts src/daemon/server.ts --format esm --watch --clean --splitting false",
|
|
64
64
|
"clean": "rm -rf dist coverage",
|
|
65
65
|
"lint": "biome check src/ scripts/",
|
|
66
66
|
"format": "biome check --fix src/ scripts/",
|