exponential-cli 1.32.0 → 1.33.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 +92 -32
- 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
|
@@ -1606,6 +1606,7 @@ function transformDecision(d) {
|
|
|
1606
1606
|
workspaceId: d.workspaceId,
|
|
1607
1607
|
number: d.number,
|
|
1608
1608
|
label: d.label,
|
|
1609
|
+
title: d.title ?? null,
|
|
1609
1610
|
statement: d.statement,
|
|
1610
1611
|
body: d.body,
|
|
1611
1612
|
status: d.status,
|
|
@@ -1647,6 +1648,7 @@ function transformDecisionListRow(d) {
|
|
|
1647
1648
|
workspaceId: d.workspaceId,
|
|
1648
1649
|
number: d.number,
|
|
1649
1650
|
label: d.label,
|
|
1651
|
+
title: d.title ?? null,
|
|
1650
1652
|
statement: d.statement,
|
|
1651
1653
|
status: d.status,
|
|
1652
1654
|
isOpenQuestion: d.status === "OPEN",
|
|
@@ -1685,10 +1687,12 @@ function outputDecisionPretty(decision, tags) {
|
|
|
1685
1687
|
const color = getDecisionStatusColor(decision.status);
|
|
1686
1688
|
const kind = decision.status === "OPEN" ? chalk2.yellow(" [open question]") : "";
|
|
1687
1689
|
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
1690
|
+
const title = decision.title?.trim();
|
|
1688
1691
|
console.log(
|
|
1689
1692
|
`
|
|
1690
|
-
${chalk2.gray(decision.label)} ${chalk2.bold(decision.statement)}${kind}`
|
|
1693
|
+
${chalk2.gray(decision.label)} ${chalk2.bold(title || decision.statement)}${kind}`
|
|
1691
1694
|
);
|
|
1695
|
+
if (title) console.log(` ${decision.statement}`);
|
|
1692
1696
|
console.log(chalk2.gray(` ID: ${decision.id}`));
|
|
1693
1697
|
console.log(` ${chalk2.gray("Status:")} ${chalk2[color](decision.status)}`);
|
|
1694
1698
|
console.log(` ${chalk2.gray("Source:")} ${decision.source}`);
|
|
@@ -1739,7 +1743,7 @@ ${chalk2.gray(decision.label)} ${chalk2.bold(decision.statement)}${kind}`
|
|
|
1739
1743
|
if (decision.links && decision.links.length > 0) {
|
|
1740
1744
|
console.log(` ${chalk2.gray("Implemented by:")}`);
|
|
1741
1745
|
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)";
|
|
1746
|
+
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
1747
|
console.log(chalk2.gray(` ${target} [link ${link.id}]`));
|
|
1744
1748
|
}
|
|
1745
1749
|
}
|
|
@@ -1786,9 +1790,11 @@ Decisions (${decisions.length} total, ${openCount} open question${openCount ===
|
|
|
1786
1790
|
for (const d of decisions) {
|
|
1787
1791
|
const color = getDecisionStatusColor(d.status);
|
|
1788
1792
|
const draft = d.reviewState && d.reviewState !== "CONFIRMED" ? chalk2.yellow(` [${d.reviewState.toLowerCase()}]`) : "";
|
|
1793
|
+
const title = d.title?.trim();
|
|
1789
1794
|
console.log(
|
|
1790
|
-
` ${chalk2.gray(d.label)} ${chalk2.bold(d.statement)}${draft} ${chalk2[color](`[${d.status}]`)}`
|
|
1795
|
+
` ${chalk2.gray(d.label)} ${chalk2.bold(title || d.statement)}${draft} ${chalk2[color](`[${d.status}]`)}`
|
|
1791
1796
|
);
|
|
1797
|
+
if (title) console.log(` ${d.statement}`);
|
|
1792
1798
|
console.log(chalk2.gray(` ID: ${d.id}`));
|
|
1793
1799
|
const context = [
|
|
1794
1800
|
d.product ? `Product: ${d.product.name}` : null,
|
|
@@ -5265,6 +5271,7 @@ async function resolveDecisionRef(client, workspaceId, ref) {
|
|
|
5265
5271
|
return row.id;
|
|
5266
5272
|
}
|
|
5267
5273
|
var BATCH_ITEM_KEYS = /* @__PURE__ */ new Set([
|
|
5274
|
+
"title",
|
|
5268
5275
|
"statement",
|
|
5269
5276
|
"body",
|
|
5270
5277
|
"status",
|
|
@@ -5315,6 +5322,12 @@ function parseBatchFile(raw) {
|
|
|
5315
5322
|
`Decision[${i}] has unknown field(s): ${unknown.join(", ")}. Accepted: ${[...BATCH_ITEM_KEYS].join(", ")}.`
|
|
5316
5323
|
);
|
|
5317
5324
|
}
|
|
5325
|
+
if (entry.title !== void 0 && entry.title !== null && typeof entry.title !== "string") {
|
|
5326
|
+
throw new Error(`Decision[${i}].title must be a string.`);
|
|
5327
|
+
}
|
|
5328
|
+
if (typeof entry.title === "string" && entry.title.trim().length > 120) {
|
|
5329
|
+
throw new Error(`Decision[${i}].title is ${entry.title.trim().length} characters; the limit is 120.`);
|
|
5330
|
+
}
|
|
5318
5331
|
if (entry.goalId !== void 0 && typeof entry.goalId !== "number") {
|
|
5319
5332
|
throw new Error(`Decision[${i}].goalId must be a number, not a string.`);
|
|
5320
5333
|
}
|
|
@@ -5341,10 +5354,39 @@ function batchDeciders(value, index) {
|
|
|
5341
5354
|
);
|
|
5342
5355
|
});
|
|
5343
5356
|
}
|
|
5344
|
-
function notLinkedMessage(decision,
|
|
5357
|
+
function notLinkedMessage(decision, target, error) {
|
|
5345
5358
|
const reason = error instanceof Error ? error.message : String(error);
|
|
5346
|
-
return `Logged ${decision.label} (${decision.id}) but could not link it to
|
|
5359
|
+
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}`;
|
|
5360
|
+
}
|
|
5361
|
+
function createLinkTarget(feature, scope) {
|
|
5362
|
+
if (feature && scope) {
|
|
5363
|
+
throw new Error(
|
|
5364
|
+
"Pass one of --feature or --scope, not both. A scope link already shows the decision on its feature page."
|
|
5365
|
+
);
|
|
5366
|
+
}
|
|
5367
|
+
if (feature) return { kind: "feature", id: feature };
|
|
5368
|
+
if (scope) return { kind: "scope", id: scope };
|
|
5369
|
+
return void 0;
|
|
5370
|
+
}
|
|
5371
|
+
async function linkNew(client, workspaceId, decisionId, target) {
|
|
5372
|
+
return target.kind === "feature" ? await client.decisions.linkFeature(workspaceId, decisionId, target.id) : await client.decisions.linkScope(workspaceId, decisionId, target.id);
|
|
5373
|
+
}
|
|
5374
|
+
var TITLE_MAX_WORDS = 6;
|
|
5375
|
+
function titleWarning(title) {
|
|
5376
|
+
if (!title) return null;
|
|
5377
|
+
const words = title.trim().split(/\s+/).filter(Boolean).length;
|
|
5378
|
+
return words > TITLE_MAX_WORDS ? `Title has ${words} words; ${TITLE_MAX_WORDS} or fewer keeps decision lists easy to scan. Saved anyway.` : null;
|
|
5347
5379
|
}
|
|
5380
|
+
function parseTitle(value, allowNull) {
|
|
5381
|
+
if (value === void 0) return void 0;
|
|
5382
|
+
if (allowNull && value === "null") return null;
|
|
5383
|
+
const trimmed = value.trim();
|
|
5384
|
+
if (trimmed.length > 120) {
|
|
5385
|
+
throw new Error(`--title is ${trimmed.length} characters; the limit is 120. State the outcome in ${TITLE_MAX_WORDS} words or fewer.`);
|
|
5386
|
+
}
|
|
5387
|
+
return trimmed === "" ? allowNull ? null : void 0 : trimmed;
|
|
5388
|
+
}
|
|
5389
|
+
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
5390
|
function notTaggedMessage(decision, error) {
|
|
5349
5391
|
const reason = error instanceof Error ? error.message : String(error);
|
|
5350
5392
|
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 +5463,7 @@ function createDecisionsCommand() {
|
|
|
5421
5463
|
"Filter by source (repeatable): MEETING, MANUAL, AGENT",
|
|
5422
5464
|
(value, previous) => [...previous, parseSource(value)],
|
|
5423
5465
|
[]
|
|
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(
|
|
5466
|
+
).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
5467
|
"--pillar <ref>",
|
|
5426
5468
|
`Only decisions filed under this Pillar (${PILLAR_REF_HELP}; repeatable, matches ANY of --pillar/--label)`,
|
|
5427
5469
|
collect4,
|
|
@@ -5531,9 +5573,12 @@ function createDecisionsCommand() {
|
|
|
5531
5573
|
"Bodies are Markdown: use --body-file <path> (or - for stdin) rather than a shell argument.",
|
|
5532
5574
|
"Bulk: --from-file <path|-> takes a JSON array of decisions; the other flags become its defaults."
|
|
5533
5575
|
].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(
|
|
5576
|
+
).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
5577
|
"--feature <id>",
|
|
5536
5578
|
'Also link it as "implemented by" this feature CUID, so it shows on the feature page'
|
|
5579
|
+
).option(
|
|
5580
|
+
"--scope <id>",
|
|
5581
|
+
`Also link it as "implemented by" this feature scope CUID (V1, V2, ...); it shows on the feature page with the scope's version`
|
|
5537
5582
|
).option("--decided-at <iso>", "When it was decided (e.g. 2026-09-10T14:00)").option("--owner <userId>", "Owner user ID").option(
|
|
5538
5583
|
'--decider <"Name <email>">',
|
|
5539
5584
|
"Someone who made the decision (repeatable); external people need no account",
|
|
@@ -5567,6 +5612,11 @@ function createDecisionsCommand() {
|
|
|
5567
5612
|
"--statement and --from-file are alternatives: the file carries the statements."
|
|
5568
5613
|
);
|
|
5569
5614
|
}
|
|
5615
|
+
const linkTarget = createLinkTarget(options.feature, options.scope);
|
|
5616
|
+
if (options.title !== void 0 && options.fromFile) {
|
|
5617
|
+
throw new Error('--title is per-decision content: put "title" on each entry in --from-file instead.');
|
|
5618
|
+
}
|
|
5619
|
+
const title = parseTitle(options.title, false);
|
|
5570
5620
|
const client = getClient();
|
|
5571
5621
|
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
5572
5622
|
const productId = options.product ? await resolveProductId(client, workspaceId, options.product) : void 0;
|
|
@@ -5622,8 +5672,10 @@ function createDecisionsCommand() {
|
|
|
5622
5672
|
for (const [index, item] of items.entries()) {
|
|
5623
5673
|
const statement = String(item.statement);
|
|
5624
5674
|
try {
|
|
5675
|
+
const itemTitle = typeof item.title === "string" && item.title.trim() !== "" ? item.title.trim() : void 0;
|
|
5625
5676
|
const input = {
|
|
5626
5677
|
...defaults,
|
|
5678
|
+
title: itemTitle,
|
|
5627
5679
|
statement,
|
|
5628
5680
|
body: typeof item.body === "string" ? item.body : void 0,
|
|
5629
5681
|
status: item.status !== void 0 ? parseStatus(String(item.status)) : defaults.status,
|
|
@@ -5657,16 +5709,16 @@ function createDecisionsCommand() {
|
|
|
5657
5709
|
});
|
|
5658
5710
|
continue;
|
|
5659
5711
|
}
|
|
5660
|
-
if (
|
|
5712
|
+
if (linkTarget) {
|
|
5661
5713
|
try {
|
|
5662
|
-
await client
|
|
5714
|
+
await linkNew(client, workspaceId, decision2.id, linkTarget);
|
|
5663
5715
|
} catch (error) {
|
|
5664
5716
|
results.push({
|
|
5665
5717
|
index,
|
|
5666
5718
|
success: false,
|
|
5667
5719
|
decision: decision2,
|
|
5668
5720
|
statement,
|
|
5669
|
-
error: notLinkedMessage(decision2,
|
|
5721
|
+
error: notLinkedMessage(decision2, linkTarget, error)
|
|
5670
5722
|
});
|
|
5671
5723
|
continue;
|
|
5672
5724
|
}
|
|
@@ -5694,6 +5746,7 @@ function createDecisionsCommand() {
|
|
|
5694
5746
|
}
|
|
5695
5747
|
const decision = await client.decisions.create({
|
|
5696
5748
|
...defaults,
|
|
5749
|
+
...title ? { title } : {},
|
|
5697
5750
|
statement: options.statement,
|
|
5698
5751
|
body: readText(options.body, options.bodyFile),
|
|
5699
5752
|
deciders: options.decider.length > 0 ? options.decider : void 0,
|
|
@@ -5705,22 +5758,21 @@ function createDecisionsCommand() {
|
|
|
5705
5758
|
} catch (error) {
|
|
5706
5759
|
throw new Error(notTaggedMessage(decision, error));
|
|
5707
5760
|
}
|
|
5708
|
-
let
|
|
5709
|
-
if (
|
|
5761
|
+
let link;
|
|
5762
|
+
if (linkTarget) {
|
|
5710
5763
|
try {
|
|
5711
|
-
|
|
5712
|
-
workspaceId,
|
|
5713
|
-
decision.id,
|
|
5714
|
-
options.feature
|
|
5715
|
-
);
|
|
5764
|
+
link = await linkNew(client, workspaceId, decision.id, linkTarget);
|
|
5716
5765
|
} catch (error) {
|
|
5717
|
-
throw new Error(notLinkedMessage(decision,
|
|
5766
|
+
throw new Error(notLinkedMessage(decision, linkTarget, error));
|
|
5718
5767
|
}
|
|
5719
5768
|
}
|
|
5769
|
+
const warning = titleWarning(title);
|
|
5720
5770
|
if (useJson) {
|
|
5721
5771
|
outputDecisionJson(decision, {
|
|
5722
|
-
...
|
|
5723
|
-
...
|
|
5772
|
+
...link && linkTarget?.kind === "feature" ? { featureLink: link } : {},
|
|
5773
|
+
...link && linkTarget?.kind === "scope" ? { scopeLink: link } : {},
|
|
5774
|
+
...tags ? { tags } : {},
|
|
5775
|
+
...warning ? { warnings: [warning] } : {}
|
|
5724
5776
|
});
|
|
5725
5777
|
} else {
|
|
5726
5778
|
console.log(
|
|
@@ -5728,7 +5780,8 @@ function createDecisionsCommand() {
|
|
|
5728
5780
|
\u2713 ${decision.status === "OPEN" ? "Open question" : "Decision"} logged`
|
|
5729
5781
|
);
|
|
5730
5782
|
outputDecisionPretty(decision, tags);
|
|
5731
|
-
if (
|
|
5783
|
+
if (link && linkTarget) console.log(chalk7.gray(` Linked to ${linkTarget.kind} ${linkTarget.id}`));
|
|
5784
|
+
if (warning) console.log(chalk7.yellow(` ${warning}`));
|
|
5732
5785
|
}
|
|
5733
5786
|
} catch (error) {
|
|
5734
5787
|
handleError(error, useJson);
|
|
@@ -5737,7 +5790,10 @@ function createDecisionsCommand() {
|
|
|
5737
5790
|
);
|
|
5738
5791
|
decisions.command("update [id]").description(
|
|
5739
5792
|
`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(
|
|
5793
|
+
).option("--id <id>", "Decision id (alternative to the positional <id>)").option("--workspace <slug|id>", "Workspace (defaults to your default workspace)").option(
|
|
5794
|
+
"-t, --title <text>",
|
|
5795
|
+
`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`
|
|
5796
|
+
).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
5797
|
async (idArg, options, cmd) => {
|
|
5742
5798
|
const globalOpts = cmd.optsWithGlobals();
|
|
5743
5799
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -5745,6 +5801,7 @@ function createDecisionsCommand() {
|
|
|
5745
5801
|
const ref = pickDecisionRef(idArg, options.id);
|
|
5746
5802
|
const body = options.body === "null" ? null : readText(options.body, options.bodyFile);
|
|
5747
5803
|
const patch = {
|
|
5804
|
+
title: parseTitle(options.title, true),
|
|
5748
5805
|
statement: options.statement,
|
|
5749
5806
|
body,
|
|
5750
5807
|
decidedAt: options.decidedAt === "null" ? null : parseDate(options.decidedAt),
|
|
@@ -5766,7 +5823,7 @@ function createDecisionsCommand() {
|
|
|
5766
5823
|
const changesContent = options.product !== void 0 || Object.values(patch).some((v) => v !== void 0);
|
|
5767
5824
|
if (!changesContent && !changesTags) {
|
|
5768
5825
|
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."
|
|
5826
|
+
"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
5827
|
);
|
|
5771
5828
|
}
|
|
5772
5829
|
const client = getClient();
|
|
@@ -5796,10 +5853,12 @@ function createDecisionsCommand() {
|
|
|
5796
5853
|
}
|
|
5797
5854
|
throw error;
|
|
5798
5855
|
}
|
|
5799
|
-
|
|
5856
|
+
const warning = titleWarning(patch.title);
|
|
5857
|
+
if (useJson) outputDecisionJson(decision, { tags, ...warning ? { warnings: [warning] } : {} });
|
|
5800
5858
|
else {
|
|
5801
5859
|
console.log("\n\u2713 Decision updated");
|
|
5802
5860
|
outputDecisionPretty(decision, tags);
|
|
5861
|
+
if (warning) console.log(chalk7.yellow(` ${warning}`));
|
|
5803
5862
|
}
|
|
5804
5863
|
} catch (error) {
|
|
5805
5864
|
handleError(error, useJson);
|
|
@@ -5846,23 +5905,24 @@ function createDecisionsCommand() {
|
|
|
5846
5905
|
}
|
|
5847
5906
|
);
|
|
5848
5907
|
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(
|
|
5908
|
+
"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."
|
|
5909
|
+
).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
5910
|
async (idArg, options, cmd) => {
|
|
5852
5911
|
const globalOpts = cmd.optsWithGlobals();
|
|
5853
5912
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
5854
5913
|
try {
|
|
5855
5914
|
const ref = pickDecisionRef(idArg, options.id);
|
|
5856
|
-
|
|
5857
|
-
|
|
5915
|
+
const targets = [options.ticket, options.feature, options.scope].filter(Boolean);
|
|
5916
|
+
if (targets.length === 0) {
|
|
5917
|
+
throw new Error("Pass --ticket <id>, --feature <id> or --scope <id>.");
|
|
5858
5918
|
}
|
|
5859
|
-
if (
|
|
5860
|
-
throw new Error("Pass one of --ticket or --
|
|
5919
|
+
if (targets.length > 1) {
|
|
5920
|
+
throw new Error("Pass one of --ticket, --feature or --scope, not more.");
|
|
5861
5921
|
}
|
|
5862
5922
|
const client = getClient();
|
|
5863
5923
|
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
5864
5924
|
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);
|
|
5925
|
+
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
5926
|
if (useJson) console.log(JSON.stringify(link, null, 2));
|
|
5867
5927
|
else {
|
|
5868
5928
|
console.log(`\u2713 Linked ${chalk7.gray(`(link id ${link.id})`)}`);
|
|
@@ -5876,7 +5936,7 @@ function createDecisionsCommand() {
|
|
|
5876
5936
|
}
|
|
5877
5937
|
);
|
|
5878
5938
|
decisions.command("unlink").description(
|
|
5879
|
-
'Remove one "implemented by" link. Takes the LINK id (shown by "decisions get"), not the ticket or
|
|
5939
|
+
'Remove one "implemented by" link. Takes the LINK id (shown by "decisions get"), not the ticket, feature or scope id.'
|
|
5880
5940
|
).requiredOption("--link <id>", "DecisionLink CUID").option("--workspace <slug|id>", "Workspace (defaults to your default workspace)").action(async (options, cmd) => {
|
|
5881
5941
|
const globalOpts = cmd.optsWithGlobals();
|
|
5882
5942
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|