@mushi-mushi/cli 0.40.3 → 0.40.5
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/{chunk-JXGVZWRL.js → chunk-3LHOI34N.js} +1 -1
- package/dist/{chunk-CGQE3GJK.js → chunk-4Z5MWQS5.js} +1 -1
- package/dist/chunk-5DI4Q5BD.js +8 -0
- package/dist/{chunk-HNVCLEDF.js → chunk-KEMUVMO7.js} +2 -2
- package/dist/{chunk-6ZQFL7SD.js → chunk-MNIFWCTR.js} +11 -11
- package/dist/chunk-UWPIVVCG.js +10 -0
- package/dist/{chunk-5TO6PSO6.js → chunk-ZOBSRRD3.js} +23 -9
- package/dist/{connect-FNGAJ532.js → connect-B2ZZPVWI.js} +3 -3
- package/dist/{connect-OJXHNDFB.js → connect-ZVMQIYBI.js} +2 -2
- package/dist/{daemon-PPOAKQNF.js → daemon-FM6M7TKK.js} +5 -3
- package/dist/index.js +238 -44
- package/dist/init.js +3 -3
- package/dist/{version-I4APZBTF.js → version-XXSOPUQR.js} +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wizard-bin.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-LWFREQOK.js +0 -8
- package/dist/chunk-ZVNRKEVP.js +0 -10
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
requireUuid,
|
|
10
10
|
saveConfig,
|
|
11
11
|
savedSdkKeyFor
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-4Z5MWQS5.js";
|
|
13
13
|
import {
|
|
14
14
|
MUSHI_MCP_PIN_SPEC
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-UWPIVVCG.js";
|
|
16
16
|
import {
|
|
17
17
|
assertEndpoint,
|
|
18
18
|
normalizeEndpoint
|
|
@@ -32,10 +32,10 @@ import {
|
|
|
32
32
|
saveConfig,
|
|
33
33
|
savedSdkKeyFor,
|
|
34
34
|
trySaveKeyToKeychain
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-3LHOI34N.js";
|
|
36
36
|
import {
|
|
37
37
|
MUSHI_CLI_VERSION
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-5DI4Q5BD.js";
|
|
39
39
|
import {
|
|
40
40
|
FRAMEWORKS,
|
|
41
41
|
detectFramework,
|
|
@@ -334,10 +334,12 @@ function defaultProjectName(packageName, cwd) {
|
|
|
334
334
|
const parts = cwd.split(/[\\/]/).filter(Boolean);
|
|
335
335
|
return parts[parts.length - 1] || "my-app";
|
|
336
336
|
}
|
|
337
|
-
function chooseProjectNonInteractive(projects, preferredName) {
|
|
337
|
+
function chooseProjectNonInteractive(projects, preferredName, appFolder = true) {
|
|
338
338
|
const wanted = slugify(preferredName);
|
|
339
339
|
const match = projects.find((p2) => slugify(p2.name) === wanted || p2.slug !== void 0 && slugify(p2.slug) === wanted);
|
|
340
|
-
|
|
340
|
+
if (match) return { kind: "existing", id: match.id, name: match.name };
|
|
341
|
+
if (!appFolder && projects.length > 0) return { kind: "ask" };
|
|
342
|
+
return { kind: "new", name: preferredName };
|
|
341
343
|
}
|
|
342
344
|
|
|
343
345
|
// src/freshness.ts
|
|
@@ -1754,16 +1756,14 @@ async function runBrowserSignIn(options, endpoint, consoleBase, preset) {
|
|
|
1754
1756
|
}
|
|
1755
1757
|
if (!isInteractive()) {
|
|
1756
1758
|
const cwd = options.cwd ?? process.cwd();
|
|
1757
|
-
const
|
|
1758
|
-
|
|
1759
|
-
defaultProjectName(readPackageJson(cwd)?.name, cwd)
|
|
1760
|
-
);
|
|
1759
|
+
const name = defaultProjectName(readPackageJson(cwd)?.name, cwd);
|
|
1760
|
+
const choice = chooseProjectNonInteractive(projects, name);
|
|
1761
1761
|
if (choice.kind === "existing") {
|
|
1762
1762
|
p.log.info(`Using project "${choice.name}" (matches this app \u2014 pass --project-id to pick another).`);
|
|
1763
1763
|
target = { kind: "existing", projectId: choice.id };
|
|
1764
1764
|
} else {
|
|
1765
|
-
p.log.info(`Creating project "${
|
|
1766
|
-
target = { kind: "new", name
|
|
1765
|
+
p.log.info(`Creating project "${name}" (no project matches this app \u2014 pass --project-id to use an existing one).`);
|
|
1766
|
+
target = { kind: "new", name };
|
|
1767
1767
|
}
|
|
1768
1768
|
} else {
|
|
1769
1769
|
const NEW = "__new__";
|
|
@@ -2185,7 +2185,7 @@ async function maybeOfferConnect(credentials, options, _consoleBase) {
|
|
|
2185
2185
|
if (p.isCancel(answer) || !answer) return;
|
|
2186
2186
|
const endpoint = resolveCloudEndpoint(options.endpoint);
|
|
2187
2187
|
try {
|
|
2188
|
-
const { runConnect } = await import("./connect-
|
|
2188
|
+
const { runConnect } = await import("./connect-ZVMQIYBI.js");
|
|
2189
2189
|
const saved = loadConfig();
|
|
2190
2190
|
const result = await runConnect(
|
|
2191
2191
|
{
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
requireConfig,
|
|
9
9
|
requireUuid,
|
|
10
10
|
tryLoadWorkerKey
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4Z5MWQS5.js";
|
|
12
12
|
import {
|
|
13
13
|
MUSHI_CLI_VERSION
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-UWPIVVCG.js";
|
|
15
15
|
|
|
16
16
|
// src/worker/daemon.ts
|
|
17
17
|
import { existsSync as existsSync6, readFileSync as readFileSync5 } from "fs";
|
|
@@ -1483,9 +1483,9 @@ async function installDeps(wt, log) {
|
|
|
1483
1483
|
const cmd = installCommand((f) => existsSync2(join4(wt, f)));
|
|
1484
1484
|
if (!cmd) return;
|
|
1485
1485
|
log(` deps: ${cmd[0]} ${cmd[1][0]} (so the agent can run tests and the commit hooks work)`);
|
|
1486
|
-
const spawnable = windowsInstaller(cmd, process.platform, process.execPath, existsSync2);
|
|
1486
|
+
const spawnable = windowsInstaller(cmd, process.platform, process.execPath, existsSync2, (process.env["PATH"] ?? "").split(";"));
|
|
1487
1487
|
if (!spawnable) {
|
|
1488
|
-
log(` deps: no ${cmd[0]}
|
|
1488
|
+
log(` deps: no ${cmd[0]} found next to this Node or on PATH, so no install; the agent works without dependencies (install it: npm i -g ${cmd[0]})`);
|
|
1489
1489
|
return;
|
|
1490
1490
|
}
|
|
1491
1491
|
const [bin, args] = spawnable;
|
|
@@ -1498,10 +1498,16 @@ var WINDOWS_PM_SCRIPTS = {
|
|
|
1498
1498
|
pnpm: ["node_modules/pnpm/bin/pnpm.cjs", "node_modules/corepack/dist/pnpm.js"],
|
|
1499
1499
|
yarn: ["node_modules/yarn/bin/yarn.js", "node_modules/corepack/dist/yarn.js"]
|
|
1500
1500
|
};
|
|
1501
|
-
function windowsInstaller(cmd, platform, nodeExe, hasFile) {
|
|
1501
|
+
function windowsInstaller(cmd, platform, nodeExe, hasFile, pathDirs = []) {
|
|
1502
1502
|
if (platform !== "win32") return cmd;
|
|
1503
|
-
const
|
|
1504
|
-
|
|
1503
|
+
const dirs = [win32.dirname(nodeExe), ...pathDirs.map((d) => d.trim().replace(/^"|"$/g, "")).filter(Boolean)];
|
|
1504
|
+
for (const dir of dirs) {
|
|
1505
|
+
const script = (WINDOWS_PM_SCRIPTS[cmd[0]] ?? []).map((rel) => win32.join(dir, rel)).find((p) => hasFile(p));
|
|
1506
|
+
if (script) return [nodeExe, [script, ...cmd[1]]];
|
|
1507
|
+
const exe = win32.join(dir, `${cmd[0]}.exe`);
|
|
1508
|
+
if (hasFile(exe)) return [exe, cmd[1]];
|
|
1509
|
+
}
|
|
1510
|
+
return null;
|
|
1505
1511
|
}
|
|
1506
1512
|
function isMissingModuleFailure(message) {
|
|
1507
1513
|
return /ERR_MODULE_NOT_FOUND|Cannot find (package|module)/.test(message);
|
|
@@ -1613,7 +1619,7 @@ function registerWorkCommands(program) {
|
|
|
1613
1619
|
if (opts.repoDir || opts.report || opts.followups || opts.recheck) {
|
|
1614
1620
|
throw new MushiCliError("E_INVALID_INPUT", "--daemon takes its lanes and clones from the worker config, not from --repo-dir, --report or --followups.", "mushi worker install");
|
|
1615
1621
|
}
|
|
1616
|
-
const { runDaemon: runDaemon2 } = await import("./daemon-
|
|
1622
|
+
const { runDaemon: runDaemon2 } = await import("./daemon-FM6M7TKK.js");
|
|
1617
1623
|
await runDaemon2({ configPath: opts.workerConfig, ...opts.agent !== void 0 ? { agent } : {}, ...opts.anyRepo ? { anyRepo: true } : {} });
|
|
1618
1624
|
return;
|
|
1619
1625
|
}
|
|
@@ -2579,6 +2585,8 @@ function createDaemon(cfg, deps) {
|
|
|
2579
2585
|
host: { ...deps.host, takes: deps.freshEyes ? ["fresh_eyes"] : [], can: deps.cursorLogin ? ["cursor_login"] : [] },
|
|
2580
2586
|
status: {
|
|
2581
2587
|
state: hostState,
|
|
2588
|
+
// Which coding agent the lanes run, so the console names its account (not always Cursor).
|
|
2589
|
+
agent: deps.agent ?? "cursor",
|
|
2582
2590
|
agents: agents(),
|
|
2583
2591
|
...guards ? { maxAgents: guards.max_agents } : {},
|
|
2584
2592
|
...lastReadings?.memAvailableGb != null ? { memAvailableGb: lastReadings.memAvailableGb } : {},
|
|
@@ -3072,6 +3080,11 @@ function createHostReadings(o) {
|
|
|
3072
3080
|
}
|
|
3073
3081
|
};
|
|
3074
3082
|
}
|
|
3083
|
+
function stopHint(platform) {
|
|
3084
|
+
if (platform === "linux") return "Stop with Ctrl-C or systemctl --user stop mushi-worker.";
|
|
3085
|
+
if (platform === "win32") return "Stop with Ctrl-C, or end its node.exe in Task Manager; `mushi worker revoke` removes it.";
|
|
3086
|
+
return "Stop with Ctrl-C.";
|
|
3087
|
+
}
|
|
3075
3088
|
async function runDaemon(opts = {}) {
|
|
3076
3089
|
const cfg = loadWorkerConfig(opts.configPath);
|
|
3077
3090
|
const agent = opts.agent ?? cfg.agent ?? "cursor";
|
|
@@ -3161,7 +3174,7 @@ async function runDaemon(opts = {}) {
|
|
|
3161
3174
|
});
|
|
3162
3175
|
live.agents = daemon.agents;
|
|
3163
3176
|
onInterrupt((signal) => daemon.shutdown(signal));
|
|
3164
|
-
process.stdout.write(`mushi worker: ${cfg.lanes.length} lane(s) on ${platform}, agent ${agentSpec(agent).label} (${agentSpec(agent).bin}); heartbeat every ${HEARTBEAT_MS / 1e3} s.
|
|
3177
|
+
process.stdout.write(`mushi worker: ${cfg.lanes.length} lane(s) on ${platform}, agent ${agentSpec(agent).label} (${agentSpec(agent).bin}); heartbeat every ${HEARTBEAT_MS / 1e3} s. ${stopHint(process.platform)}
|
|
3165
3178
|
`);
|
|
3166
3179
|
while (!daemon.stopped) {
|
|
3167
3180
|
await daemon.tick().catch((err) => process.stdout.write(`worker: tick failed: ${err instanceof Error ? err.message : String(err)}
|
|
@@ -3208,6 +3221,7 @@ export {
|
|
|
3208
3221
|
assertWorkerKey,
|
|
3209
3222
|
cursorStateFor,
|
|
3210
3223
|
createHostReadings,
|
|
3224
|
+
stopHint,
|
|
3211
3225
|
runDaemon,
|
|
3212
3226
|
registerWorkCommands
|
|
3213
3227
|
};
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
resolveSdkEnvKey,
|
|
4
4
|
runConnect
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-KEMUVMO7.js";
|
|
6
6
|
import "./chunk-CG5KPP4S.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-4Z5MWQS5.js";
|
|
8
|
+
import "./chunk-UWPIVVCG.js";
|
|
9
9
|
import "./chunk-LGGE3LH7.js";
|
|
10
10
|
export {
|
|
11
11
|
resolveSdkEnvKey,
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
saveConfig,
|
|
7
7
|
savedSdkKeyFor,
|
|
8
8
|
waitForIngestReady
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3LHOI34N.js";
|
|
10
10
|
import {
|
|
11
11
|
MUSHI_MCP_PIN_SPEC
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-5DI4Q5BD.js";
|
|
13
13
|
import {
|
|
14
14
|
detectFramework,
|
|
15
15
|
envVarsToWrite,
|
|
@@ -10,10 +10,11 @@ import {
|
|
|
10
10
|
modelFor,
|
|
11
11
|
readWorkerKey,
|
|
12
12
|
runDaemon,
|
|
13
|
+
stopHint,
|
|
13
14
|
workerHostId
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-ZOBSRRD3.js";
|
|
16
|
+
import "./chunk-4Z5MWQS5.js";
|
|
17
|
+
import "./chunk-UWPIVVCG.js";
|
|
17
18
|
import "./chunk-LGGE3LH7.js";
|
|
18
19
|
export {
|
|
19
20
|
assertWorkerKey,
|
|
@@ -26,5 +27,6 @@ export {
|
|
|
26
27
|
modelFor,
|
|
27
28
|
readWorkerKey,
|
|
28
29
|
runDaemon,
|
|
30
|
+
stopHint,
|
|
29
31
|
workerHostId
|
|
30
32
|
};
|
package/dist/index.js
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
sanitizeEndpoint,
|
|
29
29
|
sanitizeProjectId,
|
|
30
30
|
writeMcpServerEntry
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-KEMUVMO7.js";
|
|
32
32
|
import {
|
|
33
33
|
FRAMEWORKS,
|
|
34
34
|
FRAMEWORK_IDS,
|
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
registerUxCommands,
|
|
60
60
|
registerWorkCommands,
|
|
61
61
|
validateWorkerConfig
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-ZOBSRRD3.js";
|
|
63
63
|
import {
|
|
64
64
|
CONFIG_PATH,
|
|
65
65
|
MushiCliError,
|
|
@@ -99,11 +99,11 @@ import {
|
|
|
99
99
|
tryLoadKeyFromKeychain,
|
|
100
100
|
trySaveKeyToKeychain,
|
|
101
101
|
trySaveWorkerKey
|
|
102
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-4Z5MWQS5.js";
|
|
103
103
|
import {
|
|
104
104
|
MUSHI_CLI_VERSION,
|
|
105
105
|
MUSHI_MCP_PIN_SPEC
|
|
106
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-UWPIVVCG.js";
|
|
107
107
|
import {
|
|
108
108
|
CLOUD_API_ENDPOINT,
|
|
109
109
|
CLOUD_MCP_OAUTH_URL,
|
|
@@ -529,10 +529,12 @@ function defaultProjectName(packageName, cwd) {
|
|
|
529
529
|
const parts = cwd.split(/[\\/]/).filter(Boolean);
|
|
530
530
|
return parts[parts.length - 1] || "my-app";
|
|
531
531
|
}
|
|
532
|
-
function chooseProjectNonInteractive(projects, preferredName) {
|
|
532
|
+
function chooseProjectNonInteractive(projects, preferredName, appFolder = true) {
|
|
533
533
|
const wanted = slugify(preferredName);
|
|
534
534
|
const match = projects.find((p5) => slugify(p5.name) === wanted || p5.slug !== void 0 && slugify(p5.slug) === wanted);
|
|
535
|
-
|
|
535
|
+
if (match) return { kind: "existing", id: match.id, name: match.name };
|
|
536
|
+
if (!appFolder && projects.length > 0) return { kind: "ask" };
|
|
537
|
+
return { kind: "new", name: preferredName };
|
|
536
538
|
}
|
|
537
539
|
async function runLogin(opts = {}) {
|
|
538
540
|
const { CLOUD_API_ENDPOINT: CLOUD_API_ENDPOINT2, resolveCloudEndpoint: resolveCloudEndpoint2 } = await import("./endpoint-MJATXOXM.js");
|
|
@@ -629,10 +631,24 @@ error: Could not start login session: ${err instanceof Error ? err.message : Str
|
|
|
629
631
|
} else {
|
|
630
632
|
const { readPackageJson: readPackageJson2 } = await import("./detect-SOXPECZ3.js");
|
|
631
633
|
const cwd = process.cwd();
|
|
634
|
+
const pkg = readPackageJson2(cwd);
|
|
635
|
+
const { existsSync: existsSync9 } = await import("fs");
|
|
636
|
+
const { join: join15 } = await import("path");
|
|
632
637
|
const nonInteractive = chooseProjectNonInteractive(
|
|
633
638
|
projectsList,
|
|
634
|
-
defaultProjectName(
|
|
639
|
+
defaultProjectName(pkg?.name, cwd),
|
|
640
|
+
Boolean(pkg) || existsSync9(join15(cwd, ".git"))
|
|
635
641
|
);
|
|
642
|
+
if (nonInteractive.kind === "ask") {
|
|
643
|
+
process.stderr.write(
|
|
644
|
+
`
|
|
645
|
+
error: This folder is not an app (no package.json or .git), so no project was picked or created.
|
|
646
|
+
Run it again from your app's folder, or name the project:
|
|
647
|
+
` + projectsList.map((p5) => ` mushi login --project-id ${p5.id} # ${p5.name}
|
|
648
|
+
`).join("")
|
|
649
|
+
);
|
|
650
|
+
process.exit(2);
|
|
651
|
+
}
|
|
636
652
|
choice = nonInteractive.kind === "existing" ? { kind: "picked", id: nonInteractive.id, name: nonInteractive.name } : { kind: "create", name: nonInteractive.name };
|
|
637
653
|
console.log(
|
|
638
654
|
choice.kind === "picked" ? ` Using project "${choice.name}" (matches this folder \u2014 pass --project-id to pick another).` : ` Creating project "${choice.name}" (no project matches this folder \u2014 pass --project-id to use an existing one).`
|
|
@@ -1623,7 +1639,7 @@ async function checkOnboardingStatus(config, _consoleBase, cwd, doFetch = global
|
|
|
1623
1639
|
}
|
|
1624
1640
|
async function checkVersionDrift(cwd, doFetch) {
|
|
1625
1641
|
const checks = [];
|
|
1626
|
-
const { MUSHI_CLI_VERSION: MUSHI_CLI_VERSION2 } = await import("./version-
|
|
1642
|
+
const { MUSHI_CLI_VERSION: MUSHI_CLI_VERSION2 } = await import("./version-XXSOPUQR.js");
|
|
1627
1643
|
if (MUSHI_CLI_VERSION2 === "0.0.0-dev") return checks;
|
|
1628
1644
|
const parse2 = (v) => {
|
|
1629
1645
|
const m = v.replace(/^[~^]/, "").match(/^(\d+)\.(\d+)\.(\d+)/);
|
|
@@ -2211,16 +2227,14 @@ async function runBrowserSignIn(options, endpoint, consoleBase, preset) {
|
|
|
2211
2227
|
}
|
|
2212
2228
|
if (!isInteractive()) {
|
|
2213
2229
|
const cwd = options.cwd ?? process.cwd();
|
|
2214
|
-
const
|
|
2215
|
-
|
|
2216
|
-
defaultProjectName(readPackageJson(cwd)?.name, cwd)
|
|
2217
|
-
);
|
|
2230
|
+
const name = defaultProjectName(readPackageJson(cwd)?.name, cwd);
|
|
2231
|
+
const choice = chooseProjectNonInteractive(projects, name);
|
|
2218
2232
|
if (choice.kind === "existing") {
|
|
2219
2233
|
p.log.info(`Using project "${choice.name}" (matches this app \u2014 pass --project-id to pick another).`);
|
|
2220
2234
|
target = { kind: "existing", projectId: choice.id };
|
|
2221
2235
|
} else {
|
|
2222
|
-
p.log.info(`Creating project "${
|
|
2223
|
-
target = { kind: "new", name
|
|
2236
|
+
p.log.info(`Creating project "${name}" (no project matches this app \u2014 pass --project-id to use an existing one).`);
|
|
2237
|
+
target = { kind: "new", name };
|
|
2224
2238
|
}
|
|
2225
2239
|
} else {
|
|
2226
2240
|
const NEW = "__new__";
|
|
@@ -2642,7 +2656,7 @@ async function maybeOfferConnect(credentials, options, _consoleBase) {
|
|
|
2642
2656
|
if (p.isCancel(answer) || !answer) return;
|
|
2643
2657
|
const endpoint = resolveCloudEndpoint(options.endpoint);
|
|
2644
2658
|
try {
|
|
2645
|
-
const { runConnect: runConnect2 } = await import("./connect-
|
|
2659
|
+
const { runConnect: runConnect2 } = await import("./connect-B2ZZPVWI.js");
|
|
2646
2660
|
const saved = loadConfig();
|
|
2647
2661
|
const result = await runConnect2(
|
|
2648
2662
|
{
|
|
@@ -7232,6 +7246,7 @@ import { createHmac, randomBytes } from "crypto";
|
|
|
7232
7246
|
import { existsSync as existsSync3, mkdtempSync, readFileSync as readFileSync3, rmSync, writeFileSync as writeFileSync2 } from "fs";
|
|
7233
7247
|
import { tmpdir } from "os";
|
|
7234
7248
|
import { dirname as dirname2, join as join5, resolve as resolve3 } from "path";
|
|
7249
|
+
import { pathToFileURL } from "url";
|
|
7235
7250
|
function supabaseCliVersion() {
|
|
7236
7251
|
try {
|
|
7237
7252
|
const r = spawnSync("supabase", ["--version"], { encoding: "utf8", timeout: 5e3 });
|
|
@@ -7323,6 +7338,7 @@ var SELFHOST_PLAN_SQL = [
|
|
|
7323
7338
|
""
|
|
7324
7339
|
].join("\n");
|
|
7325
7340
|
var CLOUD_PROJECT_REF = "dxptnwrhwsqckaftyymj";
|
|
7341
|
+
var SELF_HOST_DOCS = "https://kensaur.us/mushi-mushi/docs/self-hosting";
|
|
7326
7342
|
function buildSelfhostSteps(input, printOnly, internalToken, tmpDir) {
|
|
7327
7343
|
const steps = [];
|
|
7328
7344
|
const target = linkedTargetFlag(input.cliMajor);
|
|
@@ -7367,10 +7383,13 @@ function buildSelfhostSteps(input, printOnly, internalToken, tmpDir) {
|
|
|
7367
7383
|
}
|
|
7368
7384
|
steps.push({ label: "apply database migrations", args: ["db", "push", target], critical: true });
|
|
7369
7385
|
const token = printOnly ? "<YOUR_INTERNAL_CALLER_SECRET>" : internalToken;
|
|
7370
|
-
const secretLines = [`MUSHI_INTERNAL_CALLER_SECRET=${token}
|
|
7386
|
+
const secretLines = [`MUSHI_INTERNAL_CALLER_SECRET=${token}`, "MUSHI_INSTANCE_MODE=self-hosted"];
|
|
7371
7387
|
if (input.anthropicKey) secretLines.push(`ANTHROPIC_API_KEY=${printOnly ? "sk-ant-..." : input.anthropicKey}`);
|
|
7372
7388
|
if (input.openaiKey) secretLines.push(`OPENAI_API_KEY=${printOnly ? "sk-..." : input.openaiKey}`);
|
|
7373
|
-
if (input.consoleUrl)
|
|
7389
|
+
if (input.consoleUrl) {
|
|
7390
|
+
secretLines.push(`ADMIN_BASE_URL=${input.consoleUrl}`);
|
|
7391
|
+
secretLines.push(`MUSHI_ADMIN_ORIGIN_ALLOWLIST=${new URL(input.consoleUrl).origin}`);
|
|
7392
|
+
}
|
|
7374
7393
|
const secretsFile = join5(tmpDir, "mushi-secrets.env");
|
|
7375
7394
|
steps.push({
|
|
7376
7395
|
label: `set function secrets (${secretLines.map((l) => l.split("=")[0]).join(", ")})`,
|
|
@@ -7387,7 +7406,7 @@ function buildSelfhostSteps(input, printOnly, internalToken, tmpDir) {
|
|
|
7387
7406
|
files: [{ path: sqlFile, content: buildRuntimeConfigSql(input.supabaseUrl, token) }]
|
|
7388
7407
|
});
|
|
7389
7408
|
if (!input.skipDeploy) {
|
|
7390
|
-
steps.push({ label: "deploy every edge function", args: ["functions", "deploy"] });
|
|
7409
|
+
steps.push({ label: "deploy every edge function", args: ["functions", "deploy"], stampDeployInfo: true });
|
|
7391
7410
|
}
|
|
7392
7411
|
return { ok: true, steps };
|
|
7393
7412
|
}
|
|
@@ -7395,6 +7414,54 @@ function selfhostConfigPatch(existing, endpoint, consoleUrl2) {
|
|
|
7395
7414
|
if (existing.apiKey && existing.endpoint !== endpoint) return null;
|
|
7396
7415
|
return consoleUrl2 ? { endpoint, consoleUrl: consoleUrl2 } : { endpoint };
|
|
7397
7416
|
}
|
|
7417
|
+
var DEPLOY_INFO_PATH = join5("packages", "server", "supabase", "functions", "_shared", "deploy-info.ts");
|
|
7418
|
+
async function loadDeployStamper(root) {
|
|
7419
|
+
const script = join5(root, "scripts", "deploy-edge-function.mjs");
|
|
7420
|
+
if (!existsSync3(script)) return null;
|
|
7421
|
+
try {
|
|
7422
|
+
const mod = await import(pathToFileURL(script).href);
|
|
7423
|
+
return typeof mod.deployInfoSource === "function" && typeof mod.resolveDeploySha === "function" ? mod : null;
|
|
7424
|
+
} catch {
|
|
7425
|
+
return null;
|
|
7426
|
+
}
|
|
7427
|
+
}
|
|
7428
|
+
function stampDeployInfo(root, stamper, now = /* @__PURE__ */ new Date()) {
|
|
7429
|
+
const file = join5(root, DEPLOY_INFO_PATH);
|
|
7430
|
+
let original;
|
|
7431
|
+
try {
|
|
7432
|
+
original = readFileSync3(file, "utf8");
|
|
7433
|
+
} catch {
|
|
7434
|
+
return null;
|
|
7435
|
+
}
|
|
7436
|
+
const sha = stamper.resolveDeploySha(root);
|
|
7437
|
+
writeFileSync2(file, stamper.deployInfoSource(sha, now.toISOString()));
|
|
7438
|
+
let restored = false;
|
|
7439
|
+
return {
|
|
7440
|
+
sha,
|
|
7441
|
+
restore: () => {
|
|
7442
|
+
if (restored) return;
|
|
7443
|
+
restored = true;
|
|
7444
|
+
writeFileSync2(file, original);
|
|
7445
|
+
}
|
|
7446
|
+
};
|
|
7447
|
+
}
|
|
7448
|
+
function runStamped(step, root, stamper, run) {
|
|
7449
|
+
const stamp = step.stampDeployInfo && stamper ? stampDeployInfo(root, stamper) : null;
|
|
7450
|
+
if (!stamp) return run();
|
|
7451
|
+
const onSignal = () => {
|
|
7452
|
+
stamp.restore();
|
|
7453
|
+
process.exit(130);
|
|
7454
|
+
};
|
|
7455
|
+
process.once("SIGINT", onSignal);
|
|
7456
|
+
process.once("exit", stamp.restore);
|
|
7457
|
+
try {
|
|
7458
|
+
return run();
|
|
7459
|
+
} finally {
|
|
7460
|
+
stamp.restore();
|
|
7461
|
+
process.removeListener("SIGINT", onSignal);
|
|
7462
|
+
process.removeListener("exit", stamp.restore);
|
|
7463
|
+
}
|
|
7464
|
+
}
|
|
7398
7465
|
function readLinkedRef(supabaseDir) {
|
|
7399
7466
|
try {
|
|
7400
7467
|
const ref = readFileSync3(join5(supabaseDir, ".temp", "project-ref"), "utf8").trim();
|
|
@@ -7429,7 +7496,7 @@ function printNoLlmNote() {
|
|
|
7429
7496
|
console.log(" and get a rule-based category and severity. Without a key there is no");
|
|
7430
7497
|
console.log(" plain-English diagnosis, no fix drafts and no duplicate detection.");
|
|
7431
7498
|
console.log(" Add one later: supabase secrets set ANTHROPIC_API_KEY=\u2026 (or OPENAI_API_KEY=\u2026),");
|
|
7432
|
-
console.log(" or per
|
|
7499
|
+
console.log(" or per app in the console under Settings \u2192 AI keys.");
|
|
7433
7500
|
}
|
|
7434
7501
|
async function runSelfhostUp(opts) {
|
|
7435
7502
|
const root = resolve3(opts.cwd ?? ".");
|
|
@@ -7523,6 +7590,11 @@ async function runSelfhostUp(opts) {
|
|
|
7523
7590
|
console.log("# LLM key (optional): add ANTHROPIC_API_KEY=\u2026 or OPENAI_API_KEY=\u2026 to mushi-secrets.env");
|
|
7524
7591
|
console.log("");
|
|
7525
7592
|
}
|
|
7593
|
+
if (!opts.skipDeploy) {
|
|
7594
|
+
console.log("# A plain `supabase functions deploy` leaves _shared/deploy-info.ts unstamped, so");
|
|
7595
|
+
console.log('# /health reports version "dev". `mushi selfhost up` stamps the commit for you.');
|
|
7596
|
+
console.log("");
|
|
7597
|
+
}
|
|
7526
7598
|
console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
|
|
7527
7599
|
console.log("Then point the CLI at it and check it:");
|
|
7528
7600
|
console.log(` mushi config endpoint ${endpoint}`);
|
|
@@ -7549,9 +7621,13 @@ async function runSelfhostUp(opts) {
|
|
|
7549
7621
|
if (!llm.anthropicKey && !llm.openaiKey) printNoLlmNote();
|
|
7550
7622
|
console.log("");
|
|
7551
7623
|
const secrets = [internalToken, llm.anthropicKey ?? "", llm.openaiKey ?? ""];
|
|
7624
|
+
const stamper = built.steps.some((s) => s.stampDeployInfo) ? await loadDeployStamper(root) : null;
|
|
7625
|
+
if (!stamper && !opts.skipDeploy) {
|
|
7626
|
+
console.log(' This clone cannot stamp the deploy (no scripts/deploy-edge-function.mjs helpers): /health will report "dev".');
|
|
7627
|
+
}
|
|
7552
7628
|
let failed = false;
|
|
7553
7629
|
for (const step of built.steps) {
|
|
7554
|
-
const result = runSupabase(step, { cwd: serverDir, secrets });
|
|
7630
|
+
const result = runStamped(step, root, stamper, () => runSupabase(step, { cwd: serverDir, secrets }));
|
|
7555
7631
|
if (result.ok) continue;
|
|
7556
7632
|
process.stderr.write(` ${result.stderr.split("\n").slice(0, 3).join("\n ")}
|
|
7557
7633
|
`);
|
|
@@ -7579,6 +7655,8 @@ async function runSelfhostUp(opts) {
|
|
|
7579
7655
|
} else {
|
|
7580
7656
|
console.log(` OK /health ${probe.status} ${probe.latencyMs}ms`);
|
|
7581
7657
|
}
|
|
7658
|
+
const health = await serverHealthCheck(endpoint, fetch);
|
|
7659
|
+
for (const line of formatSelfhostCheck(health)) console.log(` ${line}`);
|
|
7582
7660
|
console.log("");
|
|
7583
7661
|
if (failed) {
|
|
7584
7662
|
console.log("Some steps failed (see above). Fix them and re-run, or deploy the rest by hand.");
|
|
@@ -7588,7 +7666,7 @@ async function runSelfhostUp(opts) {
|
|
|
7588
7666
|
console.log("");
|
|
7589
7667
|
console.log("Next steps:");
|
|
7590
7668
|
if (!consoleUrl2) {
|
|
7591
|
-
console.log(
|
|
7669
|
+
console.log(` 0. Serve the admin console (${SELF_HOST_DOCS}/admin-spa), then:`);
|
|
7592
7670
|
console.log(" mushi config consoleUrl <console url>");
|
|
7593
7671
|
console.log(" Without it, `mushi login` opens the Mushi Mushi Cloud console.");
|
|
7594
7672
|
}
|
|
@@ -7663,13 +7741,101 @@ function runSelfhostSecrets(opts) {
|
|
|
7663
7741
|
console.log(" MUSHI_INTERNAL_CALLER_SECRET");
|
|
7664
7742
|
console.log(" Optional: ANTHROPIC_API_KEY or OPENAI_API_KEY (edit the file)");
|
|
7665
7743
|
}
|
|
7744
|
+
function selfhostDoctorExitCode(checks) {
|
|
7745
|
+
if (checks.some((c) => c.status === "fail")) return 1;
|
|
7746
|
+
if (checks.some((c) => c.status === "warn")) return 2;
|
|
7747
|
+
return 0;
|
|
7748
|
+
}
|
|
7749
|
+
function isCloudEndpoint(endpoint) {
|
|
7750
|
+
return endpoint.includes(CLOUD_PROJECT_REF) || /^https:\/\/kensaur\.us\//.test(endpoint);
|
|
7751
|
+
}
|
|
7752
|
+
var HOSTED_CONSOLE = "https://kensaur.us/mushi-mushi/admin";
|
|
7753
|
+
async function consoleCheck(consoleUrl2, endpoint, doFetch) {
|
|
7754
|
+
if (isCloudEndpoint(endpoint)) return null;
|
|
7755
|
+
const base = { name: "console_reachable", label: "Console answers" };
|
|
7756
|
+
const url = consoleUrl2?.trim().replace(/\/+$/, "");
|
|
7757
|
+
if (!url) {
|
|
7758
|
+
return {
|
|
7759
|
+
...base,
|
|
7760
|
+
status: "info",
|
|
7761
|
+
summary: "No console address saved, so `mushi login` opens Mushi Mushi Cloud.",
|
|
7762
|
+
hint: "mushi config consoleUrl <your console url>"
|
|
7763
|
+
};
|
|
7764
|
+
}
|
|
7765
|
+
if (url.startsWith(HOSTED_CONSOLE)) {
|
|
7766
|
+
return {
|
|
7767
|
+
...base,
|
|
7768
|
+
status: "warn",
|
|
7769
|
+
summary: "The saved console is Mushi Mushi Cloud\u2019s, but the API is yours: `mushi login` would sign you in on Cloud.",
|
|
7770
|
+
hint: "mushi config consoleUrl <your console url>"
|
|
7771
|
+
};
|
|
7772
|
+
}
|
|
7773
|
+
try {
|
|
7774
|
+
const res = await doFetch(url, { signal: AbortSignal.timeout(8e3), redirect: "follow" });
|
|
7775
|
+
const type = res.headers.get("content-type") ?? "";
|
|
7776
|
+
if (res.ok && type.includes("text/html")) return { ...base, status: "pass", summary: `${url} answers (HTTP ${res.status}).` };
|
|
7777
|
+
return {
|
|
7778
|
+
...base,
|
|
7779
|
+
status: "warn",
|
|
7780
|
+
summary: `${url} returned HTTP ${res.status}${type ? ` (${type.split(";")[0]})` : ""}, not the console page.`,
|
|
7781
|
+
hint: `Serve apps/admin/dist there with an index.html fallback (${SELF_HOST_DOCS}/admin-spa).`
|
|
7782
|
+
};
|
|
7783
|
+
} catch (err) {
|
|
7784
|
+
return {
|
|
7785
|
+
...base,
|
|
7786
|
+
status: "warn",
|
|
7787
|
+
summary: `${url} did not answer: ${err instanceof Error ? err.message : String(err)}.`,
|
|
7788
|
+
hint: `Check the console is served at that address (${SELF_HOST_DOCS}/admin-spa).`
|
|
7789
|
+
};
|
|
7790
|
+
}
|
|
7791
|
+
}
|
|
7792
|
+
async function serverHealthCheck(endpoint, doFetch) {
|
|
7793
|
+
const base = { name: "server_deploy", label: "Server deploy" };
|
|
7794
|
+
try {
|
|
7795
|
+
const res = await doFetch(`${endpoint.replace(/\/+$/, "")}/health`, { signal: AbortSignal.timeout(8e3) });
|
|
7796
|
+
if (!res.ok) {
|
|
7797
|
+
return { ...base, status: "fail", summary: `/health returned HTTP ${res.status}.`, hint: "Check the `api` function deployed and its logs." };
|
|
7798
|
+
}
|
|
7799
|
+
const body = await res.json().catch(() => ({}));
|
|
7800
|
+
const version = typeof body.version === "string" ? body.version : null;
|
|
7801
|
+
if (body.mode === "hosted" && !isCloudEndpoint(endpoint)) {
|
|
7802
|
+
return {
|
|
7803
|
+
...base,
|
|
7804
|
+
status: "warn",
|
|
7805
|
+
summary: "The server says it is Mushi Mushi Cloud, so the console labels this instance wrongly.",
|
|
7806
|
+
hint: "supabase secrets set MUSHI_INSTANCE_MODE=self-hosted (selfhost up sets it)."
|
|
7807
|
+
};
|
|
7808
|
+
}
|
|
7809
|
+
if (!version || version === "dev" || version === "unknown") {
|
|
7810
|
+
return {
|
|
7811
|
+
...base,
|
|
7812
|
+
status: "info",
|
|
7813
|
+
summary: 'The deploy is not stamped with a commit (/health says "dev"), so you cannot tell which code runs.',
|
|
7814
|
+
hint: "Supabase: re-run `npx mushi-mushi selfhost up`; it stamps the commit. Compose builds are unstamped; compare the image with `git log -1`."
|
|
7815
|
+
};
|
|
7816
|
+
}
|
|
7817
|
+
return { ...base, status: "pass", summary: `Running commit ${version.slice(0, 7)}.` };
|
|
7818
|
+
} catch (err) {
|
|
7819
|
+
return {
|
|
7820
|
+
...base,
|
|
7821
|
+
status: "fail",
|
|
7822
|
+
summary: `/health did not answer: ${err instanceof Error ? err.message : String(err)}.`,
|
|
7823
|
+
hint: `Check that ${endpoint} is deployed and reachable.`
|
|
7824
|
+
};
|
|
7825
|
+
}
|
|
7826
|
+
}
|
|
7827
|
+
var TAG = { pass: "OK ", info: "INFO", warn: "WARN", fail: "FAIL" };
|
|
7828
|
+
function formatSelfhostCheck(check) {
|
|
7829
|
+
const title = `${check.label ?? check.name}${check.appName ? ` (${check.appName})` : ""}`;
|
|
7830
|
+
const lines = [`${TAG[check.status]} ${title}: ${check.summary}`];
|
|
7831
|
+
if (check.hint && check.status !== "pass") lines.push(` \u2192 ${check.hint}`);
|
|
7832
|
+
return lines;
|
|
7833
|
+
}
|
|
7666
7834
|
async function runSelfhostDoctor(opts) {
|
|
7667
7835
|
const config = loadConfig();
|
|
7668
|
-
const endpoint = opts.endpoint || config.endpoint;
|
|
7836
|
+
const endpoint = (opts.endpoint || config.endpoint)?.replace(/\/+$/, "");
|
|
7669
7837
|
if (!endpoint) {
|
|
7670
|
-
process.stderr.write(
|
|
7671
|
-
"error: endpoint required \u2014 pass --endpoint or run `mushi login` first.\n"
|
|
7672
|
-
);
|
|
7838
|
+
process.stderr.write("error: endpoint required \u2014 pass --endpoint or run `mushi login` first.\n");
|
|
7673
7839
|
process.exit(1);
|
|
7674
7840
|
}
|
|
7675
7841
|
let serverChecks = [];
|
|
@@ -7685,9 +7851,10 @@ async function runSelfhostDoctor(opts) {
|
|
|
7685
7851
|
serverChecks = [
|
|
7686
7852
|
{
|
|
7687
7853
|
name: "server_doctor",
|
|
7854
|
+
label: "Server doctor",
|
|
7688
7855
|
status: "fail",
|
|
7689
7856
|
summary: `/v1/admin/doctor returned HTTP ${res.status}`,
|
|
7690
|
-
hint:
|
|
7857
|
+
hint: res.status === 401 || res.status === 403 ? `Sign the CLI in to this server: mushi login --endpoint ${endpoint} (the key needs mcp:read).` : "Check the `api` function logs."
|
|
7691
7858
|
}
|
|
7692
7859
|
];
|
|
7693
7860
|
}
|
|
@@ -7695,28 +7862,28 @@ async function runSelfhostDoctor(opts) {
|
|
|
7695
7862
|
serverChecks = [
|
|
7696
7863
|
{
|
|
7697
7864
|
name: "server_doctor",
|
|
7865
|
+
label: "Server doctor",
|
|
7698
7866
|
status: "fail",
|
|
7699
7867
|
summary: `unreachable: ${err instanceof Error ? err.message : String(err)}`,
|
|
7700
7868
|
hint: `Check that ${endpoint} is deployed and reachable.`
|
|
7701
7869
|
}
|
|
7702
7870
|
];
|
|
7703
7871
|
}
|
|
7872
|
+
const [health, consoleLine] = await Promise.all([
|
|
7873
|
+
serverHealthCheck(endpoint, fetch),
|
|
7874
|
+
consoleCheck(opts.consoleUrl || config.consoleUrl, endpoint, fetch)
|
|
7875
|
+
]);
|
|
7876
|
+
const checks = [health, ...consoleLine ? [consoleLine] : [], ...serverChecks];
|
|
7877
|
+
const code = selfhostDoctorExitCode(checks);
|
|
7704
7878
|
if (opts.json) {
|
|
7705
|
-
|
|
7706
|
-
console.log(JSON.stringify({ status: overallStatus, checks: serverChecks }, null, 2));
|
|
7879
|
+
console.log(JSON.stringify({ status: code === 1 ? "fail" : code === 2 ? "warn" : "pass", checks }, null, 2));
|
|
7707
7880
|
} else {
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
console.log(
|
|
7711
|
-
if (check.hint && check.status !== "pass") {
|
|
7712
|
-
console.log(` \u2192 Fix: ${check.hint}`);
|
|
7713
|
-
}
|
|
7881
|
+
const rank = { fail: 0, warn: 1, info: 2, pass: 3 };
|
|
7882
|
+
for (const check of [...checks].sort((a, b) => rank[a.status] - rank[b.status])) {
|
|
7883
|
+
for (const line of formatSelfhostCheck(check)) console.log(line);
|
|
7714
7884
|
}
|
|
7715
7885
|
}
|
|
7716
|
-
|
|
7717
|
-
const hasWarn = serverChecks.some((c) => c.status === "warn");
|
|
7718
|
-
if (hasFailure) process.exit(1);
|
|
7719
|
-
if (hasWarn) process.exit(2);
|
|
7886
|
+
if (code !== 0) process.exit(code);
|
|
7720
7887
|
}
|
|
7721
7888
|
function registerSelfhostCommands(program2) {
|
|
7722
7889
|
const selfhost = program2.command("selfhost").description("Self-hosted deployment tools");
|
|
@@ -7753,10 +7920,10 @@ Examples:
|
|
|
7753
7920
|
).option(
|
|
7754
7921
|
"--endpoint <url>",
|
|
7755
7922
|
`Mushi API endpoint (default: from ${CONFIG_PATH})`
|
|
7756
|
-
).option("--json", "Machine-readable JSON output").addHelpText(
|
|
7923
|
+
).option("--console-url <url>", "Console address to check (default: consoleUrl from the CLI config)").option("--json", "Machine-readable JSON output").addHelpText(
|
|
7757
7924
|
"after",
|
|
7758
7925
|
`
|
|
7759
|
-
Exit codes: 0
|
|
7926
|
+
Exit codes: 0 healthy (INFO lines are optional extras) \xB7 2 warnings only \xB7 1 any hard failure
|
|
7760
7927
|
|
|
7761
7928
|
Examples:
|
|
7762
7929
|
mushi selfhost doctor
|
|
@@ -13990,7 +14157,7 @@ Verified merge. Docs: https://kensaur.us/mushi-mushi/docs/admin/verified-merge`)
|
|
|
13990
14157
|
}
|
|
13991
14158
|
|
|
13992
14159
|
// src/commands/worker.ts
|
|
13993
|
-
import { execFileSync as execFileSync4, spawnSync as spawnSync4 } from "child_process";
|
|
14160
|
+
import { execFileSync as execFileSync4, spawn as spawn2, spawnSync as spawnSync4 } from "child_process";
|
|
13994
14161
|
import { chmodSync as chmodSync2, existsSync as existsSync7, mkdirSync as mkdirSync4, readFileSync as readFileSync9, realpathSync as realpathSync2, rmSync as rmSync2, writeFileSync as writeFileSync8 } from "fs";
|
|
13995
14162
|
import { homedir, hostname } from "os";
|
|
13996
14163
|
import { dirname as dirname6, join as join13, resolve as resolve10 } from "path";
|
|
@@ -14098,9 +14265,32 @@ function windowsTaskArgs(o) {
|
|
|
14098
14265
|
const run = [o.node, o.cli, "work", "--daemon", ...o.configPath ? ["--worker-config", o.configPath] : []].map((a) => /\s/.test(a) ? `"${a}"` : a).join(" ");
|
|
14099
14266
|
return ["/Create", "/TN", WINDOWS_TASK_NAME, "/SC", "ONLOGON", "/RL", "LIMITED", "/F", "/TR", run];
|
|
14100
14267
|
}
|
|
14268
|
+
var WINDOWS_STARTUP_FILE = "Mushi worker.vbs";
|
|
14269
|
+
function windowsWorkerLogPath(home) {
|
|
14270
|
+
return join12(home, ".cache", "mushi-work", "logs", "worker.log");
|
|
14271
|
+
}
|
|
14272
|
+
function windowsStartupScript(o) {
|
|
14273
|
+
const run = [o.node, o.cli, "work", "--daemon", ...o.configPath ? ["--worker-config", o.configPath] : []].map((a) => `"${a}"`).join(" ");
|
|
14274
|
+
const line = `cmd /c "${run} >> "${o.log}" 2>&1"`;
|
|
14275
|
+
return `' Mushi local worker (mushi work --daemon), started hidden at logon.\r
|
|
14276
|
+
CreateObject("WScript.Shell").Run "${line.replace(/"/g, '""')}", 0, False\r
|
|
14277
|
+
`;
|
|
14278
|
+
}
|
|
14101
14279
|
|
|
14102
14280
|
// src/commands/worker.ts
|
|
14103
14281
|
var UNIT_PATH = join13(process.env["XDG_CONFIG_HOME"] || join13(homedir(), ".config"), "systemd", "user", SYSTEMD_UNIT_NAME);
|
|
14282
|
+
function windowsStartupPath() {
|
|
14283
|
+
return join13(process.env["APPDATA"] || join13(homedir(), "AppData", "Roaming"), "Microsoft", "Windows", "Start Menu", "Programs", "Startup", WINDOWS_STARTUP_FILE);
|
|
14284
|
+
}
|
|
14285
|
+
function installWindowsStartup(node, cli) {
|
|
14286
|
+
const log3 = windowsWorkerLogPath(homedir());
|
|
14287
|
+
const file = windowsStartupPath();
|
|
14288
|
+
mkdirSync4(dirname6(log3), { recursive: true });
|
|
14289
|
+
mkdirSync4(dirname6(file), { recursive: true });
|
|
14290
|
+
writeFileSync8(file, windowsStartupScript({ node, cli, log: log3 }));
|
|
14291
|
+
spawn2("wscript.exe", [file], { detached: true, stdio: "ignore", windowsHide: true }).unref();
|
|
14292
|
+
console.log(`The scheduled task needs administrator rights here, so the worker starts from your Startup folder instead (${file}). It is running now; its log is ${log3}.`);
|
|
14293
|
+
}
|
|
14104
14294
|
function laneDone(l) {
|
|
14105
14295
|
if (l.config.mode === "conflicts") return l.counts7d.merges ?? 0;
|
|
14106
14296
|
if (l.config.mode === "audit") return l.counts7d.filed ?? 0;
|
|
@@ -14223,7 +14413,8 @@ Service: not automated on ${platform}; run \`mushi work --daemon\` under your se
|
|
|
14223
14413
|
console.log(enable.status === 0 ? `Started ${SYSTEMD_UNIT_NAME}. Logs: journalctl --user -u ${SYSTEMD_UNIT_NAME} -f` : `Wrote ${UNIT_PATH}; start it with: systemctl --user enable --now ${SYSTEMD_UNIT_NAME}`);
|
|
14224
14414
|
} else if (service?.kind === "task") {
|
|
14225
14415
|
const r = spawnSync4("schtasks", service.args, { stdio: "inherit" });
|
|
14226
|
-
|
|
14416
|
+
if (r.status === 0) console.log(`Created the scheduled task "${WINDOWS_TASK_NAME}"; it starts at your next logon.`);
|
|
14417
|
+
else installWindowsStartup(node, cli0);
|
|
14227
14418
|
}
|
|
14228
14419
|
console.log("The console shows this worker on Pipeline \u2192 Workers within a minute of its first heartbeat.");
|
|
14229
14420
|
});
|
|
@@ -14242,7 +14433,7 @@ Service: not automated on ${platform}; run \`mushi work --daemon\` under your se
|
|
|
14242
14433
|
execFileSync4("schtasks", ["/Query", "/TN", WINDOWS_TASK_NAME], { stdio: "ignore" });
|
|
14243
14434
|
return "scheduled";
|
|
14244
14435
|
} catch {
|
|
14245
|
-
return "not installed";
|
|
14436
|
+
return existsSync7(windowsStartupPath()) ? "startup folder" : "not installed";
|
|
14246
14437
|
}
|
|
14247
14438
|
})() : "unknown";
|
|
14248
14439
|
const conf = requireConfig();
|
|
@@ -14318,7 +14509,10 @@ ${"lane".padEnd(16)} ${"app".padEnd(16)} ${"mode".padEnd(10)} ${"state".padEnd(1
|
|
|
14318
14509
|
tryDeleteWorkerKey();
|
|
14319
14510
|
if (existsSync7(WORKER_KEY_PATH)) rmSync2(WORKER_KEY_PATH);
|
|
14320
14511
|
if (process.platform === "linux") spawnSync4("systemctl", ["--user", "disable", "--now", SYSTEMD_UNIT_NAME], { stdio: "inherit" });
|
|
14321
|
-
if (process.platform === "win32")
|
|
14512
|
+
if (process.platform === "win32") {
|
|
14513
|
+
spawnSync4("schtasks", ["/Delete", "/TN", WINDOWS_TASK_NAME, "/F"], { stdio: "inherit" });
|
|
14514
|
+
if (existsSync7(windowsStartupPath())) rmSync2(windowsStartupPath());
|
|
14515
|
+
}
|
|
14322
14516
|
console.log(`Removed the key from this machine. The lanes file (${WORKER_CONFIG_PATH}) is kept; delete it if you do not need it.`);
|
|
14323
14517
|
});
|
|
14324
14518
|
}
|
package/dist/init.js
CHANGED
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
sampleBugSnippet,
|
|
14
14
|
sanitizeSecret,
|
|
15
15
|
snippetTarget
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-MNIFWCTR.js";
|
|
17
17
|
import "./chunk-LFP3NPZT.js";
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-3LHOI34N.js";
|
|
19
|
+
import "./chunk-5DI4Q5BD.js";
|
|
20
20
|
import "./chunk-AWASJDQI.js";
|
|
21
21
|
import "./chunk-2DMHQVRU.js";
|
|
22
22
|
export {
|
package/dist/version.d.ts
CHANGED
|
@@ -14,6 +14,6 @@ declare const MUSHI_CLI_VERSION: string;
|
|
|
14
14
|
* setup refreshes the pin. Synced to packages/mcp/package.json by
|
|
15
15
|
* `scripts/sync-mcp-pin.mjs` — never hand-edit the version.
|
|
16
16
|
*/
|
|
17
|
-
declare const MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.31.
|
|
17
|
+
declare const MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.31.7";
|
|
18
18
|
|
|
19
19
|
export { MUSHI_CLI_VERSION, MUSHI_MCP_PIN_SPEC };
|
package/dist/version.js
CHANGED
package/dist/wizard-bin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runInit
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MNIFWCTR.js";
|
|
4
4
|
import {
|
|
5
5
|
FLAGS_HELP,
|
|
6
6
|
UNKNOWN_COMMAND_EXIT,
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
scaffoldTemplate
|
|
12
12
|
} from "./chunk-4JF7C3MY.js";
|
|
13
13
|
import "./chunk-LFP3NPZT.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-3LHOI34N.js";
|
|
15
|
+
import "./chunk-5DI4Q5BD.js";
|
|
16
16
|
import "./chunk-AWASJDQI.js";
|
|
17
17
|
import "./chunk-2DMHQVRU.js";
|
|
18
18
|
|
package/package.json
CHANGED
package/dist/chunk-LWFREQOK.js
DELETED