exponential-cli 1.31.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 +51 -6
- package/dist/index.js +363 -50
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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",
|
|
@@ -1665,20 +1667,32 @@ function transformDecisionListRow(d) {
|
|
|
1665
1667
|
product: d.product ?? null,
|
|
1666
1668
|
project: d.project ?? null,
|
|
1667
1669
|
meeting: d.transcriptionSession ?? null,
|
|
1668
|
-
supersededBy: d.supersededBy ?? null
|
|
1670
|
+
supersededBy: d.supersededBy ?? null,
|
|
1671
|
+
// Pillars (category "pillar") and labels (anything else), oldest first.
|
|
1672
|
+
tags: d.tags ?? []
|
|
1669
1673
|
};
|
|
1670
1674
|
}
|
|
1671
1675
|
function outputDecisionJson(decision, extra = {}) {
|
|
1672
1676
|
console.log(JSON.stringify({ ...transformDecision(decision), ...extra }, null, 2));
|
|
1673
1677
|
}
|
|
1674
|
-
function
|
|
1678
|
+
function decisionTagParts(tags) {
|
|
1679
|
+
const pillars = tags.filter((t) => t.category === "pillar").map((t) => t.name);
|
|
1680
|
+
const labels = tags.filter((t) => t.category !== "pillar").map((t) => t.name);
|
|
1681
|
+
return [
|
|
1682
|
+
pillars.length > 0 ? `Pillars: ${pillars.join(", ")}` : null,
|
|
1683
|
+
labels.length > 0 ? `Labels: ${labels.join(", ")}` : null
|
|
1684
|
+
].filter((part) => part !== null);
|
|
1685
|
+
}
|
|
1686
|
+
function outputDecisionPretty(decision, tags) {
|
|
1675
1687
|
const color = getDecisionStatusColor(decision.status);
|
|
1676
1688
|
const kind = decision.status === "OPEN" ? chalk2.yellow(" [open question]") : "";
|
|
1677
1689
|
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
1690
|
+
const title = decision.title?.trim();
|
|
1678
1691
|
console.log(
|
|
1679
1692
|
`
|
|
1680
|
-
${chalk2.gray(decision.label)} ${chalk2.bold(decision.statement)}${kind}`
|
|
1693
|
+
${chalk2.gray(decision.label)} ${chalk2.bold(title || decision.statement)}${kind}`
|
|
1681
1694
|
);
|
|
1695
|
+
if (title) console.log(` ${decision.statement}`);
|
|
1682
1696
|
console.log(chalk2.gray(` ID: ${decision.id}`));
|
|
1683
1697
|
console.log(` ${chalk2.gray("Status:")} ${chalk2[color](decision.status)}`);
|
|
1684
1698
|
console.log(` ${chalk2.gray("Source:")} ${decision.source}`);
|
|
@@ -1704,6 +1718,12 @@ ${chalk2.gray(decision.label)} ${chalk2.bold(decision.statement)}${kind}`
|
|
|
1704
1718
|
if (decision.owner) {
|
|
1705
1719
|
console.log(` ${chalk2.gray("Owner:")} ${decision.owner.name ?? decision.owner.id}`);
|
|
1706
1720
|
}
|
|
1721
|
+
if (tags) {
|
|
1722
|
+
const pillars = tags.filter((t) => t.category === "pillar").map((t) => t.name);
|
|
1723
|
+
const labels = tags.filter((t) => t.category !== "pillar").map((t) => t.name);
|
|
1724
|
+
console.log(` ${chalk2.gray("Pillars:")} ${pillars.length > 0 ? pillars.join(", ") : chalk2.dim("none")}`);
|
|
1725
|
+
console.log(` ${chalk2.gray("Labels:")} ${labels.length > 0 ? labels.join(", ") : chalk2.dim("none")}`);
|
|
1726
|
+
}
|
|
1707
1727
|
if (decision.deciders && decision.deciders.length > 0) {
|
|
1708
1728
|
const people = decision.deciders.map((d) => d.email ? `${d.name} <${d.email}>` : d.name).join(", ");
|
|
1709
1729
|
console.log(` ${chalk2.gray("Deciders:")} ${people}`);
|
|
@@ -1723,7 +1743,7 @@ ${chalk2.gray(decision.label)} ${chalk2.bold(decision.statement)}${kind}`
|
|
|
1723
1743
|
if (decision.links && decision.links.length > 0) {
|
|
1724
1744
|
console.log(` ${chalk2.gray("Implemented by:")}`);
|
|
1725
1745
|
for (const link of decision.links) {
|
|
1726
|
-
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)";
|
|
1727
1747
|
console.log(chalk2.gray(` ${target} [link ${link.id}]`));
|
|
1728
1748
|
}
|
|
1729
1749
|
}
|
|
@@ -1770,9 +1790,11 @@ Decisions (${decisions.length} total, ${openCount} open question${openCount ===
|
|
|
1770
1790
|
for (const d of decisions) {
|
|
1771
1791
|
const color = getDecisionStatusColor(d.status);
|
|
1772
1792
|
const draft = d.reviewState && d.reviewState !== "CONFIRMED" ? chalk2.yellow(` [${d.reviewState.toLowerCase()}]`) : "";
|
|
1793
|
+
const title = d.title?.trim();
|
|
1773
1794
|
console.log(
|
|
1774
|
-
` ${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}]`)}`
|
|
1775
1796
|
);
|
|
1797
|
+
if (title) console.log(` ${d.statement}`);
|
|
1776
1798
|
console.log(chalk2.gray(` ID: ${d.id}`));
|
|
1777
1799
|
const context = [
|
|
1778
1800
|
d.product ? `Product: ${d.product.name}` : null,
|
|
@@ -1784,6 +1806,10 @@ Decisions (${decisions.length} total, ${openCount} open question${openCount ===
|
|
|
1784
1806
|
if (context.length > 0) {
|
|
1785
1807
|
console.log(chalk2.gray(` ${context.join(" \xB7 ")}`));
|
|
1786
1808
|
}
|
|
1809
|
+
const tagParts = decisionTagParts(d.tags ?? []);
|
|
1810
|
+
if (tagParts.length > 0) {
|
|
1811
|
+
console.log(chalk2.cyan(` ${tagParts.join(" \xB7 ")}`));
|
|
1812
|
+
}
|
|
1787
1813
|
}
|
|
1788
1814
|
console.log();
|
|
1789
1815
|
}
|
|
@@ -4994,6 +5020,118 @@ function createRowsCommand() {
|
|
|
4994
5020
|
// src/commands/decisions.ts
|
|
4995
5021
|
import { Command as Command7 } from "commander";
|
|
4996
5022
|
import chalk7 from "chalk";
|
|
5023
|
+
|
|
5024
|
+
// src/commands/decisionTags.ts
|
|
5025
|
+
var PILLAR_CATEGORY = "pillar";
|
|
5026
|
+
function isPillar(tag) {
|
|
5027
|
+
return tag.category === PILLAR_CATEGORY;
|
|
5028
|
+
}
|
|
5029
|
+
function tagKind(tag) {
|
|
5030
|
+
return isPillar(tag) ? "pillar" : "label";
|
|
5031
|
+
}
|
|
5032
|
+
function kindNoun(kind) {
|
|
5033
|
+
return kind === "pillar" ? "Pillar" : "label";
|
|
5034
|
+
}
|
|
5035
|
+
function matchTag(candidates, ref, kind) {
|
|
5036
|
+
const value = ref.trim();
|
|
5037
|
+
if (value === "") throw new Error(`Empty ${kindNoun(kind)} name.`);
|
|
5038
|
+
const lower = value.toLowerCase();
|
|
5039
|
+
const byId = candidates.filter((t) => t.id === value);
|
|
5040
|
+
const bySlug = byId.length > 0 ? [] : candidates.filter((t) => t.slug.toLowerCase() === lower);
|
|
5041
|
+
const byName = byId.length > 0 || bySlug.length > 0 ? [] : candidates.filter((t) => t.name.trim().toLowerCase() === lower);
|
|
5042
|
+
const found = byId.length > 0 ? byId : bySlug.length > 0 ? bySlug : byName;
|
|
5043
|
+
const ofKind = found.filter((t) => tagKind(t) === kind);
|
|
5044
|
+
if (ofKind.length === 1) return ofKind[0];
|
|
5045
|
+
if (ofKind.length > 1) {
|
|
5046
|
+
const list = ofKind.map((t) => `${t.name} (slug ${t.slug}, id ${t.id})`).join("; ");
|
|
5047
|
+
throw new Error(
|
|
5048
|
+
`"${ref}" matches ${ofKind.length} ${kindNoun(kind)}s: ${list}. Pass the slug or id instead.`
|
|
5049
|
+
);
|
|
5050
|
+
}
|
|
5051
|
+
if (found.length > 0) {
|
|
5052
|
+
const other = kind === "pillar" ? "label" : "Pillar";
|
|
5053
|
+
const flag = kind === "pillar" ? "--label" : "--pillar";
|
|
5054
|
+
throw new Error(`"${ref}" is a ${other}, not a ${kindNoun(kind)}. Use ${flag} for it.`);
|
|
5055
|
+
}
|
|
5056
|
+
const listCmd = kind === "pillar" ? "exponential labels list --category pillar --workspace <slug>" : "exponential labels list --workspace <slug>";
|
|
5057
|
+
throw new Error(
|
|
5058
|
+
`No ${kindNoun(kind)} named "${ref}" in this workspace (matched by name, slug or id). Run \`${listCmd}\` to see them.`
|
|
5059
|
+
);
|
|
5060
|
+
}
|
|
5061
|
+
async function loadWorkspaceTags(client, workspaceId) {
|
|
5062
|
+
const list = await client.labels.list({ workspaceId });
|
|
5063
|
+
return list.allTags.filter((t) => t.workspaceId === null || t.workspaceId === workspaceId);
|
|
5064
|
+
}
|
|
5065
|
+
function isArchived(tag) {
|
|
5066
|
+
return tag.archivedAt !== void 0 && tag.archivedAt !== null;
|
|
5067
|
+
}
|
|
5068
|
+
function resolveTagRefs(candidates, refs, kind) {
|
|
5069
|
+
const live = candidates.filter((t) => !isArchived(t));
|
|
5070
|
+
return refs.map((ref) => {
|
|
5071
|
+
try {
|
|
5072
|
+
return matchTag(live, ref, kind);
|
|
5073
|
+
} catch (liveError) {
|
|
5074
|
+
try {
|
|
5075
|
+
return matchTag(candidates, ref, kind);
|
|
5076
|
+
} catch {
|
|
5077
|
+
throw liveError;
|
|
5078
|
+
}
|
|
5079
|
+
}
|
|
5080
|
+
});
|
|
5081
|
+
}
|
|
5082
|
+
function resolveRemovals(current, workspaceTags, refs, kind) {
|
|
5083
|
+
return refs.map((ref) => {
|
|
5084
|
+
try {
|
|
5085
|
+
return resolveTagRefs(current, [ref], kind)[0];
|
|
5086
|
+
} catch {
|
|
5087
|
+
return resolveTagRefs(workspaceTags, [ref], kind)[0];
|
|
5088
|
+
}
|
|
5089
|
+
});
|
|
5090
|
+
}
|
|
5091
|
+
function hasTagChanges(c) {
|
|
5092
|
+
return Boolean(
|
|
5093
|
+
c.clearPillars || c.clearLabels || c.addPillar?.length || c.removePillar?.length || c.addLabel?.length || c.removeLabel?.length
|
|
5094
|
+
);
|
|
5095
|
+
}
|
|
5096
|
+
function computeTagIds(current, workspaceTags, changes) {
|
|
5097
|
+
const removeIds = /* @__PURE__ */ new Set();
|
|
5098
|
+
for (const t of resolveRemovals(current, workspaceTags, changes.removePillar ?? [], "pillar")) {
|
|
5099
|
+
removeIds.add(t.id);
|
|
5100
|
+
}
|
|
5101
|
+
for (const t of resolveRemovals(current, workspaceTags, changes.removeLabel ?? [], "label")) {
|
|
5102
|
+
removeIds.add(t.id);
|
|
5103
|
+
}
|
|
5104
|
+
const added = [
|
|
5105
|
+
...resolveTagRefs(workspaceTags, changes.addPillar ?? [], "pillar"),
|
|
5106
|
+
...resolveTagRefs(workspaceTags, changes.addLabel ?? [], "label")
|
|
5107
|
+
];
|
|
5108
|
+
const kept = current.filter((t) => {
|
|
5109
|
+
if (changes.clearPillars && isPillar(t)) return false;
|
|
5110
|
+
if (changes.clearLabels && !isPillar(t)) return false;
|
|
5111
|
+
return !removeIds.has(t.id);
|
|
5112
|
+
});
|
|
5113
|
+
const ids = kept.map((t) => t.id);
|
|
5114
|
+
for (const t of added) if (!ids.includes(t.id)) ids.push(t.id);
|
|
5115
|
+
return ids;
|
|
5116
|
+
}
|
|
5117
|
+
async function applyDecisionTagChanges(client, workspaceId, decisionId, changes) {
|
|
5118
|
+
const current = await client.labels.listForEntity({ entityType: "decision", entityId: decisionId });
|
|
5119
|
+
const needsWorkspaceTags = Boolean(
|
|
5120
|
+
changes.addPillar?.length || changes.addLabel?.length || changes.removePillar?.length || changes.removeLabel?.length
|
|
5121
|
+
);
|
|
5122
|
+
const workspaceTags = needsWorkspaceTags ? await loadWorkspaceTags(client, workspaceId) : [];
|
|
5123
|
+
const tagIds = computeTagIds(current, workspaceTags, changes);
|
|
5124
|
+
const unchanged = tagIds.length === current.length && tagIds.every((id, i) => current[i]?.id === id);
|
|
5125
|
+
if (unchanged) return current;
|
|
5126
|
+
const result = await client.labels.setEntityTags({
|
|
5127
|
+
entityType: "decision",
|
|
5128
|
+
entityId: decisionId,
|
|
5129
|
+
tagIds
|
|
5130
|
+
});
|
|
5131
|
+
return result.tags;
|
|
5132
|
+
}
|
|
5133
|
+
|
|
5134
|
+
// src/commands/decisions.ts
|
|
4997
5135
|
var STATUSES = [
|
|
4998
5136
|
"OPEN",
|
|
4999
5137
|
"PROPOSED",
|
|
@@ -5093,6 +5231,24 @@ function parseNullableInt(v) {
|
|
|
5093
5231
|
if (Number.isNaN(n)) throw new Error(`Expected a number, got "${v}".`);
|
|
5094
5232
|
return n;
|
|
5095
5233
|
}
|
|
5234
|
+
function collect4(value, previous) {
|
|
5235
|
+
return [...previous, value];
|
|
5236
|
+
}
|
|
5237
|
+
var PILLAR_REF_HELP = "a Pillar name, slug or id";
|
|
5238
|
+
var LABEL_REF_HELP = "a label name, slug or id";
|
|
5239
|
+
async function resolveListTagIds(client, workspaceId, pillars, labels) {
|
|
5240
|
+
if (pillars.length === 0 && labels.length === 0) return void 0;
|
|
5241
|
+
const tags = await loadWorkspaceTags(client, workspaceId);
|
|
5242
|
+
return [
|
|
5243
|
+
...resolveTagRefs(tags, pillars, "pillar"),
|
|
5244
|
+
...resolveTagRefs(tags, labels, "label")
|
|
5245
|
+
].map((t) => t.id);
|
|
5246
|
+
}
|
|
5247
|
+
function filterRowsByTags(rows, tagIds) {
|
|
5248
|
+
if (!tagIds) return rows;
|
|
5249
|
+
const wanted = new Set(tagIds);
|
|
5250
|
+
return rows.filter((d) => (d.tags ?? []).some((t) => wanted.has(t.id)));
|
|
5251
|
+
}
|
|
5096
5252
|
var DECISION_LABEL = /^D-(\d+)$/i;
|
|
5097
5253
|
function pickDecisionRef(positional, flag) {
|
|
5098
5254
|
if (positional && flag && positional !== flag) {
|
|
@@ -5115,6 +5271,7 @@ async function resolveDecisionRef(client, workspaceId, ref) {
|
|
|
5115
5271
|
return row.id;
|
|
5116
5272
|
}
|
|
5117
5273
|
var BATCH_ITEM_KEYS = /* @__PURE__ */ new Set([
|
|
5274
|
+
"title",
|
|
5118
5275
|
"statement",
|
|
5119
5276
|
"body",
|
|
5120
5277
|
"status",
|
|
@@ -5165,6 +5322,12 @@ function parseBatchFile(raw) {
|
|
|
5165
5322
|
`Decision[${i}] has unknown field(s): ${unknown.join(", ")}. Accepted: ${[...BATCH_ITEM_KEYS].join(", ")}.`
|
|
5166
5323
|
);
|
|
5167
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
|
+
}
|
|
5168
5331
|
if (entry.goalId !== void 0 && typeof entry.goalId !== "number") {
|
|
5169
5332
|
throw new Error(`Decision[${i}].goalId must be a number, not a string.`);
|
|
5170
5333
|
}
|
|
@@ -5191,9 +5354,42 @@ function batchDeciders(value, index) {
|
|
|
5191
5354
|
);
|
|
5192
5355
|
});
|
|
5193
5356
|
}
|
|
5194
|
-
function notLinkedMessage(decision,
|
|
5357
|
+
function notLinkedMessage(decision, target, error) {
|
|
5358
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
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;
|
|
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`;
|
|
5390
|
+
function notTaggedMessage(decision, error) {
|
|
5195
5391
|
const reason = error instanceof Error ? error.message : String(error);
|
|
5196
|
-
return `Logged ${decision.label} (${decision.id}) but could not
|
|
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>`;
|
|
5197
5393
|
}
|
|
5198
5394
|
function addConfirmCommand(parent) {
|
|
5199
5395
|
parent.command("confirm [id]").description(
|
|
@@ -5267,7 +5463,17 @@ function createDecisionsCommand() {
|
|
|
5267
5463
|
"Filter by source (repeatable): MEETING, MANUAL, AGENT",
|
|
5268
5464
|
(value, previous) => [...previous, parseSource(value)],
|
|
5269
5465
|
[]
|
|
5270
|
-
).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)").
|
|
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(
|
|
5467
|
+
"--pillar <ref>",
|
|
5468
|
+
`Only decisions filed under this Pillar (${PILLAR_REF_HELP}; repeatable, matches ANY of --pillar/--label)`,
|
|
5469
|
+
collect4,
|
|
5470
|
+
[]
|
|
5471
|
+
).option(
|
|
5472
|
+
"--label <ref>",
|
|
5473
|
+
`Only decisions carrying this label (${LABEL_REF_HELP}; repeatable, matches ANY of --pillar/--label)`,
|
|
5474
|
+
collect4,
|
|
5475
|
+
[]
|
|
5476
|
+
).action(
|
|
5271
5477
|
async (options, cmd) => {
|
|
5272
5478
|
const globalOpts = cmd.optsWithGlobals();
|
|
5273
5479
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -5280,6 +5486,15 @@ function createDecisionsCommand() {
|
|
|
5280
5486
|
if (options.meeting) {
|
|
5281
5487
|
const result = await client.decisions.listForMeeting(options.meeting);
|
|
5282
5488
|
let rows2 = result.decisions;
|
|
5489
|
+
if (options.pillar.length > 0 || options.label.length > 0) {
|
|
5490
|
+
if (!result.workspaceId) {
|
|
5491
|
+
throw new Error("This meeting has no workspace, so --pillar and --label cannot be resolved.");
|
|
5492
|
+
}
|
|
5493
|
+
rows2 = filterRowsByTags(
|
|
5494
|
+
rows2,
|
|
5495
|
+
await resolveListTagIds(client, result.workspaceId, options.pillar, options.label)
|
|
5496
|
+
);
|
|
5497
|
+
}
|
|
5283
5498
|
if (options.status.length > 0) {
|
|
5284
5499
|
rows2 = rows2.filter((d) => options.status.includes(d.status));
|
|
5285
5500
|
}
|
|
@@ -5306,7 +5521,8 @@ function createDecisionsCommand() {
|
|
|
5306
5521
|
}
|
|
5307
5522
|
const workspaceId = await resolveWorkspaceId(client, occurrence?.workspaceSlug ?? options.workspace);
|
|
5308
5523
|
const limit = parsePositiveInt(options.limit, "--limit");
|
|
5309
|
-
const
|
|
5524
|
+
const tagIds = await resolveListTagIds(client, workspaceId, options.pillar, options.label);
|
|
5525
|
+
const all = options.adr ? filterRowsByTags(await client.decisions.listForAdr(workspaceId, options.adr), tagIds) : await client.decisions.list({
|
|
5310
5526
|
workspaceId,
|
|
5311
5527
|
statuses: options.status.length > 0 ? options.status : void 0,
|
|
5312
5528
|
sources: options.source.length > 0 ? options.source : void 0,
|
|
@@ -5315,6 +5531,7 @@ function createDecisionsCommand() {
|
|
|
5315
5531
|
projectId: options.project,
|
|
5316
5532
|
search: options.search,
|
|
5317
5533
|
number: parsePositiveInt(options.number, "--number"),
|
|
5534
|
+
tagIds,
|
|
5318
5535
|
// With --occurrence the cap applies after filtering, below.
|
|
5319
5536
|
limit: occurrence ? void 0 : limit
|
|
5320
5537
|
});
|
|
@@ -5331,7 +5548,7 @@ function createDecisionsCommand() {
|
|
|
5331
5548
|
}
|
|
5332
5549
|
);
|
|
5333
5550
|
decisions.command("get <id>").description(
|
|
5334
|
-
"Show one decision in full: body, evidence, deciders, chain and
|
|
5551
|
+
"Show one decision in full: body, evidence, deciders, chain, links, Pillars and labels. Takes a D-number (D-0006) or an id."
|
|
5335
5552
|
).option("--workspace <slug|id>", "Workspace (defaults to your default workspace)").action(async (id, options, cmd) => {
|
|
5336
5553
|
const globalOpts = cmd.optsWithGlobals();
|
|
5337
5554
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -5339,9 +5556,12 @@ function createDecisionsCommand() {
|
|
|
5339
5556
|
const client = getClient();
|
|
5340
5557
|
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
5341
5558
|
const decisionId = await resolveDecisionRef(client, workspaceId, id);
|
|
5342
|
-
const decision = await
|
|
5343
|
-
|
|
5344
|
-
|
|
5559
|
+
const [decision, tags] = await Promise.all([
|
|
5560
|
+
client.decisions.get(workspaceId, decisionId),
|
|
5561
|
+
client.labels.listForEntity({ entityType: "decision", entityId: decisionId })
|
|
5562
|
+
]);
|
|
5563
|
+
if (useJson) outputDecisionJson(decision, { tags });
|
|
5564
|
+
else outputDecisionPretty(decision, tags);
|
|
5345
5565
|
} catch (error) {
|
|
5346
5566
|
handleError(error, useJson);
|
|
5347
5567
|
}
|
|
@@ -5353,9 +5573,12 @@ function createDecisionsCommand() {
|
|
|
5353
5573
|
"Bodies are Markdown: use --body-file <path> (or - for stdin) rather than a shell argument.",
|
|
5354
5574
|
"Bulk: --from-file <path|-> takes a JSON array of decisions; the other flags become its defaults."
|
|
5355
5575
|
].join(" ")
|
|
5356
|
-
).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(
|
|
5357
5577
|
"--feature <id>",
|
|
5358
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`
|
|
5359
5582
|
).option("--decided-at <iso>", "When it was decided (e.g. 2026-09-10T14:00)").option("--owner <userId>", "Owner user ID").option(
|
|
5360
5583
|
'--decider <"Name <email>">',
|
|
5361
5584
|
"Someone who made the decision (repeatable); external people need no account",
|
|
@@ -5364,6 +5587,16 @@ function createDecisionsCommand() {
|
|
|
5364
5587
|
).option(
|
|
5365
5588
|
"--evidence-file <path>",
|
|
5366
5589
|
'JSON array of {turnIndex, text} transcript quotes ("-" = stdin). Needs --meeting: the server checks every quote against that transcript and silently drops the ones that do not match.'
|
|
5590
|
+
).option(
|
|
5591
|
+
"--pillar <ref>",
|
|
5592
|
+
`File it under this Pillar (${PILLAR_REF_HELP}; repeatable). Applied right after the create, which takes no tags`,
|
|
5593
|
+
collect4,
|
|
5594
|
+
[]
|
|
5595
|
+
).option(
|
|
5596
|
+
"--label <ref>",
|
|
5597
|
+
`Attach this label (${LABEL_REF_HELP}; repeatable). Applied right after the create`,
|
|
5598
|
+
collect4,
|
|
5599
|
+
[]
|
|
5367
5600
|
).option("--from-file <path>", 'Bulk create from a JSON array of decisions ("-" = stdin)').action(
|
|
5368
5601
|
async (options, cmd) => {
|
|
5369
5602
|
const globalOpts = cmd.optsWithGlobals();
|
|
@@ -5379,6 +5612,11 @@ function createDecisionsCommand() {
|
|
|
5379
5612
|
"--statement and --from-file are alternatives: the file carries the statements."
|
|
5380
5613
|
);
|
|
5381
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);
|
|
5382
5620
|
const client = getClient();
|
|
5383
5621
|
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
5384
5622
|
const productId = options.product ? await resolveProductId(client, workspaceId, options.product) : void 0;
|
|
@@ -5389,6 +5627,21 @@ function createDecisionsCommand() {
|
|
|
5389
5627
|
if (goalId !== void 0 && Number.isNaN(goalId)) {
|
|
5390
5628
|
throw new Error(`--goal must be an integer id, got "${options.goal}".`);
|
|
5391
5629
|
}
|
|
5630
|
+
const createTagIds = await resolveListTagIds(
|
|
5631
|
+
client,
|
|
5632
|
+
workspaceId,
|
|
5633
|
+
options.pillar,
|
|
5634
|
+
options.label
|
|
5635
|
+
);
|
|
5636
|
+
const tagNew = async (decision2) => {
|
|
5637
|
+
if (!createTagIds) return void 0;
|
|
5638
|
+
const result = await client.labels.setEntityTags({
|
|
5639
|
+
entityType: "decision",
|
|
5640
|
+
entityId: decision2.id,
|
|
5641
|
+
tagIds: createTagIds
|
|
5642
|
+
});
|
|
5643
|
+
return result.tags;
|
|
5644
|
+
};
|
|
5392
5645
|
const defaults = {
|
|
5393
5646
|
workspaceId,
|
|
5394
5647
|
status,
|
|
@@ -5419,8 +5672,10 @@ function createDecisionsCommand() {
|
|
|
5419
5672
|
for (const [index, item] of items.entries()) {
|
|
5420
5673
|
const statement = String(item.statement);
|
|
5421
5674
|
try {
|
|
5675
|
+
const itemTitle = typeof item.title === "string" && item.title.trim() !== "" ? item.title.trim() : void 0;
|
|
5422
5676
|
const input = {
|
|
5423
5677
|
...defaults,
|
|
5678
|
+
title: itemTitle,
|
|
5424
5679
|
statement,
|
|
5425
5680
|
body: typeof item.body === "string" ? item.body : void 0,
|
|
5426
5681
|
status: item.status !== void 0 ? parseStatus(String(item.status)) : defaults.status,
|
|
@@ -5442,16 +5697,28 @@ function createDecisionsCommand() {
|
|
|
5442
5697
|
);
|
|
5443
5698
|
}
|
|
5444
5699
|
const decision2 = await client.decisions.create(input);
|
|
5445
|
-
|
|
5700
|
+
try {
|
|
5701
|
+
await tagNew(decision2);
|
|
5702
|
+
} catch (error) {
|
|
5703
|
+
results.push({
|
|
5704
|
+
index,
|
|
5705
|
+
success: false,
|
|
5706
|
+
decision: decision2,
|
|
5707
|
+
statement,
|
|
5708
|
+
error: notTaggedMessage(decision2, error)
|
|
5709
|
+
});
|
|
5710
|
+
continue;
|
|
5711
|
+
}
|
|
5712
|
+
if (linkTarget) {
|
|
5446
5713
|
try {
|
|
5447
|
-
await client
|
|
5714
|
+
await linkNew(client, workspaceId, decision2.id, linkTarget);
|
|
5448
5715
|
} catch (error) {
|
|
5449
5716
|
results.push({
|
|
5450
5717
|
index,
|
|
5451
5718
|
success: false,
|
|
5452
5719
|
decision: decision2,
|
|
5453
5720
|
statement,
|
|
5454
|
-
error: notLinkedMessage(decision2,
|
|
5721
|
+
error: notLinkedMessage(decision2, linkTarget, error)
|
|
5455
5722
|
});
|
|
5456
5723
|
continue;
|
|
5457
5724
|
}
|
|
@@ -5479,31 +5746,42 @@ function createDecisionsCommand() {
|
|
|
5479
5746
|
}
|
|
5480
5747
|
const decision = await client.decisions.create({
|
|
5481
5748
|
...defaults,
|
|
5749
|
+
...title ? { title } : {},
|
|
5482
5750
|
statement: options.statement,
|
|
5483
5751
|
body: readText(options.body, options.bodyFile),
|
|
5484
5752
|
deciders: options.decider.length > 0 ? options.decider : void 0,
|
|
5485
5753
|
evidence: evidenceRaw === void 0 ? void 0 : parseEvidence(evidenceRaw)
|
|
5486
5754
|
});
|
|
5487
|
-
let
|
|
5488
|
-
|
|
5755
|
+
let tags;
|
|
5756
|
+
try {
|
|
5757
|
+
tags = await tagNew(decision);
|
|
5758
|
+
} catch (error) {
|
|
5759
|
+
throw new Error(notTaggedMessage(decision, error));
|
|
5760
|
+
}
|
|
5761
|
+
let link;
|
|
5762
|
+
if (linkTarget) {
|
|
5489
5763
|
try {
|
|
5490
|
-
|
|
5491
|
-
workspaceId,
|
|
5492
|
-
decision.id,
|
|
5493
|
-
options.feature
|
|
5494
|
-
);
|
|
5764
|
+
link = await linkNew(client, workspaceId, decision.id, linkTarget);
|
|
5495
5765
|
} catch (error) {
|
|
5496
|
-
throw new Error(notLinkedMessage(decision,
|
|
5766
|
+
throw new Error(notLinkedMessage(decision, linkTarget, error));
|
|
5497
5767
|
}
|
|
5498
5768
|
}
|
|
5499
|
-
|
|
5500
|
-
|
|
5769
|
+
const warning = titleWarning(title);
|
|
5770
|
+
if (useJson) {
|
|
5771
|
+
outputDecisionJson(decision, {
|
|
5772
|
+
...link && linkTarget?.kind === "feature" ? { featureLink: link } : {},
|
|
5773
|
+
...link && linkTarget?.kind === "scope" ? { scopeLink: link } : {},
|
|
5774
|
+
...tags ? { tags } : {},
|
|
5775
|
+
...warning ? { warnings: [warning] } : {}
|
|
5776
|
+
});
|
|
5777
|
+
} else {
|
|
5501
5778
|
console.log(
|
|
5502
5779
|
`
|
|
5503
5780
|
\u2713 ${decision.status === "OPEN" ? "Open question" : "Decision"} logged`
|
|
5504
5781
|
);
|
|
5505
|
-
outputDecisionPretty(decision);
|
|
5506
|
-
if (
|
|
5782
|
+
outputDecisionPretty(decision, tags);
|
|
5783
|
+
if (link && linkTarget) console.log(chalk7.gray(` Linked to ${linkTarget.kind} ${linkTarget.id}`));
|
|
5784
|
+
if (warning) console.log(chalk7.yellow(` ${warning}`));
|
|
5507
5785
|
}
|
|
5508
5786
|
} catch (error) {
|
|
5509
5787
|
handleError(error, useJson);
|
|
@@ -5512,7 +5790,10 @@ function createDecisionsCommand() {
|
|
|
5512
5790
|
);
|
|
5513
5791
|
decisions.command("update [id]").description(
|
|
5514
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".`
|
|
5515
|
-
).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(
|
|
5516
5797
|
async (idArg, options, cmd) => {
|
|
5517
5798
|
const globalOpts = cmd.optsWithGlobals();
|
|
5518
5799
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -5520,6 +5801,7 @@ function createDecisionsCommand() {
|
|
|
5520
5801
|
const ref = pickDecisionRef(idArg, options.id);
|
|
5521
5802
|
const body = options.body === "null" ? null : readText(options.body, options.bodyFile);
|
|
5522
5803
|
const patch = {
|
|
5804
|
+
title: parseTitle(options.title, true),
|
|
5523
5805
|
statement: options.statement,
|
|
5524
5806
|
body,
|
|
5525
5807
|
decidedAt: options.decidedAt === "null" ? null : parseDate(options.decidedAt),
|
|
@@ -5529,24 +5811,54 @@ function createDecisionsCommand() {
|
|
|
5529
5811
|
keyResultId: parseNullableString(options.keyResult),
|
|
5530
5812
|
adrDocumentId: parseNullableString(options.adr)
|
|
5531
5813
|
};
|
|
5532
|
-
|
|
5814
|
+
const tagChanges = {
|
|
5815
|
+
addPillar: options.addPillar,
|
|
5816
|
+
removePillar: options.removePillar,
|
|
5817
|
+
clearPillars: options.clearPillars,
|
|
5818
|
+
addLabel: options.addLabel,
|
|
5819
|
+
removeLabel: options.removeLabel,
|
|
5820
|
+
clearLabels: options.clearLabels
|
|
5821
|
+
};
|
|
5822
|
+
const changesTags = hasTagChanges(tagChanges);
|
|
5823
|
+
const changesContent = options.product !== void 0 || Object.values(patch).some((v) => v !== void 0);
|
|
5824
|
+
if (!changesContent && !changesTags) {
|
|
5533
5825
|
throw new Error(
|
|
5534
|
-
"Nothing to update. Pass at least one of --statement, --body, --body-file, --decided-at, --owner, --product, --project, --goal, --key-result, --adr."
|
|
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."
|
|
5535
5827
|
);
|
|
5536
5828
|
}
|
|
5537
5829
|
const client = getClient();
|
|
5538
5830
|
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
5539
|
-
const
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5831
|
+
const decisionId = await resolveDecisionRef(client, workspaceId, ref);
|
|
5832
|
+
let decision;
|
|
5833
|
+
if (changesContent) {
|
|
5834
|
+
const productId = options.product === void 0 ? void 0 : options.product === "null" ? null : await resolveProductId(client, workspaceId, options.product);
|
|
5835
|
+
decision = await client.decisions.update({
|
|
5836
|
+
workspaceId,
|
|
5837
|
+
decisionId,
|
|
5838
|
+
...patch,
|
|
5839
|
+
productId
|
|
5840
|
+
});
|
|
5841
|
+
} else {
|
|
5842
|
+
decision = await client.decisions.get(workspaceId, decisionId);
|
|
5843
|
+
}
|
|
5844
|
+
let tags;
|
|
5845
|
+
try {
|
|
5846
|
+
tags = changesTags ? await applyDecisionTagChanges(client, workspaceId, decisionId, tagChanges) : await client.labels.listForEntity({ entityType: "decision", entityId: decisionId });
|
|
5847
|
+
} catch (error) {
|
|
5848
|
+
if (changesContent && changesTags) {
|
|
5849
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
5850
|
+
throw new Error(
|
|
5851
|
+
`Updated ${decision.label}'s content, but its Pillars/labels were not changed: ${reason}`
|
|
5852
|
+
);
|
|
5853
|
+
}
|
|
5854
|
+
throw error;
|
|
5855
|
+
}
|
|
5856
|
+
const warning = titleWarning(patch.title);
|
|
5857
|
+
if (useJson) outputDecisionJson(decision, { tags, ...warning ? { warnings: [warning] } : {} });
|
|
5547
5858
|
else {
|
|
5548
5859
|
console.log("\n\u2713 Decision updated");
|
|
5549
|
-
outputDecisionPretty(decision);
|
|
5860
|
+
outputDecisionPretty(decision, tags);
|
|
5861
|
+
if (warning) console.log(chalk7.yellow(` ${warning}`));
|
|
5550
5862
|
}
|
|
5551
5863
|
} catch (error) {
|
|
5552
5864
|
handleError(error, useJson);
|
|
@@ -5593,23 +5905,24 @@ function createDecisionsCommand() {
|
|
|
5593
5905
|
}
|
|
5594
5906
|
);
|
|
5595
5907
|
decisions.command("link [id]").description(
|
|
5596
|
-
"Record what implements a decision: a ticket or a feature. Takes a D-number (D-0006) or an id. Idempotent."
|
|
5597
|
-
).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(
|
|
5598
5910
|
async (idArg, options, cmd) => {
|
|
5599
5911
|
const globalOpts = cmd.optsWithGlobals();
|
|
5600
5912
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
5601
5913
|
try {
|
|
5602
5914
|
const ref = pickDecisionRef(idArg, options.id);
|
|
5603
|
-
|
|
5604
|
-
|
|
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>.");
|
|
5605
5918
|
}
|
|
5606
|
-
if (
|
|
5607
|
-
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.");
|
|
5608
5921
|
}
|
|
5609
5922
|
const client = getClient();
|
|
5610
5923
|
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
5611
5924
|
const decisionId = await resolveDecisionRef(client, workspaceId, ref);
|
|
5612
|
-
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);
|
|
5613
5926
|
if (useJson) console.log(JSON.stringify(link, null, 2));
|
|
5614
5927
|
else {
|
|
5615
5928
|
console.log(`\u2713 Linked ${chalk7.gray(`(link id ${link.id})`)}`);
|
|
@@ -5623,7 +5936,7 @@ function createDecisionsCommand() {
|
|
|
5623
5936
|
}
|
|
5624
5937
|
);
|
|
5625
5938
|
decisions.command("unlink").description(
|
|
5626
|
-
'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.'
|
|
5627
5940
|
).requiredOption("--link <id>", "DecisionLink CUID").option("--workspace <slug|id>", "Workspace (defaults to your default workspace)").action(async (options, cmd) => {
|
|
5628
5941
|
const globalOpts = cmd.optsWithGlobals();
|
|
5629
5942
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -7100,7 +7413,7 @@ async function resolveLabelIds(client, workspaceId, values) {
|
|
|
7100
7413
|
}
|
|
7101
7414
|
function createLabelsCommand() {
|
|
7102
7415
|
const labels = new Command16("labels").description(
|
|
7103
|
-
|
|
7416
|
+
'Manage labels (orthogonal tags applied to actions, tickets, features, epics and decisions). Pillars are tags with category "pillar": list them with --category pillar.'
|
|
7104
7417
|
);
|
|
7105
7418
|
labels.command("list").description("List labels visible in a workspace").option("--workspace <slug|id>", "Workspace slug or CUID").option(
|
|
7106
7419
|
"--category <category>",
|