exponential-cli 1.20.1 → 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 +340 -82
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/program.ts
|
|
4
|
-
import { Command as
|
|
4
|
+
import { Command as Command27 } from "commander";
|
|
5
5
|
|
|
6
6
|
// src/commands/auth.ts
|
|
7
7
|
import { Command } from "commander";
|
|
@@ -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);
|
|
@@ -2506,6 +2506,62 @@ ${date}`));
|
|
|
2506
2506
|
${report.flags.length} manual entr${report.flags.length === 1 ? "y looks" : "ies look"} like a forgotten timer`));
|
|
2507
2507
|
}
|
|
2508
2508
|
}
|
|
2509
|
+
function hostnameOf(url) {
|
|
2510
|
+
if (!url) return null;
|
|
2511
|
+
try {
|
|
2512
|
+
return new URL(url).hostname.replace(/^www\./, "");
|
|
2513
|
+
} catch {
|
|
2514
|
+
return null;
|
|
2515
|
+
}
|
|
2516
|
+
}
|
|
2517
|
+
function transformResource(r) {
|
|
2518
|
+
return {
|
|
2519
|
+
id: r.id,
|
|
2520
|
+
title: r.title,
|
|
2521
|
+
url: r.url,
|
|
2522
|
+
host: hostnameOf(r.url),
|
|
2523
|
+
description: r.description,
|
|
2524
|
+
contentType: r.contentType,
|
|
2525
|
+
readStatus: r.readStatus,
|
|
2526
|
+
readAt: r.readAt,
|
|
2527
|
+
tags: r.tags,
|
|
2528
|
+
createdAt: r.createdAt,
|
|
2529
|
+
archivedAt: r.archivedAt
|
|
2530
|
+
};
|
|
2531
|
+
}
|
|
2532
|
+
function outputResourceJson(resource) {
|
|
2533
|
+
console.log(JSON.stringify(transformResource(resource), null, 2));
|
|
2534
|
+
}
|
|
2535
|
+
function outputResourcePretty(resource) {
|
|
2536
|
+
const badge = chalk3.gray(`[${resource.readStatus}]`);
|
|
2537
|
+
console.log(` ${badge} ${chalk3.bold(resource.title)}`);
|
|
2538
|
+
if (resource.url) console.log(chalk3.gray(` ${resource.url}`));
|
|
2539
|
+
if (resource.description) console.log(` ${resource.description}`);
|
|
2540
|
+
console.log(chalk3.gray(` ID: ${resource.id}`));
|
|
2541
|
+
}
|
|
2542
|
+
function outputResourcesJson(resources, filters = {}) {
|
|
2543
|
+
console.log(
|
|
2544
|
+
JSON.stringify({ resources: resources.map(transformResource), total: resources.length, filters }, null, 2)
|
|
2545
|
+
);
|
|
2546
|
+
}
|
|
2547
|
+
function outputResourcesPretty(resources, status) {
|
|
2548
|
+
const heading = status === "unread" ? "Reading list" : status === "all" ? "Resources" : `Resources (${status})`;
|
|
2549
|
+
if (resources.length === 0) {
|
|
2550
|
+
console.log(chalk3.gray(status === "unread" ? "Nothing to read." : "No resources found."));
|
|
2551
|
+
return;
|
|
2552
|
+
}
|
|
2553
|
+
console.log(chalk3.bold(`
|
|
2554
|
+
${heading} (${resources.length} total)`));
|
|
2555
|
+
console.log(chalk3.gray("\u2500".repeat(50)));
|
|
2556
|
+
for (const r of resources) {
|
|
2557
|
+
const when = r.readStatus === "read" && r.readAt ? new Date(r.readAt) : new Date(r.createdAt);
|
|
2558
|
+
const host = hostnameOf(r.url);
|
|
2559
|
+
console.log(` ${chalk3.bold(r.title)}${host ? chalk3.gray(` ${host}`) : ""} ${chalk3.gray(when.toLocaleDateString())}`);
|
|
2560
|
+
if (r.description) console.log(chalk3.gray(` ${r.description}`));
|
|
2561
|
+
console.log(chalk3.gray(` ID: ${r.id}`));
|
|
2562
|
+
}
|
|
2563
|
+
console.log();
|
|
2564
|
+
}
|
|
2509
2565
|
|
|
2510
2566
|
// src/commands/actions.ts
|
|
2511
2567
|
var VALID_PRIORITIES = [
|
|
@@ -3176,6 +3232,27 @@ function parseNullableInt(v) {
|
|
|
3176
3232
|
if (Number.isNaN(n)) throw new Error(`Expected a number, got "${v}".`);
|
|
3177
3233
|
return n;
|
|
3178
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
|
+
}
|
|
3179
3256
|
var BATCH_ITEM_KEYS = /* @__PURE__ */ new Set([
|
|
3180
3257
|
"statement",
|
|
3181
3258
|
"body",
|
|
@@ -3253,6 +3330,55 @@ function batchDeciders(value, index) {
|
|
|
3253
3330
|
);
|
|
3254
3331
|
});
|
|
3255
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
|
+
}
|
|
3256
3382
|
function createDecisionsCommand() {
|
|
3257
3383
|
const decisions = new Command4("decisions").description(
|
|
3258
3384
|
[
|
|
@@ -3261,7 +3387,8 @@ function createDecisionsCommand() {
|
|
|
3261
3387
|
OPEN_QUESTION_NOTE,
|
|
3262
3388
|
"",
|
|
3263
3389
|
"Statuses: OPEN (an open question) \xB7 PROPOSED \xB7 ACCEPTED \xB7 SUPERSEDED \xB7 DEPRECATED.",
|
|
3264
|
-
'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."
|
|
3265
3392
|
].join("\n")
|
|
3266
3393
|
);
|
|
3267
3394
|
decisions.command("list").description(
|
|
@@ -3331,13 +3458,16 @@ function createDecisionsCommand() {
|
|
|
3331
3458
|
}
|
|
3332
3459
|
}
|
|
3333
3460
|
);
|
|
3334
|
-
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) => {
|
|
3335
3464
|
const globalOpts = cmd.optsWithGlobals();
|
|
3336
3465
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3337
3466
|
try {
|
|
3338
3467
|
const client = getClient();
|
|
3339
3468
|
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
3340
|
-
const
|
|
3469
|
+
const decisionId = await resolveDecisionRef(client, workspaceId, id);
|
|
3470
|
+
const decision = await client.decisions.get(workspaceId, decisionId);
|
|
3341
3471
|
if (useJson) outputDecisionJson(decision);
|
|
3342
3472
|
else outputDecisionPretty(decision);
|
|
3343
3473
|
} catch (error) {
|
|
@@ -3351,7 +3481,10 @@ function createDecisionsCommand() {
|
|
|
3351
3481
|
"Bodies are Markdown: use --body-file <path> (or - for stdin) rather than a shell argument.",
|
|
3352
3482
|
"Bulk: --from-file <path|-> takes a JSON array of decisions; the other flags become its defaults."
|
|
3353
3483
|
].join(" ")
|
|
3354
|
-
).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(
|
|
3355
3488
|
'--decider <"Name <email>">',
|
|
3356
3489
|
"Someone who made the decision (repeatable); external people need no account",
|
|
3357
3490
|
(value, previous) => [...previous, parseDecider(value)],
|
|
@@ -3437,6 +3570,20 @@ function createDecisionsCommand() {
|
|
|
3437
3570
|
);
|
|
3438
3571
|
}
|
|
3439
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
|
+
}
|
|
3440
3587
|
results.push({ index, success: true, decision: decision2, statement });
|
|
3441
3588
|
} catch (error) {
|
|
3442
3589
|
results.push({
|
|
@@ -3465,26 +3612,40 @@ function createDecisionsCommand() {
|
|
|
3465
3612
|
deciders: options.decider.length > 0 ? options.decider : void 0,
|
|
3466
3613
|
evidence: evidenceRaw === void 0 ? void 0 : parseEvidence(evidenceRaw)
|
|
3467
3614
|
});
|
|
3468
|
-
|
|
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 } : {});
|
|
3469
3628
|
else {
|
|
3470
3629
|
console.log(
|
|
3471
3630
|
`
|
|
3472
3631
|
\u2713 ${decision.status === "OPEN" ? "Open question" : "Decision"} logged`
|
|
3473
3632
|
);
|
|
3474
3633
|
outputDecisionPretty(decision);
|
|
3634
|
+
if (featureLink) console.log(chalk4.gray(` Linked to feature ${options.feature}`));
|
|
3475
3635
|
}
|
|
3476
3636
|
} catch (error) {
|
|
3477
3637
|
handleError(error, useJson);
|
|
3478
3638
|
}
|
|
3479
3639
|
}
|
|
3480
3640
|
);
|
|
3481
|
-
decisions.command("update").description(
|
|
3482
|
-
`Update a decision's content and scope; only the fields you pass are written. Status changes go through "decisions status".`
|
|
3483
|
-
).
|
|
3484
|
-
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) => {
|
|
3485
3645
|
const globalOpts = cmd.optsWithGlobals();
|
|
3486
3646
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3487
3647
|
try {
|
|
3648
|
+
const ref = pickDecisionRef(idArg, options.id);
|
|
3488
3649
|
const body = options.body === "null" ? null : readText(options.body, options.bodyFile);
|
|
3489
3650
|
const patch = {
|
|
3490
3651
|
statement: options.statement,
|
|
@@ -3506,7 +3667,7 @@ function createDecisionsCommand() {
|
|
|
3506
3667
|
const productId = options.product === void 0 ? void 0 : options.product === "null" ? null : await resolveProductId(client, workspaceId, options.product);
|
|
3507
3668
|
const decision = await client.decisions.update({
|
|
3508
3669
|
workspaceId,
|
|
3509
|
-
decisionId:
|
|
3670
|
+
decisionId: await resolveDecisionRef(client, workspaceId, ref),
|
|
3510
3671
|
...patch,
|
|
3511
3672
|
productId
|
|
3512
3673
|
});
|
|
@@ -3520,16 +3681,20 @@ function createDecisionsCommand() {
|
|
|
3520
3681
|
}
|
|
3521
3682
|
}
|
|
3522
3683
|
);
|
|
3523
|
-
decisions.command("status").description(
|
|
3524
|
-
|
|
3525
|
-
).
|
|
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(
|
|
3526
3687
|
"--status <status>",
|
|
3527
3688
|
"OPEN, PROPOSED, ACCEPTED, SUPERSEDED or DEPRECATED"
|
|
3528
|
-
).option(
|
|
3529
|
-
|
|
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) => {
|
|
3530
3694
|
const globalOpts = cmd.optsWithGlobals();
|
|
3531
3695
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3532
3696
|
try {
|
|
3697
|
+
const ref = pickDecisionRef(idArg, options.id);
|
|
3533
3698
|
const status = parseStatus(options.status);
|
|
3534
3699
|
if (status === "SUPERSEDED" && !options.supersededBy) {
|
|
3535
3700
|
throw new Error(
|
|
@@ -3540,9 +3705,9 @@ function createDecisionsCommand() {
|
|
|
3540
3705
|
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
3541
3706
|
const decision = await client.decisions.setStatus({
|
|
3542
3707
|
workspaceId,
|
|
3543
|
-
decisionId:
|
|
3708
|
+
decisionId: await resolveDecisionRef(client, workspaceId, ref),
|
|
3544
3709
|
status,
|
|
3545
|
-
supersededById: options.supersededBy
|
|
3710
|
+
supersededById: options.supersededBy ? await resolveDecisionRef(client, workspaceId, options.supersededBy) : void 0
|
|
3546
3711
|
});
|
|
3547
3712
|
if (useJson) outputDecisionJson(decision);
|
|
3548
3713
|
else {
|
|
@@ -3555,11 +3720,14 @@ function createDecisionsCommand() {
|
|
|
3555
3720
|
}
|
|
3556
3721
|
}
|
|
3557
3722
|
);
|
|
3558
|
-
decisions.command("link
|
|
3559
|
-
|
|
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) => {
|
|
3560
3727
|
const globalOpts = cmd.optsWithGlobals();
|
|
3561
3728
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3562
3729
|
try {
|
|
3730
|
+
const ref = pickDecisionRef(idArg, options.id);
|
|
3563
3731
|
if (!options.ticket && !options.feature) {
|
|
3564
3732
|
throw new Error("Pass --ticket <id> or --feature <id>.");
|
|
3565
3733
|
}
|
|
@@ -3568,7 +3736,8 @@ function createDecisionsCommand() {
|
|
|
3568
3736
|
}
|
|
3569
3737
|
const client = getClient();
|
|
3570
3738
|
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
3571
|
-
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);
|
|
3572
3741
|
if (useJson) console.log(JSON.stringify(link, null, 2));
|
|
3573
3742
|
else {
|
|
3574
3743
|
console.log(`\u2713 Linked ${chalk4.gray(`(link id ${link.id})`)}`);
|
|
@@ -3632,52 +3801,52 @@ function createDecisionsCommand() {
|
|
|
3632
3801
|
handleError(error, useJson);
|
|
3633
3802
|
}
|
|
3634
3803
|
});
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
try {
|
|
3639
|
-
const client = getClient();
|
|
3640
|
-
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
3641
|
-
const decision = await client.decisions.confirmDraft(workspaceId, options.id);
|
|
3642
|
-
if (useJson) outputDecisionJson(decision);
|
|
3643
|
-
else {
|
|
3644
|
-
console.log("\n\u2713 Draft confirmed");
|
|
3645
|
-
outputDecisionPretty(decision);
|
|
3646
|
-
}
|
|
3647
|
-
} catch (error) {
|
|
3648
|
-
handleError(error, useJson);
|
|
3649
|
-
}
|
|
3650
|
-
});
|
|
3651
|
-
drafts.command("reject").description(
|
|
3804
|
+
addConfirmCommand(decisions);
|
|
3805
|
+
addConfirmCommand(drafts);
|
|
3806
|
+
drafts.command("reject [id]").description(
|
|
3652
3807
|
'Reject a draft. A confirmed decision is never rejected \u2014 deprecate or supersede it with "decisions status".'
|
|
3653
|
-
).
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
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
|
+
}
|
|
3664
3826
|
}
|
|
3665
|
-
|
|
3666
|
-
drafts.command("delete").description(
|
|
3827
|
+
);
|
|
3828
|
+
drafts.command("delete [id]").description(
|
|
3667
3829
|
"Permanently delete a draft or rejected decision. Confirmed decisions are never deleted."
|
|
3668
|
-
).
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
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
|
+
}
|
|
3679
3848
|
}
|
|
3680
|
-
|
|
3849
|
+
);
|
|
3681
3850
|
decisions.addCommand(drafts);
|
|
3682
3851
|
return decisions;
|
|
3683
3852
|
}
|
|
@@ -5950,8 +6119,96 @@ Re-run with --force to delete it anyway.`
|
|
|
5950
6119
|
return projects;
|
|
5951
6120
|
}
|
|
5952
6121
|
|
|
5953
|
-
// src/commands/
|
|
6122
|
+
// src/commands/resources.ts
|
|
5954
6123
|
import { Command as Command20 } from "commander";
|
|
6124
|
+
var STATUS_FILTERS = ["unread", "to_read", "reading", "read", "all"];
|
|
6125
|
+
function validateStatus(value) {
|
|
6126
|
+
const v = value ?? "unread";
|
|
6127
|
+
if (!STATUS_FILTERS.includes(v)) {
|
|
6128
|
+
throw new Error(`Invalid --status "${value}". Valid: ${STATUS_FILTERS.join(", ")}`);
|
|
6129
|
+
}
|
|
6130
|
+
return v;
|
|
6131
|
+
}
|
|
6132
|
+
function createResourcesCommand() {
|
|
6133
|
+
const resources = new Command20("resources").description(
|
|
6134
|
+
"Saved links and reference material. `list` defaults to the Reading list (unread); `create --url` saves a link to read later."
|
|
6135
|
+
);
|
|
6136
|
+
resources.command("list").description("List resources. Defaults to the Reading list (unread); --status read for what you finished, all for everything.").option("--workspace <slug|id>", "Workspace (defaults to the configured default)").option("--status <status>", `One of: ${STATUS_FILTERS.join(", ")} (default: unread)`).option("--search <text>", "Filter by title/description").option("--limit <n>", "Max rows (default 50)", "50").action(
|
|
6137
|
+
async (options, cmd) => {
|
|
6138
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
6139
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
6140
|
+
try {
|
|
6141
|
+
const status = validateStatus(options.status);
|
|
6142
|
+
const client = getClient();
|
|
6143
|
+
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
6144
|
+
const { resources: rows } = await client.resources.list({
|
|
6145
|
+
workspaceId,
|
|
6146
|
+
readStatus: status === "all" ? void 0 : status,
|
|
6147
|
+
search: options.search,
|
|
6148
|
+
limit: Number.parseInt(options.limit, 10) || 50
|
|
6149
|
+
});
|
|
6150
|
+
if (useJson) outputResourcesJson(rows, { status });
|
|
6151
|
+
else outputResourcesPretty(rows, status);
|
|
6152
|
+
} catch (error) {
|
|
6153
|
+
handleError(error, useJson);
|
|
6154
|
+
}
|
|
6155
|
+
}
|
|
6156
|
+
);
|
|
6157
|
+
resources.command("create").description("Save a link to the Reading list (to read later). Stored by title and URL; not fetched or indexed.").requiredOption("--url <url>", "The http(s) link to save").option("-t, --title <title>", "Title (defaults to the hostname)").option("--note <text>", "One-line note (why, or who recommended it)").option("--workspace <slug|id>", "Workspace (defaults to the configured default)").option("--read", "Save as already read (reference material, not a queue item)").action(
|
|
6158
|
+
async (options, cmd) => {
|
|
6159
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
6160
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
6161
|
+
try {
|
|
6162
|
+
const client = getClient();
|
|
6163
|
+
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
6164
|
+
const resource = await client.resources.save({
|
|
6165
|
+
url: options.url,
|
|
6166
|
+
title: options.title,
|
|
6167
|
+
note: options.note,
|
|
6168
|
+
workspaceId,
|
|
6169
|
+
readStatus: options.read ? "read" : "to_read"
|
|
6170
|
+
});
|
|
6171
|
+
if (useJson) outputResourceJson(resource);
|
|
6172
|
+
else {
|
|
6173
|
+
console.log("\n\u2713 Saved to Reading list");
|
|
6174
|
+
outputResourcePretty(resource);
|
|
6175
|
+
}
|
|
6176
|
+
} catch (error) {
|
|
6177
|
+
handleError(error, useJson);
|
|
6178
|
+
}
|
|
6179
|
+
}
|
|
6180
|
+
);
|
|
6181
|
+
const setStatus = (name, readStatus, description) => resources.command(`${name} <id>`).description(description).action(async (id, _options, cmd) => {
|
|
6182
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
6183
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
6184
|
+
try {
|
|
6185
|
+
const client = getClient();
|
|
6186
|
+
const result = await client.resources.setReadStatus(id, readStatus);
|
|
6187
|
+
if (useJson) console.log(JSON.stringify(result, null, 2));
|
|
6188
|
+
else console.log(`\u2713 ${id} is now ${result.readStatus}`);
|
|
6189
|
+
} catch (error) {
|
|
6190
|
+
handleError(error, useJson);
|
|
6191
|
+
}
|
|
6192
|
+
});
|
|
6193
|
+
setStatus("mark-read", "read", "Mark a saved resource as read (records when; fetches nothing)");
|
|
6194
|
+
setStatus("unread", "to_read", "Put a resource back on the Reading list");
|
|
6195
|
+
resources.command("archive <id>").description("Archive a resource: out of every list, but kept").action(async (id, _options, cmd) => {
|
|
6196
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
6197
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
6198
|
+
try {
|
|
6199
|
+
const client = getClient();
|
|
6200
|
+
const result = await client.resources.archive(id);
|
|
6201
|
+
if (useJson) console.log(JSON.stringify({ id, ...result }, null, 2));
|
|
6202
|
+
else console.log(`\u2713 Archived ${id}`);
|
|
6203
|
+
} catch (error) {
|
|
6204
|
+
handleError(error, useJson);
|
|
6205
|
+
}
|
|
6206
|
+
});
|
|
6207
|
+
return resources;
|
|
6208
|
+
}
|
|
6209
|
+
|
|
6210
|
+
// src/commands/runner.ts
|
|
6211
|
+
import { Command as Command21 } from "commander";
|
|
5955
6212
|
import { hostname, homedir as homedir2, tmpdir as tmpdir2 } from "os";
|
|
5956
6213
|
import { execFileSync } from "child_process";
|
|
5957
6214
|
import { mkdirSync as mkdirSync3 } from "fs";
|
|
@@ -6403,7 +6660,7 @@ function removeServiceFile(plan) {
|
|
|
6403
6660
|
|
|
6404
6661
|
// src/commands/runner.ts
|
|
6405
6662
|
function createRunnerCommand() {
|
|
6406
|
-
const cmd = new
|
|
6663
|
+
const cmd = new Command21("runner").description(
|
|
6407
6664
|
"Run your Assistant locally: claim its queued runs and work them with Claude Code on this machine"
|
|
6408
6665
|
);
|
|
6409
6666
|
cmd.command("start").description("Poll for queued runs and work them until stopped (Ctrl-C)").option("--runner-id <id>", "Name of this runner, recorded on each run", hostname()).option("--cwd <dir>", "Working directory for the spawned CLI (overrides runner config; never from the server)").option("--interval <seconds>", "Seconds between polls when nothing is queued", "15").option("--once", "Claim at most one run, work it, and exit").option("--no-mcp", "Spawn without the Exponential MCP run tools (progress still streams; the session cannot ask the owner)").action(async (opts) => {
|
|
@@ -6514,7 +6771,7 @@ ${plan.contents}
|
|
|
6514
6771
|
}
|
|
6515
6772
|
|
|
6516
6773
|
// src/commands/search.ts
|
|
6517
|
-
import { Command as
|
|
6774
|
+
import { Command as Command22 } from "commander";
|
|
6518
6775
|
import chalk8 from "chalk";
|
|
6519
6776
|
var TYPE_LABELS = {
|
|
6520
6777
|
workspace: "Workspaces",
|
|
@@ -6533,7 +6790,7 @@ var TYPE_LABELS = {
|
|
|
6533
6790
|
product: "Products"
|
|
6534
6791
|
};
|
|
6535
6792
|
function createSearchCommand() {
|
|
6536
|
-
const search = new
|
|
6793
|
+
const search = new Command22("search").description(
|
|
6537
6794
|
"Global search across projects, actions, goals, workspaces and more \u2014 same coverage as the app's Cmd+K palette"
|
|
6538
6795
|
).argument("<query>", "Text to search for").option("-w, --workspace <slug>", "Restrict results to one workspace (slug or ID)").option("-l, --limit <n>", "Max results per entity type (1-25, default 10)").action(async (query, options, cmd) => {
|
|
6539
6796
|
const globalOpts = cmd.optsWithGlobals();
|
|
@@ -6592,7 +6849,7 @@ ${TYPE_LABELS[type] ?? type}`));
|
|
|
6592
6849
|
}
|
|
6593
6850
|
|
|
6594
6851
|
// src/commands/tickets.ts
|
|
6595
|
-
import { Command as
|
|
6852
|
+
import { Command as Command23 } from "commander";
|
|
6596
6853
|
function collectRepeatable(value, previous) {
|
|
6597
6854
|
return [...previous, value];
|
|
6598
6855
|
}
|
|
@@ -6635,7 +6892,7 @@ function validateTicketType(value) {
|
|
|
6635
6892
|
return value;
|
|
6636
6893
|
}
|
|
6637
6894
|
function createTicketsCommand() {
|
|
6638
|
-
const tickets = new
|
|
6895
|
+
const tickets = new Command23("tickets").description(
|
|
6639
6896
|
"Manage product backlog tickets. Tickets live under a product, link to features/epics, depend on each other, and can be implemented via actions."
|
|
6640
6897
|
);
|
|
6641
6898
|
tickets.command("list").description(
|
|
@@ -7004,7 +7261,7 @@ function createTicketsCommand() {
|
|
|
7004
7261
|
handleError(error, useJson);
|
|
7005
7262
|
}
|
|
7006
7263
|
});
|
|
7007
|
-
const comment = new
|
|
7264
|
+
const comment = new Command23("comment").description("Manage comments on a ticket");
|
|
7008
7265
|
comment.command("list").description("List comments on a ticket").requiredOption("--id <id>", "Ticket CUID").action(async (options, cmd) => {
|
|
7009
7266
|
const globalOpts = cmd.optsWithGlobals();
|
|
7010
7267
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -7096,7 +7353,7 @@ function createTicketsCommand() {
|
|
|
7096
7353
|
}
|
|
7097
7354
|
|
|
7098
7355
|
// src/commands/time.ts
|
|
7099
|
-
import { Command as
|
|
7356
|
+
import { Command as Command24 } from "commander";
|
|
7100
7357
|
import { segmentConversation } from "exponential-sdk";
|
|
7101
7358
|
var SOURCES2 = ["manual", "claude-desktop", "agent-run"];
|
|
7102
7359
|
var STATUSES2 = ["PROPOSED", "CONFIRMED"];
|
|
@@ -7186,7 +7443,7 @@ function batchItemToInput(item, index, defaults) {
|
|
|
7186
7443
|
};
|
|
7187
7444
|
}
|
|
7188
7445
|
function createTimeCommand() {
|
|
7189
|
-
const time = new
|
|
7446
|
+
const time = new Command24("time").description(
|
|
7190
7447
|
`Time entries \u2014 log the day's work and list it. ${OWNERSHIP_NOTE}`
|
|
7191
7448
|
);
|
|
7192
7449
|
time.command("log").description(
|
|
@@ -7356,10 +7613,10 @@ function parseMessagesFile(raw) {
|
|
|
7356
7613
|
}
|
|
7357
7614
|
|
|
7358
7615
|
// src/commands/workspaces.ts
|
|
7359
|
-
import { Command as
|
|
7616
|
+
import { Command as Command25 } from "commander";
|
|
7360
7617
|
import chalk9 from "chalk";
|
|
7361
7618
|
function createWorkspacesCommand() {
|
|
7362
|
-
const workspaces = new
|
|
7619
|
+
const workspaces = new Command25("workspaces").description("Manage workspaces");
|
|
7363
7620
|
workspaces.command("list").description("List all workspaces").action(async (_options, cmd) => {
|
|
7364
7621
|
const globalOpts = cmd.optsWithGlobals();
|
|
7365
7622
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -7449,7 +7706,7 @@ Members (${members.length})
|
|
|
7449
7706
|
}
|
|
7450
7707
|
|
|
7451
7708
|
// src/commands/goals.ts
|
|
7452
|
-
import { Command as
|
|
7709
|
+
import { Command as Command26 } from "commander";
|
|
7453
7710
|
var GOAL_STATUSES = [
|
|
7454
7711
|
"planned",
|
|
7455
7712
|
"active",
|
|
@@ -7561,7 +7818,7 @@ function validateKeyResultUnit(value) {
|
|
|
7561
7818
|
return value;
|
|
7562
7819
|
}
|
|
7563
7820
|
function createKeyResultsCommand() {
|
|
7564
|
-
const kr = new
|
|
7821
|
+
const kr = new Command26("kr").description(
|
|
7565
7822
|
"Key results on an objective. Ids are CUIDs; --goal takes the objective's integer id."
|
|
7566
7823
|
);
|
|
7567
7824
|
kr.command("list").description("List key results").option("--goal <id>", "Objective ID (a number)").option("-w, --workspace <slug|id>", "Workspace (workspace-wide: every member's KRs)").option("--period <period>", "Period, e.g. Q3-2026").option("--status <status>", `Filter by status: ${KEY_RESULT_STATUSES.join(", ")}`).option("--mine", "Narrow a workspace list to key results you own").action(
|
|
@@ -7764,7 +8021,7 @@ function createKeyResultsCommand() {
|
|
|
7764
8021
|
return kr;
|
|
7765
8022
|
}
|
|
7766
8023
|
function createGoalCommentsCommand() {
|
|
7767
|
-
const comment = new
|
|
8024
|
+
const comment = new Command26("comment").description(
|
|
7768
8025
|
"Read and post comments on a goal. Mention teammates with --mention."
|
|
7769
8026
|
);
|
|
7770
8027
|
comment.command("list").description("List comments on a goal").requiredOption("--goal <id>", "Goal ID (a number)").action(async (options, cmd) => {
|
|
@@ -7859,7 +8116,7 @@ function createGoalCommentsCommand() {
|
|
|
7859
8116
|
return comment;
|
|
7860
8117
|
}
|
|
7861
8118
|
function createGoalsCommand() {
|
|
7862
|
-
const goals = new
|
|
8119
|
+
const goals = new Command26("goals").description(
|
|
7863
8120
|
"Manage goals (objectives) and their key results. Objectives have integer ids; key results are CUIDs."
|
|
7864
8121
|
);
|
|
7865
8122
|
goals.command("list").description(
|
|
@@ -8146,7 +8403,7 @@ Re-run with --with-key-results to go ahead, or move them with \`goals kr update
|
|
|
8146
8403
|
return goals;
|
|
8147
8404
|
}
|
|
8148
8405
|
function createOkrsCommand() {
|
|
8149
|
-
const okrs = new
|
|
8406
|
+
const okrs = new Command26("okrs").description(
|
|
8150
8407
|
"OKRs \u2014 objectives with their key results nested. Manage the parts with `goals` and `goals kr`."
|
|
8151
8408
|
);
|
|
8152
8409
|
okrs.command("list").description(
|
|
@@ -8235,7 +8492,7 @@ function isBareVersionRequest(args) {
|
|
|
8235
8492
|
return args.includes("--version") && args.every((arg) => arg.startsWith("-"));
|
|
8236
8493
|
}
|
|
8237
8494
|
function buildProgram() {
|
|
8238
|
-
const program = new
|
|
8495
|
+
const program = new Command27();
|
|
8239
8496
|
program.name("exponential").description(
|
|
8240
8497
|
[
|
|
8241
8498
|
"CLI to interact with Exponential productivity app.",
|
|
@@ -8258,6 +8515,7 @@ function buildProgram() {
|
|
|
8258
8515
|
program.addCommand(createPagesCommand());
|
|
8259
8516
|
program.addCommand(createProductsCommand());
|
|
8260
8517
|
program.addCommand(createProjectsCommand());
|
|
8518
|
+
program.addCommand(createResourcesCommand());
|
|
8261
8519
|
program.addCommand(createRunnerCommand());
|
|
8262
8520
|
program.addCommand(createSearchCommand());
|
|
8263
8521
|
program.addCommand(createTicketsCommand());
|