@insforge/cli 0.1.17 → 0.1.19

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 CHANGED
@@ -694,32 +694,19 @@ ${missing.join("\n")}
694
694
  `;
695
695
  appendFileSync(gitignorePath, block);
696
696
  }
697
- async function isCliInstalledGlobally() {
697
+ async function installCliGlobally(json) {
698
698
  try {
699
699
  const { stdout } = await execAsync("npm ls -g @insforge/cli --json", { timeout: 1e4 });
700
700
  const parsed = JSON.parse(stdout);
701
- return !!parsed?.dependencies?.["@insforge/cli"];
701
+ if (parsed?.dependencies?.["@insforge/cli"]) return;
702
702
  } catch {
703
- return false;
704
703
  }
705
- }
706
- async function promptCliInstall(json) {
707
- if (json) return;
708
704
  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...");
705
+ if (!json) clack5.log.info("Installing InsForge CLI globally...");
719
706
  await execAsync("npm install -g @insforge/cli", { timeout: 6e4 });
720
- s.stop("InsForge CLI installed globally");
707
+ if (!json) clack5.log.success("InsForge CLI installed. You can now run `insforge` directly.");
721
708
  } catch {
722
- clack5.log.warn("Failed to install CLI globally. You can run manually: npm install -g @insforge/cli");
709
+ if (!json) clack5.log.warn("Failed to install CLI globally. You can run manually: npm install -g @insforge/cli");
723
710
  }
724
711
  }
725
712
  async function installSkills(json) {
@@ -846,7 +833,7 @@ function registerProjectLinkCommand(program2) {
846
833
  } else {
847
834
  outputSuccess(`Linked to project "${project.name}" (${project.appkey}.${project.region})`);
848
835
  }
849
- await promptCliInstall(json);
836
+ await installCliGlobally(json);
850
837
  await installSkills(json);
851
838
  await reportCliUsage("cli.link", true, 6);
852
839
  } catch (err) {
@@ -1649,10 +1636,10 @@ function registerStorageDeleteBucketCommand(storageCmd2) {
1649
1636
  try {
1650
1637
  await requireAuth();
1651
1638
  if (!yes && !json) {
1652
- const confirm8 = await clack7.confirm({
1639
+ const confirm7 = await clack7.confirm({
1653
1640
  message: `Delete bucket "${name}" and all its objects? This cannot be undone.`
1654
1641
  });
1655
- if (!confirm8 || clack7.isCancel(confirm8)) {
1642
+ if (!confirm7 || clack7.isCancel(confirm7)) {
1656
1643
  process.exit(0);
1657
1644
  }
1658
1645
  }
@@ -1998,7 +1985,7 @@ function registerCreateCommand(program2) {
1998
1985
  if (hasTemplate) {
1999
1986
  await downloadTemplate(template, projectConfig, projectName, json, apiUrl);
2000
1987
  }
2001
- await promptCliInstall(json);
1988
+ await installCliGlobally(json);
2002
1989
  await installSkills(json);
2003
1990
  await reportCliUsage("cli.create", true, 6);
2004
1991
  if (hasTemplate) {
@@ -2501,10 +2488,10 @@ function registerSecretsDeleteCommand(secretsCmd2) {
2501
2488
  try {
2502
2489
  await requireAuth();
2503
2490
  if (!yes && !json) {
2504
- const confirm8 = await clack11.confirm({
2491
+ const confirm7 = await clack11.confirm({
2505
2492
  message: `Delete secret "${key}"? This cannot be undone.`
2506
2493
  });
2507
- if (!confirm8 || clack11.isCancel(confirm8)) {
2494
+ if (!confirm7 || clack11.isCancel(confirm7)) {
2508
2495
  process.exit(0);
2509
2496
  }
2510
2497
  }
@@ -2687,10 +2674,10 @@ function registerSchedulesDeleteCommand(schedulesCmd2) {
2687
2674
  try {
2688
2675
  await requireAuth();
2689
2676
  if (!yes && !json) {
2690
- const confirm8 = await clack12.confirm({
2677
+ const confirm7 = await clack12.confirm({
2691
2678
  message: `Delete schedule "${id}"? This cannot be undone.`
2692
2679
  });
2693
- if (!confirm8 || clack12.isCancel(confirm8)) {
2680
+ if (!confirm7 || clack12.isCancel(confirm7)) {
2694
2681
  process.exit(0);
2695
2682
  }
2696
2683
  }