@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
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
unattendedEnv
|
|
3
3
|
} from "./chunk-OYHYCK4K.js";
|
|
4
|
-
import {
|
|
5
|
-
HttpError,
|
|
6
|
-
getClient
|
|
7
|
-
} from "./chunk-6JHKKLA2.js";
|
|
8
4
|
import {
|
|
9
5
|
GIT_HOOK_CONTRACT_VERSION,
|
|
10
6
|
blockMarkers,
|
|
@@ -13,7 +9,11 @@ import {
|
|
|
13
9
|
hookBlockContractVersion,
|
|
14
10
|
inspectGitHookEntrypoint,
|
|
15
11
|
managedHookBlock
|
|
16
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-MWNRXAEB.js";
|
|
13
|
+
import {
|
|
14
|
+
HttpError,
|
|
15
|
+
getClient
|
|
16
|
+
} from "./chunk-U67RBNIZ.js";
|
|
17
17
|
import {
|
|
18
18
|
atomicWriteFile,
|
|
19
19
|
binFile,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
setRepoSyncId,
|
|
28
28
|
setRepositoryBindingState,
|
|
29
29
|
withFileLock
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-P2O7NLVN.js";
|
|
31
31
|
|
|
32
32
|
// src/commands/skill.ts
|
|
33
33
|
import { createHash as createHash2 } from "crypto";
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
saveRun,
|
|
12
12
|
sessionExcluded,
|
|
13
13
|
sessionKey
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-4L7TAM5S.js";
|
|
15
15
|
import {
|
|
16
16
|
packageVersion
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-P2O7NLVN.js";
|
|
18
18
|
|
|
19
19
|
// src/demo/isolation.ts
|
|
20
20
|
import { existsSync } from "fs";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
daemonRequest
|
|
3
|
+
} from "./chunk-SLDZJD6Q.js";
|
|
1
4
|
import {
|
|
2
5
|
getClient,
|
|
3
6
|
getSiteUrl,
|
|
4
7
|
terminalSafeLine
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import {
|
|
7
|
-
daemonRequest
|
|
8
|
-
} from "./chunk-J5HBSRAV.js";
|
|
8
|
+
} from "./chunk-U67RBNIZ.js";
|
|
9
9
|
import {
|
|
10
10
|
canonicalGitRoot,
|
|
11
11
|
canonicalRepositoryPath,
|
|
12
12
|
currentBranch,
|
|
13
13
|
repoSyncId
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-P2O7NLVN.js";
|
|
15
15
|
|
|
16
16
|
// src/daemon/proxy.ts
|
|
17
17
|
var DAEMON_HTTP_TIMEOUT_MS = 1e4;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
formatStatusline
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
getSiteUrl,
|
|
6
|
-
isSessionEnded,
|
|
7
|
-
terminalSafeText
|
|
8
|
-
} from "./chunk-6JHKKLA2.js";
|
|
3
|
+
} from "./chunk-GYQOZGGF.js";
|
|
9
4
|
import {
|
|
10
5
|
daemonPrincipalsMatch,
|
|
11
6
|
daemonRequest,
|
|
12
7
|
resolveDaemonPrincipal
|
|
13
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-SLDZJD6Q.js";
|
|
9
|
+
import {
|
|
10
|
+
getSiteUrl,
|
|
11
|
+
isSessionEnded,
|
|
12
|
+
terminalSafeText
|
|
13
|
+
} from "./chunk-U67RBNIZ.js";
|
|
14
14
|
import {
|
|
15
15
|
decisionIngestionStatus,
|
|
16
16
|
gitToplevel,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
primConfigDirectory,
|
|
19
19
|
repositoryBindingState,
|
|
20
20
|
withFileLock
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-P2O7NLVN.js";
|
|
22
22
|
|
|
23
23
|
// src/hooks/codex-context.ts
|
|
24
24
|
import { createHash, randomBytes as randomBytes2 } from "crypto";
|
|
@@ -61,13 +61,6 @@ var CODEX_DIGEST_STATE_MAX_FILES = 256;
|
|
|
61
61
|
var STATE_VERSION = 1;
|
|
62
62
|
var DRAFT_STATE_VERSION = 2;
|
|
63
63
|
var NO_CURSOR = -1;
|
|
64
|
-
function hasVisibleCodexMessage(output) {
|
|
65
|
-
if (typeof output !== "object" || output === null || Array.isArray(output)) return false;
|
|
66
|
-
const candidate = output;
|
|
67
|
-
return Boolean(
|
|
68
|
-
candidate.systemMessage?.trim() || candidate.hookSpecificOutput?.permissionDecisionReason?.trim() || candidate.hookSpecificOutput?.additionalContext?.trim()
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
64
|
function appendContext(existing, context) {
|
|
72
65
|
return existing ? `${existing}
|
|
73
66
|
|
|
@@ -505,7 +498,6 @@ async function prepareCodexContext(options) {
|
|
|
505
498
|
}
|
|
506
499
|
|
|
507
500
|
export {
|
|
508
|
-
hasVisibleCodexMessage,
|
|
509
501
|
appendCodexContext,
|
|
510
502
|
prepareCodexContext
|
|
511
503
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
+
mod
|
|
25
|
+
));
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
__commonJS,
|
|
29
|
+
__toESM
|
|
30
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/hooks/agent.ts
|
|
2
|
+
function parseAgent(argv) {
|
|
3
|
+
const i = argv.indexOf("--agent");
|
|
4
|
+
const value = i !== -1 ? argv[i + 1] : void 0;
|
|
5
|
+
if (value === "codex" || value === "cursor" || value === "hermes") {
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
return "claude_code";
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
parseAgent
|
|
13
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getSiteUrl
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-U67RBNIZ.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-P2O7NLVN.js";
|
|
11
11
|
|
|
12
12
|
// src/journal.ts
|
|
13
13
|
import {
|
|
@@ -16,12 +16,12 @@ import {
|
|
|
16
16
|
syncDirectory,
|
|
17
17
|
syncFile,
|
|
18
18
|
withFileLockSync
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-P2O7NLVN.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,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
boundedHealthError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5BQ2NEMP.js";
|
|
4
4
|
import {
|
|
5
5
|
terminalSafeLine
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-U67RBNIZ.js";
|
|
7
7
|
|
|
8
8
|
// src/hooks/redact.ts
|
|
9
9
|
import { existsSync, readFileSync, statSync } from "fs";
|