exponential-cli 1.7.0 → 1.8.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/dist/index.js +92 -13
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import { Command as
|
|
4
|
+
import { Command as Command19 } from "commander";
|
|
5
5
|
|
|
6
6
|
// src/commands/auth.ts
|
|
7
7
|
import { Command } from "commander";
|
|
@@ -3064,8 +3064,86 @@ function createProjectsCommand() {
|
|
|
3064
3064
|
return projects;
|
|
3065
3065
|
}
|
|
3066
3066
|
|
|
3067
|
-
// src/commands/
|
|
3067
|
+
// src/commands/search.ts
|
|
3068
3068
|
import { Command as Command16 } from "commander";
|
|
3069
|
+
import chalk6 from "chalk";
|
|
3070
|
+
var TYPE_LABELS = {
|
|
3071
|
+
workspace: "Workspaces",
|
|
3072
|
+
project: "Projects",
|
|
3073
|
+
action: "Actions",
|
|
3074
|
+
goal: "Goals",
|
|
3075
|
+
keyResult: "Key Results",
|
|
3076
|
+
outcome: "Outcomes",
|
|
3077
|
+
ticket: "Tickets",
|
|
3078
|
+
feature: "Features",
|
|
3079
|
+
epic: "Epics",
|
|
3080
|
+
page: "Pages",
|
|
3081
|
+
meeting: "Meetings",
|
|
3082
|
+
contact: "Contacts",
|
|
3083
|
+
organization: "Organizations",
|
|
3084
|
+
product: "Products"
|
|
3085
|
+
};
|
|
3086
|
+
function createSearchCommand() {
|
|
3087
|
+
const search = new Command16("search").description(
|
|
3088
|
+
"Global search across projects, actions, goals, workspaces and more \u2014 same coverage as the app's Cmd+K palette"
|
|
3089
|
+
).argument("<query>", "Text to search for").option("-w, --workspace <slug>", "Restrict results to one workspace (slug or ID)").option("-l, --limit <n>", "Max results per entity type (1-25, default 10)").action(async (query, options, cmd) => {
|
|
3090
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
3091
|
+
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
3092
|
+
try {
|
|
3093
|
+
const client = getClient();
|
|
3094
|
+
let workspaceId;
|
|
3095
|
+
if (options.workspace) {
|
|
3096
|
+
const workspaces = await client.workspaces.list();
|
|
3097
|
+
const match = workspaces.find(
|
|
3098
|
+
(w) => w.slug === options.workspace || w.id === options.workspace
|
|
3099
|
+
);
|
|
3100
|
+
if (!match) {
|
|
3101
|
+
console.error(chalk6.red(`Workspace "${options.workspace}" not found.`));
|
|
3102
|
+
console.log(chalk6.gray("Available workspaces:"));
|
|
3103
|
+
workspaces.forEach((w) => {
|
|
3104
|
+
console.log(chalk6.gray(` - ${w.slug} (${w.name})`));
|
|
3105
|
+
});
|
|
3106
|
+
process.exit(1);
|
|
3107
|
+
}
|
|
3108
|
+
workspaceId = match.id;
|
|
3109
|
+
}
|
|
3110
|
+
const limit = options.limit ? Number(options.limit) : void 0;
|
|
3111
|
+
const result = await client.search.global({ query, workspaceId, limit });
|
|
3112
|
+
if (useJson) {
|
|
3113
|
+
console.log(JSON.stringify(result, null, 2));
|
|
3114
|
+
return;
|
|
3115
|
+
}
|
|
3116
|
+
if (result.results.length === 0) {
|
|
3117
|
+
console.log(chalk6.gray(`No matches for "${result.query}".`));
|
|
3118
|
+
return;
|
|
3119
|
+
}
|
|
3120
|
+
const byType = /* @__PURE__ */ new Map();
|
|
3121
|
+
for (const r of result.results) {
|
|
3122
|
+
const bucket = byType.get(r.type) ?? [];
|
|
3123
|
+
bucket.push(r);
|
|
3124
|
+
byType.set(r.type, bucket);
|
|
3125
|
+
}
|
|
3126
|
+
for (const [type, rows] of byType) {
|
|
3127
|
+
console.log(chalk6.bold(`
|
|
3128
|
+
${TYPE_LABELS[type] ?? type}`));
|
|
3129
|
+
for (const row of rows) {
|
|
3130
|
+
const parts = [chalk6.white(row.title)];
|
|
3131
|
+
if (row.subtitle) parts.push(chalk6.gray(row.subtitle));
|
|
3132
|
+
if (row.workspace) parts.push(chalk6.cyan(`@${row.workspace.slug}`));
|
|
3133
|
+
console.log(` ${parts.join(chalk6.gray(" \xB7 "))}`);
|
|
3134
|
+
console.log(chalk6.gray(` ${row.id}${row.url ? ` ${row.url}` : ""}`));
|
|
3135
|
+
}
|
|
3136
|
+
}
|
|
3137
|
+
console.log();
|
|
3138
|
+
} catch (error) {
|
|
3139
|
+
handleError(error, useJson);
|
|
3140
|
+
}
|
|
3141
|
+
});
|
|
3142
|
+
return search;
|
|
3143
|
+
}
|
|
3144
|
+
|
|
3145
|
+
// src/commands/tickets.ts
|
|
3146
|
+
import { Command as Command17 } from "commander";
|
|
3069
3147
|
function collectRepeatable(value, previous) {
|
|
3070
3148
|
return [...previous, value];
|
|
3071
3149
|
}
|
|
@@ -3108,7 +3186,7 @@ function validateTicketType(value) {
|
|
|
3108
3186
|
return value;
|
|
3109
3187
|
}
|
|
3110
3188
|
function createTicketsCommand() {
|
|
3111
|
-
const tickets = new
|
|
3189
|
+
const tickets = new Command17("tickets").description(
|
|
3112
3190
|
"Manage product backlog tickets. Tickets live under a product, link to features/epics, depend on each other, and can be implemented via actions."
|
|
3113
3191
|
);
|
|
3114
3192
|
tickets.command("list").description(
|
|
@@ -3422,7 +3500,7 @@ function createTicketsCommand() {
|
|
|
3422
3500
|
handleError(error, useJson);
|
|
3423
3501
|
}
|
|
3424
3502
|
});
|
|
3425
|
-
const comment = new
|
|
3503
|
+
const comment = new Command17("comment").description("Manage comments on a ticket");
|
|
3426
3504
|
comment.command("add").description("Add a comment to a ticket").requiredOption("--id <id>", "Ticket CUID").requiredOption("-m, --message <text>", "Comment content (markdown supported)").action(async (options, cmd) => {
|
|
3427
3505
|
const globalOpts = cmd.optsWithGlobals();
|
|
3428
3506
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -3461,10 +3539,10 @@ function createTicketsCommand() {
|
|
|
3461
3539
|
}
|
|
3462
3540
|
|
|
3463
3541
|
// src/commands/workspaces.ts
|
|
3464
|
-
import { Command as
|
|
3465
|
-
import
|
|
3542
|
+
import { Command as Command18 } from "commander";
|
|
3543
|
+
import chalk7 from "chalk";
|
|
3466
3544
|
function createWorkspacesCommand() {
|
|
3467
|
-
const workspaces = new
|
|
3545
|
+
const workspaces = new Command18("workspaces").description("Manage workspaces");
|
|
3468
3546
|
workspaces.command("list").description("List all workspaces").action(async (_options, cmd) => {
|
|
3469
3547
|
const globalOpts = cmd.optsWithGlobals();
|
|
3470
3548
|
const useJson = shouldUseJson(globalOpts.json, globalOpts.pretty);
|
|
@@ -3477,7 +3555,7 @@ function createWorkspacesCommand() {
|
|
|
3477
3555
|
const config = getConfig();
|
|
3478
3556
|
outputWorkspacesPretty(workspaces2);
|
|
3479
3557
|
if (config.defaultWorkspaceSlug) {
|
|
3480
|
-
console.log(
|
|
3558
|
+
console.log(chalk7.gray(`Default workspace: ${config.defaultWorkspaceSlug}`));
|
|
3481
3559
|
}
|
|
3482
3560
|
}
|
|
3483
3561
|
} catch (error) {
|
|
@@ -3490,10 +3568,10 @@ function createWorkspacesCommand() {
|
|
|
3490
3568
|
const workspaces2 = await client.workspaces.list();
|
|
3491
3569
|
const workspace = workspaces2.find((w) => w.slug === slug);
|
|
3492
3570
|
if (!workspace) {
|
|
3493
|
-
console.error(
|
|
3494
|
-
console.log(
|
|
3571
|
+
console.error(chalk7.red(`Workspace with slug "${slug}" not found.`));
|
|
3572
|
+
console.log(chalk7.gray("Available workspaces:"));
|
|
3495
3573
|
workspaces2.forEach((w) => {
|
|
3496
|
-
console.log(
|
|
3574
|
+
console.log(chalk7.gray(` - ${w.slug} (${w.name})`));
|
|
3497
3575
|
});
|
|
3498
3576
|
process.exit(1);
|
|
3499
3577
|
}
|
|
@@ -3501,7 +3579,7 @@ function createWorkspacesCommand() {
|
|
|
3501
3579
|
defaultWorkspaceId: workspace.id,
|
|
3502
3580
|
defaultWorkspaceSlug: workspace.slug
|
|
3503
3581
|
});
|
|
3504
|
-
console.log(
|
|
3582
|
+
console.log(chalk7.green(`Default workspace set to: ${workspace.name} (${workspace.slug})`));
|
|
3505
3583
|
} catch (error) {
|
|
3506
3584
|
handleError(error);
|
|
3507
3585
|
}
|
|
@@ -3510,7 +3588,7 @@ function createWorkspacesCommand() {
|
|
|
3510
3588
|
}
|
|
3511
3589
|
|
|
3512
3590
|
// src/index.ts
|
|
3513
|
-
var program = new
|
|
3591
|
+
var program = new Command19();
|
|
3514
3592
|
program.name("exponential").description(
|
|
3515
3593
|
[
|
|
3516
3594
|
"CLI to interact with Exponential productivity app.",
|
|
@@ -3531,6 +3609,7 @@ program.addCommand(createOrganizationsCommand());
|
|
|
3531
3609
|
program.addCommand(createPagesCommand());
|
|
3532
3610
|
program.addCommand(createProductsCommand());
|
|
3533
3611
|
program.addCommand(createProjectsCommand());
|
|
3612
|
+
program.addCommand(createSearchCommand());
|
|
3534
3613
|
program.addCommand(createTicketsCommand());
|
|
3535
3614
|
program.addCommand(createWorkspacesCommand());
|
|
3536
3615
|
program.parse();
|