opencode-supertask 0.1.2 → 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 +32 -15
- package/dist/cli/index.js.map +1 -1
- package/dist/gateway/index.js +0 -1
- package/dist/gateway/index.js.map +1 -1
- package/dist/plugin/supertask.js +22 -6
- package/dist/plugin/supertask.js.map +1 -1
- package/dist/web/index.js +0 -1
- package/dist/web/index.js.map +1 -1
- package/dist/worker/index.js +0 -1
- package/dist/worker/index.js.map +1 -1
- package/package.json +1 -1
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
|
-
|
|
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 =
|
|
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
|
-
|
|
22836
|
-
process.exit(1);
|
|
22841
|
+
throw new Error(`[supertask] pm2 start failed: ${output}`);
|
|
22837
22842
|
}
|
|
22838
22843
|
}
|
|
22839
22844
|
pm2Exec(["save"]);
|
|
@@ -22866,30 +22871,32 @@ function uninstall() {
|
|
|
22866
22871
|
}
|
|
22867
22872
|
function ensureGateway() {
|
|
22868
22873
|
try {
|
|
22869
|
-
const
|
|
22870
|
-
const proc =
|
|
22874
|
+
const list = pm2JsonList();
|
|
22875
|
+
const proc = list.find((p) => p.name === PROCESS_NAME);
|
|
22871
22876
|
if (proc && proc.pm2_env?.status === "online") {
|
|
22872
22877
|
return;
|
|
22873
22878
|
}
|
|
22874
22879
|
} catch {
|
|
22875
22880
|
}
|
|
22876
22881
|
if (!isPm2Installed()) {
|
|
22882
|
+
console.log("[supertask] Installing pm2 for Gateway process management...");
|
|
22877
22883
|
try {
|
|
22878
22884
|
execSync("npm install -g pm2", { stdio: "pipe" });
|
|
22879
22885
|
} catch {
|
|
22880
22886
|
try {
|
|
22881
22887
|
execSync("bun install -g pm2", { stdio: "pipe" });
|
|
22882
22888
|
} catch {
|
|
22889
|
+
console.warn("[supertask] Could not install pm2. Gateway will not auto-start. Run `supertask install` manually.");
|
|
22883
22890
|
return;
|
|
22884
22891
|
}
|
|
22885
22892
|
}
|
|
22886
22893
|
}
|
|
22887
|
-
const
|
|
22888
|
-
const existing =
|
|
22894
|
+
const pm2List = pm2JsonList();
|
|
22895
|
+
const existing = pm2List.find((p) => p.name === PROCESS_NAME);
|
|
22889
22896
|
if (existing) {
|
|
22890
22897
|
pm2Exec(["restart", PROCESS_NAME]);
|
|
22891
22898
|
} else {
|
|
22892
|
-
const bunPath =
|
|
22899
|
+
const bunPath = findBunPath();
|
|
22893
22900
|
pm2Exec([
|
|
22894
22901
|
"start",
|
|
22895
22902
|
GATEWAY_ENTRY,
|
|
@@ -23164,12 +23171,22 @@ program2.command("config").description("Show current configuration").action(asyn
|
|
|
23164
23171
|
console.log(JSON.stringify(cfg, null, 2));
|
|
23165
23172
|
});
|
|
23166
23173
|
program2.command("install").description("Install Gateway as pm2 service (auto-start on boot, crash recovery)").action(async () => {
|
|
23167
|
-
|
|
23168
|
-
|
|
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
|
+
}
|
|
23169
23181
|
});
|
|
23170
23182
|
program2.command("uninstall").description("Stop and remove Gateway pm2 service").action(async () => {
|
|
23171
|
-
|
|
23172
|
-
|
|
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
|
+
}
|
|
23173
23190
|
});
|
|
23174
23191
|
program2.parse();
|
|
23175
23192
|
//# sourceMappingURL=index.js.map
|