commet 2.2.0 → 2.2.2
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 +140 -164
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ var import_commander11 = require("commander");
|
|
|
30
30
|
// package.json
|
|
31
31
|
var package_default = {
|
|
32
32
|
name: "commet",
|
|
33
|
-
version: "2.2.
|
|
33
|
+
version: "2.2.2",
|
|
34
34
|
description: "Commet CLI - Manage your billing platform from the command line",
|
|
35
35
|
bin: {
|
|
36
36
|
commet: "./bin/commet"
|
|
@@ -57,7 +57,7 @@ var package_default = {
|
|
|
57
57
|
author: "Commet Team",
|
|
58
58
|
license: "MIT",
|
|
59
59
|
dependencies: {
|
|
60
|
-
"@inquirer/prompts": "8.
|
|
60
|
+
"@inquirer/prompts": "8.5.0",
|
|
61
61
|
ably: "^2.21.0",
|
|
62
62
|
chalk: "5.6.2",
|
|
63
63
|
commander: "14.0.3",
|
|
@@ -91,7 +91,9 @@ var package_default = {
|
|
|
91
91
|
// src/commands/api-key.ts
|
|
92
92
|
var import_chalk2 = __toESM(require("chalk"));
|
|
93
93
|
var import_commander = require("commander");
|
|
94
|
-
|
|
94
|
+
|
|
95
|
+
// src/utils/output.ts
|
|
96
|
+
var import_chalk = __toESM(require("chalk"));
|
|
95
97
|
|
|
96
98
|
// src/utils/config.ts
|
|
97
99
|
var fs = __toESM(require("fs"));
|
|
@@ -161,7 +163,7 @@ function clearProjectConfig() {
|
|
|
161
163
|
}
|
|
162
164
|
|
|
163
165
|
// src/utils/telemetry.ts
|
|
164
|
-
var CLI_VERSION = true ? "2.2.
|
|
166
|
+
var CLI_VERSION = true ? "2.2.2" : "0.0.0";
|
|
165
167
|
var TELEMETRY_URL = "https://commet.co/api/cli/telemetry";
|
|
166
168
|
function detectRuntime() {
|
|
167
169
|
if ("Bun" in globalThis) {
|
|
@@ -298,54 +300,7 @@ function installCrashHandler() {
|
|
|
298
300
|
});
|
|
299
301
|
}
|
|
300
302
|
|
|
301
|
-
// src/utils/api.ts
|
|
302
|
-
var BASE_URL = "https://commet.co";
|
|
303
|
-
async function apiRequest(endpoint, options = {}) {
|
|
304
|
-
const apiKey = process.env.COMMET_API_KEY;
|
|
305
|
-
const auth = apiKey ? null : loadAuth();
|
|
306
|
-
if (!apiKey && !auth) {
|
|
307
|
-
return {
|
|
308
|
-
error: {
|
|
309
|
-
code: "auth_required",
|
|
310
|
-
message: "Not authenticated. Run `commet login` first."
|
|
311
|
-
}
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
try {
|
|
315
|
-
markApiRequest();
|
|
316
|
-
const response = await fetch(endpoint, {
|
|
317
|
-
...options,
|
|
318
|
-
headers: {
|
|
319
|
-
...options.headers,
|
|
320
|
-
"Content-Type": "application/json",
|
|
321
|
-
"User-Agent": getUserAgent(),
|
|
322
|
-
"commet-client-info": getClientInfoHeader(),
|
|
323
|
-
...apiKey ? { "x-api-key": apiKey } : { Authorization: `Bearer ${auth.token}` }
|
|
324
|
-
}
|
|
325
|
-
});
|
|
326
|
-
if (!response.ok) {
|
|
327
|
-
const errorData = await response.json().catch(() => ({}));
|
|
328
|
-
return {
|
|
329
|
-
error: {
|
|
330
|
-
code: errorData.code ?? `http_${response.status}`,
|
|
331
|
-
message: errorData.message ?? errorData.error ?? `Request failed with status ${response.status}`
|
|
332
|
-
}
|
|
333
|
-
};
|
|
334
|
-
}
|
|
335
|
-
const data = await response.json();
|
|
336
|
-
return { data };
|
|
337
|
-
} catch (error) {
|
|
338
|
-
return {
|
|
339
|
-
error: {
|
|
340
|
-
code: "network_error",
|
|
341
|
-
message: error instanceof Error ? error.message : "Unknown error occurred"
|
|
342
|
-
}
|
|
343
|
-
};
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
|
|
347
303
|
// src/utils/output.ts
|
|
348
|
-
var import_chalk = __toESM(require("chalk"));
|
|
349
304
|
function isAgentMode(options) {
|
|
350
305
|
if (options?.output === "agent") return true;
|
|
351
306
|
const idx = process.argv.indexOf("--output");
|
|
@@ -391,103 +346,27 @@ function requireOrgContext() {
|
|
|
391
346
|
}
|
|
392
347
|
|
|
393
348
|
// src/commands/api-key.ts
|
|
394
|
-
var apiKeyCommand = new import_commander.Command("api-key").description(
|
|
395
|
-
|
|
396
|
-
).option("--name <name>", "Name for the API key", "CLI").option(
|
|
397
|
-
"--output <format>",
|
|
398
|
-
"Output format: human (default) or agent",
|
|
399
|
-
"human"
|
|
400
|
-
).addHelpText(
|
|
401
|
-
"after",
|
|
402
|
-
`
|
|
403
|
-
Examples:
|
|
404
|
-
$ commet api-key Generate a key for the linked org
|
|
405
|
-
$ commet api-key --name "GitHub CI" Name it for easy identification
|
|
406
|
-
$ commet api-key --output agent JSON output with the key
|
|
407
|
-
|
|
408
|
-
Then use it in CI:
|
|
409
|
-
$ COMMET_API_KEY=ck_... commet push --yes
|
|
410
|
-
`
|
|
411
|
-
).action(async (options) => {
|
|
412
|
-
const agentMode = isAgentMode(options);
|
|
413
|
-
if (agentMode) {
|
|
349
|
+
var apiKeyCommand = new import_commander.Command("api-key").description("Deprecated \u2014 use 'commet api-keys create' instead").allowUnknownOption().allowExcessArguments().helpOption(false).action((options) => {
|
|
350
|
+
if (isAgentMode(options)) {
|
|
414
351
|
console.log(
|
|
415
352
|
JSON.stringify({
|
|
416
353
|
deprecated: true,
|
|
417
|
-
replacement: "commet api-keys create"
|
|
354
|
+
replacement: "commet api-keys create",
|
|
355
|
+
message: "This command has been removed. Use 'commet api-keys create' instead."
|
|
418
356
|
})
|
|
419
357
|
);
|
|
420
358
|
} else {
|
|
359
|
+
console.log(import_chalk2.default.yellow("\n \u26A0 'commet api-key' has been removed.\n"));
|
|
421
360
|
console.log(
|
|
422
|
-
import_chalk2.default.
|
|
423
|
-
|
|
424
|
-
}
|
|
425
|
-
if (process.env.COMMET_API_KEY) {
|
|
426
|
-
exitWithError({
|
|
427
|
-
code: "invalid_context",
|
|
428
|
-
message: "Cannot create API keys while using COMMET_API_KEY",
|
|
429
|
-
action: "commet login"
|
|
430
|
-
});
|
|
431
|
-
}
|
|
432
|
-
requireAuth();
|
|
433
|
-
const projectConfig = loadProjectConfig();
|
|
434
|
-
if (!projectConfig) {
|
|
435
|
-
exitWithError({
|
|
436
|
-
code: "project_not_linked",
|
|
437
|
-
message: "No organization linked",
|
|
438
|
-
action: "commet link"
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
const spinner = agentMode ? null : (0, import_ora.default)("Generating API key...").start();
|
|
442
|
-
const result = await apiRequest(
|
|
443
|
-
`${BASE_URL}/api/cli/api-keys`,
|
|
444
|
-
{
|
|
445
|
-
method: "POST",
|
|
446
|
-
body: JSON.stringify({
|
|
447
|
-
organizationId: projectConfig.orgId,
|
|
448
|
-
name: options.name
|
|
449
|
-
})
|
|
450
|
-
}
|
|
451
|
-
);
|
|
452
|
-
if (result.error || !result.data) {
|
|
453
|
-
if (agentMode) {
|
|
454
|
-
console.log(JSON.stringify({ error: result.error }));
|
|
455
|
-
} else {
|
|
456
|
-
spinner?.fail("Failed to create API key");
|
|
457
|
-
console.error(import_chalk2.default.red("Error:"), result.error?.message);
|
|
458
|
-
}
|
|
459
|
-
process.exit(1);
|
|
460
|
-
}
|
|
461
|
-
const { apiKey } = result.data;
|
|
462
|
-
const isLive = projectConfig.mode === "live";
|
|
463
|
-
if (agentMode) {
|
|
464
|
-
console.log(
|
|
465
|
-
JSON.stringify({
|
|
466
|
-
success: true,
|
|
467
|
-
apiKey,
|
|
468
|
-
mode: projectConfig.mode,
|
|
469
|
-
...isLive ? {
|
|
470
|
-
warning: "This is a live API key. Rotate it before using in production if generated by an agent."
|
|
471
|
-
} : {}
|
|
472
|
-
})
|
|
361
|
+
` Use ${import_chalk2.default.bold("commet api-keys create --name <name>")} instead.
|
|
362
|
+
`
|
|
473
363
|
);
|
|
474
|
-
return;
|
|
475
|
-
}
|
|
476
|
-
spinner?.succeed("API key created");
|
|
477
|
-
console.log("");
|
|
478
|
-
console.log(` ${import_chalk2.default.bold(apiKey)}`);
|
|
479
|
-
console.log("");
|
|
480
|
-
console.log(import_chalk2.default.yellow(" \u26A0 This key is shown only once \u2014 copy it now."));
|
|
481
|
-
if (isLive) {
|
|
482
364
|
console.log(
|
|
483
|
-
import_chalk2.default.
|
|
484
|
-
|
|
485
|
-
)
|
|
365
|
+
` Run ${import_chalk2.default.dim("commet api-keys --help")} for all options.
|
|
366
|
+
`
|
|
486
367
|
);
|
|
487
368
|
}
|
|
488
|
-
|
|
489
|
-
import_chalk2.default.dim("\n Use in CI: COMMET_API_KEY=<key> commet push --yes")
|
|
490
|
-
);
|
|
369
|
+
process.exit(0);
|
|
491
370
|
});
|
|
492
371
|
|
|
493
372
|
// src/commands/create.ts
|
|
@@ -498,13 +377,59 @@ var path2 = __toESM(require("path"));
|
|
|
498
377
|
var import_prompts = require("@inquirer/prompts");
|
|
499
378
|
var import_chalk5 = __toESM(require("chalk"));
|
|
500
379
|
var import_commander2 = require("commander");
|
|
501
|
-
var
|
|
380
|
+
var import_ora2 = __toESM(require("ora"));
|
|
502
381
|
var import_tar = require("tar");
|
|
503
382
|
|
|
383
|
+
// src/utils/api.ts
|
|
384
|
+
var BASE_URL = "https://commet.co";
|
|
385
|
+
async function apiRequest(endpoint, options = {}) {
|
|
386
|
+
const apiKey = process.env.COMMET_API_KEY;
|
|
387
|
+
const auth = apiKey ? null : loadAuth();
|
|
388
|
+
if (!apiKey && !auth) {
|
|
389
|
+
return {
|
|
390
|
+
error: {
|
|
391
|
+
code: "auth_required",
|
|
392
|
+
message: "Not authenticated. Run `commet login` first."
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
try {
|
|
397
|
+
markApiRequest();
|
|
398
|
+
const response = await fetch(endpoint, {
|
|
399
|
+
...options,
|
|
400
|
+
headers: {
|
|
401
|
+
...options.headers,
|
|
402
|
+
"Content-Type": "application/json",
|
|
403
|
+
"User-Agent": getUserAgent(),
|
|
404
|
+
"commet-client-info": getClientInfoHeader(),
|
|
405
|
+
...apiKey ? { "x-api-key": apiKey } : { Authorization: `Bearer ${auth.token}` }
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
if (!response.ok) {
|
|
409
|
+
const errorData = await response.json().catch(() => ({}));
|
|
410
|
+
return {
|
|
411
|
+
error: {
|
|
412
|
+
code: errorData.code ?? `http_${response.status}`,
|
|
413
|
+
message: errorData.message ?? errorData.error ?? `Request failed with status ${response.status}`
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
const data = await response.json();
|
|
418
|
+
return { data };
|
|
419
|
+
} catch (error) {
|
|
420
|
+
return {
|
|
421
|
+
error: {
|
|
422
|
+
code: "network_error",
|
|
423
|
+
message: error instanceof Error ? error.message : "Unknown error occurred"
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
|
|
504
429
|
// src/utils/login-flow.ts
|
|
505
430
|
var import_chalk4 = __toESM(require("chalk"));
|
|
506
431
|
var import_open = __toESM(require("open"));
|
|
507
|
-
var
|
|
432
|
+
var import_ora = __toESM(require("ora"));
|
|
508
433
|
|
|
509
434
|
// src/utils/prompt-theme.ts
|
|
510
435
|
var import_chalk3 = __toESM(require("chalk"));
|
|
@@ -527,7 +452,7 @@ function sleep(ms) {
|
|
|
527
452
|
return new Promise((resolve4) => setTimeout(resolve4, ms));
|
|
528
453
|
}
|
|
529
454
|
async function performLogin() {
|
|
530
|
-
const spinner = (0,
|
|
455
|
+
const spinner = (0, import_ora.default)("Initiating login flow...").start();
|
|
531
456
|
try {
|
|
532
457
|
const deviceResponse = await fetch(`${BASE_URL}/api/auth/device/code`, {
|
|
533
458
|
method: "POST",
|
|
@@ -560,7 +485,7 @@ async function performLogin() {
|
|
|
560
485
|
} catch {
|
|
561
486
|
console.log(import_chalk4.default.yellow("\u26A0 Could not open browser automatically."));
|
|
562
487
|
}
|
|
563
|
-
const pollSpinner = (0,
|
|
488
|
+
const pollSpinner = (0, import_ora.default)("Waiting for authorization...").start();
|
|
564
489
|
let pollingInterval = interval;
|
|
565
490
|
let attempts = 0;
|
|
566
491
|
const maxAttempts = Math.floor(180 / pollingInterval);
|
|
@@ -864,7 +789,7 @@ var createCommand = new import_commander2.Command("create").description("Create
|
|
|
864
789
|
return;
|
|
865
790
|
}
|
|
866
791
|
}
|
|
867
|
-
const orgsSpinner = (0,
|
|
792
|
+
const orgsSpinner = (0, import_ora2.default)("Fetching sandbox organizations...").start();
|
|
868
793
|
const orgsResult = await apiRequest(`${BASE_URL}/api/cli/organizations`);
|
|
869
794
|
if (orgsResult.error || !orgsResult.data) {
|
|
870
795
|
orgsSpinner.fail("Failed to fetch organizations");
|
|
@@ -958,7 +883,7 @@ var createCommand = new import_commander2.Command("create").description("Create
|
|
|
958
883
|
}
|
|
959
884
|
}
|
|
960
885
|
const shouldInstallSkills = await resolveSkills(opts);
|
|
961
|
-
const downloadSpinner = (0,
|
|
886
|
+
const downloadSpinner = (0, import_ora2.default)("Downloading template...").start();
|
|
962
887
|
try {
|
|
963
888
|
await downloadTemplate(template.dir, dest, opts.ref);
|
|
964
889
|
downloadSpinner.succeed("Template downloaded");
|
|
@@ -974,7 +899,7 @@ var createCommand = new import_commander2.Command("create").description("Create
|
|
|
974
899
|
}
|
|
975
900
|
updatePackageJson(dest, projectName);
|
|
976
901
|
copyEnvExample(dest);
|
|
977
|
-
const resolveSpinner = (0,
|
|
902
|
+
const resolveSpinner = (0, import_ora2.default)("Resolving package versions...").start();
|
|
978
903
|
try {
|
|
979
904
|
const count = await resolveWorkspaceDeps(dest);
|
|
980
905
|
if (count > 0) {
|
|
@@ -992,7 +917,7 @@ var createCommand = new import_commander2.Command("create").description("Create
|
|
|
992
917
|
}
|
|
993
918
|
return;
|
|
994
919
|
}
|
|
995
|
-
const planSpinner = (0,
|
|
920
|
+
const planSpinner = (0, import_ora2.default)("Creating plans...").start();
|
|
996
921
|
const templateResult = await apiRequest(`${BASE_URL}/api/cli/templates`, {
|
|
997
922
|
method: "POST",
|
|
998
923
|
body: JSON.stringify({
|
|
@@ -1008,7 +933,7 @@ var createCommand = new import_commander2.Command("create").description("Create
|
|
|
1008
933
|
`Created ${templateResult.data.plansCreated} plans and ${templateResult.data.featuresCreated} features`
|
|
1009
934
|
);
|
|
1010
935
|
}
|
|
1011
|
-
const keySpinner = (0,
|
|
936
|
+
const keySpinner = (0, import_ora2.default)("Creating API key...").start();
|
|
1012
937
|
const keyResult = await apiRequest(`${BASE_URL}/api/cli/api-keys`, {
|
|
1013
938
|
method: "POST",
|
|
1014
939
|
body: JSON.stringify({
|
|
@@ -1043,7 +968,7 @@ var createCommand = new import_commander2.Command("create").description("Create
|
|
|
1043
968
|
var import_prompts2 = require("@inquirer/prompts");
|
|
1044
969
|
var import_chalk6 = __toESM(require("chalk"));
|
|
1045
970
|
var import_commander3 = require("commander");
|
|
1046
|
-
var
|
|
971
|
+
var import_ora3 = __toESM(require("ora"));
|
|
1047
972
|
|
|
1048
973
|
// src/utils/gitignore-updater.ts
|
|
1049
974
|
var fs3 = __toESM(require("fs"));
|
|
@@ -1126,7 +1051,7 @@ Examples:
|
|
|
1126
1051
|
});
|
|
1127
1052
|
}
|
|
1128
1053
|
const currentConfig = projectConfigExists() ? loadProjectConfig() : null;
|
|
1129
|
-
const spinner = agentMode ? null : (0,
|
|
1054
|
+
const spinner = agentMode ? null : (0, import_ora3.default)("Fetching organizations...").start();
|
|
1130
1055
|
const result = await apiRequest(
|
|
1131
1056
|
`${BASE_URL}/api/cli/organizations`
|
|
1132
1057
|
);
|
|
@@ -1556,7 +1481,7 @@ var logoutCommand = new import_commander6.Command("logout").description(
|
|
|
1556
1481
|
// src/commands/orgs.ts
|
|
1557
1482
|
var import_chalk10 = __toESM(require("chalk"));
|
|
1558
1483
|
var import_commander7 = require("commander");
|
|
1559
|
-
var
|
|
1484
|
+
var import_ora4 = __toESM(require("ora"));
|
|
1560
1485
|
var orgsCommand = new import_commander7.Command("orgs").description(
|
|
1561
1486
|
"List all organizations you have access to. Shows name, slug, mode (live/sandbox), and which one is currently linked."
|
|
1562
1487
|
).option(
|
|
@@ -1575,7 +1500,7 @@ The slug shown here is what you pass to 'commet link --org <slug>'.
|
|
|
1575
1500
|
).action(async (options) => {
|
|
1576
1501
|
const agentMode = isAgentMode(options);
|
|
1577
1502
|
requireAuth();
|
|
1578
|
-
const spinner = agentMode ? null : (0,
|
|
1503
|
+
const spinner = agentMode ? null : (0, import_ora4.default)("Fetching organizations...").start();
|
|
1579
1504
|
const result = await apiRequest(
|
|
1580
1505
|
`${BASE_URL}/api/cli/organizations`
|
|
1581
1506
|
);
|
|
@@ -1622,7 +1547,7 @@ var path5 = __toESM(require("path"));
|
|
|
1622
1547
|
var import_prompts3 = require("@inquirer/prompts");
|
|
1623
1548
|
var import_chalk12 = __toESM(require("chalk"));
|
|
1624
1549
|
var import_commander8 = require("commander");
|
|
1625
|
-
var
|
|
1550
|
+
var import_ora5 = __toESM(require("ora"));
|
|
1626
1551
|
|
|
1627
1552
|
// src/utils/config-loader.ts
|
|
1628
1553
|
var fs4 = __toESM(require("fs"));
|
|
@@ -1960,7 +1885,7 @@ Examples:
|
|
|
1960
1885
|
).action(async (options) => {
|
|
1961
1886
|
const agentMode = isAgentMode(options);
|
|
1962
1887
|
const { orgId } = requireOrgContext();
|
|
1963
|
-
const spinner = agentMode ? null : (0,
|
|
1888
|
+
const spinner = agentMode ? null : (0, import_ora5.default)("Fetching config from remote...").start();
|
|
1964
1889
|
const orgQuery = orgId === "__from_api_key__" ? "" : `?orgId=${orgId}`;
|
|
1965
1890
|
const result = await apiRequest(
|
|
1966
1891
|
`${BASE_URL}/api/cli/pull${orgQuery}`
|
|
@@ -2174,7 +2099,7 @@ Would create commet.config.ts (${features.length} features, ${plans.length} plan
|
|
|
2174
2099
|
var import_prompts4 = require("@inquirer/prompts");
|
|
2175
2100
|
var import_chalk13 = __toESM(require("chalk"));
|
|
2176
2101
|
var import_commander9 = require("commander");
|
|
2177
|
-
var
|
|
2102
|
+
var import_ora6 = __toESM(require("ora"));
|
|
2178
2103
|
var pushCommand = new import_commander9.Command("push").description(
|
|
2179
2104
|
"Push your local commet.config.ts to Commet. Creates or updates features and plans to match your config file."
|
|
2180
2105
|
).option("-y, --yes", "Skip confirmation prompt").option("--dry-run", "Show what would change without pushing").option(
|
|
@@ -2194,7 +2119,7 @@ Examples:
|
|
|
2194
2119
|
).action(async (options) => {
|
|
2195
2120
|
const agentMode = isAgentMode(options);
|
|
2196
2121
|
const { orgId } = requireOrgContext();
|
|
2197
|
-
const loadSpinner = agentMode ? null : (0,
|
|
2122
|
+
const loadSpinner = agentMode ? null : (0, import_ora6.default)("Loading commet.config.ts...").start();
|
|
2198
2123
|
const loaded = await loadBillingConfig(process.cwd()).catch(
|
|
2199
2124
|
(error) => {
|
|
2200
2125
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -2214,7 +2139,7 @@ Examples:
|
|
|
2214
2139
|
if (!loaded) process.exit(1);
|
|
2215
2140
|
const { config, configPath } = loaded;
|
|
2216
2141
|
loadSpinner?.succeed(`Loaded ${configPath}`);
|
|
2217
|
-
const fetchSpinner = agentMode ? null : (0,
|
|
2142
|
+
const fetchSpinner = agentMode ? null : (0, import_ora6.default)("Fetching remote state...").start();
|
|
2218
2143
|
const orgQuery = orgId === "__from_api_key__" ? "" : `?orgId=${orgId}`;
|
|
2219
2144
|
const remoteResult = await apiRequest(
|
|
2220
2145
|
`${BASE_URL}/api/cli/pull${orgQuery}`
|
|
@@ -2294,7 +2219,7 @@ Examples:
|
|
|
2294
2219
|
return;
|
|
2295
2220
|
}
|
|
2296
2221
|
}
|
|
2297
|
-
const pushSpinner = agentMode ? null : (0,
|
|
2222
|
+
const pushSpinner = agentMode ? null : (0, import_ora6.default)("Pushing config...").start();
|
|
2298
2223
|
const pushBody = {
|
|
2299
2224
|
config: { features: config.features, plans: config.plans }
|
|
2300
2225
|
};
|
|
@@ -2363,7 +2288,7 @@ Examples:
|
|
|
2363
2288
|
var import_node2 = require("@commet/node");
|
|
2364
2289
|
var import_chalk14 = __toESM(require("chalk"));
|
|
2365
2290
|
var import_commander10 = require("commander");
|
|
2366
|
-
var
|
|
2291
|
+
var import_ora7 = __toESM(require("ora"));
|
|
2367
2292
|
|
|
2368
2293
|
// src/utils/sdk.ts
|
|
2369
2294
|
var import_node = require("@commet/node");
|
|
@@ -2401,7 +2326,7 @@ function createResourceCommand(def) {
|
|
|
2401
2326
|
}
|
|
2402
2327
|
subcommand.action(async (options) => {
|
|
2403
2328
|
const agentMode = isAgentMode(options);
|
|
2404
|
-
const spinner = agentMode ? null : (0,
|
|
2329
|
+
const spinner = agentMode ? null : (0, import_ora7.default)(`Running ${def.name} ${actionName}...`).start();
|
|
2405
2330
|
try {
|
|
2406
2331
|
const client = createSdkClient();
|
|
2407
2332
|
const resource = client[def.sdkProperty];
|
|
@@ -4246,6 +4171,62 @@ var webhooksResource = {
|
|
|
4246
4171
|
flag: "--description <desc>",
|
|
4247
4172
|
description: "Webhook description",
|
|
4248
4173
|
sdkKey: "description"
|
|
4174
|
+
},
|
|
4175
|
+
{
|
|
4176
|
+
flag: "--api-version <version>",
|
|
4177
|
+
description: "Pin the endpoint to an API version",
|
|
4178
|
+
sdkKey: "apiVersion"
|
|
4179
|
+
}
|
|
4180
|
+
]
|
|
4181
|
+
},
|
|
4182
|
+
get: {
|
|
4183
|
+
method: "get",
|
|
4184
|
+
description: "Get a webhook endpoint",
|
|
4185
|
+
params: [
|
|
4186
|
+
{
|
|
4187
|
+
flag: "--id <id>",
|
|
4188
|
+
description: "Webhook endpoint ID",
|
|
4189
|
+
required: true,
|
|
4190
|
+
sdkKey: "id"
|
|
4191
|
+
}
|
|
4192
|
+
]
|
|
4193
|
+
},
|
|
4194
|
+
update: {
|
|
4195
|
+
method: "update",
|
|
4196
|
+
description: "Update a webhook endpoint",
|
|
4197
|
+
params: [
|
|
4198
|
+
{
|
|
4199
|
+
flag: "--id <id>",
|
|
4200
|
+
description: "Webhook endpoint ID",
|
|
4201
|
+
required: true,
|
|
4202
|
+
sdkKey: "id"
|
|
4203
|
+
},
|
|
4204
|
+
{
|
|
4205
|
+
flag: "--url <url>",
|
|
4206
|
+
description: "Webhook URL",
|
|
4207
|
+
sdkKey: "url"
|
|
4208
|
+
},
|
|
4209
|
+
{
|
|
4210
|
+
flag: "--events <json>",
|
|
4211
|
+
description: 'Events to subscribe to (JSON array: ["subscription.created"])',
|
|
4212
|
+
parse: parseJson,
|
|
4213
|
+
sdkKey: "events"
|
|
4214
|
+
},
|
|
4215
|
+
{
|
|
4216
|
+
flag: "--description <desc>",
|
|
4217
|
+
description: "Webhook description",
|
|
4218
|
+
sdkKey: "description"
|
|
4219
|
+
},
|
|
4220
|
+
{
|
|
4221
|
+
flag: "--is-active <bool>",
|
|
4222
|
+
description: "Whether the endpoint is active",
|
|
4223
|
+
parse: parseBool,
|
|
4224
|
+
sdkKey: "isActive"
|
|
4225
|
+
},
|
|
4226
|
+
{
|
|
4227
|
+
flag: "--api-version <version>",
|
|
4228
|
+
description: "Pin the endpoint to an API version",
|
|
4229
|
+
sdkKey: "apiVersion"
|
|
4249
4230
|
}
|
|
4250
4231
|
]
|
|
4251
4232
|
},
|
|
@@ -4912,7 +4893,7 @@ program.addCommand(orgsCommand);
|
|
|
4912
4893
|
program.addCommand(pushCommand);
|
|
4913
4894
|
program.addCommand(pullCommand);
|
|
4914
4895
|
program.addCommand(listenCommand);
|
|
4915
|
-
program.addCommand(apiKeyCommand);
|
|
4896
|
+
program.addCommand(apiKeyCommand, { hidden: true });
|
|
4916
4897
|
for (const def of resourceDefinitions) {
|
|
4917
4898
|
program.addCommand(createResourceCommand(def));
|
|
4918
4899
|
}
|
|
@@ -5018,10 +4999,6 @@ function printAgentInfo() {
|
|
|
5018
4999
|
description: "Scaffold a new Commet app from template",
|
|
5019
5000
|
usage: "commet create [name] -t <template> --org <slug> -y"
|
|
5020
5001
|
},
|
|
5021
|
-
"api-key": {
|
|
5022
|
-
description: "Generate API key for CI",
|
|
5023
|
-
usage: "commet api-key --output agent"
|
|
5024
|
-
},
|
|
5025
5002
|
login: {
|
|
5026
5003
|
description: "Authenticate via browser. Requires a human \u2014 opens a device-code flow.",
|
|
5027
5004
|
usage: "commet login"
|
|
@@ -5086,7 +5063,6 @@ function printDefaultScreen() {
|
|
|
5086
5063
|
}
|
|
5087
5064
|
console.log(dim("\n Setup"));
|
|
5088
5065
|
console.log(` ${cmd("create")}${dim("Scaffold a new Commet app")}`);
|
|
5089
|
-
console.log(` ${cmd("api-key")}${dim("Generate API key for CI")}`);
|
|
5090
5066
|
console.log(` ${cmd("login")}${dim("Authenticate")}`);
|
|
5091
5067
|
console.log(` ${cmd("logout")}${dim("Log out")}`);
|
|
5092
5068
|
console.log(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "commet",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "Commet CLI - Manage your billing platform from the command line",
|
|
5
5
|
"bin": {
|
|
6
6
|
"commet": "./bin/commet"
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"author": "Commet Team",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@inquirer/prompts": "8.
|
|
22
|
+
"@inquirer/prompts": "8.5.0",
|
|
23
23
|
"ably": "^2.21.0",
|
|
24
24
|
"chalk": "5.6.2",
|
|
25
25
|
"commander": "14.0.3",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"open": "11.0.0",
|
|
29
29
|
"ora": "9.4.0",
|
|
30
30
|
"tar": "^7.5.13",
|
|
31
|
-
"@commet/node": "5.
|
|
31
|
+
"@commet/node": "5.1.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "24.12.4",
|