@primitive.ai/prim 0.1.0-alpha.114 → 0.1.0-alpha.116

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 (38) hide show
  1. package/README.md +62 -0
  2. package/SKILL.md +5 -3
  3. package/assets/primitive-gameplan/SKILL.md +134 -0
  4. package/assets/primitive-gameplan/claude-hooks.json +28 -0
  5. package/assets/primitive-gameplan/scripts/activate.mjs +37 -0
  6. package/dist/{chunk-IZXLH3R5.js → chunk-3TIKBQHV.js} +2584 -821
  7. package/dist/{chunk-NH3VC7YO.js → chunk-4OEJ2ONG.js} +1 -1
  8. package/dist/{chunk-DWAXFXDG.js → chunk-4SN5BCIG.js} +1 -1
  9. package/dist/{chunk-3KKEV7VI.js → chunk-6IRAGUYK.js} +1 -1
  10. package/dist/chunk-CXMLAWC2.js +96 -0
  11. package/dist/chunk-D3ZDZZYS.js +449 -0
  12. package/dist/{chunk-RUUSUF43.js → chunk-I3J344DF.js} +231 -94
  13. package/dist/{chunk-7DVEH7FO.js → chunk-JKJ22ONL.js} +1 -1
  14. package/dist/{chunk-PO5QAYD7.js → chunk-JKO6PZWQ.js} +119 -24
  15. package/dist/{chunk-BXLH4LDU.js → chunk-LEUZDTNT.js} +1 -1
  16. package/dist/{chunk-PJW6JZMH.js → chunk-LLKJAET2.js} +1 -1
  17. package/dist/{chunk-IMYELJIV.js → chunk-RLBASQJD.js} +3 -3
  18. package/dist/{chunk-RTULPLS7.js → chunk-S55JKCHQ.js} +1 -1
  19. package/dist/daemon/server.js +2583 -822
  20. package/dist/hook-runtime/daemon/server.js +2583 -822
  21. package/dist/hook-runtime/hooks/post-commit.js +2581 -820
  22. package/dist/hook-runtime/hooks/post-rewrite.js +2581 -820
  23. package/dist/hook-runtime/hooks/post-tool-use.js +2689 -921
  24. package/dist/hook-runtime/hooks/pre-tool-use.js +2922 -985
  25. package/dist/hook-runtime/hooks/prim-hook.js +2682 -914
  26. package/dist/hook-runtime/hooks/session-end.js +19 -12
  27. package/dist/hook-runtime/hooks/session-start.js +2828 -1060
  28. package/dist/hook-runtime/index.js +23395 -12348
  29. package/dist/hooks/post-commit.js +3 -3
  30. package/dist/hooks/post-rewrite.js +3 -3
  31. package/dist/hooks/post-tool-use.js +11 -11
  32. package/dist/hooks/pre-tool-use.js +78 -316
  33. package/dist/hooks/prim-hook.js +10 -10
  34. package/dist/hooks/session-end.js +2 -2
  35. package/dist/hooks/session-start.js +6 -6
  36. package/dist/index.js +564 -157
  37. package/package.json +8 -1
  38. package/dist/chunk-JDIAPBY7.js +0 -233
@@ -549,9 +549,9 @@ function parseAgent(argv) {
549
549
  }
550
550
 
551
551
  // src/commands/cursor-install.ts
552
- import { existsSync as existsSync6, readFileSync as readFileSync7 } from "fs";
552
+ import { existsSync as existsSync6, readFileSync as readFileSync8 } from "fs";
553
553
  import { homedir as homedir4 } from "os";
554
- import { isAbsolute as isAbsolute5, join as join9 } from "path";
554
+ import { isAbsolute as isAbsolute5, join as join10 } from "path";
555
555
 
556
556
  // src/lib/atomic-file.ts
557
557
  import { randomUUID } from "crypto";
