@primitive.ai/prim 0.1.0-alpha.117 → 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.
Files changed (47) hide show
  1. package/README.md +21 -21
  2. package/SKILL.md +3 -3
  3. package/dist/{chunk-XG7S3LIL.js → chunk-3NJ4FUPK.js} +889 -919
  4. package/dist/{chunk-J5HBSRAV.js → chunk-4HEWA4IO.js} +1 -1
  5. package/dist/{chunk-LEUZDTNT.js → chunk-B3FVP7VQ.js} +1 -1
  6. package/dist/{chunk-4OEJ2ONG.js → chunk-C2AEY4AI.js} +2 -13
  7. package/dist/{chunk-S55JKCHQ.js → chunk-C2AJBMP2.js} +2 -2
  8. package/dist/{chunk-D3ZDZZYS.js → chunk-CHRICRVE.js} +17 -10
  9. package/dist/{chunk-HMD5K6W7.js → chunk-ECP7EGOD.js} +2 -2
  10. package/dist/{chunk-FTW4ZCBA.js → chunk-FPDOBG3H.js} +1 -1
  11. package/dist/{chunk-3TIKBQHV.js → chunk-JGOFEG6T.js} +6 -4
  12. package/dist/chunk-JSBRDJBE.js +30 -0
  13. package/dist/{chunk-KGBMU76T.js → chunk-JXQVXU2K.js} +1 -1
  14. package/dist/chunk-KZB4ABIB.js +13 -0
  15. package/dist/{chunk-I3J344DF.js → chunk-L3NUFCOD.js} +5 -5
  16. package/dist/{chunk-6IRAGUYK.js → chunk-LEEWUN74.js} +2 -2
  17. package/dist/{chunk-JKJ22ONL.js → chunk-OHLVHT6R.js} +6 -6
  18. package/dist/{chunk-RLBASQJD.js → chunk-OIXHRN32.js} +4 -4
  19. package/dist/{chunk-LLKJAET2.js → chunk-PYIIYC3A.js} +8 -16
  20. package/dist/{chunk-NEQI2VLM.js → chunk-Q4CWXKNV.js} +5 -5
  21. package/dist/{chunk-4SN5BCIG.js → chunk-QX7QFMLF.js} +2 -2
  22. package/dist/{chunk-CXMLAWC2.js → chunk-SCOEPFOV.js} +2 -2
  23. package/dist/{chunk-6JHKKLA2.js → chunk-UMSJ4DU2.js} +46 -46
  24. package/dist/{chunk-JKO6PZWQ.js → chunk-VEI7KUOU.js} +26 -48
  25. package/dist/hook-runtime/daemon/server.js +1 -0
  26. package/dist/hook-runtime/hooks/post-commit.js +1 -0
  27. package/dist/hook-runtime/hooks/post-rewrite.js +1 -0
  28. package/dist/hook-runtime/hooks/post-tool-use.js +29 -29
  29. package/dist/hook-runtime/hooks/pre-commit.js +1 -0
  30. package/dist/hook-runtime/hooks/pre-tool-use-worker.js +34746 -0
  31. package/dist/hook-runtime/hooks/pre-tool-use.js +82 -35547
  32. package/dist/hook-runtime/hooks/prim-hook.js +22 -22
  33. package/dist/hook-runtime/hooks/session-end.js +14 -14
  34. package/dist/hook-runtime/hooks/session-start.js +100 -100
  35. package/dist/hook-runtime/index.js +244 -256
  36. package/dist/hook-runtime/statusline-main.js +1 -0
  37. package/dist/hooks/post-commit.js +8 -7
  38. package/dist/hooks/post-rewrite.js +7 -6
  39. package/dist/hooks/post-tool-use.js +25 -22
  40. package/dist/hooks/pre-commit.js +5 -4
  41. package/dist/hooks/pre-tool-use-worker.js +222 -0
  42. package/dist/hooks/pre-tool-use.js +73 -255
  43. package/dist/hooks/prim-hook.js +25 -22
  44. package/dist/hooks/session-end.js +10 -7
  45. package/dist/hooks/session-start.js +22 -19
  46. package/dist/index.js +54 -53
  47. package/package.json +3 -3
@@ -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;
@@ -62,9 +63,9 @@ function parseAgent(argv) {
62
63
  }
63
64
 
64
65
  // src/commands/cursor-install.ts
65
- import { existsSync as existsSync5, readFileSync as readFileSync6 } from "fs";
66
+ import { existsSync as existsSync5, readFileSync as readFileSync5 } from "fs";
66
67
  import { homedir as homedir3 } from "os";
67
- import { isAbsolute as isAbsolute5, join as join7 } from "path";
68
+ import { isAbsolute as isAbsolute5, join as join6 } from "path";
68
69
 
69
70
  // src/lib/atomic-file.ts
70
71
  import { randomUUID } from "crypto";
