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

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 (3) hide show
  1. package/README.md +4 -3
  2. package/dist/index.js +27 -12
  3. package/package.json +1 -1
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,20 @@ 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 withoutPrim = allow.filter((rule) => !ALL_PRIM_PERMISSION_RULES.has(rule));
476
+ const nextAllow = [...withoutPrim, PRIM_PERMISSION_RULE];
477
+ const unchanged = allow.length === nextAllow.length && allow.every((rule, i) => rule === nextAllow[i]);
478
+ if (unchanged) {
471
479
  return settings;
472
480
  }
473
- return {
474
- ...settings,
475
- permissions: { ...permissions, allow: [...allow, PRIM_PERMISSION_RULE] }
476
- };
481
+ return { ...settings, permissions: { ...permissions, allow: nextAllow } };
477
482
  }
478
483
  function removePrimPermission(settings) {
479
484
  const permissions = settings.permissions;
480
- if (!permissions?.allow?.includes(PRIM_PERMISSION_RULE)) {
485
+ if (!permissions?.allow?.some((rule) => ALL_PRIM_PERMISSION_RULES.has(rule))) {
481
486
  return settings;
482
487
  }
483
- const allow = permissions.allow.filter((rule) => rule !== PRIM_PERMISSION_RULE);
488
+ const allow = permissions.allow.filter((rule) => !ALL_PRIM_PERMISSION_RULES.has(rule));
484
489
  const nextPermissions = {
485
490
  ...permissions,
486
491
  allow: allow.length > 0 ? allow : void 0
@@ -2259,6 +2264,7 @@ function registerSessionCommands(program2) {
2259
2264
  // src/commands/setup.ts
2260
2265
  import { spawnSync } from "child_process";
2261
2266
  var EXIT_INCOMPLETE = 1;
2267
+ var EXIT_USAGE3 = 2;
2262
2268
  function planSetupSteps(opts) {
2263
2269
  const scopeArgs = opts.scope === "user" ? ["--scope", "user"] : [];
2264
2270
  const steps = [
@@ -2285,8 +2291,18 @@ function registerSetupCommand(program2) {
2285
2291
  program2.command("setup").description(
2286
2292
  "Install everything in one shot (auth, session + git hooks, daemon, skill, welcome)"
2287
2293
  ).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";
2294
+ if (opts.agent !== "claude" && opts.agent !== "codex") {
2295
+ process.stderr.write(`[prim] unknown --agent "${opts.agent}" (expected claude or codex)
2296
+ `);
2297
+ process.exit(EXIT_USAGE3);
2298
+ }
2299
+ if (opts.scope !== "project" && opts.scope !== "user") {
2300
+ process.stderr.write(`[prim] unknown --scope "${opts.scope}" (expected project or user)
2301
+ `);
2302
+ process.exit(EXIT_USAGE3);
2303
+ }
2304
+ const agent = opts.agent;
2305
+ const scope = opts.scope;
2290
2306
  const self = process.argv[1];
2291
2307
  const run = (args, capture = false) => {
2292
2308
  const r = spawnSync(process.execPath, [self, ...args], {
@@ -2321,8 +2337,7 @@ function registerSetupCommand(program2) {
2321
2337
  results[step.key] = code === 0 ? "ok" : step.required ? "failed" : "skipped";
2322
2338
  }
2323
2339
  note("welcome");
2324
- run(["welcome"]);
2325
- results.welcome = "ok";
2340
+ results.welcome = run(["welcome"]).code === 0 ? "ok" : "failed";
2326
2341
  const failed = Object.entries(results).filter(([, v]) => v === "failed").map(([k]) => k);
2327
2342
  const trail = Object.entries(results).map(([k, v]) => `${k}:${v}`).join(" \xB7 ");
2328
2343
  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.25",
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",