@insforge/cli 0.1.15 → 0.1.16

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