@@ -622,6 +623,7 @@ var HOOK_RUNTIME_ENTRIES = {
622
623
  "prim-pre-commit": "dist/hooks/pre-commit.js",
623
624
  "prim-post-commit": "dist/hooks/post-commit.js",
624
625
  "prim-post-rewrite": "dist/hooks/post-rewrite.js",
626
+ "prim-pre-tool-use-worker": "dist/hooks/pre-tool-use-worker.js",
625
627
  "prim-pre-tool-use": "dist/hooks/pre-tool-use.js",
626
628
  "prim-post-tool-use": "dist/hooks/post-tool-use.js",
627
629
  "prim-session-start": "dist/hooks/session-start.js",
@@ -709,13 +711,11 @@ function lstatIfPresent(path) {
709
711
 
710
712
  // src/lib/preflight-host.ts
711
713
  import { execFileSync } from "child_process";
712
- import { readFileSync as readFileSync4 } from "fs";
713
- import { join as join5 } from "path";
714
714
 
715
715
  // src/commands/claude-install.ts
716
- import { existsSync as existsSync4, readFileSync as readFileSync5 } from "fs";
716
+ import { existsSync as existsSync4, readFileSync as readFileSync4 } from "fs";
717
717
  import { homedir as homedir2 } from "os";
718
- import { join as join6 } from "path";
718
+ import { join as join5 } from "path";
719
719
 
720
720
  // src/lib/git.ts
721
721
  import { execFileSync as execFileSync2 } from "child_process";
@@ -829,7 +829,7 @@ var SESSION_END_BIN = "prim-session-end";
829
829
  var STATUSLINE_BIN = "prim-statusline";
830
830
  var STATUSLINE_ARGS = "";
831
831
  var STATUSLINE_COMMAND = stableHookCommand(STATUSLINE_BIN, STATUSLINE_ARGS);
832
- var USER_SCOPE_PATH = join6(homedir2(), ".claude", "settings.json");
832
+ var USER_SCOPE_PATH = join5(homedir2(), ".claude", "settings.json");
833
833
  function projectRoot() {
834
834
  return gitToplevel() ?? process.cwd();
835
835
  }
@@ -849,7 +849,7 @@ function makeRegistration(event, matcher, bin, args = "") {
849
849
  matcher,
850
850
  bin,
851
851
  command: stableHookCommand(bin, args),
852
- ...bin === GATE_BIN ? { timeout: 300, ...args.includes("--agent codex") ? {} : { onFailure: "block" } } : {}
852
+ ...bin === GATE_BIN ? { timeout: 2 } : {}
853
853
  };
854
854
  }
855
855
  function makeDetachedRegistration(event, matcher, bin, args = "") {
@@ -899,7 +899,7 @@ var CURSOR_EVENTS = [
899
899
  ];
900
900
  var REGISTRATIONS2 = [
901
901
  ...CURSOR_EVENTS.map((event) => ({ event, bin: CAPTURE_BIN2 })),
902
- { event: "preToolUse", bin: GATE_BIN2, matcher: "Write|Delete|Shell", timeout: 300 },
902
+ { event: "preToolUse", bin: GATE_BIN2, matcher: "Write|Delete|Shell", timeout: 2 },
903
903
  { event: "postToolUse", bin: POST_TOOL_BIN },
904
904
  { event: "postToolUseFailure", bin: POST_TOOL_BIN },
905
905
  { event: "sessionStart", bin: SESSION_START_BIN2 },
@@ -909,11 +909,11 @@ function cursorConfigDirectory(env = process.env, home = homedir3(), platform =
909
909
  const explicit = env.CURSOR_CONFIG_DIR?.trim();
910
910
  if (explicit && isAbsolute5(explicit)) return explicit;
911
911
  const xdg = env.XDG_CONFIG_HOME?.trim();
912
- if (platform !== "darwin" && xdg && isAbsolute5(xdg)) return join7(xdg, "cursor");
913
- return join7(home, ".cursor");
912
+ if (platform !== "darwin" && xdg && isAbsolute5(xdg)) return join6(xdg, "cursor");
913
+ return join6(home, ".cursor");
914
914
  }
915
915
  function cursorHooksPath(scope, root = projectRoot()) {
916
- return scope === "user" ? join7(cursorConfigDirectory(), "hooks.json") : join7(root, ".cursor", "hooks.json");
916
+ return scope === "user" ? join6(cursorConfigDirectory(), "hooks.json") : join6(root, ".cursor", "hooks.json");
917
917
  }
918
918
  function plainObject(value) {
919
919
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -922,7 +922,7 @@ function readCursorHooks(path) {
922
922
  if (!existsSync5(path)) return {};
923
923
  let parsed;
924
924
  try {
925
- parsed = JSON.parse(readFileSync6(path, "utf8"));
925
+ parsed = JSON.parse(readFileSync5(path, "utf8"));
926
926
  } catch {
927
927
  throw new Error(`invalid Cursor hooks JSON at ${path}`);
928
928
  }
@@ -960,7 +960,7 @@ function hookFor(registration, scope) {
960
960
  command: commandFor(registration, scope),
961
961
  ...registration.matcher ? { matcher: registration.matcher } : {},
962
962
  ...registration.timeout ? { timeout: registration.timeout } : {},
963
- ...registration.bin === GATE_BIN2 ? { failClosed: true } : {}
963
+ ...registration.bin === GATE_BIN2 ? { failClosed: false } : {}
964
964
  };
965
965
  }
966
966
  function exactHook(entry, registration, scope) {
@@ -1194,13 +1194,13 @@ function publicDecisionResponse(value) {
1194
1194
 
1195
1195
  // src/client.ts
1196
1196
  import { createHash as createHash4 } from "crypto";
1197
- import { chmodSync as chmodSync3, existsSync as existsSync6, mkdirSync as mkdirSync4, readFileSync as readFileSync9, rmSync as rmSync4 } from "fs";
1197
+ import { chmodSync as chmodSync3, existsSync as existsSync6, mkdirSync as mkdirSync4, readFileSync as readFileSync8, rmSync as rmSync4 } from "fs";
1198
1198
  import { dirname as dirname7 } from "path";
1199
1199
 
1200
1200
  // src/lib/credentials.ts
1201
1201
  import { createHash as createHash3 } from "crypto";
1202
- import { readFileSync as readFileSync7 } from "fs";
1203
- import { join as join8 } from "path";
1202
+ import { readFileSync as readFileSync6 } from "fs";
1203
+ import { join as join7 } from "path";
1204
1204
 
1205
1205
  // src/lib/workos-connect.ts
1206
1206
  var TOKEN_PATH = "/oauth2/token";
@@ -1348,20 +1348,20 @@ function parseWorkosConnectTokens(value, options = {}) {
1348
1348
 
1349
1349
  // src/lib/credentials.ts
1350
1350
  var CONFIG_DIRECTORY = primConfigDirectory();
1351
- var TOKEN_FILE_PATH = join8(CONFIG_DIRECTORY, "token");
1352
- var REFRESH_TOKEN_PATH = join8(CONFIG_DIRECTORY, "refresh_token");
1353
- var TOKEN_EXPIRES_PATH = join8(CONFIG_DIRECTORY, "token_expires_at");
1354
- var TERMINAL_REFRESH_PATH = join8(CONFIG_DIRECTORY, "refresh_terminal");
1355
- var CREDENTIAL_METADATA_PATH = join8(CONFIG_DIRECTORY, "credential_metadata.json");
1356
- var CREDENTIAL_FAMILY_PATH = join8(CONFIG_DIRECTORY, "credential_family.json");
1357
- var CREDENTIAL_MIGRATION_PATH = join8(CONFIG_DIRECTORY, "credential_migration.json");
1358
- var CREDENTIAL_LOCK_PATH = join8(CONFIG_DIRECTORY, "credentials.lock");
1351
+ var TOKEN_FILE_PATH = join7(CONFIG_DIRECTORY, "token");
1352
+ var REFRESH_TOKEN_PATH = join7(CONFIG_DIRECTORY, "refresh_token");
1353
+ var TOKEN_EXPIRES_PATH = join7(CONFIG_DIRECTORY, "token_expires_at");
1354
+ var TERMINAL_REFRESH_PATH = join7(CONFIG_DIRECTORY, "refresh_terminal");
1355
+ var CREDENTIAL_METADATA_PATH = join7(CONFIG_DIRECTORY, "credential_metadata.json");
1356
+ var CREDENTIAL_FAMILY_PATH = join7(CONFIG_DIRECTORY, "credential_family.json");
1357
+ var CREDENTIAL_MIGRATION_PATH = join7(CONFIG_DIRECTORY, "credential_migration.json");
1358
+ var CREDENTIAL_LOCK_PATH = join7(CONFIG_DIRECTORY, "credentials.lock");
1359
1359
  var MAX_CREDENTIAL_METADATA_BYTES = 4096;
1360
1360
  var CREDENTIAL_MIGRATION_VERSION = 1;
1361
1361
  var CREDENTIAL_MIGRATION_STATE = "family_bound";
1362
1362
  function readTrimmed(path) {
1363
1363
  try {
1364
- const value = readFileSync7(path, "utf8").trim();
1364
+ const value = readFileSync6(path, "utf8").trim();
1365
1365
  return value || void 0;
1366
1366
  } catch {
1367
1367
  return void 0;
@@ -1414,7 +1414,7 @@ function parseLegacyBrokerCredentialMetadata(value) {
1414
1414
  function readBoundedCredentialJson(path) {
1415
1415
  let raw;
1416
1416
  try {
1417
- raw = readFileSync7(path, "utf8");
1417
+ raw = readFileSync6(path, "utf8");
1418
1418
  } catch (error) {
1419
1419
  return error.code === "ENOENT" ? void 0 : null;
1420
1420
  }
@@ -1487,8 +1487,8 @@ function jwtExpiresAt(token) {
1487
1487
 
1488
1488
  // src/daemon/client-instance-id.ts
1489
1489
  import { randomBytes as randomBytes3 } from "crypto";
1490
- import { chmodSync as chmodSync2, lstatSync as lstatSync3, readFileSync as readFileSync8 } from "fs";
1491
- import { join as join9 } from "path";
1490
+ import { chmodSync as chmodSync2, lstatSync as lstatSync3, readFileSync as readFileSync7 } from "fs";
1491
+ import { join as join8 } from "path";
1492
1492
  var CONFIG_DIRECTORY_MODE = 448;
1493
1493
  var INSTANCE_FILE_MODE = 384;
1494
1494
  var INSTANCE_ENTROPY_BYTES = 32;
@@ -1525,7 +1525,7 @@ function readExisting(path) {
1525
1525
  if (metadata.size > MAX_STORED_BYTES) {
1526
1526
  throw new Error("stored client instance identity is invalid");
1527
1527
  }
1528
- const raw = readFileSync8(path, "utf8");
1528
+ const raw = readFileSync7(path, "utf8");
1529
1529
  const value = raw.endsWith("\n") ? raw.slice(0, -1) : raw;
1530
1530
  if (raw !== value && raw !== `${value}
1531
1531
  ` || !isClientInstanceId(value)) {
@@ -1539,8 +1539,8 @@ function atomicWrite(path, value) {
1539
1539
  }
1540
1540
  async function getOrCreateClientInstanceId(options) {
1541
1541
  const configDir = options.configDir;
1542
- const path = join9(configDir, "client_instance_id");
1543
- const lockPath = join9(configDir, "client-instance.lock");
1542
+ const path = join8(configDir, "client_instance_id");
1543
+ const lockPath = join8(configDir, "client-instance.lock");
1544
1544
  ensurePrivateConfigDirectory(configDir);
1545
1545
  return withFileLock(
1546
1546
  lockPath,
@@ -1637,7 +1637,7 @@ var DEFAULT_API_URL = "https://api.getprimitive.ai";
1637
1637
  var AUTH_EXPIRED_MESSAGE = "Authentication expired. Run `prim auth login` to re-authenticate.";
1638
1638
  function readTrimmed2(path) {
1639
1639
  try {
1640
- const value = readFileSync9(path, "utf8").trim();
1640
+ const value = readFileSync8(path, "utf8").trim();
1641
1641
  return value || void 0;
1642
1642
  } catch {
1643
1643
  return void 0;
@@ -2090,7 +2090,7 @@ import {
2090
2090
  lstatSync as lstatSync5,
2091
2091
  mkdirSync as mkdirSync5,
2092
2092
  openSync as openSync3,
2093
- readFileSync as readFileSync11,
2093
+ readFileSync as readFileSync10,
2094
2094
  readSync as readSync2,
2095
2095
  readdirSync as readdirSync3,
2096
2096
  realpathSync as realpathSync3,
@@ -2098,7 +2098,7 @@ import {
2098
2098
  rmdirSync as rmdirSync2
2099
2099
  } from "fs";
2100
2100
  import { homedir as homedir5 } from "os";
2101
- import { dirname as dirname9, isAbsolute as isAbsolute6, join as join13, relative as relative2, resolve as resolve5, sep as sep2 } from "path";
2101
+ import { dirname as dirname9, isAbsolute as isAbsolute6, join as join12, relative as relative2, resolve as resolve5, sep as sep2 } from "path";
2102
2102
  import { fileURLToPath as fileURLToPath3 } from "url";
2103
2103
 
2104
2104
  // node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/identity.js
@@ -8377,14 +8377,14 @@ import {
8377
8377
  fstatSync,
8378
8378
  lstatSync as lstatSync4,
8379
8379
  openSync as openSync2,
8380
- readFileSync as readFileSync10,
8380
+ readFileSync as readFileSync9,
8381
8381
  readSync,
8382
8382
  readdirSync as readdirSync2,
8383
8383
  rmdirSync,
8384
8384
  unlinkSync
8385
8385
  } from "fs";
8386
8386
  import { homedir as homedir4 } from "os";
8387
- import { dirname as dirname8, join as join12, resolve as resolve4 } from "path";
8387
+ import { dirname as dirname8, join as join11, resolve as resolve4 } from "path";
8388
8388
  import { fileURLToPath as fileURLToPath2 } from "url";
8389
8389
 
8390
8390
  // node_modules/.pnpm/diff@5.2.2/node_modules/diff/lib/index.mjs
@@ -8554,7 +8554,7 @@ Diff.prototype = {
8554
8554
  tokenize: function tokenize(value) {
8555
8555
  return value.split("");
8556
8556
  },
8557
- join: function join11(chars) {
8557
+ join: function join10(chars) {
8558
8558
  return chars.join("");
8559
8559
  }
8560
8560
  };
@@ -8771,10 +8771,10 @@ function readCodexGuidance(path) {
8771
8771
  }
8772
8772
  }
8773
8773
  function effectiveCodexGuidance(scope) {
8774
- const override = readCodexGuidance(join12(scope, "AGENTS.override.md"));
8774
+ const override = readCodexGuidance(join11(scope, "AGENTS.override.md"));
8775
8775
  if (override === null) return null;
8776
8776
  if (override !== void 0 && override.toString("utf8").trim().length > 0) return override;
8777
- const base = readCodexGuidance(join12(scope, "AGENTS.md"));
8777
+ const base = readCodexGuidance(join11(scope, "AGENTS.md"));
8778
8778
  return base ?? null;
8779
8779
  }
8780
8780
  function hasUsablePrimBlock(content, visibleBytes) {
@@ -8797,7 +8797,7 @@ function hasUsablePrimBlock(content, visibleBytes) {
8797
8797
  }
8798
8798
  function hasUsableCodexGuidance(projectRoot2) {
8799
8799
  try {
8800
- const codexHome = process.env.CODEX_HOME?.trim() ? resolve4(process.env.CODEX_HOME) : join12(homedir4(), ".codex");
8800
+ const codexHome = process.env.CODEX_HOME?.trim() ? resolve4(process.env.CODEX_HOME) : join11(homedir4(), ".codex");
8801
8801
  const scopes = [
8802
8802
  { path: codexHome, visibleBytes: CODEX_GUIDANCE_LIMIT_BYTES },
8803
8803
  { path: projectRoot2, visibleBytes: CODEX_DEFAULT_PROJECT_GUIDANCE_BYTES }
@@ -8817,19 +8817,19 @@ function sha256(content) {
8817
8817
  }
8818
8818
  function cursorSkillDirectory(cwd, scope) {
8819
8819
  const base = scope === "user" ? cursorConfigDirectory() : gitToplevel(cwd) ?? cwd;
8820
- return join12(base, scope === "user" ? "skills" : ".cursor/skills", "prim");
8820
+ return join11(base, scope === "user" ? "skills" : ".cursor/skills", "prim");
8821
8821
  }
8822
8822
  function cursorSkillPaths(cwd, scope) {
8823
8823
  const directory = cursorSkillDirectory(cwd, scope);
8824
8824
  return {
8825
8825
  directory,
8826
- skill: join12(directory, "SKILL.md"),
8827
- manifest: join12(directory, CURSOR_SKILL_MANIFEST)
8826
+ skill: join11(directory, "SKILL.md"),
8827
+ manifest: join11(directory, CURSOR_SKILL_MANIFEST)
8828
8828
  };
8829
8829
  }
8830
8830
  function readCursorSkillManifest(path) {
8831
8831
  try {
8832
- const value = JSON.parse(readFileSync10(path, "utf8"));
8832
+ const value = JSON.parse(readFileSync9(path, "utf8"));
8833
8833
  if (!value || typeof value !== "object" || Array.isArray(value)) return;
8834
8834
  const record = value;
8835
8835
  if (record.version !== 1 || record.owner !== CURSOR_SKILL_OWNER || typeof record.contentSha256 !== "string" || !/^[0-9a-f]{64}$/u.test(record.contentSha256)) {
@@ -8843,7 +8843,7 @@ function readCursorSkillManifest(path) {
8843
8843
  function cursorSkillStatus(cwd, scope) {
8844
8844
  const paths = cursorSkillPaths(cwd, scope);
8845
8845
  const manifest = readCursorSkillManifest(paths.manifest);
8846
- const content = existsSync7(paths.skill) ? readFileSync10(paths.skill, "utf8") : void 0;
8846
+ const content = existsSync7(paths.skill) ? readFileSync9(paths.skill, "utf8") : void 0;
8847
8847
  const owned = manifest !== void 0;
8848
8848
  const installed = owned && content !== void 0 && sha256(content) === manifest.contentSha256;
8849
8849
  return {
@@ -8860,7 +8860,7 @@ function loadSkill() {
8860
8860
  let dir = __dirname;
8861
8861
  while (dir !== dirname8(dir)) {
8862
8862
  const p = resolve4(dir, "SKILL.md");
8863
- if (existsSync7(p)) return readFileSync10(p, "utf-8");
8863
+ if (existsSync7(p)) return readFileSync9(p, "utf-8");
8864
8864
  dir = dirname8(dir);
8865
8865
  }
8866
8866
  throw new Error("SKILL.md not found in package");
@@ -8877,14 +8877,14 @@ var MAX_SKILL_BYTES = 1024 * 1024;
8877
8877
  var REFRESH_LOCK_TIMEOUT_MS = 150;
8878
8878
  var REFRESH_LOCK_POLL_MS = 10;
8879
8879
  function pluginDirFor(cwd, scope) {
8880
- const base = scope === "user" ? join13(homedir5(), ".claude") : join13(gitToplevel(cwd) ?? cwd, ".claude");
8881
- return join13(base, "skills", "prim");
8880
+ const base = scope === "user" ? join12(homedir5(), ".claude") : join12(gitToplevel(cwd) ?? cwd, ".claude");
8881
+ return join12(base, "skills", "prim");
8882
8882
  }
8883
8883
  function packageVersion2() {
8884
8884
  let dir = __dirname2;
8885
8885
  while (dir !== dirname9(dir)) {
8886
8886
  const p = resolve5(dir, "package.json");
8887
- if (existsSync8(p)) return JSON.parse(readFileSync11(p, "utf-8")).version;
8887
+ if (existsSync8(p)) return JSON.parse(readFileSync10(p, "utf-8")).version;
8888
8888
  dir = dirname9(dir);
8889
8889
  }
8890
8890
  return "0.0.0";
@@ -8900,8 +8900,8 @@ function renderClaudePlugin() {
8900
8900
  }
8901
8901
  function pluginPaths(dir) {
8902
8902
  return {
8903
- manifestPath: join13(dir, ".claude-plugin", "plugin.json"),
8904
- skillPath: join13(dir, "SKILL.md")
8903
+ manifestPath: join12(dir, ".claude-plugin", "plugin.json"),
8904
+ skillPath: join12(dir, "SKILL.md")
8905
8905
  };
8906
8906
  }
8907
8907
  function pathIsInside(root, path) {
@@ -8966,9 +8966,9 @@ function inspectRecognizedInstallation(paths, projectRoot2) {
8966
8966
  };
8967
8967
  }
8968
8968
  function refreshLockDir(physicalPluginDir) {
8969
- const cacheRoot = process.env.XDG_CACHE_HOME || join13(homedir5(), ".cache");
8969
+ const cacheRoot = process.env.XDG_CACHE_HOME || join12(homedir5(), ".cache");
8970
8970
  const identity = createHash6("sha256").update(physicalPluginDir).digest("hex");
8971
- return join13(cacheRoot, "prim", "skill-refresh-locks", `${identity}.lock`);
8971
+ return join12(cacheRoot, "prim", "skill-refresh-locks", `${identity}.lock`);
8972
8972
  }
8973
8973
  async function refreshClaudePlugins(cwd, options = {}) {
8974
8974
  const result = { installed: 0, refreshed: 0 };
@@ -8976,7 +8976,7 @@ async function refreshClaudePlugins(cwd, options = {}) {
8976
8976
  if (options.includeProject !== false) {
8977
8977
  const projectRoot2 = options.projectRoot ?? gitToplevel(cwd);
8978
8978
  if (projectRoot2 !== null && isAbsolute6(projectRoot2)) {
8979
- candidates.push({ dir: join13(projectRoot2, ".claude", "skills", "prim"), projectRoot: projectRoot2 });
8979
+ candidates.push({ dir: join12(projectRoot2, ".claude", "skills", "prim"), projectRoot: projectRoot2 });
8980
8980
  }
8981
8981
  }
8982
8982
  candidates.push({ dir: pluginDirFor(cwd, "user") });
@@ -9089,8 +9089,8 @@ function parseDaemonResponseEnvelope(value) {
9089
9089
 
9090
9090
  // src/daemon/client.ts
9091
9091
  import { createConnection } from "net";
9092
- import { join as join14 } from "path";
9093
- var SOCK_PATH = join14(primConfigDirectory(), "sock");
9092
+ import { join as join13 } from "path";
9093
+ var SOCK_PATH = join13(primConfigDirectory(), "sock");
9094
9094
  var DEFAULT_TIMEOUT_MS2 = 250;
9095
9095
  var nextRequestId = 1;
9096
9096
  function daemonRequest(method, params = {}, opts = {}) {
@@ -9398,9 +9398,9 @@ async function acknowledgeDecisionFeedback(input, dependencies = {}) {
9398
9398
 
9399
9399
  // src/lib/activation.ts
9400
9400
  import { execFileSync as execFileSync3 } from "child_process";
9401
- import { existsSync as existsSync9, readFileSync as readFileSync12 } from "fs";
9401
+ import { existsSync as existsSync9, readFileSync as readFileSync11 } from "fs";
9402
9402
  import { homedir as homedir6 } from "os";
9403
- import { join as join15 } from "path";
9403
+ import { join as join14 } from "path";
9404
9404
  var PRIM_ACTIVE_KEY = "prim.active";
9405
9405
  var PRIM_REPO_SYNC_ID_KEY = "prim.repoSyncId";
9406
9406
  var PRIM_REPO_SYNC_REPOSITORY_KEY = "prim.repoSyncRepository";
@@ -9498,10 +9498,10 @@ function hasProjectPrimInstall(cwd) {
9498
9498
  const root = gitToplevel(cwd);
9499
9499
  if (root === null || root === homedir6()) return false;
9500
9500
  for (const rel of PROJECT_INSTALL_FILES) {
9501
- const path = join15(root, rel);
9501
+ const path = join14(root, rel);
9502
9502
  if (existsSync9(path)) {
9503
9503
  try {
9504
- const content = readFileSync12(path, "utf-8");
9504
+ const content = readFileSync11(path, "utf-8");
9505
9505
  if (PRIM_HOOK_BINS.some((bin) => content.includes(bin))) return true;
9506
9506
  } catch {
9507
9507
  }
@@ -9522,13 +9522,13 @@ function decisionIngestionStatus(cwd) {
9522
9522
  // src/lib/bin-cache.ts
9523
9523
  import { chmodSync as chmodSync4, mkdirSync as mkdirSync6 } from "fs";
9524
9524
  import { homedir as homedir7 } from "os";
9525
- import { join as join16 } from "path";
9525
+ import { join as join15 } from "path";
9526
9526
  var GIT_HOOK_CACHE_SHELL_DIR = "${XDG_CACHE_HOME:-$HOME/.cache}/prim/bin";
9527
9527
  var GIT_HOOK_CACHE_TTL_MINUTES = 1440;
9528
9528
  var GIT_HOOK_CACHED_BINS = ["prim-post-commit", "prim-post-rewrite"];
9529
9529
  function binCacheDir() {
9530
- const base = process.env.XDG_CACHE_HOME || join16(homedir7(), ".cache");
9531
- return join16(base, "prim", "bin");
9530
+ const base = process.env.XDG_CACHE_HOME || join15(homedir7(), ".cache");
9531
+ return join15(base, "prim", "bin");
9532
9532
  }
9533
9533
  function writeAtomic(path, content) {
9534
9534
  atomicWriteFile(path, content, { mode: 384 });
@@ -9541,11 +9541,11 @@ function warmBinCache() {
9541
9541
  const dir = binCacheDir();
9542
9542
  mkdirSync6(dir, { recursive: true, mode: 448 });
9543
9543
  chmodSync4(dir, 448);
9544
- writeAtomic(join16(dir, "node"), process.execPath);
9544
+ writeAtomic(join15(dir, "node"), process.execPath);
9545
9545
  for (const bin of GIT_HOOK_CACHED_BINS) {
9546
9546
  const file = binFile(bin);
9547
9547
  if (file) {
9548
- writeAtomic(join16(dir, bin), file);
9548
+ writeAtomic(join15(dir, bin), file);
9549
9549
  }
9550
9550
  }
9551
9551
  } catch {
@@ -31654,8 +31654,8 @@ async function fetchAndCacheCollectScope(cwd, dependencies = defaultDependencies
31654
31654
 
31655
31655
  // src/lib/commit-heartbeat.ts
31656
31656
  import { execFileSync as execFileSync4 } from "child_process";
31657
- import { mkdirSync as mkdirSync7, readFileSync as readFileSync13, readdirSync as readdirSync4, unlinkSync as unlinkSync2 } from "fs";
31658
- import { dirname as dirname10, join as join17, resolve as resolve6 } from "path";
31657
+ import { mkdirSync as mkdirSync7, readFileSync as readFileSync12, readdirSync as readdirSync4, unlinkSync as unlinkSync2 } from "fs";
31658
+ import { dirname as dirname10, join as join16, resolve as resolve6 } from "path";
31659
31659
  var WIRED_PATH = "prim/git-hooks-wired";
31660
31660
  var GIT_TIMEOUT_MS3 = 1e3;
31661
31661
  var MAX_STAMP_BYTES = 1024;
@@ -31667,7 +31667,7 @@ function commonPath(cwd, relative4) {
31667
31667
  timeout: GIT_TIMEOUT_MS3
31668
31668
  }).replace(/\r?\n$/u, "");
31669
31669
  if (value === "" || /[\0\r\n]/u.test(value)) throw new Error("Git returned an unsafe path");
31670
- return join17(resolve6(cwd, value), relative4);
31670
+ return join16(resolve6(cwd, value), relative4);
31671
31671
  }
31672
31672
  function ensurePrivateParent(path) {
31673
31673
  mkdirSync7(dirname10(dirname10(path)), { recursive: true, mode: 448 });
@@ -31680,7 +31680,7 @@ function writeStamp(path, at) {
31680
31680
  }
31681
31681
  function readStampAt(path) {
31682
31682
  try {
31683
- const raw = readFileSync13(path, "utf8");
31683
+ const raw = readFileSync12(path, "utf8");
31684
31684
  if (raw.length > MAX_STAMP_BYTES) return void 0;
31685
31685
  const parsed = JSON.parse(raw);
31686
31686
  return typeof parsed.at === "number" && Number.isSafeInteger(parsed.at) && parsed.at > 0 ? parsed.at : void 0;
@@ -31715,13 +31715,13 @@ import {
31715
31715
  lstatSync as lstatSync6,
31716
31716
  mkdirSync as mkdirSync8,
31717
31717
  openSync as openSync4,
31718
- readFileSync as readFileSync14,
31718
+ readFileSync as readFileSync13,
31719
31719
  realpathSync as realpathSync4,
31720
31720
  renameSync as renameSync3,
31721
31721
  unlinkSync as unlinkSync3,
31722
31722
  writeFileSync as writeFileSync4
31723
31723
  } from "fs";
31724
- import { basename as basename2, dirname as dirname11, isAbsolute as isAbsolute8, join as join18, relative as relative3, resolve as resolve7, sep as sep3 } from "path";
31724
+ import { basename as basename2, dirname as dirname11, isAbsolute as isAbsolute8, join as join17, relative as relative3, resolve as resolve7, sep as sep3 } from "path";
31725
31725
 
31726
31726
  // src/lib/git-hook-legacy.ts
31727
31727
  import { isAbsolute as isAbsolute7 } from "path";
@@ -32030,7 +32030,7 @@ function realpathLoose(path) {
32030
32030
  let current = resolve7(path);
32031
32031
  for (; ; ) {
32032
32032
  try {
32033
- return join18(realpathSync4.native(current), ...missing);
32033
+ return join17(realpathSync4.native(current), ...missing);
32034
32034
  } catch {
32035
32035
  const parent = dirname11(current);
32036
32036
  if (parent === current) return resolve7(path);
@@ -32045,7 +32045,7 @@ function isWithin(path, directory) {
32045
32045
  }
32046
32046
  function primGitHooksDirectory() {
32047
32047
  try {
32048
- return join18(primConfigDirectory(), "git-hooks");
32048
+ return join17(primConfigDirectory(), "git-hooks");
32049
32049
  } catch {
32050
32050
  return void 0;
32051
32051
  }
@@ -32154,7 +32154,7 @@ function assertUsableHuskyDispatcher(target, spec) {
32154
32154
  }
32155
32155
  }
32156
32156
  function readHookFile(path) {
32157
- const value = readFileSync14(path);
32157
+ const value = readFileSync13(path);
32158
32158
  return Buffer.isBuffer(value) ? value : Buffer.from(value);
32159
32159
  }
32160
32160
  function decodeHookText(content, spec) {
@@ -32226,11 +32226,11 @@ function blockInsertionPoint(content, spec, huskyV8) {
32226
32226
  var HUSKY_SPEC_MAJOR_RE = /^\s*[~^]?=?\s*v?([0-9]+)(?:\.(?:[0-9]+|[xX*])){0,2}(?:-[0-9A-Za-z.-]+)?\s*$/u;
32227
32227
  function declaredHuskyMajor(dir) {
32228
32228
  for (let current = resolve7(dir); ; ) {
32229
- const manifest = join18(current, "package.json");
32229
+ const manifest = join17(current, "package.json");
32230
32230
  if (existsSync10(manifest)) {
32231
32231
  try {
32232
32232
  if (lstatSync6(manifest).size > MAX_HOOK_BYTES) return void 0;
32233
- const parsed = JSON.parse(readFileSync14(manifest, "utf8"));
32233
+ const parsed = JSON.parse(readFileSync13(manifest, "utf8"));
32234
32234
  const range = parsed.devDependencies?.husky ?? parsed.dependencies?.husky;
32235
32235
  const major = typeof range === "string" ? HUSKY_SPEC_MAJOR_RE.exec(range)?.[1] : void 0;
32236
32236
  return major === void 0 ? void 0 : Number(major);
@@ -32239,15 +32239,15 @@ function declaredHuskyMajor(dir) {
32239
32239
  }
32240
32240
  }
32241
32241
  const parent = dirname11(current);
32242
- if (parent === current || existsSync10(join18(current, ".git"))) return void 0;
32242
+ if (parent === current || existsSync10(join17(current, ".git"))) return void 0;
32243
32243
  current = parent;
32244
32244
  }
32245
32245
  }
32246
32246
  function isHuskyV8Hook(hookPath) {
32247
- const runtime = join18(dirname11(hookPath), "_", "husky.sh");
32247
+ const runtime = join17(dirname11(hookPath), "_", "husky.sh");
32248
32248
  try {
32249
32249
  const stat = lstatSync6(runtime);
32250
- return stat.isFile() && stat.size <= MAX_HOOK_BYTES && readFileSync14(runtime, "utf8").includes("husky_skip_init");
32250
+ return stat.isFile() && stat.size <= MAX_HOOK_BYTES && readFileSync13(runtime, "utf8").includes("husky_skip_init");
32251
32251
  } catch (error) {
32252
32252
  if (errorCode(error) !== "ENOENT") return false;
32253
32253
  }
@@ -32565,13 +32565,13 @@ import {
32565
32565
  lstatSync as lstatSync7,
32566
32566
  mkdirSync as mkdirSync9,
32567
32567
  openSync as openSync5,
32568
- readFileSync as readFileSync15,
32568
+ readFileSync as readFileSync14,
32569
32569
  statSync as statSync3,
32570
32570
  unlinkSync as unlinkSync4,
32571
32571
  writeFileSync as writeFileSync5
32572
32572
  } from "fs";
32573
- import { dirname as dirname12, isAbsolute as isAbsolute9, join as join19, resolve as resolve8 } from "path";
32574
- var WORKSPACE_ID_RELATIVE_PATH = join19("prim", "workspace-id");
32573
+ import { dirname as dirname12, isAbsolute as isAbsolute9, join as join18, resolve as resolve8 } from "path";
32574
+ var WORKSPACE_ID_RELATIVE_PATH = join18("prim", "workspace-id");
32575
32575
  var MAX_ANCESTORS = 64;
32576
32576
  var MAX_GIT_FILE_BYTES = 4096;
32577
32577
  var MAX_ID_FILE_BYTES = 128;
@@ -32630,19 +32630,19 @@ function resolveWorkspaceIdPath(cwd) {
32630
32630
  function resolveFromFilesystem(cwd) {
32631
32631
  let current = resolve8(cwd);
32632
32632
  for (let depth = 0; depth < MAX_ANCESTORS; depth += 1) {
32633
- const dotGit = join19(current, ".git");
32633
+ const dotGit = join18(current, ".git");
32634
32634
  try {
32635
32635
  const stat = lstatSync7(dotGit);
32636
32636
  if (stat.isDirectory() && isGitDirectory(dotGit)) {
32637
- return join19(dotGit, WORKSPACE_ID_RELATIVE_PATH);
32637
+ return join18(dotGit, WORKSPACE_ID_RELATIVE_PATH);
32638
32638
  }
32639
32639
  if (stat.isFile() && stat.size <= MAX_GIT_FILE_BYTES) {
32640
- const contents = readFileSync15(dotGit, "utf8");
32640
+ const contents = readFileSync14(dotGit, "utf8");
32641
32641
  const match = /^gitdir: (.+?)(?:\r?\n)?$/.exec(contents);
32642
32642
  if (match?.[1]) {
32643
32643
  const gitDirectory = isAbsolute9(match[1]) ? resolve8(match[1]) : resolve8(current, match[1]);
32644
32644
  if (isGitDirectory(gitDirectory)) {
32645
- return join19(gitDirectory, WORKSPACE_ID_RELATIVE_PATH);
32645
+ return join18(gitDirectory, WORKSPACE_ID_RELATIVE_PATH);
32646
32646
  }
32647
32647
  }
32648
32648
  }
@@ -32661,7 +32661,7 @@ function resolveFromFilesystem(cwd) {
32661
32661
  }
32662
32662
  function isGitDirectory(path) {
32663
32663
  try {
32664
- return statSync3(join19(path, "HEAD")).isFile();
32664
+ return statSync3(join18(path, "HEAD")).isFile();
32665
32665
  } catch {
32666
32666
  return false;
32667
32667
  }
@@ -32680,7 +32680,7 @@ function inspectPath(path) {
32680
32680
  return { status: "corrupt", path, reason: "invalid_content" };
32681
32681
  }
32682
32682
  try {
32683
- const contents = readFileSync15(path, "utf8");
32683
+ const contents = readFileSync14(path, "utf8");
32684
32684
  const workspaceId = contents.endsWith("\n") ? contents.slice(0, -1) : contents;
32685
32685
  if ((contents === workspaceId || contents === `${workspaceId}
32686
32686
  `) && isCanonicalWorkspaceId(workspaceId)) {
@@ -32699,7 +32699,7 @@ function inspectPath(path) {
32699
32699
  function createWorkspaceId(path) {
32700
32700
  const parent = dirname12(path);
32701
32701
  const workspaceId = randomUUID3();
32702
- const temporaryPath = join19(parent, `.workspace-id-${process.pid}-${randomUUID3()}.tmp`);
32702
+ const temporaryPath = join18(parent, `.workspace-id-${process.pid}-${randomUUID3()}.tmp`);
32703
32703
  let temporaryCreated = false;
32704
32704
  let publishing = false;
32705
32705
  try {
@@ -32764,7 +32764,7 @@ import {
32764
32764
  chmodSync as chmodSync6,
32765
32765
  existsSync as existsSync11,
32766
32766
  mkdirSync as mkdirSync10,
32767
- readFileSync as readFileSync16,
32767
+ readFileSync as readFileSync15,
32768
32768
  readdirSync as readdirSync5,
32769
32769
  renameSync as renameSync4,
32770
32770
  rmSync as rmSync6,
@@ -32772,7 +32772,7 @@ import {
32772
32772
  unlinkSync as unlinkSync5,
32773
32773
  writeFileSync as writeFileSync6
32774
32774
  } from "fs";
32775
- import { join as join20 } from "path";
32775
+ import { join as join19 } from "path";
32776
32776
 
32777
32777
  // src/daemon/decision-digest-cache.ts
32778
32778
  import { randomBytes as randomBytes4 } from "crypto";
@@ -32925,10 +32925,10 @@ var STATE_VERSION = 1;
32925
32925
  var DRAFT_STATE_VERSION = 2;
32926
32926
  var NO_CURSOR = -1;
32927
32927
  function stateRoot(namespace) {
32928
- return join20(primConfigDirectory(), namespace, "decision-digests");
32928
+ return join19(primConfigDirectory(), namespace, "decision-digests");
32929
32929
  }
32930
32930
  function draftStateRoot(namespace) {
32931
- return join20(primConfigDirectory(), namespace, "decision-draft-deliveries");
32931
+ return join19(primConfigDirectory(), namespace, "decision-draft-deliveries");
32932
32932
  }
32933
32933
  function workspaceFor(cwd) {
32934
32934
  try {
@@ -32940,12 +32940,12 @@ function workspaceFor(cwd) {
32940
32940
  function statePath(args) {
32941
32941
  const identity = `${args.siteUrl}\0${workspaceFor(args.cwd)}\0${args.sessionId}`;
32942
32942
  const key = createHash9("sha256").update(identity).digest("hex");
32943
- return join20(stateRoot(args.namespace), `${key}.json`);
32943
+ return join19(stateRoot(args.namespace), `${key}.json`);
32944
32944
  }
32945
32945
  function draftStatePath(args) {
32946
32946
  const identity = `${args.siteUrl}\0${workspaceFor(args.cwd)}\0${args.sessionId}\0${args.principalId}\0${args.organizationId}\0${args.credentialFingerprint}`;
32947
32947
  const key = createHash9("sha256").update(identity).digest("hex");
32948
- return join20(draftStateRoot(args.namespace), `${key}.json`);
32948
+ return join19(draftStateRoot(args.namespace), `${key}.json`);
32949
32949
  }
32950
32950
  function parseState(value) {
32951
32951
  if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
@@ -32986,7 +32986,7 @@ function parseDraftState(value) {
32986
32986
  function readState(path) {
32987
32987
  if (!existsSync11(path)) return void 0;
32988
32988
  try {
32989
- return parseState(JSON.parse(readFileSync16(path, "utf8")));
32989
+ return parseState(JSON.parse(readFileSync15(path, "utf8")));
32990
32990
  } catch {
32991
32991
  return void 0;
32992
32992
  }
@@ -32994,7 +32994,7 @@ function readState(path) {
32994
32994
  function readDraftState(path) {
32995
32995
  if (!existsSync11(path)) return void 0;
32996
32996
  try {
32997
- return parseDraftState(JSON.parse(readFileSync16(path, "utf8")));
32997
+ return parseDraftState(JSON.parse(readFileSync15(path, "utf8")));
32998
32998
  } catch {
32999
32999
  return void 0;
33000
33000
  }
@@ -33002,7 +33002,7 @@ function readDraftState(path) {
33002
33002
  function writeStateFile(path, directory, state) {
33003
33003
  mkdirSync10(directory, { recursive: true, mode: 448 });
33004
33004
  chmodSync6(directory, 448);
33005
- const temporary = join20(
33005
+ const temporary = join19(
33006
33006
  directory,
33007
33007
  `.${path.slice(directory.length + 1)}.tmp-${process.pid}-${randomBytes5(8).toString("hex")}`
33008
33008
  );
@@ -33033,7 +33033,7 @@ function cleanupStateFiles(directory, now) {
33033
33033
  const files = [];
33034
33034
  const residue = [];
33035
33035
  for (const name of names) {
33036
- const path = join20(directory, name);
33036
+ const path = join19(directory, name);
33037
33037
  try {
33038
33038
  const mtimeMs = statSync4(path).mtimeMs;
33039
33039
  if (name.endsWith(".json")) {