@basou/cli 0.42.0 → 0.42.1
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 +25 -7
- package/dist/index.js.map +1 -1
- package/dist/program.js +25 -7
- package/dist/program.js.map +1 -1
- package/package.json +2 -2
package/dist/program.js
CHANGED
|
@@ -1149,6 +1149,15 @@ async function warnLinkedFilesOutsideRoots(input) {
|
|
|
1149
1149
|
} catch {
|
|
1150
1150
|
}
|
|
1151
1151
|
}
|
|
1152
|
+
var TRACK_MARKER_IN_TITLE = /^\s*track\s*[:\uff1a]|[[(\uff08\uff3b\u3010]\s*track\s*[\])\uff09\uff3d\u3011]/i;
|
|
1153
|
+
function warnTrackMarkerWithoutKind(decisions, markerWithoutKind) {
|
|
1154
|
+
for (const index of markerWithoutKind) {
|
|
1155
|
+
const title = (decisions[index]?.title ?? "").trim();
|
|
1156
|
+
console.error(
|
|
1157
|
+
`basou: decision[${index}] title carries a track marker (${title.slice(0, 40)}) but "kind" is absent \u2014 it is recorded as a point-in-time decision and will NOT resurface in orient. Set "kind": "track" to open a track, or "kind": "decision" to say the marker is part of the title.`
|
|
1158
|
+
);
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1152
1161
|
async function doRunDecisionRecord(options, ctx) {
|
|
1153
1162
|
const cwd = ctx.cwd ?? process.cwd();
|
|
1154
1163
|
const repositoryRoot = await resolveRepositoryRootForDecision(cwd);
|
|
@@ -1246,7 +1255,8 @@ async function doRunDecisionCapture(options, ctx) {
|
|
|
1246
1255
|
const paths = basouPaths3(repositoryRoot);
|
|
1247
1256
|
await assertWorkspaceInitialized2(paths.root);
|
|
1248
1257
|
const raw = await readCaptureInput(options, ctx);
|
|
1249
|
-
const decisions = parseCaptureInput(raw);
|
|
1258
|
+
const { decisions, markerWithoutKind } = parseCaptureInput(raw);
|
|
1259
|
+
warnTrackMarkerWithoutKind(decisions, markerWithoutKind);
|
|
1250
1260
|
await warnLinkedFilesOutsideRoots({
|
|
1251
1261
|
linkedFiles: decisions.flatMap((d) => d.linked_files ?? []),
|
|
1252
1262
|
cwd,
|
|
@@ -1507,7 +1517,14 @@ function parseCaptureInput(raw) {
|
|
|
1507
1517
|
if (parsed.length === 0) {
|
|
1508
1518
|
throw new Error("Input array must contain at least one decision.");
|
|
1509
1519
|
}
|
|
1510
|
-
|
|
1520
|
+
const decisions = [];
|
|
1521
|
+
const markerWithoutKind = [];
|
|
1522
|
+
parsed.forEach((item, index) => {
|
|
1523
|
+
const { input, kindWasPresent } = validateCaptureItem(item, index);
|
|
1524
|
+
decisions.push(input);
|
|
1525
|
+
if (!kindWasPresent && TRACK_MARKER_IN_TITLE.test(input.title)) markerWithoutKind.push(index);
|
|
1526
|
+
});
|
|
1527
|
+
return { decisions, markerWithoutKind };
|
|
1511
1528
|
}
|
|
1512
1529
|
function validateCaptureItem(item, index) {
|
|
1513
1530
|
if (typeof item !== "object" || item === null || Array.isArray(item)) {
|
|
@@ -1568,7 +1585,7 @@ function validateCaptureItem(item, index) {
|
|
|
1568
1585
|
}
|
|
1569
1586
|
});
|
|
1570
1587
|
}
|
|
1571
|
-
return out;
|
|
1588
|
+
return { input: out, kindWasPresent: obj.kind !== void 0 };
|
|
1572
1589
|
}
|
|
1573
1590
|
function requireNonEmptyString(value, index, field) {
|
|
1574
1591
|
if (typeof value !== "string" || isBlank(value)) {
|
|
@@ -1619,6 +1636,9 @@ function captureItemToPayload(item) {
|
|
|
1619
1636
|
if (item.input.kind !== void 0) payload.kind = item.input.kind;
|
|
1620
1637
|
return payload;
|
|
1621
1638
|
}
|
|
1639
|
+
function kindMarker(kind) {
|
|
1640
|
+
return kind === "track" ? " [TRACK]" : " [DECISION]";
|
|
1641
|
+
}
|
|
1622
1642
|
function printCapturePreview(options, decisions) {
|
|
1623
1643
|
if (options.json === true) {
|
|
1624
1644
|
console.log(JSON.stringify({ dry_run: true, count: decisions.length, decisions }));
|
|
@@ -1628,7 +1648,7 @@ function printCapturePreview(options, decisions) {
|
|
|
1628
1648
|
`Would capture ${decisions.length} decision${decisions.length === 1 ? "" : "s"} (dry run; nothing written):`
|
|
1629
1649
|
);
|
|
1630
1650
|
for (const decision of decisions) {
|
|
1631
|
-
console.log(`- ${decision.title}${decision.kind
|
|
1651
|
+
console.log(`- ${decision.title}${kindMarker(decision.kind)}`);
|
|
1632
1652
|
}
|
|
1633
1653
|
}
|
|
1634
1654
|
function printCaptureResult(options, result) {
|
|
@@ -1649,9 +1669,7 @@ function printCaptureResult(options, result) {
|
|
|
1649
1669
|
`Captured ${result.items.length} decision${result.items.length === 1 ? "" : "s"} in ad-hoc session ${sid}:`
|
|
1650
1670
|
);
|
|
1651
1671
|
for (const item of result.items) {
|
|
1652
|
-
console.log(
|
|
1653
|
-
`- ${item.decisionId}: ${item.input.title}${item.input.kind === "track" ? " [TRACK]" : ""}`
|
|
1654
|
-
);
|
|
1672
|
+
console.log(`- ${item.decisionId}: ${item.input.title}${kindMarker(item.input.kind)}`);
|
|
1655
1673
|
}
|
|
1656
1674
|
}
|
|
1657
1675
|
function pickRichFields(options) {
|