commet 1.5.0 → 1.6.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 +67 -16
- package/package.json +1 -1
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: "1.
|
|
33
|
+
version: "1.6.0",
|
|
34
34
|
description: "Commet CLI - Manage your billing platform from the command line",
|
|
35
35
|
bin: {
|
|
36
36
|
commet: "./bin/commet"
|
|
@@ -482,7 +482,13 @@ function linkProject(dest, orgId, orgName, environment) {
|
|
|
482
482
|
"utf8"
|
|
483
483
|
);
|
|
484
484
|
}
|
|
485
|
-
|
|
485
|
+
function isInteractive() {
|
|
486
|
+
return process.stdin.isTTY === true;
|
|
487
|
+
}
|
|
488
|
+
async function resolveSkills(opts) {
|
|
489
|
+
if (typeof opts.skills === "boolean") return opts.skills;
|
|
490
|
+
if (opts.yes) return true;
|
|
491
|
+
if (!isInteractive()) return false;
|
|
486
492
|
try {
|
|
487
493
|
return await (0, import_prompts.confirm)({
|
|
488
494
|
message: `Add ${commetColor("agent skills")}?`,
|
|
@@ -513,7 +519,7 @@ async function installSkills(projectRoot) {
|
|
|
513
519
|
var createCommand = new import_commander.Command("create").description("Create a new Commet app from a template").argument("[name]", "Project name").option(
|
|
514
520
|
"-t, --template <template>",
|
|
515
521
|
"Template to use (fixed, seats, metered, credits, balance-ai, balance-fixed)"
|
|
516
|
-
).option("--ref <ref>", "Git ref to fetch templates from", "main").option("--list", "List available templates").action(async (argName, opts) => {
|
|
522
|
+
).option("--org <slug>", "Organization slug or ID (skips selection)").option("--skills", "Install agent skills").option("--no-skills", "Skip agent skills installation").option("-y, --yes", "Accept defaults for optional prompts").option("--ref <ref>", "Git ref to fetch templates from", "main").option("--list", "List available templates").action(async (argName, opts) => {
|
|
517
523
|
if (opts.list) {
|
|
518
524
|
console.log(import_chalk3.default.bold("\nAvailable templates:\n"));
|
|
519
525
|
for (const t of TEMPLATES) {
|
|
@@ -525,16 +531,23 @@ var createCommand = new import_commander.Command("create").description("Create a
|
|
|
525
531
|
return;
|
|
526
532
|
}
|
|
527
533
|
let projectName = argName;
|
|
528
|
-
|
|
529
|
-
if (!
|
|
534
|
+
if (!projectName) {
|
|
535
|
+
if (!isInteractive()) {
|
|
536
|
+
console.log(import_chalk3.default.red("\u2717 Project name is required"));
|
|
537
|
+
console.log(
|
|
538
|
+
import_chalk3.default.dim("Pass as positional argument: commet create <name>")
|
|
539
|
+
);
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
try {
|
|
530
543
|
projectName = await (0, import_prompts.input)({
|
|
531
544
|
message: "Project name:",
|
|
532
545
|
theme: promptTheme
|
|
533
546
|
});
|
|
547
|
+
} catch {
|
|
548
|
+
console.log(import_chalk3.default.yellow("\n\u26A0 Cancelled"));
|
|
549
|
+
return;
|
|
534
550
|
}
|
|
535
|
-
} catch {
|
|
536
|
-
console.log(import_chalk3.default.yellow("\n\u26A0 Cancelled"));
|
|
537
|
-
return;
|
|
538
551
|
}
|
|
539
552
|
const dest = path2.resolve(projectName);
|
|
540
553
|
if (fs2.existsSync(dest)) {
|
|
@@ -544,6 +557,11 @@ var createCommand = new import_commander.Command("create").description("Create a
|
|
|
544
557
|
return;
|
|
545
558
|
}
|
|
546
559
|
if (!authExists()) {
|
|
560
|
+
if (!isInteractive()) {
|
|
561
|
+
console.log(import_chalk3.default.red("\u2717 Not authenticated"));
|
|
562
|
+
console.log(import_chalk3.default.dim("Run `commet login` first"));
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
547
565
|
let environment;
|
|
548
566
|
try {
|
|
549
567
|
environment = await (0, import_prompts.select)({
|
|
@@ -597,9 +615,32 @@ var createCommand = new import_commander.Command("create").description("Create a
|
|
|
597
615
|
return;
|
|
598
616
|
}
|
|
599
617
|
let selectedOrg;
|
|
600
|
-
if (
|
|
618
|
+
if (opts.org) {
|
|
619
|
+
const match = organizations.find(
|
|
620
|
+
(org) => org.slug === opts.org || org.id === opts.org
|
|
621
|
+
);
|
|
622
|
+
if (!match) {
|
|
623
|
+
console.log(import_chalk3.default.red(`\u2717 Organization "${opts.org}" not found`));
|
|
624
|
+
console.log(
|
|
625
|
+
import_chalk3.default.dim(
|
|
626
|
+
`Available: ${organizations.map((o) => o.slug).join(", ")}`
|
|
627
|
+
)
|
|
628
|
+
);
|
|
629
|
+
return;
|
|
630
|
+
}
|
|
631
|
+
selectedOrg = match;
|
|
632
|
+
} else if (organizations.length === 1) {
|
|
601
633
|
selectedOrg = organizations[0];
|
|
602
634
|
} else {
|
|
635
|
+
if (!isInteractive()) {
|
|
636
|
+
console.log(import_chalk3.default.red("\u2717 Organization is required"));
|
|
637
|
+
console.log(
|
|
638
|
+
import_chalk3.default.dim(
|
|
639
|
+
`Pass --org=<slug>. Available: ${organizations.map((o) => o.slug).join(", ")}`
|
|
640
|
+
)
|
|
641
|
+
);
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
603
644
|
try {
|
|
604
645
|
const orgId = await (0, import_prompts.select)({
|
|
605
646
|
message: "Organization:",
|
|
@@ -623,8 +664,17 @@ var createCommand = new import_commander.Command("create").description("Create a
|
|
|
623
664
|
);
|
|
624
665
|
return;
|
|
625
666
|
}
|
|
626
|
-
|
|
627
|
-
if (!
|
|
667
|
+
if (!template) {
|
|
668
|
+
if (!isInteractive()) {
|
|
669
|
+
console.log(import_chalk3.default.red("\u2717 Template is required"));
|
|
670
|
+
console.log(
|
|
671
|
+
import_chalk3.default.dim(
|
|
672
|
+
`Pass --template=<name>. Available: ${TEMPLATES.map((t) => t.name).join(", ")}`
|
|
673
|
+
)
|
|
674
|
+
);
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
try {
|
|
628
678
|
const selected = await (0, import_prompts.select)({
|
|
629
679
|
message: "Billing model:",
|
|
630
680
|
choices: TEMPLATES.map((t) => ({
|
|
@@ -634,12 +684,12 @@ var createCommand = new import_commander.Command("create").description("Create a
|
|
|
634
684
|
theme: promptTheme
|
|
635
685
|
});
|
|
636
686
|
template = TEMPLATES.find((t) => t.name === selected);
|
|
687
|
+
} catch {
|
|
688
|
+
console.log(import_chalk3.default.yellow("\n\u26A0 Cancelled"));
|
|
689
|
+
return;
|
|
637
690
|
}
|
|
638
|
-
} catch {
|
|
639
|
-
console.log(import_chalk3.default.yellow("\n\u26A0 Cancelled"));
|
|
640
|
-
return;
|
|
641
691
|
}
|
|
642
|
-
const shouldInstallSkills = await
|
|
692
|
+
const shouldInstallSkills = await resolveSkills(opts);
|
|
643
693
|
const downloadSpinner = (0, import_ora2.default)("Downloading template...").start();
|
|
644
694
|
try {
|
|
645
695
|
await downloadTemplate(template.dir, dest, opts.ref);
|
|
@@ -1379,7 +1429,8 @@ try {
|
|
|
1379
1429
|
program.parse(process.argv);
|
|
1380
1430
|
} catch (error) {
|
|
1381
1431
|
if (error instanceof Error) {
|
|
1382
|
-
|
|
1432
|
+
const code = error.code;
|
|
1433
|
+
if (code === "commander.version" || code === "commander.help" || code === "commander.helpDisplayed") {
|
|
1383
1434
|
process.exit(0);
|
|
1384
1435
|
}
|
|
1385
1436
|
console.error(import_chalk13.default.red("Error:"), error.message);
|