commet 1.3.0 → 1.4.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 +2 -0
- package/dist/index.js +49 -5
- package/package.json +1 -1
package/README.md
CHANGED
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.4.0",
|
|
34
34
|
description: "Commet CLI - Manage your billing platform from the command line",
|
|
35
35
|
bin: {
|
|
36
36
|
commet: "./bin/commet"
|
|
@@ -85,6 +85,7 @@ var package_default = {
|
|
|
85
85
|
};
|
|
86
86
|
|
|
87
87
|
// src/commands/create.ts
|
|
88
|
+
var import_node_child_process = require("child_process");
|
|
88
89
|
var fs2 = __toESM(require("fs"));
|
|
89
90
|
var os2 = __toESM(require("os"));
|
|
90
91
|
var path2 = __toESM(require("path"));
|
|
@@ -409,10 +410,7 @@ function writeApiKeyToEnv(dest, apiKey, environment) {
|
|
|
409
410
|
const envPath = path2.join(dest, ".env");
|
|
410
411
|
if (!fs2.existsSync(envPath)) return;
|
|
411
412
|
let content = fs2.readFileSync(envPath, "utf-8");
|
|
412
|
-
content = content.replace(
|
|
413
|
-
/COMMET_API_KEY=.*/,
|
|
414
|
-
`COMMET_API_KEY=${apiKey}`
|
|
415
|
-
);
|
|
413
|
+
content = content.replace(/COMMET_API_KEY=.*/, `COMMET_API_KEY=${apiKey}`);
|
|
416
414
|
content = content.replace(
|
|
417
415
|
/COMMET_ENVIRONMENT=.*/,
|
|
418
416
|
`COMMET_ENVIRONMENT=${environment}`
|
|
@@ -428,6 +426,46 @@ function linkProject(dest, orgId, orgName, environment) {
|
|
|
428
426
|
"utf8"
|
|
429
427
|
);
|
|
430
428
|
}
|
|
429
|
+
async function askSkills() {
|
|
430
|
+
try {
|
|
431
|
+
return await (0, import_prompts.confirm)({
|
|
432
|
+
message: `Add ${commetColor("agent skills")}?`,
|
|
433
|
+
default: true,
|
|
434
|
+
theme: promptTheme
|
|
435
|
+
});
|
|
436
|
+
} catch {
|
|
437
|
+
return false;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
async function installSkills(projectRoot) {
|
|
441
|
+
const npx = process.platform === "win32" ? "npx.cmd" : "npx";
|
|
442
|
+
return new Promise((resolve3) => {
|
|
443
|
+
(0, import_node_child_process.execFile)(
|
|
444
|
+
npx,
|
|
445
|
+
[
|
|
446
|
+
"-y",
|
|
447
|
+
"--loglevel=error",
|
|
448
|
+
"skills",
|
|
449
|
+
"add",
|
|
450
|
+
"https://github.com/commet-labs/commet",
|
|
451
|
+
"--skill",
|
|
452
|
+
"commet"
|
|
453
|
+
],
|
|
454
|
+
{ cwd: projectRoot },
|
|
455
|
+
(error) => {
|
|
456
|
+
if (error) {
|
|
457
|
+
console.log(import_chalk3.default.dim(" You can install them manually by running:"));
|
|
458
|
+
console.log(
|
|
459
|
+
import_chalk3.default.dim(
|
|
460
|
+
" npx skills add https://github.com/commet-labs/commet --skill commet"
|
|
461
|
+
)
|
|
462
|
+
);
|
|
463
|
+
}
|
|
464
|
+
resolve3();
|
|
465
|
+
}
|
|
466
|
+
);
|
|
467
|
+
});
|
|
468
|
+
}
|
|
431
469
|
var createCommand = new import_commander.Command("create").description("Create a new Commet app from a template").argument("[name]", "Project name").option(
|
|
432
470
|
"-t, --template <template>",
|
|
433
471
|
"Template to use (fixed, seats, metered, credits, balance-ai, balance-fixed)"
|
|
@@ -557,6 +595,7 @@ var createCommand = new import_commander.Command("create").description("Create a
|
|
|
557
595
|
console.log(import_chalk3.default.yellow("\n\u26A0 Cancelled"));
|
|
558
596
|
return;
|
|
559
597
|
}
|
|
598
|
+
const shouldInstallSkills = await askSkills();
|
|
560
599
|
const downloadSpinner = (0, import_ora2.default)("Downloading template...").start();
|
|
561
600
|
try {
|
|
562
601
|
await downloadTemplate(template.dir, dest, opts.ref);
|
|
@@ -606,6 +645,11 @@ var createCommand = new import_commander.Command("create").description("Create a
|
|
|
606
645
|
keySpinner.succeed("API key created and saved to .env");
|
|
607
646
|
}
|
|
608
647
|
linkProject(dest, selectedOrg.id, selectedOrg.name, auth.environment);
|
|
648
|
+
if (shouldInstallSkills) {
|
|
649
|
+
const skillsSpinner = (0, import_ora2.default)("Installing agent skills...").start();
|
|
650
|
+
await installSkills(dest);
|
|
651
|
+
skillsSpinner.succeed("Agent skills installed");
|
|
652
|
+
}
|
|
609
653
|
console.log(import_chalk3.default.green(`
|
|
610
654
|
\u2713 Created ${projectName}`));
|
|
611
655
|
console.log(import_chalk3.default.dim(` Template: ${template.name}`));
|