@primitive.ai/prim 0.1.0-alpha.24 → 0.1.0-alpha.26

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 CHANGED
@@ -47,9 +47,10 @@ prim daemon start
47
47
  prim hooks install
48
48
  ```
49
49
 
50
- `prim claude install` also writes a scoped `Bash(npx --yes @primitive.ai/prim@latest:*)`
51
- allow-rule into `.claude/settings.json`, so an agent's prim calls don't stall on a
52
- permission prompt.
50
+ `prim claude install` also writes a scoped `Bash(npx --yes @primitive.ai/prim:*)`
51
+ allow-rule into `.claude/settings.json` (covering both the `@latest` onboarding form
52
+ and the bare day-to-day form), so an agent's prim calls don't stall on a permission
53
+ prompt.
53
54
 
54
55
  An AI coding agent can drive the setup itself — see [`setup.md`](./setup.md).
55
56
 
package/dist/index.js CHANGED
@@ -401,7 +401,12 @@ var REGISTRATIONS = [
401
401
  makeRegistration("SessionStart", "*", SESSION_START_BIN),
402
402
  makeRegistration("SessionEnd", "*", SESSION_END_BIN)
403
403
  ];
404
- var PRIM_PERMISSION_RULE = "Bash(npx --yes @primitive.ai/prim@latest:*)";
404
+ var PRIM_PERMISSION_RULE = "Bash(npx --yes @primitive.ai/prim:*)";
405
+ var LEGACY_PRIM_PERMISSION_RULES = ["Bash(npx --yes @primitive.ai/prim@latest:*)"];
406
+ var ALL_PRIM_PERMISSION_RULES = /* @__PURE__ */ new Set([
407
+ PRIM_PERMISSION_RULE,
408
+ ...LEGACY_PRIM_PERMISSION_RULES
409
+ ]);
405
410
  function settingsPathFor(scope) {
406
411
  return scope === "user" ? USER_SCOPE_PATH : projectScopePath();
407
412
  }
@@ -467,20 +472,23 @@ function applyStatusLine(settings) {
467
472
  function applyPermissions(settings) {
468
473
  const permissions = settings.permissions ?? {};
469
474
  const allow = permissions.allow ?? [];
470
- if (allow.includes(PRIM_PERMISSION_RULE)) {
475
+ const hasCanonical = allow.includes(PRIM_PERMISSION_RULE);
476
+ const hasLegacy = allow.some((rule) => LEGACY_PRIM_PERMISSION_RULES.includes(rule));
477
+ if (hasCanonical && !hasLegacy) {
471
478
  return settings;
472
479
  }
480
+ const withoutPrim = allow.filter((rule) => !ALL_PRIM_PERMISSION_RULES.has(rule));
473
481
  return {
474
482
  ...settings,
475
- permissions: { ...permissions, allow: [...allow, PRIM_PERMISSION_RULE] }
483
+ permissions: { ...permissions, allow: [...withoutPrim, PRIM_PERMISSION_RULE] }
476
484
  };
477
485
  }
478
486
  function removePrimPermission(settings) {
479
487
  const permissions = settings.permissions;
480
- if (!permissions?.allow?.includes(PRIM_PERMISSION_RULE)) {
488
+ if (!permissions?.allow?.some((rule) => ALL_PRIM_PERMISSION_RULES.has(rule))) {
481
489
  return settings;
482
490
  }
483
- const allow = permissions.allow.filter((rule) => rule !== PRIM_PERMISSION_RULE);
491
+ const allow = permissions.allow.filter((rule) => !ALL_PRIM_PERMISSION_RULES.has(rule));
484
492
  const nextPermissions = {
485
493
  ...permissions,
486
494
  allow: allow.length > 0 ? allow : void 0
@@ -2259,6 +2267,7 @@ function registerSessionCommands(program2) {
2259
2267
  // src/commands/setup.ts
2260
2268
  import { spawnSync } from "child_process";
2261
2269
  var EXIT_INCOMPLETE = 1;
2270
+ var EXIT_USAGE3 = 2;
2262
2271
  function planSetupSteps(opts) {
2263
2272
  const scopeArgs = opts.scope === "user" ? ["--scope", "user"] : [];
2264
2273
  const steps = [
@@ -2285,8 +2294,18 @@ function registerSetupCommand(program2) {
2285
2294
  program2.command("setup").description(
2286
2295
  "Install everything in one shot (auth, session + git hooks, daemon, skill, welcome)"
2287
2296
  ).option("--agent <agent>", "claude or codex", "claude").option("--scope <scope>", "project or user (session integration)", "project").option("--no-daemon", "skip starting the companion daemon").action((opts) => {
2288
- const agent = opts.agent === "codex" ? "codex" : "claude";
2289
- const scope = opts.scope === "user" ? "user" : "project";
2297
+ if (opts.agent !== "claude" && opts.agent !== "codex") {
2298
+ process.stderr.write(`[prim] unknown --agent "${opts.agent}" (expected claude or codex)
2299
+ `);
2300
+ process.exit(EXIT_USAGE3);
2301
+ }
2302
+ if (opts.scope !== "project" && opts.scope !== "user") {
2303
+ process.stderr.write(`[prim] unknown --scope "${opts.scope}" (expected project or user)
2304
+ `);
2305
+ process.exit(EXIT_USAGE3);
2306
+ }
2307
+ const agent = opts.agent;
2308
+ const scope = opts.scope;
2290
2309
  const self = process.argv[1];
2291
2310
  const run = (args, capture = false) => {
2292
2311
  const r = spawnSync(process.execPath, [self, ...args], {
@@ -2321,8 +2340,7 @@ function registerSetupCommand(program2) {
2321
2340
  results[step.key] = code === 0 ? "ok" : step.required ? "failed" : "skipped";
2322
2341
  }
2323
2342
  note("welcome");
2324
- run(["welcome"]);
2325
- results.welcome = "ok";
2343
+ results.welcome = run(["welcome"]).code === 0 ? "ok" : "failed";
2326
2344
  const failed = Object.entries(results).filter(([, v]) => v === "failed").map(([k]) => k);
2327
2345
  const trail = Object.entries(results).map(([k, v]) => `${k}:${v}`).join(" \xB7 ");
2328
2346
  note(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primitive.ai/prim",
3
- "version": "0.1.0-alpha.24",
3
+ "version": "0.1.0-alpha.26",
4
4
  "description": "CLI for Primitive's decision graph — passive decision capture, conflict gate, and team presence",
5
5
  "type": "module",
6
6
  "license": "MIT",