exponential-cli 1.27.0 → 1.28.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 +32 -0
- package/dist/index.js +314 -59
- 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 Command30 } from "commander";
|
|
5
5
|
|
|
6
6
|
// src/commands/auth.ts
|
|
7
7
|
import { Command } from "commander";
|
|
@@ -299,8 +299,8 @@ function transformWorkspace(workspace) {
|
|
|
299
299
|
};
|
|
300
300
|
}
|
|
301
301
|
function outputActionJson(action) {
|
|
302
|
-
const
|
|
303
|
-
console.log(JSON.stringify(
|
|
302
|
+
const output2 = transformAction(action);
|
|
303
|
+
console.log(JSON.stringify(output2, null, 2));
|
|
304
304
|
}
|
|
305
305
|
function outputActionUpsertJson(result) {
|
|
306
306
|
console.log(JSON.stringify({ outcome: result.outcome, action: transformAction(result.action) }, null, 2));
|
|
@@ -326,12 +326,12 @@ ${statusBadge2} ${chalk3.bold(action.name)}`);
|
|
|
326
326
|
console.log();
|
|
327
327
|
}
|
|
328
328
|
function outputActionsJson(actions, filters = {}) {
|
|
329
|
-
const
|
|
329
|
+
const output2 = {
|
|
330
330
|
actions: actions.map(transformAction),
|
|
331
331
|
total: actions.length,
|
|
332
332
|
filters
|
|
333
333
|
};
|
|
334
|
-
console.log(JSON.stringify(
|
|
334
|
+
console.log(JSON.stringify(output2, null, 2));
|
|
335
335
|
}
|
|
336
336
|
function outputActionsPretty(actions) {
|
|
337
337
|
if (actions.length === 0) {
|
|
@@ -449,11 +449,11 @@ ${chalk3.bold(`${t.loose.length} individually dated`)} ${chalk3.gray("\u2014 rea
|
|
|
449
449
|
console.log();
|
|
450
450
|
}
|
|
451
451
|
function outputProjectsJson(projects) {
|
|
452
|
-
const
|
|
452
|
+
const output2 = {
|
|
453
453
|
projects: projects.map(transformProject),
|
|
454
454
|
total: projects.length
|
|
455
455
|
};
|
|
456
|
-
console.log(JSON.stringify(
|
|
456
|
+
console.log(JSON.stringify(output2, null, 2));
|
|
457
457
|
}
|
|
458
458
|
function outputProjectsPretty(projects) {
|
|
459
459
|
if (projects.length === 0) {
|
|
@@ -483,11 +483,11 @@ ${chalk3.bold(project.name)}`);
|
|
|
483
483
|
console.log();
|
|
484
484
|
}
|
|
485
485
|
function outputWorkspacesJson(workspaces) {
|
|
486
|
-
const
|
|
486
|
+
const output2 = {
|
|
487
487
|
workspaces: workspaces.map(transformWorkspace),
|
|
488
488
|
total: workspaces.length
|
|
489
489
|
};
|
|
490
|
-
console.log(JSON.stringify(
|
|
490
|
+
console.log(JSON.stringify(output2, null, 2));
|
|
491
491
|
}
|
|
492
492
|
function outputWorkspacesPretty(workspaces) {
|
|
493
493
|
if (workspaces.length === 0) {
|
|
@@ -7695,10 +7695,264 @@ ${revision.body}
|
|
|
7695
7695
|
return pages;
|
|
7696
7696
|
}
|
|
7697
7697
|
|
|
7698
|
-
// src/commands/
|
|
7698
|
+
// src/commands/positions.ts
|
|
7699
7699
|
import { Command as Command20 } from "commander";
|
|
7700
|
+
import chalk11 from "chalk";
|
|
7701
|
+
var WORKSPACE_OPTION = ["--workspace <slug|id>", "Workspace (defaults to your default workspace)"];
|
|
7702
|
+
var HOLDER_OPTION_DESCRIPTION = "Holder: a workspace member by name, email, or user id (repeatable)";
|
|
7703
|
+
var HUMAN_ONLY_NOTE = "Writes need your own login (`exponential auth login`); agent keys are refused. Owners and admins can do everything; a member who holds a position may edit its remit.";
|
|
7704
|
+
function pickPosition(positions, ref) {
|
|
7705
|
+
const byId = positions.find((p) => p.id === ref);
|
|
7706
|
+
if (byId) return byId;
|
|
7707
|
+
const needle = ref.trim().toLowerCase();
|
|
7708
|
+
const byTitle = positions.find((p) => p.title.toLowerCase() === needle);
|
|
7709
|
+
if (byTitle) return byTitle;
|
|
7710
|
+
const known = positions.map((p) => `"${p.title}"`).join(", ");
|
|
7711
|
+
throw new Error(`No position matches "${ref}". Positions: ${known || "(none)"}`);
|
|
7712
|
+
}
|
|
7713
|
+
function resolveHolderIds(members, tokens) {
|
|
7714
|
+
return [...new Set(tokens.map((token) => resolveMember(members, token).id))];
|
|
7715
|
+
}
|
|
7716
|
+
async function loadPosition(client, workspaceId, ref) {
|
|
7717
|
+
const { positions } = await client.positions.list(workspaceId);
|
|
7718
|
+
return pickPosition(positions, ref);
|
|
7719
|
+
}
|
|
7720
|
+
function holderLabel(holder) {
|
|
7721
|
+
return `${holder.name ?? holder.userId}${holder.isAgent ? chalk11.gray(" (agent)") : ""}`;
|
|
7722
|
+
}
|
|
7723
|
+
function printPosition(position) {
|
|
7724
|
+
console.log(`${chalk11.bold(position.title)} ${chalk11.gray(`(${position.id})`)}`);
|
|
7725
|
+
console.log(
|
|
7726
|
+
` ${chalk11.gray("Held by:")} ${position.holders.length ? position.holders.map(holderLabel).join(", ") : chalk11.yellow("nobody")}`
|
|
7727
|
+
);
|
|
7728
|
+
console.log(` ${chalk11.gray("Remit:")} ${position.remit.replace(/\n/g, "\n ")}`);
|
|
7729
|
+
if (position.notAccountableFor) {
|
|
7730
|
+
console.log(` ${chalk11.gray("Not accountable for:")} ${position.notAccountableFor.replace(/\n/g, "\n ")}`);
|
|
7731
|
+
}
|
|
7732
|
+
console.log();
|
|
7733
|
+
}
|
|
7734
|
+
function output(position, useJson, verb) {
|
|
7735
|
+
if (useJson) {
|
|
7736
|
+
console.log(JSON.stringify(position, null, 2));
|
|
7737
|
+
return;
|
|
7738
|
+
}
|
|
7739
|
+
console.log(chalk11.green(`${verb}:`));
|
|
7740
|
+
printPosition(position);
|
|
7741
|
+
}
|
|
7742
|
+
function parseImportFile(raw, members) {
|
|
7743
|
+
let parsed;
|
|
7744
|
+
try {
|
|
7745
|
+
parsed = JSON.parse(raw);
|
|
7746
|
+
} catch (error) {
|
|
7747
|
+
throw new Error(`Import file is not valid JSON: ${error.message}`);
|
|
7748
|
+
}
|
|
7749
|
+
const rows = Array.isArray(parsed) ? parsed : parsed?.positions;
|
|
7750
|
+
if (!Array.isArray(rows) || rows.length === 0) {
|
|
7751
|
+
throw new Error('Import file must be a non-empty JSON array of positions (or {"positions": [...]})');
|
|
7752
|
+
}
|
|
7753
|
+
return rows.map((row, index) => {
|
|
7754
|
+
const where = `positions[${index}]`;
|
|
7755
|
+
if (typeof row.title !== "string" || !row.title.trim()) throw new Error(`${where}: "title" is required`);
|
|
7756
|
+
if (typeof row.remit !== "string" || !row.remit.trim()) throw new Error(`${where}: "remit" is required`);
|
|
7757
|
+
if (row.notAccountableFor !== void 0 && typeof row.notAccountableFor !== "string") {
|
|
7758
|
+
throw new Error(`${where}: "notAccountableFor" must be a string`);
|
|
7759
|
+
}
|
|
7760
|
+
const tokens = row.holders ?? row.holderUserIds ?? [];
|
|
7761
|
+
if (!Array.isArray(tokens) || tokens.some((t) => typeof t !== "string")) {
|
|
7762
|
+
throw new Error(`${where}: "holders" must be an array of names, emails or user ids`);
|
|
7763
|
+
}
|
|
7764
|
+
return {
|
|
7765
|
+
title: row.title,
|
|
7766
|
+
remit: row.remit,
|
|
7767
|
+
...row.notAccountableFor !== void 0 && { notAccountableFor: row.notAccountableFor },
|
|
7768
|
+
holderUserIds: resolveHolderIds(members, tokens)
|
|
7769
|
+
};
|
|
7770
|
+
});
|
|
7771
|
+
}
|
|
7772
|
+
function createPositionsCommand() {
|
|
7773
|
+
const positions = new Command20("positions").alias("roles").description(
|
|
7774
|
+
`A workspace's roles & responsibilities (Positions): what each role takes on, what it is not accountable for, and who holds it. Shown on the workspace settings page. ${HUMAN_ONLY_NOTE}`
|
|
7775
|
+
);
|
|
7776
|
+
positions.command("list").description("List positions with their holders").option(...WORKSPACE_OPTION).option("--gaps", "Also list members with no stated remit").action(async (options, cmd) => {
|
|
7777
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
7778
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
7779
|
+
try {
|
|
7780
|
+
const client = getClient();
|
|
7781
|
+
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
7782
|
+
const result = await client.positions.list(workspaceId);
|
|
7783
|
+
if (useJson) {
|
|
7784
|
+
console.log(JSON.stringify({ ...result, total: result.positions.length }, null, 2));
|
|
7785
|
+
return;
|
|
7786
|
+
}
|
|
7787
|
+
if (result.positions.length === 0) {
|
|
7788
|
+
console.log(chalk11.gray("No positions yet. Add one with `exponential positions create`."));
|
|
7789
|
+
} else {
|
|
7790
|
+
console.log(chalk11.bold(`
|
|
7791
|
+
Positions (${result.positions.length})
|
|
7792
|
+
`));
|
|
7793
|
+
result.positions.forEach(printPosition);
|
|
7794
|
+
}
|
|
7795
|
+
if (options.gaps) {
|
|
7796
|
+
const gaps = result.members.filter((m) => m.remitGap);
|
|
7797
|
+
if (gaps.length === 0) {
|
|
7798
|
+
console.log(chalk11.gray("Every member has a stated remit."));
|
|
7799
|
+
} else {
|
|
7800
|
+
const roster = await client.workspaces.listMembers(workspaceId);
|
|
7801
|
+
const nameOf = (id) => {
|
|
7802
|
+
const member = roster.find((r) => r.id === id);
|
|
7803
|
+
return member?.name ?? member?.email ?? id;
|
|
7804
|
+
};
|
|
7805
|
+
console.log(chalk11.bold(`No stated remit (${gaps.length}):`));
|
|
7806
|
+
gaps.forEach((g) => console.log(` ${nameOf(g.userId)}`));
|
|
7807
|
+
}
|
|
7808
|
+
}
|
|
7809
|
+
} catch (error) {
|
|
7810
|
+
handleError(error, useJson);
|
|
7811
|
+
}
|
|
7812
|
+
});
|
|
7813
|
+
positions.command("show <position>").description("Show one position, by id or title").option(...WORKSPACE_OPTION).action(async (ref, options, cmd) => {
|
|
7814
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
7815
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
7816
|
+
try {
|
|
7817
|
+
const client = getClient();
|
|
7818
|
+
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
7819
|
+
const position = await loadPosition(client, workspaceId, ref);
|
|
7820
|
+
if (useJson) console.log(JSON.stringify(position, null, 2));
|
|
7821
|
+
else printPosition(position);
|
|
7822
|
+
} catch (error) {
|
|
7823
|
+
handleError(error, useJson);
|
|
7824
|
+
}
|
|
7825
|
+
});
|
|
7826
|
+
positions.command("create").description("Create a position").requiredOption("-t, --title <title>", "Title, 1\u201380 characters, unique in the workspace").option("-r, --remit <markdown>", "What its holders take on (Markdown, up to 2000 characters)").option("--remit-file <path>", 'Read the remit from a file ("-" = stdin)').option("-n, --not-accountable-for <markdown>", "What it is explicitly not accountable for").option("--not-accountable-for-file <path>", 'Read "not accountable for" from a file ("-" = stdin)').option("--holder <member>", HOLDER_OPTION_DESCRIPTION, collectMention, []).option(...WORKSPACE_OPTION).action(
|
|
7827
|
+
async (options, cmd) => {
|
|
7828
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
7829
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
7830
|
+
try {
|
|
7831
|
+
const remit = readText(options.remit, options.remitFile);
|
|
7832
|
+
if (!remit?.trim()) throw new Error("A remit is required: pass --remit or --remit-file");
|
|
7833
|
+
const notAccountableFor = readText(options.notAccountableFor, options.notAccountableForFile);
|
|
7834
|
+
const client = getClient();
|
|
7835
|
+
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
7836
|
+
const holderUserIds = options.holder.length ? resolveHolderIds(await client.workspaces.listMembers(workspaceId), options.holder) : void 0;
|
|
7837
|
+
const created = await client.positions.create({
|
|
7838
|
+
workspaceId,
|
|
7839
|
+
title: options.title,
|
|
7840
|
+
remit,
|
|
7841
|
+
...notAccountableFor !== void 0 && { notAccountableFor },
|
|
7842
|
+
...holderUserIds && { holderUserIds }
|
|
7843
|
+
});
|
|
7844
|
+
output(created, useJson, "Created");
|
|
7845
|
+
} catch (error) {
|
|
7846
|
+
handleError(error, useJson);
|
|
7847
|
+
}
|
|
7848
|
+
}
|
|
7849
|
+
);
|
|
7850
|
+
positions.command("update <position>").description(`Edit a position, by id or title. --holder replaces the whole holder set.`).option("-t, --title <title>", "New title").option("-r, --remit <markdown>", "New remit").option("--remit-file <path>", 'Read the new remit from a file ("-" = stdin)').option("-n, --not-accountable-for <markdown>", 'New "not accountable for" ("" clears it)').option("--not-accountable-for-file <path>", 'Read "not accountable for" from a file ("-" = stdin)').option("--clear-not-accountable-for", 'Remove "not accountable for"').option("--holder <member>", `${HOLDER_OPTION_DESCRIPTION}; replaces the current holders`, collectMention, []).option("--no-holders", "Remove every holder").option(...WORKSPACE_OPTION).action(
|
|
7851
|
+
async (ref, options, cmd) => {
|
|
7852
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
7853
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
7854
|
+
try {
|
|
7855
|
+
if (!options.holders && options.holder.length) {
|
|
7856
|
+
throw new Error("Pass either --holder or --no-holders, not both");
|
|
7857
|
+
}
|
|
7858
|
+
const remit = readText(options.remit, options.remitFile);
|
|
7859
|
+
const notAccountableFor = options.clearNotAccountableFor ? null : readText(options.notAccountableFor, options.notAccountableForFile);
|
|
7860
|
+
const client = getClient();
|
|
7861
|
+
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
7862
|
+
const position = await loadPosition(client, workspaceId, ref);
|
|
7863
|
+
let holderUserIds;
|
|
7864
|
+
if (!options.holders) holderUserIds = [];
|
|
7865
|
+
else if (options.holder.length) {
|
|
7866
|
+
holderUserIds = resolveHolderIds(await client.workspaces.listMembers(workspaceId), options.holder);
|
|
7867
|
+
}
|
|
7868
|
+
const updated = await client.positions.update({
|
|
7869
|
+
workspaceId,
|
|
7870
|
+
positionId: position.id,
|
|
7871
|
+
...options.title !== void 0 && { title: options.title },
|
|
7872
|
+
...remit !== void 0 && { remit },
|
|
7873
|
+
...notAccountableFor !== void 0 && { notAccountableFor },
|
|
7874
|
+
...holderUserIds !== void 0 && { holderUserIds }
|
|
7875
|
+
});
|
|
7876
|
+
output(updated, useJson, "Updated");
|
|
7877
|
+
} catch (error) {
|
|
7878
|
+
handleError(error, useJson);
|
|
7879
|
+
}
|
|
7880
|
+
}
|
|
7881
|
+
);
|
|
7882
|
+
positions.command("delete <position>").description(`Delete a position, by id or title. Its holdings go with it.`).option(...WORKSPACE_OPTION).action(async (ref, options, cmd) => {
|
|
7883
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
7884
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
7885
|
+
try {
|
|
7886
|
+
const client = getClient();
|
|
7887
|
+
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
7888
|
+
const position = await loadPosition(client, workspaceId, ref);
|
|
7889
|
+
await client.positions.delete(workspaceId, position.id);
|
|
7890
|
+
if (useJson) console.log(JSON.stringify({ id: position.id, title: position.title, deleted: true }, null, 2));
|
|
7891
|
+
else console.log(chalk11.green(`Deleted "${position.title}"`));
|
|
7892
|
+
} catch (error) {
|
|
7893
|
+
handleError(error, useJson);
|
|
7894
|
+
}
|
|
7895
|
+
});
|
|
7896
|
+
const holders = positions.command("holders").description(`Change who holds a position (owner/admin).`);
|
|
7897
|
+
const holderAction = (mode) => async (ref, members, options, cmd) => {
|
|
7898
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
7899
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
7900
|
+
try {
|
|
7901
|
+
const client = getClient();
|
|
7902
|
+
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
7903
|
+
const [position, roster] = await Promise.all([
|
|
7904
|
+
loadPosition(client, workspaceId, ref),
|
|
7905
|
+
client.workspaces.listMembers(workspaceId)
|
|
7906
|
+
]);
|
|
7907
|
+
const named = resolveHolderIds(roster, members);
|
|
7908
|
+
const current = position.holders.map((h) => h.userId);
|
|
7909
|
+
const next = mode === "set" ? named : mode === "add" ? [.../* @__PURE__ */ new Set([...current, ...named])] : current.filter((id) => !named.includes(id));
|
|
7910
|
+
const updated = await client.positions.setHolders(workspaceId, position.id, next);
|
|
7911
|
+
output(updated, useJson, "Holders updated");
|
|
7912
|
+
} catch (error) {
|
|
7913
|
+
handleError(error, useJson);
|
|
7914
|
+
}
|
|
7915
|
+
};
|
|
7916
|
+
holders.command("set <position> [members...]").description("Replace the holders (no members = nobody holds it)").option(...WORKSPACE_OPTION).action(holderAction("set"));
|
|
7917
|
+
holders.command("add <position> <members...>").description("Add holders, by name, email or user id").option(...WORKSPACE_OPTION).action(holderAction("add"));
|
|
7918
|
+
holders.command("remove <position> <members...>").description("Remove holders, by name, email or user id").option(...WORKSPACE_OPTION).action(holderAction("remove"));
|
|
7919
|
+
positions.command("import <file>").description(
|
|
7920
|
+
'Create or update many positions from a JSON file ("-" = stdin): an array of { title, remit, notAccountableFor?, holders?: [name|email|id] }. Matches existing positions by title (case-insensitive); an update replaces the remit and only adds holders. All or nothing.'
|
|
7921
|
+
).option("--dry-run", "Show what would change without writing").option(...WORKSPACE_OPTION).action(async (file, options, cmd) => {
|
|
7922
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
7923
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
7924
|
+
try {
|
|
7925
|
+
const raw = readText(void 0, file);
|
|
7926
|
+
const client = getClient();
|
|
7927
|
+
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
7928
|
+
const roster = await client.workspaces.listMembers(workspaceId);
|
|
7929
|
+
const rows = parseImportFile(raw, roster);
|
|
7930
|
+
const result = await client.positions.importMany({
|
|
7931
|
+
workspaceId,
|
|
7932
|
+
dryRun: Boolean(options.dryRun),
|
|
7933
|
+
positions: rows
|
|
7934
|
+
});
|
|
7935
|
+
if (useJson) {
|
|
7936
|
+
console.log(JSON.stringify(result, null, 2));
|
|
7937
|
+
return;
|
|
7938
|
+
}
|
|
7939
|
+
const nameOf = (id) => roster.find((r) => r.id === id)?.name ?? id;
|
|
7940
|
+
console.log(chalk11.bold(result.written ? "\nImported:\n" : "\nDry run \u2014 nothing written:\n"));
|
|
7941
|
+
for (const row of result.results) {
|
|
7942
|
+
const tag = row.outcome === "create" ? chalk11.green("create") : chalk11.yellow("update");
|
|
7943
|
+
console.log(` ${tag} ${chalk11.bold(row.title)} \u2014 ${row.holderUserIds.map(nameOf).join(", ") || "no holders"}`);
|
|
7944
|
+
}
|
|
7945
|
+
} catch (error) {
|
|
7946
|
+
handleError(error, useJson);
|
|
7947
|
+
}
|
|
7948
|
+
});
|
|
7949
|
+
return positions;
|
|
7950
|
+
}
|
|
7951
|
+
|
|
7952
|
+
// src/commands/products.ts
|
|
7953
|
+
import { Command as Command21 } from "commander";
|
|
7700
7954
|
function createProductsCommand() {
|
|
7701
|
-
const products = new
|
|
7955
|
+
const products = new Command21("products").description(
|
|
7702
7956
|
"Manage products. A workspace contains products; a product holds features and tickets."
|
|
7703
7957
|
);
|
|
7704
7958
|
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) => {
|
|
@@ -7839,7 +8093,7 @@ Re-run with --force to delete it anyway.`
|
|
|
7839
8093
|
}
|
|
7840
8094
|
|
|
7841
8095
|
// src/commands/projects.ts
|
|
7842
|
-
import { Command as
|
|
8096
|
+
import { Command as Command22 } from "commander";
|
|
7843
8097
|
var PROJECT_STATUSES = [
|
|
7844
8098
|
"ACTIVE",
|
|
7845
8099
|
"ON_HOLD",
|
|
@@ -7866,7 +8120,7 @@ function validateProjectPriority(value) {
|
|
|
7866
8120
|
return value;
|
|
7867
8121
|
}
|
|
7868
8122
|
function createProjectsCommand() {
|
|
7869
|
-
const projects = new
|
|
8123
|
+
const projects = new Command22("projects").description("Manage projects");
|
|
7870
8124
|
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) => {
|
|
7871
8125
|
const globalOpts = cmd.optsWithGlobals();
|
|
7872
8126
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -7985,7 +8239,7 @@ Re-run with --force to delete it anyway.`
|
|
|
7985
8239
|
}
|
|
7986
8240
|
|
|
7987
8241
|
// src/commands/resources.ts
|
|
7988
|
-
import { Command as
|
|
8242
|
+
import { Command as Command23 } from "commander";
|
|
7989
8243
|
var STATUS_FILTERS = ["unread", "to_read", "reading", "read", "all"];
|
|
7990
8244
|
function validateStatus(value) {
|
|
7991
8245
|
const v = value ?? "unread";
|
|
@@ -8000,7 +8254,7 @@ function collectTags(value, previous) {
|
|
|
8000
8254
|
}
|
|
8001
8255
|
var TAG_OPTION = "--tag <tag>";
|
|
8002
8256
|
function createResourcesCommand() {
|
|
8003
|
-
const resources = new
|
|
8257
|
+
const resources = new Command23("resources").description(
|
|
8004
8258
|
"Saved links and reference material. `list` defaults to the Reading list (unread); `create --url` saves a link to read later."
|
|
8005
8259
|
);
|
|
8006
8260
|
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(
|
|
@@ -8107,7 +8361,7 @@ function createResourcesCommand() {
|
|
|
8107
8361
|
}
|
|
8108
8362
|
|
|
8109
8363
|
// src/commands/runner.ts
|
|
8110
|
-
import { Command as
|
|
8364
|
+
import { Command as Command24 } from "commander";
|
|
8111
8365
|
import { hostname, homedir as homedir2, tmpdir as tmpdir2 } from "os";
|
|
8112
8366
|
import { execFileSync } from "child_process";
|
|
8113
8367
|
import { mkdirSync as mkdirSync3 } from "fs";
|
|
@@ -8559,7 +8813,7 @@ function removeServiceFile(plan) {
|
|
|
8559
8813
|
|
|
8560
8814
|
// src/commands/runner.ts
|
|
8561
8815
|
function createRunnerCommand() {
|
|
8562
|
-
const cmd = new
|
|
8816
|
+
const cmd = new Command24("runner").description(
|
|
8563
8817
|
"Run your Assistant locally: claim its queued runs and work them with Claude Code on this machine"
|
|
8564
8818
|
);
|
|
8565
8819
|
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) => {
|
|
@@ -8670,8 +8924,8 @@ ${plan.contents}
|
|
|
8670
8924
|
}
|
|
8671
8925
|
|
|
8672
8926
|
// src/commands/search.ts
|
|
8673
|
-
import { Command as
|
|
8674
|
-
import
|
|
8927
|
+
import { Command as Command25 } from "commander";
|
|
8928
|
+
import chalk12 from "chalk";
|
|
8675
8929
|
var KNOWLEDGE_TYPES = ["transcription", "resource", "document", "page"];
|
|
8676
8930
|
function parseTypes(value) {
|
|
8677
8931
|
if (!value) return void 0;
|
|
@@ -8700,7 +8954,7 @@ var TYPE_LABELS = {
|
|
|
8700
8954
|
product: "Products"
|
|
8701
8955
|
};
|
|
8702
8956
|
function createSearchCommand() {
|
|
8703
|
-
const search = new
|
|
8957
|
+
const search = new Command25("search").description(
|
|
8704
8958
|
"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."
|
|
8705
8959
|
).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) => {
|
|
8706
8960
|
const globalOpts = cmd.optsWithGlobals();
|
|
@@ -8714,10 +8968,10 @@ function createSearchCommand() {
|
|
|
8714
8968
|
(w) => w.slug === options.workspace || w.id === options.workspace
|
|
8715
8969
|
);
|
|
8716
8970
|
if (!match) {
|
|
8717
|
-
console.error(
|
|
8718
|
-
console.log(
|
|
8971
|
+
console.error(chalk12.red(`Workspace "${options.workspace}" not found.`));
|
|
8972
|
+
console.log(chalk12.gray("Available workspaces:"));
|
|
8719
8973
|
workspaces.forEach((w) => {
|
|
8720
|
-
console.log(
|
|
8974
|
+
console.log(chalk12.gray(` - ${w.slug} (${w.name})`));
|
|
8721
8975
|
});
|
|
8722
8976
|
process.exit(1);
|
|
8723
8977
|
}
|
|
@@ -8739,16 +8993,16 @@ function createSearchCommand() {
|
|
|
8739
8993
|
return;
|
|
8740
8994
|
}
|
|
8741
8995
|
if (knowledge.results.length === 0) {
|
|
8742
|
-
console.log(
|
|
8996
|
+
console.log(chalk12.gray(`Nothing about "${knowledge.query}" in the Knowledge index.`));
|
|
8743
8997
|
return;
|
|
8744
8998
|
}
|
|
8745
|
-
console.log(
|
|
8999
|
+
console.log(chalk12.bold(`
|
|
8746
9000
|
About "${knowledge.query}"`));
|
|
8747
9001
|
for (const row of knowledge.results) {
|
|
8748
9002
|
console.log(
|
|
8749
|
-
` ${
|
|
9003
|
+
` ${chalk12.white(row.title)} ${chalk12.gray(`\xB7 ${row.sourceType} \xB7 ${Math.round(row.similarity * 100)}%`)}`
|
|
8750
9004
|
);
|
|
8751
|
-
console.log(
|
|
9005
|
+
console.log(chalk12.gray(` ${row.sourceId} ${row.url}`));
|
|
8752
9006
|
if (row.snippet) console.log(` ${row.snippet}`);
|
|
8753
9007
|
}
|
|
8754
9008
|
console.log();
|
|
@@ -8760,7 +9014,7 @@ About "${knowledge.query}"`));
|
|
|
8760
9014
|
return;
|
|
8761
9015
|
}
|
|
8762
9016
|
if (result.results.length === 0) {
|
|
8763
|
-
console.log(
|
|
9017
|
+
console.log(chalk12.gray(`No matches for "${result.query}".`));
|
|
8764
9018
|
return;
|
|
8765
9019
|
}
|
|
8766
9020
|
const byType = /* @__PURE__ */ new Map();
|
|
@@ -8770,14 +9024,14 @@ About "${knowledge.query}"`));
|
|
|
8770
9024
|
byType.set(r.type, bucket);
|
|
8771
9025
|
}
|
|
8772
9026
|
for (const [type, rows] of byType) {
|
|
8773
|
-
console.log(
|
|
9027
|
+
console.log(chalk12.bold(`
|
|
8774
9028
|
${TYPE_LABELS[type] ?? type}`));
|
|
8775
9029
|
for (const row of rows) {
|
|
8776
|
-
const parts = [
|
|
8777
|
-
if (row.subtitle) parts.push(
|
|
8778
|
-
if (row.workspace) parts.push(
|
|
8779
|
-
console.log(` ${parts.join(
|
|
8780
|
-
console.log(
|
|
9030
|
+
const parts = [chalk12.white(row.title)];
|
|
9031
|
+
if (row.subtitle) parts.push(chalk12.gray(row.subtitle));
|
|
9032
|
+
if (row.workspace) parts.push(chalk12.cyan(`@${row.workspace.slug}`));
|
|
9033
|
+
console.log(` ${parts.join(chalk12.gray(" \xB7 "))}`);
|
|
9034
|
+
console.log(chalk12.gray(` ${row.id}${row.url ? ` ${row.url}` : ""}`));
|
|
8781
9035
|
}
|
|
8782
9036
|
}
|
|
8783
9037
|
console.log();
|
|
@@ -8789,7 +9043,7 @@ ${TYPE_LABELS[type] ?? type}`));
|
|
|
8789
9043
|
}
|
|
8790
9044
|
|
|
8791
9045
|
// src/commands/tickets.ts
|
|
8792
|
-
import { Command as
|
|
9046
|
+
import { Command as Command26 } from "commander";
|
|
8793
9047
|
function collectRepeatable(value, previous) {
|
|
8794
9048
|
return [...previous, value];
|
|
8795
9049
|
}
|
|
@@ -8832,7 +9086,7 @@ function validateTicketType(value) {
|
|
|
8832
9086
|
return value;
|
|
8833
9087
|
}
|
|
8834
9088
|
function createTicketsCommand() {
|
|
8835
|
-
const tickets = new
|
|
9089
|
+
const tickets = new Command26("tickets").description(
|
|
8836
9090
|
"Manage product backlog tickets. Tickets live under a product, link to features/epics, depend on each other, and can be implemented via actions."
|
|
8837
9091
|
);
|
|
8838
9092
|
tickets.command("list").description(
|
|
@@ -9201,7 +9455,7 @@ function createTicketsCommand() {
|
|
|
9201
9455
|
handleError(error, useJson);
|
|
9202
9456
|
}
|
|
9203
9457
|
});
|
|
9204
|
-
const comment = new
|
|
9458
|
+
const comment = new Command26("comment").description("Manage comments on a ticket");
|
|
9205
9459
|
comment.command("list").description("List comments on a ticket").requiredOption("--id <id>", "Ticket CUID").action(async (options, cmd) => {
|
|
9206
9460
|
const globalOpts = cmd.optsWithGlobals();
|
|
9207
9461
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -9293,7 +9547,7 @@ function createTicketsCommand() {
|
|
|
9293
9547
|
}
|
|
9294
9548
|
|
|
9295
9549
|
// src/commands/time.ts
|
|
9296
|
-
import { Command as
|
|
9550
|
+
import { Command as Command27 } from "commander";
|
|
9297
9551
|
import { segmentConversation } from "exponential-sdk";
|
|
9298
9552
|
var SOURCES2 = ["manual", "claude-desktop", "agent-run"];
|
|
9299
9553
|
var STATUSES2 = ["PROPOSED", "CONFIRMED"];
|
|
@@ -9383,7 +9637,7 @@ function batchItemToInput(item, index, defaults) {
|
|
|
9383
9637
|
};
|
|
9384
9638
|
}
|
|
9385
9639
|
function createTimeCommand() {
|
|
9386
|
-
const time = new
|
|
9640
|
+
const time = new Command27("time").description(
|
|
9387
9641
|
`Time entries \u2014 log the day's work and list it. ${OWNERSHIP_NOTE}`
|
|
9388
9642
|
);
|
|
9389
9643
|
time.command("log").description(
|
|
@@ -9553,10 +9807,10 @@ function parseMessagesFile(raw) {
|
|
|
9553
9807
|
}
|
|
9554
9808
|
|
|
9555
9809
|
// src/commands/workspaces.ts
|
|
9556
|
-
import { Command as
|
|
9557
|
-
import
|
|
9810
|
+
import { Command as Command28 } from "commander";
|
|
9811
|
+
import chalk13 from "chalk";
|
|
9558
9812
|
function createWorkspacesCommand() {
|
|
9559
|
-
const workspaces = new
|
|
9813
|
+
const workspaces = new Command28("workspaces").description("Manage workspaces");
|
|
9560
9814
|
workspaces.command("list").description("List all workspaces").action(async (_options, cmd) => {
|
|
9561
9815
|
const globalOpts = cmd.optsWithGlobals();
|
|
9562
9816
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -9569,7 +9823,7 @@ function createWorkspacesCommand() {
|
|
|
9569
9823
|
const config = getConfig();
|
|
9570
9824
|
outputWorkspacesPretty(workspaces2);
|
|
9571
9825
|
if (config.defaultWorkspaceSlug) {
|
|
9572
|
-
console.log(
|
|
9826
|
+
console.log(chalk13.gray(`Default workspace: ${config.defaultWorkspaceSlug}`));
|
|
9573
9827
|
}
|
|
9574
9828
|
}
|
|
9575
9829
|
} catch (error) {
|
|
@@ -9582,10 +9836,10 @@ function createWorkspacesCommand() {
|
|
|
9582
9836
|
const workspaces2 = await client.workspaces.list();
|
|
9583
9837
|
const workspace = workspaces2.find((w) => w.slug === slug);
|
|
9584
9838
|
if (!workspace) {
|
|
9585
|
-
console.error(
|
|
9586
|
-
console.log(
|
|
9839
|
+
console.error(chalk13.red(`Workspace with slug "${slug}" not found.`));
|
|
9840
|
+
console.log(chalk13.gray("Available workspaces:"));
|
|
9587
9841
|
workspaces2.forEach((w) => {
|
|
9588
|
-
console.log(
|
|
9842
|
+
console.log(chalk13.gray(` - ${w.slug} (${w.name})`));
|
|
9589
9843
|
});
|
|
9590
9844
|
process.exit(1);
|
|
9591
9845
|
}
|
|
@@ -9593,7 +9847,7 @@ function createWorkspacesCommand() {
|
|
|
9593
9847
|
defaultWorkspaceId: workspace.id,
|
|
9594
9848
|
defaultWorkspaceSlug: workspace.slug
|
|
9595
9849
|
});
|
|
9596
|
-
console.log(
|
|
9850
|
+
console.log(chalk13.green(`Default workspace set to: ${workspace.name} (${workspace.slug})`));
|
|
9597
9851
|
} catch (error) {
|
|
9598
9852
|
handleError(error);
|
|
9599
9853
|
}
|
|
@@ -9621,20 +9875,20 @@ function createWorkspacesCommand() {
|
|
|
9621
9875
|
return;
|
|
9622
9876
|
}
|
|
9623
9877
|
if (members.length === 0) {
|
|
9624
|
-
console.log(
|
|
9878
|
+
console.log(chalk13.gray("No members found."));
|
|
9625
9879
|
return;
|
|
9626
9880
|
}
|
|
9627
|
-
console.log(
|
|
9881
|
+
console.log(chalk13.bold(`
|
|
9628
9882
|
Members (${members.length})
|
|
9629
9883
|
`));
|
|
9630
9884
|
for (const m of members) {
|
|
9631
9885
|
const label = m.name ?? m.email ?? m.id;
|
|
9632
|
-
const via = m.source === "team" ?
|
|
9886
|
+
const via = m.source === "team" ? chalk13.gray(
|
|
9633
9887
|
` via team${m.teams.length ? `: ${m.teams.map((t) => t.name).join(", ")}` : ""}` + (m.teamRole ? ` [team ${m.teamRole}]` : "")
|
|
9634
9888
|
) : "";
|
|
9635
|
-
console.log(`${
|
|
9636
|
-
if (m.email) console.log(
|
|
9637
|
-
console.log(
|
|
9889
|
+
console.log(`${chalk13.bold(label)} ${chalk13.gray(`(${m.role})`)}${via}`);
|
|
9890
|
+
if (m.email) console.log(chalk13.gray(` ${m.email}`));
|
|
9891
|
+
console.log(chalk13.gray(` mention: ${m.mentionSyntax}`));
|
|
9638
9892
|
console.log();
|
|
9639
9893
|
}
|
|
9640
9894
|
} catch (error) {
|
|
@@ -9646,7 +9900,7 @@ Members (${members.length})
|
|
|
9646
9900
|
}
|
|
9647
9901
|
|
|
9648
9902
|
// src/commands/goals.ts
|
|
9649
|
-
import { Command as
|
|
9903
|
+
import { Command as Command29 } from "commander";
|
|
9650
9904
|
var GOAL_STATUSES = [
|
|
9651
9905
|
"planned",
|
|
9652
9906
|
"active",
|
|
@@ -9758,7 +10012,7 @@ function validateKeyResultUnit(value) {
|
|
|
9758
10012
|
return value;
|
|
9759
10013
|
}
|
|
9760
10014
|
function createKeyResultsCommand() {
|
|
9761
|
-
const kr = new
|
|
10015
|
+
const kr = new Command29("kr").description(
|
|
9762
10016
|
"Key results on an objective. Ids are CUIDs; --goal takes the objective's integer id."
|
|
9763
10017
|
);
|
|
9764
10018
|
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(
|
|
@@ -9961,7 +10215,7 @@ function createKeyResultsCommand() {
|
|
|
9961
10215
|
return kr;
|
|
9962
10216
|
}
|
|
9963
10217
|
function createGoalCommentsCommand() {
|
|
9964
|
-
const comment = new
|
|
10218
|
+
const comment = new Command29("comment").description(
|
|
9965
10219
|
"Read and post comments on a goal. Mention teammates with --mention."
|
|
9966
10220
|
);
|
|
9967
10221
|
comment.command("list").description("List comments on a goal").requiredOption("--goal <id>", "Goal ID (a number)").action(async (options, cmd) => {
|
|
@@ -10056,7 +10310,7 @@ function createGoalCommentsCommand() {
|
|
|
10056
10310
|
return comment;
|
|
10057
10311
|
}
|
|
10058
10312
|
function createGoalsCommand() {
|
|
10059
|
-
const goals = new
|
|
10313
|
+
const goals = new Command29("goals").description(
|
|
10060
10314
|
"Manage goals (objectives) and their key results. Objectives have integer ids; key results are CUIDs."
|
|
10061
10315
|
);
|
|
10062
10316
|
goals.command("list").description(
|
|
@@ -10343,7 +10597,7 @@ Re-run with --with-key-results to go ahead, or move them with \`goals kr update
|
|
|
10343
10597
|
return goals;
|
|
10344
10598
|
}
|
|
10345
10599
|
function createOkrsCommand() {
|
|
10346
|
-
const okrs = new
|
|
10600
|
+
const okrs = new Command29("okrs").description(
|
|
10347
10601
|
"OKRs \u2014 objectives with their key results nested. Manage the parts with `goals` and `goals kr`."
|
|
10348
10602
|
);
|
|
10349
10603
|
okrs.command("list").description(
|
|
@@ -10432,7 +10686,7 @@ function isBareVersionRequest(args) {
|
|
|
10432
10686
|
return args.includes("--version") && args.every((arg) => arg.startsWith("-"));
|
|
10433
10687
|
}
|
|
10434
10688
|
function buildProgram() {
|
|
10435
|
-
const program = new
|
|
10689
|
+
const program = new Command30();
|
|
10436
10690
|
program.name("exponential").description(
|
|
10437
10691
|
[
|
|
10438
10692
|
"CLI to interact with Exponential productivity app.",
|
|
@@ -10463,6 +10717,7 @@ function buildProgram() {
|
|
|
10463
10717
|
program.addCommand(createTicketsCommand());
|
|
10464
10718
|
program.addCommand(createTimeCommand());
|
|
10465
10719
|
program.addCommand(createWorkspacesCommand());
|
|
10720
|
+
program.addCommand(createPositionsCommand());
|
|
10466
10721
|
program.addCommand(createGoalsCommand());
|
|
10467
10722
|
program.addCommand(createOkrsCommand());
|
|
10468
10723
|
return program;
|