exponential-cli 1.25.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 +91 -0
- package/dist/index.js +1509 -195
- 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) {
|
|
@@ -2787,6 +2787,298 @@ CSV preview: ${preview.importable} of ${preview.total} row${preview.total === 1
|
|
|
2787
2787
|
outputCsvSkipped(skipped);
|
|
2788
2788
|
console.log(chalk3.gray("\n Nothing was created. Run again without --dry-run to import."));
|
|
2789
2789
|
}
|
|
2790
|
+
function getOccurrenceStatusColor(status) {
|
|
2791
|
+
switch (status) {
|
|
2792
|
+
case "AGENDA_CIRCULATED":
|
|
2793
|
+
case "IN_PROGRESS":
|
|
2794
|
+
return "blue";
|
|
2795
|
+
case "CAPTURED":
|
|
2796
|
+
case "FOLLOWED_THROUGH":
|
|
2797
|
+
return "green";
|
|
2798
|
+
case "SKIPPED":
|
|
2799
|
+
return "yellow";
|
|
2800
|
+
default:
|
|
2801
|
+
return "gray";
|
|
2802
|
+
}
|
|
2803
|
+
}
|
|
2804
|
+
function formatInZone(value, timezone) {
|
|
2805
|
+
const date = new Date(value);
|
|
2806
|
+
try {
|
|
2807
|
+
return date.toLocaleString(void 0, {
|
|
2808
|
+
timeZone: timezone,
|
|
2809
|
+
weekday: "short",
|
|
2810
|
+
year: "numeric",
|
|
2811
|
+
month: "short",
|
|
2812
|
+
day: "numeric",
|
|
2813
|
+
hour: "2-digit",
|
|
2814
|
+
minute: "2-digit",
|
|
2815
|
+
timeZoneName: "short"
|
|
2816
|
+
});
|
|
2817
|
+
} catch {
|
|
2818
|
+
return date.toLocaleString();
|
|
2819
|
+
}
|
|
2820
|
+
}
|
|
2821
|
+
function outputCeremoniesJson(ceremonies, extra = {}) {
|
|
2822
|
+
console.log(JSON.stringify({ ceremonies, total: ceremonies.length, ...extra }, null, 2));
|
|
2823
|
+
}
|
|
2824
|
+
function outputCeremoniesPretty(ceremonies) {
|
|
2825
|
+
if (ceremonies.length === 0) {
|
|
2826
|
+
console.log(chalk3.gray("No ceremonies found."));
|
|
2827
|
+
return;
|
|
2828
|
+
}
|
|
2829
|
+
console.log(chalk3.bold(`
|
|
2830
|
+
Ceremonies (${ceremonies.length})`));
|
|
2831
|
+
console.log(chalk3.gray("\u2500".repeat(50)));
|
|
2832
|
+
for (const c of ceremonies) {
|
|
2833
|
+
const inactive = c.isActive ? "" : chalk3.red(" [inactive]");
|
|
2834
|
+
console.log(` ${chalk3.bold(c.name)} ${chalk3.gray(`(${c.slug})`)} ${chalk3.cyan(`[${c.kind}]`)}${inactive}`);
|
|
2835
|
+
console.log(chalk3.gray(` ID: ${c.id}`));
|
|
2836
|
+
console.log(
|
|
2837
|
+
chalk3.gray(
|
|
2838
|
+
` ${c.cadenceRule ?? "one-off"} \xB7 ${c.timezone} \xB7 ${c.durationMinutes} min \xB7 owner ${c.owner?.name ?? c.ownerId} \xB7 ${c._count.participants} participants \xB7 ${c._count.occurrences} occurrences`
|
|
2839
|
+
)
|
|
2840
|
+
);
|
|
2841
|
+
}
|
|
2842
|
+
console.log();
|
|
2843
|
+
}
|
|
2844
|
+
function outputCeremonyJson(ceremony) {
|
|
2845
|
+
console.log(JSON.stringify(ceremony, null, 2));
|
|
2846
|
+
}
|
|
2847
|
+
function outputCeremonyPretty(c) {
|
|
2848
|
+
console.log(chalk3.gray("\u2500".repeat(50)));
|
|
2849
|
+
const inactive = c.isActive ? "" : chalk3.red(" [inactive]");
|
|
2850
|
+
console.log(`
|
|
2851
|
+
${chalk3.bold(c.name)} ${chalk3.cyan(`[${c.kind}]`)}${inactive}`);
|
|
2852
|
+
console.log(chalk3.gray(` ID: ${c.id} \xB7 slug: ${c.slug}`));
|
|
2853
|
+
console.log(
|
|
2854
|
+
` ${chalk3.gray("Cadence:")} ${c.isOneOff ? "one-off meeting" : c.cadenceRule ?? "none"} (${c.timezone}), ${c.durationMinutes} min, agenda ${c.leadTimeHours}h ahead`
|
|
2855
|
+
);
|
|
2856
|
+
if (c.meetingUrl) console.log(` ${chalk3.gray("Room:")} ${c.meetingUrl}`);
|
|
2857
|
+
if (c.autoExtractOutputs) console.log(` ${chalk3.gray("Outputs:")} extracted automatically from recordings`);
|
|
2858
|
+
console.log(` ${chalk3.gray("Owner:")} ${c.owner?.name ?? c.owner?.email ?? c.ownerId}`);
|
|
2859
|
+
if (c.participants.length > 0) {
|
|
2860
|
+
console.log(` ${chalk3.gray("Participants:")} ${c.participants.map((p) => p.user.name ?? p.user.email ?? p.userId).join(", ")}`);
|
|
2861
|
+
}
|
|
2862
|
+
if (c.product) console.log(` ${chalk3.gray("Product:")} ${c.product.name}`);
|
|
2863
|
+
if (c.team) console.log(` ${chalk3.gray("Team:")} ${c.team.name}`);
|
|
2864
|
+
if (c.projects.length > 0) {
|
|
2865
|
+
console.log(` ${chalk3.gray("Projects:")} ${c.projects.map((p) => p.project.name).join(", ")}`);
|
|
2866
|
+
}
|
|
2867
|
+
if (c.aliases.length > 0) console.log(` ${chalk3.gray("Aliases:")} ${c.aliases.join(", ")}`);
|
|
2868
|
+
for (const [label, body] of [
|
|
2869
|
+
["Purpose", c.purpose],
|
|
2870
|
+
["Not for", c.notFor],
|
|
2871
|
+
["Inputs", c.inputs],
|
|
2872
|
+
["Outputs", c.outputs]
|
|
2873
|
+
]) {
|
|
2874
|
+
if (body) console.log(`
|
|
2875
|
+
${chalk3.bold(label)}
|
|
2876
|
+
${body}`);
|
|
2877
|
+
}
|
|
2878
|
+
if (c.agendaTemplate.length > 0) {
|
|
2879
|
+
console.log(`
|
|
2880
|
+
${chalk3.bold("Agenda template")}`);
|
|
2881
|
+
for (const s of c.agendaTemplate) {
|
|
2882
|
+
console.log(` - ${s.title} ${chalk3.gray(`(${s.type}${s.minutes ? `, ${s.minutes} min` : ""})`)}`);
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
if (c.occurrences.length > 0) {
|
|
2886
|
+
console.log(`
|
|
2887
|
+
${chalk3.bold("Occurrences")} ${chalk3.gray("(newest first)")}`);
|
|
2888
|
+
for (const o of c.occurrences) {
|
|
2889
|
+
const color = getOccurrenceStatusColor(o.status);
|
|
2890
|
+
const moved = o.cadenceStart === null ? chalk3.gray(" \xB7 added off-cadence") : new Date(o.cadenceStart).getTime() !== new Date(o.scheduledStart).getTime() ? chalk3.gray(` \xB7 moved from ${formatInZone(o.cadenceStart, c.timezone)}`) : "";
|
|
2891
|
+
const recs = o.recordedMeetings.length > 0 ? chalk3.gray(` \xB7 ${o.recordedMeetings.length} recording${o.recordedMeetings.length === 1 ? "" : "s"}`) : "";
|
|
2892
|
+
console.log(` ${formatInZone(o.scheduledStart, c.timezone)} ${chalk3[color](`[${o.status}]`)}${moved}${recs}`);
|
|
2893
|
+
console.log(chalk3.gray(` ID: ${o.id}${o.skipReason ? ` \xB7 skipped: ${o.skipReason}` : ""}`));
|
|
2894
|
+
}
|
|
2895
|
+
}
|
|
2896
|
+
console.log();
|
|
2897
|
+
}
|
|
2898
|
+
function outputCeremonyTemplatesPretty(templates) {
|
|
2899
|
+
console.log(chalk3.bold(`
|
|
2900
|
+
Ceremony templates (${templates.length})`));
|
|
2901
|
+
console.log(chalk3.gray("\u2500".repeat(50)));
|
|
2902
|
+
for (const t of templates) {
|
|
2903
|
+
console.log(` ${chalk3.bold(t.name)} ${chalk3.gray(`(${t.slug})`)} ${chalk3.cyan(`[${t.kind}]`)}`);
|
|
2904
|
+
console.log(chalk3.gray(` ${t.cadenceRule} \xB7 ${t.durationMinutes} min \xB7 ${t.agendaTemplate.length} agenda sections`));
|
|
2905
|
+
if (t.purpose) console.log(chalk3.gray(` ${t.purpose}`));
|
|
2906
|
+
}
|
|
2907
|
+
console.log();
|
|
2908
|
+
}
|
|
2909
|
+
function outputCeremonyWritePretty(result, verb) {
|
|
2910
|
+
const c = result.ceremony;
|
|
2911
|
+
console.log(`\u2713 Ceremony ${verb}: ${chalk3.bold(c.name)} ${chalk3.gray(`(${c.slug})`)}`);
|
|
2912
|
+
console.log(chalk3.gray(` ID: ${c.id}`));
|
|
2913
|
+
if (result.occurrencesCreated > 0) {
|
|
2914
|
+
console.log(chalk3.gray(` ${result.occurrencesCreated} occurrence${result.occurrencesCreated === 1 ? "" : "s"} scheduled`));
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
function outputOccurrencesJson(occurrences, extra = {}) {
|
|
2918
|
+
console.log(JSON.stringify({ occurrences, total: occurrences.length, ...extra }, null, 2));
|
|
2919
|
+
}
|
|
2920
|
+
function outputOccurrencesPretty(occurrences) {
|
|
2921
|
+
if (occurrences.length === 0) {
|
|
2922
|
+
console.log(chalk3.gray("No occurrences in this window."));
|
|
2923
|
+
return;
|
|
2924
|
+
}
|
|
2925
|
+
console.log(chalk3.bold(`
|
|
2926
|
+
Occurrences (${occurrences.length})`));
|
|
2927
|
+
console.log(chalk3.gray("\u2500".repeat(50)));
|
|
2928
|
+
for (const o of occurrences) {
|
|
2929
|
+
const color = getOccurrenceStatusColor(o.status);
|
|
2930
|
+
console.log(` ${formatInZone(o.scheduledStart)} ${chalk3.bold(o.ceremony.name)} ${chalk3[color](`[${o.status}]`)}`);
|
|
2931
|
+
console.log(chalk3.gray(` ID: ${o.id} \xB7 ceremony ${o.ceremonyId}`));
|
|
2932
|
+
}
|
|
2933
|
+
console.log();
|
|
2934
|
+
}
|
|
2935
|
+
function outputOccurrenceJson(occurrence, extras = {}) {
|
|
2936
|
+
console.log(JSON.stringify({ ...occurrence, ...extras }, null, 2));
|
|
2937
|
+
}
|
|
2938
|
+
function outputAgendaPretty(agenda) {
|
|
2939
|
+
if (!agenda) {
|
|
2940
|
+
console.log(chalk3.gray("\nNo agenda generated yet."));
|
|
2941
|
+
return;
|
|
2942
|
+
}
|
|
2943
|
+
console.log(`
|
|
2944
|
+
${chalk3.bold("Agenda")} ${chalk3.gray(`(generated ${new Date(agenda.generatedAt).toLocaleString()})`)}`);
|
|
2945
|
+
for (const section of agenda.sections) {
|
|
2946
|
+
const minutes = section.minutes ? chalk3.gray(` \xB7 ${section.minutes} min`) : "";
|
|
2947
|
+
console.log(`
|
|
2948
|
+
${chalk3.bold(section.title)}${minutes} ${chalk3.gray(`[${section.key}]`)}`);
|
|
2949
|
+
if (section.items.length === 0) {
|
|
2950
|
+
console.log(chalk3.gray(` ${section.emptyReason ?? "Nothing here."}`));
|
|
2951
|
+
}
|
|
2952
|
+
for (const item of section.items) {
|
|
2953
|
+
const box = item.resolvedAt ? chalk3.green("[x]") : "[ ]";
|
|
2954
|
+
const carried = item.carryCount ? chalk3.yellow(` \u21BB${item.carryCount}`) : "";
|
|
2955
|
+
console.log(` ${box} ${item.title}${carried}`);
|
|
2956
|
+
const meta = [item.detail, `${item.refType} \xB7 id ${item.id}`].filter(Boolean).join(" \xB7 ");
|
|
2957
|
+
console.log(chalk3.gray(` ${meta}`));
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2960
|
+
if (agenda.narrative) {
|
|
2961
|
+
console.log(`
|
|
2962
|
+
${chalk3.bold("Summary")}
|
|
2963
|
+
${agenda.narrative}`);
|
|
2964
|
+
}
|
|
2965
|
+
}
|
|
2966
|
+
function outputOccurrenceUpdatesPretty(summary) {
|
|
2967
|
+
if (summary.questions.length === 0) {
|
|
2968
|
+
console.log(chalk3.gray("This ceremony kind has no async updates."));
|
|
2969
|
+
return;
|
|
2970
|
+
}
|
|
2971
|
+
console.log(
|
|
2972
|
+
chalk3.bold(`
|
|
2973
|
+
Async updates: ${summary.submittedCount} of ${summary.participants.length} submitted`) + (summary.blockedCount > 0 ? chalk3.red(` \xB7 ${summary.blockedCount} blocked`) : "")
|
|
2974
|
+
);
|
|
2975
|
+
for (const p of summary.participants) {
|
|
2976
|
+
const state = p.submittedAt ? chalk3.green("submitted") : chalk3.gray("not yet");
|
|
2977
|
+
const blocked = p.flaggedBlocker ? chalk3.red(" [blocked]") : "";
|
|
2978
|
+
console.log(`
|
|
2979
|
+
${chalk3.bold(p.name ?? p.email ?? p.userId)} ${state}${blocked}`);
|
|
2980
|
+
for (const q of summary.questions) {
|
|
2981
|
+
const answer = p.answers[q.key];
|
|
2982
|
+
if (answer) console.log(` ${chalk3.gray(q.prompt)}
|
|
2983
|
+
${answer.replace(/\n/g, "\n ")}`);
|
|
2984
|
+
}
|
|
2985
|
+
}
|
|
2986
|
+
console.log();
|
|
2987
|
+
}
|
|
2988
|
+
function outputMyOccurrenceUpdatePretty(update) {
|
|
2989
|
+
if (update.questions.length === 0) {
|
|
2990
|
+
console.log(chalk3.gray("This ceremony kind has no async updates."));
|
|
2991
|
+
return;
|
|
2992
|
+
}
|
|
2993
|
+
const state = update.submittedAt ? chalk3.green(`submitted ${new Date(update.submittedAt).toLocaleString()}`) : chalk3.gray("not submitted");
|
|
2994
|
+
console.log(`
|
|
2995
|
+
${chalk3.bold("Your update")} ${state}${update.flaggedBlocker ? chalk3.red(" [blocked]") : ""}`);
|
|
2996
|
+
if (update.isParticipant === false) {
|
|
2997
|
+
console.log(chalk3.yellow(" You aren't a participant of this ceremony."));
|
|
2998
|
+
}
|
|
2999
|
+
for (const q of update.questions) {
|
|
3000
|
+
const answer = update.answers[q.key];
|
|
3001
|
+
const draft = update.draftAnswers[q.key];
|
|
3002
|
+
console.log(`
|
|
3003
|
+
${chalk3.bold(q.prompt)} ${chalk3.gray(`[${q.key}]`)}`);
|
|
3004
|
+
if (answer) console.log(` ${answer.replace(/\n/g, "\n ")}`);
|
|
3005
|
+
else if (draft) console.log(chalk3.gray(` (draft) ${draft.replace(/\n/g, "\n ")}`));
|
|
3006
|
+
else console.log(chalk3.gray(" \u2014"));
|
|
3007
|
+
}
|
|
3008
|
+
console.log();
|
|
3009
|
+
}
|
|
3010
|
+
function outputOccurrencePretty(o, extras = {}) {
|
|
3011
|
+
const tz = o.ceremony.timezone;
|
|
3012
|
+
const color = getOccurrenceStatusColor(o.status);
|
|
3013
|
+
console.log(chalk3.gray("\u2500".repeat(50)));
|
|
3014
|
+
console.log(`
|
|
3015
|
+
${chalk3.bold(o.ceremony.name)} \u2014 ${formatInZone(o.scheduledStart, tz)} ${chalk3[color](`[${o.status}]`)}`);
|
|
3016
|
+
console.log(chalk3.gray(` ID: ${o.id} \xB7 ceremony ${o.ceremonyId}`));
|
|
3017
|
+
console.log(` ${chalk3.gray("Owner:")} ${o.ceremony.owner?.name ?? o.ceremony.owner?.email ?? o.ceremony.ownerId}`);
|
|
3018
|
+
if (o.isOneOff) console.log(` ${chalk3.gray("One-off meeting")}${o.purpose ? `: ${o.purpose}` : ""}`);
|
|
3019
|
+
if (o.cadenceStart && new Date(o.cadenceStart).getTime() !== new Date(o.scheduledStart).getTime()) {
|
|
3020
|
+
console.log(` ${chalk3.gray("Moved from:")} ${formatInZone(o.cadenceStart, tz)}`);
|
|
3021
|
+
}
|
|
3022
|
+
if (o.scheduledMeeting) {
|
|
3023
|
+
const names = o.scheduledMeeting.attendees.map((a) => a.name ?? a.userId).filter(Boolean);
|
|
3024
|
+
console.log(
|
|
3025
|
+
` ${chalk3.gray("Booking:")} ${o.scheduledMeeting.status}${names.length > 0 ? ` \xB7 ${names.join(", ")}` : ""}`
|
|
3026
|
+
);
|
|
3027
|
+
}
|
|
3028
|
+
if (o.skipReason) console.log(` ${chalk3.gray("Skipped:")} ${o.skipReason}`);
|
|
3029
|
+
if (o.agendaCirculatedAt) {
|
|
3030
|
+
console.log(` ${chalk3.gray("Agenda circulated:")} ${formatInZone(o.agendaCirculatedAt, tz)}`);
|
|
3031
|
+
}
|
|
3032
|
+
if (o.skipProposal?.proposed) {
|
|
3033
|
+
console.log(chalk3.yellow(" The agenda is empty \u2014 this occurrence is a candidate to skip."));
|
|
3034
|
+
}
|
|
3035
|
+
if (o.recordedMeetings.length > 0) {
|
|
3036
|
+
console.log(` ${chalk3.gray("Recordings:")}`);
|
|
3037
|
+
for (const m of o.recordedMeetings) {
|
|
3038
|
+
console.log(m.visible ? ` ${m.title ?? "(untitled)"} ${chalk3.gray(m.id)}` : chalk3.gray(` (a recording you cannot view) ${m.id}`));
|
|
3039
|
+
}
|
|
3040
|
+
}
|
|
3041
|
+
if (o.notesPageId && extras.notes === void 0) {
|
|
3042
|
+
console.log(` ${chalk3.gray("Notes page:")} ${o.notesPageId} ${chalk3.gray("(--notes to include)")}`);
|
|
3043
|
+
}
|
|
3044
|
+
outputAgendaPretty(o.agenda);
|
|
3045
|
+
if (extras.notes !== void 0 && !extras.extrasErrors?.notes) {
|
|
3046
|
+
console.log(`
|
|
3047
|
+
${chalk3.bold("Notes")}`);
|
|
3048
|
+
console.log(extras.notes?.body ? extras.notes.body : chalk3.gray("No notes yet."));
|
|
3049
|
+
}
|
|
3050
|
+
if (extras.decisions) {
|
|
3051
|
+
console.log(`
|
|
3052
|
+
${chalk3.bold("Decisions and open questions")}`);
|
|
3053
|
+
if (extras.decisions.length === 0) console.log(chalk3.gray("None logged against this occurrence."));
|
|
3054
|
+
for (const d of extras.decisions) {
|
|
3055
|
+
console.log(` ${chalk3.gray(d.label)} ${d.statement} ${chalk3[getDecisionStatusColor(d.status)](`[${d.status}]`)}`);
|
|
3056
|
+
}
|
|
3057
|
+
}
|
|
3058
|
+
if (extras.updates) outputOccurrenceUpdatesPretty(extras.updates);
|
|
3059
|
+
for (const [section, message] of Object.entries(extras.extrasErrors ?? {})) {
|
|
3060
|
+
console.log(chalk3.yellow(`
|
|
3061
|
+
Couldn't load ${section}: ${message}`));
|
|
3062
|
+
}
|
|
3063
|
+
console.log();
|
|
3064
|
+
}
|
|
3065
|
+
function outputProjectOccurrencesPretty(rows) {
|
|
3066
|
+
if (rows.length === 0) {
|
|
3067
|
+
console.log(chalk3.gray("No meetings in this window."));
|
|
3068
|
+
return;
|
|
3069
|
+
}
|
|
3070
|
+
console.log(chalk3.bold(`
|
|
3071
|
+
Project meetings (${rows.length})`));
|
|
3072
|
+
console.log(chalk3.gray("\u2500".repeat(50)));
|
|
3073
|
+
for (const r of rows) {
|
|
3074
|
+
const color = getOccurrenceStatusColor(r.status);
|
|
3075
|
+
const oneOff = r.isOneOff ? chalk3.cyan(" [one-off]") : "";
|
|
3076
|
+
console.log(` ${formatInZone(r.scheduledStart)} ${chalk3.bold(r.ceremonyName)}${oneOff} ${chalk3[color](`[${r.status}]`)}`);
|
|
3077
|
+
const meta = [`ID: ${r.occurrenceId}`, `${r.attendeeCount} attendee${r.attendeeCount === 1 ? "" : "s"}`, r.purpose].filter(Boolean);
|
|
3078
|
+
console.log(chalk3.gray(` ${meta.join(" \xB7 ")}`));
|
|
3079
|
+
}
|
|
3080
|
+
console.log();
|
|
3081
|
+
}
|
|
2790
3082
|
|
|
2791
3083
|
// src/commands/actions.ts
|
|
2792
3084
|
var VALID_PRIORITIES = [
|
|
@@ -3278,86 +3570,841 @@ function createContactsCommand() {
|
|
|
3278
3570
|
const globalOpts = cmd.optsWithGlobals();
|
|
3279
3571
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3280
3572
|
try {
|
|
3281
|
-
if (!VALID_INTERACTION_TYPES.includes(options.type)) {
|
|
3282
|
-
throw new Error(`Invalid interaction type "${options.type}". Valid: ${VALID_INTERACTION_TYPES.join(", ")}`);
|
|
3283
|
-
}
|
|
3284
|
-
if (!VALID_INTERACTION_DIRECTIONS.includes(options.direction)) {
|
|
3285
|
-
throw new Error(`Invalid direction "${options.direction}". Valid: ${VALID_INTERACTION_DIRECTIONS.join(", ")}`);
|
|
3286
|
-
}
|
|
3573
|
+
if (!VALID_INTERACTION_TYPES.includes(options.type)) {
|
|
3574
|
+
throw new Error(`Invalid interaction type "${options.type}". Valid: ${VALID_INTERACTION_TYPES.join(", ")}`);
|
|
3575
|
+
}
|
|
3576
|
+
if (!VALID_INTERACTION_DIRECTIONS.includes(options.direction)) {
|
|
3577
|
+
throw new Error(`Invalid direction "${options.direction}". Valid: ${VALID_INTERACTION_DIRECTIONS.join(", ")}`);
|
|
3578
|
+
}
|
|
3579
|
+
const client = getClient();
|
|
3580
|
+
const interaction = await client.contacts.addInteraction({
|
|
3581
|
+
contactId: options.contact,
|
|
3582
|
+
type: options.type,
|
|
3583
|
+
direction: options.direction,
|
|
3584
|
+
subject: options.subject,
|
|
3585
|
+
notes: options.notes
|
|
3586
|
+
});
|
|
3587
|
+
if (useJson) {
|
|
3588
|
+
outputInteractionJson(interaction);
|
|
3589
|
+
} else {
|
|
3590
|
+
console.log("\n\u2713 Interaction added");
|
|
3591
|
+
outputInteractionPretty(interaction);
|
|
3592
|
+
}
|
|
3593
|
+
} catch (error) {
|
|
3594
|
+
handleError(error, useJson);
|
|
3595
|
+
}
|
|
3596
|
+
});
|
|
3597
|
+
contacts.command("enrich").description("Queue a web-search enrichment job for an existing contact (runs regardless of the workspace auto-enrich setting)").argument("<id>", "Contact ID").action(async (id, _options, cmd) => {
|
|
3598
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3599
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3600
|
+
try {
|
|
3601
|
+
const client = getClient();
|
|
3602
|
+
const result = await client.contacts.enrich(id);
|
|
3603
|
+
if (useJson) {
|
|
3604
|
+
console.log(JSON.stringify(result, null, 2));
|
|
3605
|
+
} else if (result.enqueued) {
|
|
3606
|
+
console.log(`
|
|
3607
|
+
\u2713 Enrichment queued for contact ${id} (job ${result.enrichmentId})`);
|
|
3608
|
+
} else if (result.reason === "already-in-flight") {
|
|
3609
|
+
console.log(`
|
|
3610
|
+
\u2022 Enrichment already in progress for contact ${id} (job ${result.enrichmentId})`);
|
|
3611
|
+
} else {
|
|
3612
|
+
console.log(`
|
|
3613
|
+
\u2022 Not queued for contact ${id}${result.reason ? ` (${result.reason})` : ""}`);
|
|
3614
|
+
}
|
|
3615
|
+
} catch (error) {
|
|
3616
|
+
handleError(error, useJson);
|
|
3617
|
+
}
|
|
3618
|
+
});
|
|
3619
|
+
return contacts;
|
|
3620
|
+
}
|
|
3621
|
+
|
|
3622
|
+
// src/commands/ceremonies.ts
|
|
3623
|
+
import { Command as Command4 } from "commander";
|
|
3624
|
+
import chalk4 from "chalk";
|
|
3625
|
+
|
|
3626
|
+
// src/utils/input.ts
|
|
3627
|
+
import { readFileSync } from "fs";
|
|
3628
|
+
var stdinConsumed = false;
|
|
3629
|
+
function readText(inline, file) {
|
|
3630
|
+
if (inline !== void 0) return inline;
|
|
3631
|
+
if (file === void 0) return void 0;
|
|
3632
|
+
if (file === "-") {
|
|
3633
|
+
if (stdinConsumed) {
|
|
3634
|
+
throw new Error('stdin ("-") can only back one option per invocation.');
|
|
3635
|
+
}
|
|
3636
|
+
stdinConsumed = true;
|
|
3637
|
+
return readFileSync(0, "utf-8");
|
|
3638
|
+
}
|
|
3639
|
+
return readFileSync(file, "utf-8");
|
|
3640
|
+
}
|
|
3641
|
+
function parseDate(value) {
|
|
3642
|
+
if (value === void 0 || value === "") return void 0;
|
|
3643
|
+
const date = /^\d{4}-\d{2}-\d{2}$/.test(value) ? /* @__PURE__ */ new Date(`${value}T00:00:00`) : new Date(value);
|
|
3644
|
+
if (Number.isNaN(date.getTime())) {
|
|
3645
|
+
throw new Error(
|
|
3646
|
+
`Invalid date: "${value}". Use ISO format, e.g. 2026-08-25 or 2026-08-25T14:00.`
|
|
3647
|
+
);
|
|
3648
|
+
}
|
|
3649
|
+
return date;
|
|
3650
|
+
}
|
|
3651
|
+
|
|
3652
|
+
// src/commands/ceremonies.ts
|
|
3653
|
+
var KINDS = [
|
|
3654
|
+
"STANDUP",
|
|
3655
|
+
"PLANNING",
|
|
3656
|
+
"REVIEW",
|
|
3657
|
+
"RETROSPECTIVE",
|
|
3658
|
+
"PRIORITISATION",
|
|
3659
|
+
"ALL_HANDS",
|
|
3660
|
+
"ONE_ON_ONE",
|
|
3661
|
+
"CUSTOM"
|
|
3662
|
+
];
|
|
3663
|
+
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
3664
|
+
var CUID = /^c[a-z0-9]{24}$/;
|
|
3665
|
+
var OCCURRENCE_LIST_CAP = 200;
|
|
3666
|
+
function parseKind(value) {
|
|
3667
|
+
const upper = value.toUpperCase().replace(/-/g, "_");
|
|
3668
|
+
if (!KINDS.includes(upper)) {
|
|
3669
|
+
throw new Error(`Invalid kind "${value}". Use one of: ${KINDS.join(", ")}`);
|
|
3670
|
+
}
|
|
3671
|
+
return upper;
|
|
3672
|
+
}
|
|
3673
|
+
function parseIntInRange(value, flag, min, max) {
|
|
3674
|
+
if (value === void 0) return void 0;
|
|
3675
|
+
const n = Number(value);
|
|
3676
|
+
if (!Number.isInteger(n) || n < min || n > max) {
|
|
3677
|
+
throw new Error(`${flag} must be an integer from ${min} to ${max} (got "${value}").`);
|
|
3678
|
+
}
|
|
3679
|
+
return n;
|
|
3680
|
+
}
|
|
3681
|
+
var collect = (value, previous) => [...previous, value];
|
|
3682
|
+
var DATE_ONLY = /^\d{4}-\d{2}-\d{2}$/;
|
|
3683
|
+
function parseCalendarDate(value) {
|
|
3684
|
+
const parsed = parseDate(value);
|
|
3685
|
+
return value !== void 0 && DATE_ONLY.test(value) ? /* @__PURE__ */ new Date(`${value}T00:00:00.000Z`) : parsed;
|
|
3686
|
+
}
|
|
3687
|
+
function parseWindowEnd(value) {
|
|
3688
|
+
const parsed = parseDate(value);
|
|
3689
|
+
return value !== void 0 && DATE_ONLY.test(value) ? /* @__PURE__ */ new Date(`${value}T23:59:59.999`) : parsed;
|
|
3690
|
+
}
|
|
3691
|
+
function parseCeremonyRef(value) {
|
|
3692
|
+
const match = value.match(/\/w\/([^/?#]+)\/ceremonies\/([^/?#]+)(?:\/([^/?#]+))?/);
|
|
3693
|
+
if (!match) return { id: value };
|
|
3694
|
+
const [, workspaceSlug, ceremonyId, occurrenceId] = match;
|
|
3695
|
+
return {
|
|
3696
|
+
workspaceSlug,
|
|
3697
|
+
ceremonyId,
|
|
3698
|
+
occurrenceId,
|
|
3699
|
+
id: occurrenceId ?? ceremonyId
|
|
3700
|
+
};
|
|
3701
|
+
}
|
|
3702
|
+
function parseOccurrenceRef(value) {
|
|
3703
|
+
const ref = parseCeremonyRef(value);
|
|
3704
|
+
if (ref.ceremonyId && !ref.occurrenceId) {
|
|
3705
|
+
throw new Error(
|
|
3706
|
+
"That URL is a ceremony, not one of its occurrences. List them with `ceremonies occurrences list --ceremony <url>`."
|
|
3707
|
+
);
|
|
3708
|
+
}
|
|
3709
|
+
return ref;
|
|
3710
|
+
}
|
|
3711
|
+
async function resolveCeremonyId(client, workspaceId, ref) {
|
|
3712
|
+
if (CUID.test(ref)) return ref;
|
|
3713
|
+
const all = await client.ceremonies.list(workspaceId, { includeInactive: true });
|
|
3714
|
+
const hit = all.find((c) => c.slug === ref || c.id === ref);
|
|
3715
|
+
if (!hit) {
|
|
3716
|
+
throw new Error(
|
|
3717
|
+
`No ceremony "${ref}" in this workspace. Run \`exponential ceremonies list\` to see slugs and ids.`
|
|
3718
|
+
);
|
|
3719
|
+
}
|
|
3720
|
+
return hit.id;
|
|
3721
|
+
}
|
|
3722
|
+
async function workspaceFor(client, ref, flag) {
|
|
3723
|
+
return resolveWorkspaceId(client, ref.workspaceSlug ?? flag);
|
|
3724
|
+
}
|
|
3725
|
+
function readAgendaTemplate(file) {
|
|
3726
|
+
const raw = readText(void 0, file);
|
|
3727
|
+
if (raw === void 0) return void 0;
|
|
3728
|
+
const parsed = JSON.parse(raw);
|
|
3729
|
+
if (!Array.isArray(parsed)) {
|
|
3730
|
+
throw new Error("--agenda-file must hold a JSON array of { key, type, title, minutes?, config? } sections.");
|
|
3731
|
+
}
|
|
3732
|
+
return parsed;
|
|
3733
|
+
}
|
|
3734
|
+
function parseSuppliedAnswers(pairs, file) {
|
|
3735
|
+
const answers = {};
|
|
3736
|
+
const raw = readText(void 0, file);
|
|
3737
|
+
if (raw !== void 0) {
|
|
3738
|
+
const parsed = JSON.parse(raw);
|
|
3739
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
3740
|
+
throw new Error("--answers-file must hold a JSON object of { questionKey: markdown }.");
|
|
3741
|
+
}
|
|
3742
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
3743
|
+
if (typeof value !== "string") {
|
|
3744
|
+
throw new Error(`--answers-file: the answer for "${key}" must be a string.`);
|
|
3745
|
+
}
|
|
3746
|
+
answers[key] = value;
|
|
3747
|
+
}
|
|
3748
|
+
}
|
|
3749
|
+
for (const pair of pairs) {
|
|
3750
|
+
const eq = pair.indexOf("=");
|
|
3751
|
+
if (eq <= 0) throw new Error(`--answer takes key=markdown (got "${pair}").`);
|
|
3752
|
+
answers[pair.slice(0, eq)] = pair.slice(eq + 1);
|
|
3753
|
+
}
|
|
3754
|
+
return answers;
|
|
3755
|
+
}
|
|
3756
|
+
function addDefinitionOptions(cmd) {
|
|
3757
|
+
return cmd.option("--name <name>", "Display name (max 120 chars)").option("--slug <slug>", "Workspace-unique slug (derived from the name when omitted)").option("--kind <kind>", `One of: ${KINDS.join(", ")}`).option(
|
|
3758
|
+
"--cadence <rrule>",
|
|
3759
|
+
'RRULE body, e.g. "FREQ=WEEKLY;BYDAY=MO;BYHOUR=10;BYMINUTE=0"'
|
|
3760
|
+
).option("--timezone <iana>", "IANA zone the cadence runs in, e.g. Europe/Madrid").option("--starts-on <date>", "Anchor date the cadence expands from (YYYY-MM-DD)").option("--duration <minutes>", "Length in minutes (5-1440)").option("--lead-time <hours>", "Hours before the start to generate and circulate the agenda (0-336)").option("--owner <userId>", "Owner user id (defaults to you on create)").option("--participant <userId>", "Participant user id (repeatable; replaces the set on update)", collect, []).option("--project <projectId>", "Reviewed project id (repeatable; replaces the set on update)", collect, []).option("--alias <title>", "Meeting-title alias for auto-attach (repeatable; replaces the set on update)", collect, []).option("--product <productId>", "Scope to a product id").option("--purpose <markdown>", "Purpose (Markdown)").option("--purpose-file <path>", 'Purpose from a file ("-" = stdin)').option("--not-for <markdown>", "What this ceremony is NOT for (Markdown)").option("--inputs <markdown>", "Required inputs (Markdown)").option("--outputs <markdown>", "Expected outputs (Markdown)").option("--agenda-file <path>", 'Agenda template: JSON array of { key, type, title, minutes? } ("-" = stdin)').option("--include-projects", "Append the linked-projects section to agendas").option("--no-include-projects", "Do not append the linked-projects section to agendas").option("--meeting-url <url>", 'Video room the ceremony meets in; recordings from it file themselves here ("" clears it)').option("--auto-extract-outputs", "Extract outputs from every recording attached to an occurrence").option("--no-auto-extract-outputs", "Stop extracting outputs automatically");
|
|
3761
|
+
}
|
|
3762
|
+
function definitionFields(options, cmd) {
|
|
3763
|
+
const fields = {};
|
|
3764
|
+
if (options.name !== void 0) fields.name = options.name;
|
|
3765
|
+
if (options.slug !== void 0) fields.slug = options.slug;
|
|
3766
|
+
if (options.kind !== void 0) fields.kind = parseKind(options.kind);
|
|
3767
|
+
if (options.cadence !== void 0) fields.cadenceRule = options.cadence;
|
|
3768
|
+
if (options.timezone !== void 0) fields.timezone = options.timezone;
|
|
3769
|
+
if (options.startsOn !== void 0) fields.startsOn = parseCalendarDate(options.startsOn);
|
|
3770
|
+
const duration = parseIntInRange(options.duration, "--duration", 5, 24 * 60);
|
|
3771
|
+
if (duration !== void 0) fields.durationMinutes = duration;
|
|
3772
|
+
const leadTime = parseIntInRange(options.leadTime, "--lead-time", 0, 24 * 14);
|
|
3773
|
+
if (leadTime !== void 0) fields.leadTimeHours = leadTime;
|
|
3774
|
+
if (options.owner !== void 0) fields.ownerId = options.owner;
|
|
3775
|
+
if (options.participant.length > 0) fields.participantUserIds = options.participant;
|
|
3776
|
+
if (options.project.length > 0) fields.projectIds = options.project;
|
|
3777
|
+
if (options.alias.length > 0) fields.aliases = options.alias;
|
|
3778
|
+
if (options.product !== void 0) fields.productId = options.product;
|
|
3779
|
+
const purpose = readText(options.purpose, options.purposeFile);
|
|
3780
|
+
if (purpose !== void 0) fields.purpose = purpose;
|
|
3781
|
+
if (options.notFor !== void 0) fields.notFor = options.notFor;
|
|
3782
|
+
if (options.inputs !== void 0) fields.inputs = options.inputs;
|
|
3783
|
+
if (options.outputs !== void 0) fields.outputs = options.outputs;
|
|
3784
|
+
const agenda = readAgendaTemplate(options.agendaFile);
|
|
3785
|
+
if (agenda !== void 0) fields.agendaTemplate = agenda;
|
|
3786
|
+
if (cmd.getOptionValueSource("includeProjects") === "cli") {
|
|
3787
|
+
fields.includeProjects = options.includeProjects;
|
|
3788
|
+
}
|
|
3789
|
+
if (options.meetingUrl !== void 0) fields.meetingUrl = options.meetingUrl;
|
|
3790
|
+
if (cmd.getOptionValueSource("autoExtractOutputs") === "cli") {
|
|
3791
|
+
fields.autoExtractOutputs = options.autoExtractOutputs;
|
|
3792
|
+
}
|
|
3793
|
+
return fields;
|
|
3794
|
+
}
|
|
3795
|
+
function parseDateTime(value, flag) {
|
|
3796
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
3797
|
+
throw new Error(`${flag} needs a time too, e.g. 2026-11-04T10:00 (local) or 2026-11-04T09:00Z.`);
|
|
3798
|
+
}
|
|
3799
|
+
const date = parseDate(value);
|
|
3800
|
+
if (!date) throw new Error(`${flag} is required.`);
|
|
3801
|
+
return date;
|
|
3802
|
+
}
|
|
3803
|
+
function createOccurrencesCommand() {
|
|
3804
|
+
const occurrences = new Command4("occurrences").alias("occurrence").description(
|
|
3805
|
+
[
|
|
3806
|
+
"Scheduled instances of a ceremony \u2014 the page at /w/<slug>/ceremonies/<ceremonyId>/<occurrenceId>.",
|
|
3807
|
+
"Every <occurrence> argument takes the occurrence CUID or that full URL (the URL brings its own workspace)."
|
|
3808
|
+
].join("\n")
|
|
3809
|
+
);
|
|
3810
|
+
occurrences.command("list").description(
|
|
3811
|
+
[
|
|
3812
|
+
"Occurrences starting in a window, oldest first (max 200). Default window: 14 days either side of now.",
|
|
3813
|
+
"--project <id> instead shows that project's Meetings timeline: newest first, one-offs included,",
|
|
3814
|
+
"two weeks back to one week ahead by default, at most --per-ceremony rows per recurring ceremony, and leaving",
|
|
3815
|
+
"out occurrences a recording on that project already captured."
|
|
3816
|
+
].join(" ")
|
|
3817
|
+
).option("--workspace <slug|id>", "Workspace (defaults to your default workspace)").option("--ceremony <slug|id>", "Only this ceremony").option("--project <id>", "A project's Meetings timeline (no workspace needed)").option("--per-ceremony <n>", "With --project: rows per recurring ceremony (1-20, default 5)").option("--from <date>", "Window start (YYYY-MM-DD or ISO)").option("--to <date>", "Window end (YYYY-MM-DD or ISO)").action(
|
|
3818
|
+
async (options, cmd) => {
|
|
3819
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3820
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3821
|
+
try {
|
|
3822
|
+
const client = getClient();
|
|
3823
|
+
if (options.project) {
|
|
3824
|
+
if (options.ceremony) throw new Error("Pass --project or --ceremony, not both.");
|
|
3825
|
+
const rows2 = await client.ceremonies.listOccurrencesForProject({
|
|
3826
|
+
projectId: options.project,
|
|
3827
|
+
from: parseDate(options.from),
|
|
3828
|
+
to: parseWindowEnd(options.to),
|
|
3829
|
+
perCeremony: parseIntInRange(options.perCeremony, "--per-ceremony", 1, 20)
|
|
3830
|
+
});
|
|
3831
|
+
if (useJson) {
|
|
3832
|
+
console.log(
|
|
3833
|
+
JSON.stringify(
|
|
3834
|
+
{
|
|
3835
|
+
occurrences: rows2.map((row) => ({ id: row.occurrenceId, ...row })),
|
|
3836
|
+
total: rows2.length,
|
|
3837
|
+
projectId: options.project
|
|
3838
|
+
},
|
|
3839
|
+
null,
|
|
3840
|
+
2
|
|
3841
|
+
)
|
|
3842
|
+
);
|
|
3843
|
+
} else {
|
|
3844
|
+
outputProjectOccurrencesPretty(rows2);
|
|
3845
|
+
}
|
|
3846
|
+
return;
|
|
3847
|
+
}
|
|
3848
|
+
const ref = options.ceremony ? parseCeremonyRef(options.ceremony) : void 0;
|
|
3849
|
+
const workspaceId = await workspaceFor(client, ref ?? {}, options.workspace);
|
|
3850
|
+
const now = Date.now();
|
|
3851
|
+
const from = parseDate(options.from) ?? new Date(now - 14 * DAY_MS);
|
|
3852
|
+
const to = parseWindowEnd(options.to) ?? new Date(now + 14 * DAY_MS);
|
|
3853
|
+
const ceremonyId = ref ? await resolveCeremonyId(client, workspaceId, ref.ceremonyId ?? ref.id) : void 0;
|
|
3854
|
+
const rows = await client.ceremonies.listOccurrences({ workspaceId, from, to, ceremonyId });
|
|
3855
|
+
if (useJson) {
|
|
3856
|
+
outputOccurrencesJson(rows, {
|
|
3857
|
+
workspaceId,
|
|
3858
|
+
from,
|
|
3859
|
+
to,
|
|
3860
|
+
ceremonyId: ceremonyId ?? null,
|
|
3861
|
+
// The server returns at most 200, oldest first, so a full page has lost the newest rows.
|
|
3862
|
+
truncated: rows.length >= OCCURRENCE_LIST_CAP
|
|
3863
|
+
});
|
|
3864
|
+
} else outputOccurrencesPretty(rows);
|
|
3865
|
+
} catch (error) {
|
|
3866
|
+
handleError(error, useJson);
|
|
3867
|
+
}
|
|
3868
|
+
}
|
|
3869
|
+
);
|
|
3870
|
+
occurrences.command("get <occurrence>").description(
|
|
3871
|
+
"One occurrence: status, agenda, recordings, notes page. --notes and --decisions pull in the rest of the meeting page."
|
|
3872
|
+
).option("--workspace <slug|id>", "Workspace (not needed when you pass the URL)").option("--notes", "Include the occurrence's notes page body").option("--decisions", "Include decisions and open questions logged against this occurrence").option("--updates", "Include participants' async updates (standups)").action(
|
|
3873
|
+
async (value, options, cmd) => {
|
|
3874
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3875
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3876
|
+
try {
|
|
3877
|
+
const client = getClient();
|
|
3878
|
+
const ref = parseOccurrenceRef(value);
|
|
3879
|
+
const workspaceId = await workspaceFor(client, ref, options.workspace);
|
|
3880
|
+
const occurrence = await client.ceremonies.getOccurrence(workspaceId, ref.id);
|
|
3881
|
+
const extrasErrors = {};
|
|
3882
|
+
const attempt = async (key, load) => {
|
|
3883
|
+
try {
|
|
3884
|
+
return await load();
|
|
3885
|
+
} catch (error) {
|
|
3886
|
+
extrasErrors[key] = error instanceof Error ? error.message : String(error);
|
|
3887
|
+
return null;
|
|
3888
|
+
}
|
|
3889
|
+
};
|
|
3890
|
+
const [notes, decisions, updates] = await Promise.all([
|
|
3891
|
+
options.notes ? attempt(
|
|
3892
|
+
"notes",
|
|
3893
|
+
async () => occurrence.notesPageId ? client.pages.get(occurrence.notesPageId) : null
|
|
3894
|
+
) : void 0,
|
|
3895
|
+
// `decision.list` has no occurrence filter server-side, so this reads
|
|
3896
|
+
// the workspace's confirmed log and filters it here.
|
|
3897
|
+
options.decisions ? attempt(
|
|
3898
|
+
"decisions",
|
|
3899
|
+
async () => (await client.decisions.list({ workspaceId })).filter(
|
|
3900
|
+
(d) => d.occurrenceId === occurrence.id
|
|
3901
|
+
)
|
|
3902
|
+
) : void 0,
|
|
3903
|
+
options.updates ? attempt("updates", () => client.ceremonies.updateSummary(workspaceId, occurrence.id)) : void 0
|
|
3904
|
+
]);
|
|
3905
|
+
const extras = {
|
|
3906
|
+
...options.notes ? { notes: notes ?? null } : {},
|
|
3907
|
+
...options.decisions ? { decisions: decisions ?? null } : {},
|
|
3908
|
+
...options.updates ? { updates: updates ?? null } : {},
|
|
3909
|
+
...Object.keys(extrasErrors).length > 0 ? { extrasErrors } : {}
|
|
3910
|
+
};
|
|
3911
|
+
if (useJson) outputOccurrenceJson(occurrence, extras);
|
|
3912
|
+
else outputOccurrencePretty(occurrence, extras);
|
|
3913
|
+
} catch (error) {
|
|
3914
|
+
handleError(error, useJson);
|
|
3915
|
+
}
|
|
3916
|
+
}
|
|
3917
|
+
);
|
|
3918
|
+
occurrences.command("updates <occurrence>").description("Every participant's async update for an occurrence, and who hasn't answered").option("--workspace <slug|id>", "Workspace (not needed when you pass the URL)").action(async (value, options, cmd) => {
|
|
3919
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3920
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3921
|
+
try {
|
|
3922
|
+
const client = getClient();
|
|
3923
|
+
const ref = parseOccurrenceRef(value);
|
|
3924
|
+
const workspaceId = await workspaceFor(client, ref, options.workspace);
|
|
3925
|
+
const summary = await client.ceremonies.updateSummary(workspaceId, ref.id);
|
|
3926
|
+
if (useJson) console.log(JSON.stringify(summary, null, 2));
|
|
3927
|
+
else outputOccurrenceUpdatesPretty(summary);
|
|
3928
|
+
} catch (error) {
|
|
3929
|
+
handleError(error, useJson);
|
|
3930
|
+
}
|
|
3931
|
+
});
|
|
3932
|
+
occurrences.command("my-update <occurrence>").description(
|
|
3933
|
+
[
|
|
3934
|
+
"Read, draft or write your own async update (standups ask: done, today, blockers).",
|
|
3935
|
+
"No flags: show it. --draft: fill a draft from your activity since the last occurrence.",
|
|
3936
|
+
"--answer key=markdown (repeatable) saves answers; --submit / --reopen changes its state."
|
|
3937
|
+
].join(" ")
|
|
3938
|
+
).option("--workspace <slug|id>", "Workspace (not needed when you pass the URL)").option("--draft", "Draft answers from your activity (leaves anything you wrote alone)").option("--answer <key=markdown>", "An answer by question key (repeatable)", collect, []).option("--answers-file <path>", 'Answers as a JSON object { key: markdown } ("-" = stdin)').option("--blocker", "Flag that something is blocking you").option("--no-blocker", "Clear the blocker flag").option("--submit", "Submit the update (refused if every answer is empty; see --allow-empty)").option("--allow-empty", "With --submit: submit even though every answer is empty").option("--reopen", "Reopen a submitted update").action(
|
|
3939
|
+
async (value, options, cmd) => {
|
|
3940
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3941
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3942
|
+
try {
|
|
3943
|
+
if (options.submit && options.reopen) {
|
|
3944
|
+
throw new Error("Pass --submit or --reopen, not both.");
|
|
3945
|
+
}
|
|
3946
|
+
if (options.draft && (options.submit || options.reopen)) {
|
|
3947
|
+
throw new Error("Run --draft on its own, review it, then --submit. To re-draft a submitted update, --reopen first.");
|
|
3948
|
+
}
|
|
3949
|
+
const supplied = parseSuppliedAnswers(options.answer, options.answersFile);
|
|
3950
|
+
const client = getClient();
|
|
3951
|
+
const ref = parseOccurrenceRef(value);
|
|
3952
|
+
const workspaceId = await workspaceFor(client, ref, options.workspace);
|
|
3953
|
+
const blockerSet = cmd.getOptionValueSource("blocker") === "cli";
|
|
3954
|
+
const writing = Object.keys(supplied).length > 0 || blockerSet || options.submit || options.reopen;
|
|
3955
|
+
const current = await client.ceremonies.myUpdate(workspaceId, ref.id);
|
|
3956
|
+
const known = current.questions.map((q) => q.key);
|
|
3957
|
+
const unknown = Object.keys(supplied).filter((key) => !known.includes(key));
|
|
3958
|
+
if (unknown.length > 0) {
|
|
3959
|
+
throw new Error(
|
|
3960
|
+
`Unknown answer key${unknown.length === 1 ? "" : "s"}: ${unknown.join(", ")}. ` + (known.length > 0 ? `This ceremony asks: ${known.join(", ")}.` : "This ceremony kind has no async updates.")
|
|
3961
|
+
);
|
|
3962
|
+
}
|
|
3963
|
+
let update = options.draft ? await client.ceremonies.draftMyUpdate(workspaceId, ref.id) : current;
|
|
3964
|
+
if (writing) {
|
|
3965
|
+
const answers = { ...update.answers, ...supplied };
|
|
3966
|
+
if (options.submit && !options.allowEmpty && !Object.values(answers).some((answer) => answer.trim() !== "")) {
|
|
3967
|
+
throw new Error(
|
|
3968
|
+
`Nothing to submit: every answer is empty. Pass --answer <key=markdown> (${known.join(", ")}), or --allow-empty.`
|
|
3969
|
+
);
|
|
3970
|
+
}
|
|
3971
|
+
update = await client.ceremonies.saveMyUpdate({
|
|
3972
|
+
workspaceId,
|
|
3973
|
+
occurrenceId: ref.id,
|
|
3974
|
+
answers,
|
|
3975
|
+
...blockerSet ? { flaggedBlocker: options.blocker } : {},
|
|
3976
|
+
...options.submit ? { submit: true } : options.reopen ? { submit: false } : {}
|
|
3977
|
+
});
|
|
3978
|
+
}
|
|
3979
|
+
if (useJson) console.log(JSON.stringify(update, null, 2));
|
|
3980
|
+
else outputMyOccurrenceUpdatePretty(update);
|
|
3981
|
+
} catch (error) {
|
|
3982
|
+
handleError(error, useJson);
|
|
3983
|
+
}
|
|
3984
|
+
}
|
|
3985
|
+
);
|
|
3986
|
+
occurrences.command("generate-agenda <occurrence>").description("Generate or regenerate the agenda (ceremony owner, or workspace owner/admin)").option("--workspace <slug|id>", "Workspace (not needed when you pass the URL)").option(
|
|
3987
|
+
"--circulate",
|
|
3988
|
+
"Also notify participants and post to the ceremony's Matrix room. Re-sends both if already sent, so don't retry blindly"
|
|
3989
|
+
).action(
|
|
3990
|
+
async (value, options, cmd) => {
|
|
3991
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3992
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3993
|
+
try {
|
|
3994
|
+
const client = getClient();
|
|
3995
|
+
const ref = parseOccurrenceRef(value);
|
|
3996
|
+
const workspaceId = await workspaceFor(client, ref, options.workspace);
|
|
3997
|
+
const result = await client.ceremonies.generateAgenda(workspaceId, ref.id, {
|
|
3998
|
+
circulate: options.circulate
|
|
3999
|
+
});
|
|
4000
|
+
if (useJson) {
|
|
4001
|
+
console.log(JSON.stringify(result, null, 2));
|
|
4002
|
+
} else {
|
|
4003
|
+
console.log(
|
|
4004
|
+
`\u2713 Agenda generated: ${result.itemCount} item${result.itemCount === 1 ? "" : "s"}${result.circulated ? ", circulated" : ""}`
|
|
4005
|
+
);
|
|
4006
|
+
if (options.circulate && !result.circulated) {
|
|
4007
|
+
console.log(chalk4.yellow(" Not circulated: this occurrence is skipped."));
|
|
4008
|
+
}
|
|
4009
|
+
outputAgendaPretty(result.agenda);
|
|
4010
|
+
}
|
|
4011
|
+
} catch (error) {
|
|
4012
|
+
handleError(error, useJson);
|
|
4013
|
+
}
|
|
4014
|
+
}
|
|
4015
|
+
);
|
|
4016
|
+
occurrences.command("add").description("Add an occurrence off the cadence \u2014 a meeting that happened, or will, at another time (ceremony owner, or workspace owner/admin)").requiredOption("--ceremony <slug|id|url>", "The ceremony").requiredOption("--at <datetime>", "Start, e.g. 2026-11-04T10:00 (local) or 2026-11-04T09:00Z").option("--workspace <slug|id>", "Workspace (not needed when you pass the URL)").action(
|
|
4017
|
+
async (options, cmd) => {
|
|
4018
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
4019
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
4020
|
+
try {
|
|
4021
|
+
const at = parseDateTime(options.at, "--at");
|
|
4022
|
+
const client = getClient();
|
|
4023
|
+
const ref = parseCeremonyRef(options.ceremony);
|
|
4024
|
+
const workspaceId = await workspaceFor(client, ref, options.workspace);
|
|
4025
|
+
const ceremonyId = await resolveCeremonyId(client, workspaceId, ref.ceremonyId ?? ref.id);
|
|
4026
|
+
const result = await client.ceremonies.addOccurrence(workspaceId, ceremonyId, at);
|
|
4027
|
+
if (useJson) console.log(JSON.stringify(result, null, 2));
|
|
4028
|
+
else console.log(`\u2713 Occurrence ${result.id} added for ${new Date(result.scheduledStart).toLocaleString()}`);
|
|
4029
|
+
} catch (error) {
|
|
4030
|
+
handleError(error, useJson);
|
|
4031
|
+
}
|
|
4032
|
+
}
|
|
4033
|
+
);
|
|
4034
|
+
occurrences.command("move <occurrence>").description("Move an occurrence that has not happened to another time; it keeps its agenda, notes and updates (ceremony owner, or workspace owner/admin)").requiredOption("--to <datetime>", "New start, e.g. 2026-11-04T10:00 (local) or 2026-11-04T09:00Z").option("--workspace <slug|id>", "Workspace (not needed when you pass the URL)").action(async (value, options, cmd) => {
|
|
4035
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
4036
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
4037
|
+
try {
|
|
4038
|
+
const to = parseDateTime(options.to, "--to");
|
|
4039
|
+
const client = getClient();
|
|
4040
|
+
const ref = parseOccurrenceRef(value);
|
|
4041
|
+
const workspaceId = await workspaceFor(client, ref, options.workspace);
|
|
4042
|
+
const result = await client.ceremonies.rescheduleOccurrence(workspaceId, ref.id, to);
|
|
4043
|
+
if (useJson) console.log(JSON.stringify(result, null, 2));
|
|
4044
|
+
else if (!result.movedFrom) console.log(`Occurrence ${result.id} is already at that time.`);
|
|
4045
|
+
else {
|
|
4046
|
+
console.log(
|
|
4047
|
+
`\u2713 Occurrence ${result.id} moved from ${new Date(result.movedFrom).toLocaleString()} to ${new Date(result.scheduledStart).toLocaleString()}`
|
|
4048
|
+
);
|
|
4049
|
+
}
|
|
4050
|
+
} catch (error) {
|
|
4051
|
+
handleError(error, useJson);
|
|
4052
|
+
}
|
|
4053
|
+
});
|
|
4054
|
+
occurrences.command("skip <occurrence>").description(
|
|
4055
|
+
[
|
|
4056
|
+
"Skip an occurrence with a reason; participants are notified (ceremony owner, or workspace owner/admin).",
|
|
4057
|
+
"On a booked one-off this CANCELS the meeting: every attendee with an address, external ones included,",
|
|
4058
|
+
"gets a calendar cancellation, the ceremony is retired, and it cannot be unskipped."
|
|
4059
|
+
].join(" ")
|
|
4060
|
+
).requiredOption("--reason <text>", "Why it is skipped (1-500 chars)").option("--workspace <slug|id>", "Workspace (not needed when you pass the URL)").action(async (value, options, cmd) => {
|
|
4061
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
4062
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
4063
|
+
try {
|
|
4064
|
+
const client = getClient();
|
|
4065
|
+
const ref = parseOccurrenceRef(value);
|
|
4066
|
+
const workspaceId = await workspaceFor(client, ref, options.workspace);
|
|
4067
|
+
const result = await client.ceremonies.skipOccurrence(workspaceId, ref.id, options.reason);
|
|
4068
|
+
if (useJson) console.log(JSON.stringify(result, null, 2));
|
|
4069
|
+
else console.log(`\u2713 Occurrence ${result.id} skipped`);
|
|
4070
|
+
} catch (error) {
|
|
4071
|
+
handleError(error, useJson);
|
|
4072
|
+
}
|
|
4073
|
+
});
|
|
4074
|
+
occurrences.command("unskip <occurrence>").description("Undo a skip (ceremony owner, or workspace owner/admin). A cancelled one-off cannot be unskipped.").option("--workspace <slug|id>", "Workspace (not needed when you pass the URL)").action(async (value, options, cmd) => {
|
|
4075
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
4076
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
4077
|
+
try {
|
|
4078
|
+
const client = getClient();
|
|
4079
|
+
const ref = parseOccurrenceRef(value);
|
|
4080
|
+
const workspaceId = await workspaceFor(client, ref, options.workspace);
|
|
4081
|
+
const result = await client.ceremonies.unskipOccurrence(workspaceId, ref.id);
|
|
4082
|
+
if (useJson) console.log(JSON.stringify(result, null, 2));
|
|
4083
|
+
else console.log(`\u2713 Occurrence ${result.id} is back to ${result.status}`);
|
|
4084
|
+
} catch (error) {
|
|
4085
|
+
handleError(error, useJson);
|
|
4086
|
+
}
|
|
4087
|
+
});
|
|
4088
|
+
const agenda = new Command4("agenda").description("Edit an occurrence's agenda by hand");
|
|
4089
|
+
agenda.command("add <occurrence>").description("Add an item to an agenda section; kept across regeneration").requiredOption("--section <key>", "The section key (see `occurrences get`)").requiredOption("--title <text>", "Item title (max 300 chars)").option("--detail <text>", "One line of detail (max 500 chars)").option("--workspace <slug|id>", "Workspace (not needed when you pass the URL)").action(
|
|
4090
|
+
async (value, options, cmd) => {
|
|
4091
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
4092
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
4093
|
+
try {
|
|
4094
|
+
const client = getClient();
|
|
4095
|
+
const ref = parseOccurrenceRef(value);
|
|
4096
|
+
const workspaceId = await workspaceFor(client, ref, options.workspace);
|
|
4097
|
+
const result = await client.ceremonies.addAgendaItem({
|
|
4098
|
+
workspaceId,
|
|
4099
|
+
occurrenceId: ref.id,
|
|
4100
|
+
sectionKey: options.section,
|
|
4101
|
+
title: options.title,
|
|
4102
|
+
detail: options.detail
|
|
4103
|
+
});
|
|
4104
|
+
if (useJson) console.log(JSON.stringify(result, null, 2));
|
|
4105
|
+
else {
|
|
4106
|
+
console.log("\u2713 Agenda item added");
|
|
4107
|
+
outputAgendaPretty(result.agenda);
|
|
4108
|
+
}
|
|
4109
|
+
} catch (error) {
|
|
4110
|
+
handleError(error, useJson);
|
|
4111
|
+
}
|
|
4112
|
+
}
|
|
4113
|
+
);
|
|
4114
|
+
agenda.command("resolve <occurrence> <itemId>").description("Mark an agenda item resolved (--reopen to undo)").option("--reopen", "Mark it unresolved again").option("--workspace <slug|id>", "Workspace (not needed when you pass the URL)").action(
|
|
4115
|
+
async (value, itemId, options, cmd) => {
|
|
4116
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
4117
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
4118
|
+
try {
|
|
4119
|
+
const client = getClient();
|
|
4120
|
+
const ref = parseOccurrenceRef(value);
|
|
4121
|
+
const workspaceId = await workspaceFor(client, ref, options.workspace);
|
|
4122
|
+
const result = await client.ceremonies.resolveAgendaItem(
|
|
4123
|
+
workspaceId,
|
|
4124
|
+
ref.id,
|
|
4125
|
+
itemId,
|
|
4126
|
+
!options.reopen
|
|
4127
|
+
);
|
|
4128
|
+
if (useJson) console.log(JSON.stringify(result, null, 2));
|
|
4129
|
+
else console.log(options.reopen ? "\u2713 Agenda item reopened" : "\u2713 Agenda item resolved");
|
|
4130
|
+
} catch (error) {
|
|
4131
|
+
handleError(error, useJson);
|
|
4132
|
+
}
|
|
4133
|
+
}
|
|
4134
|
+
);
|
|
4135
|
+
occurrences.addCommand(agenda);
|
|
4136
|
+
occurrences.command("attach <occurrence>").description("Link a recorded meeting to the occurrence it captured (same workspace; you must be able to edit the meeting)").requiredOption("--meeting <id>", "Recorded meeting (transcription session) id").action(async (value, options, cmd) => {
|
|
4137
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
4138
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
4139
|
+
try {
|
|
4140
|
+
const client = getClient();
|
|
4141
|
+
const ref = parseOccurrenceRef(value);
|
|
4142
|
+
const result = await client.ceremonies.attachMeeting(options.meeting, ref.id);
|
|
4143
|
+
if (useJson) console.log(JSON.stringify(result, null, 2));
|
|
4144
|
+
else console.log(`\u2713 Meeting ${result.meetingId} attached to occurrence ${result.occurrenceId}`);
|
|
4145
|
+
} catch (error) {
|
|
4146
|
+
handleError(error, useJson);
|
|
4147
|
+
}
|
|
4148
|
+
});
|
|
4149
|
+
occurrences.command("detach <meetingId>").description("Unlink a recorded meeting from its occurrence").action(async (meetingId, _options, cmd) => {
|
|
4150
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
4151
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
4152
|
+
try {
|
|
4153
|
+
const client = getClient();
|
|
4154
|
+
const result = await client.ceremonies.detachMeeting(meetingId);
|
|
4155
|
+
if (useJson) console.log(JSON.stringify(result, null, 2));
|
|
4156
|
+
else console.log(`\u2713 Meeting ${result.meetingId} detached`);
|
|
4157
|
+
} catch (error) {
|
|
4158
|
+
handleError(error, useJson);
|
|
4159
|
+
}
|
|
4160
|
+
});
|
|
4161
|
+
return occurrences;
|
|
4162
|
+
}
|
|
4163
|
+
function createCeremoniesCommand() {
|
|
4164
|
+
const ceremonies = new Command4("ceremonies").description(
|
|
4165
|
+
[
|
|
4166
|
+
"Recurring meeting definitions (Settings \u2192 Ceremonies) and their scheduled occurrences.",
|
|
4167
|
+
"",
|
|
4168
|
+
"A ceremony has a cadence (RRULE in a time zone), an owner, participants and an agenda template.",
|
|
4169
|
+
"Each scheduled instance is an occurrence \u2014 see `ceremonies occurrences --help`.",
|
|
4170
|
+
"Decisions logged in an occurrence live under `exponential decisions` (--occurrence).",
|
|
4171
|
+
"",
|
|
4172
|
+
"Some writes reach people or delete data. Read `<command> --help` first: update, occurrences skip,",
|
|
4173
|
+
"occurrences generate-agenda --circulate, import and backfill."
|
|
4174
|
+
].join("\n")
|
|
4175
|
+
);
|
|
4176
|
+
ceremonies.command("list").description("Ceremonies in a workspace, active first").option("--workspace <slug|id>", "Workspace (defaults to your default workspace)").option("--include-inactive", "Also list retired ceremonies").action(async (options, cmd) => {
|
|
4177
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
4178
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
4179
|
+
try {
|
|
4180
|
+
const client = getClient();
|
|
4181
|
+
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
4182
|
+
const rows = await client.ceremonies.list(workspaceId, {
|
|
4183
|
+
includeInactive: options.includeInactive
|
|
4184
|
+
});
|
|
4185
|
+
if (useJson) outputCeremoniesJson(rows, { workspaceId });
|
|
4186
|
+
else outputCeremoniesPretty(rows);
|
|
4187
|
+
} catch (error) {
|
|
4188
|
+
handleError(error, useJson);
|
|
4189
|
+
}
|
|
4190
|
+
});
|
|
4191
|
+
ceremonies.command("get <ceremony>").description("One ceremony with participants, projects and its recent + upcoming occurrences. Takes an id, slug or URL.").option("--workspace <slug|id>", "Workspace (not needed when you pass the URL)").action(async (value, options, cmd) => {
|
|
4192
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
4193
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
4194
|
+
try {
|
|
4195
|
+
const client = getClient();
|
|
4196
|
+
const ref = parseCeremonyRef(value);
|
|
4197
|
+
const workspaceId = await workspaceFor(client, ref, options.workspace);
|
|
4198
|
+
const id = await resolveCeremonyId(client, workspaceId, ref.ceremonyId ?? ref.id);
|
|
4199
|
+
const ceremony = await client.ceremonies.get(workspaceId, id);
|
|
4200
|
+
if (useJson) outputCeremonyJson(ceremony);
|
|
4201
|
+
else outputCeremonyPretty(ceremony);
|
|
4202
|
+
} catch (error) {
|
|
4203
|
+
handleError(error, useJson);
|
|
4204
|
+
}
|
|
4205
|
+
});
|
|
4206
|
+
ceremonies.command("templates").description('Built-in ceremony templates, one per kind (the "Add from template" list)').action(async (_options, cmd) => {
|
|
4207
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
4208
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
4209
|
+
try {
|
|
4210
|
+
const templates = await getClient().ceremonies.templates();
|
|
4211
|
+
if (useJson) console.log(JSON.stringify({ templates, total: templates.length }, null, 2));
|
|
4212
|
+
else outputCeremonyTemplatesPretty(templates);
|
|
4213
|
+
} catch (error) {
|
|
4214
|
+
handleError(error, useJson);
|
|
4215
|
+
}
|
|
4216
|
+
});
|
|
4217
|
+
const create = addDefinitionOptions(
|
|
4218
|
+
ceremonies.command("create").description(
|
|
4219
|
+
"Create a ceremony and schedule its first occurrences. Needs --name, --cadence, --timezone and --starts-on."
|
|
4220
|
+
).option("--workspace <slug|id>", "Workspace (defaults to your default workspace)").option("--template <slug>", "Start from a built-in template (see `ceremonies templates`); flags override it")
|
|
4221
|
+
);
|
|
4222
|
+
create.action(
|
|
4223
|
+
async (options, cmd) => {
|
|
4224
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
4225
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
4226
|
+
try {
|
|
4227
|
+
const client = getClient();
|
|
4228
|
+
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
4229
|
+
let base = {};
|
|
4230
|
+
if (options.template) {
|
|
4231
|
+
const templates = await client.ceremonies.templates();
|
|
4232
|
+
const t = templates.find((x) => x.slug === options.template);
|
|
4233
|
+
if (!t) {
|
|
4234
|
+
throw new Error(
|
|
4235
|
+
`No template "${options.template}". One of: ${templates.map((x) => x.slug).join(", ")}`
|
|
4236
|
+
);
|
|
4237
|
+
}
|
|
4238
|
+
const { slug: _slug, ...fields } = t;
|
|
4239
|
+
base = fields;
|
|
4240
|
+
}
|
|
4241
|
+
const input = { ...base, ...definitionFields(options, cmd), workspaceId };
|
|
4242
|
+
const missing = ["name", "cadenceRule", "timezone", "startsOn"].filter(
|
|
4243
|
+
(k) => input[k] === void 0
|
|
4244
|
+
);
|
|
4245
|
+
if (missing.length > 0) {
|
|
4246
|
+
const flags = {
|
|
4247
|
+
name: "--name",
|
|
4248
|
+
cadenceRule: "--cadence",
|
|
4249
|
+
timezone: "--timezone",
|
|
4250
|
+
startsOn: "--starts-on"
|
|
4251
|
+
};
|
|
4252
|
+
throw new Error(`Missing ${missing.map((k) => flags[k]).join(", ")}.`);
|
|
4253
|
+
}
|
|
4254
|
+
const result = await client.ceremonies.create(input);
|
|
4255
|
+
if (useJson) console.log(JSON.stringify(result, null, 2));
|
|
4256
|
+
else outputCeremonyWritePretty(result, "created");
|
|
4257
|
+
} catch (error) {
|
|
4258
|
+
handleError(error, useJson);
|
|
4259
|
+
}
|
|
4260
|
+
}
|
|
4261
|
+
);
|
|
4262
|
+
const update = addDefinitionOptions(
|
|
4263
|
+
ceremonies.command("update <ceremony>").description(
|
|
4264
|
+
[
|
|
4265
|
+
"Edit a ceremony (id, slug or URL). Only the flags you pass change.",
|
|
4266
|
+
"Changing --cadence, --timezone, --starts-on or --duration DELETES future PLANNED occurrences that have no",
|
|
4267
|
+
"booking or recording, along with any agenda, notes link and async updates on them, and recreates them with",
|
|
4268
|
+
"new ids. Occurrences moved or added by hand stay."
|
|
4269
|
+
].join(" ")
|
|
4270
|
+
).option("--workspace <slug|id>", "Workspace (not needed when you pass the URL)").option("--active", "Re-activate a retired ceremony").option("--inactive", "Retire the ceremony (stops scheduling)")
|
|
4271
|
+
);
|
|
4272
|
+
update.action(
|
|
4273
|
+
async (value, options, cmd) => {
|
|
4274
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
4275
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
4276
|
+
try {
|
|
4277
|
+
if (options.active && options.inactive) throw new Error("Pass --active or --inactive, not both.");
|
|
4278
|
+
const client = getClient();
|
|
4279
|
+
const ref = parseCeremonyRef(value);
|
|
4280
|
+
const workspaceId = await workspaceFor(client, ref, options.workspace);
|
|
4281
|
+
const id = await resolveCeremonyId(client, workspaceId, ref.ceremonyId ?? ref.id);
|
|
4282
|
+
const input = {
|
|
4283
|
+
...definitionFields(options, cmd),
|
|
4284
|
+
workspaceId,
|
|
4285
|
+
id,
|
|
4286
|
+
...options.active ? { isActive: true } : options.inactive ? { isActive: false } : {}
|
|
4287
|
+
};
|
|
4288
|
+
if (Object.keys(input).length === 2) {
|
|
4289
|
+
throw new Error("Nothing to update \u2014 pass at least one field flag.");
|
|
4290
|
+
}
|
|
4291
|
+
const result = await client.ceremonies.update(input);
|
|
4292
|
+
if (useJson) console.log(JSON.stringify(result, null, 2));
|
|
4293
|
+
else outputCeremonyWritePretty(result, "updated");
|
|
4294
|
+
} catch (error) {
|
|
4295
|
+
handleError(error, useJson);
|
|
4296
|
+
}
|
|
4297
|
+
}
|
|
4298
|
+
);
|
|
4299
|
+
ceremonies.command("import <file>").description(
|
|
4300
|
+
[
|
|
4301
|
+
'Upsert ceremonies from a JSON array keyed by slug ("-" = stdin). Workspace owner/admin only.',
|
|
4302
|
+
"People go by name or email: participantNames REPLACES the whole set, and a name that matches nobody is dropped",
|
|
4303
|
+
"and reported as unresolved. Not atomic: a failure partway leaves the earlier definitions written."
|
|
4304
|
+
].join(" ")
|
|
4305
|
+
).option("--workspace <slug|id>", "Workspace (defaults to your default workspace)").option("--timezone <iana>", "Default zone for definitions without one").option("--starts-on <date>", "Default anchor date for definitions without one").action(
|
|
4306
|
+
async (file, options, cmd) => {
|
|
4307
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
4308
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
4309
|
+
try {
|
|
4310
|
+
const raw = readText(void 0, file);
|
|
4311
|
+
const parsed = JSON.parse(raw ?? "");
|
|
4312
|
+
if (!Array.isArray(parsed)) throw new Error("The import file must hold a JSON array of definitions.");
|
|
4313
|
+
const client = getClient();
|
|
4314
|
+
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
4315
|
+
const results = await client.ceremonies.importDefinitions({
|
|
4316
|
+
workspaceId,
|
|
4317
|
+
definitions: parsed,
|
|
4318
|
+
timezone: options.timezone,
|
|
4319
|
+
startsOn: parseCalendarDate(options.startsOn)
|
|
4320
|
+
});
|
|
4321
|
+
if (useJson) {
|
|
4322
|
+
console.log(JSON.stringify({ results, total: results.length }, null, 2));
|
|
4323
|
+
} else {
|
|
4324
|
+
for (const r of results) {
|
|
4325
|
+
console.log(
|
|
4326
|
+
`\u2713 ${r.slug} ${r.action} (${r.occurrencesCreated} occurrence${r.occurrencesCreated === 1 ? "" : "s"} scheduled)`
|
|
4327
|
+
);
|
|
4328
|
+
if (r.unresolved.length > 0) {
|
|
4329
|
+
console.log(chalk4.yellow(` Unresolved people: ${r.unresolved.join(", ")}`));
|
|
4330
|
+
}
|
|
4331
|
+
}
|
|
4332
|
+
}
|
|
4333
|
+
} catch (error) {
|
|
4334
|
+
handleError(error, useJson);
|
|
4335
|
+
}
|
|
4336
|
+
}
|
|
4337
|
+
);
|
|
4338
|
+
ceremonies.command("backfill").description(
|
|
4339
|
+
"Attach unattached recorded meetings to occurrences by alias. Dry run unless --apply, but even a dry run schedules any missing occurrences of active ceremonies. Workspace owner/admin only."
|
|
4340
|
+
).option("--workspace <slug|id>", "Workspace (defaults to your default workspace)").option("--apply", "Write the attachments (default is a dry-run report)").action(async (options, cmd) => {
|
|
4341
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
4342
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
4343
|
+
try {
|
|
3287
4344
|
const client = getClient();
|
|
3288
|
-
const
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
direction: options.direction,
|
|
3292
|
-
subject: options.subject,
|
|
3293
|
-
notes: options.notes
|
|
4345
|
+
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
4346
|
+
const result = await client.ceremonies.backfillAttachments(workspaceId, {
|
|
4347
|
+
dryRun: !options.apply
|
|
3294
4348
|
});
|
|
3295
4349
|
if (useJson) {
|
|
3296
|
-
|
|
4350
|
+
console.log(JSON.stringify(result, null, 2));
|
|
3297
4351
|
} else {
|
|
3298
|
-
console.log(
|
|
3299
|
-
|
|
4352
|
+
console.log(
|
|
4353
|
+
chalk4.bold(
|
|
4354
|
+
`
|
|
4355
|
+
${result.dryRun ? "Dry run" : "Applied"}: ${result.matched} of ${result.scanned} meetings matched`
|
|
4356
|
+
)
|
|
4357
|
+
);
|
|
4358
|
+
if (result.occurrencesCreated > 0) {
|
|
4359
|
+
console.log(chalk4.gray(` Scheduled ${result.occurrencesCreated} missing occurrences (this happens even on a dry run).`));
|
|
4360
|
+
}
|
|
4361
|
+
for (const row of result.rows) {
|
|
4362
|
+
const target = row.occurrenceId ? chalk4.green(`\u2192 ${row.ceremonyName} ${row.scheduledStart ? new Date(row.scheduledStart).toLocaleString() : ""}`) : chalk4.gray(`\u2014 ${row.reason}`);
|
|
4363
|
+
console.log(` ${row.title ?? row.meetingId} ${target}`);
|
|
4364
|
+
}
|
|
4365
|
+
if (result.dryRun && result.matched > 0) {
|
|
4366
|
+
console.log(chalk4.gray("\nRe-run with --apply to write these attachments."));
|
|
4367
|
+
}
|
|
3300
4368
|
}
|
|
3301
4369
|
} catch (error) {
|
|
3302
4370
|
handleError(error, useJson);
|
|
3303
4371
|
}
|
|
3304
4372
|
});
|
|
3305
|
-
|
|
4373
|
+
ceremonies.command("match-url <url>").description(
|
|
4374
|
+
"Which ceremony meets in this video room, and the occurrence on now (or --at). Searches all your workspaces unless --workspace."
|
|
4375
|
+
).option("--at <datetime>", "Match the occurrence on at this time instead of now").option("--workspace <slug|id>", "Only look in this workspace").action(async (url, options, cmd) => {
|
|
3306
4376
|
const globalOpts = cmd.optsWithGlobals();
|
|
3307
4377
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3308
4378
|
try {
|
|
3309
4379
|
const client = getClient();
|
|
3310
|
-
const
|
|
4380
|
+
const workspaceId = options.workspace ? await resolveWorkspaceId(client, options.workspace) : void 0;
|
|
4381
|
+
const match = await client.ceremonies.matchMeetingUrl({
|
|
4382
|
+
url,
|
|
4383
|
+
at: options.at ? parseDateTime(options.at, "--at") : void 0,
|
|
4384
|
+
workspaceId
|
|
4385
|
+
});
|
|
3311
4386
|
if (useJson) {
|
|
3312
|
-
console.log(JSON.stringify(
|
|
3313
|
-
} else if (
|
|
3314
|
-
console.log(
|
|
3315
|
-
\u2713 Enrichment queued for contact ${id} (job ${result.enrichmentId})`);
|
|
3316
|
-
} else if (result.reason === "already-in-flight") {
|
|
3317
|
-
console.log(`
|
|
3318
|
-
\u2022 Enrichment already in progress for contact ${id} (job ${result.enrichmentId})`);
|
|
4387
|
+
console.log(JSON.stringify({ match }, null, 2));
|
|
4388
|
+
} else if (!match) {
|
|
4389
|
+
console.log(chalk4.gray("No ceremony meets in this room (or several do and none is on now)."));
|
|
3319
4390
|
} else {
|
|
3320
|
-
console.log(`
|
|
3321
|
-
|
|
4391
|
+
console.log(`${chalk4.bold(match.ceremony.name)} ${chalk4.gray(`in ${match.workspace.name} \xB7 ${match.ceremony.id}`)}`);
|
|
4392
|
+
if (match.project) console.log(` ${chalk4.gray("Project:")} ${match.project.name}`);
|
|
4393
|
+
console.log(
|
|
4394
|
+
match.occurrence ? ` ${chalk4.gray("Occurrence:")} ${new Date(match.occurrence.scheduledStart).toLocaleString()} ${chalk4.gray(match.occurrence.id)}` : chalk4.gray(" No occurrence on at that time.")
|
|
4395
|
+
);
|
|
3322
4396
|
}
|
|
3323
4397
|
} catch (error) {
|
|
3324
4398
|
handleError(error, useJson);
|
|
3325
4399
|
}
|
|
3326
4400
|
});
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
// src/commands/databases.ts
|
|
3331
|
-
import { Command as Command4 } from "commander";
|
|
3332
|
-
import chalk4 from "chalk";
|
|
3333
|
-
|
|
3334
|
-
// src/utils/input.ts
|
|
3335
|
-
import { readFileSync } from "fs";
|
|
3336
|
-
var stdinConsumed = false;
|
|
3337
|
-
function readText(inline, file) {
|
|
3338
|
-
if (inline !== void 0) return inline;
|
|
3339
|
-
if (file === void 0) return void 0;
|
|
3340
|
-
if (file === "-") {
|
|
3341
|
-
if (stdinConsumed) {
|
|
3342
|
-
throw new Error('stdin ("-") can only back one option per invocation.');
|
|
3343
|
-
}
|
|
3344
|
-
stdinConsumed = true;
|
|
3345
|
-
return readFileSync(0, "utf-8");
|
|
3346
|
-
}
|
|
3347
|
-
return readFileSync(file, "utf-8");
|
|
3348
|
-
}
|
|
3349
|
-
function parseDate(value) {
|
|
3350
|
-
if (value === void 0 || value === "") return void 0;
|
|
3351
|
-
const date = /^\d{4}-\d{2}-\d{2}$/.test(value) ? /* @__PURE__ */ new Date(`${value}T00:00:00`) : new Date(value);
|
|
3352
|
-
if (Number.isNaN(date.getTime())) {
|
|
3353
|
-
throw new Error(
|
|
3354
|
-
`Invalid date: "${value}". Use ISO format, e.g. 2026-08-25 or 2026-08-25T14:00.`
|
|
3355
|
-
);
|
|
3356
|
-
}
|
|
3357
|
-
return date;
|
|
4401
|
+
ceremonies.addCommand(createOccurrencesCommand());
|
|
4402
|
+
return ceremonies;
|
|
3358
4403
|
}
|
|
3359
4404
|
|
|
3360
4405
|
// src/commands/databases.ts
|
|
4406
|
+
import { Command as Command5 } from "commander";
|
|
4407
|
+
import chalk5 from "chalk";
|
|
3361
4408
|
var ADDABLE_TYPES = [
|
|
3362
4409
|
"text",
|
|
3363
4410
|
"number",
|
|
@@ -3371,7 +4418,7 @@ var ADDABLE_TYPES = [
|
|
|
3371
4418
|
"lastEditedTime",
|
|
3372
4419
|
"createdBy"
|
|
3373
4420
|
];
|
|
3374
|
-
function
|
|
4421
|
+
function collect2(value, previous) {
|
|
3375
4422
|
return [...previous, value];
|
|
3376
4423
|
}
|
|
3377
4424
|
function parseLimit(value) {
|
|
@@ -3488,7 +4535,7 @@ function buildListView(database, filters, sort) {
|
|
|
3488
4535
|
};
|
|
3489
4536
|
}
|
|
3490
4537
|
function createDatabasesCommand() {
|
|
3491
|
-
const databases = new
|
|
4538
|
+
const databases = new Command5("databases").description(
|
|
3492
4539
|
'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
4540
|
);
|
|
3494
4541
|
databases.command("create").description(
|
|
@@ -3520,7 +4567,7 @@ ${database.marker}` : database.marker,
|
|
|
3520
4567
|
\u2713 Database created${placed ? ` and placed in "${database.page.title}"` : ""}`);
|
|
3521
4568
|
outputDatabasePretty(database);
|
|
3522
4569
|
if (!placed && database.marker) {
|
|
3523
|
-
console.log(
|
|
4570
|
+
console.log(chalk5.gray(` Put this line in the page body to show it: ${database.marker}
|
|
3524
4571
|
`));
|
|
3525
4572
|
}
|
|
3526
4573
|
}
|
|
@@ -3587,7 +4634,7 @@ ${database.marker}` : database.marker,
|
|
|
3587
4634
|
return databases;
|
|
3588
4635
|
}
|
|
3589
4636
|
function createPropertiesCommand() {
|
|
3590
|
-
const properties = new
|
|
4637
|
+
const properties = new Command5("properties").description(
|
|
3591
4638
|
"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
4639
|
);
|
|
3593
4640
|
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(
|
|
@@ -3673,12 +4720,12 @@ function createPropertiesCommand() {
|
|
|
3673
4720
|
return properties;
|
|
3674
4721
|
}
|
|
3675
4722
|
function createRowsCommand() {
|
|
3676
|
-
const rows = new
|
|
4723
|
+
const rows = new Command5("rows").description(
|
|
3677
4724
|
`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
4725
|
);
|
|
3679
4726
|
rows.command("list <databaseId>").description(
|
|
3680
4727
|
'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",
|
|
4728
|
+
).option("--filter <expr>", "Filter (repeatable); replaces the saved filters", collect2, []).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
4729
|
async (databaseId, options, cmd) => {
|
|
3683
4730
|
const globalOpts = cmd.optsWithGlobals();
|
|
3684
4731
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -3699,7 +4746,7 @@ function createRowsCommand() {
|
|
|
3699
4746
|
);
|
|
3700
4747
|
rows.command("add <databaseId>").description(
|
|
3701
4748
|
'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)",
|
|
4749
|
+
).option("--set <Property=value>", "A cell value (repeatable)", collect2, []).option("-n, --note <text>", "Why: recorded on the row page's first revision").action(async (databaseId, options, cmd) => {
|
|
3703
4750
|
const globalOpts = cmd.optsWithGlobals();
|
|
3704
4751
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3705
4752
|
try {
|
|
@@ -3716,7 +4763,7 @@ function createRowsCommand() {
|
|
|
3716
4763
|
});
|
|
3717
4764
|
rows.command("import <databaseId>").description(
|
|
3718
4765
|
'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)",
|
|
4766
|
+
).requiredOption("--csv <file>", "The CSV file, or - for stdin").option("--map <Col=Property>", "Send a column to an existing property (repeatable)", collect2, []).option("--new <Col=type>", "Create a property for a column (repeatable)", collect2, []).option("--skip <Col>", "Leave a column out (repeatable)", collect2, []).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
4767
|
async (databaseId, options, cmd) => {
|
|
3721
4768
|
const globalOpts = cmd.optsWithGlobals();
|
|
3722
4769
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -3747,7 +4794,7 @@ function createRowsCommand() {
|
|
|
3747
4794
|
}
|
|
3748
4795
|
}
|
|
3749
4796
|
);
|
|
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)",
|
|
4797
|
+
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)", collect2, []).option("--clear <Property>", "Empty a cell (repeatable)", collect2, []).option("-n, --note <text>", "Why: shown in the row page's history").action(
|
|
3751
4798
|
async (rowId, options, cmd) => {
|
|
3752
4799
|
const globalOpts = cmd.optsWithGlobals();
|
|
3753
4800
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -3785,8 +4832,8 @@ function createRowsCommand() {
|
|
|
3785
4832
|
}
|
|
3786
4833
|
|
|
3787
4834
|
// src/commands/decisions.ts
|
|
3788
|
-
import { Command as
|
|
3789
|
-
import
|
|
4835
|
+
import { Command as Command6 } from "commander";
|
|
4836
|
+
import chalk6 from "chalk";
|
|
3790
4837
|
var STATUSES = [
|
|
3791
4838
|
"OPEN",
|
|
3792
4839
|
"PROPOSED",
|
|
@@ -4034,7 +5081,7 @@ function addConfirmCommand(parent) {
|
|
|
4034
5081
|
);
|
|
4035
5082
|
}
|
|
4036
5083
|
function createDecisionsCommand() {
|
|
4037
|
-
const decisions = new
|
|
5084
|
+
const decisions = new Command6("decisions").description(
|
|
4038
5085
|
[
|
|
4039
5086
|
"Log and manage decisions and open questions (the workspace Decision Log).",
|
|
4040
5087
|
"",
|
|
@@ -4060,11 +5107,15 @@ function createDecisionsCommand() {
|
|
|
4060
5107
|
"Filter by source (repeatable): MEETING, MANUAL, AGENT",
|
|
4061
5108
|
(value, previous) => [...previous, parseSource(value)],
|
|
4062
5109
|
[]
|
|
4063
|
-
).option("--product <slug|id>", 'Filter by product, or "workspace" for decisions with no product').option("--include-workspace-wide", "With --product: also include decisions that have no product").option("--project <id>", "Filter by project CUID").option("--search <text>", "Free-text over statement and body").option("--number <n>", "One decision by its workspace sequence number (D-0003 is 3)").option("--limit <n>", "Cap the rows returned (1-500)").option("--adr <id>", "Decisions formalised as this ADR document").action(
|
|
5110
|
+
).option("--product <slug|id>", 'Filter by product, or "workspace" for decisions with no product').option("--include-workspace-wide", "With --product: also include decisions that have no product").option("--project <id>", "Filter by project CUID").option("--search <text>", "Free-text over statement and body").option("--number <n>", "One decision by its workspace sequence number (D-0003 is 3)").option("--limit <n>", "Cap the rows returned (1-500)").option("--adr <id>", "Decisions formalised as this ADR document").option("--occurrence <id|url>", "Only decisions logged in this ceremony occurrence (the URL brings its own workspace)").action(
|
|
4064
5111
|
async (options, cmd) => {
|
|
4065
5112
|
const globalOpts = cmd.optsWithGlobals();
|
|
4066
5113
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
4067
5114
|
try {
|
|
5115
|
+
if (options.meeting && options.occurrence) {
|
|
5116
|
+
throw new Error("Pass --meeting or --occurrence, not both.");
|
|
5117
|
+
}
|
|
5118
|
+
const occurrence = options.occurrence ? parseOccurrenceRef(options.occurrence) : void 0;
|
|
4068
5119
|
const client = getClient();
|
|
4069
5120
|
if (options.meeting) {
|
|
4070
5121
|
const result = await client.decisions.listForMeeting(options.meeting);
|
|
@@ -4085,7 +5136,7 @@ function createDecisionsCommand() {
|
|
|
4085
5136
|
outputDecisionsPretty(rows2);
|
|
4086
5137
|
if (!result.canLogDecision) {
|
|
4087
5138
|
console.log(
|
|
4088
|
-
|
|
5139
|
+
chalk6.yellow(
|
|
4089
5140
|
"You cannot log decisions on this meeting (no edit access, or it has no workspace)."
|
|
4090
5141
|
)
|
|
4091
5142
|
);
|
|
@@ -4093,8 +5144,9 @@ function createDecisionsCommand() {
|
|
|
4093
5144
|
}
|
|
4094
5145
|
return;
|
|
4095
5146
|
}
|
|
4096
|
-
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
4097
|
-
const
|
|
5147
|
+
const workspaceId = await resolveWorkspaceId(client, occurrence?.workspaceSlug ?? options.workspace);
|
|
5148
|
+
const limit = parsePositiveInt(options.limit, "--limit");
|
|
5149
|
+
const all = options.adr ? await client.decisions.listForAdr(workspaceId, options.adr) : await client.decisions.list({
|
|
4098
5150
|
workspaceId,
|
|
4099
5151
|
statuses: options.status.length > 0 ? options.status : void 0,
|
|
4100
5152
|
sources: options.source.length > 0 ? options.source : void 0,
|
|
@@ -4103,10 +5155,16 @@ function createDecisionsCommand() {
|
|
|
4103
5155
|
projectId: options.project,
|
|
4104
5156
|
search: options.search,
|
|
4105
5157
|
number: parsePositiveInt(options.number, "--number"),
|
|
4106
|
-
|
|
5158
|
+
// With --occurrence the cap applies after filtering, below.
|
|
5159
|
+
limit: occurrence ? void 0 : limit
|
|
4107
5160
|
});
|
|
4108
|
-
|
|
4109
|
-
|
|
5161
|
+
const rows = occurrence ? all.filter((d) => d.occurrenceId === occurrence.id).slice(0, limit) : all;
|
|
5162
|
+
if (useJson) {
|
|
5163
|
+
outputDecisionsJson(
|
|
5164
|
+
rows,
|
|
5165
|
+
occurrence ? { workspaceId, occurrenceId: occurrence.id } : { workspaceId }
|
|
5166
|
+
);
|
|
5167
|
+
} else outputDecisionsPretty(rows);
|
|
4110
5168
|
} catch (error) {
|
|
4111
5169
|
handleError(error, useJson);
|
|
4112
5170
|
}
|
|
@@ -4285,7 +5343,7 @@ function createDecisionsCommand() {
|
|
|
4285
5343
|
\u2713 ${decision.status === "OPEN" ? "Open question" : "Decision"} logged`
|
|
4286
5344
|
);
|
|
4287
5345
|
outputDecisionPretty(decision);
|
|
4288
|
-
if (featureLink) console.log(
|
|
5346
|
+
if (featureLink) console.log(chalk6.gray(` Linked to feature ${options.feature}`));
|
|
4289
5347
|
}
|
|
4290
5348
|
} catch (error) {
|
|
4291
5349
|
handleError(error, useJson);
|
|
@@ -4394,9 +5452,9 @@ function createDecisionsCommand() {
|
|
|
4394
5452
|
const link = options.ticket ? await client.decisions.linkTicket(workspaceId, decisionId, options.ticket) : await client.decisions.linkFeature(workspaceId, decisionId, options.feature);
|
|
4395
5453
|
if (useJson) console.log(JSON.stringify(link, null, 2));
|
|
4396
5454
|
else {
|
|
4397
|
-
console.log(`\u2713 Linked ${
|
|
5455
|
+
console.log(`\u2713 Linked ${chalk6.gray(`(link id ${link.id})`)}`);
|
|
4398
5456
|
console.log(
|
|
4399
|
-
|
|
5457
|
+
chalk6.gray(" Remove it with: exponential decisions unlink --link " + link.id)
|
|
4400
5458
|
);
|
|
4401
5459
|
}
|
|
4402
5460
|
} catch (error) {
|
|
@@ -4419,7 +5477,7 @@ function createDecisionsCommand() {
|
|
|
4419
5477
|
handleError(error, useJson);
|
|
4420
5478
|
}
|
|
4421
5479
|
});
|
|
4422
|
-
const drafts = new
|
|
5480
|
+
const drafts = new Command6("draft").description(
|
|
4423
5481
|
"Review decisions an agent proposed but nobody has confirmed yet (visible only on their source meeting)"
|
|
4424
5482
|
);
|
|
4425
5483
|
drafts.command("extract").description(
|
|
@@ -4434,22 +5492,22 @@ function createDecisionsCommand() {
|
|
|
4434
5492
|
else {
|
|
4435
5493
|
if (result.alreadyPublished) {
|
|
4436
5494
|
console.log(
|
|
4437
|
-
|
|
5495
|
+
chalk6.gray("This meeting already has confirmed decisions \u2014 nothing was extracted.")
|
|
4438
5496
|
);
|
|
4439
5497
|
} else if (result.alreadyDrafted) {
|
|
4440
|
-
console.log(
|
|
5498
|
+
console.log(chalk6.gray("Returning the drafts this meeting already had."));
|
|
4441
5499
|
}
|
|
4442
5500
|
console.log(
|
|
4443
5501
|
`\u2713 ${result.draftCount} draft${result.draftCount === 1 ? "" : "s"} awaiting review (${result.draftsCreated} new)`
|
|
4444
5502
|
);
|
|
4445
5503
|
if (result.discardedWithoutEvidence > 0) {
|
|
4446
5504
|
console.log(
|
|
4447
|
-
|
|
5505
|
+
chalk6.gray(
|
|
4448
5506
|
` ${result.discardedWithoutEvidence} candidate(s) dropped \u2014 no transcript turn supported them.`
|
|
4449
5507
|
)
|
|
4450
5508
|
);
|
|
4451
5509
|
}
|
|
4452
|
-
for (const message of result.errors) console.log(
|
|
5510
|
+
for (const message of result.errors) console.log(chalk6.yellow(` ${message}`));
|
|
4453
5511
|
}
|
|
4454
5512
|
} catch (error) {
|
|
4455
5513
|
handleError(error, useJson);
|
|
@@ -4506,9 +5564,9 @@ function createDecisionsCommand() {
|
|
|
4506
5564
|
}
|
|
4507
5565
|
|
|
4508
5566
|
// src/commands/deals.ts
|
|
4509
|
-
import { Command as
|
|
5567
|
+
import { Command as Command7 } from "commander";
|
|
4510
5568
|
function createDealsCommand() {
|
|
4511
|
-
const deals = new
|
|
5569
|
+
const deals = new Command7("deals").description("Manage pipeline deals");
|
|
4512
5570
|
deals.command("pipeline").description("Get pipeline overview with stages").requiredOption("--workspace <id>", "Workspace ID").action(async (options, cmd) => {
|
|
4513
5571
|
const globalOpts = cmd.optsWithGlobals();
|
|
4514
5572
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -4693,7 +5751,7 @@ function createDealsCommand() {
|
|
|
4693
5751
|
}
|
|
4694
5752
|
|
|
4695
5753
|
// src/commands/epics.ts
|
|
4696
|
-
import { Command as
|
|
5754
|
+
import { Command as Command8 } from "commander";
|
|
4697
5755
|
var EPIC_STATUSES = ["OPEN", "IN_PROGRESS", "DONE", "CANCELLED"];
|
|
4698
5756
|
var EPIC_PRIORITIES = ["HIGH", "MEDIUM", "LOW", "NONE"];
|
|
4699
5757
|
function validateEpicStatus(value) {
|
|
@@ -4721,7 +5779,7 @@ function parseDate2(value) {
|
|
|
4721
5779
|
return d;
|
|
4722
5780
|
}
|
|
4723
5781
|
function createEpicsCommand() {
|
|
4724
|
-
const epics = new
|
|
5782
|
+
const epics = new Command8("epics").description(
|
|
4725
5783
|
"Manage epics. Epics are workspace-scoped and group actions and tickets across products."
|
|
4726
5784
|
);
|
|
4727
5785
|
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(
|
|
@@ -4838,10 +5896,10 @@ function createEpicsCommand() {
|
|
|
4838
5896
|
}
|
|
4839
5897
|
|
|
4840
5898
|
// src/commands/features.ts
|
|
4841
|
-
import { Command as
|
|
5899
|
+
import { Command as Command14 } from "commander";
|
|
4842
5900
|
|
|
4843
5901
|
// src/commands/stories.ts
|
|
4844
|
-
import { Command as
|
|
5902
|
+
import { Command as Command9 } from "commander";
|
|
4845
5903
|
async function readStdin() {
|
|
4846
5904
|
const chunks = [];
|
|
4847
5905
|
for await (const chunk of process.stdin) {
|
|
@@ -4850,7 +5908,7 @@ async function readStdin() {
|
|
|
4850
5908
|
return Buffer.concat(chunks).toString("utf-8");
|
|
4851
5909
|
}
|
|
4852
5910
|
function createStoriesCommand() {
|
|
4853
|
-
const stories = new
|
|
5911
|
+
const stories = new Command9("stories").description(
|
|
4854
5912
|
"Manage a feature's native, structured user stories (As a / I want / So that)."
|
|
4855
5913
|
);
|
|
4856
5914
|
stories.command("add").description(
|
|
@@ -4984,7 +6042,7 @@ function createStoriesCommand() {
|
|
|
4984
6042
|
}
|
|
4985
6043
|
|
|
4986
6044
|
// src/commands/scopes.ts
|
|
4987
|
-
import { Command as
|
|
6045
|
+
import { Command as Command10 } from "commander";
|
|
4988
6046
|
var SCOPE_STATUSES = [
|
|
4989
6047
|
"PLANNED",
|
|
4990
6048
|
"IN_PROGRESS",
|
|
@@ -5001,7 +6059,7 @@ function validateScopeStatus(value) {
|
|
|
5001
6059
|
return value;
|
|
5002
6060
|
}
|
|
5003
6061
|
function createScopesCommand() {
|
|
5004
|
-
const scopes = new
|
|
6062
|
+
const scopes = new Command10("scopes").description(
|
|
5005
6063
|
`Manage a feature's scopes: shippable increments ("V1", "V2"), each with its own lifecycle.`
|
|
5006
6064
|
);
|
|
5007
6065
|
scopes.command("list").description("List a feature's scopes").requiredOption("--feature <id>", "Feature CUID").action(
|
|
@@ -5080,7 +6138,7 @@ function createScopesCommand() {
|
|
|
5080
6138
|
}
|
|
5081
6139
|
|
|
5082
6140
|
// src/commands/requirements.ts
|
|
5083
|
-
import { Command as
|
|
6141
|
+
import { Command as Command11 } from "commander";
|
|
5084
6142
|
var REQUIREMENT_KINDS = [
|
|
5085
6143
|
"FUNCTIONAL",
|
|
5086
6144
|
"NON_FUNCTIONAL",
|
|
@@ -5103,7 +6161,7 @@ async function readStdin2() {
|
|
|
5103
6161
|
return Buffer.concat(chunks).toString("utf-8");
|
|
5104
6162
|
}
|
|
5105
6163
|
function createRequirementsCommand() {
|
|
5106
|
-
const requirements = new
|
|
6164
|
+
const requirements = new Command11("requirements").description(
|
|
5107
6165
|
`Manage a feature's requirements: atomic, testable EARS-style "shall" statements, checkable met/unmet.`
|
|
5108
6166
|
);
|
|
5109
6167
|
requirements.command("add").description(
|
|
@@ -5234,25 +6292,25 @@ function createRequirementsCommand() {
|
|
|
5234
6292
|
}
|
|
5235
6293
|
|
|
5236
6294
|
// src/commands/areas.ts
|
|
5237
|
-
import { Command as
|
|
5238
|
-
import
|
|
6295
|
+
import { Command as Command12 } from "commander";
|
|
6296
|
+
import chalk7 from "chalk";
|
|
5239
6297
|
function outputAreasPretty(areas) {
|
|
5240
6298
|
if (areas.length === 0) {
|
|
5241
|
-
console.log(
|
|
6299
|
+
console.log(chalk7.gray("No areas found."));
|
|
5242
6300
|
return;
|
|
5243
6301
|
}
|
|
5244
|
-
console.log(
|
|
6302
|
+
console.log(chalk7.bold(`
|
|
5245
6303
|
Areas (${areas.length} total)`));
|
|
5246
|
-
console.log(
|
|
6304
|
+
console.log(chalk7.gray("\u2500".repeat(50)));
|
|
5247
6305
|
for (const a of areas) {
|
|
5248
|
-
const count = a._count?.features != null ?
|
|
5249
|
-
console.log(` ${
|
|
5250
|
-
console.log(
|
|
6306
|
+
const count = a._count?.features != null ? chalk7.gray(` (${a._count.features} features)`) : "";
|
|
6307
|
+
console.log(` ${chalk7.bold(a.name)}${count}`);
|
|
6308
|
+
console.log(chalk7.gray(` ID: ${a.id}`));
|
|
5251
6309
|
}
|
|
5252
6310
|
console.log();
|
|
5253
6311
|
}
|
|
5254
6312
|
function createAreasCommand() {
|
|
5255
|
-
const areas = new
|
|
6313
|
+
const areas = new Command12("areas").description(
|
|
5256
6314
|
"Manage a product's areas: the buckets features are filed under (a feature has exactly one or none)."
|
|
5257
6315
|
);
|
|
5258
6316
|
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(
|
|
@@ -5296,7 +6354,7 @@ function createAreasCommand() {
|
|
|
5296
6354
|
}
|
|
5297
6355
|
|
|
5298
6356
|
// src/commands/featureComments.ts
|
|
5299
|
-
import { Command as
|
|
6357
|
+
import { Command as Command13 } from "commander";
|
|
5300
6358
|
|
|
5301
6359
|
// src/utils/mentions.ts
|
|
5302
6360
|
function candidateLabels(member) {
|
|
@@ -5369,7 +6427,7 @@ function collectMention(value, previous) {
|
|
|
5369
6427
|
|
|
5370
6428
|
// src/commands/featureComments.ts
|
|
5371
6429
|
function createFeatureCommentsCommand() {
|
|
5372
|
-
const comment = new
|
|
6430
|
+
const comment = new Command13("comment").description(
|
|
5373
6431
|
"Read and post comments on a feature. Mention teammates with --mention."
|
|
5374
6432
|
);
|
|
5375
6433
|
comment.command("list").description("List comments on a feature").requiredOption("--feature <id>", "Feature ID").action(async (options, cmd) => {
|
|
@@ -5570,7 +6628,7 @@ function validateFeatureStatus(value) {
|
|
|
5570
6628
|
return value;
|
|
5571
6629
|
}
|
|
5572
6630
|
function createFeaturesCommand() {
|
|
5573
|
-
const features = new
|
|
6631
|
+
const features = new Command14("features").description(
|
|
5574
6632
|
"Manage features. A feature lives under a product and groups user stories, scopes, and tickets."
|
|
5575
6633
|
);
|
|
5576
6634
|
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(
|
|
@@ -5827,8 +6885,8 @@ Aborted: ${reason}. Feature "${feature.name}" was NOT deleted.`);
|
|
|
5827
6885
|
}
|
|
5828
6886
|
|
|
5829
6887
|
// src/commands/labels.ts
|
|
5830
|
-
import { Command as
|
|
5831
|
-
import
|
|
6888
|
+
import { Command as Command15 } from "commander";
|
|
6889
|
+
import chalk8 from "chalk";
|
|
5832
6890
|
var TRIAGE_LABELS = [
|
|
5833
6891
|
{ slug: "needs-triage", name: "needs-triage", color: "avatar-orange" },
|
|
5834
6892
|
{ slug: "needs-info", name: "needs-info", color: "avatar-yellow" },
|
|
@@ -5842,22 +6900,22 @@ function looksLikeCuid(value) {
|
|
|
5842
6900
|
}
|
|
5843
6901
|
function outputTagsPretty(tags) {
|
|
5844
6902
|
if (tags.length === 0) {
|
|
5845
|
-
console.log(
|
|
6903
|
+
console.log(chalk8.dim("No labels found."));
|
|
5846
6904
|
return;
|
|
5847
6905
|
}
|
|
5848
6906
|
console.log();
|
|
5849
6907
|
for (const tag of tags) {
|
|
5850
|
-
const scope = tag.workspaceId === null ?
|
|
5851
|
-
const category = tag.category === null ?
|
|
6908
|
+
const scope = tag.workspaceId === null ? chalk8.cyan("global") : chalk8.magenta("workspace");
|
|
6909
|
+
const category = tag.category === null ? chalk8.dim("(label)") : chalk8.dim(`(${tag.category})`);
|
|
5852
6910
|
console.log(
|
|
5853
|
-
` ${
|
|
6911
|
+
` ${chalk8.bold(tag.slug)} ${tag.name} ${chalk8.gray(tag.color)} ${scope} ${category}`
|
|
5854
6912
|
);
|
|
5855
6913
|
}
|
|
5856
6914
|
console.log();
|
|
5857
6915
|
}
|
|
5858
6916
|
function outputTagPretty(tag, prefix) {
|
|
5859
6917
|
if (prefix) console.log(prefix);
|
|
5860
|
-
console.log(` ${
|
|
6918
|
+
console.log(` ${chalk8.bold(tag.slug)} ${tag.name} ${chalk8.gray(tag.color)}`);
|
|
5861
6919
|
}
|
|
5862
6920
|
async function resolveLabelIds(client, workspaceId, values) {
|
|
5863
6921
|
if (values.length === 0) return [];
|
|
@@ -5881,7 +6939,7 @@ async function resolveLabelIds(client, workspaceId, values) {
|
|
|
5881
6939
|
return [...byId, ...resolvedFromSlugs];
|
|
5882
6940
|
}
|
|
5883
6941
|
function createLabelsCommand() {
|
|
5884
|
-
const labels = new
|
|
6942
|
+
const labels = new Command15("labels").description(
|
|
5885
6943
|
"Manage labels (orthogonal tags applied to actions, tickets, features, and epics)."
|
|
5886
6944
|
);
|
|
5887
6945
|
labels.command("list").description("List labels visible in a workspace").option("--workspace <slug|id>", "Workspace slug or CUID").option(
|
|
@@ -5929,7 +6987,7 @@ function createLabelsCommand() {
|
|
|
5929
6987
|
if (useJson) {
|
|
5930
6988
|
console.log(JSON.stringify(tag, null, 2));
|
|
5931
6989
|
} else {
|
|
5932
|
-
outputTagPretty(tag,
|
|
6990
|
+
outputTagPretty(tag, chalk8.green("\n\u2713 Label created"));
|
|
5933
6991
|
}
|
|
5934
6992
|
} catch (error) {
|
|
5935
6993
|
handleError(error, useJson);
|
|
@@ -5967,10 +7025,10 @@ function createLabelsCommand() {
|
|
|
5967
7025
|
console.log(JSON.stringify(results, null, 2));
|
|
5968
7026
|
} else {
|
|
5969
7027
|
console.log();
|
|
5970
|
-
console.log(
|
|
7028
|
+
console.log(chalk8.bold("Triage labels:"));
|
|
5971
7029
|
for (const r of results) {
|
|
5972
|
-
const tag =
|
|
5973
|
-
const status = r.status === "created" ?
|
|
7030
|
+
const tag = chalk8.bold(r.slug);
|
|
7031
|
+
const status = r.status === "created" ? chalk8.green("created") : chalk8.dim("existed");
|
|
5974
7032
|
console.log(` ${tag} ${status}`);
|
|
5975
7033
|
}
|
|
5976
7034
|
console.log();
|
|
@@ -5984,10 +7042,10 @@ function createLabelsCommand() {
|
|
|
5984
7042
|
}
|
|
5985
7043
|
|
|
5986
7044
|
// src/commands/meetings.ts
|
|
5987
|
-
import { Command as
|
|
5988
|
-
import
|
|
7045
|
+
import { Command as Command16 } from "commander";
|
|
7046
|
+
import chalk9 from "chalk";
|
|
5989
7047
|
function createMeetingsCommand() {
|
|
5990
|
-
const meetings = new
|
|
7048
|
+
const meetings = new Command16("meetings").description(
|
|
5991
7049
|
"Manage meetings and their notes (recorded, imported, or manually created)"
|
|
5992
7050
|
);
|
|
5993
7051
|
meetings.command("list").description(
|
|
@@ -6148,7 +7206,7 @@ function createMeetingsCommand() {
|
|
|
6148
7206
|
console.log(`\u2713 Deleted ${count} of ${ids.length} meeting${ids.length === 1 ? "" : "s"}`);
|
|
6149
7207
|
if (skipped > 0) {
|
|
6150
7208
|
console.log(
|
|
6151
|
-
|
|
7209
|
+
chalk9.yellow(
|
|
6152
7210
|
`${skipped} id(s) were skipped \u2014 not found, or not owned by you.`
|
|
6153
7211
|
)
|
|
6154
7212
|
);
|
|
@@ -6159,7 +7217,7 @@ function createMeetingsCommand() {
|
|
|
6159
7217
|
}
|
|
6160
7218
|
}
|
|
6161
7219
|
);
|
|
6162
|
-
const notes = new
|
|
7220
|
+
const notes = new Command16("notes").description(
|
|
6163
7221
|
"Read and write a meeting's notes"
|
|
6164
7222
|
);
|
|
6165
7223
|
notes.command("get <id>").description(
|
|
@@ -6175,7 +7233,7 @@ function createMeetingsCommand() {
|
|
|
6175
7233
|
process.stdout.write(body.endsWith("\n") ? body : `${body}
|
|
6176
7234
|
`);
|
|
6177
7235
|
} else if (process.stdout.isTTY) {
|
|
6178
|
-
console.log(
|
|
7236
|
+
console.log(chalk9.gray("No notes yet."));
|
|
6179
7237
|
}
|
|
6180
7238
|
} catch (error) {
|
|
6181
7239
|
handleError(error, shouldUseJson(globalOpts.json, globalOpts.pretty));
|
|
@@ -6224,7 +7282,7 @@ function createMeetingsCommand() {
|
|
|
6224
7282
|
}
|
|
6225
7283
|
|
|
6226
7284
|
// src/commands/organizations.ts
|
|
6227
|
-
import { Command as
|
|
7285
|
+
import { Command as Command17 } from "commander";
|
|
6228
7286
|
var VALID_SIZES = [
|
|
6229
7287
|
"1-10",
|
|
6230
7288
|
"11-50",
|
|
@@ -6234,7 +7292,7 @@ var VALID_SIZES = [
|
|
|
6234
7292
|
"1000+"
|
|
6235
7293
|
];
|
|
6236
7294
|
function createOrganizationsCommand() {
|
|
6237
|
-
const organizations = new
|
|
7295
|
+
const organizations = new Command17("organizations").alias("orgs").description("Manage CRM organizations");
|
|
6238
7296
|
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) => {
|
|
6239
7297
|
const globalOpts = cmd.optsWithGlobals();
|
|
6240
7298
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -6302,13 +7360,13 @@ function createOrganizationsCommand() {
|
|
|
6302
7360
|
}
|
|
6303
7361
|
|
|
6304
7362
|
// src/commands/pages.ts
|
|
6305
|
-
import { Command as
|
|
6306
|
-
import
|
|
7363
|
+
import { Command as Command19 } from "commander";
|
|
7364
|
+
import chalk10 from "chalk";
|
|
6307
7365
|
|
|
6308
7366
|
// src/commands/pageComments.ts
|
|
6309
|
-
import { Command as
|
|
7367
|
+
import { Command as Command18 } from "commander";
|
|
6310
7368
|
function createPageCommentsCommand() {
|
|
6311
|
-
const comment = new
|
|
7369
|
+
const comment = new Command18("comment").description(
|
|
6312
7370
|
"Read and post comments on a page. Mention teammates with --mention."
|
|
6313
7371
|
);
|
|
6314
7372
|
comment.command("list").description("List comments on a page").requiredOption("--page <id>", "Page ID").action(async (options, cmd) => {
|
|
@@ -6411,7 +7469,7 @@ function parseLimit2(value) {
|
|
|
6411
7469
|
return n;
|
|
6412
7470
|
}
|
|
6413
7471
|
function createPagesCommand() {
|
|
6414
|
-
const pages = new
|
|
7472
|
+
const pages = new Command19("pages").description(
|
|
6415
7473
|
`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".`
|
|
6416
7474
|
);
|
|
6417
7475
|
pages.command("list").description("List pages in a workspace (metadata only, no bodies)").option("--workspace <slug|id>", "Workspace (defaults to the configured default)").option(
|
|
@@ -6560,13 +7618,13 @@ function createPagesCommand() {
|
|
|
6560
7618
|
const revision = await client.pages.revision(id, revisionId);
|
|
6561
7619
|
if (useJson) console.log(JSON.stringify(revision, null, 2));
|
|
6562
7620
|
else {
|
|
6563
|
-
console.log(
|
|
7621
|
+
console.log(chalk10.gray("\u2500".repeat(50)));
|
|
6564
7622
|
console.log(
|
|
6565
7623
|
`
|
|
6566
|
-
${
|
|
7624
|
+
${chalk10.bold(revision.title)} ${chalk10.gray(`v${revision.docVersion} \xB7 ${revision.kind}`)}`
|
|
6567
7625
|
);
|
|
6568
|
-
console.log(
|
|
6569
|
-
if (revision.note) console.log(` ${
|
|
7626
|
+
console.log(chalk10.gray(` Revision: ${revision.id}`));
|
|
7627
|
+
if (revision.note) console.log(` ${chalk10.gray("Note:")} ${revision.note}`);
|
|
6570
7628
|
if (revision.body) console.log(`
|
|
6571
7629
|
${revision.body}
|
|
6572
7630
|
`);
|
|
@@ -6637,10 +7695,264 @@ ${revision.body}
|
|
|
6637
7695
|
return pages;
|
|
6638
7696
|
}
|
|
6639
7697
|
|
|
7698
|
+
// src/commands/positions.ts
|
|
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
|
+
|
|
6640
7952
|
// src/commands/products.ts
|
|
6641
|
-
import { Command as
|
|
7953
|
+
import { Command as Command21 } from "commander";
|
|
6642
7954
|
function createProductsCommand() {
|
|
6643
|
-
const products = new
|
|
7955
|
+
const products = new Command21("products").description(
|
|
6644
7956
|
"Manage products. A workspace contains products; a product holds features and tickets."
|
|
6645
7957
|
);
|
|
6646
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) => {
|
|
@@ -6781,7 +8093,7 @@ Re-run with --force to delete it anyway.`
|
|
|
6781
8093
|
}
|
|
6782
8094
|
|
|
6783
8095
|
// src/commands/projects.ts
|
|
6784
|
-
import { Command as
|
|
8096
|
+
import { Command as Command22 } from "commander";
|
|
6785
8097
|
var PROJECT_STATUSES = [
|
|
6786
8098
|
"ACTIVE",
|
|
6787
8099
|
"ON_HOLD",
|
|
@@ -6808,7 +8120,7 @@ function validateProjectPriority(value) {
|
|
|
6808
8120
|
return value;
|
|
6809
8121
|
}
|
|
6810
8122
|
function createProjectsCommand() {
|
|
6811
|
-
const projects = new
|
|
8123
|
+
const projects = new Command22("projects").description("Manage projects");
|
|
6812
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) => {
|
|
6813
8125
|
const globalOpts = cmd.optsWithGlobals();
|
|
6814
8126
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -6927,7 +8239,7 @@ Re-run with --force to delete it anyway.`
|
|
|
6927
8239
|
}
|
|
6928
8240
|
|
|
6929
8241
|
// src/commands/resources.ts
|
|
6930
|
-
import { Command as
|
|
8242
|
+
import { Command as Command23 } from "commander";
|
|
6931
8243
|
var STATUS_FILTERS = ["unread", "to_read", "reading", "read", "all"];
|
|
6932
8244
|
function validateStatus(value) {
|
|
6933
8245
|
const v = value ?? "unread";
|
|
@@ -6942,7 +8254,7 @@ function collectTags(value, previous) {
|
|
|
6942
8254
|
}
|
|
6943
8255
|
var TAG_OPTION = "--tag <tag>";
|
|
6944
8256
|
function createResourcesCommand() {
|
|
6945
|
-
const resources = new
|
|
8257
|
+
const resources = new Command23("resources").description(
|
|
6946
8258
|
"Saved links and reference material. `list` defaults to the Reading list (unread); `create --url` saves a link to read later."
|
|
6947
8259
|
);
|
|
6948
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(
|
|
@@ -7049,7 +8361,7 @@ function createResourcesCommand() {
|
|
|
7049
8361
|
}
|
|
7050
8362
|
|
|
7051
8363
|
// src/commands/runner.ts
|
|
7052
|
-
import { Command as
|
|
8364
|
+
import { Command as Command24 } from "commander";
|
|
7053
8365
|
import { hostname, homedir as homedir2, tmpdir as tmpdir2 } from "os";
|
|
7054
8366
|
import { execFileSync } from "child_process";
|
|
7055
8367
|
import { mkdirSync as mkdirSync3 } from "fs";
|
|
@@ -7501,7 +8813,7 @@ function removeServiceFile(plan) {
|
|
|
7501
8813
|
|
|
7502
8814
|
// src/commands/runner.ts
|
|
7503
8815
|
function createRunnerCommand() {
|
|
7504
|
-
const cmd = new
|
|
8816
|
+
const cmd = new Command24("runner").description(
|
|
7505
8817
|
"Run your Assistant locally: claim its queued runs and work them with Claude Code on this machine"
|
|
7506
8818
|
);
|
|
7507
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) => {
|
|
@@ -7612,8 +8924,8 @@ ${plan.contents}
|
|
|
7612
8924
|
}
|
|
7613
8925
|
|
|
7614
8926
|
// src/commands/search.ts
|
|
7615
|
-
import { Command as
|
|
7616
|
-
import
|
|
8927
|
+
import { Command as Command25 } from "commander";
|
|
8928
|
+
import chalk12 from "chalk";
|
|
7617
8929
|
var KNOWLEDGE_TYPES = ["transcription", "resource", "document", "page"];
|
|
7618
8930
|
function parseTypes(value) {
|
|
7619
8931
|
if (!value) return void 0;
|
|
@@ -7642,7 +8954,7 @@ var TYPE_LABELS = {
|
|
|
7642
8954
|
product: "Products"
|
|
7643
8955
|
};
|
|
7644
8956
|
function createSearchCommand() {
|
|
7645
|
-
const search = new
|
|
8957
|
+
const search = new Command25("search").description(
|
|
7646
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."
|
|
7647
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) => {
|
|
7648
8960
|
const globalOpts = cmd.optsWithGlobals();
|
|
@@ -7656,10 +8968,10 @@ function createSearchCommand() {
|
|
|
7656
8968
|
(w) => w.slug === options.workspace || w.id === options.workspace
|
|
7657
8969
|
);
|
|
7658
8970
|
if (!match) {
|
|
7659
|
-
console.error(
|
|
7660
|
-
console.log(
|
|
8971
|
+
console.error(chalk12.red(`Workspace "${options.workspace}" not found.`));
|
|
8972
|
+
console.log(chalk12.gray("Available workspaces:"));
|
|
7661
8973
|
workspaces.forEach((w) => {
|
|
7662
|
-
console.log(
|
|
8974
|
+
console.log(chalk12.gray(` - ${w.slug} (${w.name})`));
|
|
7663
8975
|
});
|
|
7664
8976
|
process.exit(1);
|
|
7665
8977
|
}
|
|
@@ -7681,16 +8993,16 @@ function createSearchCommand() {
|
|
|
7681
8993
|
return;
|
|
7682
8994
|
}
|
|
7683
8995
|
if (knowledge.results.length === 0) {
|
|
7684
|
-
console.log(
|
|
8996
|
+
console.log(chalk12.gray(`Nothing about "${knowledge.query}" in the Knowledge index.`));
|
|
7685
8997
|
return;
|
|
7686
8998
|
}
|
|
7687
|
-
console.log(
|
|
8999
|
+
console.log(chalk12.bold(`
|
|
7688
9000
|
About "${knowledge.query}"`));
|
|
7689
9001
|
for (const row of knowledge.results) {
|
|
7690
9002
|
console.log(
|
|
7691
|
-
` ${
|
|
9003
|
+
` ${chalk12.white(row.title)} ${chalk12.gray(`\xB7 ${row.sourceType} \xB7 ${Math.round(row.similarity * 100)}%`)}`
|
|
7692
9004
|
);
|
|
7693
|
-
console.log(
|
|
9005
|
+
console.log(chalk12.gray(` ${row.sourceId} ${row.url}`));
|
|
7694
9006
|
if (row.snippet) console.log(` ${row.snippet}`);
|
|
7695
9007
|
}
|
|
7696
9008
|
console.log();
|
|
@@ -7702,7 +9014,7 @@ About "${knowledge.query}"`));
|
|
|
7702
9014
|
return;
|
|
7703
9015
|
}
|
|
7704
9016
|
if (result.results.length === 0) {
|
|
7705
|
-
console.log(
|
|
9017
|
+
console.log(chalk12.gray(`No matches for "${result.query}".`));
|
|
7706
9018
|
return;
|
|
7707
9019
|
}
|
|
7708
9020
|
const byType = /* @__PURE__ */ new Map();
|
|
@@ -7712,14 +9024,14 @@ About "${knowledge.query}"`));
|
|
|
7712
9024
|
byType.set(r.type, bucket);
|
|
7713
9025
|
}
|
|
7714
9026
|
for (const [type, rows] of byType) {
|
|
7715
|
-
console.log(
|
|
9027
|
+
console.log(chalk12.bold(`
|
|
7716
9028
|
${TYPE_LABELS[type] ?? type}`));
|
|
7717
9029
|
for (const row of rows) {
|
|
7718
|
-
const parts = [
|
|
7719
|
-
if (row.subtitle) parts.push(
|
|
7720
|
-
if (row.workspace) parts.push(
|
|
7721
|
-
console.log(` ${parts.join(
|
|
7722
|
-
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}` : ""}`));
|
|
7723
9035
|
}
|
|
7724
9036
|
}
|
|
7725
9037
|
console.log();
|
|
@@ -7731,7 +9043,7 @@ ${TYPE_LABELS[type] ?? type}`));
|
|
|
7731
9043
|
}
|
|
7732
9044
|
|
|
7733
9045
|
// src/commands/tickets.ts
|
|
7734
|
-
import { Command as
|
|
9046
|
+
import { Command as Command26 } from "commander";
|
|
7735
9047
|
function collectRepeatable(value, previous) {
|
|
7736
9048
|
return [...previous, value];
|
|
7737
9049
|
}
|
|
@@ -7774,7 +9086,7 @@ function validateTicketType(value) {
|
|
|
7774
9086
|
return value;
|
|
7775
9087
|
}
|
|
7776
9088
|
function createTicketsCommand() {
|
|
7777
|
-
const tickets = new
|
|
9089
|
+
const tickets = new Command26("tickets").description(
|
|
7778
9090
|
"Manage product backlog tickets. Tickets live under a product, link to features/epics, depend on each other, and can be implemented via actions."
|
|
7779
9091
|
);
|
|
7780
9092
|
tickets.command("list").description(
|
|
@@ -8143,7 +9455,7 @@ function createTicketsCommand() {
|
|
|
8143
9455
|
handleError(error, useJson);
|
|
8144
9456
|
}
|
|
8145
9457
|
});
|
|
8146
|
-
const comment = new
|
|
9458
|
+
const comment = new Command26("comment").description("Manage comments on a ticket");
|
|
8147
9459
|
comment.command("list").description("List comments on a ticket").requiredOption("--id <id>", "Ticket CUID").action(async (options, cmd) => {
|
|
8148
9460
|
const globalOpts = cmd.optsWithGlobals();
|
|
8149
9461
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -8235,7 +9547,7 @@ function createTicketsCommand() {
|
|
|
8235
9547
|
}
|
|
8236
9548
|
|
|
8237
9549
|
// src/commands/time.ts
|
|
8238
|
-
import { Command as
|
|
9550
|
+
import { Command as Command27 } from "commander";
|
|
8239
9551
|
import { segmentConversation } from "exponential-sdk";
|
|
8240
9552
|
var SOURCES2 = ["manual", "claude-desktop", "agent-run"];
|
|
8241
9553
|
var STATUSES2 = ["PROPOSED", "CONFIRMED"];
|
|
@@ -8325,7 +9637,7 @@ function batchItemToInput(item, index, defaults) {
|
|
|
8325
9637
|
};
|
|
8326
9638
|
}
|
|
8327
9639
|
function createTimeCommand() {
|
|
8328
|
-
const time = new
|
|
9640
|
+
const time = new Command27("time").description(
|
|
8329
9641
|
`Time entries \u2014 log the day's work and list it. ${OWNERSHIP_NOTE}`
|
|
8330
9642
|
);
|
|
8331
9643
|
time.command("log").description(
|
|
@@ -8495,10 +9807,10 @@ function parseMessagesFile(raw) {
|
|
|
8495
9807
|
}
|
|
8496
9808
|
|
|
8497
9809
|
// src/commands/workspaces.ts
|
|
8498
|
-
import { Command as
|
|
8499
|
-
import
|
|
9810
|
+
import { Command as Command28 } from "commander";
|
|
9811
|
+
import chalk13 from "chalk";
|
|
8500
9812
|
function createWorkspacesCommand() {
|
|
8501
|
-
const workspaces = new
|
|
9813
|
+
const workspaces = new Command28("workspaces").description("Manage workspaces");
|
|
8502
9814
|
workspaces.command("list").description("List all workspaces").action(async (_options, cmd) => {
|
|
8503
9815
|
const globalOpts = cmd.optsWithGlobals();
|
|
8504
9816
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -8511,7 +9823,7 @@ function createWorkspacesCommand() {
|
|
|
8511
9823
|
const config = getConfig();
|
|
8512
9824
|
outputWorkspacesPretty(workspaces2);
|
|
8513
9825
|
if (config.defaultWorkspaceSlug) {
|
|
8514
|
-
console.log(
|
|
9826
|
+
console.log(chalk13.gray(`Default workspace: ${config.defaultWorkspaceSlug}`));
|
|
8515
9827
|
}
|
|
8516
9828
|
}
|
|
8517
9829
|
} catch (error) {
|
|
@@ -8524,10 +9836,10 @@ function createWorkspacesCommand() {
|
|
|
8524
9836
|
const workspaces2 = await client.workspaces.list();
|
|
8525
9837
|
const workspace = workspaces2.find((w) => w.slug === slug);
|
|
8526
9838
|
if (!workspace) {
|
|
8527
|
-
console.error(
|
|
8528
|
-
console.log(
|
|
9839
|
+
console.error(chalk13.red(`Workspace with slug "${slug}" not found.`));
|
|
9840
|
+
console.log(chalk13.gray("Available workspaces:"));
|
|
8529
9841
|
workspaces2.forEach((w) => {
|
|
8530
|
-
console.log(
|
|
9842
|
+
console.log(chalk13.gray(` - ${w.slug} (${w.name})`));
|
|
8531
9843
|
});
|
|
8532
9844
|
process.exit(1);
|
|
8533
9845
|
}
|
|
@@ -8535,7 +9847,7 @@ function createWorkspacesCommand() {
|
|
|
8535
9847
|
defaultWorkspaceId: workspace.id,
|
|
8536
9848
|
defaultWorkspaceSlug: workspace.slug
|
|
8537
9849
|
});
|
|
8538
|
-
console.log(
|
|
9850
|
+
console.log(chalk13.green(`Default workspace set to: ${workspace.name} (${workspace.slug})`));
|
|
8539
9851
|
} catch (error) {
|
|
8540
9852
|
handleError(error);
|
|
8541
9853
|
}
|
|
@@ -8563,20 +9875,20 @@ function createWorkspacesCommand() {
|
|
|
8563
9875
|
return;
|
|
8564
9876
|
}
|
|
8565
9877
|
if (members.length === 0) {
|
|
8566
|
-
console.log(
|
|
9878
|
+
console.log(chalk13.gray("No members found."));
|
|
8567
9879
|
return;
|
|
8568
9880
|
}
|
|
8569
|
-
console.log(
|
|
9881
|
+
console.log(chalk13.bold(`
|
|
8570
9882
|
Members (${members.length})
|
|
8571
9883
|
`));
|
|
8572
9884
|
for (const m of members) {
|
|
8573
9885
|
const label = m.name ?? m.email ?? m.id;
|
|
8574
|
-
const via = m.source === "team" ?
|
|
9886
|
+
const via = m.source === "team" ? chalk13.gray(
|
|
8575
9887
|
` via team${m.teams.length ? `: ${m.teams.map((t) => t.name).join(", ")}` : ""}` + (m.teamRole ? ` [team ${m.teamRole}]` : "")
|
|
8576
9888
|
) : "";
|
|
8577
|
-
console.log(`${
|
|
8578
|
-
if (m.email) console.log(
|
|
8579
|
-
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}`));
|
|
8580
9892
|
console.log();
|
|
8581
9893
|
}
|
|
8582
9894
|
} catch (error) {
|
|
@@ -8588,7 +9900,7 @@ Members (${members.length})
|
|
|
8588
9900
|
}
|
|
8589
9901
|
|
|
8590
9902
|
// src/commands/goals.ts
|
|
8591
|
-
import { Command as
|
|
9903
|
+
import { Command as Command29 } from "commander";
|
|
8592
9904
|
var GOAL_STATUSES = [
|
|
8593
9905
|
"planned",
|
|
8594
9906
|
"active",
|
|
@@ -8700,7 +10012,7 @@ function validateKeyResultUnit(value) {
|
|
|
8700
10012
|
return value;
|
|
8701
10013
|
}
|
|
8702
10014
|
function createKeyResultsCommand() {
|
|
8703
|
-
const kr = new
|
|
10015
|
+
const kr = new Command29("kr").description(
|
|
8704
10016
|
"Key results on an objective. Ids are CUIDs; --goal takes the objective's integer id."
|
|
8705
10017
|
);
|
|
8706
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(
|
|
@@ -8903,7 +10215,7 @@ function createKeyResultsCommand() {
|
|
|
8903
10215
|
return kr;
|
|
8904
10216
|
}
|
|
8905
10217
|
function createGoalCommentsCommand() {
|
|
8906
|
-
const comment = new
|
|
10218
|
+
const comment = new Command29("comment").description(
|
|
8907
10219
|
"Read and post comments on a goal. Mention teammates with --mention."
|
|
8908
10220
|
);
|
|
8909
10221
|
comment.command("list").description("List comments on a goal").requiredOption("--goal <id>", "Goal ID (a number)").action(async (options, cmd) => {
|
|
@@ -8998,7 +10310,7 @@ function createGoalCommentsCommand() {
|
|
|
8998
10310
|
return comment;
|
|
8999
10311
|
}
|
|
9000
10312
|
function createGoalsCommand() {
|
|
9001
|
-
const goals = new
|
|
10313
|
+
const goals = new Command29("goals").description(
|
|
9002
10314
|
"Manage goals (objectives) and their key results. Objectives have integer ids; key results are CUIDs."
|
|
9003
10315
|
);
|
|
9004
10316
|
goals.command("list").description(
|
|
@@ -9285,7 +10597,7 @@ Re-run with --with-key-results to go ahead, or move them with \`goals kr update
|
|
|
9285
10597
|
return goals;
|
|
9286
10598
|
}
|
|
9287
10599
|
function createOkrsCommand() {
|
|
9288
|
-
const okrs = new
|
|
10600
|
+
const okrs = new Command29("okrs").description(
|
|
9289
10601
|
"OKRs \u2014 objectives with their key results nested. Manage the parts with `goals` and `goals kr`."
|
|
9290
10602
|
);
|
|
9291
10603
|
okrs.command("list").description(
|
|
@@ -9374,7 +10686,7 @@ function isBareVersionRequest(args) {
|
|
|
9374
10686
|
return args.includes("--version") && args.every((arg) => arg.startsWith("-"));
|
|
9375
10687
|
}
|
|
9376
10688
|
function buildProgram() {
|
|
9377
|
-
const program = new
|
|
10689
|
+
const program = new Command30();
|
|
9378
10690
|
program.name("exponential").description(
|
|
9379
10691
|
[
|
|
9380
10692
|
"CLI to interact with Exponential productivity app.",
|
|
@@ -9387,6 +10699,7 @@ function buildProgram() {
|
|
|
9387
10699
|
program.addCommand(createAuthCommand());
|
|
9388
10700
|
program.addCommand(createActionsCommand());
|
|
9389
10701
|
program.addCommand(createContactsCommand());
|
|
10702
|
+
program.addCommand(createCeremoniesCommand());
|
|
9390
10703
|
program.addCommand(createDatabasesCommand());
|
|
9391
10704
|
program.addCommand(createDecisionsCommand());
|
|
9392
10705
|
program.addCommand(createDealsCommand());
|
|
@@ -9404,6 +10717,7 @@ function buildProgram() {
|
|
|
9404
10717
|
program.addCommand(createTicketsCommand());
|
|
9405
10718
|
program.addCommand(createTimeCommand());
|
|
9406
10719
|
program.addCommand(createWorkspacesCommand());
|
|
10720
|
+
program.addCommand(createPositionsCommand());
|
|
9407
10721
|
program.addCommand(createGoalsCommand());
|
|
9408
10722
|
program.addCommand(createOkrsCommand());
|
|
9409
10723
|
return program;
|