@primitive.ai/prim 0.1.0-alpha.71 → 0.1.0-alpha.73

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.
@@ -36637,7 +36637,8 @@ function toRequestBody(request2) {
36637
36637
  reversibility: request2.reversibility,
36638
36638
  files: request2.files,
36639
36639
  protocolVersion: request2.protocolVersion,
36640
- repoSyncId: request2.repoSyncId
36640
+ repoSyncId: request2.repoSyncId,
36641
+ stageOverride: request2.stageOverride
36641
36642
  };
36642
36643
  const body = {};
36643
36644
  for (const [key, value] of Object.entries(candidate)) {
@@ -36680,16 +36681,19 @@ var defaultDependencies2 = {
36680
36681
  var EXPECTED_STAGE = {
36681
36682
  publish: "provisional",
36682
36683
  restore: "draft",
36684
+ ratify: "adopted",
36683
36685
  supersede: "superseded"
36684
36686
  };
36685
36687
  var PATH = {
36686
36688
  publish: "/api/cli/decisions/publish",
36687
36689
  restore: "/api/cli/decisions/restore",
36690
+ ratify: "/api/cli/decisions/ratify",
36688
36691
  supersede: "/api/cli/decisions/supersede"
36689
36692
  };
36690
36693
  var PAST_PARTICIPLE = {
36691
36694
  publish: "published",
36692
36695
  restore: "restored",
36696
+ ratify: "ratified",
36693
36697
  supersede: "superseded"
36694
36698
  };
36695
36699
  var ORG_UNBOUND_MESSAGE = "CLI token is not bound to an organization";
@@ -36740,6 +36744,9 @@ function formatSuccessHuman(operation, request2, response) {
36740
36744
  if (operation === "restore") {
36741
36745
  return `[prim] ${identifier} restored as a private draft.`;
36742
36746
  }
36747
+ if (operation === "ratify") {
36748
+ return `[prim] ${identifier} ratified as ${response.stage}.`;
36749
+ }
36743
36750
  const replacement = safeRequestedIdentifier(
36744
36751
  request2.by,
36745
36752
  "the replacement Decision"
@@ -36886,6 +36893,10 @@ function restoreDecision(id, dependencies = defaultDependencies2) {
36886
36893
  const request2 = { id };
36887
36894
  return executeLifecycle("restore", request2, dependencies);
36888
36895
  }
36896
+ function ratifyDecision(id, dependencies = defaultDependencies2) {
36897
+ const request2 = { id };
36898
+ return executeLifecycle("ratify", request2, dependencies);
36899
+ }
36889
36900
  function supersedeDecision(id, by, dependencies = defaultDependencies2) {
36890
36901
  const request2 = { id, by };
36891
36902
  return executeLifecycle("supersede", request2, dependencies);
@@ -37619,7 +37630,7 @@ function formatShowHuman(result) {
37619
37630
  lines.push(` alternatives: ${d.alternatives.map(terminalSafeLine).join(" | ")}`);
37620
37631
  }
37621
37632
  pushFiles(lines, result.files);
37622
- pushContexts(lines, result.contexts);
37633
+ pushContexts(lines, result.contexts ?? []);
37623
37634
  pushEdges(lines, "dependents", "\u2192", result.dependents);
37624
37635
  pushEdges(lines, "depends on", "\u2190", result.dependsOn);
37625
37636
  if (result.flags.length > 0) {
@@ -37840,6 +37851,9 @@ function registerDecisionsCommands(program3) {
37840
37851
  decisions.command("restore <idOrShortId>").description("Restore an authored abandoned Decision to a private draft").action(async (idOrShortId) => {
37841
37852
  process.exitCode = await restoreDecision(idOrShortId);
37842
37853
  });
37854
+ decisions.command("ratify <idOrShortId>").description("Ratify an authored Decision as adopted").action(async (idOrShortId) => {
37855
+ process.exitCode = await ratifyDecision(idOrShortId);
37856
+ });
37843
37857
  decisions.command("supersede <idOrShortId>").description("Supersede a Decision with a distinct replacement Decision").requiredOption("--by <replacementIdOrShortId>", "Decision that replaces the named Decision").action(async (idOrShortId, opts) => {
37844
37858
  process.exitCode = await supersedeDecision(idOrShortId, opts.by);
37845
37859
  });
@@ -37916,11 +37930,17 @@ function registerDecisionsCommands(program3) {
37916
37930
  "One rejected option, verbatim; repeat the flag for each",
37917
37931
  collectItem,
37918
37932
  []
37919
- ).option("--confidence <level>", "high | medium | low (default high)").option("--reversibility <level>", "high | low (default high)").option(
37933
+ ).option("--confidence <level>", "high | medium | low (default high)").option("--reversibility <level>", "high | low (default high)").option("--draft", "Create a private draft instead of publishing immediately").option("--adopt", "Create an adopted Decision as the authenticated author").option(
37920
37934
  "--files <paths>",
37921
37935
  "Comma-separated exact repo-relative paths this decision governs (repeatable)",
37922
37936
  collectPaths
37923
37937
  ).action(async (opts, command) => {
37938
+ if (opts.draft && opts.adopt) {
37939
+ console.error("[prim] create rejected: --draft and --adopt cannot be used together.");
37940
+ console.log(JSON.stringify({ ok: false, error: "conflicting_stage_override" }, null, 2));
37941
+ process.exitCode = EXIT_USAGE;
37942
+ return;
37943
+ }
37924
37944
  const requestedFiles = opts.files ?? [];
37925
37945
  let explicitScope = {};
37926
37946
  if (requestedFiles.length > 0) {
@@ -37965,6 +37985,7 @@ function registerDecisionsCommands(program3) {
37965
37985
  alternatives: opts.alternatives,
37966
37986
  confidence: opts.confidence,
37967
37987
  reversibility: opts.reversibility,
37988
+ stageOverride: opts.draft ? "draft" : opts.adopt ? "adopted" : void 0,
37968
37989
  ...explicitScope
37969
37990
  };
37970
37991
  try {
package/dist/index.js CHANGED
@@ -14243,7 +14243,8 @@ function toRequestBody(request) {
14243
14243
  reversibility: request.reversibility,
14244
14244
  files: request.files,
14245
14245
  protocolVersion: request.protocolVersion,
14246
- repoSyncId: request.repoSyncId
14246
+ repoSyncId: request.repoSyncId,
14247
+ stageOverride: request.stageOverride
14247
14248
  };
14248
14249
  const body = {};
14249
14250
  for (const [key, value] of Object.entries(candidate)) {
@@ -14286,16 +14287,19 @@ var defaultDependencies2 = {
14286
14287
  var EXPECTED_STAGE = {
14287
14288
  publish: "provisional",
14288
14289
  restore: "draft",
14290
+ ratify: "adopted",
14289
14291
  supersede: "superseded"
14290
14292
  };
14291
14293
  var PATH = {
14292
14294
  publish: "/api/cli/decisions/publish",
14293
14295
  restore: "/api/cli/decisions/restore",
14296
+ ratify: "/api/cli/decisions/ratify",
14294
14297
  supersede: "/api/cli/decisions/supersede"
14295
14298
  };
14296
14299
  var PAST_PARTICIPLE = {
14297
14300
  publish: "published",
14298
14301
  restore: "restored",
14302
+ ratify: "ratified",
14299
14303
  supersede: "superseded"
14300
14304
  };
14301
14305
  var ORG_UNBOUND_MESSAGE = "CLI token is not bound to an organization";
@@ -14346,6 +14350,9 @@ function formatSuccessHuman(operation, request, response) {
14346
14350
  if (operation === "restore") {
14347
14351
  return `[prim] ${identifier} restored as a private draft.`;
14348
14352
  }
14353
+ if (operation === "ratify") {
14354
+ return `[prim] ${identifier} ratified as ${response.stage}.`;
14355
+ }
14349
14356
  const replacement = safeRequestedIdentifier(
14350
14357
  request.by,
14351
14358
  "the replacement Decision"
@@ -14492,6 +14499,10 @@ function restoreDecision(id, dependencies = defaultDependencies2) {
14492
14499
  const request = { id };
14493
14500
  return executeLifecycle("restore", request, dependencies);
14494
14501
  }
14502
+ function ratifyDecision(id, dependencies = defaultDependencies2) {
14503
+ const request = { id };
14504
+ return executeLifecycle("ratify", request, dependencies);
14505
+ }
14495
14506
  function supersedeDecision(id, by, dependencies = defaultDependencies2) {
14496
14507
  const request = { id, by };
14497
14508
  return executeLifecycle("supersede", request, dependencies);
@@ -15225,7 +15236,7 @@ function formatShowHuman(result) {
15225
15236
  lines.push(` alternatives: ${d.alternatives.map(terminalSafeLine).join(" | ")}`);
15226
15237
  }
15227
15238
  pushFiles(lines, result.files);
15228
- pushContexts(lines, result.contexts);
15239
+ pushContexts(lines, result.contexts ?? []);
15229
15240
  pushEdges(lines, "dependents", "\u2192", result.dependents);
15230
15241
  pushEdges(lines, "depends on", "\u2190", result.dependsOn);
15231
15242
  if (result.flags.length > 0) {
@@ -15358,6 +15369,9 @@ function registerDecisionsCommands(program2) {
15358
15369
  decisions.command("restore <idOrShortId>").description("Restore an authored abandoned Decision to a private draft").action(async (idOrShortId) => {
15359
15370
  process.exitCode = await restoreDecision(idOrShortId);
15360
15371
  });
15372
+ decisions.command("ratify <idOrShortId>").description("Ratify an authored Decision as adopted").action(async (idOrShortId) => {
15373
+ process.exitCode = await ratifyDecision(idOrShortId);
15374
+ });
15361
15375
  decisions.command("supersede <idOrShortId>").description("Supersede a Decision with a distinct replacement Decision").requiredOption("--by <replacementIdOrShortId>", "Decision that replaces the named Decision").action(async (idOrShortId, opts) => {
15362
15376
  process.exitCode = await supersedeDecision(idOrShortId, opts.by);
15363
15377
  });
@@ -15434,11 +15448,17 @@ function registerDecisionsCommands(program2) {
15434
15448
  "One rejected option, verbatim; repeat the flag for each",
15435
15449
  collectItem,
15436
15450
  []
15437
- ).option("--confidence <level>", "high | medium | low (default high)").option("--reversibility <level>", "high | low (default high)").option(
15451
+ ).option("--confidence <level>", "high | medium | low (default high)").option("--reversibility <level>", "high | low (default high)").option("--draft", "Create a private draft instead of publishing immediately").option("--adopt", "Create an adopted Decision as the authenticated author").option(
15438
15452
  "--files <paths>",
15439
15453
  "Comma-separated exact repo-relative paths this decision governs (repeatable)",
15440
15454
  collectPaths
15441
15455
  ).action(async (opts, command) => {
15456
+ if (opts.draft && opts.adopt) {
15457
+ console.error("[prim] create rejected: --draft and --adopt cannot be used together.");
15458
+ console.log(JSON.stringify({ ok: false, error: "conflicting_stage_override" }, null, 2));
15459
+ process.exitCode = EXIT_USAGE;
15460
+ return;
15461
+ }
15442
15462
  const requestedFiles = opts.files ?? [];
15443
15463
  let explicitScope = {};
15444
15464
  if (requestedFiles.length > 0) {
@@ -15483,6 +15503,7 @@ function registerDecisionsCommands(program2) {
15483
15503
  alternatives: opts.alternatives,
15484
15504
  confidence: opts.confidence,
15485
15505
  reversibility: opts.reversibility,
15506
+ stageOverride: opts.draft ? "draft" : opts.adopt ? "adopted" : void 0,
15486
15507
  ...explicitScope
15487
15508
  };
15488
15509
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primitive.ai/prim",
3
- "version": "0.1.0-alpha.71",
3
+ "version": "0.1.0-alpha.73",
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",