@basou/cli 0.18.0 → 0.19.0

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/dist/index.js CHANGED
@@ -838,6 +838,9 @@ function registerDecisionCommand(program2) {
838
838
  "Related file path (repeatable). Path is opaque; existence is verified at render time.",
839
839
  collectLinkedFile,
840
840
  []
841
+ ).option(
842
+ "--track",
843
+ "Record as a strategic track (an unfinished direction + why). orientation/handoff keep resurfacing open tracks until you close one with 'basou decision void'."
841
844
  ).option(
842
845
  "--session <session_id>",
843
846
  "Attach to an existing session; otherwise an ad-hoc session is created"
@@ -870,13 +873,22 @@ Input format (a JSON array; one object per decision):
870
873
  "alternatives": ["npm workspaces", "yarn"],
871
874
  "rejected_reason": "npm hoisting caused phantom-dependency bugs",
872
875
  "linked_files": ["pnpm-workspace.yaml"]
876
+ },
877
+ {
878
+ "title": "Form-based admin editing is the next track (only 6/19 sections done)",
879
+ "rationale": "Raw-JSON editing is a stopgap, not the final shape; cover the rest.",
880
+ "kind": "track"
873
881
  }
874
882
  ]
875
883
 
876
- Only "title" is required; every other field is optional. All decisions are
877
- written into one ad-hoc session timestamped now, so orientation surfaces them
878
- as the latest decisions. Run from a workspace-view directory and it resolves to
879
- the planning repo, like 'basou orient' / 'basou refresh' / 'basou note'.
884
+ Only "title" is required; every other field is optional. Set "kind": "track" to
885
+ record a strategic, UNFINISHED direction (+ why): orientation/handoff resurface
886
+ open tracks every session until you close one with 'basou decision void <id>'.
887
+ Absent / "decision" is a point-in-time decision (surfaced only as the latest).
888
+ All decisions are written into one ad-hoc session timestamped now, so
889
+ orientation surfaces them as the latest decisions. Run from a workspace-view
890
+ directory and it resolves to the planning repo, like 'basou orient' /
891
+ 'basou refresh' / 'basou note'.
880
892
 
881
893
  Example (heredoc on stdin):
882
894
  basou decision capture <<'JSON'
