opencode-supertask 0.1.2 → 0.1.3

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
@@ -9404,7 +9404,6 @@ function getMigrationsFolder() {
9404
9404
  }
9405
9405
  function initDb() {
9406
9406
  const dataDir = dirname(DB_FILE_PATH);
9407
- const dbExisted = existsSync(DB_FILE_PATH);
9408
9407
  if (!existsSync(dataDir)) {
9409
9408
  mkdirSync(dataDir, { recursive: true });
9410
9409
  }
@@ -22799,11 +22798,18 @@ function isGatewayRunning() {
22799
22798
  if (!proc) return false;
22800
22799
  return proc.pm2_env?.status === "online";
22801
22800
  }
22801
+ function findBunPath() {
22802
+ try {
22803
+ const cmd = process.platform === "win32" ? "where bun" : "which bun";
22804
+ return execSync(cmd, { stdio: "pipe" }).toString().trim().split("\n")[0];
22805
+ } catch {
22806
+ return process.execPath;
22807
+ }
22808
+ }
22802
22809
  function install() {
22803
22810
  if (!isPm2Installed()) {
22804
22811
  if (!installPm2()) {
22805
- console.error("[supertask] Failed to install pm2. Please install it manually: npm install -g pm2");
22806
- process.exit(1);
22812
+ throw new Error("[supertask] Failed to install pm2. Please install it manually: npm install -g pm2");
22807
22813
  }
22808
22814
  }
22809
22815
  console.log("[supertask] pm2 ready");
@@ -22818,7 +22824,7 @@ function install() {
22818
22824
  }
22819
22825
  } else {
22820
22826
  console.log("[supertask] Starting Gateway with pm2...");
22821
- const bunPath = process.execPath;
22827
+ const bunPath = findBunPath();
22822
22828
  const { ok, output } = pm2Exec([
22823
22829
  "start",
22824
22830
  GATEWAY_ENTRY,
@@ -22832,8 +22838,7 @@ function install() {
22832
22838
  "30"
22833
22839
  ]);
22834
22840
  if (!ok) {
22835
- console.error("[supertask] pm2 start failed:", output);
22836
- process.exit(1);
22841
+ throw new Error(`[supertask] pm2 start failed: ${output}`);
22837
22842
  }
22838
22843
  }
22839
22844
  pm2Exec(["save"]);
@@ -22889,7 +22894,7 @@ function ensureGateway() {
22889
22894
  if (existing) {
22890
22895
  pm2Exec(["restart", PROCESS_NAME]);
22891
22896
  } else {
22892
- const bunPath = process.execPath;
22897
+ const bunPath = findBunPath();
22893
22898
  pm2Exec([
22894
22899
  "start",
22895
22900
  GATEWAY_ENTRY,