exponential-cli 1.21.0 → 1.22.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 +18 -7
- package/dist/index.js +177 -64
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -224,7 +224,9 @@ exponential decisions list --workspace clear --number 3 --limit 20 # D-0003; c
|
|
|
224
224
|
# Everything logged from one meeting — both panels (drafts too, if you can edit it)
|
|
225
225
|
exponential decisions list --meeting <meeting-cuid>
|
|
226
226
|
|
|
227
|
-
# One decision in full: body, evidence, deciders, chain and links
|
|
227
|
+
# One decision in full: body, evidence, deciders, chain and links.
|
|
228
|
+
# Anything that takes a decision accepts its D-number or its id.
|
|
229
|
+
exponential decisions get D-0006
|
|
228
230
|
exponential decisions get <cuid>
|
|
229
231
|
|
|
230
232
|
# Log a decision from a meeting. Markdown bodies come from a file or stdin.
|
|
@@ -237,23 +239,32 @@ exponential decisions create -s "Ship the importer behind a flag" \
|
|
|
237
239
|
exponential decisions create -s "Do we backfill historical rows?" \
|
|
238
240
|
--status OPEN --meeting <meeting-cuid>
|
|
239
241
|
|
|
242
|
+
# Log an open question on a feature: created and linked in one call
|
|
243
|
+
exponential decisions create -s "Which store backs the cache?" \
|
|
244
|
+
--status OPEN --feature <feature-cuid> --body-file ./options.md --json
|
|
245
|
+
|
|
240
246
|
# Bulk: a JSON array of decisions in one call — the flags become its defaults.
|
|
241
247
|
# This is the path for filing everything that came out of one meeting.
|
|
242
248
|
exponential decisions create --from-file ./decisions.json --meeting <meeting-cuid> --source AGENT
|
|
243
249
|
jq '.decisions' notes.json | exponential decisions create --from-file - --meeting <meeting-cuid>
|
|
244
250
|
|
|
245
|
-
# Answer an open question; supersede or deprecate a decision
|
|
246
|
-
exponential decisions status
|
|
247
|
-
exponential decisions status
|
|
251
|
+
# Answer an open question; supersede or deprecate a decision (`set-status` is an alias)
|
|
252
|
+
exponential decisions status D-0006 --status ACCEPTED
|
|
253
|
+
exponential decisions status D-0006 --status SUPERSEDED --superseded-by <cuid>
|
|
248
254
|
|
|
249
255
|
# Record what implements it (unlink takes the LINK id, from `decisions get`)
|
|
250
|
-
exponential decisions link
|
|
256
|
+
exponential decisions link D-0006 --ticket <ticket-cuid>
|
|
251
257
|
exponential decisions unlink --link <link-cuid>
|
|
252
258
|
|
|
253
259
|
# Let the server propose decisions from a meeting, then review them
|
|
254
260
|
exponential decisions draft extract --meeting <meeting-cuid>
|
|
255
|
-
exponential decisions draft confirm
|
|
256
|
-
exponential decisions draft reject
|
|
261
|
+
exponential decisions draft confirm <cuid>
|
|
262
|
+
exponential decisions draft reject <cuid>
|
|
263
|
+
|
|
264
|
+
# Confirm a draft and accept it in one command, as the signed-in person.
|
|
265
|
+
# Agent keys can't confirm. Works on already-confirmed decisions too.
|
|
266
|
+
# A draft's D-number can't be looked up until it's confirmed, so pass its id.
|
|
267
|
+
exponential decisions confirm <cuid> --status ACCEPTED
|
|
257
268
|
```
|
|
258
269
|
|
|
259
270
|
`--from-file` takes a JSON array (or `{"decisions": [...]}`), each entry a create
|
package/dist/index.js
CHANGED
|
@@ -1658,8 +1658,8 @@ function transformDecisionListRow(d) {
|
|
|
1658
1658
|
supersededBy: d.supersededBy ?? null
|
|
1659
1659
|
};
|
|
1660
1660
|
}
|
|
1661
|
-
function outputDecisionJson(decision) {
|
|
1662
|
-
console.log(JSON.stringify(transformDecision(decision), null, 2));
|
|
1661
|
+
function outputDecisionJson(decision, extra = {}) {
|
|
1662
|
+
console.log(JSON.stringify({ ...transformDecision(decision), ...extra }, null, 2));
|
|
1663
1663
|
}
|
|
1664
1664
|
function outputDecisionPretty(decision) {
|
|
1665
1665
|
const color = getDecisionStatusColor(decision.status);
|
|
@@ -3232,6 +3232,27 @@ function parseNullableInt(v) {
|
|
|
3232
3232
|
if (Number.isNaN(n)) throw new Error(`Expected a number, got "${v}".`);
|
|
3233
3233
|
return n;
|
|
3234
3234
|
}
|
|
3235
|
+
var DECISION_LABEL = /^D-(\d+)$/i;
|
|
3236
|
+
function pickDecisionRef(positional, flag) {
|
|
3237
|
+
if (positional && flag && positional !== flag) {
|
|
3238
|
+
throw new Error(`Got two decisions ("${positional}" and --id "${flag}"). Pass one.`);
|
|
3239
|
+
}
|
|
3240
|
+
const ref = positional ?? flag;
|
|
3241
|
+
if (!ref) throw new Error("Pass the decision: a D-number like D-0006, or its id.");
|
|
3242
|
+
return ref;
|
|
3243
|
+
}
|
|
3244
|
+
async function resolveDecisionRef(client, workspaceId, ref) {
|
|
3245
|
+
const match = DECISION_LABEL.exec(ref.trim());
|
|
3246
|
+
if (!match) return ref;
|
|
3247
|
+
const number = Number.parseInt(match[1], 10);
|
|
3248
|
+
const [row] = await client.decisions.list({ workspaceId, number, limit: 1 });
|
|
3249
|
+
if (!row) {
|
|
3250
|
+
throw new Error(
|
|
3251
|
+
`${ref} is not in this workspace's decision log. Drafts are not listed until someone confirms them, so pass a draft's id instead (the "id" field from "decisions create --json").`
|
|
3252
|
+
);
|
|
3253
|
+
}
|
|
3254
|
+
return row.id;
|
|
3255
|
+
}
|
|
3235
3256
|
var BATCH_ITEM_KEYS = /* @__PURE__ */ new Set([
|
|
3236
3257
|
"statement",
|
|
3237
3258
|
"body",
|
|
@@ -3309,6 +3330,55 @@ function batchDeciders(value, index) {
|
|
|
3309
3330
|
);
|
|
3310
3331
|
});
|
|
3311
3332
|
}
|
|
3333
|
+
function notLinkedMessage(decision, featureId, error) {
|
|
3334
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
3335
|
+
return `Logged ${decision.label} (${decision.id}) but could not link it to feature ${featureId}: ${reason}. Link it with: exponential decisions link ${decision.id} --feature ${featureId}`;
|
|
3336
|
+
}
|
|
3337
|
+
function addConfirmCommand(parent) {
|
|
3338
|
+
parent.command("confirm [id]").description(
|
|
3339
|
+
"Publish a draft decision into the log, as the signed-in person. Takes a D-number (D-0006) or an id. --status ACCEPTED also accepts it. Agents cannot confirm: this needs a person's login."
|
|
3340
|
+
).option("--id <id>", "Decision id (alternative to the positional <id>)").option("--status <status>", "Then set this status: OPEN, PROPOSED, ACCEPTED or DEPRECATED").option("--workspace <slug|id>", "Workspace (defaults to your default workspace)").action(
|
|
3341
|
+
async (idArg, options, cmd) => {
|
|
3342
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3343
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3344
|
+
try {
|
|
3345
|
+
const ref = pickDecisionRef(idArg, options.id);
|
|
3346
|
+
const status = options.status ? parseStatus(options.status) : void 0;
|
|
3347
|
+
if (status === "SUPERSEDED") {
|
|
3348
|
+
throw new Error(
|
|
3349
|
+
'SUPERSEDED needs the decision that replaced this one. Confirm first, then run "decisions status <id> --status SUPERSEDED --superseded-by <id>".'
|
|
3350
|
+
);
|
|
3351
|
+
}
|
|
3352
|
+
const client = getClient();
|
|
3353
|
+
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
3354
|
+
const decisionId = await resolveDecisionRef(client, workspaceId, ref);
|
|
3355
|
+
let decision = await client.decisions.confirmDraft(workspaceId, decisionId);
|
|
3356
|
+
if (status && decision.status !== status) {
|
|
3357
|
+
try {
|
|
3358
|
+
decision = await client.decisions.setStatus({
|
|
3359
|
+
workspaceId,
|
|
3360
|
+
decisionId: decision.id,
|
|
3361
|
+
status
|
|
3362
|
+
});
|
|
3363
|
+
} catch (error) {
|
|
3364
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
3365
|
+
throw new Error(
|
|
3366
|
+
`Confirmed ${decision.label}, but it is still ${decision.status}: setting ${status} failed (${reason}). Retry with: exponential decisions status ${decision.id} --status ${status}`
|
|
3367
|
+
);
|
|
3368
|
+
}
|
|
3369
|
+
}
|
|
3370
|
+
if (useJson) outputDecisionJson(decision);
|
|
3371
|
+
else {
|
|
3372
|
+
console.log(`
|
|
3373
|
+
\u2713 Confirmed${status ? ` as ${decision.status}` : ""}`);
|
|
3374
|
+
outputDecisionPretty(decision);
|
|
3375
|
+
}
|
|
3376
|
+
} catch (error) {
|
|
3377
|
+
handleError(error, useJson);
|
|
3378
|
+
}
|
|
3379
|
+
}
|
|
3380
|
+
);
|
|
3381
|
+
}
|
|
3312
3382
|
function createDecisionsCommand() {
|
|
3313
3383
|
const decisions = new Command4("decisions").description(
|
|
3314
3384
|
[
|
|
@@ -3317,7 +3387,8 @@ function createDecisionsCommand() {
|
|
|
3317
3387
|
OPEN_QUESTION_NOTE,
|
|
3318
3388
|
"",
|
|
3319
3389
|
"Statuses: OPEN (an open question) \xB7 PROPOSED \xB7 ACCEPTED \xB7 SUPERSEDED \xB7 DEPRECATED.",
|
|
3320
|
-
'SUPERSEDED and DEPRECATED are reached with "decisions status", never at creation.'
|
|
3390
|
+
'SUPERSEDED and DEPRECATED are reached with "decisions status", never at creation.',
|
|
3391
|
+
"Commands that take a decision accept its D-number (D-0006) or its id."
|
|
3321
3392
|
].join("\n")
|
|
3322
3393
|
);
|
|
3323
3394
|
decisions.command("list").description(
|
|
@@ -3387,13 +3458,16 @@ function createDecisionsCommand() {
|
|
|
3387
3458
|
}
|
|
3388
3459
|
}
|
|
3389
3460
|
);
|
|
3390
|
-
decisions.command("get <id>").description(
|
|
3461
|
+
decisions.command("get <id>").description(
|
|
3462
|
+
"Show one decision in full: body, evidence, deciders, chain and links. Takes a D-number (D-0006) or an id."
|
|
3463
|
+
).option("--workspace <slug|id>", "Workspace (defaults to your default workspace)").action(async (id, options, cmd) => {
|
|
3391
3464
|
const globalOpts = cmd.optsWithGlobals();
|
|
3392
3465
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3393
3466
|
try {
|
|
3394
3467
|
const client = getClient();
|
|
3395
3468
|
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
3396
|
-
const
|
|
3469
|
+
const decisionId = await resolveDecisionRef(client, workspaceId, id);
|
|
3470
|
+
const decision = await client.decisions.get(workspaceId, decisionId);
|
|
3397
3471
|
if (useJson) outputDecisionJson(decision);
|
|
3398
3472
|
else outputDecisionPretty(decision);
|
|
3399
3473
|
} catch (error) {
|
|
@@ -3407,7 +3481,10 @@ function createDecisionsCommand() {
|
|
|
3407
3481
|
"Bodies are Markdown: use --body-file <path> (or - for stdin) rather than a shell argument.",
|
|
3408
3482
|
"Bulk: --from-file <path|-> takes a JSON array of decisions; the other flags become its defaults."
|
|
3409
3483
|
].join(" ")
|
|
3410
|
-
).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(
|
|
3484
|
+
).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(
|
|
3485
|
+
"--feature <id>",
|
|
3486
|
+
'Also link it as "implemented by" this feature CUID, so it shows on the feature page'
|
|
3487
|
+
).option("--decided-at <iso>", "When it was decided (e.g. 2026-09-10T14:00)").option("--owner <userId>", "Owner user ID").option(
|
|
3411
3488
|
'--decider <"Name <email>">',
|
|
3412
3489
|
"Someone who made the decision (repeatable); external people need no account",
|
|
3413
3490
|
(value, previous) => [...previous, parseDecider(value)],
|
|
@@ -3493,6 +3570,20 @@ function createDecisionsCommand() {
|
|
|
3493
3570
|
);
|
|
3494
3571
|
}
|
|
3495
3572
|
const decision2 = await client.decisions.create(input);
|
|
3573
|
+
if (options.feature) {
|
|
3574
|
+
try {
|
|
3575
|
+
await client.decisions.linkFeature(workspaceId, decision2.id, options.feature);
|
|
3576
|
+
} catch (error) {
|
|
3577
|
+
results.push({
|
|
3578
|
+
index,
|
|
3579
|
+
success: false,
|
|
3580
|
+
decision: decision2,
|
|
3581
|
+
statement,
|
|
3582
|
+
error: notLinkedMessage(decision2, options.feature, error)
|
|
3583
|
+
});
|
|
3584
|
+
continue;
|
|
3585
|
+
}
|
|
3586
|
+
}
|
|
3496
3587
|
results.push({ index, success: true, decision: decision2, statement });
|
|
3497
3588
|
} catch (error) {
|
|
3498
3589
|
results.push({
|
|
@@ -3521,26 +3612,40 @@ function createDecisionsCommand() {
|
|
|
3521
3612
|
deciders: options.decider.length > 0 ? options.decider : void 0,
|
|
3522
3613
|
evidence: evidenceRaw === void 0 ? void 0 : parseEvidence(evidenceRaw)
|
|
3523
3614
|
});
|
|
3524
|
-
|
|
3615
|
+
let featureLink;
|
|
3616
|
+
if (options.feature) {
|
|
3617
|
+
try {
|
|
3618
|
+
featureLink = await client.decisions.linkFeature(
|
|
3619
|
+
workspaceId,
|
|
3620
|
+
decision.id,
|
|
3621
|
+
options.feature
|
|
3622
|
+
);
|
|
3623
|
+
} catch (error) {
|
|
3624
|
+
throw new Error(notLinkedMessage(decision, options.feature, error));
|
|
3625
|
+
}
|
|
3626
|
+
}
|
|
3627
|
+
if (useJson) outputDecisionJson(decision, featureLink ? { featureLink } : {});
|
|
3525
3628
|
else {
|
|
3526
3629
|
console.log(
|
|
3527
3630
|
`
|
|
3528
3631
|
\u2713 ${decision.status === "OPEN" ? "Open question" : "Decision"} logged`
|
|
3529
3632
|
);
|
|
3530
3633
|
outputDecisionPretty(decision);
|
|
3634
|
+
if (featureLink) console.log(chalk4.gray(` Linked to feature ${options.feature}`));
|
|
3531
3635
|
}
|
|
3532
3636
|
} catch (error) {
|
|
3533
3637
|
handleError(error, useJson);
|
|
3534
3638
|
}
|
|
3535
3639
|
}
|
|
3536
3640
|
);
|
|
3537
|
-
decisions.command("update").description(
|
|
3538
|
-
`Update a decision's content and scope; only the fields you pass are written. Status changes go through "decisions status".`
|
|
3539
|
-
).
|
|
3540
|
-
async (options, cmd) => {
|
|
3641
|
+
decisions.command("update [id]").description(
|
|
3642
|
+
`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".`
|
|
3643
|
+
).option("--id <id>", "Decision id (alternative to the positional <id>)").option("--workspace <slug|id>", "Workspace (defaults to your default workspace)").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)').action(
|
|
3644
|
+
async (idArg, options, cmd) => {
|
|
3541
3645
|
const globalOpts = cmd.optsWithGlobals();
|
|
3542
3646
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3543
3647
|
try {
|
|
3648
|
+
const ref = pickDecisionRef(idArg, options.id);
|
|
3544
3649
|
const body = options.body === "null" ? null : readText(options.body, options.bodyFile);
|
|
3545
3650
|
const patch = {
|
|
3546
3651
|
statement: options.statement,
|
|
@@ -3562,7 +3667,7 @@ function createDecisionsCommand() {
|
|
|
3562
3667
|
const productId = options.product === void 0 ? void 0 : options.product === "null" ? null : await resolveProductId(client, workspaceId, options.product);
|
|
3563
3668
|
const decision = await client.decisions.update({
|
|
3564
3669
|
workspaceId,
|
|
3565
|
-
decisionId:
|
|
3670
|
+
decisionId: await resolveDecisionRef(client, workspaceId, ref),
|
|
3566
3671
|
...patch,
|
|
3567
3672
|
productId
|
|
3568
3673
|
});
|
|
@@ -3576,16 +3681,20 @@ function createDecisionsCommand() {
|
|
|
3576
3681
|
}
|
|
3577
3682
|
}
|
|
3578
3683
|
);
|
|
3579
|
-
decisions.command("status").description(
|
|
3580
|
-
|
|
3581
|
-
).
|
|
3684
|
+
decisions.command("status [id]").alias("set-status").description(
|
|
3685
|
+
'Move a confirmed decision through its lifecycle \u2014 including answering an open question by moving it from OPEN to ACCEPTED. Takes a D-number (D-0006) or an id. A draft has to be confirmed first: "decisions confirm <id> --status ACCEPTED" does both.'
|
|
3686
|
+
).option("--id <id>", "Decision id (alternative to the positional <id>)").requiredOption(
|
|
3582
3687
|
"--status <status>",
|
|
3583
3688
|
"OPEN, PROPOSED, ACCEPTED, SUPERSEDED or DEPRECATED"
|
|
3584
|
-
).option(
|
|
3585
|
-
|
|
3689
|
+
).option(
|
|
3690
|
+
"--superseded-by <id>",
|
|
3691
|
+
"The decision that replaced this one, as a D-number or id (with --status SUPERSEDED)"
|
|
3692
|
+
).option("--workspace <slug|id>", "Workspace (defaults to your default workspace)").action(
|
|
3693
|
+
async (idArg, options, cmd) => {
|
|
3586
3694
|
const globalOpts = cmd.optsWithGlobals();
|
|
3587
3695
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3588
3696
|
try {
|
|
3697
|
+
const ref = pickDecisionRef(idArg, options.id);
|
|
3589
3698
|
const status = parseStatus(options.status);
|
|
3590
3699
|
if (status === "SUPERSEDED" && !options.supersededBy) {
|
|
3591
3700
|
throw new Error(
|
|
@@ -3596,9 +3705,9 @@ function createDecisionsCommand() {
|
|
|
3596
3705
|
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
3597
3706
|
const decision = await client.decisions.setStatus({
|
|
3598
3707
|
workspaceId,
|
|
3599
|
-
decisionId:
|
|
3708
|
+
decisionId: await resolveDecisionRef(client, workspaceId, ref),
|
|
3600
3709
|
status,
|
|
3601
|
-
supersededById: options.supersededBy
|
|
3710
|
+
supersededById: options.supersededBy ? await resolveDecisionRef(client, workspaceId, options.supersededBy) : void 0
|
|
3602
3711
|
});
|
|
3603
3712
|
if (useJson) outputDecisionJson(decision);
|
|
3604
3713
|
else {
|
|
@@ -3611,11 +3720,14 @@ function createDecisionsCommand() {
|
|
|
3611
3720
|
}
|
|
3612
3721
|
}
|
|
3613
3722
|
);
|
|
3614
|
-
decisions.command("link
|
|
3615
|
-
|
|
3723
|
+
decisions.command("link [id]").description(
|
|
3724
|
+
"Record what implements a decision: a ticket or a feature. Takes a D-number (D-0006) or an id. Idempotent."
|
|
3725
|
+
).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(
|
|
3726
|
+
async (idArg, options, cmd) => {
|
|
3616
3727
|
const globalOpts = cmd.optsWithGlobals();
|
|
3617
3728
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3618
3729
|
try {
|
|
3730
|
+
const ref = pickDecisionRef(idArg, options.id);
|
|
3619
3731
|
if (!options.ticket && !options.feature) {
|
|
3620
3732
|
throw new Error("Pass --ticket <id> or --feature <id>.");
|
|
3621
3733
|
}
|
|
@@ -3624,7 +3736,8 @@ function createDecisionsCommand() {
|
|
|
3624
3736
|
}
|
|
3625
3737
|
const client = getClient();
|
|
3626
3738
|
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
3627
|
-
const
|
|
3739
|
+
const decisionId = await resolveDecisionRef(client, workspaceId, ref);
|
|
3740
|
+
const link = options.ticket ? await client.decisions.linkTicket(workspaceId, decisionId, options.ticket) : await client.decisions.linkFeature(workspaceId, decisionId, options.feature);
|
|
3628
3741
|
if (useJson) console.log(JSON.stringify(link, null, 2));
|
|
3629
3742
|
else {
|
|
3630
3743
|
console.log(`\u2713 Linked ${chalk4.gray(`(link id ${link.id})`)}`);
|
|
@@ -3688,52 +3801,52 @@ function createDecisionsCommand() {
|
|
|
3688
3801
|
handleError(error, useJson);
|
|
3689
3802
|
}
|
|
3690
3803
|
});
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
try {
|
|
3695
|
-
const client = getClient();
|
|
3696
|
-
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
3697
|
-
const decision = await client.decisions.confirmDraft(workspaceId, options.id);
|
|
3698
|
-
if (useJson) outputDecisionJson(decision);
|
|
3699
|
-
else {
|
|
3700
|
-
console.log("\n\u2713 Draft confirmed");
|
|
3701
|
-
outputDecisionPretty(decision);
|
|
3702
|
-
}
|
|
3703
|
-
} catch (error) {
|
|
3704
|
-
handleError(error, useJson);
|
|
3705
|
-
}
|
|
3706
|
-
});
|
|
3707
|
-
drafts.command("reject").description(
|
|
3804
|
+
addConfirmCommand(decisions);
|
|
3805
|
+
addConfirmCommand(drafts);
|
|
3806
|
+
drafts.command("reject [id]").description(
|
|
3708
3807
|
'Reject a draft. A confirmed decision is never rejected \u2014 deprecate or supersede it with "decisions status".'
|
|
3709
|
-
).
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3808
|
+
).option("--id <id>", "Decision id (alternative to the positional <id>)").option("--workspace <slug|id>", "Workspace (defaults to your default workspace)").action(
|
|
3809
|
+
async (idArg, options, cmd) => {
|
|
3810
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3811
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3812
|
+
try {
|
|
3813
|
+
const client = getClient();
|
|
3814
|
+
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
3815
|
+
const decisionId = await resolveDecisionRef(
|
|
3816
|
+
client,
|
|
3817
|
+
workspaceId,
|
|
3818
|
+
pickDecisionRef(idArg, options.id)
|
|
3819
|
+
);
|
|
3820
|
+
const result = await client.decisions.rejectDraft(workspaceId, decisionId);
|
|
3821
|
+
if (useJson) console.log(JSON.stringify(result, null, 2));
|
|
3822
|
+
else console.log("\u2713 Draft rejected");
|
|
3823
|
+
} catch (error) {
|
|
3824
|
+
handleError(error, useJson);
|
|
3825
|
+
}
|
|
3720
3826
|
}
|
|
3721
|
-
|
|
3722
|
-
drafts.command("delete").description(
|
|
3827
|
+
);
|
|
3828
|
+
drafts.command("delete [id]").description(
|
|
3723
3829
|
"Permanently delete a draft or rejected decision. Confirmed decisions are never deleted."
|
|
3724
|
-
).
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3830
|
+
).option("--id <id>", "Decision id (alternative to the positional <id>)").option("--workspace <slug|id>", "Workspace (defaults to your default workspace)").action(
|
|
3831
|
+
async (idArg, options, cmd) => {
|
|
3832
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3833
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3834
|
+
try {
|
|
3835
|
+
const client = getClient();
|
|
3836
|
+
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
3837
|
+
const decisionId = await resolveDecisionRef(
|
|
3838
|
+
client,
|
|
3839
|
+
workspaceId,
|
|
3840
|
+
pickDecisionRef(idArg, options.id)
|
|
3841
|
+
);
|
|
3842
|
+
const result = await client.decisions.deleteDraft(workspaceId, decisionId);
|
|
3843
|
+
if (useJson) console.log(JSON.stringify({ deleted: true, ...result }, null, 2));
|
|
3844
|
+
else console.log("\u2713 Draft deleted");
|
|
3845
|
+
} catch (error) {
|
|
3846
|
+
handleError(error, useJson);
|
|
3847
|
+
}
|
|
3735
3848
|
}
|
|
3736
|
-
|
|
3849
|
+
);
|
|
3737
3850
|
decisions.addCommand(drafts);
|
|
3738
3851
|
return decisions;
|
|
3739
3852
|
}
|