@mushi-mushi/cli 0.39.0 → 0.40.1
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-UVAADP4O.js → chunk-3B7PXCRR.js} +12 -4
- package/dist/chunk-CP57NSIY.js +8 -0
- package/dist/{chunk-BG2TVTBN.js → chunk-KIWSPGQB.js} +1 -1
- package/dist/chunk-KQHEYAEK.js +10 -0
- package/dist/{chunk-OZPDPF6G.js → chunk-OVBRQDHI.js} +2 -2
- package/dist/{chunk-PPES6C4Y.js → chunk-QKO42UPX.js} +1 -1
- package/dist/chunk-RH5VBBIV.js +2279 -0
- package/dist/chunk-TNTSV54C.js +160 -0
- package/dist/{connect-RZV3PXP3.js → connect-LCTKRHV7.js} +3 -3
- package/dist/{connect-BCCGBCYR.js → connect-Q6LFT6QA.js} +2 -2
- package/dist/{daemon-ASMMT73O.js → daemon-JX6IG454.js} +5 -3
- package/dist/index.js +82 -39
- package/dist/init.js +11 -2269
- package/dist/{version-MGHYYC2T.js → version-T27RO74F.js} +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wizard-args.d.ts +35 -1
- package/dist/wizard-args.js +14 -95
- package/dist/wizard-bin.d.ts +32 -0
- package/dist/wizard-bin.js +106 -0
- package/package.json +8 -1
- package/templates/node/.env.example +4 -0
- package/templates/node/README.md +12 -0
- package/templates/node/gitignore +6 -0
- package/templates/node/package.json +15 -0
- package/templates/node/src/server.mjs +38 -0
- package/templates/svelte/.env.example +4 -0
- package/templates/svelte/README.md +10 -0
- package/templates/svelte/gitignore +6 -0
- package/templates/svelte/index.html +12 -0
- package/templates/svelte/package.json +20 -0
- package/templates/svelte/src/App.svelte +20 -0
- package/templates/svelte/src/main.ts +12 -0
- package/templates/svelte/vite.config.ts +6 -0
- package/templates/vue/.env.example +4 -0
- package/templates/vue/README.md +10 -0
- package/templates/vue/gitignore +6 -0
- package/templates/vue/index.html +12 -0
- package/templates/vue/package.json +20 -0
- package/templates/vue/src/App.vue +22 -0
- package/templates/vue/src/main.ts +12 -0
- package/templates/vue/vite.config.ts +6 -0
- package/dist/chunk-HQM2WZVF.js +0 -8
- package/dist/chunk-JQPLY3ZT.js +0 -10
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FRAMEWORK_IDS,
|
|
3
|
+
isFrameworkId
|
|
4
|
+
} from "./chunk-AWASJDQI.js";
|
|
5
|
+
|
|
6
|
+
// src/template.ts
|
|
7
|
+
import { cpSync, existsSync, renameSync } from "fs";
|
|
8
|
+
import { join, resolve } from "path";
|
|
9
|
+
import { fileURLToPath } from "url";
|
|
10
|
+
var TEMPLATE_IDS = ["vue", "svelte", "node"];
|
|
11
|
+
function isTemplateId(value) {
|
|
12
|
+
return typeof value === "string" && TEMPLATE_IDS.includes(value);
|
|
13
|
+
}
|
|
14
|
+
function templateDir(id) {
|
|
15
|
+
return fileURLToPath(new URL(`../templates/${id}`, import.meta.url));
|
|
16
|
+
}
|
|
17
|
+
function scaffoldTemplate(id, targetArg, cwd = process.cwd()) {
|
|
18
|
+
const relTarget = targetArg ?? `mushi-${id}-app`;
|
|
19
|
+
const targetDir = resolve(cwd, relTarget);
|
|
20
|
+
if (existsSync(targetDir)) {
|
|
21
|
+
throw new Error(`target directory already exists: ${targetDir}`);
|
|
22
|
+
}
|
|
23
|
+
cpSync(templateDir(id), targetDir, { recursive: true });
|
|
24
|
+
renameSync(join(targetDir, "gitignore"), join(targetDir, ".gitignore"));
|
|
25
|
+
return `Scaffolded the ${id} starter into ${targetDir}
|
|
26
|
+
|
|
27
|
+
Next steps:
|
|
28
|
+
cd "${relTarget}"
|
|
29
|
+
npm install
|
|
30
|
+
npx mushi-mushi # browser sign-in, writes your env vars
|
|
31
|
+
${id === "node" ? "npm start" : "npm run dev"}
|
|
32
|
+
`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// src/wizard-args.ts
|
|
36
|
+
var MIN_NODE_MAJOR = 20;
|
|
37
|
+
var WIZARD_PROBE_ENV = "MUSHI_WIZARD_PROBE";
|
|
38
|
+
var UNKNOWN_COMMAND_EXIT = 64;
|
|
39
|
+
function isUnknownTopLevelCommand(word, commands) {
|
|
40
|
+
if (word === void 0 || word.startsWith("-") || word === "help") return false;
|
|
41
|
+
return !commands.some((c) => c.name() === word || c.aliases().includes(word));
|
|
42
|
+
}
|
|
43
|
+
function newAppHint(word) {
|
|
44
|
+
return `To start a new app instead: npx mushi-mushi --template <${TEMPLATE_IDS.join("|")}> ${word}`;
|
|
45
|
+
}
|
|
46
|
+
var FLAGS_HELP = `Start a new app instead:
|
|
47
|
+
--template <id> [dir] scaffold a starter app (${TEMPLATE_IDS.join(", ")}) into [dir]
|
|
48
|
+
(default ./mushi-<id>-app) instead of running the wizard
|
|
49
|
+
|
|
50
|
+
Flags (forwarded to the wizard):
|
|
51
|
+
--project-id <uuid> skip the project ID prompt (UUID from the Projects page)
|
|
52
|
+
--api-key <key> skip the API key prompt with an ingest-only key (CI only \u2014 leaks into \`ps\`)
|
|
53
|
+
--framework <id> force a framework (${FRAMEWORK_IDS.join(", ")})
|
|
54
|
+
--skip-install print the install command instead of running it
|
|
55
|
+
--skip-test-report don't offer to send a test report at the end
|
|
56
|
+
--audit health-check an existing install (doctor checks) instead of re-running the wizard
|
|
57
|
+
--cwd <path> run in a different directory
|
|
58
|
+
--endpoint <url> override the Mushi API endpoint (self-hosted)
|
|
59
|
+
-y, --yes take the defaults: detected framework, saved credentials, browser sign-in
|
|
60
|
+
(required in non-interactive shells such as an AI agent's terminal, where
|
|
61
|
+
the sign-in URL is printed and the project is picked by the app's name)
|
|
62
|
+
-v, --version print the version and exit
|
|
63
|
+
-h, --help show this help
|
|
64
|
+
|
|
65
|
+
Requires Node.js ${MIN_NODE_MAJOR} or newer.
|
|
66
|
+
|
|
67
|
+
Docs: https://kensaur.us/mushi-mushi/docs/
|
|
68
|
+
Console: https://kensaur.us/mushi-mushi/`;
|
|
69
|
+
function parseArgs(argv) {
|
|
70
|
+
const args = argv[0] === "init" ? argv.slice(1) : argv;
|
|
71
|
+
const out = { showHelp: false, showVersion: false };
|
|
72
|
+
for (let i = 0; i < args.length; i++) {
|
|
73
|
+
const a = args[i];
|
|
74
|
+
if (a === "-h" || a === "--help") {
|
|
75
|
+
out.showHelp = true;
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (a === "-v" || a === "--version") {
|
|
79
|
+
out.showVersion = true;
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (a === "-y" || a === "--yes") {
|
|
83
|
+
out.yes = true;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (a === "--skip-install") {
|
|
87
|
+
out.skipInstall = true;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (a === "--skip-test-report") {
|
|
91
|
+
out.skipTestReport = true;
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (a === "--audit") {
|
|
95
|
+
out.audit = true;
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
if (a === "--project-id") {
|
|
99
|
+
out.projectId = args[++i];
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (a === "--api-key") {
|
|
103
|
+
out.apiKey = args[++i];
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (a === "--cwd") {
|
|
107
|
+
out.cwd = args[++i];
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
if (a === "--endpoint") {
|
|
111
|
+
out.endpoint = args[++i];
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (a === "--framework") {
|
|
115
|
+
const fw = args[++i];
|
|
116
|
+
if (!isFrameworkId(fw)) {
|
|
117
|
+
throw new Error(`Unknown framework: ${fw}. Valid: ${FRAMEWORK_IDS.join(", ")}`);
|
|
118
|
+
}
|
|
119
|
+
out.framework = fw;
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
if (a === "--template") {
|
|
123
|
+
const id = args[++i];
|
|
124
|
+
if (!isTemplateId(id)) {
|
|
125
|
+
throw new Error(`Unknown template: ${id ?? "(missing)"}. Valid: ${TEMPLATE_IDS.join(", ")}`);
|
|
126
|
+
}
|
|
127
|
+
out.template = id;
|
|
128
|
+
const next = args[i + 1];
|
|
129
|
+
if (next !== void 0 && !next.startsWith("-")) out.templateDir = args[++i];
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
if (a.startsWith("-")) {
|
|
133
|
+
throw new Error(`Unknown flag: ${a}. Try --help.`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return out;
|
|
137
|
+
}
|
|
138
|
+
function assertNodeVersion(binName) {
|
|
139
|
+
const major = Number(process.versions.node.split(".")[0]);
|
|
140
|
+
if (!Number.isFinite(major) || major < MIN_NODE_MAJOR) {
|
|
141
|
+
process.stderr.write(
|
|
142
|
+
`${binName} requires Node.js ${MIN_NODE_MAJOR} or newer. You are on ${process.versions.node}.
|
|
143
|
+
Upgrade Node (https://nodejs.org/) and try again.
|
|
144
|
+
`
|
|
145
|
+
);
|
|
146
|
+
process.exit(1);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export {
|
|
151
|
+
scaffoldTemplate,
|
|
152
|
+
MIN_NODE_MAJOR,
|
|
153
|
+
WIZARD_PROBE_ENV,
|
|
154
|
+
UNKNOWN_COMMAND_EXIT,
|
|
155
|
+
isUnknownTopLevelCommand,
|
|
156
|
+
newAppHint,
|
|
157
|
+
FLAGS_HELP,
|
|
158
|
+
parseArgs,
|
|
159
|
+
assertNodeVersion
|
|
160
|
+
};
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
resolveSdkEnvKey,
|
|
4
4
|
runConnect
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-OVBRQDHI.js";
|
|
6
6
|
import "./chunk-CG5KPP4S.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-QKO42UPX.js";
|
|
8
|
+
import "./chunk-KQHEYAEK.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-KIWSPGQB.js";
|
|
10
10
|
import {
|
|
11
11
|
MUSHI_MCP_PIN_SPEC
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-CP57NSIY.js";
|
|
13
13
|
import {
|
|
14
14
|
detectFramework,
|
|
15
15
|
envVarsToWrite,
|
|
@@ -4,21 +4,23 @@ import {
|
|
|
4
4
|
createDaemon,
|
|
5
5
|
createHostReadings,
|
|
6
6
|
cursorStateFor,
|
|
7
|
+
fairOrder,
|
|
7
8
|
infraBackoffMs,
|
|
8
9
|
machineFailed,
|
|
9
10
|
modelFor,
|
|
10
11
|
readWorkerKey,
|
|
11
12
|
runDaemon,
|
|
12
13
|
workerHostId
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-3B7PXCRR.js";
|
|
15
|
+
import "./chunk-QKO42UPX.js";
|
|
16
|
+
import "./chunk-KQHEYAEK.js";
|
|
16
17
|
import "./chunk-LGGE3LH7.js";
|
|
17
18
|
export {
|
|
18
19
|
assertWorkerKey,
|
|
19
20
|
createDaemon,
|
|
20
21
|
createHostReadings,
|
|
21
22
|
cursorStateFor,
|
|
23
|
+
fairOrder,
|
|
22
24
|
infraBackoffMs,
|
|
23
25
|
machineFailed,
|
|
24
26
|
modelFor,
|
package/dist/index.js
CHANGED
|
@@ -22,9 +22,10 @@ import {
|
|
|
22
22
|
sanitizeEndpoint,
|
|
23
23
|
sanitizeProjectId,
|
|
24
24
|
writeMcpServerEntry
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-OVBRQDHI.js";
|
|
26
26
|
import {
|
|
27
27
|
FRAMEWORKS,
|
|
28
|
+
FRAMEWORK_IDS,
|
|
28
29
|
detectFramework,
|
|
29
30
|
detectPackageManager,
|
|
30
31
|
envVarsToWrite,
|
|
@@ -52,7 +53,7 @@ import {
|
|
|
52
53
|
registerUxCommands,
|
|
53
54
|
registerWorkCommands,
|
|
54
55
|
validateWorkerConfig
|
|
55
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-3B7PXCRR.js";
|
|
56
57
|
import {
|
|
57
58
|
CONFIG_PATH,
|
|
58
59
|
MushiCliError,
|
|
@@ -91,11 +92,11 @@ import {
|
|
|
91
92
|
tryLoadKeyFromKeychain,
|
|
92
93
|
trySaveKeyToKeychain,
|
|
93
94
|
trySaveWorkerKey
|
|
94
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-QKO42UPX.js";
|
|
95
96
|
import {
|
|
96
97
|
MUSHI_CLI_VERSION,
|
|
97
98
|
MUSHI_MCP_PIN_SPEC
|
|
98
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-KQHEYAEK.js";
|
|
99
100
|
import {
|
|
100
101
|
CLOUD_API_ENDPOINT,
|
|
101
102
|
CLOUD_MCP_OAUTH_URL,
|
|
@@ -614,7 +615,7 @@ error: Could not start login session: ${err instanceof Error ? err.message : Str
|
|
|
614
615
|
if (process.stdin.isTTY) {
|
|
615
616
|
const { createInterface } = await import("readline");
|
|
616
617
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
617
|
-
const ask = (q2) => new Promise((
|
|
618
|
+
const ask = (q2) => new Promise((resolve11) => rl.question(q2, (a) => resolve11(a.trim())));
|
|
618
619
|
choice = await resolveProjectChoice(projectsList, ask);
|
|
619
620
|
rl.close();
|
|
620
621
|
} else {
|
|
@@ -974,9 +975,9 @@ async function checkCliAuthPath(config, doFetch = globalThis.fetch) {
|
|
|
974
975
|
async function checkSdkInstall(cwd) {
|
|
975
976
|
try {
|
|
976
977
|
const { readFile: readFile3 } = await import("fs/promises");
|
|
977
|
-
const { join:
|
|
978
|
-
const root =
|
|
979
|
-
const pkgPath =
|
|
978
|
+
const { join: join14, resolve: resolve11 } = await import("path");
|
|
979
|
+
const root = resolve11(cwd);
|
|
980
|
+
const pkgPath = join14(root, "package.json");
|
|
980
981
|
const pkg = JSON.parse(await readFile3(pkgPath, "utf8"));
|
|
981
982
|
const deps2 = { ...pkg.dependencies ?? {}, ...pkg.devDependencies ?? {} };
|
|
982
983
|
const sdks = [
|
|
@@ -1187,9 +1188,9 @@ async function checkHostAppWiring(cwd) {
|
|
|
1187
1188
|
const checks = [];
|
|
1188
1189
|
try {
|
|
1189
1190
|
const { readFile: readFile3, access } = await import("fs/promises");
|
|
1190
|
-
const { join:
|
|
1191
|
-
const root =
|
|
1192
|
-
const pkgPath =
|
|
1191
|
+
const { join: join14, resolve: resolve11 } = await import("path");
|
|
1192
|
+
const root = resolve11(cwd);
|
|
1193
|
+
const pkgPath = join14(root, "package.json");
|
|
1193
1194
|
const pkg = JSON.parse(await readFile3(pkgPath, "utf8"));
|
|
1194
1195
|
const deps2 = { ...pkg.dependencies ?? {}, ...pkg.devDependencies ?? {} };
|
|
1195
1196
|
const isCapHybrid = Boolean(deps2["@capacitor/core"] && deps2["react"]);
|
|
@@ -1197,7 +1198,7 @@ async function checkHostAppWiring(cwd) {
|
|
|
1197
1198
|
let envContent = "";
|
|
1198
1199
|
for (const f of envCandidates) {
|
|
1199
1200
|
try {
|
|
1200
|
-
envContent = await readFile3(
|
|
1201
|
+
envContent = await readFile3(join14(root, f), "utf8");
|
|
1201
1202
|
break;
|
|
1202
1203
|
} catch {
|
|
1203
1204
|
}
|
|
@@ -1212,9 +1213,9 @@ async function checkHostAppWiring(cwd) {
|
|
|
1212
1213
|
detail: hasProjectId && hasApiKey ? "VITE_/MUSHI_ project id + API key found" : "Run `mushi connect --write-env` or add VITE_MUSHI_PROJECT_ID + VITE_MUSHI_API_KEY"
|
|
1213
1214
|
});
|
|
1214
1215
|
let mcpFound = null;
|
|
1215
|
-
for (const rel of [".mcp.json",
|
|
1216
|
+
for (const rel of [".mcp.json", join14(".cursor", "mcp.json")]) {
|
|
1216
1217
|
try {
|
|
1217
|
-
await access(
|
|
1218
|
+
await access(join14(root, rel));
|
|
1218
1219
|
mcpFound = rel;
|
|
1219
1220
|
break;
|
|
1220
1221
|
} catch {
|
|
@@ -1258,7 +1259,7 @@ var HASH_ROUTER_PATTERNS = [
|
|
|
1258
1259
|
var HASH_TEMPLATE_PATTERN = /['"`]\/?#\//;
|
|
1259
1260
|
async function scanDirForPattern(dir, patterns, maxDepth = 6, maxFiles = 2e3) {
|
|
1260
1261
|
const { readdir: readdir2, readFile: readFile3 } = await import("fs/promises");
|
|
1261
|
-
const { join:
|
|
1262
|
+
const { join: join14 } = await import("path");
|
|
1262
1263
|
let count = 0;
|
|
1263
1264
|
async function walk2(d, depth) {
|
|
1264
1265
|
if (depth > maxDepth || count > maxFiles) return null;
|
|
@@ -1270,7 +1271,7 @@ async function scanDirForPattern(dir, patterns, maxDepth = 6, maxFiles = 2e3) {
|
|
|
1270
1271
|
}
|
|
1271
1272
|
for (const e of entries) {
|
|
1272
1273
|
if (e.name.startsWith(".") || e.name === "node_modules" || e.name === "dist") continue;
|
|
1273
|
-
const full =
|
|
1274
|
+
const full = join14(d, e.name);
|
|
1274
1275
|
if (e.isDirectory()) {
|
|
1275
1276
|
const found = await walk2(full, depth + 1);
|
|
1276
1277
|
if (found) return found;
|
|
@@ -1285,12 +1286,12 @@ async function scanDirForPattern(dir, patterns, maxDepth = 6, maxFiles = 2e3) {
|
|
|
1285
1286
|
}
|
|
1286
1287
|
return null;
|
|
1287
1288
|
}
|
|
1288
|
-
const { resolve:
|
|
1289
|
+
const { resolve: resolve11 } = await import("path");
|
|
1289
1290
|
for (const sub of ["src", "app", "pages", "lib", "components"]) {
|
|
1290
|
-
const found = await walk2(
|
|
1291
|
+
const found = await walk2(join14(resolve11(dir), sub), 0);
|
|
1291
1292
|
if (found) return found;
|
|
1292
1293
|
}
|
|
1293
|
-
return walk2(
|
|
1294
|
+
return walk2(resolve11(dir), 0);
|
|
1294
1295
|
}
|
|
1295
1296
|
async function checkHashRouterCapture(cwd) {
|
|
1296
1297
|
const hashFile = await scanDirForPattern(cwd, HASH_ROUTER_PATTERNS);
|
|
@@ -1323,13 +1324,13 @@ function normalizeProjectPath(path) {
|
|
|
1323
1324
|
}
|
|
1324
1325
|
async function collectMcpSources(root, home) {
|
|
1325
1326
|
const { readFile: readFile3 } = await import("fs/promises");
|
|
1326
|
-
const { join:
|
|
1327
|
+
const { join: join14 } = await import("path");
|
|
1327
1328
|
const sources = [];
|
|
1328
1329
|
const invalid = [];
|
|
1329
1330
|
const plainFiles = [
|
|
1330
|
-
{ path:
|
|
1331
|
-
{ path:
|
|
1332
|
-
{ path:
|
|
1331
|
+
{ path: join14(root, ".mcp.json"), claudeCode: true },
|
|
1332
|
+
{ path: join14(root, ".cursor", "mcp.json"), claudeCode: false },
|
|
1333
|
+
{ path: join14(home, ".cursor", "mcp.json"), claudeCode: false }
|
|
1333
1334
|
];
|
|
1334
1335
|
for (const file of plainFiles) {
|
|
1335
1336
|
let raw;
|
|
@@ -1346,7 +1347,7 @@ async function collectMcpSources(root, home) {
|
|
|
1346
1347
|
invalid.push(file.path);
|
|
1347
1348
|
}
|
|
1348
1349
|
}
|
|
1349
|
-
const claudeJsonPath =
|
|
1350
|
+
const claudeJsonPath = join14(home, ".claude.json");
|
|
1350
1351
|
try {
|
|
1351
1352
|
const parsed = JSON.parse(await readFile3(claudeJsonPath, "utf8"));
|
|
1352
1353
|
if (isJsonObject(parsed)) {
|
|
@@ -1417,9 +1418,9 @@ function assessMushiEntry(source, name, entry, cliKeySaved) {
|
|
|
1417
1418
|
}
|
|
1418
1419
|
async function checkMcpConfig(config, cwd, doFetch = globalThis.fetch, home) {
|
|
1419
1420
|
const checks = [];
|
|
1420
|
-
const { resolve:
|
|
1421
|
+
const { resolve: resolve11 } = await import("path");
|
|
1421
1422
|
const { homedir: homedir2 } = await import("os");
|
|
1422
|
-
const root =
|
|
1423
|
+
const root = resolve11(cwd);
|
|
1423
1424
|
const { sources, invalid } = await collectMcpSources(root, home ?? homedir2());
|
|
1424
1425
|
if (invalid.length > 0) {
|
|
1425
1426
|
checks.push({
|
|
@@ -1543,12 +1544,12 @@ async function checkOnboardingStatus(config, _consoleBase, cwd, doFetch = global
|
|
|
1543
1544
|
}
|
|
1544
1545
|
try {
|
|
1545
1546
|
const { readFile: readFile3 } = await import("fs/promises");
|
|
1546
|
-
const { join:
|
|
1547
|
-
const root =
|
|
1547
|
+
const { join: join14, resolve: resolve11 } = await import("path");
|
|
1548
|
+
const root = resolve11(cwd);
|
|
1548
1549
|
let envContent = "";
|
|
1549
1550
|
for (const f of [".env.local", ".env"]) {
|
|
1550
1551
|
try {
|
|
1551
|
-
envContent = await readFile3(
|
|
1552
|
+
envContent = await readFile3(join14(root, f), "utf8");
|
|
1552
1553
|
break;
|
|
1553
1554
|
} catch {
|
|
1554
1555
|
}
|
|
@@ -1614,7 +1615,7 @@ async function checkOnboardingStatus(config, _consoleBase, cwd, doFetch = global
|
|
|
1614
1615
|
}
|
|
1615
1616
|
async function checkVersionDrift(cwd, doFetch) {
|
|
1616
1617
|
const checks = [];
|
|
1617
|
-
const { MUSHI_CLI_VERSION: MUSHI_CLI_VERSION2 } = await import("./version-
|
|
1618
|
+
const { MUSHI_CLI_VERSION: MUSHI_CLI_VERSION2 } = await import("./version-T27RO74F.js");
|
|
1618
1619
|
if (MUSHI_CLI_VERSION2 === "0.0.0-dev") return checks;
|
|
1619
1620
|
const parse2 = (v) => {
|
|
1620
1621
|
const m = v.replace(/^[~^]/, "").match(/^(\d+)\.(\d+)\.(\d+)/);
|
|
@@ -1644,8 +1645,8 @@ async function checkVersionDrift(cwd, doFetch) {
|
|
|
1644
1645
|
}
|
|
1645
1646
|
try {
|
|
1646
1647
|
const { readFile: readFile3 } = await import("fs/promises");
|
|
1647
|
-
const { join:
|
|
1648
|
-
const pkg = JSON.parse(await readFile3(
|
|
1648
|
+
const { join: join14 } = await import("path");
|
|
1649
|
+
const pkg = JSON.parse(await readFile3(join14(cwd, "package.json"), "utf8"));
|
|
1649
1650
|
const deps2 = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
1650
1651
|
const candidates = Object.entries(deps2).filter(([name, spec]) => isMushiSdkPackage(name) && !isLauncherOnly(name, spec)).filter(([, v]) => /^[~^]?\d/.test(v));
|
|
1651
1652
|
const drifted = (await Promise.all(
|
|
@@ -2403,7 +2404,7 @@ async function installPackages(pm, packages, cwd) {
|
|
|
2403
2404
|
function runCommand(pm, packages, cwd) {
|
|
2404
2405
|
const verb = pm === "npm" ? "install" : "add";
|
|
2405
2406
|
const command = process.platform === "win32" ? `${pm}.cmd` : pm;
|
|
2406
|
-
return new Promise((
|
|
2407
|
+
return new Promise((resolve11, reject) => {
|
|
2407
2408
|
const child = spawn(command, [verb, ...packages], {
|
|
2408
2409
|
stdio: "inherit",
|
|
2409
2410
|
shell: false,
|
|
@@ -2412,7 +2413,7 @@ function runCommand(pm, packages, cwd) {
|
|
|
2412
2413
|
});
|
|
2413
2414
|
child.on("error", reject);
|
|
2414
2415
|
child.on("exit", (code) => {
|
|
2415
|
-
if (code === 0)
|
|
2416
|
+
if (code === 0) resolve11();
|
|
2416
2417
|
else reject(new Error(`${pm} exited with code ${code ?? "null"}`));
|
|
2417
2418
|
});
|
|
2418
2419
|
});
|
|
@@ -2587,7 +2588,7 @@ async function maybeOfferConnect(credentials, options, _consoleBase) {
|
|
|
2587
2588
|
if (p.isCancel(answer) || !answer) return;
|
|
2588
2589
|
const endpoint = resolveCloudEndpoint(options.endpoint);
|
|
2589
2590
|
try {
|
|
2590
|
-
const { runConnect: runConnect2 } = await import("./connect-
|
|
2591
|
+
const { runConnect: runConnect2 } = await import("./connect-LCTKRHV7.js");
|
|
2591
2592
|
const saved = loadConfig();
|
|
2592
2593
|
const result = await runConnect2(
|
|
2593
2594
|
{
|
|
@@ -3626,11 +3627,11 @@ async function findMapFiles(dir) {
|
|
|
3626
3627
|
return results;
|
|
3627
3628
|
}
|
|
3628
3629
|
function fileHash(path) {
|
|
3629
|
-
return new Promise((
|
|
3630
|
+
return new Promise((resolve11, reject) => {
|
|
3630
3631
|
const hash = createHash("sha256");
|
|
3631
3632
|
const stream = createReadStream(path);
|
|
3632
3633
|
stream.on("data", (chunk) => hash.update(chunk));
|
|
3633
|
-
stream.on("end", () =>
|
|
3634
|
+
stream.on("end", () => resolve11(hash.digest("hex")));
|
|
3634
3635
|
stream.on("error", reject);
|
|
3635
3636
|
});
|
|
3636
3637
|
}
|
|
@@ -4017,7 +4018,7 @@ error: Could not start browser sign-in: ${err instanceof Error ? err.message : S
|
|
|
4017
4018
|
const projectsList = await listProjects(endpoint, cliToken);
|
|
4018
4019
|
const { createInterface } = await import("readline");
|
|
4019
4020
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
4020
|
-
const ask = (q2) => new Promise((
|
|
4021
|
+
const ask = (q2) => new Promise((resolve11) => rl.question(q2, (a) => resolve11(a.trim())));
|
|
4021
4022
|
let chosen;
|
|
4022
4023
|
let projectId2;
|
|
4023
4024
|
let projectName;
|
|
@@ -4446,7 +4447,7 @@ If you are not signed in yet, setup runs browser sign-in first, then writes the
|
|
|
4446
4447
|
const { createInterface } = await import("readline");
|
|
4447
4448
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
4448
4449
|
const answer = await new Promise(
|
|
4449
|
-
(
|
|
4450
|
+
(resolve11) => rl.question(" Upgrade this key now via browser sign-in? [Y/n] ", (a) => resolve11(a.trim().toLowerCase()))
|
|
4450
4451
|
);
|
|
4451
4452
|
rl.close();
|
|
4452
4453
|
if (answer === "" || answer === "y" || answer === "yes") {
|
|
@@ -13886,6 +13887,44 @@ ${"lane".padEnd(16)} ${"app".padEnd(16)} ${"mode".padEnd(10)} ${"state".padEnd(1
|
|
|
13886
13887
|
});
|
|
13887
13888
|
}
|
|
13888
13889
|
|
|
13890
|
+
// src/template.ts
|
|
13891
|
+
import { cpSync, existsSync as existsSync7, renameSync } from "fs";
|
|
13892
|
+
import { join as join13, resolve as resolve10 } from "path";
|
|
13893
|
+
import { fileURLToPath } from "url";
|
|
13894
|
+
var TEMPLATE_IDS = ["vue", "svelte", "node"];
|
|
13895
|
+
|
|
13896
|
+
// src/wizard-args.ts
|
|
13897
|
+
var MIN_NODE_MAJOR = 20;
|
|
13898
|
+
var WIZARD_PROBE_ENV = "MUSHI_WIZARD_PROBE";
|
|
13899
|
+
var UNKNOWN_COMMAND_EXIT = 64;
|
|
13900
|
+
function isUnknownTopLevelCommand(word, commands) {
|
|
13901
|
+
if (word === void 0 || word.startsWith("-") || word === "help") return false;
|
|
13902
|
+
return !commands.some((c) => c.name() === word || c.aliases().includes(word));
|
|
13903
|
+
}
|
|
13904
|
+
var FLAGS_HELP = `Start a new app instead:
|
|
13905
|
+
--template <id> [dir] scaffold a starter app (${TEMPLATE_IDS.join(", ")}) into [dir]
|
|
13906
|
+
(default ./mushi-<id>-app) instead of running the wizard
|
|
13907
|
+
|
|
13908
|
+
Flags (forwarded to the wizard):
|
|
13909
|
+
--project-id <uuid> skip the project ID prompt (UUID from the Projects page)
|
|
13910
|
+
--api-key <key> skip the API key prompt with an ingest-only key (CI only \u2014 leaks into \`ps\`)
|
|
13911
|
+
--framework <id> force a framework (${FRAMEWORK_IDS.join(", ")})
|
|
13912
|
+
--skip-install print the install command instead of running it
|
|
13913
|
+
--skip-test-report don't offer to send a test report at the end
|
|
13914
|
+
--audit health-check an existing install (doctor checks) instead of re-running the wizard
|
|
13915
|
+
--cwd <path> run in a different directory
|
|
13916
|
+
--endpoint <url> override the Mushi API endpoint (self-hosted)
|
|
13917
|
+
-y, --yes take the defaults: detected framework, saved credentials, browser sign-in
|
|
13918
|
+
(required in non-interactive shells such as an AI agent's terminal, where
|
|
13919
|
+
the sign-in URL is printed and the project is picked by the app's name)
|
|
13920
|
+
-v, --version print the version and exit
|
|
13921
|
+
-h, --help show this help
|
|
13922
|
+
|
|
13923
|
+
Requires Node.js ${MIN_NODE_MAJOR} or newer.
|
|
13924
|
+
|
|
13925
|
+
Docs: https://kensaur.us/mushi-mushi/docs/
|
|
13926
|
+
Console: https://kensaur.us/mushi-mushi/`;
|
|
13927
|
+
|
|
13889
13928
|
// src/index.ts
|
|
13890
13929
|
installSignalHandlers();
|
|
13891
13930
|
var program = new Command().name("mushi").description("Mushi CLI \u2014 set up the SDK, triage a report, fix from your editor").version(MUSHI_CLI_VERSION).option("--profile <name>", "Use a named credential profile for this invocation (or set MUSHI_PROFILE)").option("-o, --output <format>", "Output format: text | json", "text").hook("preAction", (_thisCommand, actionCommand) => {
|
|
@@ -13957,6 +13996,10 @@ registerVerifyCommands(program);
|
|
|
13957
13996
|
registerWorkCommands(program);
|
|
13958
13997
|
registerWorkerCommands(program);
|
|
13959
13998
|
registerCompletionCommand(program);
|
|
13999
|
+
if (process.env[WIZARD_PROBE_ENV] === "1") {
|
|
14000
|
+
delete process.env[WIZARD_PROBE_ENV];
|
|
14001
|
+
if (isUnknownTopLevelCommand(process.argv[2], program.commands)) process.exit(UNKNOWN_COMMAND_EXIT);
|
|
14002
|
+
}
|
|
13960
14003
|
program.parseAsync().catch((err) => {
|
|
13961
14004
|
printAndExit(err);
|
|
13962
14005
|
});
|