@@ -973,7 +985,7 @@ async function doRunDecisionRecord(options, ctx) {
973
985
  workingDirectory: repositoryRoot,
974
986
  invocation: {
975
987
  command: "basou decision record",
976
- args: ["--title", options.title]
988
+ args: options.track === true ? ["--title", options.title, "--track"] : ["--title", options.title]
977
989
  },
978
990
  targetEventBuilders: [
979
991
  (sessionId, eventId) => buildDecisionEvent({
@@ -1254,7 +1266,8 @@ var CAPTURE_ALLOWED_KEYS = /* @__PURE__ */ new Set([
1254
1266
  "rejected_reason",
1255
1267
  "alternatives",
1256
1268
  "linked_events",
1257
- "linked_files"
1269
+ "linked_files",
1270
+ "kind"
1258
1271
  ]);
1259
1272
  function parseCaptureInput(raw) {
1260
1273
  if (raw.trim().length === 0) {
@@ -1283,7 +1296,7 @@ function validateCaptureItem(item, index) {
1283
1296
  for (const key of Object.keys(obj)) {
1284
1297
  if (!CAPTURE_ALLOWED_KEYS.has(key)) {
1285
1298
  throw new Error(
1286
- `decision[${index}]: unknown field '${key}'. Allowed: title, rationale, rejected_reason, alternatives, linked_events, linked_files.`
1299
+ `decision[${index}]: unknown field '${key}'. Allowed: title, rationale, rejected_reason, alternatives, linked_events, linked_files, kind.`
1287
1300
  );
1288
1301
  }
1289
1302
  }
@@ -1291,6 +1304,12 @@ function validateCaptureItem(item, index) {
1291
1304
  throw new Error(`decision[${index}].title must be a non-empty string.`);
1292
1305
  }
1293
1306
  const out = { title: obj.title };
1307
+ if (obj.kind !== void 0) {
1308
+ if (obj.kind !== "decision" && obj.kind !== "track") {
1309
+ throw new Error(`decision[${index}].kind must be "decision" or "track", got '${obj.kind}'.`);
1310
+ }
1311
+ if (obj.kind === "track") out.kind = "track";
1312
+ }
1294
1313
  if (obj.rationale !== void 0) {
1295
1314
  out.rationale = requireNonEmptyString(obj.rationale, index, "rationale");
1296
1315
  }
@@ -1358,6 +1377,7 @@ function toRichFields(decision) {
1358
1377
  if (decision.alternatives !== void 0) out.alternatives = [...decision.alternatives];
1359
1378
  if (decision.linked_events !== void 0) out.linked_events = [...decision.linked_events];
1360
1379
  if (decision.linked_files !== void 0) out.linked_files = [...decision.linked_files];
1380
+ if (decision.kind !== void 0) out.kind = decision.kind;
1361
1381
  return out;
1362
1382
  }
1363
1383
  function buildCaptureLabel(count) {
@@ -1375,6 +1395,7 @@ function captureItemToPayload(item) {
1375
1395
  payload.rejected_reason = item.input.rejected_reason;
1376
1396
  if (item.input.linked_events !== void 0) payload.linked_events = item.input.linked_events;
1377
1397
  if (item.input.linked_files !== void 0) payload.linked_files = item.input.linked_files;
1398
+ if (item.input.kind !== void 0) payload.kind = item.input.kind;
1378
1399
  return payload;
1379
1400
  }
1380
1401
  function printCapturePreview(options, decisions) {
@@ -1386,7 +1407,7 @@ function printCapturePreview(options, decisions) {
1386
1407
  `Would capture ${decisions.length} decision${decisions.length === 1 ? "" : "s"} (dry run; nothing written):`
1387
1408
  );
1388
1409
  for (const decision of decisions) {
1389
- console.log(`- ${decision.title}`);
1410
+ console.log(`- ${decision.title}${decision.kind === "track" ? " [TRACK]" : ""}`);
1390
1411
  }
1391
1412
  }
1392
1413
  function printCaptureResult(options, result) {
@@ -1407,7 +1428,9 @@ function printCaptureResult(options, result) {
1407
1428
  `Captured ${result.items.length} decision${result.items.length === 1 ? "" : "s"} in ad-hoc session ${sid}:`
1408
1429
  );
1409
1430
  for (const item of result.items) {
1410
- console.log(`- ${item.decisionId}: ${item.input.title}`);
1431
+ console.log(
1432
+ `- ${item.decisionId}: ${item.input.title}${item.input.kind === "track" ? " [TRACK]" : ""}`
1433
+ );
1411
1434
  }
1412
1435
  }
1413
1436
  function pickRichFields(options) {
@@ -1423,6 +1446,7 @@ function pickRichFields(options) {
1423
1446
  if (options.linkedFile !== void 0 && options.linkedFile.length > 0) {
1424
1447
  out.linked_files = [...options.linkedFile];
1425
1448
  }
1449
+ if (options.track === true) out.kind = "track";
1426
1450
  return out;
1427
1451
  }
1428
1452
  function buildDecisionEvent(input) {
@@ -1439,7 +1463,8 @@ function buildDecisionEvent(input) {
1439
1463
  ...input.rich.alternatives !== void 0 ? { alternatives: input.rich.alternatives } : {},
1440
1464
  ...input.rich.rejected_reason !== void 0 ? { rejected_reason: input.rich.rejected_reason } : {},
1441
1465
  ...input.rich.linked_events !== void 0 ? { linked_events: input.rich.linked_events } : {},
1442
- ...input.rich.linked_files !== void 0 ? { linked_files: input.rich.linked_files } : {}
1466
+ ...input.rich.linked_files !== void 0 ? { linked_files: input.rich.linked_files } : {},
1467
+ ...input.rich.kind !== void 0 ? { kind: input.rich.kind } : {}
1443
1468
  };
1444
1469
  }
1445
1470
  function buildAdHocLabel(title) {
@@ -1506,15 +1531,19 @@ function printDecisionResult(options, result) {
1506
1531
  }
1507
1532
  if (result.rich.linked_events !== void 0) payload.linked_events = result.rich.linked_events;
1508
1533
  if (result.rich.linked_files !== void 0) payload.linked_files = result.rich.linked_files;
1534
+ if (result.rich.kind !== void 0) payload.kind = result.rich.kind;
1509
1535
  console.log(JSON.stringify(payload));
1510
1536
  return;
1511
1537
  }
1538
+ const trackPrefix = result.rich.kind === "track" ? "track " : "";
1512
1539
  const rationaleSuffix = result.rich.rationale !== void 0 ? ` (rationale: ${result.rich.rationale})` : "";
1513
1540
  if (result.mode === "ad-hoc") {
1514
- console.log(`Recorded ${result.decisionId} in ad-hoc session ${sid}${rationaleSuffix}`);
1541
+ console.log(
1542
+ `Recorded ${trackPrefix}${result.decisionId} in ad-hoc session ${sid}${rationaleSuffix}`
1543
+ );
1515
1544
  } else {
1516
1545
  console.log(
1517
- `Recorded ${result.decisionId} in session ${sid} (${result.sessionStatus})${rationaleSuffix}`
1546
+ `Recorded ${trackPrefix}${result.decisionId} in session ${sid} (${result.sessionStatus})${rationaleSuffix}`
1518
1547
  );
1519
1548
  }
1520
1549
  }