exponential-cli 1.29.0 → 1.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/dist/index.js +998 -869
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
// src/
|
|
4
|
-
import { Command as Command30 } from "commander";
|
|
5
|
-
|
|
6
|
-
// src/commands/auth.ts
|
|
3
|
+
// src/commands/agentGuidance.ts
|
|
7
4
|
import { Command } from "commander";
|
|
8
|
-
import
|
|
5
|
+
import chalk3 from "chalk";
|
|
6
|
+
|
|
7
|
+
// src/client/index.ts
|
|
8
|
+
import { ExponentialClient } from "exponential-sdk";
|
|
9
9
|
|
|
10
10
|
// src/config/index.ts
|
|
11
11
|
import { createConfigStore } from "exponential-sdk";
|
|
@@ -27,7 +27,6 @@ function getConfigPath() {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
// src/client/index.ts
|
|
30
|
-
import { ExponentialClient } from "exponential-sdk";
|
|
31
30
|
import { isTRPCError, TRPCClientError } from "exponential-sdk";
|
|
32
31
|
var clientInstance = null;
|
|
33
32
|
function getClient() {
|
|
@@ -125,125 +124,6 @@ function handleError(error, json = false) {
|
|
|
125
124
|
process.exit(1);
|
|
126
125
|
}
|
|
127
126
|
|
|
128
|
-
// src/commands/auth.ts
|
|
129
|
-
function createAuthCommand() {
|
|
130
|
-
const auth = new Command("auth").description("Authentication commands");
|
|
131
|
-
auth.command("login").description("Configure CLI with your API token").requiredOption("--token <token>", "JWT token from /settings/api-keys").requiredOption("--api-url <url>", "API URL (e.g., https://www.exponential.im)").action(async (options) => {
|
|
132
|
-
try {
|
|
133
|
-
let apiUrl = options.apiUrl.replace(/\/+$/, "");
|
|
134
|
-
if (!apiUrl.startsWith("http://localhost") && !apiUrl.startsWith("https://")) {
|
|
135
|
-
apiUrl = `https://${apiUrl}`;
|
|
136
|
-
}
|
|
137
|
-
setConfig({
|
|
138
|
-
token: options.token,
|
|
139
|
-
apiUrl
|
|
140
|
-
});
|
|
141
|
-
resetClient();
|
|
142
|
-
console.log(chalk2.gray("Validating token..."));
|
|
143
|
-
const client = getClient();
|
|
144
|
-
await client.workspaces.list();
|
|
145
|
-
console.log(chalk2.green("Successfully authenticated!"));
|
|
146
|
-
console.log(chalk2.gray(`Config saved to: ${getConfigPath()}`));
|
|
147
|
-
} catch (error) {
|
|
148
|
-
clearConfig();
|
|
149
|
-
handleError(error);
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
auth.command("logout").description("Remove stored credentials").action(() => {
|
|
153
|
-
clearConfig();
|
|
154
|
-
resetClient();
|
|
155
|
-
console.log(chalk2.green("Successfully logged out."));
|
|
156
|
-
console.log(chalk2.gray(`Config cleared from: ${getConfigPath()}`));
|
|
157
|
-
});
|
|
158
|
-
auth.command("whoami").description("Show which account the stored token signs in as, and whether it is an agent").option("--json", "Output as JSON").action(async (options) => {
|
|
159
|
-
if (!isAuthenticated()) {
|
|
160
|
-
if (options.json) {
|
|
161
|
-
console.log(JSON.stringify({ error: { code: "UNAUTHENTICATED", message: "Not authenticated" } }, null, 2));
|
|
162
|
-
} else {
|
|
163
|
-
console.log(chalk2.yellow("Not authenticated."));
|
|
164
|
-
console.log(chalk2.gray("Run: exponential auth login --token <jwt> --api-url <url>"));
|
|
165
|
-
}
|
|
166
|
-
process.exit(1);
|
|
167
|
-
}
|
|
168
|
-
try {
|
|
169
|
-
const config = getConfig();
|
|
170
|
-
const client = getClient();
|
|
171
|
-
const [me, workspaces] = await Promise.all([
|
|
172
|
-
client.users.me(),
|
|
173
|
-
client.workspaces.list()
|
|
174
|
-
]);
|
|
175
|
-
const workspaceCount = workspaces.length;
|
|
176
|
-
if (options.json) {
|
|
177
|
-
console.log(JSON.stringify({
|
|
178
|
-
id: me.id,
|
|
179
|
-
name: me.name,
|
|
180
|
-
email: me.email,
|
|
181
|
-
isAgent: me.isAgent,
|
|
182
|
-
agent: me.agent,
|
|
183
|
-
apiUrl: config.apiUrl,
|
|
184
|
-
workspaces: workspaceCount,
|
|
185
|
-
configPath: getConfigPath()
|
|
186
|
-
}, null, 2));
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
console.log(chalk2.green("Authenticated"));
|
|
190
|
-
console.log(`Account: ${chalk2.bold(me.name ?? "(unnamed)")} ${chalk2.gray(`(${me.id})`)}`);
|
|
191
|
-
if (me.email) {
|
|
192
|
-
console.log(chalk2.gray(`Email: ${me.email}`));
|
|
193
|
-
}
|
|
194
|
-
if (me.isAgent) {
|
|
195
|
-
const owner = me.agent?.owner.name ?? me.agent?.owner.id ?? "unknown";
|
|
196
|
-
console.log(`Type: ${chalk2.cyan("External agent")} ${chalk2.gray(`owned by ${owner}`)}`);
|
|
197
|
-
console.log(chalk2.gray("To give this agent a restricted project, add this account on the project's Members tab."));
|
|
198
|
-
} else {
|
|
199
|
-
console.log(`Type: ${chalk2.cyan("Person")}`);
|
|
200
|
-
}
|
|
201
|
-
console.log(chalk2.gray(`API URL: ${config.apiUrl}`));
|
|
202
|
-
console.log(chalk2.gray(`Workspaces: ${workspaceCount}`));
|
|
203
|
-
console.log(chalk2.gray(`Config: ${getConfigPath()}`));
|
|
204
|
-
} catch (error) {
|
|
205
|
-
handleError(error, options.json);
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
auth.command("show").description(
|
|
209
|
-
"Print parts of the current credentials. Use --token to print the raw JWT (for piping into other tools, e.g. `gh secret set EXPONENTIAL_TOKEN < <(exponential auth show --token)`)."
|
|
210
|
-
).option("--token", "Print the raw JWT to stdout with no trailing newline").action((options) => {
|
|
211
|
-
const config = getConfig();
|
|
212
|
-
if (options.token) {
|
|
213
|
-
if (!config.token) {
|
|
214
|
-
console.error("Not authenticated. Run `exponential auth login` first.");
|
|
215
|
-
process.exit(1);
|
|
216
|
-
}
|
|
217
|
-
process.stdout.write(config.token);
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
console.log(chalk2.bold("\nCredentials"));
|
|
221
|
-
console.log(chalk2.gray("\u2500".repeat(40)));
|
|
222
|
-
console.log(`API URL: ${config.apiUrl || chalk2.gray("(not set)")}`);
|
|
223
|
-
console.log(
|
|
224
|
-
`Token: ${config.token ? chalk2.gray(`${config.token.substring(0, 20)}...`) : chalk2.gray("(not set)")}`
|
|
225
|
-
);
|
|
226
|
-
console.log(
|
|
227
|
-
chalk2.gray("Use `exponential auth show --token` to print the raw JWT.")
|
|
228
|
-
);
|
|
229
|
-
console.log();
|
|
230
|
-
});
|
|
231
|
-
auth.command("status").description("Show detailed authentication status").action(() => {
|
|
232
|
-
const config = getConfig();
|
|
233
|
-
console.log(chalk2.bold("\nAuthentication Status"));
|
|
234
|
-
console.log(chalk2.gray("\u2500".repeat(40)));
|
|
235
|
-
console.log(`Authenticated: ${isAuthenticated() ? chalk2.green("Yes") : chalk2.red("No")}`);
|
|
236
|
-
console.log(`API URL: ${config.apiUrl || chalk2.gray("(not set)")}`);
|
|
237
|
-
console.log(`Token: ${config.token ? chalk2.gray(`${config.token.substring(0, 20)}...`) : chalk2.gray("(not set)")}`);
|
|
238
|
-
console.log(`Config Path: ${getConfigPath()}`);
|
|
239
|
-
console.log();
|
|
240
|
-
});
|
|
241
|
-
return auth;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// src/commands/actions.ts
|
|
245
|
-
import { Command as Command2 } from "commander";
|
|
246
|
-
|
|
247
127
|
// src/utils/resolve.ts
|
|
248
128
|
async function resolveWorkspaceId(client, slugOrId) {
|
|
249
129
|
return (await resolveWorkspace(client, slugOrId)).id;
|
|
@@ -272,7 +152,7 @@ async function resolveProductId(client, workspaceId, slugOrId) {
|
|
|
272
152
|
}
|
|
273
153
|
|
|
274
154
|
// src/utils/output.ts
|
|
275
|
-
import
|
|
155
|
+
import chalk2 from "chalk";
|
|
276
156
|
function shouldUseJson(forceJson, forcePretty) {
|
|
277
157
|
if (forceJson) return true;
|
|
278
158
|
if (forcePretty) return false;
|
|
@@ -340,21 +220,21 @@ function outputActionUpsertJson(result) {
|
|
|
340
220
|
}
|
|
341
221
|
function outputActionPretty(action) {
|
|
342
222
|
const statusColor = getKanbanStatusColor(action.kanbanStatus);
|
|
343
|
-
const statusBadge2 = action.kanbanStatus ?
|
|
344
|
-
console.log(
|
|
223
|
+
const statusBadge2 = action.kanbanStatus ? chalk2[statusColor](`[${action.kanbanStatus}]`) : chalk2.gray("[NO STATUS]");
|
|
224
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
345
225
|
console.log(`
|
|
346
|
-
${statusBadge2} ${
|
|
347
|
-
console.log(
|
|
226
|
+
${statusBadge2} ${chalk2.bold(action.name)}`);
|
|
227
|
+
console.log(chalk2.gray(` ID: ${action.id}`));
|
|
348
228
|
if (action.project) {
|
|
349
|
-
console.log(` ${
|
|
229
|
+
console.log(` ${chalk2.cyan("Project:")} ${action.project.name}`);
|
|
350
230
|
}
|
|
351
|
-
console.log(` ${
|
|
231
|
+
console.log(` ${chalk2.magenta("Priority:")} ${action.priority}`);
|
|
352
232
|
if (action.dueDate) {
|
|
353
233
|
const dueDate = new Date(action.dueDate);
|
|
354
|
-
console.log(` ${
|
|
234
|
+
console.log(` ${chalk2.yellow("Due:")} ${formatDate(dueDate)}`);
|
|
355
235
|
}
|
|
356
236
|
if (action.description) {
|
|
357
|
-
console.log(` ${
|
|
237
|
+
console.log(` ${chalk2.gray("Description:")} ${action.description.substring(0, 100)}${action.description.length > 100 ? "..." : ""}`);
|
|
358
238
|
}
|
|
359
239
|
console.log();
|
|
360
240
|
}
|
|
@@ -368,30 +248,30 @@ function outputActionsJson(actions, filters = {}) {
|
|
|
368
248
|
}
|
|
369
249
|
function outputActionsPretty(actions) {
|
|
370
250
|
if (actions.length === 0) {
|
|
371
|
-
console.log(
|
|
251
|
+
console.log(chalk2.gray("No actions found."));
|
|
372
252
|
return;
|
|
373
253
|
}
|
|
374
|
-
console.log(
|
|
254
|
+
console.log(chalk2.bold(`
|
|
375
255
|
Actions (${actions.length} total)`));
|
|
376
|
-
console.log(
|
|
256
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
377
257
|
for (const action of actions) {
|
|
378
258
|
const statusColor = getKanbanStatusColor(action.kanbanStatus);
|
|
379
|
-
const statusBadge2 = action.kanbanStatus ?
|
|
259
|
+
const statusBadge2 = action.kanbanStatus ? chalk2[statusColor](`[${action.kanbanStatus}]`) : chalk2.gray("[NO STATUS]");
|
|
380
260
|
console.log(`
|
|
381
|
-
${statusBadge2} ${
|
|
382
|
-
console.log(
|
|
261
|
+
${statusBadge2} ${chalk2.bold(action.name)}`);
|
|
262
|
+
console.log(chalk2.gray(` ID: ${action.id}`));
|
|
383
263
|
if (action.project) {
|
|
384
|
-
console.log(` ${
|
|
264
|
+
console.log(` ${chalk2.cyan("Project:")} ${action.project.name}`);
|
|
385
265
|
}
|
|
386
|
-
console.log(` ${
|
|
266
|
+
console.log(` ${chalk2.magenta("Priority:")} ${action.priority}`);
|
|
387
267
|
if (action.dueDate) {
|
|
388
268
|
const dueDate = new Date(action.dueDate);
|
|
389
269
|
const isOverdue = dueDate < /* @__PURE__ */ new Date();
|
|
390
270
|
const dateStr = formatDate(dueDate);
|
|
391
|
-
console.log(` ${
|
|
271
|
+
console.log(` ${chalk2.yellow("Due:")} ${isOverdue ? chalk2.red(dateStr) : dateStr}`);
|
|
392
272
|
}
|
|
393
273
|
if (action.description) {
|
|
394
|
-
console.log(` ${
|
|
274
|
+
console.log(` ${chalk2.gray("Description:")} ${action.description.substring(0, 100)}${action.description.length > 100 ? "..." : ""}`);
|
|
395
275
|
}
|
|
396
276
|
}
|
|
397
277
|
console.log();
|
|
@@ -407,30 +287,30 @@ function outputTodaysActionsJson(t, filters = {}) {
|
|
|
407
287
|
}
|
|
408
288
|
function printTodayGroup(label, group, color) {
|
|
409
289
|
if (group.count === 0) return;
|
|
410
|
-
const truncated = group.count > group.actions.length ?
|
|
290
|
+
const truncated = group.count > group.actions.length ? chalk2.gray(` (showing ${group.actions.length})`) : "";
|
|
411
291
|
console.log(`
|
|
412
|
-
${
|
|
292
|
+
${chalk2[color].bold(`${label} (${group.count})`)}${truncated}`);
|
|
413
293
|
for (const a of group.actions) {
|
|
414
294
|
const when = a.scheduledStart ?? a.dueDate;
|
|
415
|
-
const stamp = when ?
|
|
416
|
-
const project = a.projectName ?
|
|
295
|
+
const stamp = when ? chalk2.gray(formatDate(new Date(when))) : "";
|
|
296
|
+
const project = a.projectName ? chalk2.cyan(` [${a.projectName}]`) : "";
|
|
417
297
|
console.log(` ${a.name}${project} ${stamp}`);
|
|
418
|
-
console.log(
|
|
298
|
+
console.log(chalk2.gray(` ID: ${a.id}`));
|
|
419
299
|
}
|
|
420
300
|
}
|
|
421
301
|
function outputTodaysActionsPretty(t) {
|
|
422
302
|
const total = t.overdue.count + t.today.count + t.inbox.count;
|
|
423
303
|
if (total === 0) {
|
|
424
|
-
console.log(
|
|
304
|
+
console.log(chalk2.gray("Nothing on your plate."));
|
|
425
305
|
return;
|
|
426
306
|
}
|
|
427
|
-
console.log(
|
|
428
|
-
console.log(
|
|
307
|
+
console.log(chalk2.bold("\nOn your plate"));
|
|
308
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
429
309
|
printTodayGroup("Overdue", t.overdue, "red");
|
|
430
310
|
printTodayGroup("Today", t.today, "green");
|
|
431
311
|
printTodayGroup("Inbox", t.inbox, "gray");
|
|
432
312
|
if (t.overdue.count > 0) {
|
|
433
|
-
console.log(
|
|
313
|
+
console.log(chalk2.gray(`
|
|
434
314
|
Run "exponential actions overdue" to see why the overdue pile is that size.`));
|
|
435
315
|
}
|
|
436
316
|
console.log();
|
|
@@ -440,43 +320,43 @@ function outputOverdueTriageJson(t) {
|
|
|
440
320
|
}
|
|
441
321
|
function outputOverdueTriagePretty(t) {
|
|
442
322
|
if (t.totalOverdue === 0) {
|
|
443
|
-
console.log(
|
|
323
|
+
console.log(chalk2.green("Nothing overdue."));
|
|
444
324
|
return;
|
|
445
325
|
}
|
|
446
|
-
console.log(
|
|
326
|
+
console.log(chalk2.bold(`
|
|
447
327
|
Overdue: ${t.totalOverdue}`));
|
|
448
|
-
console.log(
|
|
328
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
449
329
|
if (t.cohorts.length > 0) {
|
|
450
330
|
console.log(
|
|
451
331
|
`
|
|
452
|
-
${
|
|
332
|
+
${chalk2.yellow.bold(`${t.cohortCount} of these were bulk-created`)} ${chalk2.gray("\u2014 stamped with one identical timestamp, so almost certainly never individually due.")}`
|
|
453
333
|
);
|
|
454
334
|
for (const c of t.cohorts) {
|
|
455
335
|
console.log(
|
|
456
336
|
`
|
|
457
|
-
${
|
|
337
|
+
${chalk2.bold(`${c.count} actions`)} stamped ${chalk2.gray(c.stampedAt.toISOString())} ${chalk2.red(`(${c.daysOverdue}d overdue)`)}`
|
|
458
338
|
);
|
|
459
339
|
if (c.projectNames.length > 0) {
|
|
460
|
-
console.log(` ${
|
|
340
|
+
console.log(` ${chalk2.cyan("Projects:")} ${c.projectNames.join(", ")}`);
|
|
461
341
|
}
|
|
462
342
|
for (const a of c.actions.slice(0, 4)) {
|
|
463
|
-
console.log(
|
|
343
|
+
console.log(chalk2.gray(` \xB7 ${a.name.substring(0, 62)}`));
|
|
464
344
|
}
|
|
465
345
|
if (c.actions.length > 4) {
|
|
466
|
-
console.log(
|
|
346
|
+
console.log(chalk2.gray(` \xB7 \u2026 and ${c.actions.length - 4} more`));
|
|
467
347
|
}
|
|
468
348
|
console.log(
|
|
469
|
-
|
|
349
|
+
chalk2.gray(` Amnesty: `) + `exponential actions defer --ids ${c.actionIds.slice(0, 2).join(",")}${c.actionIds.length > 2 ? ",\u2026" : ""}`
|
|
470
350
|
);
|
|
471
351
|
}
|
|
472
352
|
}
|
|
473
353
|
if (t.loose.length > 0) {
|
|
474
354
|
console.log(`
|
|
475
|
-
${
|
|
355
|
+
${chalk2.bold(`${t.loose.length} individually dated`)} ${chalk2.gray("\u2014 real debt, oldest first.")}`);
|
|
476
356
|
for (const a of t.loose) {
|
|
477
|
-
const project = a.projectName ?
|
|
478
|
-
console.log(` ${
|
|
479
|
-
console.log(
|
|
357
|
+
const project = a.projectName ? chalk2.cyan(` [${a.projectName}]`) : "";
|
|
358
|
+
console.log(` ${chalk2.red(`${String(a.daysOverdue).padStart(3)}d`)} ${a.name.substring(0, 62)}${project}`);
|
|
359
|
+
console.log(chalk2.gray(` ID: ${a.id}`));
|
|
480
360
|
}
|
|
481
361
|
}
|
|
482
362
|
console.log();
|
|
@@ -490,27 +370,27 @@ function outputProjectsJson(projects) {
|
|
|
490
370
|
}
|
|
491
371
|
function outputProjectsPretty(projects) {
|
|
492
372
|
if (projects.length === 0) {
|
|
493
|
-
console.log(
|
|
373
|
+
console.log(chalk2.gray("No projects found."));
|
|
494
374
|
return;
|
|
495
375
|
}
|
|
496
|
-
console.log(
|
|
376
|
+
console.log(chalk2.bold(`
|
|
497
377
|
Projects (${projects.length} total)`));
|
|
498
|
-
console.log(
|
|
378
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
499
379
|
for (const project of projects) {
|
|
500
380
|
console.log(`
|
|
501
|
-
${
|
|
502
|
-
console.log(
|
|
381
|
+
${chalk2.bold(project.name)}`);
|
|
382
|
+
console.log(chalk2.gray(` ID: ${project.id}`));
|
|
503
383
|
if (project.status) {
|
|
504
|
-
console.log(` ${
|
|
384
|
+
console.log(` ${chalk2.cyan("Status:")} ${project.status}`);
|
|
505
385
|
}
|
|
506
386
|
if (project.priority) {
|
|
507
|
-
console.log(` ${
|
|
387
|
+
console.log(` ${chalk2.magenta("Priority:")} ${project.priority}`);
|
|
508
388
|
}
|
|
509
389
|
if (project.workspace) {
|
|
510
|
-
console.log(` ${
|
|
390
|
+
console.log(` ${chalk2.yellow("Workspace:")} ${project.workspace.name} (${project.workspace.slug})`);
|
|
511
391
|
}
|
|
512
392
|
if (project.description) {
|
|
513
|
-
console.log(` ${
|
|
393
|
+
console.log(` ${chalk2.gray("Description:")} ${project.description.substring(0, 100)}${project.description.length > 100 ? "..." : ""}`);
|
|
514
394
|
}
|
|
515
395
|
}
|
|
516
396
|
console.log();
|
|
@@ -524,18 +404,18 @@ function outputWorkspacesJson(workspaces) {
|
|
|
524
404
|
}
|
|
525
405
|
function outputWorkspacesPretty(workspaces) {
|
|
526
406
|
if (workspaces.length === 0) {
|
|
527
|
-
console.log(
|
|
407
|
+
console.log(chalk2.gray("No workspaces found."));
|
|
528
408
|
return;
|
|
529
409
|
}
|
|
530
|
-
console.log(
|
|
410
|
+
console.log(chalk2.bold(`
|
|
531
411
|
Workspaces (${workspaces.length} total)`));
|
|
532
|
-
console.log(
|
|
412
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
533
413
|
for (const workspace of workspaces) {
|
|
534
414
|
console.log(`
|
|
535
|
-
${
|
|
536
|
-
console.log(
|
|
537
|
-
console.log(` ${
|
|
538
|
-
console.log(` ${
|
|
415
|
+
${chalk2.bold(workspace.name)}`);
|
|
416
|
+
console.log(chalk2.gray(` ID: ${workspace.id}`));
|
|
417
|
+
console.log(` ${chalk2.cyan("Slug:")} ${workspace.slug}`);
|
|
418
|
+
console.log(` ${chalk2.magenta("Type:")} ${workspace.type}`);
|
|
539
419
|
}
|
|
540
420
|
console.log();
|
|
541
421
|
}
|
|
@@ -568,25 +448,25 @@ function outputContactJson(contact) {
|
|
|
568
448
|
console.log(JSON.stringify(transformContact(contact), null, 2));
|
|
569
449
|
}
|
|
570
450
|
function outputContactPretty(contact) {
|
|
571
|
-
const name = [contact.firstName, contact.lastName].filter(Boolean).join(" ") ||
|
|
572
|
-
console.log(
|
|
451
|
+
const name = [contact.firstName, contact.lastName].filter(Boolean).join(" ") || chalk2.gray("(no name)");
|
|
452
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
573
453
|
console.log(`
|
|
574
|
-
${
|
|
575
|
-
console.log(
|
|
576
|
-
if (contact.email) console.log(` ${
|
|
577
|
-
if (contact.phone) console.log(` ${
|
|
578
|
-
if (contact.telegram) console.log(` ${
|
|
579
|
-
if (contact.linkedIn) console.log(` ${
|
|
580
|
-
if (contact.twitter) console.log(` ${
|
|
581
|
-
if (contact.github) console.log(` ${
|
|
582
|
-
if (contact.bluesky) console.log(` ${
|
|
583
|
-
if (contact.about) console.log(` ${
|
|
584
|
-
if (contact.profileType) console.log(` ${
|
|
585
|
-
if (contact.skills?.length) console.log(` ${
|
|
586
|
-
if (contact.tags?.length) console.log(` ${
|
|
587
|
-
if (contact.organization) console.log(` ${
|
|
588
|
-
if (contact.connectionScore != null) console.log(` ${
|
|
589
|
-
if (contact.lastInteractionAt) console.log(` ${
|
|
454
|
+
${chalk2.bold(name)}`);
|
|
455
|
+
console.log(chalk2.gray(` ID: ${contact.id}`));
|
|
456
|
+
if (contact.email) console.log(` ${chalk2.cyan("Email:")} ${contact.email}`);
|
|
457
|
+
if (contact.phone) console.log(` ${chalk2.cyan("Phone:")} ${contact.phone}`);
|
|
458
|
+
if (contact.telegram) console.log(` ${chalk2.cyan("Telegram:")} ${contact.telegram}`);
|
|
459
|
+
if (contact.linkedIn) console.log(` ${chalk2.cyan("LinkedIn:")} ${contact.linkedIn}`);
|
|
460
|
+
if (contact.twitter) console.log(` ${chalk2.cyan("Twitter:")} ${contact.twitter}`);
|
|
461
|
+
if (contact.github) console.log(` ${chalk2.cyan("GitHub:")} ${contact.github}`);
|
|
462
|
+
if (contact.bluesky) console.log(` ${chalk2.cyan("Bluesky:")} ${contact.bluesky}`);
|
|
463
|
+
if (contact.about) console.log(` ${chalk2.gray("About:")} ${contact.about.substring(0, 120)}${contact.about.length > 120 ? "..." : ""}`);
|
|
464
|
+
if (contact.profileType) console.log(` ${chalk2.magenta("Type:")} ${contact.profileType}`);
|
|
465
|
+
if (contact.skills?.length) console.log(` ${chalk2.yellow("Skills:")} ${contact.skills.join(", ")}`);
|
|
466
|
+
if (contact.tags?.length) console.log(` ${chalk2.yellow("Tags:")} ${contact.tags.join(", ")}`);
|
|
467
|
+
if (contact.organization) console.log(` ${chalk2.green("Org:")} ${contact.organization.name}`);
|
|
468
|
+
if (contact.connectionScore != null) console.log(` ${chalk2.blue("Connection Score:")} ${contact.connectionScore}`);
|
|
469
|
+
if (contact.lastInteractionAt) console.log(` ${chalk2.gray("Last Interaction:")} ${formatDate(new Date(contact.lastInteractionAt))} (${contact.lastInteractionType ?? ""})`);
|
|
590
470
|
console.log();
|
|
591
471
|
}
|
|
592
472
|
function outputContactsJson(contacts, nextCursor) {
|
|
@@ -598,20 +478,20 @@ function outputContactsJson(contacts, nextCursor) {
|
|
|
598
478
|
}
|
|
599
479
|
function outputContactsPretty(contacts) {
|
|
600
480
|
if (contacts.length === 0) {
|
|
601
|
-
console.log(
|
|
481
|
+
console.log(chalk2.gray("No contacts found."));
|
|
602
482
|
return;
|
|
603
483
|
}
|
|
604
|
-
console.log(
|
|
484
|
+
console.log(chalk2.bold(`
|
|
605
485
|
Contacts (${contacts.length} total)`));
|
|
606
|
-
console.log(
|
|
486
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
607
487
|
for (const contact of contacts) {
|
|
608
|
-
const name = [contact.firstName, contact.lastName].filter(Boolean).join(" ") ||
|
|
488
|
+
const name = [contact.firstName, contact.lastName].filter(Boolean).join(" ") || chalk2.gray("(no name)");
|
|
609
489
|
console.log(`
|
|
610
|
-
${
|
|
611
|
-
console.log(
|
|
612
|
-
if (contact.email) console.log(` ${
|
|
613
|
-
if (contact.organization) console.log(` ${
|
|
614
|
-
if (contact.tags?.length) console.log(` ${
|
|
490
|
+
${chalk2.bold(name)}`);
|
|
491
|
+
console.log(chalk2.gray(` ID: ${contact.id}`));
|
|
492
|
+
if (contact.email) console.log(` ${chalk2.cyan("Email:")} ${contact.email}`);
|
|
493
|
+
if (contact.organization) console.log(` ${chalk2.green("Org:")} ${contact.organization.name}`);
|
|
494
|
+
if (contact.tags?.length) console.log(` ${chalk2.yellow("Tags:")} ${contact.tags.join(", ")}`);
|
|
615
495
|
}
|
|
616
496
|
console.log();
|
|
617
497
|
}
|
|
@@ -645,10 +525,10 @@ function outputInteractionJson(interaction) {
|
|
|
645
525
|
console.log(JSON.stringify(interaction, null, 2));
|
|
646
526
|
}
|
|
647
527
|
function outputInteractionPretty(interaction) {
|
|
648
|
-
console.log(
|
|
649
|
-
console.log(` ${
|
|
650
|
-
if (interaction.subject) console.log(` ${
|
|
651
|
-
if (interaction.notes) console.log(` ${
|
|
528
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
529
|
+
console.log(` ${chalk2.cyan("Type:")} ${interaction.type} (${interaction.direction})`);
|
|
530
|
+
if (interaction.subject) console.log(` ${chalk2.bold("Subject:")} ${interaction.subject}`);
|
|
531
|
+
if (interaction.notes) console.log(` ${chalk2.gray("Notes:")} ${interaction.notes}`);
|
|
652
532
|
console.log();
|
|
653
533
|
}
|
|
654
534
|
function transformOrganization(org) {
|
|
@@ -670,15 +550,15 @@ function outputOrganizationJson(org) {
|
|
|
670
550
|
console.log(JSON.stringify(transformOrganization(org), null, 2));
|
|
671
551
|
}
|
|
672
552
|
function outputOrganizationPretty(org) {
|
|
673
|
-
console.log(
|
|
553
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
674
554
|
console.log(`
|
|
675
|
-
${
|
|
676
|
-
console.log(
|
|
677
|
-
if (org.industry) console.log(` ${
|
|
678
|
-
if (org.size) console.log(` ${
|
|
679
|
-
if (org.websiteUrl) console.log(` ${
|
|
680
|
-
if (org.description) console.log(` ${
|
|
681
|
-
if (org._count?.contacts != null) console.log(` ${
|
|
555
|
+
${chalk2.bold(org.name)}`);
|
|
556
|
+
console.log(chalk2.gray(` ID: ${org.id}`));
|
|
557
|
+
if (org.industry) console.log(` ${chalk2.magenta("Industry:")} ${org.industry}`);
|
|
558
|
+
if (org.size) console.log(` ${chalk2.cyan("Size:")} ${org.size}`);
|
|
559
|
+
if (org.websiteUrl) console.log(` ${chalk2.cyan("Website:")} ${org.websiteUrl}`);
|
|
560
|
+
if (org.description) console.log(` ${chalk2.gray("About:")} ${org.description.substring(0, 120)}${org.description.length > 120 ? "..." : ""}`);
|
|
561
|
+
if (org._count?.contacts != null) console.log(` ${chalk2.green("Contacts:")} ${org._count.contacts}`);
|
|
682
562
|
console.log();
|
|
683
563
|
}
|
|
684
564
|
function outputOrganizationsJson(organizations, nextCursor) {
|
|
@@ -690,18 +570,18 @@ function outputOrganizationsJson(organizations, nextCursor) {
|
|
|
690
570
|
}
|
|
691
571
|
function outputOrganizationsPretty(organizations) {
|
|
692
572
|
if (organizations.length === 0) {
|
|
693
|
-
console.log(
|
|
573
|
+
console.log(chalk2.gray("No organizations found."));
|
|
694
574
|
return;
|
|
695
575
|
}
|
|
696
|
-
console.log(
|
|
576
|
+
console.log(chalk2.bold(`
|
|
697
577
|
Organizations (${organizations.length} total)`));
|
|
698
|
-
console.log(
|
|
578
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
699
579
|
for (const org of organizations) {
|
|
700
580
|
console.log(`
|
|
701
|
-
${
|
|
702
|
-
console.log(
|
|
703
|
-
if (org.industry) console.log(` ${
|
|
704
|
-
if (org._count?.contacts != null) console.log(` ${
|
|
581
|
+
${chalk2.bold(org.name)}`);
|
|
582
|
+
console.log(chalk2.gray(` ID: ${org.id}`));
|
|
583
|
+
if (org.industry) console.log(` ${chalk2.magenta("Industry:")} ${org.industry}`);
|
|
584
|
+
if (org._count?.contacts != null) console.log(` ${chalk2.green("Contacts:")} ${org._count.contacts}`);
|
|
705
585
|
}
|
|
706
586
|
console.log();
|
|
707
587
|
}
|
|
@@ -709,21 +589,21 @@ function outputDealJson(deal) {
|
|
|
709
589
|
console.log(JSON.stringify(transformDeal(deal), null, 2));
|
|
710
590
|
}
|
|
711
591
|
function outputDealPretty(deal) {
|
|
712
|
-
console.log(
|
|
592
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
713
593
|
console.log(`
|
|
714
|
-
${
|
|
715
|
-
console.log(
|
|
716
|
-
if (deal.stage) console.log(` ${
|
|
717
|
-
if (deal.value != null) console.log(` ${
|
|
718
|
-
if (deal.probability != null) console.log(` ${
|
|
719
|
-
if (deal.expectedCloseDate) console.log(` ${
|
|
594
|
+
${chalk2.bold(deal.title)}`);
|
|
595
|
+
console.log(chalk2.gray(` ID: ${deal.id}`));
|
|
596
|
+
if (deal.stage) console.log(` ${chalk2.blue("Stage:")} ${deal.stage.name}`);
|
|
597
|
+
if (deal.value != null) console.log(` ${chalk2.green("Value:")} ${deal.currency} ${deal.value.toLocaleString()}`);
|
|
598
|
+
if (deal.probability != null) console.log(` ${chalk2.yellow("Probability:")} ${deal.probability}%`);
|
|
599
|
+
if (deal.expectedCloseDate) console.log(` ${chalk2.cyan("Expected Close:")} ${formatDate(new Date(deal.expectedCloseDate))}`);
|
|
720
600
|
if (deal.contact) {
|
|
721
601
|
const name = [deal.contact.firstName, deal.contact.lastName].filter(Boolean).join(" ");
|
|
722
|
-
if (name) console.log(` ${
|
|
602
|
+
if (name) console.log(` ${chalk2.magenta("Contact:")} ${name}`);
|
|
723
603
|
}
|
|
724
|
-
if (deal.organization) console.log(` ${
|
|
725
|
-
if (deal.assignedTo) console.log(` ${
|
|
726
|
-
if (deal.description) console.log(` ${
|
|
604
|
+
if (deal.organization) console.log(` ${chalk2.magenta("Org:")} ${deal.organization.name}`);
|
|
605
|
+
if (deal.assignedTo) console.log(` ${chalk2.gray("Assigned:")} ${deal.assignedTo.name ?? deal.assignedTo.email ?? deal.assignedTo.id}`);
|
|
606
|
+
if (deal.description) console.log(` ${chalk2.gray("Description:")} ${deal.description.substring(0, 120)}${deal.description.length > 120 ? "..." : ""}`);
|
|
727
607
|
console.log();
|
|
728
608
|
}
|
|
729
609
|
function outputDealsJson(deals) {
|
|
@@ -734,24 +614,24 @@ function outputDealsJson(deals) {
|
|
|
734
614
|
}
|
|
735
615
|
function outputDealsPretty(deals) {
|
|
736
616
|
if (deals.length === 0) {
|
|
737
|
-
console.log(
|
|
617
|
+
console.log(chalk2.gray("No deals found."));
|
|
738
618
|
return;
|
|
739
619
|
}
|
|
740
|
-
console.log(
|
|
620
|
+
console.log(chalk2.bold(`
|
|
741
621
|
Deals (${deals.length} total)`));
|
|
742
|
-
console.log(
|
|
622
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
743
623
|
for (const deal of deals) {
|
|
744
|
-
const stageLabel = deal.stage ?
|
|
745
|
-
const valueLabel = deal.value != null ?
|
|
624
|
+
const stageLabel = deal.stage ? chalk2.blue(`[${deal.stage.name}]`) : "";
|
|
625
|
+
const valueLabel = deal.value != null ? chalk2.green(` ${deal.currency} ${deal.value.toLocaleString()}`) : "";
|
|
746
626
|
console.log(`
|
|
747
|
-
${stageLabel} ${
|
|
748
|
-
console.log(
|
|
627
|
+
${stageLabel} ${chalk2.bold(deal.title)}${valueLabel}`);
|
|
628
|
+
console.log(chalk2.gray(` ID: ${deal.id}`));
|
|
749
629
|
if (deal.contact) {
|
|
750
630
|
const name = [deal.contact.firstName, deal.contact.lastName].filter(Boolean).join(" ");
|
|
751
|
-
if (name) console.log(` ${
|
|
631
|
+
if (name) console.log(` ${chalk2.magenta("Contact:")} ${name}`);
|
|
752
632
|
}
|
|
753
|
-
if (deal.probability != null) console.log(` ${
|
|
754
|
-
if (deal.expectedCloseDate) console.log(` ${
|
|
633
|
+
if (deal.probability != null) console.log(` ${chalk2.yellow("Probability:")} ${deal.probability}%`);
|
|
634
|
+
if (deal.expectedCloseDate) console.log(` ${chalk2.cyan("Close:")} ${formatDate(new Date(deal.expectedCloseDate))}`);
|
|
755
635
|
}
|
|
756
636
|
console.log();
|
|
757
637
|
}
|
|
@@ -796,13 +676,13 @@ function outputPipelineJson(pipeline) {
|
|
|
796
676
|
}, null, 2));
|
|
797
677
|
}
|
|
798
678
|
function outputPipelinePretty(pipeline) {
|
|
799
|
-
console.log(
|
|
679
|
+
console.log(chalk2.bold(`
|
|
800
680
|
Pipeline: ${pipeline.name}`));
|
|
801
|
-
console.log(
|
|
802
|
-
console.log(
|
|
681
|
+
console.log(chalk2.gray(` ID: ${pipeline.id}`));
|
|
682
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
803
683
|
for (const stage of pipeline.pipelineStages) {
|
|
804
|
-
const count = stage._count?.deals != null ?
|
|
805
|
-
console.log(` ${
|
|
684
|
+
const count = stage._count?.deals != null ? chalk2.gray(` (${stage._count.deals} deals)`) : "";
|
|
685
|
+
console.log(` ${chalk2.bold(stage.name)}${count} \u2014 ${chalk2.gray(stage.type)}`);
|
|
806
686
|
}
|
|
807
687
|
console.log();
|
|
808
688
|
}
|
|
@@ -864,12 +744,12 @@ function outputCommentPretty(comment) {
|
|
|
864
744
|
const author = n.author?.name ?? n.authorId;
|
|
865
745
|
const when = formatDate(n.createdAt);
|
|
866
746
|
const badges = [
|
|
867
|
-
n.parentCommentId && n.parentKey !== "parentId" ?
|
|
868
|
-
n.resolvedAt ?
|
|
747
|
+
n.parentCommentId && n.parentKey !== "parentId" ? chalk2.gray("(reply)") : "",
|
|
748
|
+
n.resolvedAt ? chalk2.green("(resolved)") : ""
|
|
869
749
|
].filter(Boolean).join(" ");
|
|
870
|
-
console.log(
|
|
871
|
-
console.log(`${
|
|
872
|
-
console.log(
|
|
750
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
751
|
+
console.log(`${chalk2.bold(author)} ${chalk2.gray(`\u2014 ${when}`)}${badges ? ` ${badges}` : ""}`);
|
|
752
|
+
console.log(chalk2.gray(` ID: ${n.id}`));
|
|
873
753
|
console.log();
|
|
874
754
|
console.log(n.content);
|
|
875
755
|
console.log();
|
|
@@ -882,10 +762,10 @@ function outputCommentsJson(comments) {
|
|
|
882
762
|
}
|
|
883
763
|
function outputCommentsPretty(comments) {
|
|
884
764
|
if (comments.length === 0) {
|
|
885
|
-
console.log(
|
|
765
|
+
console.log(chalk2.gray("No comments."));
|
|
886
766
|
return;
|
|
887
767
|
}
|
|
888
|
-
console.log(
|
|
768
|
+
console.log(chalk2.bold(`
|
|
889
769
|
Comments (${comments.length})`));
|
|
890
770
|
for (const c of comments) {
|
|
891
771
|
outputCommentPretty(c);
|
|
@@ -895,12 +775,12 @@ function outputProductJson(product) {
|
|
|
895
775
|
console.log(JSON.stringify(transformProduct(product), null, 2));
|
|
896
776
|
}
|
|
897
777
|
function outputProductPretty(product) {
|
|
898
|
-
console.log(
|
|
778
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
899
779
|
console.log(`
|
|
900
|
-
${
|
|
901
|
-
console.log(
|
|
780
|
+
${chalk2.bold(product.name)} ${chalk2.gray(`(${product.slug})`)}`);
|
|
781
|
+
console.log(chalk2.gray(` ID: ${product.id}`));
|
|
902
782
|
if (product.description) {
|
|
903
|
-
console.log(` ${
|
|
783
|
+
console.log(` ${chalk2.gray("Description:")} ${product.description}`);
|
|
904
784
|
}
|
|
905
785
|
if (product._count) {
|
|
906
786
|
const c = product._count;
|
|
@@ -908,7 +788,7 @@ ${chalk3.bold(product.name)} ${chalk3.gray(`(${product.slug})`)}`);
|
|
|
908
788
|
c.features != null ? `features: ${c.features}` : null,
|
|
909
789
|
c.tickets != null ? `tickets: ${c.tickets}` : null
|
|
910
790
|
].filter(Boolean);
|
|
911
|
-
if (parts.length) console.log(` ${
|
|
791
|
+
if (parts.length) console.log(` ${chalk2.cyan("Counts:")} ${parts.join(" ")}`);
|
|
912
792
|
}
|
|
913
793
|
console.log();
|
|
914
794
|
}
|
|
@@ -920,16 +800,16 @@ function outputProductsJson(products) {
|
|
|
920
800
|
}
|
|
921
801
|
function outputProductsPretty(products) {
|
|
922
802
|
if (products.length === 0) {
|
|
923
|
-
console.log(
|
|
803
|
+
console.log(chalk2.gray("No products found."));
|
|
924
804
|
return;
|
|
925
805
|
}
|
|
926
|
-
console.log(
|
|
806
|
+
console.log(chalk2.bold(`
|
|
927
807
|
Products (${products.length} total)`));
|
|
928
|
-
console.log(
|
|
808
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
929
809
|
for (const p of products) {
|
|
930
|
-
const ticketCount = p._count?.tickets != null ?
|
|
931
|
-
console.log(` ${
|
|
932
|
-
console.log(
|
|
810
|
+
const ticketCount = p._count?.tickets != null ? chalk2.gray(` \u2014 ${p._count.tickets} tickets`) : "";
|
|
811
|
+
console.log(` ${chalk2.bold(p.name)} ${chalk2.gray(`(${p.slug})`)}${ticketCount}`);
|
|
812
|
+
console.log(chalk2.gray(` ID: ${p.id}`));
|
|
933
813
|
}
|
|
934
814
|
console.log();
|
|
935
815
|
}
|
|
@@ -953,32 +833,32 @@ function outputFeatureJson(feature) {
|
|
|
953
833
|
console.log(JSON.stringify(transformFeature(feature), null, 2));
|
|
954
834
|
}
|
|
955
835
|
function outputFeaturePretty(feature) {
|
|
956
|
-
console.log(
|
|
836
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
957
837
|
console.log(`
|
|
958
|
-
${
|
|
959
|
-
console.log(
|
|
838
|
+
${chalk2[getFeatureStatusColor(feature.status)](`[${feature.status}]`)} ${chalk2.bold(feature.name)}`);
|
|
839
|
+
console.log(chalk2.gray(` ID: ${feature.id}`));
|
|
960
840
|
if (feature.description) {
|
|
961
|
-
console.log(` ${
|
|
841
|
+
console.log(` ${chalk2.gray("Description:")} ${feature.description.substring(0, 120)}${feature.description.length > 120 ? "..." : ""}`);
|
|
962
842
|
}
|
|
963
843
|
if (feature.vision) {
|
|
964
|
-
console.log(` ${
|
|
844
|
+
console.log(` ${chalk2.gray("Vision:")} ${feature.vision.substring(0, 120)}${feature.vision.length > 120 ? "..." : ""}`);
|
|
965
845
|
}
|
|
966
846
|
if (feature.priority != null) {
|
|
967
|
-
console.log(` ${
|
|
847
|
+
console.log(` ${chalk2.magenta("Priority:")} ${feature.priority}`);
|
|
968
848
|
}
|
|
969
849
|
if (feature.goal) {
|
|
970
|
-
console.log(` ${
|
|
850
|
+
console.log(` ${chalk2.blue("Objective:")} ${feature.goal.title} ${chalk2.gray(`(${feature.goal.id})`)}`);
|
|
971
851
|
}
|
|
972
852
|
if (feature.keyResultLinks?.length) {
|
|
973
|
-
console.log(` ${
|
|
853
|
+
console.log(` ${chalk2.blue("Key results:")}`);
|
|
974
854
|
for (const link of feature.keyResultLinks) {
|
|
975
855
|
const kr = link.keyResult;
|
|
976
856
|
const progress = kr.currentValue != null && kr.targetValue != null ? `${kr.currentValue}/${kr.targetValue}${kr.unit && kr.unit !== "custom" ? ` ${kr.unit}` : ""}, ` : "";
|
|
977
|
-
console.log(` \xB7 ${kr.title} ${
|
|
857
|
+
console.log(` \xB7 ${kr.title} ${chalk2.gray(`(${progress}${kr.period}, ${kr.id})`)}`);
|
|
978
858
|
}
|
|
979
859
|
}
|
|
980
860
|
if (feature._count?.tickets != null) {
|
|
981
|
-
console.log(` ${
|
|
861
|
+
console.log(` ${chalk2.cyan("Tickets:")} ${feature._count.tickets}`);
|
|
982
862
|
}
|
|
983
863
|
console.log();
|
|
984
864
|
}
|
|
@@ -990,20 +870,20 @@ function outputFeaturesJson(features) {
|
|
|
990
870
|
}
|
|
991
871
|
function outputFeaturesPretty(features) {
|
|
992
872
|
if (features.length === 0) {
|
|
993
|
-
console.log(
|
|
873
|
+
console.log(chalk2.gray("No features found."));
|
|
994
874
|
return;
|
|
995
875
|
}
|
|
996
|
-
console.log(
|
|
876
|
+
console.log(chalk2.bold(`
|
|
997
877
|
Features (${features.length} total)`));
|
|
998
|
-
console.log(
|
|
878
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
999
879
|
for (const f of features) {
|
|
1000
|
-
const statusBadge2 =
|
|
1001
|
-
const ticketCount = f._count?.tickets != null ?
|
|
1002
|
-
console.log(` ${statusBadge2} ${
|
|
1003
|
-
console.log(
|
|
880
|
+
const statusBadge2 = chalk2[getFeatureStatusColor(f.status)](`[${f.status}]`);
|
|
881
|
+
const ticketCount = f._count?.tickets != null ? chalk2.gray(` \u2014 ${f._count.tickets} tickets`) : "";
|
|
882
|
+
console.log(` ${statusBadge2} ${chalk2.bold(f.name)}${ticketCount}`);
|
|
883
|
+
console.log(chalk2.gray(` ID: ${f.id}`));
|
|
1004
884
|
if (f.keyResultLinks?.length) {
|
|
1005
885
|
const titles = f.keyResultLinks.map((l) => l.keyResult.title).join("; ");
|
|
1006
|
-
console.log(
|
|
886
|
+
console.log(chalk2.gray(` KRs: ${titles}`));
|
|
1007
887
|
}
|
|
1008
888
|
}
|
|
1009
889
|
console.log();
|
|
@@ -1078,18 +958,18 @@ function outputUserStoryJson(story) {
|
|
|
1078
958
|
console.log(JSON.stringify(transformUserStory(story), null, 2));
|
|
1079
959
|
}
|
|
1080
960
|
function outputUserStoryPretty(story) {
|
|
1081
|
-
console.log(
|
|
1082
|
-
const order =
|
|
961
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
962
|
+
const order = chalk2.gray(`#${story.displayOrder}`);
|
|
1083
963
|
console.log(`
|
|
1084
|
-
${order} ${
|
|
1085
|
-
console.log(
|
|
1086
|
-
if (story.asA) console.log(` ${
|
|
1087
|
-
if (story.iWant) console.log(` ${
|
|
1088
|
-
if (story.soThat) console.log(` ${
|
|
964
|
+
${order} ${chalk2.bold(story.iWant ?? '(no "I want")')}`);
|
|
965
|
+
console.log(chalk2.gray(` ID: ${story.id}`));
|
|
966
|
+
if (story.asA) console.log(` ${chalk2.cyan("As a:")} ${story.asA}`);
|
|
967
|
+
if (story.iWant) console.log(` ${chalk2.cyan("I want:")} ${story.iWant}`);
|
|
968
|
+
if (story.soThat) console.log(` ${chalk2.cyan("So that:")} ${story.soThat}`);
|
|
1089
969
|
if (story.acceptanceCriteria) {
|
|
1090
|
-
console.log(` ${
|
|
970
|
+
console.log(` ${chalk2.yellow("Acceptance:")} ${story.acceptanceCriteria}`);
|
|
1091
971
|
}
|
|
1092
|
-
if (story.scopeId) console.log(` ${
|
|
972
|
+
if (story.scopeId) console.log(` ${chalk2.magenta("Scope:")} ${story.scopeId}`);
|
|
1093
973
|
console.log();
|
|
1094
974
|
}
|
|
1095
975
|
function outputUserStoriesJson(stories) {
|
|
@@ -1100,21 +980,21 @@ function outputUserStoriesJson(stories) {
|
|
|
1100
980
|
}
|
|
1101
981
|
function outputUserStoriesPretty(stories) {
|
|
1102
982
|
if (stories.length === 0) {
|
|
1103
|
-
console.log(
|
|
983
|
+
console.log(chalk2.gray("No user stories found."));
|
|
1104
984
|
return;
|
|
1105
985
|
}
|
|
1106
|
-
console.log(
|
|
986
|
+
console.log(chalk2.bold(`
|
|
1107
987
|
User stories (${stories.length} total)`));
|
|
1108
|
-
console.log(
|
|
988
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
1109
989
|
for (const story of stories) {
|
|
1110
|
-
const order =
|
|
990
|
+
const order = chalk2.gray(`#${story.displayOrder}`);
|
|
1111
991
|
const parts = [
|
|
1112
992
|
story.asA ? `As a ${story.asA},` : null,
|
|
1113
993
|
story.iWant ? `I want ${story.iWant},` : null,
|
|
1114
994
|
story.soThat ? `so that ${story.soThat}.` : null
|
|
1115
995
|
].filter(Boolean).join(" ");
|
|
1116
|
-
console.log(` ${order} ${parts ||
|
|
1117
|
-
console.log(
|
|
996
|
+
console.log(` ${order} ${parts || chalk2.gray("(empty)")}`);
|
|
997
|
+
console.log(chalk2.gray(` ID: ${story.id}`));
|
|
1118
998
|
}
|
|
1119
999
|
console.log();
|
|
1120
1000
|
}
|
|
@@ -1129,14 +1009,14 @@ function outputBatchResultsJson(results) {
|
|
|
1129
1009
|
}
|
|
1130
1010
|
function outputBatchResultsPretty(results) {
|
|
1131
1011
|
const succeeded = results.filter((r) => r.ok).length;
|
|
1132
|
-
console.log(
|
|
1012
|
+
console.log(chalk2.bold(`
|
|
1133
1013
|
Added ${succeeded}/${results.length} user stories`));
|
|
1134
|
-
console.log(
|
|
1014
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
1135
1015
|
for (const r of results) {
|
|
1136
1016
|
if (r.ok) {
|
|
1137
|
-
console.log(` ${
|
|
1017
|
+
console.log(` ${chalk2.green("\u2713")} [${r.index}] ${chalk2.gray(r.id ?? "")}`);
|
|
1138
1018
|
} else {
|
|
1139
|
-
console.log(` ${
|
|
1019
|
+
console.log(` ${chalk2.red("\u2717")} [${r.index}] ${r.error ?? "failed"}`);
|
|
1140
1020
|
}
|
|
1141
1021
|
}
|
|
1142
1022
|
console.log();
|
|
@@ -1146,54 +1026,54 @@ function outputTicketJson(ticket) {
|
|
|
1146
1026
|
}
|
|
1147
1027
|
function outputTicketPretty(ticket) {
|
|
1148
1028
|
const id = ticket.shortId ?? (ticket.number != null ? `#${ticket.number}` : "?");
|
|
1149
|
-
console.log(
|
|
1029
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
1150
1030
|
console.log(
|
|
1151
1031
|
`
|
|
1152
|
-
${
|
|
1032
|
+
${chalk2[getTicketStatusColor(ticket.status)](`[${ticket.status}]`)} ${chalk2.gray(`[${ticket.type}]`)} ${chalk2.bold(`${id} ${ticket.title}`)}`
|
|
1153
1033
|
);
|
|
1154
|
-
console.log(
|
|
1034
|
+
console.log(chalk2.gray(` ID: ${ticket.id}`));
|
|
1155
1035
|
if (ticket.isBlocked) {
|
|
1156
|
-
console.log(` ${
|
|
1036
|
+
console.log(` ${chalk2.red("BLOCKED")} by ${ticket.openBlockerCount ?? 0} open ticket(s)`);
|
|
1157
1037
|
} else if (ticket.openBlockerCount && ticket.openBlockerCount > 0) {
|
|
1158
|
-
console.log(` ${
|
|
1038
|
+
console.log(` ${chalk2.yellow("Blockers:")} ${ticket.openBlockerCount} open (not currently in flight)`);
|
|
1159
1039
|
}
|
|
1160
1040
|
if (ticket.feature) {
|
|
1161
|
-
console.log(` ${
|
|
1041
|
+
console.log(` ${chalk2.cyan("Feature:")} ${ticket.feature.name}`);
|
|
1162
1042
|
}
|
|
1163
1043
|
if (ticket.epic) {
|
|
1164
|
-
console.log(` ${
|
|
1044
|
+
console.log(` ${chalk2.cyan("Epic:")} ${ticket.epic.name}`);
|
|
1165
1045
|
}
|
|
1166
1046
|
if (ticket.assignee) {
|
|
1167
|
-
console.log(` ${
|
|
1047
|
+
console.log(` ${chalk2.magenta("Assignee:")} ${ticket.assignee.name ?? ticket.assignee.id}`);
|
|
1168
1048
|
}
|
|
1169
1049
|
if (ticket.priority != null) {
|
|
1170
|
-
console.log(` ${
|
|
1050
|
+
console.log(` ${chalk2.magenta("Priority:")} ${ticket.priority}`);
|
|
1171
1051
|
}
|
|
1172
1052
|
if (ticket.points != null) {
|
|
1173
|
-
console.log(` ${
|
|
1053
|
+
console.log(` ${chalk2.yellow("Points:")} ${ticket.points}`);
|
|
1174
1054
|
}
|
|
1175
1055
|
if (ticket.body) {
|
|
1176
|
-
console.log(` ${
|
|
1056
|
+
console.log(` ${chalk2.gray("Body:")} ${ticket.body.substring(0, 200)}${ticket.body.length > 200 ? "..." : ""}`);
|
|
1177
1057
|
}
|
|
1178
1058
|
const detail = ticket;
|
|
1179
1059
|
if (detail.dependsOn && detail.dependsOn.length > 0) {
|
|
1180
|
-
console.log(` ${
|
|
1060
|
+
console.log(` ${chalk2.cyan("Depends on:")}`);
|
|
1181
1061
|
for (const dep of detail.dependsOn) {
|
|
1182
1062
|
const depId = dep.shortId ?? (dep.number != null ? `#${dep.number}` : "?");
|
|
1183
|
-
console.log(` - ${
|
|
1063
|
+
console.log(` - ${chalk2.gray(`[${dep.status}]`)} ${depId} ${dep.title}`);
|
|
1184
1064
|
}
|
|
1185
1065
|
}
|
|
1186
1066
|
if (detail.requiredFor && detail.requiredFor.length > 0) {
|
|
1187
|
-
console.log(` ${
|
|
1067
|
+
console.log(` ${chalk2.cyan("Required for:")}`);
|
|
1188
1068
|
for (const dep of detail.requiredFor) {
|
|
1189
1069
|
const depId = dep.shortId ?? (dep.number != null ? `#${dep.number}` : "?");
|
|
1190
|
-
console.log(` - ${
|
|
1070
|
+
console.log(` - ${chalk2.gray(`[${dep.status}]`)} ${depId} ${dep.title}`);
|
|
1191
1071
|
}
|
|
1192
1072
|
}
|
|
1193
1073
|
if (detail.actions && detail.actions.length > 0) {
|
|
1194
|
-
console.log(` ${
|
|
1074
|
+
console.log(` ${chalk2.cyan("Actions:")} ${detail.actions.length}`);
|
|
1195
1075
|
for (const a of detail.actions) {
|
|
1196
|
-
console.log(` - ${
|
|
1076
|
+
console.log(` - ${chalk2.gray(`[${a.kanbanStatus ?? a.status}]`)} ${a.name} ${chalk2.gray(`(${a.id})`)}`);
|
|
1197
1077
|
}
|
|
1198
1078
|
}
|
|
1199
1079
|
console.log();
|
|
@@ -1206,19 +1086,19 @@ function outputTicketsJson(tickets) {
|
|
|
1206
1086
|
}
|
|
1207
1087
|
function outputTicketsPretty(tickets) {
|
|
1208
1088
|
if (tickets.length === 0) {
|
|
1209
|
-
console.log(
|
|
1089
|
+
console.log(chalk2.gray("No tickets found."));
|
|
1210
1090
|
return;
|
|
1211
1091
|
}
|
|
1212
|
-
console.log(
|
|
1092
|
+
console.log(chalk2.bold(`
|
|
1213
1093
|
Tickets (${tickets.length} total)`));
|
|
1214
|
-
console.log(
|
|
1094
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
1215
1095
|
for (const t of tickets) {
|
|
1216
1096
|
const id = t.shortId ?? (t.number != null ? `#${t.number}` : "?");
|
|
1217
|
-
const statusBadge2 =
|
|
1218
|
-
const typeBadge =
|
|
1219
|
-
const blocked = t.isBlocked ?
|
|
1220
|
-
console.log(` ${statusBadge2} ${typeBadge} ${
|
|
1221
|
-
console.log(
|
|
1097
|
+
const statusBadge2 = chalk2[getTicketStatusColor(t.status)](`[${t.status}]`);
|
|
1098
|
+
const typeBadge = chalk2.gray(`[${t.type}]`);
|
|
1099
|
+
const blocked = t.isBlocked ? chalk2.red(" BLOCKED") : "";
|
|
1100
|
+
console.log(` ${statusBadge2} ${typeBadge} ${chalk2.bold(id)} ${t.title}${blocked}`);
|
|
1101
|
+
console.log(chalk2.gray(` ID: ${t.id}`));
|
|
1222
1102
|
}
|
|
1223
1103
|
console.log();
|
|
1224
1104
|
}
|
|
@@ -1242,18 +1122,18 @@ function outputTicketSearchJson(hits, query) {
|
|
|
1242
1122
|
}
|
|
1243
1123
|
function outputTicketSearchPretty(hits, query) {
|
|
1244
1124
|
if (hits.length === 0) {
|
|
1245
|
-
console.log(
|
|
1125
|
+
console.log(chalk2.gray(`No tickets match "${query}".`));
|
|
1246
1126
|
return;
|
|
1247
1127
|
}
|
|
1248
|
-
console.log(
|
|
1128
|
+
console.log(chalk2.bold(`
|
|
1249
1129
|
Tickets matching "${query}" (${hits.length})`));
|
|
1250
|
-
console.log(
|
|
1130
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
1251
1131
|
for (const t of hits) {
|
|
1252
1132
|
const id = t.shortId ?? (t.number != null ? `#${t.number}` : "?");
|
|
1253
|
-
const statusBadge2 =
|
|
1254
|
-
const assignee = t.assignee ?
|
|
1255
|
-
console.log(` ${statusBadge2} ${
|
|
1256
|
-
console.log(
|
|
1133
|
+
const statusBadge2 = chalk2[getTicketStatusColor(t.status)](`[${t.status}]`);
|
|
1134
|
+
const assignee = t.assignee ? chalk2.gray(` \u2014 ${t.assignee.name ?? t.assignee.id}`) : "";
|
|
1135
|
+
console.log(` ${statusBadge2} ${chalk2.bold(id)} ${t.title}${assignee}`);
|
|
1136
|
+
console.log(chalk2.gray(` ID: ${t.id}`));
|
|
1257
1137
|
}
|
|
1258
1138
|
console.log();
|
|
1259
1139
|
}
|
|
@@ -1330,22 +1210,22 @@ function outputEpicJson(epic) {
|
|
|
1330
1210
|
console.log(JSON.stringify(transformEpic(epic), null, 2));
|
|
1331
1211
|
}
|
|
1332
1212
|
function outputEpicPretty(epic) {
|
|
1333
|
-
console.log(
|
|
1213
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
1334
1214
|
console.log(`
|
|
1335
|
-
${
|
|
1336
|
-
console.log(
|
|
1215
|
+
${chalk2[getEpicStatusColor(epic.status)](`[${epic.status}]`)} ${chalk2.bold(epic.name)}`);
|
|
1216
|
+
console.log(chalk2.gray(` ID: ${epic.id}`));
|
|
1337
1217
|
if (epic.description) {
|
|
1338
|
-
console.log(` ${
|
|
1218
|
+
console.log(` ${chalk2.gray("Description:")} ${epic.description.substring(0, 200)}${epic.description.length > 200 ? "..." : ""}`);
|
|
1339
1219
|
}
|
|
1340
|
-
console.log(` ${
|
|
1220
|
+
console.log(` ${chalk2.magenta("Priority:")} ${epic.priority}`);
|
|
1341
1221
|
if (epic.startDate) {
|
|
1342
|
-
console.log(` ${
|
|
1222
|
+
console.log(` ${chalk2.cyan("Start:")} ${formatDate(new Date(epic.startDate))}`);
|
|
1343
1223
|
}
|
|
1344
1224
|
if (epic.targetDate) {
|
|
1345
|
-
console.log(` ${
|
|
1225
|
+
console.log(` ${chalk2.cyan("Target:")} ${formatDate(new Date(epic.targetDate))}`);
|
|
1346
1226
|
}
|
|
1347
1227
|
if (epic.owner) {
|
|
1348
|
-
console.log(` ${
|
|
1228
|
+
console.log(` ${chalk2.gray("Owner:")} ${epic.owner.name ?? epic.owner.email ?? epic.owner.id}`);
|
|
1349
1229
|
}
|
|
1350
1230
|
if (epic._count) {
|
|
1351
1231
|
const c = epic._count;
|
|
@@ -1353,7 +1233,7 @@ ${chalk3[getEpicStatusColor(epic.status)](`[${epic.status}]`)} ${chalk3.bold(epi
|
|
|
1353
1233
|
c.actions != null ? `actions: ${c.actions}` : null,
|
|
1354
1234
|
c.tickets != null ? `tickets: ${c.tickets}` : null
|
|
1355
1235
|
].filter(Boolean);
|
|
1356
|
-
if (parts.length) console.log(` ${
|
|
1236
|
+
if (parts.length) console.log(` ${chalk2.cyan("Counts:")} ${parts.join(" ")}`);
|
|
1357
1237
|
}
|
|
1358
1238
|
console.log();
|
|
1359
1239
|
}
|
|
@@ -1365,19 +1245,19 @@ function outputEpicsJson(epics) {
|
|
|
1365
1245
|
}
|
|
1366
1246
|
function outputEpicsPretty(epics) {
|
|
1367
1247
|
if (epics.length === 0) {
|
|
1368
|
-
console.log(
|
|
1248
|
+
console.log(chalk2.gray("No epics found."));
|
|
1369
1249
|
return;
|
|
1370
1250
|
}
|
|
1371
|
-
console.log(
|
|
1251
|
+
console.log(chalk2.bold(`
|
|
1372
1252
|
Epics (${epics.length} total)`));
|
|
1373
|
-
console.log(
|
|
1253
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
1374
1254
|
for (const e of epics) {
|
|
1375
|
-
const statusBadge2 =
|
|
1376
|
-
const counts = e._count ?
|
|
1255
|
+
const statusBadge2 = chalk2[getEpicStatusColor(e.status)](`[${e.status}]`);
|
|
1256
|
+
const counts = e._count ? chalk2.gray(
|
|
1377
1257
|
` \u2014 ${e._count.tickets ?? 0} tickets, ${e._count.actions ?? 0} actions`
|
|
1378
1258
|
) : "";
|
|
1379
|
-
console.log(` ${statusBadge2} ${
|
|
1380
|
-
console.log(
|
|
1259
|
+
console.log(` ${statusBadge2} ${chalk2.bold(e.name)}${counts}`);
|
|
1260
|
+
console.log(chalk2.gray(` ID: ${e.id}`));
|
|
1381
1261
|
}
|
|
1382
1262
|
console.log();
|
|
1383
1263
|
}
|
|
@@ -1414,15 +1294,15 @@ function getEpicStatusColor(status) {
|
|
|
1414
1294
|
}
|
|
1415
1295
|
function outputStagesPretty(stages) {
|
|
1416
1296
|
if (stages.length === 0) {
|
|
1417
|
-
console.log(
|
|
1297
|
+
console.log(chalk2.gray("No stages found."));
|
|
1418
1298
|
return;
|
|
1419
1299
|
}
|
|
1420
|
-
console.log(
|
|
1300
|
+
console.log(chalk2.bold(`
|
|
1421
1301
|
Pipeline Stages (${stages.length})`));
|
|
1422
|
-
console.log(
|
|
1302
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
1423
1303
|
for (const stage of stages) {
|
|
1424
|
-
const count = stage._count?.deals != null ?
|
|
1425
|
-
console.log(` ${
|
|
1304
|
+
const count = stage._count?.deals != null ? chalk2.gray(` (${stage._count.deals} deals)`) : "";
|
|
1305
|
+
console.log(` ${chalk2.bold(stage.name)}${count} \u2014 ${chalk2.gray(stage.type)}`);
|
|
1426
1306
|
}
|
|
1427
1307
|
console.log();
|
|
1428
1308
|
}
|
|
@@ -1437,29 +1317,29 @@ function formatDay(value) {
|
|
|
1437
1317
|
return new Date(value).toISOString().slice(0, 10);
|
|
1438
1318
|
}
|
|
1439
1319
|
function outputPagePretty(page) {
|
|
1440
|
-
console.log(
|
|
1320
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
1441
1321
|
console.log(`
|
|
1442
|
-
${
|
|
1443
|
-
console.log(
|
|
1322
|
+
${chalk2.bold(page.title)}`);
|
|
1323
|
+
console.log(chalk2.gray(` ID: ${page.id} v${page.docVersion}`));
|
|
1444
1324
|
if (page.project) {
|
|
1445
|
-
console.log(` ${
|
|
1325
|
+
console.log(` ${chalk2.gray("Project:")} ${page.project.name}`);
|
|
1446
1326
|
}
|
|
1447
1327
|
if (page.asOf || page.source) {
|
|
1448
1328
|
const parts = [];
|
|
1449
1329
|
if (page.asOf) parts.push(`As of ${formatDay(page.asOf)}`);
|
|
1450
1330
|
if (page.source) parts.push(`Source: ${page.source}`);
|
|
1451
|
-
console.log(` ${
|
|
1331
|
+
console.log(` ${chalk2.gray(parts.join(" \xB7 "))}`);
|
|
1452
1332
|
}
|
|
1453
1333
|
if (typeof page.bodyBytes === "number") {
|
|
1454
1334
|
const scope = page.section ? ` (showing section "${page.section.text}")` : "";
|
|
1455
|
-
console.log(
|
|
1335
|
+
console.log(chalk2.gray(` Body: ${formatBytes(page.bodyBytes)}${scope}`));
|
|
1456
1336
|
}
|
|
1457
1337
|
if (page.outline) {
|
|
1458
1338
|
console.log();
|
|
1459
|
-
if (page.outline.length === 0) console.log(
|
|
1339
|
+
if (page.outline.length === 0) console.log(chalk2.gray(" (no headings)"));
|
|
1460
1340
|
for (const h of page.outline) {
|
|
1461
1341
|
console.log(
|
|
1462
|
-
` ${" ".repeat(h.level - 1)}${
|
|
1342
|
+
` ${" ".repeat(h.level - 1)}${chalk2.gray("#".repeat(h.level))} ${h.text} ${chalk2.gray(`L${h.line + 1}`)}`
|
|
1463
1343
|
);
|
|
1464
1344
|
}
|
|
1465
1345
|
console.log();
|
|
@@ -1473,68 +1353,68 @@ ${page.body}
|
|
|
1473
1353
|
}
|
|
1474
1354
|
function outputPageSearchPretty(result) {
|
|
1475
1355
|
if (result.results.length === 0) {
|
|
1476
|
-
console.log(
|
|
1356
|
+
console.log(chalk2.gray(`No pages about "${result.query}".`));
|
|
1477
1357
|
return;
|
|
1478
1358
|
}
|
|
1479
|
-
console.log(
|
|
1359
|
+
console.log(chalk2.bold(`
|
|
1480
1360
|
Pages about "${result.query}" (${result.results.length})`));
|
|
1481
|
-
console.log(
|
|
1361
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
1482
1362
|
for (const r of result.results) {
|
|
1483
|
-
const score = r.similarity === null ?
|
|
1484
|
-
console.log(` ${
|
|
1485
|
-
console.log(
|
|
1363
|
+
const score = r.similarity === null ? chalk2.gray("text match") : chalk2.gray(`${Math.round(r.similarity * 100)}%`);
|
|
1364
|
+
console.log(` ${chalk2.bold(r.title)} ${score}`);
|
|
1365
|
+
console.log(chalk2.gray(` ID: ${r.id} ${r.url}`));
|
|
1486
1366
|
if (r.snippet) console.log(` ${r.snippet}`);
|
|
1487
1367
|
}
|
|
1488
1368
|
console.log();
|
|
1489
1369
|
}
|
|
1490
1370
|
function outputPageHistoryPretty(history) {
|
|
1491
1371
|
if (history.revisions.length === 0) {
|
|
1492
|
-
console.log(
|
|
1372
|
+
console.log(chalk2.gray("No revisions yet."));
|
|
1493
1373
|
return;
|
|
1494
1374
|
}
|
|
1495
1375
|
const n = history.revisions.length;
|
|
1496
|
-
console.log(
|
|
1376
|
+
console.log(chalk2.bold(`
|
|
1497
1377
|
History (${n} revision${n === 1 ? "" : "s"})`));
|
|
1498
|
-
console.log(
|
|
1378
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
1499
1379
|
for (const r of history.revisions) {
|
|
1500
1380
|
const when = new Date(r.updatedAt).toISOString().replace("T", " ").slice(0, 16);
|
|
1501
1381
|
const who = r.kind === "baseline" ? "before history" : r.authorHidden ? "a member" : r.author?.name ?? "automated";
|
|
1502
1382
|
console.log(
|
|
1503
|
-
` ${
|
|
1383
|
+
` ${chalk2.gray(when)} ${chalk2.bold(who)} ${chalk2.cyan(r.kind)} v${r.docVersion} ${chalk2.gray(formatBytes(r.bodyBytes))}`
|
|
1504
1384
|
);
|
|
1505
|
-
console.log(
|
|
1385
|
+
console.log(chalk2.gray(` ${r.id} "${r.title}"`));
|
|
1506
1386
|
if (r.note) console.log(` ${r.note}`);
|
|
1507
|
-
else if (r.kind === "markdown" || r.kind === "restore") console.log(
|
|
1387
|
+
else if (r.kind === "markdown" || r.kind === "restore") console.log(chalk2.gray(" (no reason given)"));
|
|
1508
1388
|
}
|
|
1509
1389
|
if (history.nextCursor) {
|
|
1510
|
-
console.log(
|
|
1390
|
+
console.log(chalk2.gray(`
|
|
1511
1391
|
More: --cursor ${history.nextCursor}`));
|
|
1512
1392
|
}
|
|
1513
1393
|
console.log();
|
|
1514
1394
|
}
|
|
1515
1395
|
function outputPageDiffPretty(diff) {
|
|
1516
1396
|
const side = (s) => s.revisionId ? `${s.revisionId} (v${s.docVersion})` : s.createdAt ? "current" : "(empty)";
|
|
1517
|
-
console.log(
|
|
1397
|
+
console.log(chalk2.gray(`${side(diff.from)} \u2192 ${side(diff.to)}`));
|
|
1518
1398
|
if (diff.titleChanged) {
|
|
1519
|
-
console.log(
|
|
1520
|
-
console.log(
|
|
1399
|
+
console.log(chalk2.red(`- title: ${diff.from.title}`));
|
|
1400
|
+
console.log(chalk2.green(`+ title: ${diff.to.title}`));
|
|
1521
1401
|
}
|
|
1522
1402
|
if (diff.provenanceChanged) {
|
|
1523
1403
|
const prov = (s) => `as of ${s.asOf ? formatDay(s.asOf) : "\u2014"} \xB7 source ${s.source ?? "\u2014"}`;
|
|
1524
|
-
console.log(
|
|
1525
|
-
console.log(
|
|
1404
|
+
console.log(chalk2.red(`- ${prov(diff.from)}`));
|
|
1405
|
+
console.log(chalk2.green(`+ ${prov(diff.to)}`));
|
|
1526
1406
|
}
|
|
1527
1407
|
if (!diff.unified) {
|
|
1528
|
-
console.log(
|
|
1408
|
+
console.log(chalk2.gray("No changes to the body."));
|
|
1529
1409
|
return;
|
|
1530
1410
|
}
|
|
1531
|
-
console.log(
|
|
1411
|
+
console.log(chalk2.gray(`+${diff.stats.added} \u2212${diff.stats.removed}
|
|
1532
1412
|
`));
|
|
1533
1413
|
for (const line of diff.unified.split("\n")) {
|
|
1534
1414
|
if (line.startsWith("+++") || line.startsWith("---") || line.startsWith("@@")) {
|
|
1535
|
-
console.log(
|
|
1536
|
-
} else if (line.startsWith("+")) console.log(
|
|
1537
|
-
else if (line.startsWith("-")) console.log(
|
|
1415
|
+
console.log(chalk2.gray(line));
|
|
1416
|
+
} else if (line.startsWith("+")) console.log(chalk2.green(line));
|
|
1417
|
+
else if (line.startsWith("-")) console.log(chalk2.red(line));
|
|
1538
1418
|
else console.log(line);
|
|
1539
1419
|
}
|
|
1540
1420
|
}
|
|
@@ -1543,15 +1423,15 @@ function outputPagesJson(pages) {
|
|
|
1543
1423
|
}
|
|
1544
1424
|
function outputPagesPretty(pages) {
|
|
1545
1425
|
if (pages.length === 0) {
|
|
1546
|
-
console.log(
|
|
1426
|
+
console.log(chalk2.gray("No pages found."));
|
|
1547
1427
|
return;
|
|
1548
1428
|
}
|
|
1549
|
-
console.log(
|
|
1429
|
+
console.log(chalk2.bold(`
|
|
1550
1430
|
Pages (${pages.length} total)`));
|
|
1551
|
-
console.log(
|
|
1431
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
1552
1432
|
for (const p of pages) {
|
|
1553
|
-
console.log(` ${
|
|
1554
|
-
console.log(
|
|
1433
|
+
console.log(` ${chalk2.bold(p.title)}`);
|
|
1434
|
+
console.log(chalk2.gray(` ID: ${p.id}`));
|
|
1555
1435
|
}
|
|
1556
1436
|
console.log();
|
|
1557
1437
|
}
|
|
@@ -1612,29 +1492,29 @@ function outputMeetingJson(meeting) {
|
|
|
1612
1492
|
console.log(JSON.stringify(transformMeeting(meeting), null, 2));
|
|
1613
1493
|
}
|
|
1614
1494
|
function outputMeetingPretty(meeting, options = {}) {
|
|
1615
|
-
console.log(
|
|
1495
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
1616
1496
|
console.log(`
|
|
1617
|
-
${
|
|
1618
|
-
console.log(
|
|
1619
|
-
console.log(` ${
|
|
1497
|
+
${chalk2.bold(meeting.title ?? "Untitled meeting")}`);
|
|
1498
|
+
console.log(chalk2.gray(` ID: ${meeting.id}`));
|
|
1499
|
+
console.log(` ${chalk2.gray("Date:")} ${meetingWhen(meeting).toLocaleString()}`);
|
|
1620
1500
|
if (meeting.workspace) {
|
|
1621
|
-
console.log(` ${
|
|
1501
|
+
console.log(` ${chalk2.gray("Workspace:")} ${meeting.workspace.name}`);
|
|
1622
1502
|
}
|
|
1623
1503
|
if (meeting.project) {
|
|
1624
|
-
console.log(` ${
|
|
1504
|
+
console.log(` ${chalk2.gray("Project:")} ${meeting.project.name}`);
|
|
1625
1505
|
}
|
|
1626
1506
|
if (meeting.sourceIntegration) {
|
|
1627
|
-
console.log(` ${
|
|
1507
|
+
console.log(` ${chalk2.gray("Source:")} ${meeting.sourceIntegration.provider}`);
|
|
1628
1508
|
}
|
|
1629
1509
|
if (meeting.durationSeconds) {
|
|
1630
|
-
console.log(` ${
|
|
1510
|
+
console.log(` ${chalk2.gray("Duration:")} ${Math.round(meeting.durationSeconds / 60)} min`);
|
|
1631
1511
|
}
|
|
1632
1512
|
if (meeting.archivedAt) {
|
|
1633
|
-
console.log(` ${
|
|
1513
|
+
console.log(` ${chalk2.yellow("Archived")}`);
|
|
1634
1514
|
}
|
|
1635
1515
|
if (meeting.participants && meeting.participants.length > 0) {
|
|
1636
1516
|
const people = meeting.participants.map((p) => p.name ?? p.email).join(", ");
|
|
1637
|
-
console.log(` ${
|
|
1517
|
+
console.log(` ${chalk2.gray("Participants:")} ${people}`);
|
|
1638
1518
|
}
|
|
1639
1519
|
if (meeting.description) {
|
|
1640
1520
|
console.log(`
|
|
@@ -1642,26 +1522,26 @@ ${meeting.description}`);
|
|
|
1642
1522
|
}
|
|
1643
1523
|
if (meeting.summary) {
|
|
1644
1524
|
console.log(`
|
|
1645
|
-
${
|
|
1525
|
+
${chalk2.bold("Summary")}`);
|
|
1646
1526
|
console.log(renderMeetingSummary(meeting.summary));
|
|
1647
1527
|
}
|
|
1648
1528
|
if (meeting.notes) {
|
|
1649
1529
|
console.log(`
|
|
1650
|
-
${
|
|
1530
|
+
${chalk2.bold("Notes")}`);
|
|
1651
1531
|
console.log(meeting.notes);
|
|
1652
1532
|
} else {
|
|
1653
|
-
console.log(
|
|
1533
|
+
console.log(chalk2.gray("\nNo notes yet."));
|
|
1654
1534
|
}
|
|
1655
1535
|
if (options.transcript) {
|
|
1656
1536
|
if (meeting.transcription) {
|
|
1657
1537
|
console.log(`
|
|
1658
|
-
${
|
|
1538
|
+
${chalk2.bold("Transcript")}`);
|
|
1659
1539
|
console.log(meeting.transcription);
|
|
1660
1540
|
} else {
|
|
1661
|
-
console.log(
|
|
1541
|
+
console.log(chalk2.gray("\nNo transcript."));
|
|
1662
1542
|
}
|
|
1663
1543
|
} else if (meeting.transcription) {
|
|
1664
|
-
console.log(
|
|
1544
|
+
console.log(chalk2.gray("\n(transcript available \u2014 pass --transcript to print it)"));
|
|
1665
1545
|
}
|
|
1666
1546
|
console.log();
|
|
1667
1547
|
}
|
|
@@ -1676,32 +1556,32 @@ function outputMeetingsJson(meetings) {
|
|
|
1676
1556
|
}
|
|
1677
1557
|
function outputMeetingsPretty(meetings) {
|
|
1678
1558
|
if (meetings.length === 0) {
|
|
1679
|
-
console.log(
|
|
1559
|
+
console.log(chalk2.gray("No meetings found."));
|
|
1680
1560
|
return;
|
|
1681
1561
|
}
|
|
1682
|
-
console.log(
|
|
1562
|
+
console.log(chalk2.bold(`
|
|
1683
1563
|
Meetings (${meetings.length} total)`));
|
|
1684
|
-
console.log(
|
|
1564
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
1685
1565
|
for (const m of meetings) {
|
|
1686
1566
|
const flags = [
|
|
1687
1567
|
m.notes ? "notes" : null,
|
|
1688
1568
|
m.summary ? "summary" : null,
|
|
1689
1569
|
m.transcription ? "transcript" : null
|
|
1690
1570
|
].filter(Boolean);
|
|
1691
|
-
const archived = m.archivedAt ?
|
|
1571
|
+
const archived = m.archivedAt ? chalk2.yellow(" [archived]") : "";
|
|
1692
1572
|
console.log(
|
|
1693
|
-
` ${
|
|
1573
|
+
` ${chalk2.bold(m.title ?? "Untitled meeting")}${archived} ${chalk2.gray(
|
|
1694
1574
|
meetingWhen(m).toLocaleDateString()
|
|
1695
1575
|
)}`
|
|
1696
1576
|
);
|
|
1697
|
-
console.log(
|
|
1577
|
+
console.log(chalk2.gray(` ID: ${m.id}`));
|
|
1698
1578
|
const context = [
|
|
1699
1579
|
m.project ? `Project: ${m.project.name}` : null,
|
|
1700
1580
|
m.participantCount ? `${m.participantCount} participants` : null,
|
|
1701
1581
|
flags.length > 0 ? flags.join(", ") : null
|
|
1702
1582
|
].filter(Boolean);
|
|
1703
1583
|
if (context.length > 0) {
|
|
1704
|
-
console.log(
|
|
1584
|
+
console.log(chalk2.gray(` ${context.join(" \xB7 ")}`));
|
|
1705
1585
|
}
|
|
1706
1586
|
}
|
|
1707
1587
|
console.log();
|
|
@@ -1793,66 +1673,66 @@ function outputDecisionJson(decision, extra = {}) {
|
|
|
1793
1673
|
}
|
|
1794
1674
|
function outputDecisionPretty(decision) {
|
|
1795
1675
|
const color = getDecisionStatusColor(decision.status);
|
|
1796
|
-
const kind = decision.status === "OPEN" ?
|
|
1797
|
-
console.log(
|
|
1676
|
+
const kind = decision.status === "OPEN" ? chalk2.yellow(" [open question]") : "";
|
|
1677
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
1798
1678
|
console.log(
|
|
1799
1679
|
`
|
|
1800
|
-
${
|
|
1680
|
+
${chalk2.gray(decision.label)} ${chalk2.bold(decision.statement)}${kind}`
|
|
1801
1681
|
);
|
|
1802
|
-
console.log(
|
|
1803
|
-
console.log(` ${
|
|
1804
|
-
console.log(` ${
|
|
1682
|
+
console.log(chalk2.gray(` ID: ${decision.id}`));
|
|
1683
|
+
console.log(` ${chalk2.gray("Status:")} ${chalk2[color](decision.status)}`);
|
|
1684
|
+
console.log(` ${chalk2.gray("Source:")} ${decision.source}`);
|
|
1805
1685
|
if (decision.reviewState && decision.reviewState !== "CONFIRMED") {
|
|
1806
|
-
console.log(` ${
|
|
1686
|
+
console.log(` ${chalk2.yellow(decision.reviewState)}`);
|
|
1807
1687
|
}
|
|
1808
1688
|
if (decision.decidedAt) {
|
|
1809
1689
|
console.log(
|
|
1810
|
-
` ${
|
|
1690
|
+
` ${chalk2.gray("Decided:")} ${new Date(decision.decidedAt).toLocaleString()}`
|
|
1811
1691
|
);
|
|
1812
1692
|
}
|
|
1813
1693
|
if (decision.transcriptionSession) {
|
|
1814
1694
|
console.log(
|
|
1815
|
-
` ${
|
|
1695
|
+
` ${chalk2.gray("Meeting:")} ${decision.transcriptionSession.title ?? "Untitled"} (${decision.transcriptionSession.id})`
|
|
1816
1696
|
);
|
|
1817
1697
|
}
|
|
1818
1698
|
if (decision.product) {
|
|
1819
|
-
console.log(` ${
|
|
1699
|
+
console.log(` ${chalk2.gray("Product:")} ${decision.product.name}`);
|
|
1820
1700
|
}
|
|
1821
1701
|
if (decision.project) {
|
|
1822
|
-
console.log(` ${
|
|
1702
|
+
console.log(` ${chalk2.gray("Project:")} ${decision.project.name}`);
|
|
1823
1703
|
}
|
|
1824
1704
|
if (decision.owner) {
|
|
1825
|
-
console.log(` ${
|
|
1705
|
+
console.log(` ${chalk2.gray("Owner:")} ${decision.owner.name ?? decision.owner.id}`);
|
|
1826
1706
|
}
|
|
1827
1707
|
if (decision.deciders && decision.deciders.length > 0) {
|
|
1828
1708
|
const people = decision.deciders.map((d) => d.email ? `${d.name} <${d.email}>` : d.name).join(", ");
|
|
1829
|
-
console.log(` ${
|
|
1709
|
+
console.log(` ${chalk2.gray("Deciders:")} ${people}`);
|
|
1830
1710
|
}
|
|
1831
1711
|
if (decision.supersededBy) {
|
|
1832
1712
|
console.log(
|
|
1833
|
-
` ${
|
|
1713
|
+
` ${chalk2.gray("Superseded by:")} D-${decision.supersededBy.number} ${decision.supersededBy.statement}`
|
|
1834
1714
|
);
|
|
1835
1715
|
}
|
|
1836
1716
|
if (decision.supersedes && decision.supersedes.length > 0) {
|
|
1837
1717
|
for (const prior of decision.supersedes) {
|
|
1838
1718
|
console.log(
|
|
1839
|
-
` ${
|
|
1719
|
+
` ${chalk2.gray("Supersedes:")} D-${prior.number} ${prior.statement}`
|
|
1840
1720
|
);
|
|
1841
1721
|
}
|
|
1842
1722
|
}
|
|
1843
1723
|
if (decision.links && decision.links.length > 0) {
|
|
1844
|
-
console.log(` ${
|
|
1724
|
+
console.log(` ${chalk2.gray("Implemented by:")}`);
|
|
1845
1725
|
for (const link of decision.links) {
|
|
1846
1726
|
const target = link.ticket ? `${link.ticket.shortId ?? `#${link.ticket.number}`} ${link.ticket.title}` : link.feature ? `feature: ${link.feature.name}` : "(unknown)";
|
|
1847
|
-
console.log(
|
|
1727
|
+
console.log(chalk2.gray(` ${target} [link ${link.id}]`));
|
|
1848
1728
|
}
|
|
1849
1729
|
}
|
|
1850
1730
|
if (decision.evidence && decision.evidence.length > 0) {
|
|
1851
1731
|
console.log(`
|
|
1852
|
-
${
|
|
1732
|
+
${chalk2.bold("Evidence")}`);
|
|
1853
1733
|
for (const turn of decision.evidence) {
|
|
1854
1734
|
const who = turn.speaker ? `${turn.speaker}: ` : "";
|
|
1855
|
-
console.log(
|
|
1735
|
+
console.log(chalk2.gray(` [${turn.turnIndex}] ${who}${turn.text}`));
|
|
1856
1736
|
}
|
|
1857
1737
|
}
|
|
1858
1738
|
if (decision.body) {
|
|
@@ -1876,24 +1756,24 @@ function outputDecisionsJson(decisions, extra = {}) {
|
|
|
1876
1756
|
}
|
|
1877
1757
|
function outputDecisionsPretty(decisions) {
|
|
1878
1758
|
if (decisions.length === 0) {
|
|
1879
|
-
console.log(
|
|
1759
|
+
console.log(chalk2.gray("No decisions found."));
|
|
1880
1760
|
return;
|
|
1881
1761
|
}
|
|
1882
1762
|
const openCount = decisions.filter((d) => d.status === "OPEN").length;
|
|
1883
1763
|
console.log(
|
|
1884
|
-
|
|
1764
|
+
chalk2.bold(
|
|
1885
1765
|
`
|
|
1886
1766
|
Decisions (${decisions.length} total, ${openCount} open question${openCount === 1 ? "" : "s"})`
|
|
1887
1767
|
)
|
|
1888
1768
|
);
|
|
1889
|
-
console.log(
|
|
1769
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
1890
1770
|
for (const d of decisions) {
|
|
1891
1771
|
const color = getDecisionStatusColor(d.status);
|
|
1892
|
-
const draft = d.reviewState && d.reviewState !== "CONFIRMED" ?
|
|
1772
|
+
const draft = d.reviewState && d.reviewState !== "CONFIRMED" ? chalk2.yellow(` [${d.reviewState.toLowerCase()}]`) : "";
|
|
1893
1773
|
console.log(
|
|
1894
|
-
` ${
|
|
1774
|
+
` ${chalk2.gray(d.label)} ${chalk2.bold(d.statement)}${draft} ${chalk2[color](`[${d.status}]`)}`
|
|
1895
1775
|
);
|
|
1896
|
-
console.log(
|
|
1776
|
+
console.log(chalk2.gray(` ID: ${d.id}`));
|
|
1897
1777
|
const context = [
|
|
1898
1778
|
d.product ? `Product: ${d.product.name}` : null,
|
|
1899
1779
|
d.transcriptionSession ? `Meeting: ${d.transcriptionSession.title ?? d.transcriptionSession.id}` : null,
|
|
@@ -1902,7 +1782,7 @@ Decisions (${decisions.length} total, ${openCount} open question${openCount ===
|
|
|
1902
1782
|
d._count?.links ? `${d._count.links} linked` : null
|
|
1903
1783
|
].filter(Boolean);
|
|
1904
1784
|
if (context.length > 0) {
|
|
1905
|
-
console.log(
|
|
1785
|
+
console.log(chalk2.gray(` ${context.join(" \xB7 ")}`));
|
|
1906
1786
|
}
|
|
1907
1787
|
}
|
|
1908
1788
|
console.log();
|
|
@@ -1932,37 +1812,37 @@ function outputDecisionBatchPretty(results) {
|
|
|
1932
1812
|
const statement = r.statement ?? r.decision?.statement ?? "";
|
|
1933
1813
|
if (r.success) {
|
|
1934
1814
|
console.log(
|
|
1935
|
-
` ${
|
|
1815
|
+
` ${chalk2.green("\u2713")} #${r.index}: ${chalk2.gray(r.decision?.label ?? "")} ${statement}`
|
|
1936
1816
|
);
|
|
1937
1817
|
} else {
|
|
1938
|
-
console.log(` ${
|
|
1818
|
+
console.log(` ${chalk2.red("\u2717")} #${r.index}: ${statement} \u2014 ${r.error ?? "failed"}`);
|
|
1939
1819
|
}
|
|
1940
1820
|
}
|
|
1941
1821
|
const ok = results.filter((r) => r.success).length;
|
|
1942
|
-
console.log(
|
|
1822
|
+
console.log(chalk2.bold(`
|
|
1943
1823
|
${ok}/${results.length} decisions logged`));
|
|
1944
1824
|
}
|
|
1945
1825
|
function outputRequirementJson(requirement) {
|
|
1946
1826
|
console.log(JSON.stringify(requirement, null, 2));
|
|
1947
1827
|
}
|
|
1948
1828
|
function outputRequirementPretty(requirement) {
|
|
1949
|
-
const met = requirement.checkedAt ?
|
|
1950
|
-
const kind = requirement.kind ?
|
|
1829
|
+
const met = requirement.checkedAt ? chalk2.green("[met]") : chalk2.gray("[unmet]");
|
|
1830
|
+
const kind = requirement.kind ? chalk2.gray(` (${requirement.kind})`) : "";
|
|
1951
1831
|
console.log(` ${met} ${requirement.statement}${kind}`);
|
|
1952
|
-
console.log(
|
|
1832
|
+
console.log(chalk2.gray(` ID: ${requirement.id}`));
|
|
1953
1833
|
}
|
|
1954
1834
|
function outputRequirementsJson(requirements) {
|
|
1955
1835
|
console.log(JSON.stringify({ requirements, total: requirements.length }, null, 2));
|
|
1956
1836
|
}
|
|
1957
1837
|
function outputRequirementsPretty(requirements) {
|
|
1958
1838
|
if (requirements.length === 0) {
|
|
1959
|
-
console.log(
|
|
1839
|
+
console.log(chalk2.gray("No requirements found."));
|
|
1960
1840
|
return;
|
|
1961
1841
|
}
|
|
1962
1842
|
const metCount = requirements.filter((r) => r.checkedAt).length;
|
|
1963
|
-
console.log(
|
|
1843
|
+
console.log(chalk2.bold(`
|
|
1964
1844
|
Requirements (${metCount}/${requirements.length} met)`));
|
|
1965
|
-
console.log(
|
|
1845
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
1966
1846
|
for (const r of requirements) {
|
|
1967
1847
|
outputRequirementPretty(r);
|
|
1968
1848
|
}
|
|
@@ -1979,13 +1859,13 @@ function outputRequirementBatchJson(results) {
|
|
|
1979
1859
|
function outputRequirementBatchPretty(results) {
|
|
1980
1860
|
for (const r of results) {
|
|
1981
1861
|
if (r.success) {
|
|
1982
|
-
console.log(` ${
|
|
1862
|
+
console.log(` ${chalk2.green("\u2713")} #${r.index}: ${r.requirement?.statement ?? ""}`);
|
|
1983
1863
|
} else {
|
|
1984
|
-
console.log(` ${
|
|
1864
|
+
console.log(` ${chalk2.red("\u2717")} #${r.index}: ${r.error ?? "failed"}`);
|
|
1985
1865
|
}
|
|
1986
1866
|
}
|
|
1987
1867
|
const ok = results.filter((r) => r.success).length;
|
|
1988
|
-
console.log(
|
|
1868
|
+
console.log(chalk2.bold(`
|
|
1989
1869
|
${ok}/${results.length} requirements added`));
|
|
1990
1870
|
}
|
|
1991
1871
|
function getScopeStatusColor(status) {
|
|
@@ -2006,9 +1886,9 @@ function outputScopeJson(scope) {
|
|
|
2006
1886
|
console.log(JSON.stringify(scope, null, 2));
|
|
2007
1887
|
}
|
|
2008
1888
|
function outputScopePretty(scope) {
|
|
2009
|
-
const badge =
|
|
2010
|
-
console.log(` ${badge} ${
|
|
2011
|
-
console.log(
|
|
1889
|
+
const badge = chalk2[getScopeStatusColor(scope.status)](`[${scope.status}]`);
|
|
1890
|
+
console.log(` ${badge} ${chalk2.bold(scope.version)}`);
|
|
1891
|
+
console.log(chalk2.gray(` ID: ${scope.id}`));
|
|
2012
1892
|
if (scope.description) {
|
|
2013
1893
|
console.log(` ${scope.description.substring(0, 120)}${scope.description.length > 120 ? "..." : ""}`);
|
|
2014
1894
|
}
|
|
@@ -2018,12 +1898,12 @@ function outputScopesJson(scopes) {
|
|
|
2018
1898
|
}
|
|
2019
1899
|
function outputScopesPretty(scopes) {
|
|
2020
1900
|
if (scopes.length === 0) {
|
|
2021
|
-
console.log(
|
|
1901
|
+
console.log(chalk2.gray("No scopes found."));
|
|
2022
1902
|
return;
|
|
2023
1903
|
}
|
|
2024
|
-
console.log(
|
|
1904
|
+
console.log(chalk2.bold(`
|
|
2025
1905
|
Scopes (${scopes.length} total)`));
|
|
2026
|
-
console.log(
|
|
1906
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
2027
1907
|
for (const s of scopes) {
|
|
2028
1908
|
outputScopePretty(s);
|
|
2029
1909
|
}
|
|
@@ -2101,24 +1981,24 @@ function outputGoalJson(goal) {
|
|
|
2101
1981
|
console.log(JSON.stringify(transformGoal(goal), null, 2));
|
|
2102
1982
|
}
|
|
2103
1983
|
function outputGoalPretty(goal) {
|
|
2104
|
-
console.log(
|
|
2105
|
-
const badge =
|
|
1984
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
1985
|
+
const badge = chalk2[getGoalStatusColor(goal.status)](`[${goal.status}]`);
|
|
2106
1986
|
console.log(`
|
|
2107
|
-
${badge} ${
|
|
2108
|
-
if (goal.period) console.log(` ${
|
|
1987
|
+
${badge} ${chalk2.bold(goal.title)} ${chalk2.gray(`#${goal.id}`)}`);
|
|
1988
|
+
if (goal.period) console.log(` ${chalk2.gray("Period:")} ${goal.period}`);
|
|
2109
1989
|
const health = goal.healthOverride ?? goal.health;
|
|
2110
|
-
if (health) console.log(` ${
|
|
1990
|
+
if (health) console.log(` ${chalk2.gray("Health:")} ${health}`);
|
|
2111
1991
|
if (goal.description) {
|
|
2112
|
-
console.log(` ${
|
|
1992
|
+
console.log(` ${chalk2.gray("Description:")} ${goal.description.substring(0, 200)}${goal.description.length > 200 ? "..." : ""}`);
|
|
2113
1993
|
}
|
|
2114
1994
|
if (goal.parentGoal) {
|
|
2115
|
-
console.log(` ${
|
|
1995
|
+
console.log(` ${chalk2.gray("Parent:")} ${goal.parentGoal.title} ${chalk2.gray(`#${goal.parentGoal.id}`)}`);
|
|
2116
1996
|
}
|
|
2117
1997
|
if (goal.projects?.length) {
|
|
2118
|
-
console.log(` ${
|
|
1998
|
+
console.log(` ${chalk2.cyan("Projects:")} ${goal.projects.map((p) => p.name).join(", ")}`);
|
|
2119
1999
|
}
|
|
2120
2000
|
if (goal.childGoals?.length) {
|
|
2121
|
-
console.log(` ${
|
|
2001
|
+
console.log(` ${chalk2.cyan("Sub-goals:")} ${goal.childGoals.length}`);
|
|
2122
2002
|
}
|
|
2123
2003
|
console.log();
|
|
2124
2004
|
}
|
|
@@ -2130,18 +2010,18 @@ function outputGoalsJson(goals) {
|
|
|
2130
2010
|
}
|
|
2131
2011
|
function outputGoalsPretty(goals) {
|
|
2132
2012
|
if (goals.length === 0) {
|
|
2133
|
-
console.log(
|
|
2013
|
+
console.log(chalk2.gray("No goals found."));
|
|
2134
2014
|
return;
|
|
2135
2015
|
}
|
|
2136
|
-
console.log(
|
|
2016
|
+
console.log(chalk2.bold(`
|
|
2137
2017
|
Goals (${goals.length} total)`));
|
|
2138
|
-
console.log(
|
|
2018
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
2139
2019
|
for (const g of goals) {
|
|
2140
|
-
const badge =
|
|
2141
|
-
const period = g.period ?
|
|
2142
|
-
const krs = g._count?.keyResults ?
|
|
2143
|
-
console.log(` ${badge}${period} ${
|
|
2144
|
-
console.log(
|
|
2020
|
+
const badge = chalk2[getGoalStatusColor(g.status)](`[${g.status}]`);
|
|
2021
|
+
const period = g.period ? chalk2.gray(` ${g.period}`) : "";
|
|
2022
|
+
const krs = g._count?.keyResults ? chalk2.gray(` \u2014 ${g._count.keyResults} KRs`) : "";
|
|
2023
|
+
console.log(` ${badge}${period} ${chalk2.bold(g.title)}${krs}`);
|
|
2024
|
+
console.log(chalk2.gray(` ID: ${g.id}`));
|
|
2145
2025
|
}
|
|
2146
2026
|
console.log();
|
|
2147
2027
|
}
|
|
@@ -2165,17 +2045,17 @@ function outputGoalTreeJson(nodes) {
|
|
|
2165
2045
|
}
|
|
2166
2046
|
function outputGoalTreePretty(nodes) {
|
|
2167
2047
|
if (nodes.length === 0) {
|
|
2168
|
-
console.log(
|
|
2048
|
+
console.log(chalk2.gray("No goals found."));
|
|
2169
2049
|
return;
|
|
2170
2050
|
}
|
|
2171
|
-
console.log(
|
|
2172
|
-
console.log(
|
|
2051
|
+
console.log(chalk2.bold("\nGoal tree"));
|
|
2052
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
2173
2053
|
const walk = (node, depth) => {
|
|
2174
2054
|
const pad = " ".repeat(depth + 1);
|
|
2175
|
-
const badge =
|
|
2176
|
-
const period = node.period ?
|
|
2177
|
-
const krs = node.keyResults?.length ?
|
|
2178
|
-
console.log(`${pad}${depth > 0 ? "\u2514 " : ""}${badge}${period} ${
|
|
2055
|
+
const badge = chalk2[getGoalStatusColor(node.status)](`[${node.status}]`);
|
|
2056
|
+
const period = node.period ? chalk2.gray(` ${node.period}`) : "";
|
|
2057
|
+
const krs = node.keyResults?.length ? chalk2.gray(` \u2014 ${node.keyResults.length} KRs`) : "";
|
|
2058
|
+
console.log(`${pad}${depth > 0 ? "\u2514 " : ""}${badge}${period} ${chalk2.bold(node.title)} ${chalk2.gray(`#${node.id}`)}${krs}`);
|
|
2179
2059
|
for (const child of node.childGoals ?? []) {
|
|
2180
2060
|
walk(child, depth + 1);
|
|
2181
2061
|
}
|
|
@@ -2187,11 +2067,11 @@ function outputGoalPeriodsJson(periods) {
|
|
|
2187
2067
|
console.log(JSON.stringify({ periods, total: periods.length }, null, 2));
|
|
2188
2068
|
}
|
|
2189
2069
|
function outputGoalPeriodsPretty(periods) {
|
|
2190
|
-
console.log(
|
|
2070
|
+
console.log(chalk2.bold(`
|
|
2191
2071
|
Periods (${periods.length} total)`));
|
|
2192
|
-
console.log(
|
|
2072
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
2193
2073
|
for (const p of periods) {
|
|
2194
|
-
console.log(` ${
|
|
2074
|
+
console.log(` ${chalk2.bold(p.value)} ${chalk2.gray(p.label)}`);
|
|
2195
2075
|
}
|
|
2196
2076
|
console.log();
|
|
2197
2077
|
}
|
|
@@ -2202,19 +2082,19 @@ function outputGoalStatsJson(stats) {
|
|
|
2202
2082
|
}, null, 2));
|
|
2203
2083
|
}
|
|
2204
2084
|
function outputGoalStatsPretty(stats) {
|
|
2205
|
-
console.log(
|
|
2206
|
-
console.log(
|
|
2207
|
-
console.log(` ${
|
|
2208
|
-
console.log(` ${
|
|
2085
|
+
console.log(chalk2.bold("\nOKR stats"));
|
|
2086
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
2087
|
+
console.log(` ${chalk2.gray("Objectives:")} ${stats.totalObjectives}`);
|
|
2088
|
+
console.log(` ${chalk2.gray("Key results:")} ${stats.totalKeyResults} (${stats.completedKeyResults} achieved)`);
|
|
2209
2089
|
console.log(
|
|
2210
|
-
` ${
|
|
2090
|
+
` ${chalk2.gray("Breakdown:")} ${chalk2.green(`${stats.statusBreakdown.onTrack} on-track`)}, ${chalk2.yellow(`${stats.statusBreakdown.atRisk} at-risk`)}, ${chalk2.red(`${stats.statusBreakdown.offTrack} off-track`)}, ${chalk2.green(`${stats.statusBreakdown.achieved} achieved`)}`
|
|
2211
2091
|
);
|
|
2212
|
-
console.log(` ${
|
|
2092
|
+
console.log(` ${chalk2.gray("Avg progress:")} ${stats.averageProgress}%`);
|
|
2213
2093
|
if (stats.averageConfidence != null) {
|
|
2214
|
-
console.log(` ${
|
|
2094
|
+
console.log(` ${chalk2.gray("Avg confidence:")} ${stats.averageConfidence}%`);
|
|
2215
2095
|
}
|
|
2216
2096
|
if (stats.periodEndDate) {
|
|
2217
|
-
console.log(` ${
|
|
2097
|
+
console.log(` ${chalk2.gray("Period ends:")} ${new Date(stats.periodEndDate).toISOString().slice(0, 10)}`);
|
|
2218
2098
|
}
|
|
2219
2099
|
console.log();
|
|
2220
2100
|
}
|
|
@@ -2257,19 +2137,19 @@ function outputKeyResultJson(kr) {
|
|
|
2257
2137
|
}
|
|
2258
2138
|
function outputKeyResultPretty(kr) {
|
|
2259
2139
|
const status = kr.statusOverride ?? kr.status;
|
|
2260
|
-
const badge =
|
|
2261
|
-
console.log(` ${badge} ${
|
|
2140
|
+
const badge = chalk2[getKeyResultStatusColor(status)](`[${status}]`);
|
|
2141
|
+
console.log(` ${badge} ${chalk2.bold(kr.title)}`);
|
|
2262
2142
|
console.log(
|
|
2263
|
-
|
|
2143
|
+
chalk2.gray(
|
|
2264
2144
|
` ${kr.currentValue}/${kr.targetValue} ${kr.unit} (${keyResultProgress(kr)}%)${kr.period ? ` \xB7 ${kr.period}` : ""} \xB7 objective #${kr.goalId}`
|
|
2265
2145
|
)
|
|
2266
2146
|
);
|
|
2267
|
-
console.log(
|
|
2147
|
+
console.log(chalk2.gray(` ID: ${kr.id}`));
|
|
2268
2148
|
if (kr.projects?.length) {
|
|
2269
|
-
console.log(
|
|
2149
|
+
console.log(chalk2.gray(` Projects: ${kr.projects.map((l) => l.project?.name ?? l.projectId).join(", ")}`));
|
|
2270
2150
|
}
|
|
2271
2151
|
if (kr.features?.length) {
|
|
2272
|
-
console.log(
|
|
2152
|
+
console.log(chalk2.gray(` Features: ${kr.features.map((l) => l.feature?.name ?? l.featureId).join(", ")}`));
|
|
2273
2153
|
}
|
|
2274
2154
|
}
|
|
2275
2155
|
function outputKeyResultsJson(keyResults) {
|
|
@@ -2280,12 +2160,12 @@ function outputKeyResultsJson(keyResults) {
|
|
|
2280
2160
|
}
|
|
2281
2161
|
function outputKeyResultsPretty(keyResults) {
|
|
2282
2162
|
if (keyResults.length === 0) {
|
|
2283
|
-
console.log(
|
|
2163
|
+
console.log(chalk2.gray("No key results found."));
|
|
2284
2164
|
return;
|
|
2285
2165
|
}
|
|
2286
|
-
console.log(
|
|
2166
|
+
console.log(chalk2.bold(`
|
|
2287
2167
|
Key results (${keyResults.length} total)`));
|
|
2288
|
-
console.log(
|
|
2168
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
2289
2169
|
for (const kr of keyResults) {
|
|
2290
2170
|
outputKeyResultPretty(kr);
|
|
2291
2171
|
}
|
|
@@ -2302,9 +2182,9 @@ function outputCheckInJson(checkIn) {
|
|
|
2302
2182
|
}, null, 2));
|
|
2303
2183
|
}
|
|
2304
2184
|
function outputCheckInPretty(checkIn) {
|
|
2305
|
-
console.log(` ${
|
|
2306
|
-
if (checkIn.notes) console.log(` ${
|
|
2307
|
-
console.log(
|
|
2185
|
+
console.log(` ${chalk2.gray("Value:")} ${checkIn.previousValue} \u2192 ${chalk2.bold(String(checkIn.newValue))}`);
|
|
2186
|
+
if (checkIn.notes) console.log(` ${chalk2.gray("Note:")} ${checkIn.notes}`);
|
|
2187
|
+
console.log(chalk2.gray(` Check-in ID: ${checkIn.id}`));
|
|
2308
2188
|
console.log();
|
|
2309
2189
|
}
|
|
2310
2190
|
function transformObjective(objective) {
|
|
@@ -2337,31 +2217,31 @@ function outputObjectivesJson(objectives) {
|
|
|
2337
2217
|
}
|
|
2338
2218
|
function outputObjectivesPretty(objectives) {
|
|
2339
2219
|
if (objectives.length === 0) {
|
|
2340
|
-
console.log(
|
|
2220
|
+
console.log(chalk2.gray("No OKRs found."));
|
|
2341
2221
|
return;
|
|
2342
2222
|
}
|
|
2343
2223
|
const totalKeyResults = objectives.reduce((n, o) => n + o.keyResults.length, 0);
|
|
2344
2224
|
console.log(
|
|
2345
|
-
|
|
2225
|
+
chalk2.bold(`
|
|
2346
2226
|
OKRs (${objectives.length} objectives, ${totalKeyResults} key results)`)
|
|
2347
2227
|
);
|
|
2348
|
-
console.log(
|
|
2228
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
2349
2229
|
for (const o of objectives) {
|
|
2350
|
-
const badge =
|
|
2351
|
-
const period = o.period ?
|
|
2230
|
+
const badge = chalk2[getGoalStatusColor(o.status)](`[${o.status}]`);
|
|
2231
|
+
const period = o.period ? chalk2.gray(` ${o.period}`) : "";
|
|
2352
2232
|
console.log(
|
|
2353
2233
|
`
|
|
2354
|
-
${badge}${period} ${
|
|
2234
|
+
${badge}${period} ${chalk2.bold(o.title)} ${chalk2.gray(`#${o.id}`)} ${chalk2.gray(`${o.progress}%`)}`
|
|
2355
2235
|
);
|
|
2356
2236
|
if (o.keyResults.length === 0) {
|
|
2357
|
-
console.log(
|
|
2237
|
+
console.log(chalk2.gray(" (no key results)"));
|
|
2358
2238
|
continue;
|
|
2359
2239
|
}
|
|
2360
2240
|
for (const kr of o.keyResults) {
|
|
2361
2241
|
const krStatus = kr.statusOverride ?? kr.status;
|
|
2362
|
-
const krBadge =
|
|
2363
|
-
console.log(` ${krBadge} ${kr.title} ${
|
|
2364
|
-
console.log(
|
|
2242
|
+
const krBadge = chalk2[getKeyResultStatusColor(krStatus)](`[${krStatus}]`);
|
|
2243
|
+
console.log(` ${krBadge} ${kr.title} ${chalk2.gray(`${kr.currentValue}/${kr.targetValue} ${kr.unit}`)}`);
|
|
2244
|
+
console.log(chalk2.gray(` ID: ${kr.id}`));
|
|
2365
2245
|
}
|
|
2366
2246
|
}
|
|
2367
2247
|
console.log();
|
|
@@ -2390,36 +2270,36 @@ function outputProjectJson(project) {
|
|
|
2390
2270
|
}, null, 2));
|
|
2391
2271
|
}
|
|
2392
2272
|
function outputProjectPretty(project) {
|
|
2393
|
-
console.log(
|
|
2273
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
2394
2274
|
console.log(`
|
|
2395
|
-
${
|
|
2396
|
-
console.log(
|
|
2397
|
-
if (project.status) console.log(` ${
|
|
2398
|
-
if (project.priority) console.log(` ${
|
|
2275
|
+
${chalk2.bold(project.name)}`);
|
|
2276
|
+
console.log(chalk2.gray(` ID: ${project.id}`));
|
|
2277
|
+
if (project.status) console.log(` ${chalk2.cyan("Status:")} ${project.status}`);
|
|
2278
|
+
if (project.priority) console.log(` ${chalk2.magenta("Priority:")} ${project.priority}`);
|
|
2399
2279
|
if (project.workspace) {
|
|
2400
|
-
console.log(` ${
|
|
2280
|
+
console.log(` ${chalk2.yellow("Workspace:")} ${project.workspace.name} (${project.workspace.slug})`);
|
|
2401
2281
|
}
|
|
2402
2282
|
if (project.description) {
|
|
2403
|
-
console.log(` ${
|
|
2283
|
+
console.log(` ${chalk2.gray("Description:")} ${project.description.substring(0, 200)}${project.description.length > 200 ? "..." : ""}`);
|
|
2404
2284
|
}
|
|
2405
2285
|
if (project.dri) {
|
|
2406
|
-
console.log(` ${
|
|
2286
|
+
console.log(` ${chalk2.magenta("DRI:")} ${project.dri.name ?? project.dri.email ?? project.dri.id}`);
|
|
2407
2287
|
}
|
|
2408
2288
|
if (project.goals?.length) {
|
|
2409
|
-
console.log(` ${
|
|
2289
|
+
console.log(` ${chalk2.cyan("Objectives:")}`);
|
|
2410
2290
|
for (const g of project.goals) {
|
|
2411
2291
|
console.log(` - #${g.id} ${g.title}`);
|
|
2412
2292
|
}
|
|
2413
2293
|
}
|
|
2414
2294
|
if (project.keyResults?.length) {
|
|
2415
|
-
console.log(` ${
|
|
2295
|
+
console.log(` ${chalk2.cyan("Key results:")}`);
|
|
2416
2296
|
for (const k of project.keyResults) {
|
|
2417
|
-
const objective = k.keyResult?.goal ?
|
|
2418
|
-
console.log(` - ${k.keyResult?.title ?? k.keyResultId} ${
|
|
2297
|
+
const objective = k.keyResult?.goal ? chalk2.gray(` (objective #${k.keyResult.goal.id})`) : "";
|
|
2298
|
+
console.log(` - ${k.keyResult?.title ?? k.keyResultId} ${chalk2.gray(`[${k.keyResultId}]`)}${objective}`);
|
|
2419
2299
|
}
|
|
2420
2300
|
}
|
|
2421
2301
|
if (project.actions?.length) {
|
|
2422
|
-
console.log(` ${
|
|
2302
|
+
console.log(` ${chalk2.cyan("Actions:")} ${project.actions.length}`);
|
|
2423
2303
|
}
|
|
2424
2304
|
console.log();
|
|
2425
2305
|
}
|
|
@@ -2459,7 +2339,7 @@ function transformTimeEntry(entry) {
|
|
|
2459
2339
|
};
|
|
2460
2340
|
}
|
|
2461
2341
|
function statusBadge(status) {
|
|
2462
|
-
return status === "PROPOSED" ?
|
|
2342
|
+
return status === "PROPOSED" ? chalk2.yellow("[PROPOSED]") : chalk2.green("[CONFIRMED]");
|
|
2463
2343
|
}
|
|
2464
2344
|
function outputTimeLogJson(result) {
|
|
2465
2345
|
console.log(
|
|
@@ -2478,34 +2358,34 @@ function outputTimeLogJson(result) {
|
|
|
2478
2358
|
function outputTimeLogPretty(result) {
|
|
2479
2359
|
if (result.outcome === "merged") {
|
|
2480
2360
|
console.log(
|
|
2481
|
-
`${
|
|
2361
|
+
`${chalk2.green("\u2713")} Merged into your manual time (${(result.mergedInto ?? []).length} entr${(result.mergedInto ?? []).length === 1 ? "y" : "ies"} annotated); nothing new written.`
|
|
2482
2362
|
);
|
|
2483
2363
|
return;
|
|
2484
2364
|
}
|
|
2485
2365
|
if (result.outcome === "dropped" || !result.entry) {
|
|
2486
|
-
console.log(`${
|
|
2366
|
+
console.log(`${chalk2.yellow("\u2013")} Dropped: your manual time already covers every minute of it.`);
|
|
2487
2367
|
return;
|
|
2488
2368
|
}
|
|
2489
2369
|
const pieces = result.pieces && result.pieces.length > 0 ? result.pieces : [result.entry];
|
|
2490
2370
|
const verb = { created: "Logged", updated: "Updated", left: "Left untouched (already confirmed)" }[result.outcome] ?? result.outcome;
|
|
2491
2371
|
for (const e of pieces) {
|
|
2492
2372
|
console.log(
|
|
2493
|
-
`${
|
|
2373
|
+
`${chalk2.green("\u2713")} ${verb}: ${clock(e.startedAt)}\u2013${e.endedAt ? clock(e.endedAt) : "now"} ${chalk2.bold(formatMinutes(entryMinutes(e)))} ${statusBadge(e.status)} ${e.action?.name ?? e.actionId}`
|
|
2494
2374
|
);
|
|
2495
|
-
if (e.note) console.log(
|
|
2496
|
-
console.log(
|
|
2375
|
+
if (e.note) console.log(chalk2.gray(` ${e.note}`));
|
|
2376
|
+
console.log(chalk2.gray(` ID: ${e.id}${e.sourceRef ? ` ref: ${e.sourceRef}` : ""} owner: ${e.userId}`));
|
|
2497
2377
|
}
|
|
2498
|
-
if (pieces.length > 1) console.log(
|
|
2378
|
+
if (pieces.length > 1) console.log(chalk2.gray(` split into ${pieces.length} pieces around your manual time`));
|
|
2499
2379
|
}
|
|
2500
2380
|
function outputTimeConfirmJson(result, date) {
|
|
2501
2381
|
console.log(JSON.stringify({ date, confirmed: result.confirmed }, null, 2));
|
|
2502
2382
|
}
|
|
2503
2383
|
function outputTimeConfirmPretty(result, date) {
|
|
2504
2384
|
if (result.confirmed === 0) {
|
|
2505
|
-
console.log(
|
|
2385
|
+
console.log(chalk2.gray(`Nothing proposed on ${date}; nothing to confirm.`));
|
|
2506
2386
|
return;
|
|
2507
2387
|
}
|
|
2508
|
-
console.log(`${
|
|
2388
|
+
console.log(`${chalk2.green("\u2713")} Confirmed ${result.confirmed} ${result.confirmed === 1 ? "entry" : "entries"} on ${date}.`);
|
|
2509
2389
|
}
|
|
2510
2390
|
function outputTimeEntriesJson(entries, date) {
|
|
2511
2391
|
const rows = entries.map(transformTimeEntry);
|
|
@@ -2525,10 +2405,10 @@ function outputTimeEntriesJson(entries, date) {
|
|
|
2525
2405
|
}
|
|
2526
2406
|
function outputTimeEntriesPretty(entries, date) {
|
|
2527
2407
|
if (entries.length === 0) {
|
|
2528
|
-
console.log(
|
|
2408
|
+
console.log(chalk2.gray(`No time entries on ${date}.`));
|
|
2529
2409
|
return;
|
|
2530
2410
|
}
|
|
2531
|
-
console.log(
|
|
2411
|
+
console.log(chalk2.bold(`
|
|
2532
2412
|
Time on ${date}
|
|
2533
2413
|
`));
|
|
2534
2414
|
let total = 0;
|
|
@@ -2537,14 +2417,14 @@ Time on ${date}
|
|
|
2537
2417
|
total += mins;
|
|
2538
2418
|
const range = `${clock(e.startedAt)}\u2013${e.endedAt ? clock(e.endedAt) : "now"}`;
|
|
2539
2419
|
console.log(
|
|
2540
|
-
` ${range} ${
|
|
2420
|
+
` ${range} ${chalk2.bold(formatMinutes(mins).padStart(6))} ${statusBadge(e.status)} ${e.action?.name ?? e.actionId}${e.note ? chalk2.gray(` \xB7 ${e.note}`) : ""}`
|
|
2541
2421
|
);
|
|
2542
|
-
console.log(
|
|
2422
|
+
console.log(chalk2.gray(` ${e.id} ${e.source}${e.sourceRef ? ` ${e.sourceRef}` : ""}`));
|
|
2543
2423
|
}
|
|
2544
2424
|
const proposed = entries.filter((e) => e.status === "PROPOSED").length;
|
|
2545
2425
|
console.log(
|
|
2546
|
-
|
|
2547
|
-
${formatMinutes(total)} across ${entries.length} entries`) + (proposed > 0 ?
|
|
2426
|
+
chalk2.bold(`
|
|
2427
|
+
${formatMinutes(total)} across ${entries.length} entries`) + (proposed > 0 ? chalk2.yellow(`, ${proposed} proposed`) : "")
|
|
2548
2428
|
);
|
|
2549
2429
|
}
|
|
2550
2430
|
function outputTimeBatchJson(results) {
|
|
@@ -2573,14 +2453,14 @@ function outputTimeBatchPretty(results) {
|
|
|
2573
2453
|
const ref = r.sourceRef ?? r.entry?.sourceRef ?? "";
|
|
2574
2454
|
if (r.success && r.entry) {
|
|
2575
2455
|
console.log(
|
|
2576
|
-
` ${
|
|
2456
|
+
` ${chalk2.green("\u2713")} #${r.index}: ${chalk2.gray(r.outcome ?? "")} ${clock(r.entry.startedAt)}\u2013${r.entry.endedAt ? clock(r.entry.endedAt) : "now"} ${r.entry.action?.name ?? r.entry.actionId}${ref ? chalk2.gray(` ${ref}`) : ""}`
|
|
2577
2457
|
);
|
|
2578
2458
|
} else {
|
|
2579
|
-
console.log(` ${
|
|
2459
|
+
console.log(` ${chalk2.red("\u2717")} #${r.index}: ${ref} \u2014 ${r.error ?? "failed"}`);
|
|
2580
2460
|
}
|
|
2581
2461
|
}
|
|
2582
2462
|
const ok = results.filter((r) => r.success).length;
|
|
2583
|
-
console.log(
|
|
2463
|
+
console.log(chalk2.bold(`
|
|
2584
2464
|
${ok}/${results.length} entries logged`));
|
|
2585
2465
|
}
|
|
2586
2466
|
function outputDayReportJson(report, date) {
|
|
@@ -2611,28 +2491,28 @@ function outputDayReportJson(report, date) {
|
|
|
2611
2491
|
);
|
|
2612
2492
|
}
|
|
2613
2493
|
function outputDayReportPretty(report, date) {
|
|
2614
|
-
console.log(
|
|
2494
|
+
console.log(chalk2.bold(`
|
|
2615
2495
|
${date}`));
|
|
2616
2496
|
console.log(
|
|
2617
|
-
` ${
|
|
2497
|
+
` ${chalk2.bold(formatMinutes(report.attentionMinutes))} attention \xB7 ${formatMinutes(report.sessionMinutes)} session \xB7 ${formatMinutes(report.agentRunMinutes)} agent-run` + (report.proposedCount > 0 ? chalk2.yellow(` \xB7 ${report.proposedCount} proposed`) : "") + (report.unassignedCount > 0 ? chalk2.yellow(` \xB7 ${report.unassignedCount} unassigned`) : "")
|
|
2618
2498
|
);
|
|
2619
2499
|
if (report.entries.length === 0) {
|
|
2620
|
-
console.log(
|
|
2500
|
+
console.log(chalk2.gray(" No time recorded."));
|
|
2621
2501
|
return;
|
|
2622
2502
|
}
|
|
2623
|
-
console.log(
|
|
2503
|
+
console.log(chalk2.bold("\nBy product"));
|
|
2624
2504
|
for (const row of report.byProduct) {
|
|
2625
|
-
console.log(` ${formatMinutes(row.minutes).padStart(7)} ${row.productId ? row.name :
|
|
2505
|
+
console.log(` ${formatMinutes(row.minutes).padStart(7)} ${row.productId ? row.name : chalk2.yellow(row.name)}`);
|
|
2626
2506
|
}
|
|
2627
|
-
console.log(
|
|
2507
|
+
console.log(chalk2.bold("\nBy action"));
|
|
2628
2508
|
for (const row of report.byAction) {
|
|
2629
|
-
const ticket = row.ticket ?
|
|
2630
|
-
const agent = row.agentRunMinutes > 0 ?
|
|
2631
|
-
const proposed = row.proposedCount > 0 ?
|
|
2509
|
+
const ticket = row.ticket ? chalk2.gray(` ${row.ticket.shortId ?? `#${row.ticket.number}`}`) : row.projectId ? chalk2.gray(` \xB7 ${row.projectName ?? "project"}`) : chalk2.yellow(" [unassigned]");
|
|
2510
|
+
const agent = row.agentRunMinutes > 0 ? chalk2.gray(` (+${formatMinutes(row.agentRunMinutes)} agent-run)`) : "";
|
|
2511
|
+
const proposed = row.proposedCount > 0 ? chalk2.yellow(` ${row.proposedCount} proposed`) : "";
|
|
2632
2512
|
console.log(` ${formatMinutes(row.minutes).padStart(7)} ${row.name}${ticket}${agent}${proposed}`);
|
|
2633
2513
|
}
|
|
2634
2514
|
if (report.flags.length > 0) {
|
|
2635
|
-
console.log(
|
|
2515
|
+
console.log(chalk2.yellow(`
|
|
2636
2516
|
${report.flags.length} manual entr${report.flags.length === 1 ? "y looks" : "ies look"} like a forgotten timer`));
|
|
2637
2517
|
}
|
|
2638
2518
|
}
|
|
@@ -2666,12 +2546,12 @@ function outputResourceJson(resource) {
|
|
|
2666
2546
|
console.log(JSON.stringify(transformResource(resource), null, 2));
|
|
2667
2547
|
}
|
|
2668
2548
|
function outputResourcePretty(resource) {
|
|
2669
|
-
const badge =
|
|
2670
|
-
console.log(` ${badge} ${
|
|
2671
|
-
if (resource.url) console.log(
|
|
2549
|
+
const badge = chalk2.gray(`[${resource.readStatus}]`);
|
|
2550
|
+
console.log(` ${badge} ${chalk2.bold(resource.title)}`);
|
|
2551
|
+
if (resource.url) console.log(chalk2.gray(` ${resource.url}`));
|
|
2672
2552
|
if (resource.description) console.log(` ${resource.description}`);
|
|
2673
|
-
if (resource.tags?.length) console.log(
|
|
2674
|
-
console.log(
|
|
2553
|
+
if (resource.tags?.length) console.log(chalk2.cyan(` ${formatResourceTags(resource.tags)}`));
|
|
2554
|
+
console.log(chalk2.gray(` ID: ${resource.id}`));
|
|
2675
2555
|
}
|
|
2676
2556
|
function outputResourcesJson(resources, filters = {}) {
|
|
2677
2557
|
console.log(
|
|
@@ -2681,19 +2561,19 @@ function outputResourcesJson(resources, filters = {}) {
|
|
|
2681
2561
|
function outputResourcesPretty(resources, status) {
|
|
2682
2562
|
const heading = status === "unread" ? "Reading list" : status === "all" ? "Resources" : `Resources (${status})`;
|
|
2683
2563
|
if (resources.length === 0) {
|
|
2684
|
-
console.log(
|
|
2564
|
+
console.log(chalk2.gray(status === "unread" ? "Nothing to read." : "No resources found."));
|
|
2685
2565
|
return;
|
|
2686
2566
|
}
|
|
2687
|
-
console.log(
|
|
2567
|
+
console.log(chalk2.bold(`
|
|
2688
2568
|
${heading} (${resources.length} total)`));
|
|
2689
|
-
console.log(
|
|
2569
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
2690
2570
|
for (const r of resources) {
|
|
2691
2571
|
const when = r.readStatus === "read" && r.readAt ? new Date(r.readAt) : new Date(r.createdAt);
|
|
2692
2572
|
const host = hostnameOf(r.url);
|
|
2693
|
-
console.log(` ${
|
|
2694
|
-
if (r.description) console.log(
|
|
2695
|
-
if (r.tags?.length) console.log(
|
|
2696
|
-
console.log(
|
|
2573
|
+
console.log(` ${chalk2.bold(r.title)}${host ? chalk2.gray(` ${host}`) : ""} ${chalk2.gray(when.toLocaleDateString())}`);
|
|
2574
|
+
if (r.description) console.log(chalk2.gray(` ${r.description}`));
|
|
2575
|
+
if (r.tags?.length) console.log(chalk2.cyan(` ${formatResourceTags(r.tags)}`));
|
|
2576
|
+
console.log(chalk2.gray(` ID: ${r.id}`));
|
|
2697
2577
|
}
|
|
2698
2578
|
console.log();
|
|
2699
2579
|
}
|
|
@@ -2702,49 +2582,49 @@ function outputDatabaseJson(database) {
|
|
|
2702
2582
|
}
|
|
2703
2583
|
function describeProperty(p) {
|
|
2704
2584
|
const options = p.options?.length ? ` [${p.options.map((o) => o.name).join(", ")}]` : "";
|
|
2705
|
-
return ` ${p.name} ${
|
|
2585
|
+
return ` ${p.name} ${chalk2.gray(`${p.type} ${p.id}`)}${chalk2.gray(options)}`;
|
|
2706
2586
|
}
|
|
2707
2587
|
function outputDatabasePretty(database) {
|
|
2708
|
-
console.log(
|
|
2588
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
2709
2589
|
console.log(`
|
|
2710
|
-
${
|
|
2711
|
-
console.log(
|
|
2712
|
-
console.log(` ${
|
|
2590
|
+
${chalk2.bold(database.name)}`);
|
|
2591
|
+
console.log(chalk2.gray(` ID: ${database.id}`));
|
|
2592
|
+
console.log(` ${chalk2.gray("Page:")} ${database.page.title} ${chalk2.gray(database.page.id)}`);
|
|
2713
2593
|
const facts = [];
|
|
2714
2594
|
if (typeof database.rowCount === "number") facts.push(`${database.rowCount} row${database.rowCount === 1 ? "" : "s"}`);
|
|
2715
2595
|
if (database.detachedAt) facts.push(`detached ${formatDate(new Date(database.detachedAt))} \u2014 block is out of the page`);
|
|
2716
|
-
if (facts.length) console.log(
|
|
2596
|
+
if (facts.length) console.log(chalk2.gray(` ${facts.join(" \xB7 ")}`));
|
|
2717
2597
|
console.log(`
|
|
2718
|
-
${
|
|
2598
|
+
${chalk2.gray("Properties")}`);
|
|
2719
2599
|
for (const p of database.properties) console.log(describeProperty(p));
|
|
2720
2600
|
const view = database.view;
|
|
2721
2601
|
const viewParts = [];
|
|
2722
2602
|
if (view.sort) viewParts.push(`sort ${view.sort.propertyId} ${view.sort.direction}`);
|
|
2723
2603
|
if (view.filters.length) viewParts.push(`${view.filters.length} filter${view.filters.length === 1 ? "" : "s"}`);
|
|
2724
2604
|
if (view.hiddenPropertyIds.length) viewParts.push(`${view.hiddenPropertyIds.length} hidden`);
|
|
2725
|
-
if (viewParts.length) console.log(
|
|
2605
|
+
if (viewParts.length) console.log(chalk2.gray(`
|
|
2726
2606
|
View: ${viewParts.join(" \xB7 ")}`));
|
|
2727
2607
|
console.log();
|
|
2728
2608
|
}
|
|
2729
2609
|
function outputDatabasesPretty(databases) {
|
|
2730
2610
|
if (databases.length === 0) {
|
|
2731
|
-
console.log(
|
|
2611
|
+
console.log(chalk2.gray("No databases on this page."));
|
|
2732
2612
|
return;
|
|
2733
2613
|
}
|
|
2734
|
-
console.log(
|
|
2614
|
+
console.log(chalk2.bold(`
|
|
2735
2615
|
Databases (${databases.length})`));
|
|
2736
|
-
console.log(
|
|
2616
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
2737
2617
|
for (const d of databases) {
|
|
2738
|
-
const state = d.detachedAt ?
|
|
2739
|
-
const rows = typeof d.rowCount === "number" ?
|
|
2740
|
-
console.log(` ${d.name} ${
|
|
2618
|
+
const state = d.detachedAt ? chalk2.yellow(" detached") : "";
|
|
2619
|
+
const rows = typeof d.rowCount === "number" ? chalk2.gray(` ${d.rowCount} rows`) : "";
|
|
2620
|
+
console.log(` ${d.name} ${chalk2.gray(d.id)}${rows}${state}`);
|
|
2741
2621
|
}
|
|
2742
2622
|
console.log();
|
|
2743
2623
|
}
|
|
2744
2624
|
function formatCell(def, value) {
|
|
2745
|
-
if (value === null || value === void 0 || value === "") return
|
|
2625
|
+
if (value === null || value === void 0 || value === "") return chalk2.gray("\u2014");
|
|
2746
2626
|
if (Array.isArray(value)) {
|
|
2747
|
-
if (value.length === 0) return
|
|
2627
|
+
if (value.length === 0) return chalk2.gray("\u2014");
|
|
2748
2628
|
return value.map((v) => formatCell(def, v)).join(", ");
|
|
2749
2629
|
}
|
|
2750
2630
|
if (def?.options) {
|
|
@@ -2758,42 +2638,42 @@ function outputRowJson(row) {
|
|
|
2758
2638
|
}
|
|
2759
2639
|
function outputRowPretty(row, database) {
|
|
2760
2640
|
console.log(`
|
|
2761
|
-
${
|
|
2641
|
+
${chalk2.bold(row.title || "Untitled")} ${chalk2.gray(row.id)}`);
|
|
2762
2642
|
const defs = database?.properties.filter((p) => p.type !== "title") ?? [];
|
|
2763
2643
|
if (defs.length) {
|
|
2764
2644
|
for (const def of defs) {
|
|
2765
|
-
console.log(` ${
|
|
2645
|
+
console.log(` ${chalk2.gray(`${def.name}:`)} ${formatCell(def, row.values[def.id])}`);
|
|
2766
2646
|
}
|
|
2767
2647
|
} else {
|
|
2768
2648
|
for (const [key, value] of Object.entries(row.values)) {
|
|
2769
|
-
console.log(` ${
|
|
2649
|
+
console.log(` ${chalk2.gray(`${key}:`)} ${formatCell(void 0, value)}`);
|
|
2770
2650
|
}
|
|
2771
2651
|
}
|
|
2772
|
-
console.log(
|
|
2652
|
+
console.log(chalk2.gray(` Read the page: exponential pages get ${row.id}`));
|
|
2773
2653
|
console.log();
|
|
2774
2654
|
}
|
|
2775
2655
|
function outputRowsPretty(page, database) {
|
|
2776
2656
|
if (page.rows.length === 0) {
|
|
2777
|
-
console.log(
|
|
2657
|
+
console.log(chalk2.gray(`No rows in ${database.name}.`));
|
|
2778
2658
|
return;
|
|
2779
2659
|
}
|
|
2780
2660
|
const byId = new Map(database.properties.map((p) => [p.id, p]));
|
|
2781
2661
|
const columns = page.columns.map((id) => byId.get(id)).filter((p) => !!p && p.type !== "title");
|
|
2782
|
-
console.log(
|
|
2662
|
+
console.log(chalk2.bold(`
|
|
2783
2663
|
${database.name} (${page.rows.length} row${page.rows.length === 1 ? "" : "s"}${page.nextCursor ? ", more" : ""})`));
|
|
2784
|
-
console.log(
|
|
2664
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
2785
2665
|
for (const row of page.rows) {
|
|
2786
|
-
const cells = columns.map((c) => `${
|
|
2787
|
-
console.log(` ${
|
|
2666
|
+
const cells = columns.map((c) => `${chalk2.gray(`${c.name}:`)} ${formatCell(c, row.values[c.id])}`);
|
|
2667
|
+
console.log(` ${chalk2.bold(row.title || "Untitled")} ${chalk2.gray(row.id)}`);
|
|
2788
2668
|
if (cells.length) console.log(` ${cells.join(" ")}`);
|
|
2789
2669
|
}
|
|
2790
|
-
if (page.nextCursor) console.log(
|
|
2670
|
+
if (page.nextCursor) console.log(chalk2.gray(`
|
|
2791
2671
|
More: --cursor ${page.nextCursor}`));
|
|
2792
2672
|
console.log();
|
|
2793
2673
|
}
|
|
2794
2674
|
function outputCsvSkipped(skipped) {
|
|
2795
2675
|
if (skipped.length === 0) return;
|
|
2796
|
-
console.log(
|
|
2676
|
+
console.log(chalk2.yellow(`
|
|
2797
2677
|
${skipped.length} row${skipped.length === 1 ? "" : "s"} not imported:`));
|
|
2798
2678
|
for (const row of skipped) {
|
|
2799
2679
|
const why = row.errors.map((e) => `${e.propertyName} ${e.reason}`).join("; ");
|
|
@@ -2801,16 +2681,16 @@ function outputCsvSkipped(skipped) {
|
|
|
2801
2681
|
}
|
|
2802
2682
|
}
|
|
2803
2683
|
function outputCsvPreviewPretty(preview) {
|
|
2804
|
-
console.log(
|
|
2684
|
+
console.log(chalk2.bold(`
|
|
2805
2685
|
CSV preview: ${preview.importable} of ${preview.total} row${preview.total === 1 ? "" : "s"} would be created`));
|
|
2806
|
-
console.log(
|
|
2686
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
2807
2687
|
for (const column of preview.columns) {
|
|
2808
|
-
const to = column.target.kind === "skip" ?
|
|
2809
|
-
console.log(` ${
|
|
2688
|
+
const to = column.target.kind === "skip" ? chalk2.gray("skipped") : column.target.kind === "new" ? `${chalk2.green("new")} ${column.propertyName} (${column.type})` : `${column.propertyName} (${column.type})`;
|
|
2689
|
+
console.log(` ${chalk2.gray(`${column.header} \u2192`)} ${to}`);
|
|
2810
2690
|
}
|
|
2811
2691
|
const newOptions = Object.entries(preview.newOptions ?? {});
|
|
2812
2692
|
if (newOptions.length) {
|
|
2813
|
-
console.log(
|
|
2693
|
+
console.log(chalk2.green("\n Options the import will add:"));
|
|
2814
2694
|
for (const [columnId, names] of newOptions) {
|
|
2815
2695
|
const column = preview.columns.find((c) => (c.target.kind === "property" ? c.target.propertyId : `new:${c.propertyName ?? ""}`) === columnId);
|
|
2816
2696
|
console.log(` ${column?.propertyName ?? columnId}: ${names.join(", ")}`);
|
|
@@ -2818,7 +2698,7 @@ CSV preview: ${preview.importable} of ${preview.total} row${preview.total === 1
|
|
|
2818
2698
|
}
|
|
2819
2699
|
const skipped = preview.rows.filter((r) => r.errors.length > 0).map((r) => ({ index: r.index, errors: r.errors }));
|
|
2820
2700
|
outputCsvSkipped(skipped);
|
|
2821
|
-
console.log(
|
|
2701
|
+
console.log(chalk2.gray("\n Nothing was created. Run again without --dry-run to import."));
|
|
2822
2702
|
}
|
|
2823
2703
|
function getOccurrenceStatusColor(status) {
|
|
2824
2704
|
switch (status) {
|
|
@@ -2856,18 +2736,18 @@ function outputCeremoniesJson(ceremonies, extra = {}) {
|
|
|
2856
2736
|
}
|
|
2857
2737
|
function outputCeremoniesPretty(ceremonies) {
|
|
2858
2738
|
if (ceremonies.length === 0) {
|
|
2859
|
-
console.log(
|
|
2739
|
+
console.log(chalk2.gray("No ceremonies found."));
|
|
2860
2740
|
return;
|
|
2861
2741
|
}
|
|
2862
|
-
console.log(
|
|
2742
|
+
console.log(chalk2.bold(`
|
|
2863
2743
|
Ceremonies (${ceremonies.length})`));
|
|
2864
|
-
console.log(
|
|
2744
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
2865
2745
|
for (const c of ceremonies) {
|
|
2866
|
-
const inactive = c.isActive ? "" :
|
|
2867
|
-
console.log(` ${
|
|
2868
|
-
console.log(
|
|
2746
|
+
const inactive = c.isActive ? "" : chalk2.red(" [inactive]");
|
|
2747
|
+
console.log(` ${chalk2.bold(c.name)} ${chalk2.gray(`(${c.slug})`)} ${chalk2.cyan(`[${c.kind}]`)}${inactive}`);
|
|
2748
|
+
console.log(chalk2.gray(` ID: ${c.id}`));
|
|
2869
2749
|
console.log(
|
|
2870
|
-
|
|
2750
|
+
chalk2.gray(
|
|
2871
2751
|
` ${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`
|
|
2872
2752
|
)
|
|
2873
2753
|
);
|
|
@@ -2878,26 +2758,26 @@ function outputCeremonyJson(ceremony) {
|
|
|
2878
2758
|
console.log(JSON.stringify(ceremony, null, 2));
|
|
2879
2759
|
}
|
|
2880
2760
|
function outputCeremonyPretty(c) {
|
|
2881
|
-
console.log(
|
|
2882
|
-
const inactive = c.isActive ? "" :
|
|
2761
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
2762
|
+
const inactive = c.isActive ? "" : chalk2.red(" [inactive]");
|
|
2883
2763
|
console.log(`
|
|
2884
|
-
${
|
|
2885
|
-
console.log(
|
|
2764
|
+
${chalk2.bold(c.name)} ${chalk2.cyan(`[${c.kind}]`)}${inactive}`);
|
|
2765
|
+
console.log(chalk2.gray(` ID: ${c.id} \xB7 slug: ${c.slug}`));
|
|
2886
2766
|
console.log(
|
|
2887
|
-
` ${
|
|
2767
|
+
` ${chalk2.gray("Cadence:")} ${c.isOneOff ? "one-off meeting" : c.cadenceRule ?? "none"} (${c.timezone}), ${c.durationMinutes} min, agenda ${c.leadTimeHours}h ahead`
|
|
2888
2768
|
);
|
|
2889
|
-
if (c.meetingUrl) console.log(` ${
|
|
2890
|
-
if (c.autoExtractOutputs) console.log(` ${
|
|
2891
|
-
console.log(` ${
|
|
2769
|
+
if (c.meetingUrl) console.log(` ${chalk2.gray("Room:")} ${c.meetingUrl}`);
|
|
2770
|
+
if (c.autoExtractOutputs) console.log(` ${chalk2.gray("Outputs:")} extracted automatically from recordings`);
|
|
2771
|
+
console.log(` ${chalk2.gray("Owner:")} ${c.owner?.name ?? c.owner?.email ?? c.ownerId}`);
|
|
2892
2772
|
if (c.participants.length > 0) {
|
|
2893
|
-
console.log(` ${
|
|
2773
|
+
console.log(` ${chalk2.gray("Participants:")} ${c.participants.map((p) => p.user.name ?? p.user.email ?? p.userId).join(", ")}`);
|
|
2894
2774
|
}
|
|
2895
|
-
if (c.product) console.log(` ${
|
|
2896
|
-
if (c.team) console.log(` ${
|
|
2775
|
+
if (c.product) console.log(` ${chalk2.gray("Product:")} ${c.product.name}`);
|
|
2776
|
+
if (c.team) console.log(` ${chalk2.gray("Team:")} ${c.team.name}`);
|
|
2897
2777
|
if (c.projects.length > 0) {
|
|
2898
|
-
console.log(` ${
|
|
2778
|
+
console.log(` ${chalk2.gray("Projects:")} ${c.projects.map((p) => p.project.name).join(", ")}`);
|
|
2899
2779
|
}
|
|
2900
|
-
if (c.aliases.length > 0) console.log(` ${
|
|
2780
|
+
if (c.aliases.length > 0) console.log(` ${chalk2.gray("Aliases:")} ${c.aliases.join(", ")}`);
|
|
2901
2781
|
for (const [label, body] of [
|
|
2902
2782
|
["Purpose", c.purpose],
|
|
2903
2783
|
["Not for", c.notFor],
|
|
@@ -2905,46 +2785,46 @@ ${chalk3.bold(c.name)} ${chalk3.cyan(`[${c.kind}]`)}${inactive}`);
|
|
|
2905
2785
|
["Outputs", c.outputs]
|
|
2906
2786
|
]) {
|
|
2907
2787
|
if (body) console.log(`
|
|
2908
|
-
${
|
|
2788
|
+
${chalk2.bold(label)}
|
|
2909
2789
|
${body}`);
|
|
2910
2790
|
}
|
|
2911
2791
|
if (c.agendaTemplate.length > 0) {
|
|
2912
2792
|
console.log(`
|
|
2913
|
-
${
|
|
2793
|
+
${chalk2.bold("Agenda template")}`);
|
|
2914
2794
|
for (const s of c.agendaTemplate) {
|
|
2915
|
-
console.log(` - ${s.title} ${
|
|
2795
|
+
console.log(` - ${s.title} ${chalk2.gray(`(${s.type}${s.minutes ? `, ${s.minutes} min` : ""})`)}`);
|
|
2916
2796
|
}
|
|
2917
2797
|
}
|
|
2918
2798
|
if (c.occurrences.length > 0) {
|
|
2919
2799
|
console.log(`
|
|
2920
|
-
${
|
|
2800
|
+
${chalk2.bold("Occurrences")} ${chalk2.gray("(newest first)")}`);
|
|
2921
2801
|
for (const o of c.occurrences) {
|
|
2922
2802
|
const color = getOccurrenceStatusColor(o.status);
|
|
2923
|
-
const moved = o.cadenceStart === null ?
|
|
2924
|
-
const recs = o.recordedMeetings.length > 0 ?
|
|
2925
|
-
console.log(` ${formatInZone(o.scheduledStart, c.timezone)} ${
|
|
2926
|
-
console.log(
|
|
2803
|
+
const moved = o.cadenceStart === null ? chalk2.gray(" \xB7 added off-cadence") : new Date(o.cadenceStart).getTime() !== new Date(o.scheduledStart).getTime() ? chalk2.gray(` \xB7 moved from ${formatInZone(o.cadenceStart, c.timezone)}`) : "";
|
|
2804
|
+
const recs = o.recordedMeetings.length > 0 ? chalk2.gray(` \xB7 ${o.recordedMeetings.length} recording${o.recordedMeetings.length === 1 ? "" : "s"}`) : "";
|
|
2805
|
+
console.log(` ${formatInZone(o.scheduledStart, c.timezone)} ${chalk2[color](`[${o.status}]`)}${moved}${recs}`);
|
|
2806
|
+
console.log(chalk2.gray(` ID: ${o.id}${o.skipReason ? ` \xB7 skipped: ${o.skipReason}` : ""}`));
|
|
2927
2807
|
}
|
|
2928
2808
|
}
|
|
2929
2809
|
console.log();
|
|
2930
2810
|
}
|
|
2931
2811
|
function outputCeremonyTemplatesPretty(templates) {
|
|
2932
|
-
console.log(
|
|
2812
|
+
console.log(chalk2.bold(`
|
|
2933
2813
|
Ceremony templates (${templates.length})`));
|
|
2934
|
-
console.log(
|
|
2814
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
2935
2815
|
for (const t of templates) {
|
|
2936
|
-
console.log(` ${
|
|
2937
|
-
console.log(
|
|
2938
|
-
if (t.purpose) console.log(
|
|
2816
|
+
console.log(` ${chalk2.bold(t.name)} ${chalk2.gray(`(${t.slug})`)} ${chalk2.cyan(`[${t.kind}]`)}`);
|
|
2817
|
+
console.log(chalk2.gray(` ${t.cadenceRule} \xB7 ${t.durationMinutes} min \xB7 ${t.agendaTemplate.length} agenda sections`));
|
|
2818
|
+
if (t.purpose) console.log(chalk2.gray(` ${t.purpose}`));
|
|
2939
2819
|
}
|
|
2940
2820
|
console.log();
|
|
2941
2821
|
}
|
|
2942
2822
|
function outputCeremonyWritePretty(result, verb) {
|
|
2943
2823
|
const c = result.ceremony;
|
|
2944
|
-
console.log(`\u2713 Ceremony ${verb}: ${
|
|
2945
|
-
console.log(
|
|
2824
|
+
console.log(`\u2713 Ceremony ${verb}: ${chalk2.bold(c.name)} ${chalk2.gray(`(${c.slug})`)}`);
|
|
2825
|
+
console.log(chalk2.gray(` ID: ${c.id}`));
|
|
2946
2826
|
if (result.occurrencesCreated > 0) {
|
|
2947
|
-
console.log(
|
|
2827
|
+
console.log(chalk2.gray(` ${result.occurrencesCreated} occurrence${result.occurrencesCreated === 1 ? "" : "s"} scheduled`));
|
|
2948
2828
|
}
|
|
2949
2829
|
}
|
|
2950
2830
|
function outputOccurrencesJson(occurrences, extra = {}) {
|
|
@@ -2952,16 +2832,16 @@ function outputOccurrencesJson(occurrences, extra = {}) {
|
|
|
2952
2832
|
}
|
|
2953
2833
|
function outputOccurrencesPretty(occurrences) {
|
|
2954
2834
|
if (occurrences.length === 0) {
|
|
2955
|
-
console.log(
|
|
2835
|
+
console.log(chalk2.gray("No occurrences in this window."));
|
|
2956
2836
|
return;
|
|
2957
2837
|
}
|
|
2958
|
-
console.log(
|
|
2838
|
+
console.log(chalk2.bold(`
|
|
2959
2839
|
Occurrences (${occurrences.length})`));
|
|
2960
|
-
console.log(
|
|
2840
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
2961
2841
|
for (const o of occurrences) {
|
|
2962
2842
|
const color = getOccurrenceStatusColor(o.status);
|
|
2963
|
-
console.log(` ${formatInZone(o.scheduledStart)} ${
|
|
2964
|
-
console.log(
|
|
2843
|
+
console.log(` ${formatInZone(o.scheduledStart)} ${chalk2.bold(o.ceremony.name)} ${chalk2[color](`[${o.status}]`)}`);
|
|
2844
|
+
console.log(chalk2.gray(` ID: ${o.id} \xB7 ceremony ${o.ceremonyId}`));
|
|
2965
2845
|
}
|
|
2966
2846
|
console.log();
|
|
2967
2847
|
}
|
|
@@ -2970,49 +2850,49 @@ function outputOccurrenceJson(occurrence, extras = {}) {
|
|
|
2970
2850
|
}
|
|
2971
2851
|
function outputAgendaPretty(agenda) {
|
|
2972
2852
|
if (!agenda) {
|
|
2973
|
-
console.log(
|
|
2853
|
+
console.log(chalk2.gray("\nNo agenda generated yet."));
|
|
2974
2854
|
return;
|
|
2975
2855
|
}
|
|
2976
2856
|
console.log(`
|
|
2977
|
-
${
|
|
2857
|
+
${chalk2.bold("Agenda")} ${chalk2.gray(`(generated ${new Date(agenda.generatedAt).toLocaleString()})`)}`);
|
|
2978
2858
|
for (const section of agenda.sections) {
|
|
2979
|
-
const minutes = section.minutes ?
|
|
2859
|
+
const minutes = section.minutes ? chalk2.gray(` \xB7 ${section.minutes} min`) : "";
|
|
2980
2860
|
console.log(`
|
|
2981
|
-
${
|
|
2861
|
+
${chalk2.bold(section.title)}${minutes} ${chalk2.gray(`[${section.key}]`)}`);
|
|
2982
2862
|
if (section.items.length === 0) {
|
|
2983
|
-
console.log(
|
|
2863
|
+
console.log(chalk2.gray(` ${section.emptyReason ?? "Nothing here."}`));
|
|
2984
2864
|
}
|
|
2985
2865
|
for (const item of section.items) {
|
|
2986
|
-
const box = item.resolvedAt ?
|
|
2987
|
-
const carried = item.carryCount ?
|
|
2866
|
+
const box = item.resolvedAt ? chalk2.green("[x]") : "[ ]";
|
|
2867
|
+
const carried = item.carryCount ? chalk2.yellow(` \u21BB${item.carryCount}`) : "";
|
|
2988
2868
|
console.log(` ${box} ${item.title}${carried}`);
|
|
2989
2869
|
const meta = [item.detail, `${item.refType} \xB7 id ${item.id}`].filter(Boolean).join(" \xB7 ");
|
|
2990
|
-
console.log(
|
|
2870
|
+
console.log(chalk2.gray(` ${meta}`));
|
|
2991
2871
|
}
|
|
2992
2872
|
}
|
|
2993
2873
|
if (agenda.narrative) {
|
|
2994
2874
|
console.log(`
|
|
2995
|
-
${
|
|
2875
|
+
${chalk2.bold("Summary")}
|
|
2996
2876
|
${agenda.narrative}`);
|
|
2997
2877
|
}
|
|
2998
2878
|
}
|
|
2999
2879
|
function outputOccurrenceUpdatesPretty(summary) {
|
|
3000
2880
|
if (summary.questions.length === 0) {
|
|
3001
|
-
console.log(
|
|
2881
|
+
console.log(chalk2.gray("This ceremony kind has no async updates."));
|
|
3002
2882
|
return;
|
|
3003
2883
|
}
|
|
3004
2884
|
console.log(
|
|
3005
|
-
|
|
3006
|
-
Async updates: ${summary.submittedCount} of ${summary.participants.length} submitted`) + (summary.blockedCount > 0 ?
|
|
2885
|
+
chalk2.bold(`
|
|
2886
|
+
Async updates: ${summary.submittedCount} of ${summary.participants.length} submitted`) + (summary.blockedCount > 0 ? chalk2.red(` \xB7 ${summary.blockedCount} blocked`) : "")
|
|
3007
2887
|
);
|
|
3008
2888
|
for (const p of summary.participants) {
|
|
3009
|
-
const state = p.submittedAt ?
|
|
3010
|
-
const blocked = p.flaggedBlocker ?
|
|
2889
|
+
const state = p.submittedAt ? chalk2.green("submitted") : chalk2.gray("not yet");
|
|
2890
|
+
const blocked = p.flaggedBlocker ? chalk2.red(" [blocked]") : "";
|
|
3011
2891
|
console.log(`
|
|
3012
|
-
${
|
|
2892
|
+
${chalk2.bold(p.name ?? p.email ?? p.userId)} ${state}${blocked}`);
|
|
3013
2893
|
for (const q of summary.questions) {
|
|
3014
2894
|
const answer = p.answers[q.key];
|
|
3015
|
-
if (answer) console.log(` ${
|
|
2895
|
+
if (answer) console.log(` ${chalk2.gray(q.prompt)}
|
|
3016
2896
|
${answer.replace(/\n/g, "\n ")}`);
|
|
3017
2897
|
}
|
|
3018
2898
|
}
|
|
@@ -3020,100 +2900,314 @@ Async updates: ${summary.submittedCount} of ${summary.participants.length} submi
|
|
|
3020
2900
|
}
|
|
3021
2901
|
function outputMyOccurrenceUpdatePretty(update) {
|
|
3022
2902
|
if (update.questions.length === 0) {
|
|
3023
|
-
console.log(
|
|
2903
|
+
console.log(chalk2.gray("This ceremony kind has no async updates."));
|
|
3024
2904
|
return;
|
|
3025
2905
|
}
|
|
3026
|
-
const state = update.submittedAt ?
|
|
2906
|
+
const state = update.submittedAt ? chalk2.green(`submitted ${new Date(update.submittedAt).toLocaleString()}`) : chalk2.gray("not submitted");
|
|
3027
2907
|
console.log(`
|
|
3028
|
-
${
|
|
2908
|
+
${chalk2.bold("Your update")} ${state}${update.flaggedBlocker ? chalk2.red(" [blocked]") : ""}`);
|
|
3029
2909
|
if (update.isParticipant === false) {
|
|
3030
|
-
console.log(
|
|
2910
|
+
console.log(chalk2.yellow(" You aren't a participant of this ceremony."));
|
|
3031
2911
|
}
|
|
3032
2912
|
for (const q of update.questions) {
|
|
3033
2913
|
const answer = update.answers[q.key];
|
|
3034
2914
|
const draft = update.draftAnswers[q.key];
|
|
3035
2915
|
console.log(`
|
|
3036
|
-
${
|
|
2916
|
+
${chalk2.bold(q.prompt)} ${chalk2.gray(`[${q.key}]`)}`);
|
|
3037
2917
|
if (answer) console.log(` ${answer.replace(/\n/g, "\n ")}`);
|
|
3038
|
-
else if (draft) console.log(
|
|
3039
|
-
else console.log(
|
|
2918
|
+
else if (draft) console.log(chalk2.gray(` (draft) ${draft.replace(/\n/g, "\n ")}`));
|
|
2919
|
+
else console.log(chalk2.gray(" \u2014"));
|
|
3040
2920
|
}
|
|
3041
2921
|
console.log();
|
|
3042
2922
|
}
|
|
3043
2923
|
function outputOccurrencePretty(o, extras = {}) {
|
|
3044
2924
|
const tz = o.ceremony.timezone;
|
|
3045
2925
|
const color = getOccurrenceStatusColor(o.status);
|
|
3046
|
-
console.log(
|
|
2926
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
3047
2927
|
console.log(`
|
|
3048
|
-
${
|
|
3049
|
-
console.log(
|
|
3050
|
-
console.log(` ${
|
|
3051
|
-
if (o.isOneOff) console.log(` ${
|
|
2928
|
+
${chalk2.bold(o.ceremony.name)} \u2014 ${formatInZone(o.scheduledStart, tz)} ${chalk2[color](`[${o.status}]`)}`);
|
|
2929
|
+
console.log(chalk2.gray(` ID: ${o.id} \xB7 ceremony ${o.ceremonyId}`));
|
|
2930
|
+
console.log(` ${chalk2.gray("Owner:")} ${o.ceremony.owner?.name ?? o.ceremony.owner?.email ?? o.ceremony.ownerId}`);
|
|
2931
|
+
if (o.isOneOff) console.log(` ${chalk2.gray("One-off meeting")}${o.purpose ? `: ${o.purpose}` : ""}`);
|
|
3052
2932
|
if (o.cadenceStart && new Date(o.cadenceStart).getTime() !== new Date(o.scheduledStart).getTime()) {
|
|
3053
|
-
console.log(` ${
|
|
2933
|
+
console.log(` ${chalk2.gray("Moved from:")} ${formatInZone(o.cadenceStart, tz)}`);
|
|
3054
2934
|
}
|
|
3055
2935
|
if (o.scheduledMeeting) {
|
|
3056
2936
|
const names = o.scheduledMeeting.attendees.map((a) => a.name ?? a.userId).filter(Boolean);
|
|
3057
2937
|
console.log(
|
|
3058
|
-
` ${
|
|
2938
|
+
` ${chalk2.gray("Booking:")} ${o.scheduledMeeting.status}${names.length > 0 ? ` \xB7 ${names.join(", ")}` : ""}`
|
|
3059
2939
|
);
|
|
3060
2940
|
}
|
|
3061
|
-
if (o.skipReason) console.log(` ${
|
|
2941
|
+
if (o.skipReason) console.log(` ${chalk2.gray("Skipped:")} ${o.skipReason}`);
|
|
3062
2942
|
if (o.agendaCirculatedAt) {
|
|
3063
|
-
console.log(` ${
|
|
2943
|
+
console.log(` ${chalk2.gray("Agenda circulated:")} ${formatInZone(o.agendaCirculatedAt, tz)}`);
|
|
3064
2944
|
}
|
|
3065
2945
|
if (o.skipProposal?.proposed) {
|
|
3066
|
-
console.log(
|
|
2946
|
+
console.log(chalk2.yellow(" The agenda is empty \u2014 this occurrence is a candidate to skip."));
|
|
3067
2947
|
}
|
|
3068
2948
|
if (o.recordedMeetings.length > 0) {
|
|
3069
|
-
console.log(` ${
|
|
2949
|
+
console.log(` ${chalk2.gray("Recordings:")}`);
|
|
3070
2950
|
for (const m of o.recordedMeetings) {
|
|
3071
|
-
console.log(m.visible ? ` ${m.title ?? "(untitled)"} ${
|
|
2951
|
+
console.log(m.visible ? ` ${m.title ?? "(untitled)"} ${chalk2.gray(m.id)}` : chalk2.gray(` (a recording you cannot view) ${m.id}`));
|
|
3072
2952
|
}
|
|
3073
2953
|
}
|
|
3074
2954
|
if (o.notesPageId && extras.notes === void 0) {
|
|
3075
|
-
console.log(` ${
|
|
2955
|
+
console.log(` ${chalk2.gray("Notes page:")} ${o.notesPageId} ${chalk2.gray("(--notes to include)")}`);
|
|
3076
2956
|
}
|
|
3077
2957
|
outputAgendaPretty(o.agenda);
|
|
3078
2958
|
if (extras.notes !== void 0 && !extras.extrasErrors?.notes) {
|
|
3079
2959
|
console.log(`
|
|
3080
|
-
${
|
|
3081
|
-
console.log(extras.notes?.body ? extras.notes.body :
|
|
2960
|
+
${chalk2.bold("Notes")}`);
|
|
2961
|
+
console.log(extras.notes?.body ? extras.notes.body : chalk2.gray("No notes yet."));
|
|
3082
2962
|
}
|
|
3083
2963
|
if (extras.decisions) {
|
|
3084
2964
|
console.log(`
|
|
3085
|
-
${
|
|
3086
|
-
if (extras.decisions.length === 0) console.log(
|
|
2965
|
+
${chalk2.bold("Decisions and open questions")}`);
|
|
2966
|
+
if (extras.decisions.length === 0) console.log(chalk2.gray("None logged against this occurrence."));
|
|
3087
2967
|
for (const d of extras.decisions) {
|
|
3088
|
-
console.log(` ${
|
|
2968
|
+
console.log(` ${chalk2.gray(d.label)} ${d.statement} ${chalk2[getDecisionStatusColor(d.status)](`[${d.status}]`)}`);
|
|
3089
2969
|
}
|
|
3090
2970
|
}
|
|
3091
2971
|
if (extras.updates) outputOccurrenceUpdatesPretty(extras.updates);
|
|
3092
2972
|
for (const [section, message] of Object.entries(extras.extrasErrors ?? {})) {
|
|
3093
|
-
console.log(
|
|
2973
|
+
console.log(chalk2.yellow(`
|
|
3094
2974
|
Couldn't load ${section}: ${message}`));
|
|
3095
2975
|
}
|
|
3096
2976
|
console.log();
|
|
3097
2977
|
}
|
|
3098
2978
|
function outputProjectOccurrencesPretty(rows) {
|
|
3099
2979
|
if (rows.length === 0) {
|
|
3100
|
-
console.log(
|
|
2980
|
+
console.log(chalk2.gray("No meetings in this window."));
|
|
3101
2981
|
return;
|
|
3102
2982
|
}
|
|
3103
|
-
console.log(
|
|
2983
|
+
console.log(chalk2.bold(`
|
|
3104
2984
|
Project meetings (${rows.length})`));
|
|
3105
|
-
console.log(
|
|
2985
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
3106
2986
|
for (const r of rows) {
|
|
3107
2987
|
const color = getOccurrenceStatusColor(r.status);
|
|
3108
|
-
const oneOff = r.isOneOff ?
|
|
3109
|
-
console.log(` ${formatInZone(r.scheduledStart)} ${
|
|
2988
|
+
const oneOff = r.isOneOff ? chalk2.cyan(" [one-off]") : "";
|
|
2989
|
+
console.log(` ${formatInZone(r.scheduledStart)} ${chalk2.bold(r.ceremonyName)}${oneOff} ${chalk2[color](`[${r.status}]`)}`);
|
|
3110
2990
|
const meta = [`ID: ${r.occurrenceId}`, `${r.attendeeCount} attendee${r.attendeeCount === 1 ? "" : "s"}`, r.purpose].filter(Boolean);
|
|
3111
|
-
console.log(
|
|
2991
|
+
console.log(chalk2.gray(` ${meta.join(" \xB7 ")}`));
|
|
3112
2992
|
}
|
|
3113
2993
|
console.log();
|
|
3114
2994
|
}
|
|
3115
2995
|
|
|
2996
|
+
// src/commands/agentGuidance.ts
|
|
2997
|
+
var GUIDANCE_NOTE = "This is guidance, not authority (ADR-0071): it never grants permission for anything.";
|
|
2998
|
+
function more(omitted) {
|
|
2999
|
+
return omitted > 0 ? [chalk3.dim(` \u2026and ${omitted} more`)] : [];
|
|
3000
|
+
}
|
|
3001
|
+
function formatContext(ctx) {
|
|
3002
|
+
const lines = [];
|
|
3003
|
+
const scope = ctx.project ? `${ctx.workspace.name} / ${ctx.project.name}` : ctx.workspace.name;
|
|
3004
|
+
lines.push(chalk3.bold(`Agent context \u2014 ${scope}`));
|
|
3005
|
+
lines.push(chalk3.dim(GUIDANCE_NOTE));
|
|
3006
|
+
lines.push("");
|
|
3007
|
+
lines.push(chalk3.bold("Instructions"));
|
|
3008
|
+
if (ctx.instructions.length === 0) lines.push(chalk3.dim(" (none)"));
|
|
3009
|
+
for (const i of ctx.instructions) {
|
|
3010
|
+
lines.push(chalk3.cyan(` [${i.scope}]`));
|
|
3011
|
+
for (const l of i.text.split("\n")) lines.push(` ${l}`);
|
|
3012
|
+
}
|
|
3013
|
+
lines.push("");
|
|
3014
|
+
const decisions = ctx.decisions ?? { items: [], omitted: 0 };
|
|
3015
|
+
lines.push(chalk3.bold("Decisions"));
|
|
3016
|
+
if (decisions.items.length === 0 && decisions.omitted === 0) {
|
|
3017
|
+
lines.push(chalk3.dim(ctx.project ? " (none)" : " (none \u2014 pass --project to include decisions)"));
|
|
3018
|
+
}
|
|
3019
|
+
for (const d of decisions.items) {
|
|
3020
|
+
lines.push(` ${chalk3.yellow(d.label)} ${d.statement}`);
|
|
3021
|
+
lines.push(chalk3.dim(` ${d.url}`));
|
|
3022
|
+
}
|
|
3023
|
+
lines.push(...more(decisions.omitted));
|
|
3024
|
+
lines.push("");
|
|
3025
|
+
const adrs = ctx.adrs ?? { items: [], omitted: 0 };
|
|
3026
|
+
lines.push(chalk3.bold("ADRs"));
|
|
3027
|
+
if (adrs.items.length === 0 && adrs.omitted === 0) lines.push(chalk3.dim(" (none)"));
|
|
3028
|
+
for (const a of adrs.items) {
|
|
3029
|
+
lines.push(` ${chalk3.yellow(a.label ?? "ADR")} ${a.title}`);
|
|
3030
|
+
lines.push(chalk3.dim(` ${a.url}`));
|
|
3031
|
+
}
|
|
3032
|
+
lines.push(...more(adrs.omitted));
|
|
3033
|
+
lines.push("");
|
|
3034
|
+
lines.push(chalk3.dim(`revision ${ctx.revision}`));
|
|
3035
|
+
return lines.join("\n");
|
|
3036
|
+
}
|
|
3037
|
+
function formatMethod(method) {
|
|
3038
|
+
const lines = [];
|
|
3039
|
+
lines.push(chalk3.bold(`Method ${method.version}`) + chalk3.dim(` (${method.status})`));
|
|
3040
|
+
lines.push(chalk3.dim(GUIDANCE_NOTE));
|
|
3041
|
+
for (const doc of method.documents) {
|
|
3042
|
+
lines.push("");
|
|
3043
|
+
lines.push(chalk3.bold.cyan(`# ${doc.title}`));
|
|
3044
|
+
lines.push(doc.markdown);
|
|
3045
|
+
}
|
|
3046
|
+
lines.push("");
|
|
3047
|
+
lines.push(chalk3.dim(method.contentHash));
|
|
3048
|
+
return lines.join("\n");
|
|
3049
|
+
}
|
|
3050
|
+
function createContextCommand() {
|
|
3051
|
+
return new Command("context").description(
|
|
3052
|
+
`Show the AI instructions, decisions and ADRs agents get for a workspace (and project). ${GUIDANCE_NOTE}`
|
|
3053
|
+
).option("-w, --workspace <slug>", "Workspace slug or id (defaults to the configured workspace)").option("-p, --project <id>", "Project id, to include project instructions and decisions").action(async (options, cmd) => {
|
|
3054
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3055
|
+
try {
|
|
3056
|
+
const client = getClient();
|
|
3057
|
+
const workspaceId = await resolveWorkspaceId(client, options.workspace);
|
|
3058
|
+
const ctx = await client.agentGuidance.context({ workspaceId, projectId: options.project });
|
|
3059
|
+
if (shouldUseJson(globalOpts.json, globalOpts.pretty)) {
|
|
3060
|
+
console.log(JSON.stringify(ctx, null, 2));
|
|
3061
|
+
} else {
|
|
3062
|
+
console.log(formatContext(ctx));
|
|
3063
|
+
}
|
|
3064
|
+
} catch (error) {
|
|
3065
|
+
handleError(error);
|
|
3066
|
+
}
|
|
3067
|
+
});
|
|
3068
|
+
}
|
|
3069
|
+
function createMethodCommand() {
|
|
3070
|
+
return new Command("method").description(`Show the current published method agents follow. ${GUIDANCE_NOTE}`).option("-w, --workspace <slug>", "Workspace slug or id (lets preview workspaces see a draft)").action(async (options, cmd) => {
|
|
3071
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3072
|
+
try {
|
|
3073
|
+
const client = getClient();
|
|
3074
|
+
const workspaceId = options.workspace ? await resolveWorkspaceId(client, options.workspace) : void 0;
|
|
3075
|
+
const method = await client.agentGuidance.method({ workspaceId });
|
|
3076
|
+
if (shouldUseJson(globalOpts.json, globalOpts.pretty)) {
|
|
3077
|
+
console.log(JSON.stringify(method, null, 2));
|
|
3078
|
+
} else {
|
|
3079
|
+
console.log(formatMethod(method));
|
|
3080
|
+
}
|
|
3081
|
+
} catch (error) {
|
|
3082
|
+
handleError(error);
|
|
3083
|
+
}
|
|
3084
|
+
});
|
|
3085
|
+
}
|
|
3086
|
+
|
|
3087
|
+
// src/program.ts
|
|
3088
|
+
import { Command as Command31 } from "commander";
|
|
3089
|
+
|
|
3090
|
+
// src/commands/auth.ts
|
|
3091
|
+
import { Command as Command2 } from "commander";
|
|
3092
|
+
import chalk4 from "chalk";
|
|
3093
|
+
function createAuthCommand() {
|
|
3094
|
+
const auth = new Command2("auth").description("Authentication commands");
|
|
3095
|
+
auth.command("login").description("Configure CLI with your API token").requiredOption("--token <token>", "JWT token from /settings/api-keys").requiredOption("--api-url <url>", "API URL (e.g., https://www.exponential.im)").action(async (options) => {
|
|
3096
|
+
try {
|
|
3097
|
+
let apiUrl = options.apiUrl.replace(/\/+$/, "");
|
|
3098
|
+
if (!apiUrl.startsWith("http://localhost") && !apiUrl.startsWith("https://")) {
|
|
3099
|
+
apiUrl = `https://${apiUrl}`;
|
|
3100
|
+
}
|
|
3101
|
+
setConfig({
|
|
3102
|
+
token: options.token,
|
|
3103
|
+
apiUrl
|
|
3104
|
+
});
|
|
3105
|
+
resetClient();
|
|
3106
|
+
console.log(chalk4.gray("Validating token..."));
|
|
3107
|
+
const client = getClient();
|
|
3108
|
+
await client.workspaces.list();
|
|
3109
|
+
console.log(chalk4.green("Successfully authenticated!"));
|
|
3110
|
+
console.log(chalk4.gray(`Config saved to: ${getConfigPath()}`));
|
|
3111
|
+
} catch (error) {
|
|
3112
|
+
clearConfig();
|
|
3113
|
+
handleError(error);
|
|
3114
|
+
}
|
|
3115
|
+
});
|
|
3116
|
+
auth.command("logout").description("Remove stored credentials").action(() => {
|
|
3117
|
+
clearConfig();
|
|
3118
|
+
resetClient();
|
|
3119
|
+
console.log(chalk4.green("Successfully logged out."));
|
|
3120
|
+
console.log(chalk4.gray(`Config cleared from: ${getConfigPath()}`));
|
|
3121
|
+
});
|
|
3122
|
+
auth.command("whoami").description("Show which account the stored token signs in as, and whether it is an agent").option("--json", "Output as JSON").action(async (options) => {
|
|
3123
|
+
if (!isAuthenticated()) {
|
|
3124
|
+
if (options.json) {
|
|
3125
|
+
console.log(JSON.stringify({ error: { code: "UNAUTHENTICATED", message: "Not authenticated" } }, null, 2));
|
|
3126
|
+
} else {
|
|
3127
|
+
console.log(chalk4.yellow("Not authenticated."));
|
|
3128
|
+
console.log(chalk4.gray("Run: exponential auth login --token <jwt> --api-url <url>"));
|
|
3129
|
+
}
|
|
3130
|
+
process.exit(1);
|
|
3131
|
+
}
|
|
3132
|
+
try {
|
|
3133
|
+
const config = getConfig();
|
|
3134
|
+
const client = getClient();
|
|
3135
|
+
const [me, workspaces] = await Promise.all([
|
|
3136
|
+
client.users.me(),
|
|
3137
|
+
client.workspaces.list()
|
|
3138
|
+
]);
|
|
3139
|
+
const workspaceCount = workspaces.length;
|
|
3140
|
+
if (options.json) {
|
|
3141
|
+
console.log(JSON.stringify({
|
|
3142
|
+
id: me.id,
|
|
3143
|
+
name: me.name,
|
|
3144
|
+
email: me.email,
|
|
3145
|
+
isAgent: me.isAgent,
|
|
3146
|
+
agent: me.agent,
|
|
3147
|
+
apiUrl: config.apiUrl,
|
|
3148
|
+
workspaces: workspaceCount,
|
|
3149
|
+
configPath: getConfigPath()
|
|
3150
|
+
}, null, 2));
|
|
3151
|
+
return;
|
|
3152
|
+
}
|
|
3153
|
+
console.log(chalk4.green("Authenticated"));
|
|
3154
|
+
console.log(`Account: ${chalk4.bold(me.name ?? "(unnamed)")} ${chalk4.gray(`(${me.id})`)}`);
|
|
3155
|
+
if (me.email) {
|
|
3156
|
+
console.log(chalk4.gray(`Email: ${me.email}`));
|
|
3157
|
+
}
|
|
3158
|
+
if (me.isAgent) {
|
|
3159
|
+
const owner = me.agent?.owner.name ?? me.agent?.owner.id ?? "unknown";
|
|
3160
|
+
console.log(`Type: ${chalk4.cyan("External agent")} ${chalk4.gray(`owned by ${owner}`)}`);
|
|
3161
|
+
console.log(chalk4.gray("To give this agent a restricted project, add this account on the project's Members tab."));
|
|
3162
|
+
} else {
|
|
3163
|
+
console.log(`Type: ${chalk4.cyan("Person")}`);
|
|
3164
|
+
}
|
|
3165
|
+
console.log(chalk4.gray(`API URL: ${config.apiUrl}`));
|
|
3166
|
+
console.log(chalk4.gray(`Workspaces: ${workspaceCount}`));
|
|
3167
|
+
console.log(chalk4.gray(`Config: ${getConfigPath()}`));
|
|
3168
|
+
} catch (error) {
|
|
3169
|
+
handleError(error, options.json);
|
|
3170
|
+
}
|
|
3171
|
+
});
|
|
3172
|
+
auth.command("show").description(
|
|
3173
|
+
"Print parts of the current credentials. Use --token to print the raw JWT (for piping into other tools, e.g. `gh secret set EXPONENTIAL_TOKEN < <(exponential auth show --token)`)."
|
|
3174
|
+
).option("--token", "Print the raw JWT to stdout with no trailing newline").action((options) => {
|
|
3175
|
+
const config = getConfig();
|
|
3176
|
+
if (options.token) {
|
|
3177
|
+
if (!config.token) {
|
|
3178
|
+
console.error("Not authenticated. Run `exponential auth login` first.");
|
|
3179
|
+
process.exit(1);
|
|
3180
|
+
}
|
|
3181
|
+
process.stdout.write(config.token);
|
|
3182
|
+
return;
|
|
3183
|
+
}
|
|
3184
|
+
console.log(chalk4.bold("\nCredentials"));
|
|
3185
|
+
console.log(chalk4.gray("\u2500".repeat(40)));
|
|
3186
|
+
console.log(`API URL: ${config.apiUrl || chalk4.gray("(not set)")}`);
|
|
3187
|
+
console.log(
|
|
3188
|
+
`Token: ${config.token ? chalk4.gray(`${config.token.substring(0, 20)}...`) : chalk4.gray("(not set)")}`
|
|
3189
|
+
);
|
|
3190
|
+
console.log(
|
|
3191
|
+
chalk4.gray("Use `exponential auth show --token` to print the raw JWT.")
|
|
3192
|
+
);
|
|
3193
|
+
console.log();
|
|
3194
|
+
});
|
|
3195
|
+
auth.command("status").description("Show detailed authentication status").action(() => {
|
|
3196
|
+
const config = getConfig();
|
|
3197
|
+
console.log(chalk4.bold("\nAuthentication Status"));
|
|
3198
|
+
console.log(chalk4.gray("\u2500".repeat(40)));
|
|
3199
|
+
console.log(`Authenticated: ${isAuthenticated() ? chalk4.green("Yes") : chalk4.red("No")}`);
|
|
3200
|
+
console.log(`API URL: ${config.apiUrl || chalk4.gray("(not set)")}`);
|
|
3201
|
+
console.log(`Token: ${config.token ? chalk4.gray(`${config.token.substring(0, 20)}...`) : chalk4.gray("(not set)")}`);
|
|
3202
|
+
console.log(`Config Path: ${getConfigPath()}`);
|
|
3203
|
+
console.log();
|
|
3204
|
+
});
|
|
3205
|
+
return auth;
|
|
3206
|
+
}
|
|
3207
|
+
|
|
3116
3208
|
// src/commands/actions.ts
|
|
3209
|
+
import { Command as Command3 } from "commander";
|
|
3210
|
+
import { splitAssigneeRefs } from "exponential-sdk";
|
|
3117
3211
|
var VALID_PRIORITIES = [
|
|
3118
3212
|
"Quick",
|
|
3119
3213
|
"Scheduled",
|
|
@@ -3143,8 +3237,12 @@ function parseIds(raw) {
|
|
|
3143
3237
|
}
|
|
3144
3238
|
return ids;
|
|
3145
3239
|
}
|
|
3240
|
+
function collect(value, previous = []) {
|
|
3241
|
+
return [...previous, value];
|
|
3242
|
+
}
|
|
3243
|
+
var ASSIGNEE_REF_HELP = "user id or email; repeat the flag or comma-separate values";
|
|
3146
3244
|
function createActionsCommand() {
|
|
3147
|
-
const actions = new
|
|
3245
|
+
const actions = new Command3("actions").description("Manage actions/tasks");
|
|
3148
3246
|
actions.command("list").description("List all actions").option("--project <id>", "Filter by project ID").option("--status <status>", "Filter by kanban status (BACKLOG, TODO, IN_PROGRESS, IN_REVIEW, DONE)").option("--assignee <id>", "Filter by assignee ID").action(async (options, cmd) => {
|
|
3149
3247
|
const globalOpts = cmd.optsWithGlobals();
|
|
3150
3248
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -3286,7 +3384,7 @@ function createActionsCommand() {
|
|
|
3286
3384
|
handleError(error, useJson);
|
|
3287
3385
|
}
|
|
3288
3386
|
});
|
|
3289
|
-
actions.command("update").description("Update an existing action").requiredOption("--id <id>", "Action ID to update").option("-n, --name <name>", "New action name").option("-d, --description <text>", "New description").option("-p, --project <id>", "Move to project ID").option("--priority <priority>", "Priority (Quick, Scheduled, 1st Priority, etc.)").option("--status <status>", "Status (ACTIVE, COMPLETED, CANCELLED)").option("--kanban <status>", "Kanban status (BACKLOG, TODO, IN_PROGRESS, IN_REVIEW, DONE)").option("--due <date>", 'Due date (YYYY-MM-DD or "null" to clear)').option("--scheduled-start <datetime>", 'Do-date: when you plan to work on it (YYYY-MM-DD, ISO datetime, or "null" to clear). This is what /today partitions on.').option("--scheduled-end <datetime>", 'End of the time block (YYYY-MM-DD, ISO datetime, or "null" to clear)').action(async (options, cmd) => {
|
|
3387
|
+
actions.command("update").description("Update an existing action").requiredOption("--id <id>", "Action ID to update").option("-n, --name <name>", "New action name").option("-d, --description <text>", "New description").option("-p, --project <id>", "Move to project ID").option("--priority <priority>", "Priority (Quick, Scheduled, 1st Priority, etc.)").option("--status <status>", "Status (ACTIVE, COMPLETED, CANCELLED)").option("--kanban <status>", "Kanban status (BACKLOG, TODO, IN_PROGRESS, IN_REVIEW, DONE)").option("--due <date>", 'Due date (YYYY-MM-DD or "null" to clear)').option("--scheduled-start <datetime>", 'Do-date: when you plan to work on it (YYYY-MM-DD, ISO datetime, or "null" to clear). This is what /today partitions on.').option("--scheduled-end <datetime>", 'End of the time block (YYYY-MM-DD, ISO datetime, or "null" to clear)').option("--assignee <ref>", `Add an assignee (${ASSIGNEE_REF_HELP}). Additive: existing assignees stay. Must be assignable in the action's project or workspace`, collect).option("--unassign <ref>", `Remove an assignee (${ASSIGNEE_REF_HELP}). Users not assigned are ignored`, collect).option("--clear-assignees", "Remove every assignee (runs before --assignee, so the two together replace the set)").action(async (options, cmd) => {
|
|
3290
3388
|
const globalOpts = cmd.optsWithGlobals();
|
|
3291
3389
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3292
3390
|
try {
|
|
@@ -3305,8 +3403,7 @@ function createActionsCommand() {
|
|
|
3305
3403
|
const scheduledStart = parseNullableDate(options.scheduledStart, "scheduled-start");
|
|
3306
3404
|
const scheduledEnd = parseNullableDate(options.scheduledEnd, "scheduled-end");
|
|
3307
3405
|
const client = getClient();
|
|
3308
|
-
const
|
|
3309
|
-
id: options.id,
|
|
3406
|
+
const fieldPatch = {
|
|
3310
3407
|
name: options.name,
|
|
3311
3408
|
description: options.description,
|
|
3312
3409
|
projectId: options.project,
|
|
@@ -3316,18 +3413,26 @@ function createActionsCommand() {
|
|
|
3316
3413
|
dueDate,
|
|
3317
3414
|
scheduledStart,
|
|
3318
3415
|
scheduledEnd
|
|
3319
|
-
}
|
|
3416
|
+
};
|
|
3417
|
+
const hasFieldChanges = Object.values(fieldPatch).some((v) => v !== void 0);
|
|
3418
|
+
const hasAssigneeChanges = Boolean(options.clearAssignees || options.unassign?.length || options.assignee?.length);
|
|
3419
|
+
let action;
|
|
3420
|
+
if (hasFieldChanges || !hasAssigneeChanges) {
|
|
3421
|
+
action = await client.actions.update({ id: options.id, ...fieldPatch });
|
|
3422
|
+
}
|
|
3423
|
+
const assigned = await applyAssigneeChanges(client, options.id, options);
|
|
3424
|
+
const result = assigned ?? action;
|
|
3320
3425
|
if (useJson) {
|
|
3321
|
-
outputActionJson(
|
|
3426
|
+
outputActionJson(result);
|
|
3322
3427
|
} else {
|
|
3323
3428
|
console.log("\n\u2713 Action updated successfully");
|
|
3324
|
-
outputActionPretty(
|
|
3429
|
+
outputActionPretty(result);
|
|
3325
3430
|
}
|
|
3326
3431
|
} catch (error) {
|
|
3327
3432
|
handleError(error, useJson);
|
|
3328
3433
|
}
|
|
3329
3434
|
});
|
|
3330
|
-
actions.command("create").description("Create a new action").requiredOption("-n, --name <name>", "Action name/title").option("-d, --description <text>", "Action description").option("-p, --project <id>", "Project ID to assign the action to").option("--priority <priority>", "Priority (Quick, Scheduled, 1st Priority, etc.)").option("--due <date>", "Due date (YYYY-MM-DD)").option("--effort <minutes>", "Effort estimate in minutes", parseInt).option("--ticket <id>", "Link action to a product ticket (CUID) after creation").option("--epic <id>", "Epic CUID to attach the action to").action(async (options, cmd) => {
|
|
3435
|
+
actions.command("create").description("Create a new action").requiredOption("-n, --name <name>", "Action name/title").option("-d, --description <text>", "Action description").option("-p, --project <id>", "Project ID to assign the action to").option("--priority <priority>", "Priority (Quick, Scheduled, 1st Priority, etc.)").option("--due <date>", "Due date (YYYY-MM-DD)").option("--effort <minutes>", "Effort estimate in minutes", parseInt).option("--ticket <id>", "Link action to a product ticket (CUID) after creation").option("--epic <id>", "Epic CUID to attach the action to").option("--assignee <ref>", `Assign the new action (${ASSIGNEE_REF_HELP}). Each must be assignable in the project or workspace, or nothing is created`, collect).action(async (options, cmd) => {
|
|
3331
3436
|
const globalOpts = cmd.optsWithGlobals();
|
|
3332
3437
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3333
3438
|
try {
|
|
@@ -3349,7 +3454,8 @@ function createActionsCommand() {
|
|
|
3349
3454
|
priority: options.priority,
|
|
3350
3455
|
dueDate,
|
|
3351
3456
|
effortEstimate: options.effort,
|
|
3352
|
-
epicId: options.epic
|
|
3457
|
+
epicId: options.epic,
|
|
3458
|
+
...assigneesForCreate(options.assignee)
|
|
3353
3459
|
});
|
|
3354
3460
|
if (options.ticket) {
|
|
3355
3461
|
action = await client.tickets.linkAction(options.ticket, action.id);
|
|
@@ -3393,7 +3499,7 @@ function createActionsCommand() {
|
|
|
3393
3499
|
}
|
|
3394
3500
|
}
|
|
3395
3501
|
);
|
|
3396
|
-
const comment = new
|
|
3502
|
+
const comment = new Command3("comment").description("Manage comments on an action");
|
|
3397
3503
|
comment.command("list").description("List comments on an action").requiredOption("--id <id>", "Action ID").action(async (options, cmd) => {
|
|
3398
3504
|
const globalOpts = cmd.optsWithGlobals();
|
|
3399
3505
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -3462,9 +3568,30 @@ function createActionsCommand() {
|
|
|
3462
3568
|
actions.addCommand(comment);
|
|
3463
3569
|
return actions;
|
|
3464
3570
|
}
|
|
3571
|
+
function assigneesForCreate(refs) {
|
|
3572
|
+
if (!refs?.length) return {};
|
|
3573
|
+
const { userIds, emails } = splitAssigneeRefs(refs);
|
|
3574
|
+
return {
|
|
3575
|
+
...userIds.length ? { assigneeIds: userIds } : {},
|
|
3576
|
+
...emails.length ? { assigneeEmails: emails } : {}
|
|
3577
|
+
};
|
|
3578
|
+
}
|
|
3579
|
+
async function applyAssigneeChanges(client, actionId, options) {
|
|
3580
|
+
let result;
|
|
3581
|
+
if (options.clearAssignees) {
|
|
3582
|
+
result = await client.actions.unassign(actionId, { all: true });
|
|
3583
|
+
}
|
|
3584
|
+
if (options.unassign?.length) {
|
|
3585
|
+
result = await client.actions.unassign(actionId, splitAssigneeRefs(options.unassign));
|
|
3586
|
+
}
|
|
3587
|
+
if (options.assignee?.length) {
|
|
3588
|
+
result = await client.actions.assign(actionId, splitAssigneeRefs(options.assignee));
|
|
3589
|
+
}
|
|
3590
|
+
return result;
|
|
3591
|
+
}
|
|
3465
3592
|
|
|
3466
3593
|
// src/commands/contacts.ts
|
|
3467
|
-
import { Command as
|
|
3594
|
+
import { Command as Command4 } from "commander";
|
|
3468
3595
|
var VALID_INTERACTION_TYPES = [
|
|
3469
3596
|
"EMAIL",
|
|
3470
3597
|
"TELEGRAM",
|
|
@@ -3476,7 +3603,7 @@ var VALID_INTERACTION_TYPES = [
|
|
|
3476
3603
|
];
|
|
3477
3604
|
var VALID_INTERACTION_DIRECTIONS = ["INBOUND", "OUTBOUND"];
|
|
3478
3605
|
function createContactsCommand() {
|
|
3479
|
-
const contacts = new
|
|
3606
|
+
const contacts = new Command4("contacts").description("Manage CRM contacts");
|
|
3480
3607
|
contacts.command("list").description("List contacts").requiredOption("--workspace <id>", "Workspace ID").option("--search <query>", "Search by name or email").option("--tags <tags>", "Filter by tags (comma-separated)").option("--organization <id>", "Filter by organization ID").option("--limit <n>", "Max results to return", parseInt).option("--cursor <cursor>", "Pagination cursor").action(async (options, cmd) => {
|
|
3481
3608
|
const globalOpts = cmd.optsWithGlobals();
|
|
3482
3609
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -3653,8 +3780,8 @@ function createContactsCommand() {
|
|
|
3653
3780
|
}
|
|
3654
3781
|
|
|
3655
3782
|
// src/commands/ceremonies.ts
|
|
3656
|
-
import { Command as
|
|
3657
|
-
import
|
|
3783
|
+
import { Command as Command5 } from "commander";
|
|
3784
|
+
import chalk5 from "chalk";
|
|
3658
3785
|
|
|
3659
3786
|
// src/utils/input.ts
|
|
3660
3787
|
import { readFileSync } from "fs";
|
|
@@ -3711,7 +3838,7 @@ function parseIntInRange(value, flag, min, max) {
|
|
|
3711
3838
|
}
|
|
3712
3839
|
return n;
|
|
3713
3840
|
}
|
|
3714
|
-
var
|
|
3841
|
+
var collect2 = (value, previous) => [...previous, value];
|
|
3715
3842
|
var DATE_ONLY = /^\d{4}-\d{2}-\d{2}$/;
|
|
3716
3843
|
function parseCalendarDate(value) {
|
|
3717
3844
|
const parsed = parseDate(value);
|
|
@@ -3790,7 +3917,7 @@ function addDefinitionOptions(cmd) {
|
|
|
3790
3917
|
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(
|
|
3791
3918
|
"--cadence <rrule>",
|
|
3792
3919
|
'RRULE body, e.g. "FREQ=WEEKLY;BYDAY=MO;BYHOUR=10;BYMINUTE=0"'
|
|
3793
|
-
).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)",
|
|
3920
|
+
).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)", collect2, []).option("--project <projectId>", "Reviewed project id (repeatable; replaces the set on update)", collect2, []).option("--alias <title>", "Meeting-title alias for auto-attach (repeatable; replaces the set on update)", collect2, []).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");
|
|
3794
3921
|
}
|
|
3795
3922
|
function definitionFields(options, cmd) {
|
|
3796
3923
|
const fields = {};
|
|
@@ -3834,7 +3961,7 @@ function parseDateTime(value, flag) {
|
|
|
3834
3961
|
return date;
|
|
3835
3962
|
}
|
|
3836
3963
|
function createOccurrencesCommand() {
|
|
3837
|
-
const occurrences = new
|
|
3964
|
+
const occurrences = new Command5("occurrences").alias("occurrence").description(
|
|
3838
3965
|
[
|
|
3839
3966
|
"Scheduled instances of a ceremony \u2014 the page at /w/<slug>/ceremonies/<ceremonyId>/<occurrenceId>.",
|
|
3840
3967
|
"Every <occurrence> argument takes the occurrence CUID or that full URL (the URL brings its own workspace)."
|
|
@@ -3968,7 +4095,7 @@ function createOccurrencesCommand() {
|
|
|
3968
4095
|
"No flags: show it. --draft: fill a draft from your activity since the last occurrence.",
|
|
3969
4096
|
"--answer key=markdown (repeatable) saves answers; --submit / --reopen changes its state."
|
|
3970
4097
|
].join(" ")
|
|
3971
|
-
).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)",
|
|
4098
|
+
).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)", collect2, []).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(
|
|
3972
4099
|
async (value, options, cmd) => {
|
|
3973
4100
|
const globalOpts = cmd.optsWithGlobals();
|
|
3974
4101
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -4037,7 +4164,7 @@ function createOccurrencesCommand() {
|
|
|
4037
4164
|
`\u2713 Agenda generated: ${result.itemCount} item${result.itemCount === 1 ? "" : "s"}${result.circulated ? ", circulated" : ""}`
|
|
4038
4165
|
);
|
|
4039
4166
|
if (options.circulate && !result.circulated) {
|
|
4040
|
-
console.log(
|
|
4167
|
+
console.log(chalk5.yellow(" Not circulated: this occurrence is skipped."));
|
|
4041
4168
|
}
|
|
4042
4169
|
outputAgendaPretty(result.agenda);
|
|
4043
4170
|
}
|
|
@@ -4118,7 +4245,7 @@ function createOccurrencesCommand() {
|
|
|
4118
4245
|
handleError(error, useJson);
|
|
4119
4246
|
}
|
|
4120
4247
|
});
|
|
4121
|
-
const agenda = new
|
|
4248
|
+
const agenda = new Command5("agenda").description("Edit an occurrence's agenda by hand");
|
|
4122
4249
|
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(
|
|
4123
4250
|
async (value, options, cmd) => {
|
|
4124
4251
|
const globalOpts = cmd.optsWithGlobals();
|
|
@@ -4194,7 +4321,7 @@ function createOccurrencesCommand() {
|
|
|
4194
4321
|
return occurrences;
|
|
4195
4322
|
}
|
|
4196
4323
|
function createCeremoniesCommand() {
|
|
4197
|
-
const ceremonies = new
|
|
4324
|
+
const ceremonies = new Command5("ceremonies").description(
|
|
4198
4325
|
[
|
|
4199
4326
|
"Recurring meeting definitions (Settings \u2192 Ceremonies) and their scheduled occurrences.",
|
|
4200
4327
|
"",
|
|
@@ -4359,7 +4486,7 @@ function createCeremoniesCommand() {
|
|
|
4359
4486
|
`\u2713 ${r.slug} ${r.action} (${r.occurrencesCreated} occurrence${r.occurrencesCreated === 1 ? "" : "s"} scheduled)`
|
|
4360
4487
|
);
|
|
4361
4488
|
if (r.unresolved.length > 0) {
|
|
4362
|
-
console.log(
|
|
4489
|
+
console.log(chalk5.yellow(` Unresolved people: ${r.unresolved.join(", ")}`));
|
|
4363
4490
|
}
|
|
4364
4491
|
}
|
|
4365
4492
|
}
|
|
@@ -4383,20 +4510,20 @@ function createCeremoniesCommand() {
|
|
|
4383
4510
|
console.log(JSON.stringify(result, null, 2));
|
|
4384
4511
|
} else {
|
|
4385
4512
|
console.log(
|
|
4386
|
-
|
|
4513
|
+
chalk5.bold(
|
|
4387
4514
|
`
|
|
4388
4515
|
${result.dryRun ? "Dry run" : "Applied"}: ${result.matched} of ${result.scanned} meetings matched`
|
|
4389
4516
|
)
|
|
4390
4517
|
);
|
|
4391
4518
|
if (result.occurrencesCreated > 0) {
|
|
4392
|
-
console.log(
|
|
4519
|
+
console.log(chalk5.gray(` Scheduled ${result.occurrencesCreated} missing occurrences (this happens even on a dry run).`));
|
|
4393
4520
|
}
|
|
4394
4521
|
for (const row of result.rows) {
|
|
4395
|
-
const target = row.occurrenceId ?
|
|
4522
|
+
const target = row.occurrenceId ? chalk5.green(`\u2192 ${row.ceremonyName} ${row.scheduledStart ? new Date(row.scheduledStart).toLocaleString() : ""}`) : chalk5.gray(`\u2014 ${row.reason}`);
|
|
4396
4523
|
console.log(` ${row.title ?? row.meetingId} ${target}`);
|
|
4397
4524
|
}
|
|
4398
4525
|
if (result.dryRun && result.matched > 0) {
|
|
4399
|
-
console.log(
|
|
4526
|
+
console.log(chalk5.gray("\nRe-run with --apply to write these attachments."));
|
|
4400
4527
|
}
|
|
4401
4528
|
}
|
|
4402
4529
|
} catch (error) {
|
|
@@ -4419,12 +4546,12 @@ ${result.dryRun ? "Dry run" : "Applied"}: ${result.matched} of ${result.scanned}
|
|
|
4419
4546
|
if (useJson) {
|
|
4420
4547
|
console.log(JSON.stringify({ match }, null, 2));
|
|
4421
4548
|
} else if (!match) {
|
|
4422
|
-
console.log(
|
|
4549
|
+
console.log(chalk5.gray("No ceremony meets in this room (or several do and none is on now)."));
|
|
4423
4550
|
} else {
|
|
4424
|
-
console.log(`${
|
|
4425
|
-
if (match.project) console.log(` ${
|
|
4551
|
+
console.log(`${chalk5.bold(match.ceremony.name)} ${chalk5.gray(`in ${match.workspace.name} \xB7 ${match.ceremony.id}`)}`);
|
|
4552
|
+
if (match.project) console.log(` ${chalk5.gray("Project:")} ${match.project.name}`);
|
|
4426
4553
|
console.log(
|
|
4427
|
-
match.occurrence ? ` ${
|
|
4554
|
+
match.occurrence ? ` ${chalk5.gray("Occurrence:")} ${new Date(match.occurrence.scheduledStart).toLocaleString()} ${chalk5.gray(match.occurrence.id)}` : chalk5.gray(" No occurrence on at that time.")
|
|
4428
4555
|
);
|
|
4429
4556
|
}
|
|
4430
4557
|
} catch (error) {
|
|
@@ -4436,8 +4563,8 @@ ${result.dryRun ? "Dry run" : "Applied"}: ${result.matched} of ${result.scanned}
|
|
|
4436
4563
|
}
|
|
4437
4564
|
|
|
4438
4565
|
// src/commands/databases.ts
|
|
4439
|
-
import { Command as
|
|
4440
|
-
import
|
|
4566
|
+
import { Command as Command6 } from "commander";
|
|
4567
|
+
import chalk6 from "chalk";
|
|
4441
4568
|
var ADDABLE_TYPES = [
|
|
4442
4569
|
"text",
|
|
4443
4570
|
"number",
|
|
@@ -4451,7 +4578,7 @@ var ADDABLE_TYPES = [
|
|
|
4451
4578
|
"lastEditedTime",
|
|
4452
4579
|
"createdBy"
|
|
4453
4580
|
];
|
|
4454
|
-
function
|
|
4581
|
+
function collect3(value, previous) {
|
|
4455
4582
|
return [...previous, value];
|
|
4456
4583
|
}
|
|
4457
4584
|
function parseLimit(value) {
|
|
@@ -4568,7 +4695,7 @@ function buildListView(database, filters, sort) {
|
|
|
4568
4695
|
};
|
|
4569
4696
|
}
|
|
4570
4697
|
function createDatabasesCommand() {
|
|
4571
|
-
const databases = new
|
|
4698
|
+
const databases = new Command6("databases").description(
|
|
4572
4699
|
'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.'
|
|
4573
4700
|
);
|
|
4574
4701
|
databases.command("create").description(
|
|
@@ -4600,7 +4727,7 @@ ${database.marker}` : database.marker,
|
|
|
4600
4727
|
\u2713 Database created${placed ? ` and placed in "${database.page.title}"` : ""}`);
|
|
4601
4728
|
outputDatabasePretty(database);
|
|
4602
4729
|
if (!placed && database.marker) {
|
|
4603
|
-
console.log(
|
|
4730
|
+
console.log(chalk6.gray(` Put this line in the page body to show it: ${database.marker}
|
|
4604
4731
|
`));
|
|
4605
4732
|
}
|
|
4606
4733
|
}
|
|
@@ -4667,7 +4794,7 @@ ${database.marker}` : database.marker,
|
|
|
4667
4794
|
return databases;
|
|
4668
4795
|
}
|
|
4669
4796
|
function createPropertiesCommand() {
|
|
4670
|
-
const properties = new
|
|
4797
|
+
const properties = new Command6("properties").description(
|
|
4671
4798
|
"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."
|
|
4672
4799
|
);
|
|
4673
4800
|
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(
|
|
@@ -4753,12 +4880,12 @@ function createPropertiesCommand() {
|
|
|
4753
4880
|
return properties;
|
|
4754
4881
|
}
|
|
4755
4882
|
function createRowsCommand() {
|
|
4756
|
-
const rows = new
|
|
4883
|
+
const rows = new Command6("rows").description(
|
|
4757
4884
|
`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>".`
|
|
4758
4885
|
);
|
|
4759
4886
|
rows.command("list <databaseId>").description(
|
|
4760
4887
|
'Rows through the saved view, or with your own --filter/--sort: "Status=Tracked", "Score>5", "Owner!=", "Name~latency", "Status in Tracked,Instrumenting".'
|
|
4761
|
-
).option("--filter <expr>", "Filter (repeatable); replaces the saved filters",
|
|
4888
|
+
).option("--filter <expr>", "Filter (repeatable); replaces the saved filters", collect3, []).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(
|
|
4762
4889
|
async (databaseId, options, cmd) => {
|
|
4763
4890
|
const globalOpts = cmd.optsWithGlobals();
|
|
4764
4891
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -4779,7 +4906,7 @@ function createRowsCommand() {
|
|
|
4779
4906
|
);
|
|
4780
4907
|
rows.command("add <databaseId>").description(
|
|
4781
4908
|
'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).'
|
|
4782
|
-
).option("--set <Property=value>", "A cell value (repeatable)",
|
|
4909
|
+
).option("--set <Property=value>", "A cell value (repeatable)", collect3, []).option("-n, --note <text>", "Why: recorded on the row page's first revision").action(async (databaseId, options, cmd) => {
|
|
4783
4910
|
const globalOpts = cmd.optsWithGlobals();
|
|
4784
4911
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
4785
4912
|
try {
|
|
@@ -4796,7 +4923,7 @@ function createRowsCommand() {
|
|
|
4796
4923
|
});
|
|
4797
4924
|
rows.command("import <databaseId>").description(
|
|
4798
4925
|
'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.'
|
|
4799
|
-
).requiredOption("--csv <file>", "The CSV file, or - for stdin").option("--map <Col=Property>", "Send a column to an existing property (repeatable)",
|
|
4926
|
+
).requiredOption("--csv <file>", "The CSV file, or - for stdin").option("--map <Col=Property>", "Send a column to an existing property (repeatable)", collect3, []).option("--new <Col=type>", "Create a property for a column (repeatable)", collect3, []).option("--skip <Col>", "Leave a column out (repeatable)", collect3, []).option("--dry-run", "Preview only: type every row, create nothing").option("-n, --note <text>", "Why: recorded on each new row's first revision").action(
|
|
4800
4927
|
async (databaseId, options, cmd) => {
|
|
4801
4928
|
const globalOpts = cmd.optsWithGlobals();
|
|
4802
4929
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -4827,7 +4954,7 @@ function createRowsCommand() {
|
|
|
4827
4954
|
}
|
|
4828
4955
|
}
|
|
4829
4956
|
);
|
|
4830
|
-
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)",
|
|
4957
|
+
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)", collect3, []).option("--clear <Property>", "Empty a cell (repeatable)", collect3, []).option("-n, --note <text>", "Why: shown in the row page's history").action(
|
|
4831
4958
|
async (rowId, options, cmd) => {
|
|
4832
4959
|
const globalOpts = cmd.optsWithGlobals();
|
|
4833
4960
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -4865,8 +4992,8 @@ function createRowsCommand() {
|
|
|
4865
4992
|
}
|
|
4866
4993
|
|
|
4867
4994
|
// src/commands/decisions.ts
|
|
4868
|
-
import { Command as
|
|
4869
|
-
import
|
|
4995
|
+
import { Command as Command7 } from "commander";
|
|
4996
|
+
import chalk7 from "chalk";
|
|
4870
4997
|
var STATUSES = [
|
|
4871
4998
|
"OPEN",
|
|
4872
4999
|
"PROPOSED",
|
|
@@ -5114,7 +5241,7 @@ function addConfirmCommand(parent) {
|
|
|
5114
5241
|
);
|
|
5115
5242
|
}
|
|
5116
5243
|
function createDecisionsCommand() {
|
|
5117
|
-
const decisions = new
|
|
5244
|
+
const decisions = new Command7("decisions").description(
|
|
5118
5245
|
[
|
|
5119
5246
|
"Log and manage decisions and open questions (the workspace Decision Log).",
|
|
5120
5247
|
"",
|
|
@@ -5169,7 +5296,7 @@ function createDecisionsCommand() {
|
|
|
5169
5296
|
outputDecisionsPretty(rows2);
|
|
5170
5297
|
if (!result.canLogDecision) {
|
|
5171
5298
|
console.log(
|
|
5172
|
-
|
|
5299
|
+
chalk7.yellow(
|
|
5173
5300
|
"You cannot log decisions on this meeting (no edit access, or it has no workspace)."
|
|
5174
5301
|
)
|
|
5175
5302
|
);
|
|
@@ -5376,7 +5503,7 @@ function createDecisionsCommand() {
|
|
|
5376
5503
|
\u2713 ${decision.status === "OPEN" ? "Open question" : "Decision"} logged`
|
|
5377
5504
|
);
|
|
5378
5505
|
outputDecisionPretty(decision);
|
|
5379
|
-
if (featureLink) console.log(
|
|
5506
|
+
if (featureLink) console.log(chalk7.gray(` Linked to feature ${options.feature}`));
|
|
5380
5507
|
}
|
|
5381
5508
|
} catch (error) {
|
|
5382
5509
|
handleError(error, useJson);
|
|
@@ -5485,9 +5612,9 @@ function createDecisionsCommand() {
|
|
|
5485
5612
|
const link = options.ticket ? await client.decisions.linkTicket(workspaceId, decisionId, options.ticket) : await client.decisions.linkFeature(workspaceId, decisionId, options.feature);
|
|
5486
5613
|
if (useJson) console.log(JSON.stringify(link, null, 2));
|
|
5487
5614
|
else {
|
|
5488
|
-
console.log(`\u2713 Linked ${
|
|
5615
|
+
console.log(`\u2713 Linked ${chalk7.gray(`(link id ${link.id})`)}`);
|
|
5489
5616
|
console.log(
|
|
5490
|
-
|
|
5617
|
+
chalk7.gray(" Remove it with: exponential decisions unlink --link " + link.id)
|
|
5491
5618
|
);
|
|
5492
5619
|
}
|
|
5493
5620
|
} catch (error) {
|
|
@@ -5510,7 +5637,7 @@ function createDecisionsCommand() {
|
|
|
5510
5637
|
handleError(error, useJson);
|
|
5511
5638
|
}
|
|
5512
5639
|
});
|
|
5513
|
-
const drafts = new
|
|
5640
|
+
const drafts = new Command7("draft").description(
|
|
5514
5641
|
"Review decisions an agent proposed but nobody has confirmed yet (visible only on their source meeting)"
|
|
5515
5642
|
);
|
|
5516
5643
|
drafts.command("extract").description(
|
|
@@ -5525,22 +5652,22 @@ function createDecisionsCommand() {
|
|
|
5525
5652
|
else {
|
|
5526
5653
|
if (result.alreadyPublished) {
|
|
5527
5654
|
console.log(
|
|
5528
|
-
|
|
5655
|
+
chalk7.gray("This meeting already has confirmed decisions \u2014 nothing was extracted.")
|
|
5529
5656
|
);
|
|
5530
5657
|
} else if (result.alreadyDrafted) {
|
|
5531
|
-
console.log(
|
|
5658
|
+
console.log(chalk7.gray("Returning the drafts this meeting already had."));
|
|
5532
5659
|
}
|
|
5533
5660
|
console.log(
|
|
5534
5661
|
`\u2713 ${result.draftCount} draft${result.draftCount === 1 ? "" : "s"} awaiting review (${result.draftsCreated} new)`
|
|
5535
5662
|
);
|
|
5536
5663
|
if (result.discardedWithoutEvidence > 0) {
|
|
5537
5664
|
console.log(
|
|
5538
|
-
|
|
5665
|
+
chalk7.gray(
|
|
5539
5666
|
` ${result.discardedWithoutEvidence} candidate(s) dropped \u2014 no transcript turn supported them.`
|
|
5540
5667
|
)
|
|
5541
5668
|
);
|
|
5542
5669
|
}
|
|
5543
|
-
for (const message of result.errors) console.log(
|
|
5670
|
+
for (const message of result.errors) console.log(chalk7.yellow(` ${message}`));
|
|
5544
5671
|
}
|
|
5545
5672
|
} catch (error) {
|
|
5546
5673
|
handleError(error, useJson);
|
|
@@ -5597,9 +5724,9 @@ function createDecisionsCommand() {
|
|
|
5597
5724
|
}
|
|
5598
5725
|
|
|
5599
5726
|
// src/commands/deals.ts
|
|
5600
|
-
import { Command as
|
|
5727
|
+
import { Command as Command8 } from "commander";
|
|
5601
5728
|
function createDealsCommand() {
|
|
5602
|
-
const deals = new
|
|
5729
|
+
const deals = new Command8("deals").description("Manage pipeline deals");
|
|
5603
5730
|
deals.command("pipeline").description("Get pipeline overview with stages").requiredOption("--workspace <id>", "Workspace ID").action(async (options, cmd) => {
|
|
5604
5731
|
const globalOpts = cmd.optsWithGlobals();
|
|
5605
5732
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -5784,7 +5911,7 @@ function createDealsCommand() {
|
|
|
5784
5911
|
}
|
|
5785
5912
|
|
|
5786
5913
|
// src/commands/epics.ts
|
|
5787
|
-
import { Command as
|
|
5914
|
+
import { Command as Command9 } from "commander";
|
|
5788
5915
|
var EPIC_STATUSES = ["OPEN", "IN_PROGRESS", "DONE", "CANCELLED"];
|
|
5789
5916
|
var EPIC_PRIORITIES = ["HIGH", "MEDIUM", "LOW", "NONE"];
|
|
5790
5917
|
function validateEpicStatus(value) {
|
|
@@ -5812,7 +5939,7 @@ function parseDate2(value) {
|
|
|
5812
5939
|
return d;
|
|
5813
5940
|
}
|
|
5814
5941
|
function createEpicsCommand() {
|
|
5815
|
-
const epics = new
|
|
5942
|
+
const epics = new Command9("epics").description(
|
|
5816
5943
|
"Manage epics. Epics are workspace-scoped and group actions and tickets across products."
|
|
5817
5944
|
);
|
|
5818
5945
|
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(
|
|
@@ -5929,10 +6056,10 @@ function createEpicsCommand() {
|
|
|
5929
6056
|
}
|
|
5930
6057
|
|
|
5931
6058
|
// src/commands/features.ts
|
|
5932
|
-
import { Command as
|
|
6059
|
+
import { Command as Command15 } from "commander";
|
|
5933
6060
|
|
|
5934
6061
|
// src/commands/stories.ts
|
|
5935
|
-
import { Command as
|
|
6062
|
+
import { Command as Command10 } from "commander";
|
|
5936
6063
|
async function readStdin() {
|
|
5937
6064
|
const chunks = [];
|
|
5938
6065
|
for await (const chunk of process.stdin) {
|
|
@@ -5941,7 +6068,7 @@ async function readStdin() {
|
|
|
5941
6068
|
return Buffer.concat(chunks).toString("utf-8");
|
|
5942
6069
|
}
|
|
5943
6070
|
function createStoriesCommand() {
|
|
5944
|
-
const stories = new
|
|
6071
|
+
const stories = new Command10("stories").description(
|
|
5945
6072
|
"Manage a feature's native, structured user stories (As a / I want / So that)."
|
|
5946
6073
|
);
|
|
5947
6074
|
stories.command("add").description(
|
|
@@ -6075,7 +6202,7 @@ function createStoriesCommand() {
|
|
|
6075
6202
|
}
|
|
6076
6203
|
|
|
6077
6204
|
// src/commands/scopes.ts
|
|
6078
|
-
import { Command as
|
|
6205
|
+
import { Command as Command11 } from "commander";
|
|
6079
6206
|
var SCOPE_STATUSES = [
|
|
6080
6207
|
"PLANNED",
|
|
6081
6208
|
"IN_PROGRESS",
|
|
@@ -6092,7 +6219,7 @@ function validateScopeStatus(value) {
|
|
|
6092
6219
|
return value;
|
|
6093
6220
|
}
|
|
6094
6221
|
function createScopesCommand() {
|
|
6095
|
-
const scopes = new
|
|
6222
|
+
const scopes = new Command11("scopes").description(
|
|
6096
6223
|
`Manage a feature's scopes: shippable increments ("V1", "V2"), each with its own lifecycle.`
|
|
6097
6224
|
);
|
|
6098
6225
|
scopes.command("list").description("List a feature's scopes").requiredOption("--feature <id>", "Feature CUID").action(
|
|
@@ -6171,7 +6298,7 @@ function createScopesCommand() {
|
|
|
6171
6298
|
}
|
|
6172
6299
|
|
|
6173
6300
|
// src/commands/requirements.ts
|
|
6174
|
-
import { Command as
|
|
6301
|
+
import { Command as Command12 } from "commander";
|
|
6175
6302
|
var REQUIREMENT_KINDS = [
|
|
6176
6303
|
"FUNCTIONAL",
|
|
6177
6304
|
"NON_FUNCTIONAL",
|
|
@@ -6194,7 +6321,7 @@ async function readStdin2() {
|
|
|
6194
6321
|
return Buffer.concat(chunks).toString("utf-8");
|
|
6195
6322
|
}
|
|
6196
6323
|
function createRequirementsCommand() {
|
|
6197
|
-
const requirements = new
|
|
6324
|
+
const requirements = new Command12("requirements").description(
|
|
6198
6325
|
`Manage a feature's requirements: atomic, testable EARS-style "shall" statements, checkable met/unmet.`
|
|
6199
6326
|
);
|
|
6200
6327
|
requirements.command("add").description(
|
|
@@ -6325,25 +6452,25 @@ function createRequirementsCommand() {
|
|
|
6325
6452
|
}
|
|
6326
6453
|
|
|
6327
6454
|
// src/commands/areas.ts
|
|
6328
|
-
import { Command as
|
|
6329
|
-
import
|
|
6455
|
+
import { Command as Command13 } from "commander";
|
|
6456
|
+
import chalk8 from "chalk";
|
|
6330
6457
|
function outputAreasPretty(areas) {
|
|
6331
6458
|
if (areas.length === 0) {
|
|
6332
|
-
console.log(
|
|
6459
|
+
console.log(chalk8.gray("No areas found."));
|
|
6333
6460
|
return;
|
|
6334
6461
|
}
|
|
6335
|
-
console.log(
|
|
6462
|
+
console.log(chalk8.bold(`
|
|
6336
6463
|
Areas (${areas.length} total)`));
|
|
6337
|
-
console.log(
|
|
6464
|
+
console.log(chalk8.gray("\u2500".repeat(50)));
|
|
6338
6465
|
for (const a of areas) {
|
|
6339
|
-
const count = a._count?.features != null ?
|
|
6340
|
-
console.log(` ${
|
|
6341
|
-
console.log(
|
|
6466
|
+
const count = a._count?.features != null ? chalk8.gray(` (${a._count.features} features)`) : "";
|
|
6467
|
+
console.log(` ${chalk8.bold(a.name)}${count}`);
|
|
6468
|
+
console.log(chalk8.gray(` ID: ${a.id}`));
|
|
6342
6469
|
}
|
|
6343
6470
|
console.log();
|
|
6344
6471
|
}
|
|
6345
6472
|
function createAreasCommand() {
|
|
6346
|
-
const areas = new
|
|
6473
|
+
const areas = new Command13("areas").description(
|
|
6347
6474
|
"Manage a product's areas: the buckets features are filed under (a feature has exactly one or none)."
|
|
6348
6475
|
);
|
|
6349
6476
|
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(
|
|
@@ -6387,7 +6514,7 @@ function createAreasCommand() {
|
|
|
6387
6514
|
}
|
|
6388
6515
|
|
|
6389
6516
|
// src/commands/featureComments.ts
|
|
6390
|
-
import { Command as
|
|
6517
|
+
import { Command as Command14 } from "commander";
|
|
6391
6518
|
|
|
6392
6519
|
// src/utils/mentions.ts
|
|
6393
6520
|
function candidateLabels(member) {
|
|
@@ -6460,7 +6587,7 @@ function collectMention(value, previous) {
|
|
|
6460
6587
|
|
|
6461
6588
|
// src/commands/featureComments.ts
|
|
6462
6589
|
function createFeatureCommentsCommand() {
|
|
6463
|
-
const comment = new
|
|
6590
|
+
const comment = new Command14("comment").description(
|
|
6464
6591
|
"Read and post comments on a feature. Mention teammates with --mention."
|
|
6465
6592
|
);
|
|
6466
6593
|
comment.command("list").description("List comments on a feature").requiredOption("--feature <id>", "Feature ID").action(async (options, cmd) => {
|
|
@@ -6661,7 +6788,7 @@ function validateFeatureStatus(value) {
|
|
|
6661
6788
|
return value;
|
|
6662
6789
|
}
|
|
6663
6790
|
function createFeaturesCommand() {
|
|
6664
|
-
const features = new
|
|
6791
|
+
const features = new Command15("features").description(
|
|
6665
6792
|
"Manage features. A feature lives under a product and groups user stories, scopes, and tickets."
|
|
6666
6793
|
);
|
|
6667
6794
|
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(
|
|
@@ -6918,8 +7045,8 @@ Aborted: ${reason}. Feature "${feature.name}" was NOT deleted.`);
|
|
|
6918
7045
|
}
|
|
6919
7046
|
|
|
6920
7047
|
// src/commands/labels.ts
|
|
6921
|
-
import { Command as
|
|
6922
|
-
import
|
|
7048
|
+
import { Command as Command16 } from "commander";
|
|
7049
|
+
import chalk9 from "chalk";
|
|
6923
7050
|
var TRIAGE_LABELS = [
|
|
6924
7051
|
{ slug: "needs-triage", name: "needs-triage", color: "avatar-orange" },
|
|
6925
7052
|
{ slug: "needs-info", name: "needs-info", color: "avatar-yellow" },
|
|
@@ -6933,22 +7060,22 @@ function looksLikeCuid(value) {
|
|
|
6933
7060
|
}
|
|
6934
7061
|
function outputTagsPretty(tags) {
|
|
6935
7062
|
if (tags.length === 0) {
|
|
6936
|
-
console.log(
|
|
7063
|
+
console.log(chalk9.dim("No labels found."));
|
|
6937
7064
|
return;
|
|
6938
7065
|
}
|
|
6939
7066
|
console.log();
|
|
6940
7067
|
for (const tag of tags) {
|
|
6941
|
-
const scope = tag.workspaceId === null ?
|
|
6942
|
-
const category = tag.category === null ?
|
|
7068
|
+
const scope = tag.workspaceId === null ? chalk9.cyan("global") : chalk9.magenta("workspace");
|
|
7069
|
+
const category = tag.category === null ? chalk9.dim("(label)") : chalk9.dim(`(${tag.category})`);
|
|
6943
7070
|
console.log(
|
|
6944
|
-
` ${
|
|
7071
|
+
` ${chalk9.bold(tag.slug)} ${tag.name} ${chalk9.gray(tag.color)} ${scope} ${category}`
|
|
6945
7072
|
);
|
|
6946
7073
|
}
|
|
6947
7074
|
console.log();
|
|
6948
7075
|
}
|
|
6949
7076
|
function outputTagPretty(tag, prefix) {
|
|
6950
7077
|
if (prefix) console.log(prefix);
|
|
6951
|
-
console.log(` ${
|
|
7078
|
+
console.log(` ${chalk9.bold(tag.slug)} ${tag.name} ${chalk9.gray(tag.color)}`);
|
|
6952
7079
|
}
|
|
6953
7080
|
async function resolveLabelIds(client, workspaceId, values) {
|
|
6954
7081
|
if (values.length === 0) return [];
|
|
@@ -6972,7 +7099,7 @@ async function resolveLabelIds(client, workspaceId, values) {
|
|
|
6972
7099
|
return [...byId, ...resolvedFromSlugs];
|
|
6973
7100
|
}
|
|
6974
7101
|
function createLabelsCommand() {
|
|
6975
|
-
const labels = new
|
|
7102
|
+
const labels = new Command16("labels").description(
|
|
6976
7103
|
"Manage labels (orthogonal tags applied to actions, tickets, features, and epics)."
|
|
6977
7104
|
);
|
|
6978
7105
|
labels.command("list").description("List labels visible in a workspace").option("--workspace <slug|id>", "Workspace slug or CUID").option(
|
|
@@ -7020,7 +7147,7 @@ function createLabelsCommand() {
|
|
|
7020
7147
|
if (useJson) {
|
|
7021
7148
|
console.log(JSON.stringify(tag, null, 2));
|
|
7022
7149
|
} else {
|
|
7023
|
-
outputTagPretty(tag,
|
|
7150
|
+
outputTagPretty(tag, chalk9.green("\n\u2713 Label created"));
|
|
7024
7151
|
}
|
|
7025
7152
|
} catch (error) {
|
|
7026
7153
|
handleError(error, useJson);
|
|
@@ -7058,10 +7185,10 @@ function createLabelsCommand() {
|
|
|
7058
7185
|
console.log(JSON.stringify(results, null, 2));
|
|
7059
7186
|
} else {
|
|
7060
7187
|
console.log();
|
|
7061
|
-
console.log(
|
|
7188
|
+
console.log(chalk9.bold("Triage labels:"));
|
|
7062
7189
|
for (const r of results) {
|
|
7063
|
-
const tag =
|
|
7064
|
-
const status = r.status === "created" ?
|
|
7190
|
+
const tag = chalk9.bold(r.slug);
|
|
7191
|
+
const status = r.status === "created" ? chalk9.green("created") : chalk9.dim("existed");
|
|
7065
7192
|
console.log(` ${tag} ${status}`);
|
|
7066
7193
|
}
|
|
7067
7194
|
console.log();
|
|
@@ -7075,10 +7202,10 @@ function createLabelsCommand() {
|
|
|
7075
7202
|
}
|
|
7076
7203
|
|
|
7077
7204
|
// src/commands/meetings.ts
|
|
7078
|
-
import { Command as
|
|
7079
|
-
import
|
|
7205
|
+
import { Command as Command17 } from "commander";
|
|
7206
|
+
import chalk10 from "chalk";
|
|
7080
7207
|
function createMeetingsCommand() {
|
|
7081
|
-
const meetings = new
|
|
7208
|
+
const meetings = new Command17("meetings").description(
|
|
7082
7209
|
"Manage meetings and their notes (recorded, imported, or manually created)"
|
|
7083
7210
|
);
|
|
7084
7211
|
meetings.command("list").description(
|
|
@@ -7239,7 +7366,7 @@ function createMeetingsCommand() {
|
|
|
7239
7366
|
console.log(`\u2713 Deleted ${count} of ${ids.length} meeting${ids.length === 1 ? "" : "s"}`);
|
|
7240
7367
|
if (skipped > 0) {
|
|
7241
7368
|
console.log(
|
|
7242
|
-
|
|
7369
|
+
chalk10.yellow(
|
|
7243
7370
|
`${skipped} id(s) were skipped \u2014 not found, or not owned by you.`
|
|
7244
7371
|
)
|
|
7245
7372
|
);
|
|
@@ -7250,7 +7377,7 @@ function createMeetingsCommand() {
|
|
|
7250
7377
|
}
|
|
7251
7378
|
}
|
|
7252
7379
|
);
|
|
7253
|
-
const notes = new
|
|
7380
|
+
const notes = new Command17("notes").description(
|
|
7254
7381
|
"Read and write a meeting's notes"
|
|
7255
7382
|
);
|
|
7256
7383
|
notes.command("get <id>").description(
|
|
@@ -7266,7 +7393,7 @@ function createMeetingsCommand() {
|
|
|
7266
7393
|
process.stdout.write(body.endsWith("\n") ? body : `${body}
|
|
7267
7394
|
`);
|
|
7268
7395
|
} else if (process.stdout.isTTY) {
|
|
7269
|
-
console.log(
|
|
7396
|
+
console.log(chalk10.gray("No notes yet."));
|
|
7270
7397
|
}
|
|
7271
7398
|
} catch (error) {
|
|
7272
7399
|
handleError(error, shouldUseJson(globalOpts.json, globalOpts.pretty));
|
|
@@ -7315,7 +7442,7 @@ function createMeetingsCommand() {
|
|
|
7315
7442
|
}
|
|
7316
7443
|
|
|
7317
7444
|
// src/commands/organizations.ts
|
|
7318
|
-
import { Command as
|
|
7445
|
+
import { Command as Command18 } from "commander";
|
|
7319
7446
|
var VALID_SIZES = [
|
|
7320
7447
|
"1-10",
|
|
7321
7448
|
"11-50",
|
|
@@ -7325,7 +7452,7 @@ var VALID_SIZES = [
|
|
|
7325
7452
|
"1000+"
|
|
7326
7453
|
];
|
|
7327
7454
|
function createOrganizationsCommand() {
|
|
7328
|
-
const organizations = new
|
|
7455
|
+
const organizations = new Command18("organizations").alias("orgs").description("Manage CRM organizations");
|
|
7329
7456
|
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) => {
|
|
7330
7457
|
const globalOpts = cmd.optsWithGlobals();
|
|
7331
7458
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -7393,13 +7520,13 @@ function createOrganizationsCommand() {
|
|
|
7393
7520
|
}
|
|
7394
7521
|
|
|
7395
7522
|
// src/commands/pages.ts
|
|
7396
|
-
import { Command as
|
|
7397
|
-
import
|
|
7523
|
+
import { Command as Command20 } from "commander";
|
|
7524
|
+
import chalk11 from "chalk";
|
|
7398
7525
|
|
|
7399
7526
|
// src/commands/pageComments.ts
|
|
7400
|
-
import { Command as
|
|
7527
|
+
import { Command as Command19 } from "commander";
|
|
7401
7528
|
function createPageCommentsCommand() {
|
|
7402
|
-
const comment = new
|
|
7529
|
+
const comment = new Command19("comment").description(
|
|
7403
7530
|
"Read and post comments on a page. Mention teammates with --mention."
|
|
7404
7531
|
);
|
|
7405
7532
|
comment.command("list").description("List comments on a page").requiredOption("--page <id>", "Page ID").action(async (options, cmd) => {
|
|
@@ -7502,7 +7629,7 @@ function parseLimit2(value) {
|
|
|
7502
7629
|
return n;
|
|
7503
7630
|
}
|
|
7504
7631
|
function createPagesCommand() {
|
|
7505
|
-
const pages = new
|
|
7632
|
+
const pages = new Command20("pages").description(
|
|
7506
7633
|
`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".`
|
|
7507
7634
|
);
|
|
7508
7635
|
pages.command("list").description("List pages in a workspace (metadata only, no bodies)").option("--workspace <slug|id>", "Workspace (defaults to the configured default)").option(
|
|
@@ -7651,13 +7778,13 @@ function createPagesCommand() {
|
|
|
7651
7778
|
const revision = await client.pages.revision(id, revisionId);
|
|
7652
7779
|
if (useJson) console.log(JSON.stringify(revision, null, 2));
|
|
7653
7780
|
else {
|
|
7654
|
-
console.log(
|
|
7781
|
+
console.log(chalk11.gray("\u2500".repeat(50)));
|
|
7655
7782
|
console.log(
|
|
7656
7783
|
`
|
|
7657
|
-
${
|
|
7784
|
+
${chalk11.bold(revision.title)} ${chalk11.gray(`v${revision.docVersion} \xB7 ${revision.kind}`)}`
|
|
7658
7785
|
);
|
|
7659
|
-
console.log(
|
|
7660
|
-
if (revision.note) console.log(` ${
|
|
7786
|
+
console.log(chalk11.gray(` Revision: ${revision.id}`));
|
|
7787
|
+
if (revision.note) console.log(` ${chalk11.gray("Note:")} ${revision.note}`);
|
|
7661
7788
|
if (revision.body) console.log(`
|
|
7662
7789
|
${revision.body}
|
|
7663
7790
|
`);
|
|
@@ -7729,8 +7856,8 @@ ${revision.body}
|
|
|
7729
7856
|
}
|
|
7730
7857
|
|
|
7731
7858
|
// src/commands/positions.ts
|
|
7732
|
-
import { Command as
|
|
7733
|
-
import
|
|
7859
|
+
import { Command as Command21 } from "commander";
|
|
7860
|
+
import chalk12 from "chalk";
|
|
7734
7861
|
var WORKSPACE_OPTION = ["--workspace <slug|id>", "Workspace (defaults to your default workspace)"];
|
|
7735
7862
|
var HOLDER_OPTION_DESCRIPTION = "Holder: a workspace member by name, email, or user id (repeatable)";
|
|
7736
7863
|
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.";
|
|
@@ -7751,16 +7878,16 @@ async function loadPosition(client, workspaceId, ref) {
|
|
|
7751
7878
|
return pickPosition(positions, ref);
|
|
7752
7879
|
}
|
|
7753
7880
|
function holderLabel(holder) {
|
|
7754
|
-
return `${holder.name ?? holder.userId}${holder.isAgent ?
|
|
7881
|
+
return `${holder.name ?? holder.userId}${holder.isAgent ? chalk12.gray(" (agent)") : ""}`;
|
|
7755
7882
|
}
|
|
7756
7883
|
function printPosition(position) {
|
|
7757
|
-
console.log(`${
|
|
7884
|
+
console.log(`${chalk12.bold(position.title)} ${chalk12.gray(`(${position.id})`)}`);
|
|
7758
7885
|
console.log(
|
|
7759
|
-
` ${
|
|
7886
|
+
` ${chalk12.gray("Held by:")} ${position.holders.length ? position.holders.map(holderLabel).join(", ") : chalk12.yellow("nobody")}`
|
|
7760
7887
|
);
|
|
7761
|
-
console.log(` ${
|
|
7888
|
+
console.log(` ${chalk12.gray("Remit:")} ${position.remit.replace(/\n/g, "\n ")}`);
|
|
7762
7889
|
if (position.notAccountableFor) {
|
|
7763
|
-
console.log(` ${
|
|
7890
|
+
console.log(` ${chalk12.gray("Not accountable for:")} ${position.notAccountableFor.replace(/\n/g, "\n ")}`);
|
|
7764
7891
|
}
|
|
7765
7892
|
console.log();
|
|
7766
7893
|
}
|
|
@@ -7769,7 +7896,7 @@ function output(position, useJson, verb) {
|
|
|
7769
7896
|
console.log(JSON.stringify(position, null, 2));
|
|
7770
7897
|
return;
|
|
7771
7898
|
}
|
|
7772
|
-
console.log(
|
|
7899
|
+
console.log(chalk12.green(`${verb}:`));
|
|
7773
7900
|
printPosition(position);
|
|
7774
7901
|
}
|
|
7775
7902
|
function parseImportFile(raw, members) {
|
|
@@ -7803,7 +7930,7 @@ function parseImportFile(raw, members) {
|
|
|
7803
7930
|
});
|
|
7804
7931
|
}
|
|
7805
7932
|
function createPositionsCommand() {
|
|
7806
|
-
const positions = new
|
|
7933
|
+
const positions = new Command21("positions").alias("roles").description(
|
|
7807
7934
|
`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}`
|
|
7808
7935
|
);
|
|
7809
7936
|
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) => {
|
|
@@ -7818,9 +7945,9 @@ function createPositionsCommand() {
|
|
|
7818
7945
|
return;
|
|
7819
7946
|
}
|
|
7820
7947
|
if (result.positions.length === 0) {
|
|
7821
|
-
console.log(
|
|
7948
|
+
console.log(chalk12.gray("No positions yet. Add one with `exponential positions create`."));
|
|
7822
7949
|
} else {
|
|
7823
|
-
console.log(
|
|
7950
|
+
console.log(chalk12.bold(`
|
|
7824
7951
|
Positions (${result.positions.length})
|
|
7825
7952
|
`));
|
|
7826
7953
|
result.positions.forEach(printPosition);
|
|
@@ -7828,14 +7955,14 @@ Positions (${result.positions.length})
|
|
|
7828
7955
|
if (options.gaps) {
|
|
7829
7956
|
const gaps = result.members.filter((m) => m.remitGap);
|
|
7830
7957
|
if (gaps.length === 0) {
|
|
7831
|
-
console.log(
|
|
7958
|
+
console.log(chalk12.gray("Every member has a stated remit."));
|
|
7832
7959
|
} else {
|
|
7833
7960
|
const roster = await client.workspaces.listMembers(workspaceId);
|
|
7834
7961
|
const nameOf = (id) => {
|
|
7835
7962
|
const member = roster.find((r) => r.id === id);
|
|
7836
7963
|
return member?.name ?? member?.email ?? id;
|
|
7837
7964
|
};
|
|
7838
|
-
console.log(
|
|
7965
|
+
console.log(chalk12.bold(`No stated remit (${gaps.length}):`));
|
|
7839
7966
|
gaps.forEach((g) => console.log(` ${nameOf(g.userId)}`));
|
|
7840
7967
|
}
|
|
7841
7968
|
}
|
|
@@ -7921,7 +8048,7 @@ Positions (${result.positions.length})
|
|
|
7921
8048
|
const position = await loadPosition(client, workspaceId, ref);
|
|
7922
8049
|
await client.positions.delete(workspaceId, position.id);
|
|
7923
8050
|
if (useJson) console.log(JSON.stringify({ id: position.id, title: position.title, deleted: true }, null, 2));
|
|
7924
|
-
else console.log(
|
|
8051
|
+
else console.log(chalk12.green(`Deleted "${position.title}"`));
|
|
7925
8052
|
} catch (error) {
|
|
7926
8053
|
handleError(error, useJson);
|
|
7927
8054
|
}
|
|
@@ -7970,10 +8097,10 @@ Positions (${result.positions.length})
|
|
|
7970
8097
|
return;
|
|
7971
8098
|
}
|
|
7972
8099
|
const nameOf = (id) => roster.find((r) => r.id === id)?.name ?? id;
|
|
7973
|
-
console.log(
|
|
8100
|
+
console.log(chalk12.bold(result.written ? "\nImported:\n" : "\nDry run \u2014 nothing written:\n"));
|
|
7974
8101
|
for (const row of result.results) {
|
|
7975
|
-
const tag = row.outcome === "create" ?
|
|
7976
|
-
console.log(` ${tag} ${
|
|
8102
|
+
const tag = row.outcome === "create" ? chalk12.green("create") : chalk12.yellow("update");
|
|
8103
|
+
console.log(` ${tag} ${chalk12.bold(row.title)} \u2014 ${row.holderUserIds.map(nameOf).join(", ") || "no holders"}`);
|
|
7977
8104
|
}
|
|
7978
8105
|
} catch (error) {
|
|
7979
8106
|
handleError(error, useJson);
|
|
@@ -7983,9 +8110,9 @@ Positions (${result.positions.length})
|
|
|
7983
8110
|
}
|
|
7984
8111
|
|
|
7985
8112
|
// src/commands/products.ts
|
|
7986
|
-
import { Command as
|
|
8113
|
+
import { Command as Command22 } from "commander";
|
|
7987
8114
|
function createProductsCommand() {
|
|
7988
|
-
const products = new
|
|
8115
|
+
const products = new Command22("products").description(
|
|
7989
8116
|
"Manage products. A workspace contains products; a product holds features and tickets."
|
|
7990
8117
|
);
|
|
7991
8118
|
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) => {
|
|
@@ -8126,7 +8253,7 @@ Re-run with --force to delete it anyway.`
|
|
|
8126
8253
|
}
|
|
8127
8254
|
|
|
8128
8255
|
// src/commands/projects.ts
|
|
8129
|
-
import { Command as
|
|
8256
|
+
import { Command as Command23 } from "commander";
|
|
8130
8257
|
var PROJECT_STATUSES = [
|
|
8131
8258
|
"ACTIVE",
|
|
8132
8259
|
"ON_HOLD",
|
|
@@ -8153,7 +8280,7 @@ function validateProjectPriority(value) {
|
|
|
8153
8280
|
return value;
|
|
8154
8281
|
}
|
|
8155
8282
|
function createProjectsCommand() {
|
|
8156
|
-
const projects = new
|
|
8283
|
+
const projects = new Command23("projects").description("Manage projects");
|
|
8157
8284
|
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) => {
|
|
8158
8285
|
const globalOpts = cmd.optsWithGlobals();
|
|
8159
8286
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -8272,7 +8399,7 @@ Re-run with --force to delete it anyway.`
|
|
|
8272
8399
|
}
|
|
8273
8400
|
|
|
8274
8401
|
// src/commands/resources.ts
|
|
8275
|
-
import { Command as
|
|
8402
|
+
import { Command as Command24 } from "commander";
|
|
8276
8403
|
var STATUS_FILTERS = ["unread", "to_read", "reading", "read", "all"];
|
|
8277
8404
|
function validateStatus(value) {
|
|
8278
8405
|
const v = value ?? "unread";
|
|
@@ -8287,7 +8414,7 @@ function collectTags(value, previous) {
|
|
|
8287
8414
|
}
|
|
8288
8415
|
var TAG_OPTION = "--tag <tag>";
|
|
8289
8416
|
function createResourcesCommand() {
|
|
8290
|
-
const resources = new
|
|
8417
|
+
const resources = new Command24("resources").description(
|
|
8291
8418
|
"Saved links and reference material. `list` defaults to the Reading list (unread); `create --url` saves a link to read later."
|
|
8292
8419
|
);
|
|
8293
8420
|
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(
|
|
@@ -8394,7 +8521,7 @@ function createResourcesCommand() {
|
|
|
8394
8521
|
}
|
|
8395
8522
|
|
|
8396
8523
|
// src/commands/runner.ts
|
|
8397
|
-
import { Command as
|
|
8524
|
+
import { Command as Command25 } from "commander";
|
|
8398
8525
|
import { hostname, homedir as homedir2, tmpdir as tmpdir2 } from "os";
|
|
8399
8526
|
import { execFileSync } from "child_process";
|
|
8400
8527
|
import { mkdirSync as mkdirSync3 } from "fs";
|
|
@@ -8846,7 +8973,7 @@ function removeServiceFile(plan) {
|
|
|
8846
8973
|
|
|
8847
8974
|
// src/commands/runner.ts
|
|
8848
8975
|
function createRunnerCommand() {
|
|
8849
|
-
const cmd = new
|
|
8976
|
+
const cmd = new Command25("runner").description(
|
|
8850
8977
|
"Run your Assistant locally: claim its queued runs and work them with Claude Code on this machine"
|
|
8851
8978
|
);
|
|
8852
8979
|
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) => {
|
|
@@ -8957,8 +9084,8 @@ ${plan.contents}
|
|
|
8957
9084
|
}
|
|
8958
9085
|
|
|
8959
9086
|
// src/commands/search.ts
|
|
8960
|
-
import { Command as
|
|
8961
|
-
import
|
|
9087
|
+
import { Command as Command26 } from "commander";
|
|
9088
|
+
import chalk13 from "chalk";
|
|
8962
9089
|
var KNOWLEDGE_TYPES = ["transcription", "resource", "document", "page"];
|
|
8963
9090
|
function parseTypes(value) {
|
|
8964
9091
|
if (!value) return void 0;
|
|
@@ -8987,7 +9114,7 @@ var TYPE_LABELS = {
|
|
|
8987
9114
|
product: "Products"
|
|
8988
9115
|
};
|
|
8989
9116
|
function createSearchCommand() {
|
|
8990
|
-
const search = new
|
|
9117
|
+
const search = new Command26("search").description(
|
|
8991
9118
|
"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."
|
|
8992
9119
|
).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) => {
|
|
8993
9120
|
const globalOpts = cmd.optsWithGlobals();
|
|
@@ -9001,10 +9128,10 @@ function createSearchCommand() {
|
|
|
9001
9128
|
(w) => w.slug === options.workspace || w.id === options.workspace
|
|
9002
9129
|
);
|
|
9003
9130
|
if (!match) {
|
|
9004
|
-
console.error(
|
|
9005
|
-
console.log(
|
|
9131
|
+
console.error(chalk13.red(`Workspace "${options.workspace}" not found.`));
|
|
9132
|
+
console.log(chalk13.gray("Available workspaces:"));
|
|
9006
9133
|
workspaces.forEach((w) => {
|
|
9007
|
-
console.log(
|
|
9134
|
+
console.log(chalk13.gray(` - ${w.slug} (${w.name})`));
|
|
9008
9135
|
});
|
|
9009
9136
|
process.exit(1);
|
|
9010
9137
|
}
|
|
@@ -9026,16 +9153,16 @@ function createSearchCommand() {
|
|
|
9026
9153
|
return;
|
|
9027
9154
|
}
|
|
9028
9155
|
if (knowledge.results.length === 0) {
|
|
9029
|
-
console.log(
|
|
9156
|
+
console.log(chalk13.gray(`Nothing about "${knowledge.query}" in the Knowledge index.`));
|
|
9030
9157
|
return;
|
|
9031
9158
|
}
|
|
9032
|
-
console.log(
|
|
9159
|
+
console.log(chalk13.bold(`
|
|
9033
9160
|
About "${knowledge.query}"`));
|
|
9034
9161
|
for (const row of knowledge.results) {
|
|
9035
9162
|
console.log(
|
|
9036
|
-
` ${
|
|
9163
|
+
` ${chalk13.white(row.title)} ${chalk13.gray(`\xB7 ${row.sourceType} \xB7 ${Math.round(row.similarity * 100)}%`)}`
|
|
9037
9164
|
);
|
|
9038
|
-
console.log(
|
|
9165
|
+
console.log(chalk13.gray(` ${row.sourceId} ${row.url}`));
|
|
9039
9166
|
if (row.snippet) console.log(` ${row.snippet}`);
|
|
9040
9167
|
}
|
|
9041
9168
|
console.log();
|
|
@@ -9047,7 +9174,7 @@ About "${knowledge.query}"`));
|
|
|
9047
9174
|
return;
|
|
9048
9175
|
}
|
|
9049
9176
|
if (result.results.length === 0) {
|
|
9050
|
-
console.log(
|
|
9177
|
+
console.log(chalk13.gray(`No matches for "${result.query}".`));
|
|
9051
9178
|
return;
|
|
9052
9179
|
}
|
|
9053
9180
|
const byType = /* @__PURE__ */ new Map();
|
|
@@ -9057,14 +9184,14 @@ About "${knowledge.query}"`));
|
|
|
9057
9184
|
byType.set(r.type, bucket);
|
|
9058
9185
|
}
|
|
9059
9186
|
for (const [type, rows] of byType) {
|
|
9060
|
-
console.log(
|
|
9187
|
+
console.log(chalk13.bold(`
|
|
9061
9188
|
${TYPE_LABELS[type] ?? type}`));
|
|
9062
9189
|
for (const row of rows) {
|
|
9063
|
-
const parts = [
|
|
9064
|
-
if (row.subtitle) parts.push(
|
|
9065
|
-
if (row.workspace) parts.push(
|
|
9066
|
-
console.log(` ${parts.join(
|
|
9067
|
-
console.log(
|
|
9190
|
+
const parts = [chalk13.white(row.title)];
|
|
9191
|
+
if (row.subtitle) parts.push(chalk13.gray(row.subtitle));
|
|
9192
|
+
if (row.workspace) parts.push(chalk13.cyan(`@${row.workspace.slug}`));
|
|
9193
|
+
console.log(` ${parts.join(chalk13.gray(" \xB7 "))}`);
|
|
9194
|
+
console.log(chalk13.gray(` ${row.id}${row.url ? ` ${row.url}` : ""}`));
|
|
9068
9195
|
}
|
|
9069
9196
|
}
|
|
9070
9197
|
console.log();
|
|
@@ -9076,7 +9203,7 @@ ${TYPE_LABELS[type] ?? type}`));
|
|
|
9076
9203
|
}
|
|
9077
9204
|
|
|
9078
9205
|
// src/commands/tickets.ts
|
|
9079
|
-
import { Command as
|
|
9206
|
+
import { Command as Command27 } from "commander";
|
|
9080
9207
|
function collectRepeatable(value, previous) {
|
|
9081
9208
|
return [...previous, value];
|
|
9082
9209
|
}
|
|
@@ -9119,7 +9246,7 @@ function validateTicketType(value) {
|
|
|
9119
9246
|
return value;
|
|
9120
9247
|
}
|
|
9121
9248
|
function createTicketsCommand() {
|
|
9122
|
-
const tickets = new
|
|
9249
|
+
const tickets = new Command27("tickets").description(
|
|
9123
9250
|
"Manage product backlog tickets. Tickets live under a product, link to features/epics, depend on each other, and can be implemented via actions."
|
|
9124
9251
|
);
|
|
9125
9252
|
tickets.command("list").description(
|
|
@@ -9488,7 +9615,7 @@ function createTicketsCommand() {
|
|
|
9488
9615
|
handleError(error, useJson);
|
|
9489
9616
|
}
|
|
9490
9617
|
});
|
|
9491
|
-
const comment = new
|
|
9618
|
+
const comment = new Command27("comment").description("Manage comments on a ticket");
|
|
9492
9619
|
comment.command("list").description("List comments on a ticket").requiredOption("--id <id>", "Ticket CUID").action(async (options, cmd) => {
|
|
9493
9620
|
const globalOpts = cmd.optsWithGlobals();
|
|
9494
9621
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -9580,7 +9707,7 @@ function createTicketsCommand() {
|
|
|
9580
9707
|
}
|
|
9581
9708
|
|
|
9582
9709
|
// src/commands/time.ts
|
|
9583
|
-
import { Command as
|
|
9710
|
+
import { Command as Command28 } from "commander";
|
|
9584
9711
|
import { segmentConversation } from "exponential-sdk";
|
|
9585
9712
|
var SOURCES2 = ["manual", "claude-desktop", "agent-run"];
|
|
9586
9713
|
var STATUSES2 = ["PROPOSED", "CONFIRMED"];
|
|
@@ -9670,7 +9797,7 @@ function batchItemToInput(item, index, defaults) {
|
|
|
9670
9797
|
};
|
|
9671
9798
|
}
|
|
9672
9799
|
function createTimeCommand() {
|
|
9673
|
-
const time = new
|
|
9800
|
+
const time = new Command28("time").description(
|
|
9674
9801
|
`Time entries \u2014 log the day's work and list it. ${OWNERSHIP_NOTE}`
|
|
9675
9802
|
);
|
|
9676
9803
|
time.command("log").description(
|
|
@@ -9840,10 +9967,10 @@ function parseMessagesFile(raw) {
|
|
|
9840
9967
|
}
|
|
9841
9968
|
|
|
9842
9969
|
// src/commands/workspaces.ts
|
|
9843
|
-
import { Command as
|
|
9844
|
-
import
|
|
9970
|
+
import { Command as Command29 } from "commander";
|
|
9971
|
+
import chalk14 from "chalk";
|
|
9845
9972
|
function createWorkspacesCommand() {
|
|
9846
|
-
const workspaces = new
|
|
9973
|
+
const workspaces = new Command29("workspaces").description("Manage workspaces");
|
|
9847
9974
|
workspaces.command("list").description("List all workspaces").action(async (_options, cmd) => {
|
|
9848
9975
|
const globalOpts = cmd.optsWithGlobals();
|
|
9849
9976
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -9856,7 +9983,7 @@ function createWorkspacesCommand() {
|
|
|
9856
9983
|
const config = getConfig();
|
|
9857
9984
|
outputWorkspacesPretty(workspaces2);
|
|
9858
9985
|
if (config.defaultWorkspaceSlug) {
|
|
9859
|
-
console.log(
|
|
9986
|
+
console.log(chalk14.gray(`Default workspace: ${config.defaultWorkspaceSlug}`));
|
|
9860
9987
|
}
|
|
9861
9988
|
}
|
|
9862
9989
|
} catch (error) {
|
|
@@ -9869,10 +9996,10 @@ function createWorkspacesCommand() {
|
|
|
9869
9996
|
const workspaces2 = await client.workspaces.list();
|
|
9870
9997
|
const workspace = workspaces2.find((w) => w.slug === slug);
|
|
9871
9998
|
if (!workspace) {
|
|
9872
|
-
console.error(
|
|
9873
|
-
console.log(
|
|
9999
|
+
console.error(chalk14.red(`Workspace with slug "${slug}" not found.`));
|
|
10000
|
+
console.log(chalk14.gray("Available workspaces:"));
|
|
9874
10001
|
workspaces2.forEach((w) => {
|
|
9875
|
-
console.log(
|
|
10002
|
+
console.log(chalk14.gray(` - ${w.slug} (${w.name})`));
|
|
9876
10003
|
});
|
|
9877
10004
|
process.exit(1);
|
|
9878
10005
|
}
|
|
@@ -9880,7 +10007,7 @@ function createWorkspacesCommand() {
|
|
|
9880
10007
|
defaultWorkspaceId: workspace.id,
|
|
9881
10008
|
defaultWorkspaceSlug: workspace.slug
|
|
9882
10009
|
});
|
|
9883
|
-
console.log(
|
|
10010
|
+
console.log(chalk14.green(`Default workspace set to: ${workspace.name} (${workspace.slug})`));
|
|
9884
10011
|
} catch (error) {
|
|
9885
10012
|
handleError(error);
|
|
9886
10013
|
}
|
|
@@ -9908,20 +10035,20 @@ function createWorkspacesCommand() {
|
|
|
9908
10035
|
return;
|
|
9909
10036
|
}
|
|
9910
10037
|
if (members.length === 0) {
|
|
9911
|
-
console.log(
|
|
10038
|
+
console.log(chalk14.gray("No members found."));
|
|
9912
10039
|
return;
|
|
9913
10040
|
}
|
|
9914
|
-
console.log(
|
|
10041
|
+
console.log(chalk14.bold(`
|
|
9915
10042
|
Members (${members.length})
|
|
9916
10043
|
`));
|
|
9917
10044
|
for (const m of members) {
|
|
9918
10045
|
const label = m.name ?? m.email ?? m.id;
|
|
9919
|
-
const via = m.source === "team" ?
|
|
10046
|
+
const via = m.source === "team" ? chalk14.gray(
|
|
9920
10047
|
` via team${m.teams.length ? `: ${m.teams.map((t) => t.name).join(", ")}` : ""}` + (m.teamRole ? ` [team ${m.teamRole}]` : "")
|
|
9921
10048
|
) : "";
|
|
9922
|
-
console.log(`${
|
|
9923
|
-
if (m.email) console.log(
|
|
9924
|
-
console.log(
|
|
10049
|
+
console.log(`${chalk14.bold(label)} ${chalk14.gray(`(${m.role})`)}${via}`);
|
|
10050
|
+
if (m.email) console.log(chalk14.gray(` ${m.email}`));
|
|
10051
|
+
console.log(chalk14.gray(` mention: ${m.mentionSyntax}`));
|
|
9925
10052
|
console.log();
|
|
9926
10053
|
}
|
|
9927
10054
|
} catch (error) {
|
|
@@ -9933,7 +10060,7 @@ Members (${members.length})
|
|
|
9933
10060
|
}
|
|
9934
10061
|
|
|
9935
10062
|
// src/commands/goals.ts
|
|
9936
|
-
import { Command as
|
|
10063
|
+
import { Command as Command30 } from "commander";
|
|
9937
10064
|
var GOAL_STATUSES = [
|
|
9938
10065
|
"planned",
|
|
9939
10066
|
"active",
|
|
@@ -10045,7 +10172,7 @@ function validateKeyResultUnit(value) {
|
|
|
10045
10172
|
return value;
|
|
10046
10173
|
}
|
|
10047
10174
|
function createKeyResultsCommand() {
|
|
10048
|
-
const kr = new
|
|
10175
|
+
const kr = new Command30("kr").description(
|
|
10049
10176
|
"Key results on an objective. Ids are CUIDs; --goal takes the objective's integer id."
|
|
10050
10177
|
);
|
|
10051
10178
|
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(
|
|
@@ -10248,7 +10375,7 @@ function createKeyResultsCommand() {
|
|
|
10248
10375
|
return kr;
|
|
10249
10376
|
}
|
|
10250
10377
|
function createGoalCommentsCommand() {
|
|
10251
|
-
const comment = new
|
|
10378
|
+
const comment = new Command30("comment").description(
|
|
10252
10379
|
"Read and post comments on a goal. Mention teammates with --mention."
|
|
10253
10380
|
);
|
|
10254
10381
|
comment.command("list").description("List comments on a goal").requiredOption("--goal <id>", "Goal ID (a number)").action(async (options, cmd) => {
|
|
@@ -10343,7 +10470,7 @@ function createGoalCommentsCommand() {
|
|
|
10343
10470
|
return comment;
|
|
10344
10471
|
}
|
|
10345
10472
|
function createGoalsCommand() {
|
|
10346
|
-
const goals = new
|
|
10473
|
+
const goals = new Command30("goals").description(
|
|
10347
10474
|
"Manage goals (objectives) and their key results. Objectives have integer ids; key results are CUIDs."
|
|
10348
10475
|
);
|
|
10349
10476
|
goals.command("list").description(
|
|
@@ -10630,7 +10757,7 @@ Re-run with --with-key-results to go ahead, or move them with \`goals kr update
|
|
|
10630
10757
|
return goals;
|
|
10631
10758
|
}
|
|
10632
10759
|
function createOkrsCommand() {
|
|
10633
|
-
const okrs = new
|
|
10760
|
+
const okrs = new Command30("okrs").description(
|
|
10634
10761
|
"OKRs \u2014 objectives with their key results nested. Manage the parts with `goals` and `goals kr`."
|
|
10635
10762
|
);
|
|
10636
10763
|
okrs.command("list").description(
|
|
@@ -10719,7 +10846,7 @@ function isBareVersionRequest(args) {
|
|
|
10719
10846
|
return args.includes("--version") && args.every((arg) => arg.startsWith("-"));
|
|
10720
10847
|
}
|
|
10721
10848
|
function buildProgram() {
|
|
10722
|
-
const program = new
|
|
10849
|
+
const program = new Command31();
|
|
10723
10850
|
program.name("exponential").description(
|
|
10724
10851
|
[
|
|
10725
10852
|
"CLI to interact with Exponential productivity app.",
|
|
@@ -10732,6 +10859,8 @@ function buildProgram() {
|
|
|
10732
10859
|
program.addCommand(createAuthCommand());
|
|
10733
10860
|
program.addCommand(createActionsCommand());
|
|
10734
10861
|
program.addCommand(createContactsCommand());
|
|
10862
|
+
program.addCommand(createContextCommand());
|
|
10863
|
+
program.addCommand(createMethodCommand());
|
|
10735
10864
|
program.addCommand(createCeremoniesCommand());
|
|
10736
10865
|
program.addCommand(createDatabasesCommand());
|
|
10737
10866
|
program.addCommand(createDecisionsCommand());
|