opencode-supertask 0.1.3 → 0.1.4

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/cli/index.js CHANGED
@@ -22871,26 +22871,28 @@ function uninstall() {
22871
22871
  }
22872
22872
  function ensureGateway() {
22873
22873
  try {
22874
- const list2 = pm2JsonList();
22875
- const proc = list2.find((p) => p.name === PROCESS_NAME);
22874
+ const list = pm2JsonList();
22875
+ const proc = list.find((p) => p.name === PROCESS_NAME);
22876
22876
  if (proc && proc.pm2_env?.status === "online") {
22877
22877
  return;
22878
22878
  }
22879
22879
  } catch {
22880
22880
  }
22881
22881
  if (!isPm2Installed()) {
22882
+ console.log("[supertask] Installing pm2 for Gateway process management...");
22882
22883
  try {
22883
22884
  execSync("npm install -g pm2", { stdio: "pipe" });
22884
22885
  } catch {
22885
22886
  try {
22886
22887
  execSync("bun install -g pm2", { stdio: "pipe" });
22887
22888
  } catch {
22889
+ console.warn("[supertask] Could not install pm2. Gateway will not auto-start. Run `supertask install` manually.");
22888
22890
  return;
22889
22891
  }
22890
22892
  }
22891
22893
  }
22892
- const list = pm2JsonList();
22893
- const existing = list.find((p) => p.name === PROCESS_NAME);
22894
+ const pm2List = pm2JsonList();
22895
+ const existing = pm2List.find((p) => p.name === PROCESS_NAME);
22894
22896
  if (existing) {
22895
22897
  pm2Exec(["restart", PROCESS_NAME]);
22896
22898
  } else {
@@ -23169,12 +23171,22 @@ program2.command("config").description("Show current configuration").action(asyn
23169
23171
  console.log(JSON.stringify(cfg, null, 2));
23170
23172
  });
23171
23173
  program2.command("install").description("Install Gateway as pm2 service (auto-start on boot, crash recovery)").action(async () => {
23172
- const { install: pm2Install } = await Promise.resolve().then(() => (init_pm2(), pm2_exports));
23173
- pm2Install();
23174
+ try {
23175
+ const { install: pm2Install } = await Promise.resolve().then(() => (init_pm2(), pm2_exports));
23176
+ pm2Install();
23177
+ } catch (err) {
23178
+ console.error(err instanceof Error ? err.message : String(err));
23179
+ process.exit(1);
23180
+ }
23174
23181
  });
23175
23182
  program2.command("uninstall").description("Stop and remove Gateway pm2 service").action(async () => {
23176
- const { uninstall: pm2Uninstall } = await Promise.resolve().then(() => (init_pm2(), pm2_exports));
23177
- pm2Uninstall();
23183
+ try {
23184
+ const { uninstall: pm2Uninstall } = await Promise.resolve().then(() => (init_pm2(), pm2_exports));
23185
+ pm2Uninstall();
23186
+ } catch (err) {
23187
+ console.error(err instanceof Error ? err.message : String(err));
23188
+ process.exit(1);
23189
+ }
23178
23190
  });
23179
23191
  program2.parse();
23180
23192
  //# sourceMappingURL=index.js.map