@primitive.ai/prim 0.1.0-alpha.82 → 0.1.0-alpha.84
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/dist/{chunk-ZOSNEO5N.js → chunk-7O6NAUKJ.js} +2 -2
- package/dist/{chunk-BQUJ4AFJ.js → chunk-PPQYQEIR.js} +52 -8
- package/dist/hook-runtime/hooks/post-tool-use.js +53 -9
- package/dist/hook-runtime/hooks/pre-tool-use.js +63 -12
- package/dist/hook-runtime/hooks/prim-hook.js +53 -9
- package/dist/hook-runtime/hooks/session-start.js +7229 -8322
- package/dist/hook-runtime/index.js +18418 -19483
- package/dist/hooks/post-tool-use.js +2 -2
- package/dist/hooks/pre-tool-use.js +12 -5
- package/dist/hooks/prim-hook.js +2 -2
- package/dist/index.js +1 -1
- package/package.json +2 -2
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
enrichHookPayloadWithFileRefs,
|
|
7
7
|
preserveHookFileMetadata
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-7O6NAUKJ.js";
|
|
9
9
|
import {
|
|
10
10
|
postToolInvocationId,
|
|
11
11
|
toMove,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
appendMove,
|
|
19
19
|
resolveOrg
|
|
20
20
|
} from "../chunk-YWO7O6QG.js";
|
|
21
|
-
import "../chunk-
|
|
21
|
+
import "../chunk-PPQYQEIR.js";
|
|
22
22
|
import {
|
|
23
23
|
appendCodexContext,
|
|
24
24
|
prepareCodexContext
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
failOpenHermes,
|
|
11
11
|
failOpenOutput,
|
|
12
12
|
readHookMode
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-PPQYQEIR.js";
|
|
14
14
|
import {
|
|
15
15
|
appendCodexContext,
|
|
16
16
|
hasVisibleCodexMessage,
|
|
@@ -60,8 +60,9 @@ function resolvePreflightTargets(args) {
|
|
|
60
60
|
let rawPaths;
|
|
61
61
|
let coverage = "complete";
|
|
62
62
|
let mutation = "present";
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
let definite = false;
|
|
64
|
+
if ((args.agent === "claude_code" || args.agent === "codex") && args.toolName === "Bash") {
|
|
65
|
+
const command = typeof args.toolInput === "string" ? args.toolInput : args.toolInput && typeof args.toolInput === "object" ? args.toolInput.command : void 0;
|
|
65
66
|
if (typeof command !== "string") {
|
|
66
67
|
return { paths: [], coverage: "unverified", mutation: "present" };
|
|
67
68
|
}
|
|
@@ -69,11 +70,13 @@ function resolvePreflightTargets(args) {
|
|
|
69
70
|
rawPaths = shell.paths;
|
|
70
71
|
coverage = shell.coverage;
|
|
71
72
|
mutation = shell.mutation;
|
|
73
|
+
definite = shell.definiteEdit === true;
|
|
72
74
|
} else {
|
|
73
75
|
const extracted = extractFileTargets(args.toolName, args.toolInput, args.agent);
|
|
74
76
|
if (!extracted) return { paths: [], coverage: "complete", mutation: "none" };
|
|
75
77
|
rawPaths = extracted.paths;
|
|
76
78
|
if (!extracted.complete) coverage = "unverified";
|
|
79
|
+
definite = true;
|
|
77
80
|
}
|
|
78
81
|
const root = canonicalGitRoot(args.cwd);
|
|
79
82
|
const paths = /* @__PURE__ */ new Set();
|
|
@@ -84,7 +87,11 @@ function resolvePreflightTargets(args) {
|
|
|
84
87
|
}
|
|
85
88
|
const bounded = [...paths];
|
|
86
89
|
if (bounded.length > MAX_PREFLIGHT_PATHS) coverage = "unverified";
|
|
87
|
-
|
|
90
|
+
const resolved = bounded.slice(0, MAX_PREFLIGHT_PATHS);
|
|
91
|
+
if (definite && resolved.length === 0 && mutation === "present") {
|
|
92
|
+
return { paths: resolved, coverage: "unverified", mutation, definite: true };
|
|
93
|
+
}
|
|
94
|
+
return { paths: resolved, coverage, mutation };
|
|
88
95
|
}
|
|
89
96
|
function truncateUtf8(value, maxBytes) {
|
|
90
97
|
const encoded = Buffer2.from(value);
|
|
@@ -284,7 +291,7 @@ async function main() {
|
|
|
284
291
|
await emit(failOpen());
|
|
285
292
|
return;
|
|
286
293
|
}
|
|
287
|
-
if (targets.paths.length === 0) {
|
|
294
|
+
if (targets.paths.length === 0 && !targets.definite) {
|
|
288
295
|
await emit(failOpen());
|
|
289
296
|
return;
|
|
290
297
|
}
|
package/dist/hooks/prim-hook.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
enrichHookPayloadWithFileRefs,
|
|
14
14
|
preserveHookFileMetadata
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-7O6NAUKJ.js";
|
|
16
16
|
import {
|
|
17
17
|
postToolInvocationId,
|
|
18
18
|
shouldFlushAfter,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
appendMove,
|
|
26
26
|
resolveOrg
|
|
27
27
|
} from "../chunk-YWO7O6QG.js";
|
|
28
|
-
import "../chunk-
|
|
28
|
+
import "../chunk-PPQYQEIR.js";
|
|
29
29
|
import {
|
|
30
30
|
prepareCodexContext
|
|
31
31
|
} from "../chunk-4CZTNXIS.js";
|
package/dist/index.js
CHANGED
|
@@ -14660,7 +14660,7 @@ var GATE_BIN2 = "prim-pre-tool-use";
|
|
|
14660
14660
|
var POST_TOOL_USE_BIN2 = "prim-post-tool-use";
|
|
14661
14661
|
var SESSION_START_BIN2 = "prim-session-start";
|
|
14662
14662
|
var CODEX_ARGS = "--agent codex";
|
|
14663
|
-
var CODEX_EDIT_MATCHER = "apply_patch";
|
|
14663
|
+
var CODEX_EDIT_MATCHER = "apply_patch|Bash";
|
|
14664
14664
|
var CODEX_POST_TOOL_MATCHER = "apply_patch|Bash";
|
|
14665
14665
|
var JSON_INDENT2 = 2;
|
|
14666
14666
|
var CODEX_CAPTURE_EVENTS = [
|
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.84",
|
|
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",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"contracts:check": "node scripts/generate-cli-contract.mjs --check",
|
|
54
54
|
"contracts:provenance": "node scripts/update-cli-contract.mjs --check",
|
|
55
55
|
"contracts:update": "node scripts/update-cli-contract.mjs",
|
|
56
|
-
"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",
|
|
56
|
+
"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",
|
|
57
57
|
"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",
|
|
58
58
|
"clean": "rm -rf dist coverage",
|
|
59
59
|
"lint": "biome check src/ scripts/",
|