@@ -724,10 +724,15 @@ case "$prim_node" in /*) ;; *) exit 69 ;; esac
724
724
  exec "$prim_node" "$prim_entry" "$@"
725
725
  `;
726
726
 
727
+ // src/lib/preflight-host.ts
728
+ import { execFileSync as execFileSync3 } from "child_process";
729
+ import { readFileSync as readFileSync6 } from "fs";
730
+ import { join as join8 } from "path";
731
+
727
732
  // src/commands/claude-install.ts
728
- import { existsSync as existsSync5, readFileSync as readFileSync6 } from "fs";
733
+ import { existsSync as existsSync5, readFileSync as readFileSync7 } from "fs";
729
734
  import { homedir as homedir3 } from "os";
730
- import { join as join8 } from "path";
735
+ import { join as join9 } from "path";
731
736
  var CAPTURE_BIN = "prim-hook";
732
737
  var GATE_BIN = "prim-pre-tool-use";
733
738
  var POST_TOOL_USE_BIN = "prim-post-tool-use";
@@ -736,7 +741,7 @@ var SESSION_END_BIN = "prim-session-end";
736
741
  var STATUSLINE_BIN = "prim-statusline";
737
742
  var STATUSLINE_ARGS = "";
738
743
  var STATUSLINE_COMMAND = stableHookCommand(STATUSLINE_BIN, STATUSLINE_ARGS);
739
- var USER_SCOPE_PATH = join8(homedir3(), ".claude", "settings.json");
744
+ var USER_SCOPE_PATH = join9(homedir3(), ".claude", "settings.json");
740
745
  function projectRoot() {
741
746
  return gitToplevel() ?? process.cwd();
742
747
  }
@@ -755,7 +760,8 @@ function makeRegistration(event, matcher, bin, args = "") {
755
760
  event,
756
761
  matcher,
757
762
  bin,
758
- command: stableHookCommand(bin, args)
763
+ command: stableHookCommand(bin, args),
764
+ ...bin === GATE_BIN ? { timeout: 300, ...args.includes("--agent codex") ? {} : { onFailure: "block" } } : {}
759
765
  };
760
766
  }
761
767
  function makeDetachedRegistration(event, matcher, bin, args = "") {
@@ -805,7 +811,7 @@ var CURSOR_EVENTS = [
805
811
  ];
806
812
  var REGISTRATIONS2 = [
807
813
  ...CURSOR_EVENTS.map((event) => ({ event, bin: CAPTURE_BIN2 })),
808
- { event: "preToolUse", bin: GATE_BIN2, matcher: "Write|Delete|Shell", timeout: 10 },
814
+ { event: "preToolUse", bin: GATE_BIN2, matcher: "Write|Delete|Shell", timeout: 300 },
809
815
  { event: "postToolUse", bin: POST_TOOL_BIN },
810
816
  { event: "postToolUseFailure", bin: POST_TOOL_BIN },
811
817
  { event: "sessionStart", bin: SESSION_START_BIN2 },
@@ -815,11 +821,11 @@ function cursorConfigDirectory(env = process.env, home = homedir4(), platform =
815
821
  const explicit = env.CURSOR_CONFIG_DIR?.trim();
816
822
  if (explicit && isAbsolute5(explicit)) return explicit;
817
823
  const xdg = env.XDG_CONFIG_HOME?.trim();
818
- if (platform !== "darwin" && xdg && isAbsolute5(xdg)) return join9(xdg, "cursor");
819
- return join9(home, ".cursor");
824
+ if (platform !== "darwin" && xdg && isAbsolute5(xdg)) return join10(xdg, "cursor");
825
+ return join10(home, ".cursor");
820
826
  }
821
827
  function cursorHooksPath(scope, root = projectRoot()) {
822
- return scope === "user" ? join9(cursorConfigDirectory(), "hooks.json") : join9(root, ".cursor", "hooks.json");
828
+ return scope === "user" ? join10(cursorConfigDirectory(), "hooks.json") : join10(root, ".cursor", "hooks.json");
823
829
  }
824
830
  function plainObject(value) {
825
831
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -828,7 +834,7 @@ function readCursorHooks(path) {
828
834
  if (!existsSync6(path)) return {};
829
835
  let parsed;
830
836
  try {
831
- parsed = JSON.parse(readFileSync7(path, "utf8"));
837
+ parsed = JSON.parse(readFileSync8(path, "utf8"));
832
838
  } catch {
833
839
  throw new Error(`invalid Cursor hooks JSON at ${path}`);
834
840
  }
@@ -865,7 +871,8 @@ function hookFor(registration, scope) {
865
871
  return {
866
872
  command: commandFor(registration, scope),
867
873
  ...registration.matcher ? { matcher: registration.matcher } : {},
868
- ...registration.timeout ? { timeout: registration.timeout } : {}
874
+ ...registration.timeout ? { timeout: registration.timeout } : {},
875
+ ...registration.bin === GATE_BIN2 ? { failClosed: true } : {}
869
876
  };
870
877
  }
871
878
  function exactHook(entry, registration, scope) {