@primitive.ai/prim 0.1.0-alpha.116 → 0.1.0-alpha.118
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-XG7S3LIL.js → chunk-3NJ4FUPK.js} +889 -919
- package/dist/{chunk-J5HBSRAV.js → chunk-4HEWA4IO.js} +1 -1
- package/dist/{chunk-LEUZDTNT.js → chunk-B3FVP7VQ.js} +1 -1
- package/dist/{chunk-4OEJ2ONG.js → chunk-C2AEY4AI.js} +2 -13
- package/dist/{chunk-S55JKCHQ.js → chunk-C2AJBMP2.js} +2 -2
- package/dist/{chunk-D3ZDZZYS.js → chunk-CHRICRVE.js} +17 -10
- package/dist/{chunk-HMD5K6W7.js → chunk-ECP7EGOD.js} +2 -2
- package/dist/{chunk-FTW4ZCBA.js → chunk-FPDOBG3H.js} +1 -1
- package/dist/{chunk-3TIKBQHV.js → chunk-JGOFEG6T.js} +6 -4
- package/dist/chunk-JSBRDJBE.js +30 -0
- package/dist/{chunk-KGBMU76T.js → chunk-JXQVXU2K.js} +1 -1
- package/dist/chunk-KZB4ABIB.js +13 -0
- package/dist/{chunk-I3J344DF.js → chunk-L3NUFCOD.js} +5 -5
- package/dist/{chunk-6IRAGUYK.js → chunk-LEEWUN74.js} +2 -2
- package/dist/{chunk-JKJ22ONL.js → chunk-OHLVHT6R.js} +6 -6
- package/dist/{chunk-RLBASQJD.js → chunk-OIXHRN32.js} +4 -4
- package/dist/{chunk-LLKJAET2.js → chunk-PYIIYC3A.js} +8 -16
- package/dist/{chunk-NEQI2VLM.js → chunk-Q4CWXKNV.js} +5 -5
- package/dist/{chunk-4SN5BCIG.js → chunk-QX7QFMLF.js} +2 -2
- package/dist/{chunk-CXMLAWC2.js → chunk-SCOEPFOV.js} +2 -2
- package/dist/{chunk-6JHKKLA2.js → chunk-UMSJ4DU2.js} +46 -46
- package/dist/{chunk-JKO6PZWQ.js → chunk-VEI7KUOU.js} +26 -48
- package/dist/hook-runtime/daemon/server.js +1 -0
- package/dist/hook-runtime/hooks/post-commit.js +1 -0
- package/dist/hook-runtime/hooks/post-rewrite.js +1 -0
- package/dist/hook-runtime/hooks/post-tool-use.js +29 -29
- package/dist/hook-runtime/hooks/pre-commit.js +1 -0
- package/dist/hook-runtime/hooks/pre-tool-use-worker.js +34746 -0
- package/dist/hook-runtime/hooks/pre-tool-use.js +82 -35549
- package/dist/hook-runtime/hooks/prim-hook.js +22 -22
- package/dist/hook-runtime/hooks/session-end.js +14 -14
- package/dist/hook-runtime/hooks/session-start.js +100 -100
- package/dist/hook-runtime/index.js +244 -256
- package/dist/hook-runtime/statusline-main.js +1 -0
- package/dist/hooks/post-commit.js +8 -7
- package/dist/hooks/post-rewrite.js +7 -6
- package/dist/hooks/post-tool-use.js +25 -22
- package/dist/hooks/pre-commit.js +5 -4
- package/dist/hooks/pre-tool-use-worker.js +222 -0
- package/dist/hooks/pre-tool-use.js +73 -257
- package/dist/hooks/prim-hook.js +25 -22
- package/dist/hooks/session-end.js +10 -7
- package/dist/hooks/session-start.js +22 -19
- package/dist/index.js +54 -53
- package/package.json +3 -3
|
@@ -16,12 +16,12 @@ import {
|
|
|
16
16
|
syncDirectory,
|
|
17
17
|
syncFile,
|
|
18
18
|
withFileLockSync
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-3NJ4FUPK.js";
|
|
20
20
|
|
|
21
21
|
// src/commands/claude-install.ts
|
|
22
|
-
import { existsSync as existsSync2, readFileSync as
|
|
22
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
23
23
|
import { homedir } from "os";
|
|
24
|
-
import { join as
|
|
24
|
+
import { join as join2 } from "path";
|
|
25
25
|
|
|
26
26
|
// src/lib/hook-runtime.ts
|
|
27
27
|
import { createHash, randomBytes } from "crypto";
|
|
@@ -203,6 +203,7 @@ var HOOK_RUNTIME_ENTRIES = {
|
|
|
203
203
|
"prim-pre-commit": "dist/hooks/pre-commit.js",
|
|
204
204
|
"prim-post-commit": "dist/hooks/post-commit.js",
|
|
205
205
|
"prim-post-rewrite": "dist/hooks/post-rewrite.js",
|
|
206
|
+
"prim-pre-tool-use-worker": "dist/hooks/pre-tool-use-worker.js",
|
|
206
207
|
"prim-pre-tool-use": "dist/hooks/pre-tool-use.js",
|
|
207
208
|
"prim-post-tool-use": "dist/hooks/post-tool-use.js",
|
|
208
209
|
"prim-session-start": "dist/hooks/session-start.js",
|
|
@@ -736,14 +737,12 @@ function removeHookRuntime(options = {}) {
|
|
|
736
737
|
|
|
737
738
|
// src/lib/preflight-host.ts
|
|
738
739
|
import { execFileSync } from "child_process";
|
|
739
|
-
import { readFileSync as readFileSync2 } from "fs";
|
|
740
|
-
import { join as join2 } from "path";
|
|
741
740
|
function inspectFailureProtection(host) {
|
|
742
741
|
if (host === "codex")
|
|
743
742
|
return {
|
|
744
743
|
host,
|
|
745
|
-
status: "
|
|
746
|
-
detail: "Codex
|
|
744
|
+
status: "supported",
|
|
745
|
+
detail: "Codex gates wait at most two seconds. Confirmed conflicts retain explicit denial; crashed or timed-out checks permit the tool without a Primitive notice."
|
|
747
746
|
};
|
|
748
747
|
let output;
|
|
749
748
|
try {
|
|
@@ -757,47 +756,26 @@ function inspectFailureProtection(host) {
|
|
|
757
756
|
return {
|
|
758
757
|
host,
|
|
759
758
|
status: "unknown",
|
|
760
|
-
detail: `Cannot inspect ${host}; install or expose the host on PATH, then run prim doctor. Host
|
|
759
|
+
detail: `Cannot inspect ${host}; install or expose the host on PATH, then run prim doctor. Host timeout behavior is not verified.`
|
|
761
760
|
};
|
|
762
761
|
}
|
|
763
762
|
const version = /\b(\d+\.\d+\.\d+(?:-[\w.-]+)?)\b/u.exec(output)?.[1];
|
|
764
763
|
if (host === "hermes") {
|
|
765
|
-
const project = /^\s*Project:\s*(.+?)\s*$/mu.exec(output)?.[1];
|
|
766
|
-
try {
|
|
767
|
-
if (project) {
|
|
768
|
-
const source = readFileSync2(join2(project, "agent", "shell_hooks.py"), "utf8");
|
|
769
|
-
if (/fail_closed\s*:\s*bool/u.test(source) && /["']fail_closed["']/u.test(source)) {
|
|
770
|
-
return {
|
|
771
|
-
host,
|
|
772
|
-
version,
|
|
773
|
-
status: "supported",
|
|
774
|
-
detail: "Installed Hermes exposes fail_closed shell hooks; Primitive configures fail_closed: true and the 300-second maximum timeout."
|
|
775
|
-
};
|
|
776
|
-
}
|
|
777
|
-
return {
|
|
778
|
-
host,
|
|
779
|
-
version,
|
|
780
|
-
status: "unsupported",
|
|
781
|
-
detail: "Installed Hermes does not expose fail_closed shell hooks. Upgrade Hermes before relying on host timeout/crash protection; then run prim hermes install and prim doctor."
|
|
782
|
-
};
|
|
783
|
-
}
|
|
784
|
-
} catch {
|
|
785
|
-
}
|
|
786
764
|
return {
|
|
787
765
|
host,
|
|
788
766
|
version,
|
|
789
|
-
status: "
|
|
790
|
-
detail: "
|
|
767
|
+
status: "supported",
|
|
768
|
+
detail: "Hermes gates use a two-second timeout and fail_closed: false. Only confirmed conflicts stop a tool."
|
|
791
769
|
};
|
|
792
770
|
}
|
|
793
|
-
const minimum = host === "claude" ? "2.1.
|
|
771
|
+
const minimum = host === "claude" ? "2.1.284" : "3.24.9";
|
|
794
772
|
const comparison = compareSemver(version, minimum);
|
|
795
773
|
const status = comparison === void 0 ? "unknown" : comparison < 0 ? "unsupported" : "supported";
|
|
796
774
|
return {
|
|
797
775
|
host,
|
|
798
776
|
version,
|
|
799
777
|
status,
|
|
800
|
-
detail: status === "supported" ? `${host} ${version} supports the configured ${host === "claude" ?
|
|
778
|
+
detail: status === "supported" ? `${host} ${version} supports the configured ${host === "claude" ? "default fail-open" : "failClosed: false"} policy and two-second timeout.` : `${host} ${version ?? "version unknown"}: upgrade to ${minimum} or newer ${host === "cursor" ? "(Primitive's verified host compatibility baseline) " : ""}before relying on host timeout behavior; then run prim ${host} install and prim doctor.`
|
|
801
779
|
};
|
|
802
780
|
}
|
|
803
781
|
function reportFailureProtection(host) {
|
|
@@ -805,7 +783,7 @@ function reportFailureProtection(host) {
|
|
|
805
783
|
console.error(`[prim] ${protection.detail}`);
|
|
806
784
|
if (protection.status === "unsupported" || protection.status === "unknown") {
|
|
807
785
|
console.error(
|
|
808
|
-
"[prim] Conflict Gate host
|
|
786
|
+
"[prim] Conflict Gate host compatibility is not verified; installed settings alone do not establish readiness."
|
|
809
787
|
);
|
|
810
788
|
}
|
|
811
789
|
return protection;
|
|
@@ -829,11 +807,11 @@ var PRIM_BINS = [
|
|
|
829
807
|
SESSION_END_BIN
|
|
830
808
|
];
|
|
831
809
|
var JSON_INDENT = 2;
|
|
832
|
-
var USER_SCOPE_PATH =
|
|
810
|
+
var USER_SCOPE_PATH = join2(homedir(), ".claude", "settings.json");
|
|
833
811
|
function projectRoot() {
|
|
834
812
|
return gitToplevel() ?? process.cwd();
|
|
835
813
|
}
|
|
836
|
-
var projectScopePath = () =>
|
|
814
|
+
var projectScopePath = () => join2(projectRoot(), ".claude", "settings.json");
|
|
837
815
|
var CAPTURE_EVENTS = [
|
|
838
816
|
"SessionStart",
|
|
839
817
|
"UserPromptSubmit",
|
|
@@ -850,7 +828,7 @@ function makeRegistration(event, matcher, bin, args = "") {
|
|
|
850
828
|
matcher,
|
|
851
829
|
bin,
|
|
852
830
|
command: stableHookCommand(bin, args),
|
|
853
|
-
...bin === GATE_BIN ? { timeout:
|
|
831
|
+
...bin === GATE_BIN ? { timeout: 2 } : {}
|
|
854
832
|
};
|
|
855
833
|
}
|
|
856
834
|
function makeDetachedRegistration(event, matcher, bin, args = "") {
|
|
@@ -888,7 +866,7 @@ function readSettings(path) {
|
|
|
888
866
|
if (!existsSync2(path)) {
|
|
889
867
|
return {};
|
|
890
868
|
}
|
|
891
|
-
const raw =
|
|
869
|
+
const raw = readFileSync2(path, "utf-8");
|
|
892
870
|
try {
|
|
893
871
|
return JSON.parse(raw);
|
|
894
872
|
} catch (err) {
|
|
@@ -1268,9 +1246,9 @@ ${line("project", result.project)}`);
|
|
|
1268
1246
|
}
|
|
1269
1247
|
|
|
1270
1248
|
// src/commands/cursor-install.ts
|
|
1271
|
-
import { existsSync as existsSync3, readFileSync as
|
|
1249
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
|
|
1272
1250
|
import { homedir as homedir2 } from "os";
|
|
1273
|
-
import { isAbsolute as isAbsolute2, join as
|
|
1251
|
+
import { isAbsolute as isAbsolute2, join as join3 } from "path";
|
|
1274
1252
|
var CAPTURE_BIN2 = "prim-hook";
|
|
1275
1253
|
var GATE_BIN2 = "prim-pre-tool-use";
|
|
1276
1254
|
var POST_TOOL_BIN = "prim-post-tool-use";
|
|
@@ -1291,7 +1269,7 @@ var CURSOR_EVENTS = [
|
|
|
1291
1269
|
];
|
|
1292
1270
|
var REGISTRATIONS2 = [
|
|
1293
1271
|
...CURSOR_EVENTS.map((event) => ({ event, bin: CAPTURE_BIN2 })),
|
|
1294
|
-
{ event: "preToolUse", bin: GATE_BIN2, matcher: "Write|Delete|Shell", timeout:
|
|
1272
|
+
{ event: "preToolUse", bin: GATE_BIN2, matcher: "Write|Delete|Shell", timeout: 2 },
|
|
1295
1273
|
{ event: "postToolUse", bin: POST_TOOL_BIN },
|
|
1296
1274
|
{ event: "postToolUseFailure", bin: POST_TOOL_BIN },
|
|
1297
1275
|
{ event: "sessionStart", bin: SESSION_START_BIN2 },
|
|
@@ -1301,14 +1279,14 @@ function cursorConfigDirectory(env = process.env, home = homedir2(), platform =
|
|
|
1301
1279
|
const explicit = env.CURSOR_CONFIG_DIR?.trim();
|
|
1302
1280
|
if (explicit && isAbsolute2(explicit)) return explicit;
|
|
1303
1281
|
const xdg = env.XDG_CONFIG_HOME?.trim();
|
|
1304
|
-
if (platform !== "darwin" && xdg && isAbsolute2(xdg)) return
|
|
1305
|
-
return
|
|
1282
|
+
if (platform !== "darwin" && xdg && isAbsolute2(xdg)) return join3(xdg, "cursor");
|
|
1283
|
+
return join3(home, ".cursor");
|
|
1306
1284
|
}
|
|
1307
1285
|
function cursorHooksPath(scope, root = projectRoot()) {
|
|
1308
|
-
return scope === "user" ?
|
|
1286
|
+
return scope === "user" ? join3(cursorConfigDirectory(), "hooks.json") : join3(root, ".cursor", "hooks.json");
|
|
1309
1287
|
}
|
|
1310
1288
|
function cursorCliConfigPath() {
|
|
1311
|
-
return
|
|
1289
|
+
return join3(cursorConfigDirectory(), "cli-config.json");
|
|
1312
1290
|
}
|
|
1313
1291
|
function plainObject(value) {
|
|
1314
1292
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -1317,7 +1295,7 @@ function readCursorHooks(path) {
|
|
|
1317
1295
|
if (!existsSync3(path)) return {};
|
|
1318
1296
|
let parsed;
|
|
1319
1297
|
try {
|
|
1320
|
-
parsed = JSON.parse(
|
|
1298
|
+
parsed = JSON.parse(readFileSync3(path, "utf8"));
|
|
1321
1299
|
} catch {
|
|
1322
1300
|
throw new Error(`invalid Cursor hooks JSON at ${path}`);
|
|
1323
1301
|
}
|
|
@@ -1339,7 +1317,7 @@ function readObject(path) {
|
|
|
1339
1317
|
if (!existsSync3(path)) return {};
|
|
1340
1318
|
let parsed;
|
|
1341
1319
|
try {
|
|
1342
|
-
parsed = JSON.parse(
|
|
1320
|
+
parsed = JSON.parse(readFileSync3(path, "utf8"));
|
|
1343
1321
|
} catch {
|
|
1344
1322
|
throw new Error(`invalid Cursor CLI config JSON at ${path}`);
|
|
1345
1323
|
}
|
|
@@ -1373,7 +1351,7 @@ function hookFor(registration, scope) {
|
|
|
1373
1351
|
command: commandFor(registration, scope),
|
|
1374
1352
|
...registration.matcher ? { matcher: registration.matcher } : {},
|
|
1375
1353
|
...registration.timeout ? { timeout: registration.timeout } : {},
|
|
1376
|
-
...registration.bin === GATE_BIN2 ? { failClosed:
|
|
1354
|
+
...registration.bin === GATE_BIN2 ? { failClosed: false } : {}
|
|
1377
1355
|
};
|
|
1378
1356
|
}
|
|
1379
1357
|
function exactHook(entry, registration, scope) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __primCreateRequire } from "node:module"; const require = __primCreateRequire(import.meta.url);
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __primCreateRequire } from "node:module"; const require = __primCreateRequire(import.meta.url);
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __primCreateRequire } from "node:module"; const require = __primCreateRequire(import.meta.url);
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __primCreateRequire } from "node:module"; const require = __primCreateRequire(import.meta.url);
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -52,8 +53,8 @@ var require_ucs2length = __commonJS({
|
|
|
52
53
|
});
|
|
53
54
|
|
|
54
55
|
// src/hooks/post-tool-use.ts
|
|
55
|
-
import { readFileSync as
|
|
56
|
-
import { dirname as dirname12, join as
|
|
56
|
+
import { readFileSync as readFileSync17 } from "fs";
|
|
57
|
+
import { dirname as dirname12, join as join20 } from "path";
|
|
57
58
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
58
59
|
|
|
59
60
|
// src/binding.ts
|
|
@@ -838,6 +839,7 @@ var HOOK_RUNTIME_ENTRIES = {
|
|
|
838
839
|
"prim-pre-commit": "dist/hooks/pre-commit.js",
|
|
839
840
|
"prim-post-commit": "dist/hooks/post-commit.js",
|
|
840
841
|
"prim-post-rewrite": "dist/hooks/post-rewrite.js",
|
|
842
|
+
"prim-pre-tool-use-worker": "dist/hooks/pre-tool-use-worker.js",
|
|
841
843
|
"prim-pre-tool-use": "dist/hooks/pre-tool-use.js",
|
|
842
844
|
"prim-post-tool-use": "dist/hooks/post-tool-use.js",
|
|
843
845
|
"prim-session-start": "dist/hooks/session-start.js",
|
|
@@ -25356,19 +25358,17 @@ async function prepareCodexContext(options) {
|
|
|
25356
25358
|
}
|
|
25357
25359
|
|
|
25358
25360
|
// src/commands/cursor-install.ts
|
|
25359
|
-
import { existsSync as existsSync12, readFileSync as
|
|
25361
|
+
import { existsSync as existsSync12, readFileSync as readFileSync13 } from "fs";
|
|
25360
25362
|
import { homedir as homedir4 } from "os";
|
|
25361
|
-
import { isAbsolute as isAbsolute6, join as
|
|
25363
|
+
import { isAbsolute as isAbsolute6, join as join16 } from "path";
|
|
25362
25364
|
|
|
25363
25365
|
// src/lib/preflight-host.ts
|
|
25364
25366
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
25365
|
-
import { readFileSync as readFileSync12 } from "fs";
|
|
25366
|
-
import { join as join15 } from "path";
|
|
25367
25367
|
|
|
25368
25368
|
// src/commands/claude-install.ts
|
|
25369
|
-
import { existsSync as existsSync11, readFileSync as
|
|
25369
|
+
import { existsSync as existsSync11, readFileSync as readFileSync12 } from "fs";
|
|
25370
25370
|
import { homedir as homedir3 } from "os";
|
|
25371
|
-
import { join as
|
|
25371
|
+
import { join as join15 } from "path";
|
|
25372
25372
|
var CAPTURE_BIN = "prim-hook";
|
|
25373
25373
|
var GATE_BIN = "prim-pre-tool-use";
|
|
25374
25374
|
var POST_TOOL_USE_BIN = "prim-post-tool-use";
|
|
@@ -25377,7 +25377,7 @@ var SESSION_END_BIN = "prim-session-end";
|
|
|
25377
25377
|
var STATUSLINE_BIN = "prim-statusline";
|
|
25378
25378
|
var STATUSLINE_ARGS = "";
|
|
25379
25379
|
var STATUSLINE_COMMAND = stableHookCommand(STATUSLINE_BIN, STATUSLINE_ARGS);
|
|
25380
|
-
var USER_SCOPE_PATH =
|
|
25380
|
+
var USER_SCOPE_PATH = join15(homedir3(), ".claude", "settings.json");
|
|
25381
25381
|
function projectRoot() {
|
|
25382
25382
|
return gitToplevel() ?? process.cwd();
|
|
25383
25383
|
}
|
|
@@ -25397,7 +25397,7 @@ function makeRegistration(event, matcher, bin, args = "") {
|
|
|
25397
25397
|
matcher,
|
|
25398
25398
|
bin,
|
|
25399
25399
|
command: stableHookCommand(bin, args),
|
|
25400
|
-
...bin === GATE_BIN ? { timeout:
|
|
25400
|
+
...bin === GATE_BIN ? { timeout: 2 } : {}
|
|
25401
25401
|
};
|
|
25402
25402
|
}
|
|
25403
25403
|
function makeDetachedRegistration(event, matcher, bin, args = "") {
|
|
@@ -25447,7 +25447,7 @@ var CURSOR_EVENTS = [
|
|
|
25447
25447
|
];
|
|
25448
25448
|
var REGISTRATIONS2 = [
|
|
25449
25449
|
...CURSOR_EVENTS.map((event) => ({ event, bin: CAPTURE_BIN2 })),
|
|
25450
|
-
{ event: "preToolUse", bin: GATE_BIN2, matcher: "Write|Delete|Shell", timeout:
|
|
25450
|
+
{ event: "preToolUse", bin: GATE_BIN2, matcher: "Write|Delete|Shell", timeout: 2 },
|
|
25451
25451
|
{ event: "postToolUse", bin: POST_TOOL_BIN },
|
|
25452
25452
|
{ event: "postToolUseFailure", bin: POST_TOOL_BIN },
|
|
25453
25453
|
{ event: "sessionStart", bin: SESSION_START_BIN2 },
|
|
@@ -25457,11 +25457,11 @@ function cursorConfigDirectory(env = process.env, home = homedir4(), platform2 =
|
|
|
25457
25457
|
const explicit = env.CURSOR_CONFIG_DIR?.trim();
|
|
25458
25458
|
if (explicit && isAbsolute6(explicit)) return explicit;
|
|
25459
25459
|
const xdg = env.XDG_CONFIG_HOME?.trim();
|
|
25460
|
-
if (platform2 !== "darwin" && xdg && isAbsolute6(xdg)) return
|
|
25461
|
-
return
|
|
25460
|
+
if (platform2 !== "darwin" && xdg && isAbsolute6(xdg)) return join16(xdg, "cursor");
|
|
25461
|
+
return join16(home, ".cursor");
|
|
25462
25462
|
}
|
|
25463
25463
|
function cursorHooksPath(scope, root = projectRoot()) {
|
|
25464
|
-
return scope === "user" ?
|
|
25464
|
+
return scope === "user" ? join16(cursorConfigDirectory(), "hooks.json") : join16(root, ".cursor", "hooks.json");
|
|
25465
25465
|
}
|
|
25466
25466
|
function plainObject(value) {
|
|
25467
25467
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -25470,7 +25470,7 @@ function readCursorHooks(path) {
|
|
|
25470
25470
|
if (!existsSync12(path)) return {};
|
|
25471
25471
|
let parsed;
|
|
25472
25472
|
try {
|
|
25473
|
-
parsed = JSON.parse(
|
|
25473
|
+
parsed = JSON.parse(readFileSync13(path, "utf8"));
|
|
25474
25474
|
} catch {
|
|
25475
25475
|
throw new Error(`invalid Cursor hooks JSON at ${path}`);
|
|
25476
25476
|
}
|
|
@@ -25508,7 +25508,7 @@ function hookFor(registration, scope) {
|
|
|
25508
25508
|
command: commandFor(registration, scope),
|
|
25509
25509
|
...registration.matcher ? { matcher: registration.matcher } : {},
|
|
25510
25510
|
...registration.timeout ? { timeout: registration.timeout } : {},
|
|
25511
|
-
...registration.bin === GATE_BIN2 ? { failClosed:
|
|
25511
|
+
...registration.bin === GATE_BIN2 ? { failClosed: false } : {}
|
|
25512
25512
|
};
|
|
25513
25513
|
}
|
|
25514
25514
|
function exactHook(entry, registration, scope) {
|
|
@@ -25691,8 +25691,8 @@ function extractFileTargets(toolName, toolInput, agent = "claude_code") {
|
|
|
25691
25691
|
}
|
|
25692
25692
|
|
|
25693
25693
|
// src/hooks/redact.ts
|
|
25694
|
-
import { existsSync as existsSync13, readFileSync as
|
|
25695
|
-
import { join as
|
|
25694
|
+
import { existsSync as existsSync13, readFileSync as readFileSync14, statSync as statSync5 } from "fs";
|
|
25695
|
+
import { join as join17 } from "path";
|
|
25696
25696
|
import { Worker } from "worker_threads";
|
|
25697
25697
|
var USER_HOME_RULES = [
|
|
25698
25698
|
{
|
|
@@ -25768,7 +25768,7 @@ function normalizedWorkspaceFlags(value) {
|
|
|
25768
25768
|
return [...new Set(`g${requested}`)].sort().join("");
|
|
25769
25769
|
}
|
|
25770
25770
|
function loadWorkspaceRules(cwd) {
|
|
25771
|
-
const path =
|
|
25771
|
+
const path = join17(cwd, WORKSPACE_FILE2);
|
|
25772
25772
|
if (!existsSync13(path)) return [];
|
|
25773
25773
|
let cfg;
|
|
25774
25774
|
try {
|
|
@@ -25776,7 +25776,7 @@ function loadWorkspaceRules(cwd) {
|
|
|
25776
25776
|
debugRedaction(`ignoring oversized ${WORKSPACE_FILE2}`);
|
|
25777
25777
|
return [];
|
|
25778
25778
|
}
|
|
25779
|
-
cfg = JSON.parse(
|
|
25779
|
+
cfg = JSON.parse(readFileSync14(path, "utf-8"));
|
|
25780
25780
|
} catch {
|
|
25781
25781
|
debugRedaction(`ignoring unparseable ${WORKSPACE_FILE2}`);
|
|
25782
25782
|
return [];
|
|
@@ -35442,25 +35442,25 @@ import {
|
|
|
35442
35442
|
mkdirSync as mkdirSync7,
|
|
35443
35443
|
openSync as openSync3,
|
|
35444
35444
|
opendirSync,
|
|
35445
|
-
readFileSync as
|
|
35445
|
+
readFileSync as readFileSync16,
|
|
35446
35446
|
readSync,
|
|
35447
35447
|
readdirSync as readdirSync5
|
|
35448
35448
|
} from "fs";
|
|
35449
|
-
import { dirname as dirname11, join as
|
|
35449
|
+
import { dirname as dirname11, join as join19 } from "path";
|
|
35450
35450
|
|
|
35451
35451
|
// src/drain-progress.ts
|
|
35452
35452
|
import {
|
|
35453
35453
|
chmodSync as chmodSync6,
|
|
35454
35454
|
existsSync as existsSync14,
|
|
35455
|
-
readFileSync as
|
|
35455
|
+
readFileSync as readFileSync15,
|
|
35456
35456
|
readdirSync as readdirSync4,
|
|
35457
35457
|
rmSync as rmSync6,
|
|
35458
35458
|
rmdirSync
|
|
35459
35459
|
} from "fs";
|
|
35460
|
-
import { basename as basename2, dirname as dirname10, join as
|
|
35460
|
+
import { basename as basename2, dirname as dirname10, join as join18 } from "path";
|
|
35461
35461
|
|
|
35462
35462
|
// src/journal.ts
|
|
35463
|
-
var JOURNAL_DIR =
|
|
35463
|
+
var JOURNAL_DIR = join19(primConfigDirectory(), "moves");
|
|
35464
35464
|
var UNBOUND_BUCKET = "_unbound";
|
|
35465
35465
|
var JOURNAL_BASENAME = "journal.ndjson";
|
|
35466
35466
|
var JOURNAL_STATS_SAMPLE_BYTES = 64 * 1024;
|
|
@@ -35472,7 +35472,7 @@ function envSlug(apiUrl) {
|
|
|
35472
35472
|
return slug;
|
|
35473
35473
|
}
|
|
35474
35474
|
function currentEnvDir() {
|
|
35475
|
-
return
|
|
35475
|
+
return join19(JOURNAL_DIR, envSlug(getSiteUrl()));
|
|
35476
35476
|
}
|
|
35477
35477
|
var DIR_MODE = 448;
|
|
35478
35478
|
var FILE_MODE2 = 384;
|
|
@@ -35488,10 +35488,10 @@ function appendMoveToPath(path, move) {
|
|
|
35488
35488
|
}
|
|
35489
35489
|
function bucketDir(orgId) {
|
|
35490
35490
|
const safe = orgId !== void 0 && SAFE_BUCKET.test(orgId) && !RESERVED_BUCKETS.has(orgId);
|
|
35491
|
-
return
|
|
35491
|
+
return join19(currentEnvDir(), safe ? orgId : UNBOUND_BUCKET);
|
|
35492
35492
|
}
|
|
35493
35493
|
function journalPath(orgId) {
|
|
35494
|
-
return
|
|
35494
|
+
return join19(bucketDir(orgId), JOURNAL_BASENAME);
|
|
35495
35495
|
}
|
|
35496
35496
|
function appendMove(move, orgId) {
|
|
35497
35497
|
appendMoveToPath(journalPath(orgId), move);
|
|
@@ -35663,7 +35663,7 @@ function editingToolsFor(agent) {
|
|
|
35663
35663
|
var here = dirname12(fileURLToPath2(import.meta.url));
|
|
35664
35664
|
function resolveCliVersion() {
|
|
35665
35665
|
try {
|
|
35666
|
-
const pkg = JSON.parse(
|
|
35666
|
+
const pkg = JSON.parse(readFileSync17(join20(here, "..", "..", "package.json"), "utf-8"));
|
|
35667
35667
|
return pkg.version ?? "unknown";
|
|
35668
35668
|
} catch {
|
|
35669
35669
|
return "unknown";
|