exponential-cli 1.32.0 → 1.34.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/README.md +17 -5
- package/dist/index.js +117 -33
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -301,7 +301,10 @@ exponential decisions get D-0006
|
|
|
301
301
|
exponential decisions get <cuid>
|
|
302
302
|
|
|
303
303
|
# Log a decision from a meeting. Markdown bodies come from a file or stdin.
|
|
304
|
-
|
|
304
|
+
# --title is the outcome in six words or fewer: the row text in every decision
|
|
305
|
+
# list, with the statement under it. Optional; longer titles warn but save.
|
|
306
|
+
exponential decisions create -t "Importer ships behind a flag" \
|
|
307
|
+
-s "Ship the importer behind a flag" \
|
|
305
308
|
--status ACCEPTED --source AGENT --meeting <meeting-cuid> \
|
|
306
309
|
--body-file ./decision.md \
|
|
307
310
|
--decider "Ada Lovelace <ada@example.com>" --decider "Grace Hopper"
|
|
@@ -323,8 +326,16 @@ jq '.decisions' notes.json | exponential decisions create --from-file - --meetin
|
|
|
323
326
|
exponential decisions status D-0006 --status ACCEPTED
|
|
324
327
|
exponential decisions status D-0006 --status SUPERSEDED --superseded-by <cuid>
|
|
325
328
|
|
|
326
|
-
#
|
|
329
|
+
# Retitle a decision, or clear its title so it reads by its statement again
|
|
330
|
+
exponential decisions update D-0006 --title "Text place beats Dataminr location"
|
|
331
|
+
exponential decisions update D-0006 --title null
|
|
332
|
+
|
|
333
|
+
# Record what implements it (unlink takes the LINK id, from `decisions get`).
|
|
334
|
+
# --scope links one of a feature's scopes (V1, V2, ...): the decision shows on
|
|
335
|
+
# the feature page with the scope's version, and groups under it on a Pillar page.
|
|
327
336
|
exponential decisions link D-0006 --ticket <ticket-cuid>
|
|
337
|
+
exponential decisions link D-0006 --scope <scope-cuid>
|
|
338
|
+
exponential decisions create -s "Geolocate from the text" --scope <scope-cuid>
|
|
328
339
|
exponential decisions unlink --link <link-cuid>
|
|
329
340
|
|
|
330
341
|
# Let the server propose decisions from a meeting, then review them
|
|
@@ -344,6 +355,7 @@ input — `statement` is the only required field:
|
|
|
344
355
|
```json
|
|
345
356
|
[
|
|
346
357
|
{
|
|
358
|
+
"title": "Importer ships behind a flag",
|
|
347
359
|
"statement": "Ship the importer behind a flag",
|
|
348
360
|
"body": "## Context\n...\n## Consequences\n...",
|
|
349
361
|
"status": "ACCEPTED",
|
|
@@ -359,9 +371,9 @@ exit code is non-zero unless every entry landed.
|
|
|
359
371
|
|
|
360
372
|
Scope flags on the command (`--meeting`, `--workspace`, `--product`, `--source`,
|
|
361
373
|
`--status`, `--decided-at`, `--decider`, ...) apply to every entry that doesn't
|
|
362
|
-
set its own. `--body`, `--body-file` and `--evidence-file` are
|
|
363
|
-
content rather than shared scope, so they are refused alongside
|
|
364
|
-
put `body` and `evidence` on the entries. An entry carrying a field this format
|
|
374
|
+
set its own. `--title`, `--body`, `--body-file` and `--evidence-file` are
|
|
375
|
+
per-decision content rather than shared scope, so they are refused alongside
|
|
376
|
+
`--from-file` — put `title`, `body` and `evidence` on the entries. An entry carrying a field this format
|
|
365
377
|
doesn't know (a typo'd `"decider"`, say) is rejected rather than filed without
|
|
366
378
|
it.
|
|
367
379
|
|
package/dist/index.js
CHANGED
|
@@ -1021,6 +1021,9 @@ Added ${succeeded}/${results.length} user stories`));
|
|
|
1021
1021
|
}
|
|
1022
1022
|
console.log();
|
|
1023
1023
|
}
|
|
1024
|
+
function ticketDecisions(ticket) {
|
|
1025
|
+
return ticket.decisions;
|
|
1026
|
+
}
|
|
1024
1027
|
function outputTicketJson(ticket) {
|
|
1025
1028
|
console.log(JSON.stringify(transformTicket(ticket), null, 2));
|
|
1026
1029
|
}
|
|
@@ -1070,6 +1073,19 @@ ${chalk2[getTicketStatusColor(ticket.status)](`[${ticket.status}]`)} ${chalk2.gr
|
|
|
1070
1073
|
console.log(` - ${chalk2.gray(`[${dep.status}]`)} ${depId} ${dep.title}`);
|
|
1071
1074
|
}
|
|
1072
1075
|
}
|
|
1076
|
+
const decisions = ticketDecisions(ticket);
|
|
1077
|
+
if (decisions && decisions.length > 0) {
|
|
1078
|
+
const open = decisions.filter((d) => d.status === "OPEN");
|
|
1079
|
+
const decided = decisions.filter((d) => d.status !== "OPEN");
|
|
1080
|
+
if (open.length > 0) {
|
|
1081
|
+
console.log(` ${chalk2.cyan("Open questions:")}`);
|
|
1082
|
+
for (const d of open) console.log(` - ${d.label} ${d.statement}`);
|
|
1083
|
+
}
|
|
1084
|
+
if (decided.length > 0) {
|
|
1085
|
+
console.log(` ${chalk2.cyan("Decisions:")}`);
|
|
1086
|
+
for (const d of decided) console.log(` - ${chalk2.gray(`[${d.status}]`)} ${d.label} ${d.statement}`);
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1073
1089
|
if (detail.actions && detail.actions.length > 0) {
|
|
1074
1090
|
console.log(` ${chalk2.cyan("Actions:")} ${detail.actions.length}`);
|
|
1075
1091
|
for (const a of detail.actions) {
|
|
@@ -1168,6 +1184,14 @@ function transformTicket(ticket) {
|
|
|
1168
1184
|
counts: ticket._count ?? null,
|
|
1169
1185
|
dependsOn: detail.dependsOn ?? void 0,
|
|
1170
1186
|
requiredFor: detail.requiredFor ?? void 0,
|
|
1187
|
+
decisions: ticketDecisions(ticket)?.map((d) => ({
|
|
1188
|
+
id: d.id,
|
|
1189
|
+
label: d.label,
|
|
1190
|
+
statement: d.statement,
|
|
1191
|
+
status: d.status,
|
|
1192
|
+
decidedAt: d.decidedAt ? new Date(d.decidedAt).toISOString() : null,
|
|
1193
|
+
linkId: d.linkId
|
|
1194
|
+
})),
|
|
1171
1195
|
actions: detail.actions?.map((a) => ({
|
|
1172
1196
|
id: a.id,
|
|
1173
1197
|
name: a.name,
|
|
@@ -1606,6 +1630,7 @@ function transformDecision(d) {
|
|
|
1606
1630
|
workspaceId: d.workspaceId,
|
|
1607
1631
|
number: d.number,
|
|
1608
1632
|
label: d.label,
|
|
1633
|
+
title: d.title ?? null,
|
|
1609
1634
|
statement: d.statement,
|
|
1610
1635
|
body: d.body,
|
|
1611
1636
|
status: d.status,
|
|
@@ -1647,6 +1672,7 @@ function transformDecisionListRow(d) {
|
|
|
1647
1672
|
workspaceId: d.workspaceId,
|
|
1648
1673
|
number: d.number,
|
|
1649
1674
|
label: d.label,
|
|
1675
|
+
title: d.title ?? null,
|
|
1650
1676
|
statement: d.statement,
|
|
1651
1677
|
status: d.status,
|
|
1652
1678
|
isOpenQuestion: d.status === "OPEN",
|
|
@@ -1685,10 +1711,12 @@ function outputDecisionPretty(decision, tags) {
|
|
|
1685
1711
|
const color = getDecisionStatusColor(decision.status);
|
|
1686
1712
|
const kind = decision.status === "OPEN" ? chalk2.yellow(" [open question]") : "";
|
|
1687
1713
|
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
1714
|
+
const title = decision.title?.trim();
|
|
1688
1715
|
console.log(
|
|
1689
1716
|
`
|
|
1690
|
-
${chalk2.gray(decision.label)} ${chalk2.bold(decision.statement)}${kind}`
|
|
1717
|
+
${chalk2.gray(decision.label)} ${chalk2.bold(title || decision.statement)}${kind}`
|
|
1691
1718
|
);
|
|
1719
|
+
if (title) console.log(` ${decision.statement}`);
|
|
1692
1720
|
console.log(chalk2.gray(` ID: ${decision.id}`));
|
|
1693
1721
|
console.log(` ${chalk2.gray("Status:")} ${chalk2[color](decision.status)}`);
|
|
1694
1722
|
console.log(` ${chalk2.gray("Source:")} ${decision.source}`);
|
|
@@ -1739,7 +1767,7 @@ ${chalk2.gray(decision.label)} ${chalk2.bold(decision.statement)}${kind}`
|
|
|
1739
1767
|
if (decision.links && decision.links.length > 0) {
|
|
1740
1768
|
console.log(` ${chalk2.gray("Implemented by:")}`);
|
|
1741
1769
|
for (const link of decision.links) {
|
|
1742
|
-
const target = link.ticket ? `${link.ticket.shortId ?? `#${link.ticket.number}`} ${link.ticket.title}` : link.feature ? `feature: ${link.feature.name}` : "(unknown)";
|
|
1770
|
+
const target = link.ticket ? `${link.ticket.shortId ?? `#${link.ticket.number}`} ${link.ticket.title}` : link.scope ? `scope: ${link.scope.feature ? `${link.scope.feature.name} > ` : ""}${link.scope.version}${link.scope.description ? ` ${link.scope.description}` : ""}` : link.feature ? `feature: ${link.feature.name}` : "(unknown)";
|
|
1743
1771
|
console.log(chalk2.gray(` ${target} [link ${link.id}]`));
|
|
1744
1772
|
}
|
|
1745
1773
|
}
|
|
@@ -1786,9 +1814,11 @@ Decisions (${decisions.length} total, ${openCount} open question${openCount ===
|
|
|
1786
1814
|
for (const d of decisions) {
|
|
1787
1815
|
const color = getDecisionStatusColor(d.status);
|
|
1788
1816
|
const draft = d.reviewState && d.reviewState !== "CONFIRMED" ? chalk2.yellow(` [${d.reviewState.toLowerCase()}]`) : "";
|
|
1817
|
+
const title = d.title?.trim();
|
|
1789
1818
|
console.log(
|
|
1790
|
-
` ${chalk2.gray(d.label)} ${chalk2.bold(d.statement)}${draft} ${chalk2[color](`[${d.status}]`)}`
|
|
1819
|
+
` ${chalk2.gray(d.label)} ${chalk2.bold(title || d.statement)}${draft} ${chalk2[color](`[${d.status}]`)}`
|
|
1791
1820
|
);
|
|
1821
|
+
if (title) console.log(` ${d.statement}`);
|
|
1792
1822
|
console.log(chalk2.gray(` ID: ${d.id}`));
|
|
1793
1823
|
const context = [
|
|
1794
1824
|
d.product ? `Product: ${d.product.name}` : null,
|
|
@@ -5265,6 +5295,7 @@ async function resolveDecisionRef(client, workspaceId, ref) {
|
|
|
5265
5295
|
return row.id;
|
|
5266
5296
|
}
|
|
5267
5297
|
var BATCH_ITEM_KEYS = /* @__PURE__ */ new Set([
|
|
5298
|
+
"title",
|
|
5268
5299
|
"statement",
|
|
5269
5300
|
"body",
|
|
5270
5301
|
"status",
|
|
@@ -5315,6 +5346,12 @@ function parseBatchFile(raw) {
|
|
|
5315
5346
|
`Decision[${i}] has unknown field(s): ${unknown.join(", ")}. Accepted: ${[...BATCH_ITEM_KEYS].join(", ")}.`
|
|
5316
5347
|
);
|
|
5317
5348
|
}
|
|
5349
|
+
if (entry.title !== void 0 && entry.title !== null && typeof entry.title !== "string") {
|
|
5350
|
+
throw new Error(`Decision[${i}].title must be a string.`);
|
|
5351
|
+
}
|
|
5352
|
+
if (typeof entry.title === "string" && entry.title.trim().length > 120) {
|
|
5353
|
+
throw new Error(`Decision[${i}].title is ${entry.title.trim().length} characters; the limit is 120.`);
|
|
5354
|
+
}
|
|
5318
5355
|
if (entry.goalId !== void 0 && typeof entry.goalId !== "number") {
|
|
5319
5356
|
throw new Error(`Decision[${i}].goalId must be a number, not a string.`);
|
|
5320
5357
|
}
|
|
@@ -5341,10 +5378,39 @@ function batchDeciders(value, index) {
|
|
|
5341
5378
|
);
|
|
5342
5379
|
});
|
|
5343
5380
|
}
|
|
5344
|
-
function notLinkedMessage(decision,
|
|
5381
|
+
function notLinkedMessage(decision, target, error) {
|
|
5345
5382
|
const reason = error instanceof Error ? error.message : String(error);
|
|
5346
|
-
return `Logged ${decision.label} (${decision.id}) but could not link it to
|
|
5383
|
+
return `Logged ${decision.label} (${decision.id}) but could not link it to ${target.kind} ${target.id}: ${reason}. Link it with: exponential decisions link ${decision.id} --${target.kind} ${target.id}`;
|
|
5384
|
+
}
|
|
5385
|
+
function createLinkTarget(feature, scope) {
|
|
5386
|
+
if (feature && scope) {
|
|
5387
|
+
throw new Error(
|
|
5388
|
+
"Pass one of --feature or --scope, not both. A scope link already shows the decision on its feature page."
|
|
5389
|
+
);
|
|
5390
|
+
}
|
|
5391
|
+
if (feature) return { kind: "feature", id: feature };
|
|
5392
|
+
if (scope) return { kind: "scope", id: scope };
|
|
5393
|
+
return void 0;
|
|
5394
|
+
}
|
|
5395
|
+
async function linkNew(client, workspaceId, decisionId, target) {
|
|
5396
|
+
return target.kind === "feature" ? await client.decisions.linkFeature(workspaceId, decisionId, target.id) : await client.decisions.linkScope(workspaceId, decisionId, target.id);
|
|
5397
|
+
}
|
|
5398
|
+
var TITLE_MAX_WORDS = 6;
|
|
5399
|
+
function titleWarning(title) {
|
|
5400
|
+
if (!title) return null;
|
|
5401
|
+
const words = title.trim().split(/\s+/).filter(Boolean).length;
|
|
5402
|
+
return words > TITLE_MAX_WORDS ? `Title has ${words} words; ${TITLE_MAX_WORDS} or fewer keeps decision lists easy to scan. Saved anyway.` : null;
|
|
5403
|
+
}
|
|
5404
|
+
function parseTitle(value, allowNull) {
|
|
5405
|
+
if (value === void 0) return void 0;
|
|
5406
|
+
if (allowNull && value === "null") return null;
|
|
5407
|
+
const trimmed = value.trim();
|
|
5408
|
+
if (trimmed.length > 120) {
|
|
5409
|
+
throw new Error(`--title is ${trimmed.length} characters; the limit is 120. State the outcome in ${TITLE_MAX_WORDS} words or fewer.`);
|
|
5410
|
+
}
|
|
5411
|
+
return trimmed === "" ? allowNull ? null : void 0 : trimmed;
|
|
5347
5412
|
}
|
|
5413
|
+
var TITLE_HELP = `The outcome in ${TITLE_MAX_WORDS} words or fewer, e.g. "Text place beats Dataminr location"; shown as the row text in decision lists`;
|
|
5348
5414
|
function notTaggedMessage(decision, error) {
|
|
5349
5415
|
const reason = error instanceof Error ? error.message : String(error);
|
|
5350
5416
|
return `Logged ${decision.label} (${decision.id}) but could not file it under its Pillars/labels: ${reason}. Add them with: exponential decisions update ${decision.id} --add-pillar <ref> --add-label <ref>`;
|
|
@@ -5421,7 +5487,7 @@ function createDecisionsCommand() {
|
|
|
5421
5487
|
"Filter by source (repeatable): MEETING, MANUAL, AGENT",
|
|
5422
5488
|
(value, previous) => [...previous, parseSource(value)],
|
|
5423
5489
|
[]
|
|
5424
|
-
).option("--product <slug|id>", 'Filter by product, or "workspace" for decisions with no product').option("--include-workspace-wide", "With --product: also include decisions that have no product").option("--project <id>", "Filter by project CUID").option("--search <text>", "Free-text over statement and body").option("--number <n>", "One decision by its workspace sequence number (D-0003 is 3)").option("--limit <n>", "Cap the rows returned (1-500)").option("--adr <id>", "Decisions formalised as this ADR document").option("--occurrence <id|url>", "Only decisions logged in this ceremony occurrence (the URL brings its own workspace)").option(
|
|
5490
|
+
).option("--product <slug|id>", 'Filter by product, or "workspace" for decisions with no product').option("--include-workspace-wide", "With --product: also include decisions that have no product").option("--project <id>", "Filter by project CUID").option("--search <text>", "Free-text over title, statement and body").option("--number <n>", "One decision by its workspace sequence number (D-0003 is 3)").option("--limit <n>", "Cap the rows returned (1-500)").option("--adr <id>", "Decisions formalised as this ADR document").option("--occurrence <id|url>", "Only decisions logged in this ceremony occurrence (the URL brings its own workspace)").option(
|
|
5425
5491
|
"--pillar <ref>",
|
|
5426
5492
|
`Only decisions filed under this Pillar (${PILLAR_REF_HELP}; repeatable, matches ANY of --pillar/--label)`,
|
|
5427
5493
|
collect4,
|
|
@@ -5531,9 +5597,12 @@ function createDecisionsCommand() {
|
|
|
5531
5597
|
"Bodies are Markdown: use --body-file <path> (or - for stdin) rather than a shell argument.",
|
|
5532
5598
|
"Bulk: --from-file <path|-> takes a JSON array of decisions; the other flags become its defaults."
|
|
5533
5599
|
].join(" ")
|
|
5534
|
-
).option("-s, --statement <text>", "The decision, or the open question (max 500 chars)").option("-b, --body <markdown>", "Markdown detail: context, alternatives, consequences").option("--body-file <path>", 'Read the body from a file ("-" = stdin)').option("--status <status>", "OPEN (open question), PROPOSED (default) or ACCEPTED").option("--source <source>", "MEETING, MANUAL or AGENT").option("--meeting <id>", "Meeting (transcriptionSessionId) this came out of \u2014 needs edit access to it").option("--workspace <slug|id>", "Workspace (defaults to your default workspace)").option("--product <slug|id>", "Link to a product").option("--project <id>", "Link to a project CUID").option("--goal <id>", "Link to a goal (integer id)").option("--key-result <id>", "Link to a key result CUID").option("--occurrence <id>", "Link to a ceremony occurrence CUID").option(
|
|
5600
|
+
).option("-t, --title <text>", `${TITLE_HELP} (max 120 chars)`).option("-s, --statement <text>", "The decision, or the open question (max 500 chars)").option("-b, --body <markdown>", "Markdown detail: context, alternatives, consequences").option("--body-file <path>", 'Read the body from a file ("-" = stdin)').option("--status <status>", "OPEN (open question), PROPOSED (default) or ACCEPTED").option("--source <source>", "MEETING, MANUAL or AGENT").option("--meeting <id>", "Meeting (transcriptionSessionId) this came out of \u2014 needs edit access to it").option("--workspace <slug|id>", "Workspace (defaults to your default workspace)").option("--product <slug|id>", "Link to a product").option("--project <id>", "Link to a project CUID").option("--goal <id>", "Link to a goal (integer id)").option("--key-result <id>", "Link to a key result CUID").option("--occurrence <id>", "Link to a ceremony occurrence CUID").option(
|
|
5535
5601
|
"--feature <id>",
|
|
5536
5602
|
'Also link it as "implemented by" this feature CUID, so it shows on the feature page'
|
|
5603
|
+
).option(
|
|
5604
|
+
"--scope <id>",
|
|
5605
|
+
`Also link it as "implemented by" this feature scope CUID (V1, V2, ...); it shows on the feature page with the scope's version`
|
|
5537
5606
|
).option("--decided-at <iso>", "When it was decided (e.g. 2026-09-10T14:00)").option("--owner <userId>", "Owner user ID").option(
|
|
5538
5607
|
'--decider <"Name <email>">',
|
|
5539
5608
|
"Someone who made the decision (repeatable); external people need no account",
|
|
@@ -5567,6 +5636,11 @@ function createDecisionsCommand() {
|
|
|
5567
5636
|
"--statement and --from-file are alternatives: the file carries the statements."
|
|
5568
5637
|
);
|
|
5569
5638
|
}
|
|
5639
|
+
const linkTarget = createLinkTarget(options.feature, options.scope);
|
|
5640
|
+
if (options.title !== void 0 && options.fromFile) {
|
|
5641
|
+
throw new Error('--title is per-decision content: put "title" on each entry in --from-file instead.');
|
|
5642
|
+
}
|
|
5643
|
+
const title = parseTitle(options.title, false);
|
|
5570
5644
|
const client = getClient();
|
|
5571
5645
|
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
5572
5646
|
const productId = options.product ? await resolveProductId(client, workspaceId, options.product) : void 0;
|
|
@@ -5622,8 +5696,10 @@ function createDecisionsCommand() {
|
|
|
5622
5696
|
for (const [index, item] of items.entries()) {
|
|
5623
5697
|
const statement = String(item.statement);
|
|
5624
5698
|
try {
|
|
5699
|
+
const itemTitle = typeof item.title === "string" && item.title.trim() !== "" ? item.title.trim() : void 0;
|
|
5625
5700
|
const input = {
|
|
5626
5701
|
...defaults,
|
|
5702
|
+
title: itemTitle,
|
|
5627
5703
|
statement,
|
|
5628
5704
|
body: typeof item.body === "string" ? item.body : void 0,
|
|
5629
5705
|
status: item.status !== void 0 ? parseStatus(String(item.status)) : defaults.status,
|
|
@@ -5657,16 +5733,16 @@ function createDecisionsCommand() {
|
|
|
5657
5733
|
});
|
|
5658
5734
|
continue;
|
|
5659
5735
|
}
|
|
5660
|
-
if (
|
|
5736
|
+
if (linkTarget) {
|
|
5661
5737
|
try {
|
|
5662
|
-
await client
|
|
5738
|
+
await linkNew(client, workspaceId, decision2.id, linkTarget);
|
|
5663
5739
|
} catch (error) {
|
|
5664
5740
|
results.push({
|
|
5665
5741
|
index,
|
|
5666
5742
|
success: false,
|
|
5667
5743
|
decision: decision2,
|
|
5668
5744
|
statement,
|
|
5669
|
-
error: notLinkedMessage(decision2,
|
|
5745
|
+
error: notLinkedMessage(decision2, linkTarget, error)
|
|
5670
5746
|
});
|
|
5671
5747
|
continue;
|
|
5672
5748
|
}
|
|
@@ -5694,6 +5770,7 @@ function createDecisionsCommand() {
|
|
|
5694
5770
|
}
|
|
5695
5771
|
const decision = await client.decisions.create({
|
|
5696
5772
|
...defaults,
|
|
5773
|
+
...title ? { title } : {},
|
|
5697
5774
|
statement: options.statement,
|
|
5698
5775
|
body: readText(options.body, options.bodyFile),
|
|
5699
5776
|
deciders: options.decider.length > 0 ? options.decider : void 0,
|
|
@@ -5705,22 +5782,21 @@ function createDecisionsCommand() {
|
|
|
5705
5782
|
} catch (error) {
|
|
5706
5783
|
throw new Error(notTaggedMessage(decision, error));
|
|
5707
5784
|
}
|
|
5708
|
-
let
|
|
5709
|
-
if (
|
|
5785
|
+
let link;
|
|
5786
|
+
if (linkTarget) {
|
|
5710
5787
|
try {
|
|
5711
|
-
|
|
5712
|
-
workspaceId,
|
|
5713
|
-
decision.id,
|
|
5714
|
-
options.feature
|
|
5715
|
-
);
|
|
5788
|
+
link = await linkNew(client, workspaceId, decision.id, linkTarget);
|
|
5716
5789
|
} catch (error) {
|
|
5717
|
-
throw new Error(notLinkedMessage(decision,
|
|
5790
|
+
throw new Error(notLinkedMessage(decision, linkTarget, error));
|
|
5718
5791
|
}
|
|
5719
5792
|
}
|
|
5793
|
+
const warning = titleWarning(title);
|
|
5720
5794
|
if (useJson) {
|
|
5721
5795
|
outputDecisionJson(decision, {
|
|
5722
|
-
...
|
|
5723
|
-
...
|
|
5796
|
+
...link && linkTarget?.kind === "feature" ? { featureLink: link } : {},
|
|
5797
|
+
...link && linkTarget?.kind === "scope" ? { scopeLink: link } : {},
|
|
5798
|
+
...tags ? { tags } : {},
|
|
5799
|
+
...warning ? { warnings: [warning] } : {}
|
|
5724
5800
|
});
|
|
5725
5801
|
} else {
|
|
5726
5802
|
console.log(
|
|
@@ -5728,7 +5804,8 @@ function createDecisionsCommand() {
|
|
|
5728
5804
|
\u2713 ${decision.status === "OPEN" ? "Open question" : "Decision"} logged`
|
|
5729
5805
|
);
|
|
5730
5806
|
outputDecisionPretty(decision, tags);
|
|
5731
|
-
if (
|
|
5807
|
+
if (link && linkTarget) console.log(chalk7.gray(` Linked to ${linkTarget.kind} ${linkTarget.id}`));
|
|
5808
|
+
if (warning) console.log(chalk7.yellow(` ${warning}`));
|
|
5732
5809
|
}
|
|
5733
5810
|
} catch (error) {
|
|
5734
5811
|
handleError(error, useJson);
|
|
@@ -5737,7 +5814,10 @@ function createDecisionsCommand() {
|
|
|
5737
5814
|
);
|
|
5738
5815
|
decisions.command("update [id]").description(
|
|
5739
5816
|
`Update a decision's content and scope; only the fields you pass are written. Takes a D-number (D-0006) or an id. Status changes go through "decisions status".`
|
|
5740
|
-
).option("--id <id>", "Decision id (alternative to the positional <id>)").option("--workspace <slug|id>", "Workspace (defaults to your default workspace)").option(
|
|
5817
|
+
).option("--id <id>", "Decision id (alternative to the positional <id>)").option("--workspace <slug|id>", "Workspace (defaults to your default workspace)").option(
|
|
5818
|
+
"-t, --title <text>",
|
|
5819
|
+
`New title (or "null" to clear). ${TITLE_HELP}. On a confirmed decision only a person signed in as themselves can change it; agent keys get FORBIDDEN`
|
|
5820
|
+
).option("-s, --statement <text>", "New statement").option("-b, --body <markdown>", 'New Markdown body (or "null" to clear)').option("--body-file <path>", 'Read the new body from a file ("-" = stdin)').option("--decided-at <iso>", 'When it was decided (or "null" to clear)').option("--owner <userId>", 'Owner user ID (or "null" to clear)').option("--product <slug|id>", 'Product (or "null" to detach)').option("--project <id>", 'Project CUID (or "null" to detach)').option("--goal <id>", 'Goal integer id (or "null" to detach)').option("--key-result <id>", 'Key result CUID (or "null" to detach)').option("--adr <id>", 'ADR document CUID (or "null" to detach)').option("--add-pillar <ref>", `File the decision under this Pillar (${PILLAR_REF_HELP}; repeatable)`, collect4, []).option("--remove-pillar <ref>", `Take the decision out of this Pillar (${PILLAR_REF_HELP}; repeatable)`, collect4, []).option("--clear-pillars", "Remove every Pillar (runs before --add-pillar, so the two together replace the Pillars)").option("--add-label <ref>", `Label to attach (${LABEL_REF_HELP}; repeatable)`, collect4, []).option("--remove-label <ref>", `Label to detach (${LABEL_REF_HELP}; repeatable)`, collect4, []).option("--clear-labels", "Remove every label (runs before --add-label, so the two together replace the labels). Pillars are untouched").action(
|
|
5741
5821
|
async (idArg, options, cmd) => {
|
|
5742
5822
|
const globalOpts = cmd.optsWithGlobals();
|
|
5743
5823
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -5745,6 +5825,7 @@ function createDecisionsCommand() {
|
|
|
5745
5825
|
const ref = pickDecisionRef(idArg, options.id);
|
|
5746
5826
|
const body = options.body === "null" ? null : readText(options.body, options.bodyFile);
|
|
5747
5827
|
const patch = {
|
|
5828
|
+
title: parseTitle(options.title, true),
|
|
5748
5829
|
statement: options.statement,
|
|
5749
5830
|
body,
|
|
5750
5831
|
decidedAt: options.decidedAt === "null" ? null : parseDate(options.decidedAt),
|
|
@@ -5766,7 +5847,7 @@ function createDecisionsCommand() {
|
|
|
5766
5847
|
const changesContent = options.product !== void 0 || Object.values(patch).some((v) => v !== void 0);
|
|
5767
5848
|
if (!changesContent && !changesTags) {
|
|
5768
5849
|
throw new Error(
|
|
5769
|
-
"Nothing to update. Pass at least one of --statement, --body, --body-file, --decided-at, --owner, --product, --project, --goal, --key-result, --adr, --add-pillar, --remove-pillar, --clear-pillars, --add-label, --remove-label, --clear-labels."
|
|
5850
|
+
"Nothing to update. Pass at least one of --title, --statement, --body, --body-file, --decided-at, --owner, --product, --project, --goal, --key-result, --adr, --add-pillar, --remove-pillar, --clear-pillars, --add-label, --remove-label, --clear-labels."
|
|
5770
5851
|
);
|
|
5771
5852
|
}
|
|
5772
5853
|
const client = getClient();
|
|
@@ -5796,10 +5877,12 @@ function createDecisionsCommand() {
|
|
|
5796
5877
|
}
|
|
5797
5878
|
throw error;
|
|
5798
5879
|
}
|
|
5799
|
-
|
|
5880
|
+
const warning = titleWarning(patch.title);
|
|
5881
|
+
if (useJson) outputDecisionJson(decision, { tags, ...warning ? { warnings: [warning] } : {} });
|
|
5800
5882
|
else {
|
|
5801
5883
|
console.log("\n\u2713 Decision updated");
|
|
5802
5884
|
outputDecisionPretty(decision, tags);
|
|
5885
|
+
if (warning) console.log(chalk7.yellow(` ${warning}`));
|
|
5803
5886
|
}
|
|
5804
5887
|
} catch (error) {
|
|
5805
5888
|
handleError(error, useJson);
|
|
@@ -5846,23 +5929,24 @@ function createDecisionsCommand() {
|
|
|
5846
5929
|
}
|
|
5847
5930
|
);
|
|
5848
5931
|
decisions.command("link [id]").description(
|
|
5849
|
-
"Record what implements a decision: a ticket or a feature. Takes a D-number (D-0006) or an id. Idempotent."
|
|
5850
|
-
).option("--id <id>", "Decision id (alternative to the positional <id>)").option("--ticket <id>", "Ticket CUID").option("--feature <id>", "Feature CUID").option("--workspace <slug|id>", "Workspace (defaults to your default workspace)").action(
|
|
5932
|
+
"Record what implements a decision: a ticket, a feature, or one of a feature's scopes (V1, V2, ...). Takes a D-number (D-0006) or an id. Idempotent."
|
|
5933
|
+
).option("--id <id>", "Decision id (alternative to the positional <id>)").option("--ticket <id>", "Ticket CUID").option("--feature <id>", "Feature CUID").option("--scope <id>", "Feature scope CUID; the decision also shows on that scope's feature page").option("--workspace <slug|id>", "Workspace (defaults to your default workspace)").action(
|
|
5851
5934
|
async (idArg, options, cmd) => {
|
|
5852
5935
|
const globalOpts = cmd.optsWithGlobals();
|
|
5853
5936
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
5854
5937
|
try {
|
|
5855
5938
|
const ref = pickDecisionRef(idArg, options.id);
|
|
5856
|
-
|
|
5857
|
-
|
|
5939
|
+
const targets = [options.ticket, options.feature, options.scope].filter(Boolean);
|
|
5940
|
+
if (targets.length === 0) {
|
|
5941
|
+
throw new Error("Pass --ticket <id>, --feature <id> or --scope <id>.");
|
|
5858
5942
|
}
|
|
5859
|
-
if (
|
|
5860
|
-
throw new Error("Pass one of --ticket or --
|
|
5943
|
+
if (targets.length > 1) {
|
|
5944
|
+
throw new Error("Pass one of --ticket, --feature or --scope, not more.");
|
|
5861
5945
|
}
|
|
5862
5946
|
const client = getClient();
|
|
5863
5947
|
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
5864
5948
|
const decisionId = await resolveDecisionRef(client, workspaceId, ref);
|
|
5865
|
-
const link = options.ticket ? await client.decisions.linkTicket(workspaceId, decisionId, options.ticket) : await client.decisions.linkFeature(workspaceId, decisionId, options.feature);
|
|
5949
|
+
const link = options.ticket ? await client.decisions.linkTicket(workspaceId, decisionId, options.ticket) : options.feature ? await client.decisions.linkFeature(workspaceId, decisionId, options.feature) : await client.decisions.linkScope(workspaceId, decisionId, options.scope);
|
|
5866
5950
|
if (useJson) console.log(JSON.stringify(link, null, 2));
|
|
5867
5951
|
else {
|
|
5868
5952
|
console.log(`\u2713 Linked ${chalk7.gray(`(link id ${link.id})`)}`);
|
|
@@ -5876,7 +5960,7 @@ function createDecisionsCommand() {
|
|
|
5876
5960
|
}
|
|
5877
5961
|
);
|
|
5878
5962
|
decisions.command("unlink").description(
|
|
5879
|
-
'Remove one "implemented by" link. Takes the LINK id (shown by "decisions get"), not the ticket or
|
|
5963
|
+
'Remove one "implemented by" link. Takes the LINK id (shown by "decisions get"), not the ticket, feature or scope id.'
|
|
5880
5964
|
).requiredOption("--link <id>", "DecisionLink CUID").option("--workspace <slug|id>", "Workspace (defaults to your default workspace)").action(async (options, cmd) => {
|
|
5881
5965
|
const globalOpts = cmd.optsWithGlobals();
|
|
5882
5966
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -9631,7 +9715,7 @@ function createTicketsCommand() {
|
|
|
9631
9715
|
}
|
|
9632
9716
|
}
|
|
9633
9717
|
);
|
|
9634
|
-
tickets.command("get <id>").description("Show a ticket with dependencies, actions, and comments").action(async (id, _options, cmd) => {
|
|
9718
|
+
tickets.command("get <id>").description("Show a ticket with dependencies, decisions, actions, and comments").action(async (id, _options, cmd) => {
|
|
9635
9719
|
const globalOpts = cmd.optsWithGlobals();
|
|
9636
9720
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
9637
9721
|
try {
|