@primitive.ai/prim 0.1.0-alpha.93 → 0.1.0-alpha.94
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 +50 -8
- package/SKILL.md +5 -2
- package/dist/{chunk-X64HTHUF.js → chunk-AXQQMX2U.js} +200 -8
- package/dist/chunk-FXF4JWK2.js +162 -0
- package/dist/{chunk-C3VAA5CG.js → chunk-IMK4JKTA.js} +1 -1
- package/dist/{chunk-36TWVNBE.js → chunk-O7YAW7G6.js} +1 -1
- package/dist/{chunk-DCJN6LZH.js → chunk-WUXFLE7X.js} +684 -365
- package/dist/hook-runtime/hooks/post-commit.js +154 -38
- package/dist/hook-runtime/hooks/post-tool-use.js +55 -5
- package/dist/hook-runtime/hooks/pre-tool-use.js +55 -5
- package/dist/hook-runtime/hooks/prim-hook.js +55 -5
- package/dist/hook-runtime/hooks/session-end.js +53 -5
- package/dist/hook-runtime/hooks/session-start.js +843 -277
- package/dist/hook-runtime/index.js +2709 -1880
- package/dist/hooks/post-commit.js +4 -0
- package/dist/hooks/post-tool-use.js +3 -3
- package/dist/hooks/pre-tool-use.js +3 -3
- package/dist/hooks/prim-hook.js +3 -3
- package/dist/hooks/session-end.js +2 -2
- package/dist/hooks/session-start.js +28 -14
- package/dist/index.js +553 -339
- package/package.json +1 -1
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
recordPostCommitFired
|
|
4
|
+
} from "../chunk-FXF4JWK2.js";
|
|
2
5
|
import {
|
|
3
6
|
unattendedEnv
|
|
4
7
|
} from "../chunk-OYHYCK4K.js";
|
|
@@ -141,6 +144,7 @@ function spawnBackgroundFlush() {
|
|
|
141
144
|
}
|
|
142
145
|
function runPostCommit() {
|
|
143
146
|
const cwd = gitText(["rev-parse", "--show-toplevel"]) ?? process.cwd();
|
|
147
|
+
recordPostCommitFired(cwd, process.env.PRIM_COMMIT_SHA);
|
|
144
148
|
if (!isRepoActiveForCapture(cwd)) {
|
|
145
149
|
return;
|
|
146
150
|
}
|
|
@@ -22,7 +22,7 @@ import "../chunk-ZB4F75SZ.js";
|
|
|
22
22
|
import {
|
|
23
23
|
appendCodexContext,
|
|
24
24
|
prepareCodexContext
|
|
25
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-O7YAW7G6.js";
|
|
26
26
|
import "../chunk-ZU563PQI.js";
|
|
27
27
|
import {
|
|
28
28
|
scrubFromCwd
|
|
@@ -43,8 +43,8 @@ import {
|
|
|
43
43
|
parseAgent,
|
|
44
44
|
readHookStdin,
|
|
45
45
|
shouldSuppressImportedCursorHandler
|
|
46
|
-
} from "../chunk-
|
|
47
|
-
import "../chunk-
|
|
46
|
+
} from "../chunk-IMK4JKTA.js";
|
|
47
|
+
import "../chunk-AXQQMX2U.js";
|
|
48
48
|
import {
|
|
49
49
|
currentBranch,
|
|
50
50
|
resolveRepositoryContext
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
appendCodexContext,
|
|
18
18
|
hasVisibleCodexMessage,
|
|
19
19
|
prepareCodexContext
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-O7YAW7G6.js";
|
|
21
21
|
import "../chunk-ZU563PQI.js";
|
|
22
22
|
import {
|
|
23
23
|
DEFAULT_RULES,
|
|
@@ -37,10 +37,10 @@ import {
|
|
|
37
37
|
parseAgent,
|
|
38
38
|
readHookStdin,
|
|
39
39
|
shouldSuppressImportedCursorHandler
|
|
40
|
-
} from "../chunk-
|
|
40
|
+
} from "../chunk-IMK4JKTA.js";
|
|
41
41
|
import {
|
|
42
42
|
packageVersion
|
|
43
|
-
} from "../chunk-
|
|
43
|
+
} from "../chunk-AXQQMX2U.js";
|
|
44
44
|
import {
|
|
45
45
|
canonicalGitRoot,
|
|
46
46
|
canonicalRepositoryPath,
|
package/dist/hooks/prim-hook.js
CHANGED
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
import "../chunk-ZB4F75SZ.js";
|
|
32
32
|
import {
|
|
33
33
|
prepareCodexContext
|
|
34
|
-
} from "../chunk-
|
|
34
|
+
} from "../chunk-O7YAW7G6.js";
|
|
35
35
|
import "../chunk-ZU563PQI.js";
|
|
36
36
|
import {
|
|
37
37
|
scrubFromCwd,
|
|
@@ -48,8 +48,8 @@ import {
|
|
|
48
48
|
parseAgent,
|
|
49
49
|
readHookStdin,
|
|
50
50
|
shouldSuppressImportedCursorHandler
|
|
51
|
-
} from "../chunk-
|
|
52
|
-
import "../chunk-
|
|
51
|
+
} from "../chunk-IMK4JKTA.js";
|
|
52
|
+
import "../chunk-AXQQMX2U.js";
|
|
53
53
|
import {
|
|
54
54
|
currentBranch,
|
|
55
55
|
resolveRepositoryContext
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
parseAgent,
|
|
5
5
|
readHookStdin,
|
|
6
6
|
shouldSuppressImportedCursorHandler
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-IMK4JKTA.js";
|
|
8
|
+
import "../chunk-AXQQMX2U.js";
|
|
9
9
|
import "../chunk-H4UNYFUC.js";
|
|
10
10
|
import {
|
|
11
11
|
daemonRequest
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
bindRepository,
|
|
4
|
-
|
|
5
|
-
ensureEffectivePostRewriteHook,
|
|
4
|
+
ensureEffectiveGitHook,
|
|
6
5
|
hasUsableCodexGuidance,
|
|
7
6
|
hasUsableCursorSkill,
|
|
8
7
|
kickDaemonEnsure,
|
|
9
8
|
refreshClaudePlugins,
|
|
10
9
|
warmBinCache
|
|
11
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-WUXFLE7X.js";
|
|
11
|
+
import {
|
|
12
|
+
clearHooksWired,
|
|
13
|
+
recordHooksWired
|
|
14
|
+
} from "../chunk-FXF4JWK2.js";
|
|
12
15
|
import {
|
|
13
16
|
buildHookOutput,
|
|
14
17
|
handoffHookOutput
|
|
@@ -25,7 +28,7 @@ import {
|
|
|
25
28
|
} from "../chunk-EZXEWFDG.js";
|
|
26
29
|
import {
|
|
27
30
|
prepareCodexContext
|
|
28
|
-
} from "../chunk-
|
|
31
|
+
} from "../chunk-O7YAW7G6.js";
|
|
29
32
|
import "../chunk-ZU563PQI.js";
|
|
30
33
|
import {
|
|
31
34
|
fetchAndCacheCollectScope,
|
|
@@ -42,8 +45,10 @@ import {
|
|
|
42
45
|
parseAgent,
|
|
43
46
|
readHookStdin,
|
|
44
47
|
shouldSuppressImportedCursorHandler
|
|
45
|
-
} from "../chunk-
|
|
46
|
-
import
|
|
48
|
+
} from "../chunk-IMK4JKTA.js";
|
|
49
|
+
import {
|
|
50
|
+
MANAGED_GIT_HOOK_NAMES
|
|
51
|
+
} from "../chunk-AXQQMX2U.js";
|
|
47
52
|
import {
|
|
48
53
|
gitToplevel
|
|
49
54
|
} from "../chunk-H4UNYFUC.js";
|
|
@@ -73,7 +78,11 @@ var CODEX_PRIM_REMINDER = primReminder(CODEX_PRIM_ACTION, CODEX_PRIM_ACTION);
|
|
|
73
78
|
async function activeProjectRoot(cwd) {
|
|
74
79
|
try {
|
|
75
80
|
const root = gitToplevel(cwd);
|
|
76
|
-
if (!root
|
|
81
|
+
if (!root) return null;
|
|
82
|
+
if (!isRepoActiveForCapture(cwd)) {
|
|
83
|
+
if (repoActiveFlag(root) === "false") clearHooksWired(root);
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
77
86
|
let shellGateActive = repoActiveFlag(root) === "true";
|
|
78
87
|
if (!shellGateActive) {
|
|
79
88
|
try {
|
|
@@ -83,13 +92,18 @@ async function activeProjectRoot(cwd) {
|
|
|
83
92
|
}
|
|
84
93
|
}
|
|
85
94
|
if (shellGateActive) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
95
|
+
for (const hookName of MANAGED_GIT_HOOK_NAMES) {
|
|
96
|
+
try {
|
|
97
|
+
const result = ensureEffectiveGitHook(hookName, root, {
|
|
98
|
+
context: "ambient",
|
|
99
|
+
repairOnly: hookName === "pre-commit"
|
|
100
|
+
});
|
|
101
|
+
if (hookName === "post-commit" && // Manual mode: the user's own wiring is expected to reach prim too.
|
|
102
|
+
["created", "updated", "unchanged", "manual"].includes(result.outcome)) {
|
|
103
|
+
recordHooksWired(root, { onlyIfAbsent: true });
|
|
104
|
+
}
|
|
105
|
+
} catch {
|
|
106
|
+
}
|
|
93
107
|
}
|
|
94
108
|
}
|
|
95
109
|
try {
|