@insforge/cli 0.1.15 → 0.1.17
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 +36 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -694,6 +694,34 @@ ${missing.join("\n")}
|
|
|
694
694
|
`;
|
|
695
695
|
appendFileSync(gitignorePath, block);
|
|
696
696
|
}
|
|
697
|
+
async function isCliInstalledGlobally() {
|
|
698
|
+
try {
|
|
699
|
+
const { stdout } = await execAsync("npm ls -g @insforge/cli --json", { timeout: 1e4 });
|
|
700
|
+
const parsed = JSON.parse(stdout);
|
|
701
|
+
return !!parsed?.dependencies?.["@insforge/cli"];
|
|
702
|
+
} catch {
|
|
703
|
+
return false;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
async function promptCliInstall(json) {
|
|
707
|
+
if (json) return;
|
|
708
|
+
try {
|
|
709
|
+
if (await isCliInstalledGlobally()) return;
|
|
710
|
+
const shouldInstall = await clack5.confirm({
|
|
711
|
+
message: "Would you like to install the InsForge CLI globally? (so you can run `insforge` directly)"
|
|
712
|
+
});
|
|
713
|
+
if (clack5.isCancel(shouldInstall) || !shouldInstall) {
|
|
714
|
+
clack5.log.info("You can install it later with: npm install -g @insforge/cli");
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
const s = clack5.spinner();
|
|
718
|
+
s.start("Installing @insforge/cli globally...");
|
|
719
|
+
await execAsync("npm install -g @insforge/cli", { timeout: 6e4 });
|
|
720
|
+
s.stop("InsForge CLI installed globally");
|
|
721
|
+
} catch {
|
|
722
|
+
clack5.log.warn("Failed to install CLI globally. You can run manually: npm install -g @insforge/cli");
|
|
723
|
+
}
|
|
724
|
+
}
|
|
697
725
|
async function installSkills(json) {
|
|
698
726
|
try {
|
|
699
727
|
if (!json) clack5.log.info("Installing InsForge agent skills...");
|
|
@@ -818,6 +846,7 @@ function registerProjectLinkCommand(program2) {
|
|
|
818
846
|
} else {
|
|
819
847
|
outputSuccess(`Linked to project "${project.name}" (${project.appkey}.${project.region})`);
|
|
820
848
|
}
|
|
849
|
+
await promptCliInstall(json);
|
|
821
850
|
await installSkills(json);
|
|
822
851
|
await reportCliUsage("cli.link", true, 6);
|
|
823
852
|
} catch (err) {
|
|
@@ -1620,10 +1649,10 @@ function registerStorageDeleteBucketCommand(storageCmd2) {
|
|
|
1620
1649
|
try {
|
|
1621
1650
|
await requireAuth();
|
|
1622
1651
|
if (!yes && !json) {
|
|
1623
|
-
const
|
|
1652
|
+
const confirm8 = await clack7.confirm({
|
|
1624
1653
|
message: `Delete bucket "${name}" and all its objects? This cannot be undone.`
|
|
1625
1654
|
});
|
|
1626
|
-
if (!
|
|
1655
|
+
if (!confirm8 || clack7.isCancel(confirm8)) {
|
|
1627
1656
|
process.exit(0);
|
|
1628
1657
|
}
|
|
1629
1658
|
}
|
|
@@ -1969,6 +1998,7 @@ function registerCreateCommand(program2) {
|
|
|
1969
1998
|
if (hasTemplate) {
|
|
1970
1999
|
await downloadTemplate(template, projectConfig, projectName, json, apiUrl);
|
|
1971
2000
|
}
|
|
2001
|
+
await promptCliInstall(json);
|
|
1972
2002
|
await installSkills(json);
|
|
1973
2003
|
await reportCliUsage("cli.create", true, 6);
|
|
1974
2004
|
if (hasTemplate) {
|
|
@@ -2471,10 +2501,10 @@ function registerSecretsDeleteCommand(secretsCmd2) {
|
|
|
2471
2501
|
try {
|
|
2472
2502
|
await requireAuth();
|
|
2473
2503
|
if (!yes && !json) {
|
|
2474
|
-
const
|
|
2504
|
+
const confirm8 = await clack11.confirm({
|
|
2475
2505
|
message: `Delete secret "${key}"? This cannot be undone.`
|
|
2476
2506
|
});
|
|
2477
|
-
if (!
|
|
2507
|
+
if (!confirm8 || clack11.isCancel(confirm8)) {
|
|
2478
2508
|
process.exit(0);
|
|
2479
2509
|
}
|
|
2480
2510
|
}
|
|
@@ -2657,10 +2687,10 @@ function registerSchedulesDeleteCommand(schedulesCmd2) {
|
|
|
2657
2687
|
try {
|
|
2658
2688
|
await requireAuth();
|
|
2659
2689
|
if (!yes && !json) {
|
|
2660
|
-
const
|
|
2690
|
+
const confirm8 = await clack12.confirm({
|
|
2661
2691
|
message: `Delete schedule "${id}"? This cannot be undone.`
|
|
2662
2692
|
});
|
|
2663
|
-
if (!
|
|
2693
|
+
if (!confirm8 || clack12.isCancel(confirm8)) {
|
|
2664
2694
|
process.exit(0);
|
|
2665
2695
|
}
|
|
2666
2696
|
}
|