exponential-cli 1.24.0 → 1.25.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 +38 -0
- package/dist/index.js +673 -118
- 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 Command28 } from "commander";
|
|
5
5
|
|
|
6
6
|
// src/commands/auth.ts
|
|
7
7
|
import { Command } from "commander";
|
|
@@ -93,12 +93,14 @@ function handleError(error, json = false) {
|
|
|
93
93
|
message = "Access denied";
|
|
94
94
|
break;
|
|
95
95
|
}
|
|
96
|
+
const property = error.data?.property;
|
|
96
97
|
if (json) {
|
|
97
98
|
console.log(JSON.stringify({
|
|
98
99
|
error: {
|
|
99
100
|
code,
|
|
100
101
|
message,
|
|
101
|
-
suggestion
|
|
102
|
+
suggestion,
|
|
103
|
+
...property ? { property } : {}
|
|
102
104
|
}
|
|
103
105
|
}, null, 2));
|
|
104
106
|
} else {
|
|
@@ -2662,6 +2664,129 @@ ${heading} (${resources.length} total)`));
|
|
|
2662
2664
|
}
|
|
2663
2665
|
console.log();
|
|
2664
2666
|
}
|
|
2667
|
+
function outputDatabaseJson(database) {
|
|
2668
|
+
console.log(JSON.stringify(database, null, 2));
|
|
2669
|
+
}
|
|
2670
|
+
function describeProperty(p) {
|
|
2671
|
+
const options = p.options?.length ? ` [${p.options.map((o) => o.name).join(", ")}]` : "";
|
|
2672
|
+
return ` ${p.name} ${chalk3.gray(`${p.type} ${p.id}`)}${chalk3.gray(options)}`;
|
|
2673
|
+
}
|
|
2674
|
+
function outputDatabasePretty(database) {
|
|
2675
|
+
console.log(chalk3.gray("\u2500".repeat(50)));
|
|
2676
|
+
console.log(`
|
|
2677
|
+
${chalk3.bold(database.name)}`);
|
|
2678
|
+
console.log(chalk3.gray(` ID: ${database.id}`));
|
|
2679
|
+
console.log(` ${chalk3.gray("Page:")} ${database.page.title} ${chalk3.gray(database.page.id)}`);
|
|
2680
|
+
const facts = [];
|
|
2681
|
+
if (typeof database.rowCount === "number") facts.push(`${database.rowCount} row${database.rowCount === 1 ? "" : "s"}`);
|
|
2682
|
+
if (database.detachedAt) facts.push(`detached ${formatDate(new Date(database.detachedAt))} \u2014 block is out of the page`);
|
|
2683
|
+
if (facts.length) console.log(chalk3.gray(` ${facts.join(" \xB7 ")}`));
|
|
2684
|
+
console.log(`
|
|
2685
|
+
${chalk3.gray("Properties")}`);
|
|
2686
|
+
for (const p of database.properties) console.log(describeProperty(p));
|
|
2687
|
+
const view = database.view;
|
|
2688
|
+
const viewParts = [];
|
|
2689
|
+
if (view.sort) viewParts.push(`sort ${view.sort.propertyId} ${view.sort.direction}`);
|
|
2690
|
+
if (view.filters.length) viewParts.push(`${view.filters.length} filter${view.filters.length === 1 ? "" : "s"}`);
|
|
2691
|
+
if (view.hiddenPropertyIds.length) viewParts.push(`${view.hiddenPropertyIds.length} hidden`);
|
|
2692
|
+
if (viewParts.length) console.log(chalk3.gray(`
|
|
2693
|
+
View: ${viewParts.join(" \xB7 ")}`));
|
|
2694
|
+
console.log();
|
|
2695
|
+
}
|
|
2696
|
+
function outputDatabasesPretty(databases) {
|
|
2697
|
+
if (databases.length === 0) {
|
|
2698
|
+
console.log(chalk3.gray("No databases on this page."));
|
|
2699
|
+
return;
|
|
2700
|
+
}
|
|
2701
|
+
console.log(chalk3.bold(`
|
|
2702
|
+
Databases (${databases.length})`));
|
|
2703
|
+
console.log(chalk3.gray("\u2500".repeat(50)));
|
|
2704
|
+
for (const d of databases) {
|
|
2705
|
+
const state = d.detachedAt ? chalk3.yellow(" detached") : "";
|
|
2706
|
+
const rows = typeof d.rowCount === "number" ? chalk3.gray(` ${d.rowCount} rows`) : "";
|
|
2707
|
+
console.log(` ${d.name} ${chalk3.gray(d.id)}${rows}${state}`);
|
|
2708
|
+
}
|
|
2709
|
+
console.log();
|
|
2710
|
+
}
|
|
2711
|
+
function formatCell(def, value) {
|
|
2712
|
+
if (value === null || value === void 0 || value === "") return chalk3.gray("\u2014");
|
|
2713
|
+
if (Array.isArray(value)) {
|
|
2714
|
+
if (value.length === 0) return chalk3.gray("\u2014");
|
|
2715
|
+
return value.map((v) => formatCell(def, v)).join(", ");
|
|
2716
|
+
}
|
|
2717
|
+
if (def?.options) {
|
|
2718
|
+
return def.options.find((o) => o.id === value)?.name ?? String(value);
|
|
2719
|
+
}
|
|
2720
|
+
if (typeof value === "boolean") return value ? "Yes" : "No";
|
|
2721
|
+
return String(value);
|
|
2722
|
+
}
|
|
2723
|
+
function outputRowJson(row) {
|
|
2724
|
+
console.log(JSON.stringify(row, null, 2));
|
|
2725
|
+
}
|
|
2726
|
+
function outputRowPretty(row, database) {
|
|
2727
|
+
console.log(`
|
|
2728
|
+
${chalk3.bold(row.title || "Untitled")} ${chalk3.gray(row.id)}`);
|
|
2729
|
+
const defs = database?.properties.filter((p) => p.type !== "title") ?? [];
|
|
2730
|
+
if (defs.length) {
|
|
2731
|
+
for (const def of defs) {
|
|
2732
|
+
console.log(` ${chalk3.gray(`${def.name}:`)} ${formatCell(def, row.values[def.id])}`);
|
|
2733
|
+
}
|
|
2734
|
+
} else {
|
|
2735
|
+
for (const [key, value] of Object.entries(row.values)) {
|
|
2736
|
+
console.log(` ${chalk3.gray(`${key}:`)} ${formatCell(void 0, value)}`);
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2739
|
+
console.log(chalk3.gray(` Read the page: exponential pages get ${row.id}`));
|
|
2740
|
+
console.log();
|
|
2741
|
+
}
|
|
2742
|
+
function outputRowsPretty(page, database) {
|
|
2743
|
+
if (page.rows.length === 0) {
|
|
2744
|
+
console.log(chalk3.gray(`No rows in ${database.name}.`));
|
|
2745
|
+
return;
|
|
2746
|
+
}
|
|
2747
|
+
const byId = new Map(database.properties.map((p) => [p.id, p]));
|
|
2748
|
+
const columns = page.columns.map((id) => byId.get(id)).filter((p) => !!p && p.type !== "title");
|
|
2749
|
+
console.log(chalk3.bold(`
|
|
2750
|
+
${database.name} (${page.rows.length} row${page.rows.length === 1 ? "" : "s"}${page.nextCursor ? ", more" : ""})`));
|
|
2751
|
+
console.log(chalk3.gray("\u2500".repeat(50)));
|
|
2752
|
+
for (const row of page.rows) {
|
|
2753
|
+
const cells = columns.map((c) => `${chalk3.gray(`${c.name}:`)} ${formatCell(c, row.values[c.id])}`);
|
|
2754
|
+
console.log(` ${chalk3.bold(row.title || "Untitled")} ${chalk3.gray(row.id)}`);
|
|
2755
|
+
if (cells.length) console.log(` ${cells.join(" ")}`);
|
|
2756
|
+
}
|
|
2757
|
+
if (page.nextCursor) console.log(chalk3.gray(`
|
|
2758
|
+
More: --cursor ${page.nextCursor}`));
|
|
2759
|
+
console.log();
|
|
2760
|
+
}
|
|
2761
|
+
function outputCsvSkipped(skipped) {
|
|
2762
|
+
if (skipped.length === 0) return;
|
|
2763
|
+
console.log(chalk3.yellow(`
|
|
2764
|
+
${skipped.length} row${skipped.length === 1 ? "" : "s"} not imported:`));
|
|
2765
|
+
for (const row of skipped) {
|
|
2766
|
+
const why = row.errors.map((e) => `${e.propertyName} ${e.reason}`).join("; ");
|
|
2767
|
+
console.log(` row ${row.index + 1}: ${why}`);
|
|
2768
|
+
}
|
|
2769
|
+
}
|
|
2770
|
+
function outputCsvPreviewPretty(preview) {
|
|
2771
|
+
console.log(chalk3.bold(`
|
|
2772
|
+
CSV preview: ${preview.importable} of ${preview.total} row${preview.total === 1 ? "" : "s"} would be created`));
|
|
2773
|
+
console.log(chalk3.gray("\u2500".repeat(50)));
|
|
2774
|
+
for (const column of preview.columns) {
|
|
2775
|
+
const to = column.target.kind === "skip" ? chalk3.gray("skipped") : column.target.kind === "new" ? `${chalk3.green("new")} ${column.propertyName} (${column.type})` : `${column.propertyName} (${column.type})`;
|
|
2776
|
+
console.log(` ${chalk3.gray(`${column.header} \u2192`)} ${to}`);
|
|
2777
|
+
}
|
|
2778
|
+
const newOptions = Object.entries(preview.newOptions ?? {});
|
|
2779
|
+
if (newOptions.length) {
|
|
2780
|
+
console.log(chalk3.green("\n Options the import will add:"));
|
|
2781
|
+
for (const [columnId, names] of newOptions) {
|
|
2782
|
+
const column = preview.columns.find((c) => (c.target.kind === "property" ? c.target.propertyId : `new:${c.propertyName ?? ""}`) === columnId);
|
|
2783
|
+
console.log(` ${column?.propertyName ?? columnId}: ${names.join(", ")}`);
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2786
|
+
const skipped = preview.rows.filter((r) => r.errors.length > 0).map((r) => ({ index: r.index, errors: r.errors }));
|
|
2787
|
+
outputCsvSkipped(skipped);
|
|
2788
|
+
console.log(chalk3.gray("\n Nothing was created. Run again without --dry-run to import."));
|
|
2789
|
+
}
|
|
2665
2790
|
|
|
2666
2791
|
// src/commands/actions.ts
|
|
2667
2792
|
var VALID_PRIORITIES = [
|
|
@@ -3202,7 +3327,7 @@ function createContactsCommand() {
|
|
|
3202
3327
|
return contacts;
|
|
3203
3328
|
}
|
|
3204
3329
|
|
|
3205
|
-
// src/commands/
|
|
3330
|
+
// src/commands/databases.ts
|
|
3206
3331
|
import { Command as Command4 } from "commander";
|
|
3207
3332
|
import chalk4 from "chalk";
|
|
3208
3333
|
|
|
@@ -3232,7 +3357,436 @@ function parseDate(value) {
|
|
|
3232
3357
|
return date;
|
|
3233
3358
|
}
|
|
3234
3359
|
|
|
3360
|
+
// src/commands/databases.ts
|
|
3361
|
+
var ADDABLE_TYPES = [
|
|
3362
|
+
"text",
|
|
3363
|
+
"number",
|
|
3364
|
+
"select",
|
|
3365
|
+
"multiSelect",
|
|
3366
|
+
"date",
|
|
3367
|
+
"checkbox",
|
|
3368
|
+
"url",
|
|
3369
|
+
"person",
|
|
3370
|
+
"createdTime",
|
|
3371
|
+
"lastEditedTime",
|
|
3372
|
+
"createdBy"
|
|
3373
|
+
];
|
|
3374
|
+
function collect(value, previous) {
|
|
3375
|
+
return [...previous, value];
|
|
3376
|
+
}
|
|
3377
|
+
function parseLimit(value) {
|
|
3378
|
+
if (value === void 0) return void 0;
|
|
3379
|
+
const n = Number(value);
|
|
3380
|
+
if (!Number.isInteger(n) || n < 1) {
|
|
3381
|
+
throw new Error(`--limit must be a positive integer, got "${value}"`);
|
|
3382
|
+
}
|
|
3383
|
+
return n;
|
|
3384
|
+
}
|
|
3385
|
+
function parseSet(pairs, cleared = []) {
|
|
3386
|
+
const values = {};
|
|
3387
|
+
for (const pair of pairs) {
|
|
3388
|
+
const at = pair.indexOf("=");
|
|
3389
|
+
if (at <= 0) {
|
|
3390
|
+
throw new Error(`--set expects Property=value, got "${pair}"`);
|
|
3391
|
+
}
|
|
3392
|
+
const key = pair.slice(0, at).trim();
|
|
3393
|
+
const raw = pair.slice(at + 1);
|
|
3394
|
+
values[key] = raw === "" ? null : raw;
|
|
3395
|
+
}
|
|
3396
|
+
for (const key of cleared) values[key.trim()] = null;
|
|
3397
|
+
return values;
|
|
3398
|
+
}
|
|
3399
|
+
function parseCsvMapping(database, flags) {
|
|
3400
|
+
const mapping = {};
|
|
3401
|
+
const split = (pair, flag) => {
|
|
3402
|
+
const at = pair.indexOf("=");
|
|
3403
|
+
if (at <= 0) throw new Error(`${flag} expects Column=value, got "${pair}"`);
|
|
3404
|
+
return [pair.slice(0, at).trim(), pair.slice(at + 1).trim()];
|
|
3405
|
+
};
|
|
3406
|
+
for (const pair of flags.map) {
|
|
3407
|
+
const [column, property] = split(pair, "--map");
|
|
3408
|
+
mapping[column] = { kind: "property", propertyId: resolveProperty(database, property).id };
|
|
3409
|
+
}
|
|
3410
|
+
for (const pair of flags.new) {
|
|
3411
|
+
const [column, spec] = split(pair, "--new");
|
|
3412
|
+
const colon = spec.indexOf(":");
|
|
3413
|
+
const name = colon > 0 ? spec.slice(0, colon).trim() : column;
|
|
3414
|
+
const type = colon > 0 ? spec.slice(colon + 1).trim() : spec;
|
|
3415
|
+
mapping[column] = { kind: "new", name, type: parsePropertyType(type) };
|
|
3416
|
+
}
|
|
3417
|
+
for (const column of flags.skip) mapping[column.trim()] = { kind: "skip" };
|
|
3418
|
+
return mapping;
|
|
3419
|
+
}
|
|
3420
|
+
function parsePropertyType(value) {
|
|
3421
|
+
if (ADDABLE_TYPES.includes(value)) return value;
|
|
3422
|
+
throw new Error(`--type must be one of: ${ADDABLE_TYPES.join(", ")} (got "${value}")`);
|
|
3423
|
+
}
|
|
3424
|
+
function parseOptions(value) {
|
|
3425
|
+
if (value === void 0) return void 0;
|
|
3426
|
+
return value.split(",").map((part) => part.trim()).filter(Boolean).map((part) => {
|
|
3427
|
+
const at = part.lastIndexOf(":");
|
|
3428
|
+
if (at > 0) {
|
|
3429
|
+
return { name: part.slice(0, at).trim(), color: part.slice(at + 1).trim() };
|
|
3430
|
+
}
|
|
3431
|
+
return { name: part };
|
|
3432
|
+
});
|
|
3433
|
+
}
|
|
3434
|
+
function parseFilter(expression) {
|
|
3435
|
+
const match = /^\s*(.+?)\s*(!=|>=|<=|=|~|>|<| in )\s*(.*)$/.exec(expression);
|
|
3436
|
+
if (!match) throw new Error(`--filter expects Property=value (or !=, ~, >, <, in), got "${expression}"`);
|
|
3437
|
+
const [, property, operator, value] = match;
|
|
3438
|
+
switch (operator.trim()) {
|
|
3439
|
+
case "=":
|
|
3440
|
+
return value === "" ? { property, op: "isEmpty" } : { property, op: "eq", value };
|
|
3441
|
+
case "!=":
|
|
3442
|
+
return value === "" ? { property, op: "isNotEmpty" } : { property, op: "neq", value };
|
|
3443
|
+
case "~":
|
|
3444
|
+
return { property, op: "contains", value };
|
|
3445
|
+
case ">":
|
|
3446
|
+
return { property, op: "gt", value };
|
|
3447
|
+
case "<":
|
|
3448
|
+
return { property, op: "lt", value };
|
|
3449
|
+
case ">=":
|
|
3450
|
+
case "<=":
|
|
3451
|
+
throw new Error(`--filter does not support "${operator.trim()}" (only > and <), got "${expression}"`);
|
|
3452
|
+
case "in":
|
|
3453
|
+
return { property, op: "anyOf", value: value.split(",").map((s) => s.trim()).filter(Boolean) };
|
|
3454
|
+
default:
|
|
3455
|
+
throw new Error(`Unknown filter operator "${operator}"`);
|
|
3456
|
+
}
|
|
3457
|
+
}
|
|
3458
|
+
function parseSort(value) {
|
|
3459
|
+
if (value === void 0) return void 0;
|
|
3460
|
+
const at = value.lastIndexOf(":");
|
|
3461
|
+
const property = at > 0 ? value.slice(0, at).trim() : value.trim();
|
|
3462
|
+
const direction = at > 0 ? value.slice(at + 1).trim().toLowerCase() : "asc";
|
|
3463
|
+
if (direction !== "asc" && direction !== "desc") {
|
|
3464
|
+
throw new Error(`--sort expects Property or Property:asc|desc, got "${value}"`);
|
|
3465
|
+
}
|
|
3466
|
+
return { property, direction };
|
|
3467
|
+
}
|
|
3468
|
+
function resolveProperty(database, key) {
|
|
3469
|
+
const byId = database.properties.find((p) => p.id === key);
|
|
3470
|
+
if (byId) return byId;
|
|
3471
|
+
const wanted = key.trim().toLowerCase();
|
|
3472
|
+
const byName = database.properties.filter((p) => p.name.trim().toLowerCase() === wanted);
|
|
3473
|
+
if (byName.length === 1) return byName[0];
|
|
3474
|
+
throw new Error(
|
|
3475
|
+
`No property "${key}" on ${database.name}. Properties: ${database.properties.map((p) => p.name).join(", ")}`
|
|
3476
|
+
);
|
|
3477
|
+
}
|
|
3478
|
+
function buildListView(database, filters, sort) {
|
|
3479
|
+
if (filters.length === 0 && sort === void 0) return void 0;
|
|
3480
|
+
const parsedSort = parseSort(sort);
|
|
3481
|
+
return {
|
|
3482
|
+
...database.view,
|
|
3483
|
+
sort: parsedSort ? { propertyId: resolveProperty(database, parsedSort.property).id, direction: parsedSort.direction } : database.view.sort,
|
|
3484
|
+
filters: filters.length === 0 ? database.view.filters : filters.map((expression) => {
|
|
3485
|
+
const { property, op, value } = parseFilter(expression);
|
|
3486
|
+
return { propertyId: resolveProperty(database, property).id, op, ...value !== void 0 ? { value } : {} };
|
|
3487
|
+
})
|
|
3488
|
+
};
|
|
3489
|
+
}
|
|
3490
|
+
function createDatabasesCommand() {
|
|
3491
|
+
const databases = new Command4("databases").description(
|
|
3492
|
+
'Databases: typed tables inside pages. A database is a block in a page body, owned by that page; each row is a page of its own (read it with "pages get <rowId>"). Writes are typed per property \u2014 a bad value is refused naming the property. Not a work tracker: use tickets, actions and projects for work.'
|
|
3493
|
+
);
|
|
3494
|
+
databases.command("create").description(
|
|
3495
|
+
"Create a database on a page (with a title property) and place its block at the end of the page body. --no-place leaves the body alone and prints the marker to put in yourself."
|
|
3496
|
+
).requiredOption("--page <id>", "The page that will hold the database (you need edit access)").requiredOption("--name <name>", "Database name, e.g. Metrics").option("--no-place", "Do not append the marker to the page body").option("-n, --note <text>", "Why: recorded on the page revision that places the block").action(
|
|
3497
|
+
async (options, cmd) => {
|
|
3498
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3499
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3500
|
+
try {
|
|
3501
|
+
const client = getClient();
|
|
3502
|
+
const database = await client.databases.create({ pageId: options.page, name: options.name });
|
|
3503
|
+
let placed = false;
|
|
3504
|
+
if (options.place && database.marker) {
|
|
3505
|
+
const page = await client.pages.get(options.page);
|
|
3506
|
+
const body = page.body?.trimEnd();
|
|
3507
|
+
await client.pages.update({
|
|
3508
|
+
id: options.page,
|
|
3509
|
+
body: body ? `${body}
|
|
3510
|
+
|
|
3511
|
+
${database.marker}` : database.marker,
|
|
3512
|
+
baseVersion: page.docVersion,
|
|
3513
|
+
note: options.note ?? `Add the ${database.name} database`
|
|
3514
|
+
});
|
|
3515
|
+
placed = true;
|
|
3516
|
+
}
|
|
3517
|
+
if (useJson) outputDatabaseJson({ ...database, placed });
|
|
3518
|
+
else {
|
|
3519
|
+
console.log(`
|
|
3520
|
+
\u2713 Database created${placed ? ` and placed in "${database.page.title}"` : ""}`);
|
|
3521
|
+
outputDatabasePretty(database);
|
|
3522
|
+
if (!placed && database.marker) {
|
|
3523
|
+
console.log(chalk4.gray(` Put this line in the page body to show it: ${database.marker}
|
|
3524
|
+
`));
|
|
3525
|
+
}
|
|
3526
|
+
}
|
|
3527
|
+
} catch (error) {
|
|
3528
|
+
handleError(error, useJson);
|
|
3529
|
+
}
|
|
3530
|
+
}
|
|
3531
|
+
);
|
|
3532
|
+
databases.command("get <id>").description("One database: its properties, saved view, row count and holding page").action(async (id, _options, cmd) => {
|
|
3533
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3534
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3535
|
+
try {
|
|
3536
|
+
const database = await getClient().databases.get(id);
|
|
3537
|
+
if (useJson) outputDatabaseJson(database);
|
|
3538
|
+
else outputDatabasePretty(database);
|
|
3539
|
+
} catch (error) {
|
|
3540
|
+
handleError(error, useJson);
|
|
3541
|
+
}
|
|
3542
|
+
});
|
|
3543
|
+
databases.command("list").description("The databases a page holds, detached ones included (a detached database's block is out of the body; its rows wait 30 days for the purge)").requiredOption("--page <id>", "Page CUID").action(async (options, cmd) => {
|
|
3544
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3545
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3546
|
+
try {
|
|
3547
|
+
const list = await getClient().databases.list(options.page);
|
|
3548
|
+
if (useJson) console.log(JSON.stringify(list, null, 2));
|
|
3549
|
+
else outputDatabasesPretty(list);
|
|
3550
|
+
} catch (error) {
|
|
3551
|
+
handleError(error, useJson);
|
|
3552
|
+
}
|
|
3553
|
+
});
|
|
3554
|
+
databases.command("update").description("Rename a database, or replace its saved view whole (JSON: { sort?, filters, hiddenPropertyIds, propertyOrder })").requiredOption("--id <id>", "Database CUID").option("--name <name>", "New name").option("--view <json>", "The whole view as JSON").option("--view-file <path>", 'Read the view JSON from a file ("-" = stdin)').action(
|
|
3555
|
+
async (options, cmd) => {
|
|
3556
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3557
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3558
|
+
try {
|
|
3559
|
+
const viewText = readText(options.view, options.viewFile);
|
|
3560
|
+
const view = viewText === void 0 ? void 0 : JSON.parse(viewText);
|
|
3561
|
+
const database = await getClient().databases.update({ id: options.id, name: options.name, view });
|
|
3562
|
+
if (useJson) outputDatabaseJson(database);
|
|
3563
|
+
else {
|
|
3564
|
+
console.log("\n\u2713 Database updated");
|
|
3565
|
+
outputDatabasePretty(database);
|
|
3566
|
+
}
|
|
3567
|
+
} catch (error) {
|
|
3568
|
+
handleError(error, useJson);
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3571
|
+
);
|
|
3572
|
+
databases.command("delete <id>").description("Delete a database and every row with it. Removing the block from the page only detaches; this is the delete.").requiredOption("--yes", "Confirm: the rows are pages and they go too").action(async (id, _options, cmd) => {
|
|
3573
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3574
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3575
|
+
try {
|
|
3576
|
+
const result = await getClient().databases.delete(id);
|
|
3577
|
+
if (useJson) console.log(JSON.stringify(result, null, 2));
|
|
3578
|
+
else console.log(`
|
|
3579
|
+
\u2713 Database ${result.id} deleted with ${result.rowCount} row${result.rowCount === 1 ? "" : "s"}
|
|
3580
|
+
`);
|
|
3581
|
+
} catch (error) {
|
|
3582
|
+
handleError(error, useJson);
|
|
3583
|
+
}
|
|
3584
|
+
});
|
|
3585
|
+
databases.addCommand(createPropertiesCommand());
|
|
3586
|
+
databases.addCommand(createRowsCommand());
|
|
3587
|
+
return databases;
|
|
3588
|
+
}
|
|
3589
|
+
function createPropertiesCommand() {
|
|
3590
|
+
const properties = new Command4("properties").description(
|
|
3591
|
+
"The schema: add, rename, retype, re-option, remove or reorder properties. Ids are stable \u2014 renaming never rewrites a row. A property is named by id or by name."
|
|
3592
|
+
);
|
|
3593
|
+
properties.command("add <databaseId>").description(`Add a property. Types: ${ADDABLE_TYPES.join(", ")} (title exists from creation; relation arrives with V3).`).requiredOption("--name <name>", "Property name").requiredOption("--type <type>", "Property type").option("--options <list>", 'select/multiSelect options, comma-separated; "Name:color" picks a palette colour').option("--description <text>", "What the property means").action(
|
|
3594
|
+
async (databaseId, options, cmd) => {
|
|
3595
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3596
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3597
|
+
try {
|
|
3598
|
+
const result = await getClient().databases.addProperty({
|
|
3599
|
+
id: databaseId,
|
|
3600
|
+
name: options.name,
|
|
3601
|
+
type: parsePropertyType(options.type),
|
|
3602
|
+
description: options.description,
|
|
3603
|
+
options: parseOptions(options.options)
|
|
3604
|
+
});
|
|
3605
|
+
if (useJson) console.log(JSON.stringify(result, null, 2));
|
|
3606
|
+
else {
|
|
3607
|
+
console.log(`
|
|
3608
|
+
\u2713 Property "${result.property.name}" (${result.property.type}) added \u2014 id ${result.property.id}`);
|
|
3609
|
+
outputDatabasePretty(result.database);
|
|
3610
|
+
}
|
|
3611
|
+
} catch (error) {
|
|
3612
|
+
handleError(error, useJson);
|
|
3613
|
+
}
|
|
3614
|
+
}
|
|
3615
|
+
);
|
|
3616
|
+
properties.command("update <databaseId> <property>").description('Rename, retype, re-option or describe a property. --options replaces the whole list; "id=Name" keeps an existing option under a new name.').option("--name <name>", "New name").option("--type <type>", "New type (not for the title property)").option("--options <list>", 'The full option list, comma-separated; prefix "optionId=" to keep an existing option').option("--description <text>", "New description").option("--clear-description", "Remove the description").action(
|
|
3617
|
+
async (databaseId, property, options, cmd) => {
|
|
3618
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3619
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3620
|
+
try {
|
|
3621
|
+
const parsedOptions = parseOptions(options.options)?.map((option) => {
|
|
3622
|
+
const at = option.name.indexOf("=");
|
|
3623
|
+
return at > 0 ? { ...option, id: option.name.slice(0, at).trim(), name: option.name.slice(at + 1).trim() } : option;
|
|
3624
|
+
});
|
|
3625
|
+
const result = await getClient().databases.updateProperty({
|
|
3626
|
+
id: databaseId,
|
|
3627
|
+
propertyId: property,
|
|
3628
|
+
name: options.name,
|
|
3629
|
+
type: options.type === void 0 ? void 0 : parsePropertyType(options.type),
|
|
3630
|
+
description: options.clearDescription ? null : options.description,
|
|
3631
|
+
options: parsedOptions
|
|
3632
|
+
});
|
|
3633
|
+
if (useJson) console.log(JSON.stringify(result, null, 2));
|
|
3634
|
+
else {
|
|
3635
|
+
console.log(`
|
|
3636
|
+
\u2713 Property "${result.property.name}" updated`);
|
|
3637
|
+
outputDatabasePretty(result.database);
|
|
3638
|
+
}
|
|
3639
|
+
} catch (error) {
|
|
3640
|
+
handleError(error, useJson);
|
|
3641
|
+
}
|
|
3642
|
+
}
|
|
3643
|
+
);
|
|
3644
|
+
properties.command("remove <databaseId> <property>").description("Remove a property from the schema and the view. Row values under it stay until each row is next written. The title property cannot be removed.").action(async (databaseId, property, _options, cmd) => {
|
|
3645
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3646
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3647
|
+
try {
|
|
3648
|
+
const database = await getClient().databases.removeProperty(databaseId, property);
|
|
3649
|
+
if (useJson) outputDatabaseJson(database);
|
|
3650
|
+
else {
|
|
3651
|
+
console.log("\n\u2713 Property removed");
|
|
3652
|
+
outputDatabasePretty(database);
|
|
3653
|
+
}
|
|
3654
|
+
} catch (error) {
|
|
3655
|
+
handleError(error, useJson);
|
|
3656
|
+
}
|
|
3657
|
+
});
|
|
3658
|
+
properties.command("reorder <databaseId> <propertyIds...>").description("Set the column order. List every property id exactly once (space- or comma-separated).").action(async (databaseId, propertyIds, _options, cmd) => {
|
|
3659
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3660
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3661
|
+
try {
|
|
3662
|
+
const ids = propertyIds.flatMap((part) => part.split(",")).map((s) => s.trim()).filter(Boolean);
|
|
3663
|
+
const database = await getClient().databases.reorderProperties(databaseId, ids);
|
|
3664
|
+
if (useJson) outputDatabaseJson(database);
|
|
3665
|
+
else {
|
|
3666
|
+
console.log("\n\u2713 Properties reordered");
|
|
3667
|
+
outputDatabasePretty(database);
|
|
3668
|
+
}
|
|
3669
|
+
} catch (error) {
|
|
3670
|
+
handleError(error, useJson);
|
|
3671
|
+
}
|
|
3672
|
+
});
|
|
3673
|
+
return properties;
|
|
3674
|
+
}
|
|
3675
|
+
function createRowsCommand() {
|
|
3676
|
+
const rows = new Command4("rows").description(
|
|
3677
|
+
`Rows: each is a page of the database. Write values with repeatable --set Property=value; read a row's body and history with "pages get <rowId>" / "pages history <rowId>".`
|
|
3678
|
+
);
|
|
3679
|
+
rows.command("list <databaseId>").description(
|
|
3680
|
+
'Rows through the saved view, or with your own --filter/--sort: "Status=Tracked", "Score>5", "Owner!=", "Name~latency", "Status in Tracked,Instrumenting".'
|
|
3681
|
+
).option("--filter <expr>", "Filter (repeatable); replaces the saved filters", collect, []).option("--sort <prop[:asc|desc]>", "Sort; replaces the saved sort").option("-l, --limit <n>", "Rows per page (1-200, default 50)").option("--cursor <cursor>", "Continue from a previous page (nextCursor)").action(
|
|
3682
|
+
async (databaseId, options, cmd) => {
|
|
3683
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3684
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3685
|
+
try {
|
|
3686
|
+
const client = getClient();
|
|
3687
|
+
const database = await client.databases.get(databaseId);
|
|
3688
|
+
const page = await client.databases.listRows(databaseId, {
|
|
3689
|
+
view: buildListView(database, options.filter, options.sort),
|
|
3690
|
+
limit: parseLimit(options.limit),
|
|
3691
|
+
cursor: options.cursor
|
|
3692
|
+
});
|
|
3693
|
+
if (useJson) console.log(JSON.stringify(page, null, 2));
|
|
3694
|
+
else outputRowsPretty(page, database);
|
|
3695
|
+
} catch (error) {
|
|
3696
|
+
handleError(error, useJson);
|
|
3697
|
+
}
|
|
3698
|
+
}
|
|
3699
|
+
);
|
|
3700
|
+
rows.command("add <databaseId>").description(
|
|
3701
|
+
'Add a row. --set Name="Alert latency" --set Status=Tracked (repeatable; property by name or id; a select by option name, lists comma-separated, dates ISO, checkboxes yes/no).'
|
|
3702
|
+
).option("--set <Property=value>", "A cell value (repeatable)", collect, []).option("-n, --note <text>", "Why: recorded on the row page's first revision").action(async (databaseId, options, cmd) => {
|
|
3703
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3704
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3705
|
+
try {
|
|
3706
|
+
const client = getClient();
|
|
3707
|
+
const row = await client.databases.createRow(databaseId, parseSet(options.set), { note: options.note });
|
|
3708
|
+
if (useJson) outputRowJson(row);
|
|
3709
|
+
else {
|
|
3710
|
+
console.log("\n\u2713 Row added");
|
|
3711
|
+
outputRowPretty(row, await client.databases.get(databaseId));
|
|
3712
|
+
}
|
|
3713
|
+
} catch (error) {
|
|
3714
|
+
handleError(error, useJson);
|
|
3715
|
+
}
|
|
3716
|
+
});
|
|
3717
|
+
rows.command("import <databaseId>").description(
|
|
3718
|
+
'Import a CSV: --csv file (or - for stdin). Columns map to properties by header name; --map "Col=Property", --new "Col=type" (or "Col=Name:type") and --skip Col override. --dry-run shows the typed preview and creates nothing. Rows with a cell that does not fit are reported and left out.'
|
|
3719
|
+
).requiredOption("--csv <file>", "The CSV file, or - for stdin").option("--map <Col=Property>", "Send a column to an existing property (repeatable)", collect, []).option("--new <Col=type>", "Create a property for a column (repeatable)", collect, []).option("--skip <Col>", "Leave a column out (repeatable)", collect, []).option("--dry-run", "Preview only: type every row, create nothing").option("-n, --note <text>", "Why: recorded on each new row's first revision").action(
|
|
3720
|
+
async (databaseId, options, cmd) => {
|
|
3721
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3722
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3723
|
+
try {
|
|
3724
|
+
const csv = readText(void 0, options.csv);
|
|
3725
|
+
if (!csv?.trim()) throw new Error("The CSV is empty");
|
|
3726
|
+
const client = getClient();
|
|
3727
|
+
const database = await client.databases.get(databaseId);
|
|
3728
|
+
const overrides = parseCsvMapping(database, options);
|
|
3729
|
+
const suggested = await client.databases.previewCsv(databaseId, csv);
|
|
3730
|
+
const mapping = { ...suggested.mapping, ...overrides };
|
|
3731
|
+
const preview = Object.keys(overrides).length > 0 ? await client.databases.previewCsv(databaseId, csv, mapping) : suggested;
|
|
3732
|
+
if (options.dryRun) {
|
|
3733
|
+
if (useJson) console.log(JSON.stringify(preview, null, 2));
|
|
3734
|
+
else outputCsvPreviewPretty(preview);
|
|
3735
|
+
return;
|
|
3736
|
+
}
|
|
3737
|
+
const result = await client.databases.commitCsv(databaseId, csv, mapping, { note: options.note });
|
|
3738
|
+
if (useJson) console.log(JSON.stringify(result, null, 2));
|
|
3739
|
+
else {
|
|
3740
|
+
console.log(`
|
|
3741
|
+
\u2713 Imported ${result.created.length} of ${result.total} row${result.total === 1 ? "" : "s"}`);
|
|
3742
|
+
for (const p of result.properties) console.log(` + property ${p.name} (${p.type})`);
|
|
3743
|
+
outputCsvSkipped(result.skipped);
|
|
3744
|
+
}
|
|
3745
|
+
} catch (error) {
|
|
3746
|
+
handleError(error, useJson);
|
|
3747
|
+
}
|
|
3748
|
+
}
|
|
3749
|
+
);
|
|
3750
|
+
rows.command("update <rowId>").description("Write some of a row's cells: --set Property=value (repeatable), --clear Property to empty one. Other cells are kept. Recorded in the row page's history.").option("--set <Property=value>", "A cell value (repeatable)", collect, []).option("--clear <Property>", "Empty a cell (repeatable)", collect, []).option("-n, --note <text>", "Why: shown in the row page's history").action(
|
|
3751
|
+
async (rowId, options, cmd) => {
|
|
3752
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3753
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3754
|
+
try {
|
|
3755
|
+
const values = parseSet(options.set, options.clear);
|
|
3756
|
+
if (Object.keys(values).length === 0) {
|
|
3757
|
+
throw new Error("Nothing to write: pass at least one --set Property=value or --clear Property");
|
|
3758
|
+
}
|
|
3759
|
+
const client = getClient();
|
|
3760
|
+
const row = await client.databases.updateRow(rowId, values, { note: options.note });
|
|
3761
|
+
if (useJson) outputRowJson(row);
|
|
3762
|
+
else {
|
|
3763
|
+
console.log("\n\u2713 Row updated");
|
|
3764
|
+
outputRowPretty(row, row.databaseId ? await client.databases.get(row.databaseId) : void 0);
|
|
3765
|
+
}
|
|
3766
|
+
} catch (error) {
|
|
3767
|
+
handleError(error, useJson);
|
|
3768
|
+
}
|
|
3769
|
+
}
|
|
3770
|
+
);
|
|
3771
|
+
rows.command("delete <rowId>").description("Delete a row (the page and its search chunks)").requiredOption("--yes", "Confirm").action(async (rowId, _options, cmd) => {
|
|
3772
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3773
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3774
|
+
try {
|
|
3775
|
+
const result = await getClient().databases.deleteRow(rowId);
|
|
3776
|
+
if (useJson) console.log(JSON.stringify(result, null, 2));
|
|
3777
|
+
else console.log(`
|
|
3778
|
+
\u2713 Row ${result.id} deleted
|
|
3779
|
+
`);
|
|
3780
|
+
} catch (error) {
|
|
3781
|
+
handleError(error, useJson);
|
|
3782
|
+
}
|
|
3783
|
+
});
|
|
3784
|
+
return rows;
|
|
3785
|
+
}
|
|
3786
|
+
|
|
3235
3787
|
// src/commands/decisions.ts
|
|
3788
|
+
import { Command as Command5 } from "commander";
|
|
3789
|
+
import chalk5 from "chalk";
|
|
3236
3790
|
var STATUSES = [
|
|
3237
3791
|
"OPEN",
|
|
3238
3792
|
"PROPOSED",
|
|
@@ -3480,7 +4034,7 @@ function addConfirmCommand(parent) {
|
|
|
3480
4034
|
);
|
|
3481
4035
|
}
|
|
3482
4036
|
function createDecisionsCommand() {
|
|
3483
|
-
const decisions = new
|
|
4037
|
+
const decisions = new Command5("decisions").description(
|
|
3484
4038
|
[
|
|
3485
4039
|
"Log and manage decisions and open questions (the workspace Decision Log).",
|
|
3486
4040
|
"",
|
|
@@ -3531,7 +4085,7 @@ function createDecisionsCommand() {
|
|
|
3531
4085
|
outputDecisionsPretty(rows2);
|
|
3532
4086
|
if (!result.canLogDecision) {
|
|
3533
4087
|
console.log(
|
|
3534
|
-
|
|
4088
|
+
chalk5.yellow(
|
|
3535
4089
|
"You cannot log decisions on this meeting (no edit access, or it has no workspace)."
|
|
3536
4090
|
)
|
|
3537
4091
|
);
|
|
@@ -3731,7 +4285,7 @@ function createDecisionsCommand() {
|
|
|
3731
4285
|
\u2713 ${decision.status === "OPEN" ? "Open question" : "Decision"} logged`
|
|
3732
4286
|
);
|
|
3733
4287
|
outputDecisionPretty(decision);
|
|
3734
|
-
if (featureLink) console.log(
|
|
4288
|
+
if (featureLink) console.log(chalk5.gray(` Linked to feature ${options.feature}`));
|
|
3735
4289
|
}
|
|
3736
4290
|
} catch (error) {
|
|
3737
4291
|
handleError(error, useJson);
|
|
@@ -3840,9 +4394,9 @@ function createDecisionsCommand() {
|
|
|
3840
4394
|
const link = options.ticket ? await client.decisions.linkTicket(workspaceId, decisionId, options.ticket) : await client.decisions.linkFeature(workspaceId, decisionId, options.feature);
|
|
3841
4395
|
if (useJson) console.log(JSON.stringify(link, null, 2));
|
|
3842
4396
|
else {
|
|
3843
|
-
console.log(`\u2713 Linked ${
|
|
4397
|
+
console.log(`\u2713 Linked ${chalk5.gray(`(link id ${link.id})`)}`);
|
|
3844
4398
|
console.log(
|
|
3845
|
-
|
|
4399
|
+
chalk5.gray(" Remove it with: exponential decisions unlink --link " + link.id)
|
|
3846
4400
|
);
|
|
3847
4401
|
}
|
|
3848
4402
|
} catch (error) {
|
|
@@ -3865,7 +4419,7 @@ function createDecisionsCommand() {
|
|
|
3865
4419
|
handleError(error, useJson);
|
|
3866
4420
|
}
|
|
3867
4421
|
});
|
|
3868
|
-
const drafts = new
|
|
4422
|
+
const drafts = new Command5("draft").description(
|
|
3869
4423
|
"Review decisions an agent proposed but nobody has confirmed yet (visible only on their source meeting)"
|
|
3870
4424
|
);
|
|
3871
4425
|
drafts.command("extract").description(
|
|
@@ -3880,22 +4434,22 @@ function createDecisionsCommand() {
|
|
|
3880
4434
|
else {
|
|
3881
4435
|
if (result.alreadyPublished) {
|
|
3882
4436
|
console.log(
|
|
3883
|
-
|
|
4437
|
+
chalk5.gray("This meeting already has confirmed decisions \u2014 nothing was extracted.")
|
|
3884
4438
|
);
|
|
3885
4439
|
} else if (result.alreadyDrafted) {
|
|
3886
|
-
console.log(
|
|
4440
|
+
console.log(chalk5.gray("Returning the drafts this meeting already had."));
|
|
3887
4441
|
}
|
|
3888
4442
|
console.log(
|
|
3889
4443
|
`\u2713 ${result.draftCount} draft${result.draftCount === 1 ? "" : "s"} awaiting review (${result.draftsCreated} new)`
|
|
3890
4444
|
);
|
|
3891
4445
|
if (result.discardedWithoutEvidence > 0) {
|
|
3892
4446
|
console.log(
|
|
3893
|
-
|
|
4447
|
+
chalk5.gray(
|
|
3894
4448
|
` ${result.discardedWithoutEvidence} candidate(s) dropped \u2014 no transcript turn supported them.`
|
|
3895
4449
|
)
|
|
3896
4450
|
);
|
|
3897
4451
|
}
|
|
3898
|
-
for (const message of result.errors) console.log(
|
|
4452
|
+
for (const message of result.errors) console.log(chalk5.yellow(` ${message}`));
|
|
3899
4453
|
}
|
|
3900
4454
|
} catch (error) {
|
|
3901
4455
|
handleError(error, useJson);
|
|
@@ -3952,9 +4506,9 @@ function createDecisionsCommand() {
|
|
|
3952
4506
|
}
|
|
3953
4507
|
|
|
3954
4508
|
// src/commands/deals.ts
|
|
3955
|
-
import { Command as
|
|
4509
|
+
import { Command as Command6 } from "commander";
|
|
3956
4510
|
function createDealsCommand() {
|
|
3957
|
-
const deals = new
|
|
4511
|
+
const deals = new Command6("deals").description("Manage pipeline deals");
|
|
3958
4512
|
deals.command("pipeline").description("Get pipeline overview with stages").requiredOption("--workspace <id>", "Workspace ID").action(async (options, cmd) => {
|
|
3959
4513
|
const globalOpts = cmd.optsWithGlobals();
|
|
3960
4514
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -4139,7 +4693,7 @@ function createDealsCommand() {
|
|
|
4139
4693
|
}
|
|
4140
4694
|
|
|
4141
4695
|
// src/commands/epics.ts
|
|
4142
|
-
import { Command as
|
|
4696
|
+
import { Command as Command7 } from "commander";
|
|
4143
4697
|
var EPIC_STATUSES = ["OPEN", "IN_PROGRESS", "DONE", "CANCELLED"];
|
|
4144
4698
|
var EPIC_PRIORITIES = ["HIGH", "MEDIUM", "LOW", "NONE"];
|
|
4145
4699
|
function validateEpicStatus(value) {
|
|
@@ -4167,7 +4721,7 @@ function parseDate2(value) {
|
|
|
4167
4721
|
return d;
|
|
4168
4722
|
}
|
|
4169
4723
|
function createEpicsCommand() {
|
|
4170
|
-
const epics = new
|
|
4724
|
+
const epics = new Command7("epics").description(
|
|
4171
4725
|
"Manage epics. Epics are workspace-scoped and group actions and tickets across products."
|
|
4172
4726
|
);
|
|
4173
4727
|
epics.command("list").description("List epics in a workspace").option("--workspace <slug|id>", "Workspace slug or CUID").option("--status <status>", `Filter by status: ${EPIC_STATUSES.join(", ")}`).action(
|
|
@@ -4284,10 +4838,10 @@ function createEpicsCommand() {
|
|
|
4284
4838
|
}
|
|
4285
4839
|
|
|
4286
4840
|
// src/commands/features.ts
|
|
4287
|
-
import { Command as
|
|
4841
|
+
import { Command as Command13 } from "commander";
|
|
4288
4842
|
|
|
4289
4843
|
// src/commands/stories.ts
|
|
4290
|
-
import { Command as
|
|
4844
|
+
import { Command as Command8 } from "commander";
|
|
4291
4845
|
async function readStdin() {
|
|
4292
4846
|
const chunks = [];
|
|
4293
4847
|
for await (const chunk of process.stdin) {
|
|
@@ -4296,7 +4850,7 @@ async function readStdin() {
|
|
|
4296
4850
|
return Buffer.concat(chunks).toString("utf-8");
|
|
4297
4851
|
}
|
|
4298
4852
|
function createStoriesCommand() {
|
|
4299
|
-
const stories = new
|
|
4853
|
+
const stories = new Command8("stories").description(
|
|
4300
4854
|
"Manage a feature's native, structured user stories (As a / I want / So that)."
|
|
4301
4855
|
);
|
|
4302
4856
|
stories.command("add").description(
|
|
@@ -4430,7 +4984,7 @@ function createStoriesCommand() {
|
|
|
4430
4984
|
}
|
|
4431
4985
|
|
|
4432
4986
|
// src/commands/scopes.ts
|
|
4433
|
-
import { Command as
|
|
4987
|
+
import { Command as Command9 } from "commander";
|
|
4434
4988
|
var SCOPE_STATUSES = [
|
|
4435
4989
|
"PLANNED",
|
|
4436
4990
|
"IN_PROGRESS",
|
|
@@ -4447,7 +5001,7 @@ function validateScopeStatus(value) {
|
|
|
4447
5001
|
return value;
|
|
4448
5002
|
}
|
|
4449
5003
|
function createScopesCommand() {
|
|
4450
|
-
const scopes = new
|
|
5004
|
+
const scopes = new Command9("scopes").description(
|
|
4451
5005
|
`Manage a feature's scopes: shippable increments ("V1", "V2"), each with its own lifecycle.`
|
|
4452
5006
|
);
|
|
4453
5007
|
scopes.command("list").description("List a feature's scopes").requiredOption("--feature <id>", "Feature CUID").action(
|
|
@@ -4526,7 +5080,7 @@ function createScopesCommand() {
|
|
|
4526
5080
|
}
|
|
4527
5081
|
|
|
4528
5082
|
// src/commands/requirements.ts
|
|
4529
|
-
import { Command as
|
|
5083
|
+
import { Command as Command10 } from "commander";
|
|
4530
5084
|
var REQUIREMENT_KINDS = [
|
|
4531
5085
|
"FUNCTIONAL",
|
|
4532
5086
|
"NON_FUNCTIONAL",
|
|
@@ -4549,7 +5103,7 @@ async function readStdin2() {
|
|
|
4549
5103
|
return Buffer.concat(chunks).toString("utf-8");
|
|
4550
5104
|
}
|
|
4551
5105
|
function createRequirementsCommand() {
|
|
4552
|
-
const requirements = new
|
|
5106
|
+
const requirements = new Command10("requirements").description(
|
|
4553
5107
|
`Manage a feature's requirements: atomic, testable EARS-style "shall" statements, checkable met/unmet.`
|
|
4554
5108
|
);
|
|
4555
5109
|
requirements.command("add").description(
|
|
@@ -4680,25 +5234,25 @@ function createRequirementsCommand() {
|
|
|
4680
5234
|
}
|
|
4681
5235
|
|
|
4682
5236
|
// src/commands/areas.ts
|
|
4683
|
-
import { Command as
|
|
4684
|
-
import
|
|
5237
|
+
import { Command as Command11 } from "commander";
|
|
5238
|
+
import chalk6 from "chalk";
|
|
4685
5239
|
function outputAreasPretty(areas) {
|
|
4686
5240
|
if (areas.length === 0) {
|
|
4687
|
-
console.log(
|
|
5241
|
+
console.log(chalk6.gray("No areas found."));
|
|
4688
5242
|
return;
|
|
4689
5243
|
}
|
|
4690
|
-
console.log(
|
|
5244
|
+
console.log(chalk6.bold(`
|
|
4691
5245
|
Areas (${areas.length} total)`));
|
|
4692
|
-
console.log(
|
|
5246
|
+
console.log(chalk6.gray("\u2500".repeat(50)));
|
|
4693
5247
|
for (const a of areas) {
|
|
4694
|
-
const count = a._count?.features != null ?
|
|
4695
|
-
console.log(` ${
|
|
4696
|
-
console.log(
|
|
5248
|
+
const count = a._count?.features != null ? chalk6.gray(` (${a._count.features} features)`) : "";
|
|
5249
|
+
console.log(` ${chalk6.bold(a.name)}${count}`);
|
|
5250
|
+
console.log(chalk6.gray(` ID: ${a.id}`));
|
|
4697
5251
|
}
|
|
4698
5252
|
console.log();
|
|
4699
5253
|
}
|
|
4700
5254
|
function createAreasCommand() {
|
|
4701
|
-
const areas = new
|
|
5255
|
+
const areas = new Command11("areas").description(
|
|
4702
5256
|
"Manage a product's areas: the buckets features are filed under (a feature has exactly one or none)."
|
|
4703
5257
|
);
|
|
4704
5258
|
areas.command("list").description("List a product's areas").requiredOption("--product <slug|id>", "Product slug or CUID").option("--workspace <slug|id>", "Workspace (required when --product is a slug)").action(
|
|
@@ -4742,7 +5296,7 @@ function createAreasCommand() {
|
|
|
4742
5296
|
}
|
|
4743
5297
|
|
|
4744
5298
|
// src/commands/featureComments.ts
|
|
4745
|
-
import { Command as
|
|
5299
|
+
import { Command as Command12 } from "commander";
|
|
4746
5300
|
|
|
4747
5301
|
// src/utils/mentions.ts
|
|
4748
5302
|
function candidateLabels(member) {
|
|
@@ -4815,7 +5369,7 @@ function collectMention(value, previous) {
|
|
|
4815
5369
|
|
|
4816
5370
|
// src/commands/featureComments.ts
|
|
4817
5371
|
function createFeatureCommentsCommand() {
|
|
4818
|
-
const comment = new
|
|
5372
|
+
const comment = new Command12("comment").description(
|
|
4819
5373
|
"Read and post comments on a feature. Mention teammates with --mention."
|
|
4820
5374
|
);
|
|
4821
5375
|
comment.command("list").description("List comments on a feature").requiredOption("--feature <id>", "Feature ID").action(async (options, cmd) => {
|
|
@@ -5016,7 +5570,7 @@ function validateFeatureStatus(value) {
|
|
|
5016
5570
|
return value;
|
|
5017
5571
|
}
|
|
5018
5572
|
function createFeaturesCommand() {
|
|
5019
|
-
const features = new
|
|
5573
|
+
const features = new Command13("features").description(
|
|
5020
5574
|
"Manage features. A feature lives under a product and groups user stories, scopes, and tickets."
|
|
5021
5575
|
);
|
|
5022
5576
|
features.command("list").description("List features in a product").requiredOption("--product <slug|id>", "Product slug or CUID").option("--workspace <slug|id>", "Workspace (required when --product is a slug)").option("--status <status>", `Filter by status: ${FEATURE_STATUSES.join(", ")}`).action(
|
|
@@ -5273,8 +5827,8 @@ Aborted: ${reason}. Feature "${feature.name}" was NOT deleted.`);
|
|
|
5273
5827
|
}
|
|
5274
5828
|
|
|
5275
5829
|
// src/commands/labels.ts
|
|
5276
|
-
import { Command as
|
|
5277
|
-
import
|
|
5830
|
+
import { Command as Command14 } from "commander";
|
|
5831
|
+
import chalk7 from "chalk";
|
|
5278
5832
|
var TRIAGE_LABELS = [
|
|
5279
5833
|
{ slug: "needs-triage", name: "needs-triage", color: "avatar-orange" },
|
|
5280
5834
|
{ slug: "needs-info", name: "needs-info", color: "avatar-yellow" },
|
|
@@ -5288,22 +5842,22 @@ function looksLikeCuid(value) {
|
|
|
5288
5842
|
}
|
|
5289
5843
|
function outputTagsPretty(tags) {
|
|
5290
5844
|
if (tags.length === 0) {
|
|
5291
|
-
console.log(
|
|
5845
|
+
console.log(chalk7.dim("No labels found."));
|
|
5292
5846
|
return;
|
|
5293
5847
|
}
|
|
5294
5848
|
console.log();
|
|
5295
5849
|
for (const tag of tags) {
|
|
5296
|
-
const scope = tag.workspaceId === null ?
|
|
5297
|
-
const category = tag.category === null ?
|
|
5850
|
+
const scope = tag.workspaceId === null ? chalk7.cyan("global") : chalk7.magenta("workspace");
|
|
5851
|
+
const category = tag.category === null ? chalk7.dim("(label)") : chalk7.dim(`(${tag.category})`);
|
|
5298
5852
|
console.log(
|
|
5299
|
-
` ${
|
|
5853
|
+
` ${chalk7.bold(tag.slug)} ${tag.name} ${chalk7.gray(tag.color)} ${scope} ${category}`
|
|
5300
5854
|
);
|
|
5301
5855
|
}
|
|
5302
5856
|
console.log();
|
|
5303
5857
|
}
|
|
5304
5858
|
function outputTagPretty(tag, prefix) {
|
|
5305
5859
|
if (prefix) console.log(prefix);
|
|
5306
|
-
console.log(` ${
|
|
5860
|
+
console.log(` ${chalk7.bold(tag.slug)} ${tag.name} ${chalk7.gray(tag.color)}`);
|
|
5307
5861
|
}
|
|
5308
5862
|
async function resolveLabelIds(client, workspaceId, values) {
|
|
5309
5863
|
if (values.length === 0) return [];
|
|
@@ -5327,7 +5881,7 @@ async function resolveLabelIds(client, workspaceId, values) {
|
|
|
5327
5881
|
return [...byId, ...resolvedFromSlugs];
|
|
5328
5882
|
}
|
|
5329
5883
|
function createLabelsCommand() {
|
|
5330
|
-
const labels = new
|
|
5884
|
+
const labels = new Command14("labels").description(
|
|
5331
5885
|
"Manage labels (orthogonal tags applied to actions, tickets, features, and epics)."
|
|
5332
5886
|
);
|
|
5333
5887
|
labels.command("list").description("List labels visible in a workspace").option("--workspace <slug|id>", "Workspace slug or CUID").option(
|
|
@@ -5375,7 +5929,7 @@ function createLabelsCommand() {
|
|
|
5375
5929
|
if (useJson) {
|
|
5376
5930
|
console.log(JSON.stringify(tag, null, 2));
|
|
5377
5931
|
} else {
|
|
5378
|
-
outputTagPretty(tag,
|
|
5932
|
+
outputTagPretty(tag, chalk7.green("\n\u2713 Label created"));
|
|
5379
5933
|
}
|
|
5380
5934
|
} catch (error) {
|
|
5381
5935
|
handleError(error, useJson);
|
|
@@ -5413,10 +5967,10 @@ function createLabelsCommand() {
|
|
|
5413
5967
|
console.log(JSON.stringify(results, null, 2));
|
|
5414
5968
|
} else {
|
|
5415
5969
|
console.log();
|
|
5416
|
-
console.log(
|
|
5970
|
+
console.log(chalk7.bold("Triage labels:"));
|
|
5417
5971
|
for (const r of results) {
|
|
5418
|
-
const tag =
|
|
5419
|
-
const status = r.status === "created" ?
|
|
5972
|
+
const tag = chalk7.bold(r.slug);
|
|
5973
|
+
const status = r.status === "created" ? chalk7.green("created") : chalk7.dim("existed");
|
|
5420
5974
|
console.log(` ${tag} ${status}`);
|
|
5421
5975
|
}
|
|
5422
5976
|
console.log();
|
|
@@ -5430,10 +5984,10 @@ function createLabelsCommand() {
|
|
|
5430
5984
|
}
|
|
5431
5985
|
|
|
5432
5986
|
// src/commands/meetings.ts
|
|
5433
|
-
import { Command as
|
|
5434
|
-
import
|
|
5987
|
+
import { Command as Command15 } from "commander";
|
|
5988
|
+
import chalk8 from "chalk";
|
|
5435
5989
|
function createMeetingsCommand() {
|
|
5436
|
-
const meetings = new
|
|
5990
|
+
const meetings = new Command15("meetings").description(
|
|
5437
5991
|
"Manage meetings and their notes (recorded, imported, or manually created)"
|
|
5438
5992
|
);
|
|
5439
5993
|
meetings.command("list").description(
|
|
@@ -5594,7 +6148,7 @@ function createMeetingsCommand() {
|
|
|
5594
6148
|
console.log(`\u2713 Deleted ${count} of ${ids.length} meeting${ids.length === 1 ? "" : "s"}`);
|
|
5595
6149
|
if (skipped > 0) {
|
|
5596
6150
|
console.log(
|
|
5597
|
-
|
|
6151
|
+
chalk8.yellow(
|
|
5598
6152
|
`${skipped} id(s) were skipped \u2014 not found, or not owned by you.`
|
|
5599
6153
|
)
|
|
5600
6154
|
);
|
|
@@ -5605,7 +6159,7 @@ function createMeetingsCommand() {
|
|
|
5605
6159
|
}
|
|
5606
6160
|
}
|
|
5607
6161
|
);
|
|
5608
|
-
const notes = new
|
|
6162
|
+
const notes = new Command15("notes").description(
|
|
5609
6163
|
"Read and write a meeting's notes"
|
|
5610
6164
|
);
|
|
5611
6165
|
notes.command("get <id>").description(
|
|
@@ -5621,7 +6175,7 @@ function createMeetingsCommand() {
|
|
|
5621
6175
|
process.stdout.write(body.endsWith("\n") ? body : `${body}
|
|
5622
6176
|
`);
|
|
5623
6177
|
} else if (process.stdout.isTTY) {
|
|
5624
|
-
console.log(
|
|
6178
|
+
console.log(chalk8.gray("No notes yet."));
|
|
5625
6179
|
}
|
|
5626
6180
|
} catch (error) {
|
|
5627
6181
|
handleError(error, shouldUseJson(globalOpts.json, globalOpts.pretty));
|
|
@@ -5670,7 +6224,7 @@ function createMeetingsCommand() {
|
|
|
5670
6224
|
}
|
|
5671
6225
|
|
|
5672
6226
|
// src/commands/organizations.ts
|
|
5673
|
-
import { Command as
|
|
6227
|
+
import { Command as Command16 } from "commander";
|
|
5674
6228
|
var VALID_SIZES = [
|
|
5675
6229
|
"1-10",
|
|
5676
6230
|
"11-50",
|
|
@@ -5680,7 +6234,7 @@ var VALID_SIZES = [
|
|
|
5680
6234
|
"1000+"
|
|
5681
6235
|
];
|
|
5682
6236
|
function createOrganizationsCommand() {
|
|
5683
|
-
const organizations = new
|
|
6237
|
+
const organizations = new Command16("organizations").alias("orgs").description("Manage CRM organizations");
|
|
5684
6238
|
organizations.command("list").description("List organizations").requiredOption("--workspace <id>", "Workspace ID").option("--search <query>", "Search by name or description").option("--industry <industry>", "Filter by industry").option("--limit <n>", "Max results to return", parseInt).option("--cursor <cursor>", "Pagination cursor").action(async (options, cmd) => {
|
|
5685
6239
|
const globalOpts = cmd.optsWithGlobals();
|
|
5686
6240
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -5748,13 +6302,13 @@ function createOrganizationsCommand() {
|
|
|
5748
6302
|
}
|
|
5749
6303
|
|
|
5750
6304
|
// src/commands/pages.ts
|
|
5751
|
-
import { Command as
|
|
5752
|
-
import
|
|
6305
|
+
import { Command as Command18 } from "commander";
|
|
6306
|
+
import chalk9 from "chalk";
|
|
5753
6307
|
|
|
5754
6308
|
// src/commands/pageComments.ts
|
|
5755
|
-
import { Command as
|
|
6309
|
+
import { Command as Command17 } from "commander";
|
|
5756
6310
|
function createPageCommentsCommand() {
|
|
5757
|
-
const comment = new
|
|
6311
|
+
const comment = new Command17("comment").description(
|
|
5758
6312
|
"Read and post comments on a page. Mention teammates with --mention."
|
|
5759
6313
|
);
|
|
5760
6314
|
comment.command("list").description("List comments on a page").requiredOption("--page <id>", "Page ID").action(async (options, cmd) => {
|
|
@@ -5848,7 +6402,7 @@ function createPageCommentsCommand() {
|
|
|
5848
6402
|
}
|
|
5849
6403
|
|
|
5850
6404
|
// src/commands/pages.ts
|
|
5851
|
-
function
|
|
6405
|
+
function parseLimit2(value) {
|
|
5852
6406
|
if (value === void 0) return void 0;
|
|
5853
6407
|
const n = Number(value);
|
|
5854
6408
|
if (!Number.isInteger(n) || n < 1) {
|
|
@@ -5857,7 +6411,7 @@ function parseLimit(value) {
|
|
|
5857
6411
|
return n;
|
|
5858
6412
|
}
|
|
5859
6413
|
function createPagesCommand() {
|
|
5860
|
-
const pages = new
|
|
6414
|
+
const pages = new Command18("pages").description(
|
|
5861
6415
|
`Manage Knowledge pages (PRDs, research, technical specs). Reads are Markdown-only by default; every write is recorded in the page's history. Link one to a feature with "features link-page".`
|
|
5862
6416
|
);
|
|
5863
6417
|
pages.command("list").description("List pages in a workspace (metadata only, no bodies)").option("--workspace <slug|id>", "Workspace (defaults to the configured default)").option(
|
|
@@ -5894,7 +6448,7 @@ function createPagesCommand() {
|
|
|
5894
6448
|
workspaceId,
|
|
5895
6449
|
query,
|
|
5896
6450
|
projectId: options.project,
|
|
5897
|
-
limit:
|
|
6451
|
+
limit: parseLimit2(options.limit)
|
|
5898
6452
|
});
|
|
5899
6453
|
if (useJson) console.log(JSON.stringify(result, null, 2));
|
|
5900
6454
|
else outputPageSearchPretty(result);
|
|
@@ -5987,7 +6541,7 @@ function createPagesCommand() {
|
|
|
5987
6541
|
try {
|
|
5988
6542
|
const client = getClient();
|
|
5989
6543
|
const history = await client.pages.history(id, {
|
|
5990
|
-
limit:
|
|
6544
|
+
limit: parseLimit2(options.limit),
|
|
5991
6545
|
cursor: options.cursor
|
|
5992
6546
|
});
|
|
5993
6547
|
if (useJson) console.log(JSON.stringify(history, null, 2));
|
|
@@ -6006,13 +6560,13 @@ function createPagesCommand() {
|
|
|
6006
6560
|
const revision = await client.pages.revision(id, revisionId);
|
|
6007
6561
|
if (useJson) console.log(JSON.stringify(revision, null, 2));
|
|
6008
6562
|
else {
|
|
6009
|
-
console.log(
|
|
6563
|
+
console.log(chalk9.gray("\u2500".repeat(50)));
|
|
6010
6564
|
console.log(
|
|
6011
6565
|
`
|
|
6012
|
-
${
|
|
6566
|
+
${chalk9.bold(revision.title)} ${chalk9.gray(`v${revision.docVersion} \xB7 ${revision.kind}`)}`
|
|
6013
6567
|
);
|
|
6014
|
-
console.log(
|
|
6015
|
-
if (revision.note) console.log(` ${
|
|
6568
|
+
console.log(chalk9.gray(` Revision: ${revision.id}`));
|
|
6569
|
+
if (revision.note) console.log(` ${chalk9.gray("Note:")} ${revision.note}`);
|
|
6016
6570
|
if (revision.body) console.log(`
|
|
6017
6571
|
${revision.body}
|
|
6018
6572
|
`);
|
|
@@ -6084,9 +6638,9 @@ ${revision.body}
|
|
|
6084
6638
|
}
|
|
6085
6639
|
|
|
6086
6640
|
// src/commands/products.ts
|
|
6087
|
-
import { Command as
|
|
6641
|
+
import { Command as Command19 } from "commander";
|
|
6088
6642
|
function createProductsCommand() {
|
|
6089
|
-
const products = new
|
|
6643
|
+
const products = new Command19("products").description(
|
|
6090
6644
|
"Manage products. A workspace contains products; a product holds features and tickets."
|
|
6091
6645
|
);
|
|
6092
6646
|
products.command("list").description("List products in a workspace").option("--workspace <slug|id>", "Workspace slug or CUID (defaults to configured workspace)").action(async (options, cmd) => {
|
|
@@ -6227,7 +6781,7 @@ Re-run with --force to delete it anyway.`
|
|
|
6227
6781
|
}
|
|
6228
6782
|
|
|
6229
6783
|
// src/commands/projects.ts
|
|
6230
|
-
import { Command as
|
|
6784
|
+
import { Command as Command20 } from "commander";
|
|
6231
6785
|
var PROJECT_STATUSES = [
|
|
6232
6786
|
"ACTIVE",
|
|
6233
6787
|
"ON_HOLD",
|
|
@@ -6254,7 +6808,7 @@ function validateProjectPriority(value) {
|
|
|
6254
6808
|
return value;
|
|
6255
6809
|
}
|
|
6256
6810
|
function createProjectsCommand() {
|
|
6257
|
-
const projects = new
|
|
6811
|
+
const projects = new Command20("projects").description("Manage projects");
|
|
6258
6812
|
projects.command("list").description("List all projects").option("--workspace <slug|id>", "Workspace slug or CUID").option("--include-actions", "Include actions in output").action(async (options, cmd) => {
|
|
6259
6813
|
const globalOpts = cmd.optsWithGlobals();
|
|
6260
6814
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -6373,7 +6927,7 @@ Re-run with --force to delete it anyway.`
|
|
|
6373
6927
|
}
|
|
6374
6928
|
|
|
6375
6929
|
// src/commands/resources.ts
|
|
6376
|
-
import { Command as
|
|
6930
|
+
import { Command as Command21 } from "commander";
|
|
6377
6931
|
var STATUS_FILTERS = ["unread", "to_read", "reading", "read", "all"];
|
|
6378
6932
|
function validateStatus(value) {
|
|
6379
6933
|
const v = value ?? "unread";
|
|
@@ -6388,7 +6942,7 @@ function collectTags(value, previous) {
|
|
|
6388
6942
|
}
|
|
6389
6943
|
var TAG_OPTION = "--tag <tag>";
|
|
6390
6944
|
function createResourcesCommand() {
|
|
6391
|
-
const resources = new
|
|
6945
|
+
const resources = new Command21("resources").description(
|
|
6392
6946
|
"Saved links and reference material. `list` defaults to the Reading list (unread); `create --url` saves a link to read later."
|
|
6393
6947
|
);
|
|
6394
6948
|
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(TAG_OPTION, "Only resources with this tag (repeatable or comma-separated; matches any)", collectTags, []).option("--limit <n>", "Max rows (default 50)", "50").action(
|
|
@@ -6495,7 +7049,7 @@ function createResourcesCommand() {
|
|
|
6495
7049
|
}
|
|
6496
7050
|
|
|
6497
7051
|
// src/commands/runner.ts
|
|
6498
|
-
import { Command as
|
|
7052
|
+
import { Command as Command22 } from "commander";
|
|
6499
7053
|
import { hostname, homedir as homedir2, tmpdir as tmpdir2 } from "os";
|
|
6500
7054
|
import { execFileSync } from "child_process";
|
|
6501
7055
|
import { mkdirSync as mkdirSync3 } from "fs";
|
|
@@ -6947,7 +7501,7 @@ function removeServiceFile(plan) {
|
|
|
6947
7501
|
|
|
6948
7502
|
// src/commands/runner.ts
|
|
6949
7503
|
function createRunnerCommand() {
|
|
6950
|
-
const cmd = new
|
|
7504
|
+
const cmd = new Command22("runner").description(
|
|
6951
7505
|
"Run your Assistant locally: claim its queued runs and work them with Claude Code on this machine"
|
|
6952
7506
|
);
|
|
6953
7507
|
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) => {
|
|
@@ -7058,8 +7612,8 @@ ${plan.contents}
|
|
|
7058
7612
|
}
|
|
7059
7613
|
|
|
7060
7614
|
// src/commands/search.ts
|
|
7061
|
-
import { Command as
|
|
7062
|
-
import
|
|
7615
|
+
import { Command as Command23 } from "commander";
|
|
7616
|
+
import chalk10 from "chalk";
|
|
7063
7617
|
var KNOWLEDGE_TYPES = ["transcription", "resource", "document", "page"];
|
|
7064
7618
|
function parseTypes(value) {
|
|
7065
7619
|
if (!value) return void 0;
|
|
@@ -7088,7 +7642,7 @@ var TYPE_LABELS = {
|
|
|
7088
7642
|
product: "Products"
|
|
7089
7643
|
};
|
|
7090
7644
|
function createSearchCommand() {
|
|
7091
|
-
const search = new
|
|
7645
|
+
const search = new Command23("search").description(
|
|
7092
7646
|
"Global search across projects, actions, goals, workspaces and more \u2014 same coverage as the app's Cmd+K palette. Matches titles; add --semantic to search meetings, resources, documents and pages by meaning."
|
|
7093
7647
|
).argument("<query>", "Text to search for").option("-w, --workspace <slug>", "Restrict results to one workspace (slug or ID; required with --semantic)").option("-l, --limit <n>", "Max results per entity type (1-25, default 10; 1-20 with --semantic)").option("--semantic", "Search the Knowledge index by meaning instead of matching titles").option("--types <list>", "With --semantic: comma-separated source kinds (transcription,resource,document,page)").action(async (query, options, cmd) => {
|
|
7094
7648
|
const globalOpts = cmd.optsWithGlobals();
|
|
@@ -7102,10 +7656,10 @@ function createSearchCommand() {
|
|
|
7102
7656
|
(w) => w.slug === options.workspace || w.id === options.workspace
|
|
7103
7657
|
);
|
|
7104
7658
|
if (!match) {
|
|
7105
|
-
console.error(
|
|
7106
|
-
console.log(
|
|
7659
|
+
console.error(chalk10.red(`Workspace "${options.workspace}" not found.`));
|
|
7660
|
+
console.log(chalk10.gray("Available workspaces:"));
|
|
7107
7661
|
workspaces.forEach((w) => {
|
|
7108
|
-
console.log(
|
|
7662
|
+
console.log(chalk10.gray(` - ${w.slug} (${w.name})`));
|
|
7109
7663
|
});
|
|
7110
7664
|
process.exit(1);
|
|
7111
7665
|
}
|
|
@@ -7127,16 +7681,16 @@ function createSearchCommand() {
|
|
|
7127
7681
|
return;
|
|
7128
7682
|
}
|
|
7129
7683
|
if (knowledge.results.length === 0) {
|
|
7130
|
-
console.log(
|
|
7684
|
+
console.log(chalk10.gray(`Nothing about "${knowledge.query}" in the Knowledge index.`));
|
|
7131
7685
|
return;
|
|
7132
7686
|
}
|
|
7133
|
-
console.log(
|
|
7687
|
+
console.log(chalk10.bold(`
|
|
7134
7688
|
About "${knowledge.query}"`));
|
|
7135
7689
|
for (const row of knowledge.results) {
|
|
7136
7690
|
console.log(
|
|
7137
|
-
` ${
|
|
7691
|
+
` ${chalk10.white(row.title)} ${chalk10.gray(`\xB7 ${row.sourceType} \xB7 ${Math.round(row.similarity * 100)}%`)}`
|
|
7138
7692
|
);
|
|
7139
|
-
console.log(
|
|
7693
|
+
console.log(chalk10.gray(` ${row.sourceId} ${row.url}`));
|
|
7140
7694
|
if (row.snippet) console.log(` ${row.snippet}`);
|
|
7141
7695
|
}
|
|
7142
7696
|
console.log();
|
|
@@ -7148,7 +7702,7 @@ About "${knowledge.query}"`));
|
|
|
7148
7702
|
return;
|
|
7149
7703
|
}
|
|
7150
7704
|
if (result.results.length === 0) {
|
|
7151
|
-
console.log(
|
|
7705
|
+
console.log(chalk10.gray(`No matches for "${result.query}".`));
|
|
7152
7706
|
return;
|
|
7153
7707
|
}
|
|
7154
7708
|
const byType = /* @__PURE__ */ new Map();
|
|
@@ -7158,14 +7712,14 @@ About "${knowledge.query}"`));
|
|
|
7158
7712
|
byType.set(r.type, bucket);
|
|
7159
7713
|
}
|
|
7160
7714
|
for (const [type, rows] of byType) {
|
|
7161
|
-
console.log(
|
|
7715
|
+
console.log(chalk10.bold(`
|
|
7162
7716
|
${TYPE_LABELS[type] ?? type}`));
|
|
7163
7717
|
for (const row of rows) {
|
|
7164
|
-
const parts = [
|
|
7165
|
-
if (row.subtitle) parts.push(
|
|
7166
|
-
if (row.workspace) parts.push(
|
|
7167
|
-
console.log(` ${parts.join(
|
|
7168
|
-
console.log(
|
|
7718
|
+
const parts = [chalk10.white(row.title)];
|
|
7719
|
+
if (row.subtitle) parts.push(chalk10.gray(row.subtitle));
|
|
7720
|
+
if (row.workspace) parts.push(chalk10.cyan(`@${row.workspace.slug}`));
|
|
7721
|
+
console.log(` ${parts.join(chalk10.gray(" \xB7 "))}`);
|
|
7722
|
+
console.log(chalk10.gray(` ${row.id}${row.url ? ` ${row.url}` : ""}`));
|
|
7169
7723
|
}
|
|
7170
7724
|
}
|
|
7171
7725
|
console.log();
|
|
@@ -7177,7 +7731,7 @@ ${TYPE_LABELS[type] ?? type}`));
|
|
|
7177
7731
|
}
|
|
7178
7732
|
|
|
7179
7733
|
// src/commands/tickets.ts
|
|
7180
|
-
import { Command as
|
|
7734
|
+
import { Command as Command24 } from "commander";
|
|
7181
7735
|
function collectRepeatable(value, previous) {
|
|
7182
7736
|
return [...previous, value];
|
|
7183
7737
|
}
|
|
@@ -7220,7 +7774,7 @@ function validateTicketType(value) {
|
|
|
7220
7774
|
return value;
|
|
7221
7775
|
}
|
|
7222
7776
|
function createTicketsCommand() {
|
|
7223
|
-
const tickets = new
|
|
7777
|
+
const tickets = new Command24("tickets").description(
|
|
7224
7778
|
"Manage product backlog tickets. Tickets live under a product, link to features/epics, depend on each other, and can be implemented via actions."
|
|
7225
7779
|
);
|
|
7226
7780
|
tickets.command("list").description(
|
|
@@ -7589,7 +8143,7 @@ function createTicketsCommand() {
|
|
|
7589
8143
|
handleError(error, useJson);
|
|
7590
8144
|
}
|
|
7591
8145
|
});
|
|
7592
|
-
const comment = new
|
|
8146
|
+
const comment = new Command24("comment").description("Manage comments on a ticket");
|
|
7593
8147
|
comment.command("list").description("List comments on a ticket").requiredOption("--id <id>", "Ticket CUID").action(async (options, cmd) => {
|
|
7594
8148
|
const globalOpts = cmd.optsWithGlobals();
|
|
7595
8149
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -7681,7 +8235,7 @@ function createTicketsCommand() {
|
|
|
7681
8235
|
}
|
|
7682
8236
|
|
|
7683
8237
|
// src/commands/time.ts
|
|
7684
|
-
import { Command as
|
|
8238
|
+
import { Command as Command25 } from "commander";
|
|
7685
8239
|
import { segmentConversation } from "exponential-sdk";
|
|
7686
8240
|
var SOURCES2 = ["manual", "claude-desktop", "agent-run"];
|
|
7687
8241
|
var STATUSES2 = ["PROPOSED", "CONFIRMED"];
|
|
@@ -7771,7 +8325,7 @@ function batchItemToInput(item, index, defaults) {
|
|
|
7771
8325
|
};
|
|
7772
8326
|
}
|
|
7773
8327
|
function createTimeCommand() {
|
|
7774
|
-
const time = new
|
|
8328
|
+
const time = new Command25("time").description(
|
|
7775
8329
|
`Time entries \u2014 log the day's work and list it. ${OWNERSHIP_NOTE}`
|
|
7776
8330
|
);
|
|
7777
8331
|
time.command("log").description(
|
|
@@ -7941,10 +8495,10 @@ function parseMessagesFile(raw) {
|
|
|
7941
8495
|
}
|
|
7942
8496
|
|
|
7943
8497
|
// src/commands/workspaces.ts
|
|
7944
|
-
import { Command as
|
|
7945
|
-
import
|
|
8498
|
+
import { Command as Command26 } from "commander";
|
|
8499
|
+
import chalk11 from "chalk";
|
|
7946
8500
|
function createWorkspacesCommand() {
|
|
7947
|
-
const workspaces = new
|
|
8501
|
+
const workspaces = new Command26("workspaces").description("Manage workspaces");
|
|
7948
8502
|
workspaces.command("list").description("List all workspaces").action(async (_options, cmd) => {
|
|
7949
8503
|
const globalOpts = cmd.optsWithGlobals();
|
|
7950
8504
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -7957,7 +8511,7 @@ function createWorkspacesCommand() {
|
|
|
7957
8511
|
const config = getConfig();
|
|
7958
8512
|
outputWorkspacesPretty(workspaces2);
|
|
7959
8513
|
if (config.defaultWorkspaceSlug) {
|
|
7960
|
-
console.log(
|
|
8514
|
+
console.log(chalk11.gray(`Default workspace: ${config.defaultWorkspaceSlug}`));
|
|
7961
8515
|
}
|
|
7962
8516
|
}
|
|
7963
8517
|
} catch (error) {
|
|
@@ -7970,10 +8524,10 @@ function createWorkspacesCommand() {
|
|
|
7970
8524
|
const workspaces2 = await client.workspaces.list();
|
|
7971
8525
|
const workspace = workspaces2.find((w) => w.slug === slug);
|
|
7972
8526
|
if (!workspace) {
|
|
7973
|
-
console.error(
|
|
7974
|
-
console.log(
|
|
8527
|
+
console.error(chalk11.red(`Workspace with slug "${slug}" not found.`));
|
|
8528
|
+
console.log(chalk11.gray("Available workspaces:"));
|
|
7975
8529
|
workspaces2.forEach((w) => {
|
|
7976
|
-
console.log(
|
|
8530
|
+
console.log(chalk11.gray(` - ${w.slug} (${w.name})`));
|
|
7977
8531
|
});
|
|
7978
8532
|
process.exit(1);
|
|
7979
8533
|
}
|
|
@@ -7981,7 +8535,7 @@ function createWorkspacesCommand() {
|
|
|
7981
8535
|
defaultWorkspaceId: workspace.id,
|
|
7982
8536
|
defaultWorkspaceSlug: workspace.slug
|
|
7983
8537
|
});
|
|
7984
|
-
console.log(
|
|
8538
|
+
console.log(chalk11.green(`Default workspace set to: ${workspace.name} (${workspace.slug})`));
|
|
7985
8539
|
} catch (error) {
|
|
7986
8540
|
handleError(error);
|
|
7987
8541
|
}
|
|
@@ -8009,20 +8563,20 @@ function createWorkspacesCommand() {
|
|
|
8009
8563
|
return;
|
|
8010
8564
|
}
|
|
8011
8565
|
if (members.length === 0) {
|
|
8012
|
-
console.log(
|
|
8566
|
+
console.log(chalk11.gray("No members found."));
|
|
8013
8567
|
return;
|
|
8014
8568
|
}
|
|
8015
|
-
console.log(
|
|
8569
|
+
console.log(chalk11.bold(`
|
|
8016
8570
|
Members (${members.length})
|
|
8017
8571
|
`));
|
|
8018
8572
|
for (const m of members) {
|
|
8019
8573
|
const label = m.name ?? m.email ?? m.id;
|
|
8020
|
-
const via = m.source === "team" ?
|
|
8574
|
+
const via = m.source === "team" ? chalk11.gray(
|
|
8021
8575
|
` via team${m.teams.length ? `: ${m.teams.map((t) => t.name).join(", ")}` : ""}` + (m.teamRole ? ` [team ${m.teamRole}]` : "")
|
|
8022
8576
|
) : "";
|
|
8023
|
-
console.log(`${
|
|
8024
|
-
if (m.email) console.log(
|
|
8025
|
-
console.log(
|
|
8577
|
+
console.log(`${chalk11.bold(label)} ${chalk11.gray(`(${m.role})`)}${via}`);
|
|
8578
|
+
if (m.email) console.log(chalk11.gray(` ${m.email}`));
|
|
8579
|
+
console.log(chalk11.gray(` mention: ${m.mentionSyntax}`));
|
|
8026
8580
|
console.log();
|
|
8027
8581
|
}
|
|
8028
8582
|
} catch (error) {
|
|
@@ -8034,7 +8588,7 @@ Members (${members.length})
|
|
|
8034
8588
|
}
|
|
8035
8589
|
|
|
8036
8590
|
// src/commands/goals.ts
|
|
8037
|
-
import { Command as
|
|
8591
|
+
import { Command as Command27 } from "commander";
|
|
8038
8592
|
var GOAL_STATUSES = [
|
|
8039
8593
|
"planned",
|
|
8040
8594
|
"active",
|
|
@@ -8146,7 +8700,7 @@ function validateKeyResultUnit(value) {
|
|
|
8146
8700
|
return value;
|
|
8147
8701
|
}
|
|
8148
8702
|
function createKeyResultsCommand() {
|
|
8149
|
-
const kr = new
|
|
8703
|
+
const kr = new Command27("kr").description(
|
|
8150
8704
|
"Key results on an objective. Ids are CUIDs; --goal takes the objective's integer id."
|
|
8151
8705
|
);
|
|
8152
8706
|
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(
|
|
@@ -8349,7 +8903,7 @@ function createKeyResultsCommand() {
|
|
|
8349
8903
|
return kr;
|
|
8350
8904
|
}
|
|
8351
8905
|
function createGoalCommentsCommand() {
|
|
8352
|
-
const comment = new
|
|
8906
|
+
const comment = new Command27("comment").description(
|
|
8353
8907
|
"Read and post comments on a goal. Mention teammates with --mention."
|
|
8354
8908
|
);
|
|
8355
8909
|
comment.command("list").description("List comments on a goal").requiredOption("--goal <id>", "Goal ID (a number)").action(async (options, cmd) => {
|
|
@@ -8444,7 +8998,7 @@ function createGoalCommentsCommand() {
|
|
|
8444
8998
|
return comment;
|
|
8445
8999
|
}
|
|
8446
9000
|
function createGoalsCommand() {
|
|
8447
|
-
const goals = new
|
|
9001
|
+
const goals = new Command27("goals").description(
|
|
8448
9002
|
"Manage goals (objectives) and their key results. Objectives have integer ids; key results are CUIDs."
|
|
8449
9003
|
);
|
|
8450
9004
|
goals.command("list").description(
|
|
@@ -8731,7 +9285,7 @@ Re-run with --with-key-results to go ahead, or move them with \`goals kr update
|
|
|
8731
9285
|
return goals;
|
|
8732
9286
|
}
|
|
8733
9287
|
function createOkrsCommand() {
|
|
8734
|
-
const okrs = new
|
|
9288
|
+
const okrs = new Command27("okrs").description(
|
|
8735
9289
|
"OKRs \u2014 objectives with their key results nested. Manage the parts with `goals` and `goals kr`."
|
|
8736
9290
|
);
|
|
8737
9291
|
okrs.command("list").description(
|
|
@@ -8820,7 +9374,7 @@ function isBareVersionRequest(args) {
|
|
|
8820
9374
|
return args.includes("--version") && args.every((arg) => arg.startsWith("-"));
|
|
8821
9375
|
}
|
|
8822
9376
|
function buildProgram() {
|
|
8823
|
-
const program = new
|
|
9377
|
+
const program = new Command28();
|
|
8824
9378
|
program.name("exponential").description(
|
|
8825
9379
|
[
|
|
8826
9380
|
"CLI to interact with Exponential productivity app.",
|
|
@@ -8833,6 +9387,7 @@ function buildProgram() {
|
|
|
8833
9387
|
program.addCommand(createAuthCommand());
|
|
8834
9388
|
program.addCommand(createActionsCommand());
|
|
8835
9389
|
program.addCommand(createContactsCommand());
|
|
9390
|
+
program.addCommand(createDatabasesCommand());
|
|
8836
9391
|
program.addCommand(createDecisionsCommand());
|
|
8837
9392
|
program.addCommand(createDealsCommand());
|
|
8838
9393
|
program.addCommand(createEpicsCommand());
|