@mushi-mushi/cli 0.38.0 → 0.40.0
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-AIZRI665.js → chunk-AWASJDQI.js} +62 -33
- package/dist/{chunk-KOBEOGNF.js → chunk-CG5KPP4S.js} +62 -33
- package/dist/chunk-CNJIN4ST.js +10 -0
- package/dist/{chunk-QZMSGTVZ.js → chunk-ETFORW35.js} +1 -1
- package/dist/chunk-FA5LABKE.js +2279 -0
- package/dist/chunk-JWG2QI3W.js +8 -0
- package/dist/{chunk-JXAH3XKH.js → chunk-PGLH5XP2.js} +3 -3
- package/dist/chunk-TNTSV54C.js +160 -0
- package/dist/{chunk-V3DR4WLG.js → chunk-UV4DMSQH.js} +1 -1
- package/dist/{chunk-BUCMB4NS.js → chunk-WXICRZIU.js} +4 -4
- package/dist/{connect-M2IGP63E.js → connect-BSMHOKUQ.js} +4 -4
- package/dist/{connect-OTHJSNHC.js → connect-NKWXYGN7.js} +4 -4
- package/dist/{daemon-VYXTQ5TG.js → daemon-6SCU35YF.js} +3 -3
- package/dist/{detect-WZT5X6LP.js → detect-SOXPECZ3.js} +5 -1
- package/dist/detect.d.ts +17 -1
- package/dist/detect.js +5 -1
- package/dist/index.js +130 -62
- package/dist/init.js +11 -2264
- package/dist/{snippet-inject-NDAPEL2T.js → snippet-inject-AVGVHTUJ.js} +3 -2
- package/dist/{snippet-inject-LPRWTQDE.js → snippet-inject-ETGBPDYB.js} +3 -2
- package/dist/{version-ULUVAZ3V.js → version-SLVFYTAI.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-DJNAPA4D.js +0 -10
- package/dist/chunk-M5LN4ZWQ.js +0 -8
package/dist/index.js
CHANGED
|
@@ -22,15 +22,18 @@ import {
|
|
|
22
22
|
sanitizeEndpoint,
|
|
23
23
|
sanitizeProjectId,
|
|
24
24
|
writeMcpServerEntry
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-WXICRZIU.js";
|
|
26
26
|
import {
|
|
27
27
|
FRAMEWORKS,
|
|
28
|
+
FRAMEWORK_IDS,
|
|
28
29
|
detectFramework,
|
|
29
30
|
detectPackageManager,
|
|
30
31
|
envVarsToWrite,
|
|
31
32
|
installCommand,
|
|
33
|
+
isLauncherOnly,
|
|
34
|
+
isMushiSdkPackage,
|
|
32
35
|
readPackageJson
|
|
33
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-CG5KPP4S.js";
|
|
34
37
|
import {
|
|
35
38
|
LANE_NAME_RE,
|
|
36
39
|
MODEL_RE,
|
|
@@ -50,7 +53,7 @@ import {
|
|
|
50
53
|
registerUxCommands,
|
|
51
54
|
registerWorkCommands,
|
|
52
55
|
validateWorkerConfig
|
|
53
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-PGLH5XP2.js";
|
|
54
57
|
import {
|
|
55
58
|
CONFIG_PATH,
|
|
56
59
|
MushiCliError,
|
|
@@ -89,11 +92,11 @@ import {
|
|
|
89
92
|
tryLoadKeyFromKeychain,
|
|
90
93
|
trySaveKeyToKeychain,
|
|
91
94
|
trySaveWorkerKey
|
|
92
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-ETFORW35.js";
|
|
93
96
|
import {
|
|
94
97
|
MUSHI_CLI_VERSION,
|
|
95
98
|
MUSHI_MCP_PIN_SPEC
|
|
96
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-CNJIN4ST.js";
|
|
97
100
|
import {
|
|
98
101
|
CLOUD_API_ENDPOINT,
|
|
99
102
|
CLOUD_MCP_OAUTH_URL,
|
|
@@ -612,11 +615,11 @@ error: Could not start login session: ${err instanceof Error ? err.message : Str
|
|
|
612
615
|
if (process.stdin.isTTY) {
|
|
613
616
|
const { createInterface } = await import("readline");
|
|
614
617
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
615
|
-
const ask = (q2) => new Promise((
|
|
618
|
+
const ask = (q2) => new Promise((resolve11) => rl.question(q2, (a) => resolve11(a.trim())));
|
|
616
619
|
choice = await resolveProjectChoice(projectsList, ask);
|
|
617
620
|
rl.close();
|
|
618
621
|
} else {
|
|
619
|
-
const { readPackageJson: readPackageJson2 } = await import("./detect-
|
|
622
|
+
const { readPackageJson: readPackageJson2 } = await import("./detect-SOXPECZ3.js");
|
|
620
623
|
const cwd = process.cwd();
|
|
621
624
|
const nonInteractive = chooseProjectNonInteractive(
|
|
622
625
|
projectsList,
|
|
@@ -972,12 +975,13 @@ async function checkCliAuthPath(config, doFetch = globalThis.fetch) {
|
|
|
972
975
|
async function checkSdkInstall(cwd) {
|
|
973
976
|
try {
|
|
974
977
|
const { readFile: readFile3 } = await import("fs/promises");
|
|
975
|
-
const { join:
|
|
976
|
-
const root =
|
|
977
|
-
const pkgPath =
|
|
978
|
+
const { join: join14, resolve: resolve11 } = await import("path");
|
|
979
|
+
const root = resolve11(cwd);
|
|
980
|
+
const pkgPath = join14(root, "package.json");
|
|
978
981
|
const pkg = JSON.parse(await readFile3(pkgPath, "utf8"));
|
|
979
982
|
const deps2 = { ...pkg.dependencies ?? {}, ...pkg.devDependencies ?? {} };
|
|
980
983
|
const sdks = [
|
|
984
|
+
"mushi-mushi",
|
|
981
985
|
"@mushi-mushi/react",
|
|
982
986
|
"@mushi-mushi/web",
|
|
983
987
|
"@mushi-mushi/core",
|
|
@@ -988,11 +992,11 @@ async function checkSdkInstall(cwd) {
|
|
|
988
992
|
"@mushi-mushi/capacitor",
|
|
989
993
|
"@mushi-mushi/node"
|
|
990
994
|
];
|
|
991
|
-
const installed = sdks.filter((s) => deps2[s]);
|
|
995
|
+
const installed = sdks.filter((s) => deps2[s] && !isLauncherOnly(s, deps2[s]));
|
|
992
996
|
return {
|
|
993
997
|
name: "SDK installed in this repo",
|
|
994
998
|
ok: installed.length > 0,
|
|
995
|
-
detail: installed.length > 0 ? installed.map((s) => `${s}@${deps2[s]}`).join(", ") : "No
|
|
999
|
+
detail: installed.length > 0 ? installed.map((s) => `${s}@${deps2[s]}`).join(", ") : "No Mushi Mushi SDK (mushi-mushi) in package.json \u2014 run `npx mushi-mushi` to install"
|
|
996
1000
|
};
|
|
997
1001
|
} catch {
|
|
998
1002
|
return null;
|
|
@@ -1184,9 +1188,9 @@ async function checkHostAppWiring(cwd) {
|
|
|
1184
1188
|
const checks = [];
|
|
1185
1189
|
try {
|
|
1186
1190
|
const { readFile: readFile3, access } = await import("fs/promises");
|
|
1187
|
-
const { join:
|
|
1188
|
-
const root =
|
|
1189
|
-
const pkgPath =
|
|
1191
|
+
const { join: join14, resolve: resolve11 } = await import("path");
|
|
1192
|
+
const root = resolve11(cwd);
|
|
1193
|
+
const pkgPath = join14(root, "package.json");
|
|
1190
1194
|
const pkg = JSON.parse(await readFile3(pkgPath, "utf8"));
|
|
1191
1195
|
const deps2 = { ...pkg.dependencies ?? {}, ...pkg.devDependencies ?? {} };
|
|
1192
1196
|
const isCapHybrid = Boolean(deps2["@capacitor/core"] && deps2["react"]);
|
|
@@ -1194,7 +1198,7 @@ async function checkHostAppWiring(cwd) {
|
|
|
1194
1198
|
let envContent = "";
|
|
1195
1199
|
for (const f of envCandidates) {
|
|
1196
1200
|
try {
|
|
1197
|
-
envContent = await readFile3(
|
|
1201
|
+
envContent = await readFile3(join14(root, f), "utf8");
|
|
1198
1202
|
break;
|
|
1199
1203
|
} catch {
|
|
1200
1204
|
}
|
|
@@ -1209,9 +1213,9 @@ async function checkHostAppWiring(cwd) {
|
|
|
1209
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"
|
|
1210
1214
|
});
|
|
1211
1215
|
let mcpFound = null;
|
|
1212
|
-
for (const rel of [".mcp.json",
|
|
1216
|
+
for (const rel of [".mcp.json", join14(".cursor", "mcp.json")]) {
|
|
1213
1217
|
try {
|
|
1214
|
-
await access(
|
|
1218
|
+
await access(join14(root, rel));
|
|
1215
1219
|
mcpFound = rel;
|
|
1216
1220
|
break;
|
|
1217
1221
|
} catch {
|
|
@@ -1223,11 +1227,13 @@ async function checkHostAppWiring(cwd) {
|
|
|
1223
1227
|
detail: mcpFound ? `${mcpFound} present` : "No .mcp.json (Claude Code) or .cursor/mcp.json (Cursor) \u2014 run `npx mushi-mushi setup --ide claude` or `--ide cursor` for two-way reporter replies"
|
|
1224
1228
|
});
|
|
1225
1229
|
if (isCapHybrid) {
|
|
1226
|
-
const hasWebSdk = Boolean(
|
|
1230
|
+
const hasWebSdk = Boolean(
|
|
1231
|
+
deps2["mushi-mushi"] && !isLauncherOnly("mushi-mushi", deps2["mushi-mushi"]) || deps2["@mushi-mushi/web"] || deps2["@mushi-mushi/react"]
|
|
1232
|
+
);
|
|
1227
1233
|
checks.push({
|
|
1228
1234
|
name: "[host] Capacitor hybrid \u2014 WebView SDK",
|
|
1229
1235
|
ok: hasWebSdk,
|
|
1230
|
-
detail: hasWebSdk ? "Use
|
|
1236
|
+
detail: hasWebSdk ? "Use mushi-mushi (or mushi-mushi/react) in the WebView (initMushi in main.tsx)" : "Install mushi-mushi for Capacitor WebView reporting"
|
|
1231
1237
|
});
|
|
1232
1238
|
checks.push({
|
|
1233
1239
|
name: "[host] Capacitor native plugin (optional)",
|
|
@@ -1253,7 +1259,7 @@ var HASH_ROUTER_PATTERNS = [
|
|
|
1253
1259
|
var HASH_TEMPLATE_PATTERN = /['"`]\/?#\//;
|
|
1254
1260
|
async function scanDirForPattern(dir, patterns, maxDepth = 6, maxFiles = 2e3) {
|
|
1255
1261
|
const { readdir: readdir2, readFile: readFile3 } = await import("fs/promises");
|
|
1256
|
-
const { join:
|
|
1262
|
+
const { join: join14 } = await import("path");
|
|
1257
1263
|
let count = 0;
|
|
1258
1264
|
async function walk2(d, depth) {
|
|
1259
1265
|
if (depth > maxDepth || count > maxFiles) return null;
|
|
@@ -1265,7 +1271,7 @@ async function scanDirForPattern(dir, patterns, maxDepth = 6, maxFiles = 2e3) {
|
|
|
1265
1271
|
}
|
|
1266
1272
|
for (const e of entries) {
|
|
1267
1273
|
if (e.name.startsWith(".") || e.name === "node_modules" || e.name === "dist") continue;
|
|
1268
|
-
const full =
|
|
1274
|
+
const full = join14(d, e.name);
|
|
1269
1275
|
if (e.isDirectory()) {
|
|
1270
1276
|
const found = await walk2(full, depth + 1);
|
|
1271
1277
|
if (found) return found;
|
|
@@ -1280,12 +1286,12 @@ async function scanDirForPattern(dir, patterns, maxDepth = 6, maxFiles = 2e3) {
|
|
|
1280
1286
|
}
|
|
1281
1287
|
return null;
|
|
1282
1288
|
}
|
|
1283
|
-
const { resolve:
|
|
1289
|
+
const { resolve: resolve11 } = await import("path");
|
|
1284
1290
|
for (const sub of ["src", "app", "pages", "lib", "components"]) {
|
|
1285
|
-
const found = await walk2(
|
|
1291
|
+
const found = await walk2(join14(resolve11(dir), sub), 0);
|
|
1286
1292
|
if (found) return found;
|
|
1287
1293
|
}
|
|
1288
|
-
return walk2(
|
|
1294
|
+
return walk2(resolve11(dir), 0);
|
|
1289
1295
|
}
|
|
1290
1296
|
async function checkHashRouterCapture(cwd) {
|
|
1291
1297
|
const hashFile = await scanDirForPattern(cwd, HASH_ROUTER_PATTERNS);
|
|
@@ -1318,13 +1324,13 @@ function normalizeProjectPath(path) {
|
|
|
1318
1324
|
}
|
|
1319
1325
|
async function collectMcpSources(root, home) {
|
|
1320
1326
|
const { readFile: readFile3 } = await import("fs/promises");
|
|
1321
|
-
const { join:
|
|
1327
|
+
const { join: join14 } = await import("path");
|
|
1322
1328
|
const sources = [];
|
|
1323
1329
|
const invalid = [];
|
|
1324
1330
|
const plainFiles = [
|
|
1325
|
-
{ path:
|
|
1326
|
-
{ path:
|
|
1327
|
-
{ 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 }
|
|
1328
1334
|
];
|
|
1329
1335
|
for (const file of plainFiles) {
|
|
1330
1336
|
let raw;
|
|
@@ -1341,7 +1347,7 @@ async function collectMcpSources(root, home) {
|
|
|
1341
1347
|
invalid.push(file.path);
|
|
1342
1348
|
}
|
|
1343
1349
|
}
|
|
1344
|
-
const claudeJsonPath =
|
|
1350
|
+
const claudeJsonPath = join14(home, ".claude.json");
|
|
1345
1351
|
try {
|
|
1346
1352
|
const parsed = JSON.parse(await readFile3(claudeJsonPath, "utf8"));
|
|
1347
1353
|
if (isJsonObject(parsed)) {
|
|
@@ -1412,9 +1418,9 @@ function assessMushiEntry(source, name, entry, cliKeySaved) {
|
|
|
1412
1418
|
}
|
|
1413
1419
|
async function checkMcpConfig(config, cwd, doFetch = globalThis.fetch, home) {
|
|
1414
1420
|
const checks = [];
|
|
1415
|
-
const { resolve:
|
|
1421
|
+
const { resolve: resolve11 } = await import("path");
|
|
1416
1422
|
const { homedir: homedir2 } = await import("os");
|
|
1417
|
-
const root =
|
|
1423
|
+
const root = resolve11(cwd);
|
|
1418
1424
|
const { sources, invalid } = await collectMcpSources(root, home ?? homedir2());
|
|
1419
1425
|
if (invalid.length > 0) {
|
|
1420
1426
|
checks.push({
|
|
@@ -1538,12 +1544,12 @@ async function checkOnboardingStatus(config, _consoleBase, cwd, doFetch = global
|
|
|
1538
1544
|
}
|
|
1539
1545
|
try {
|
|
1540
1546
|
const { readFile: readFile3 } = await import("fs/promises");
|
|
1541
|
-
const { join:
|
|
1542
|
-
const root =
|
|
1547
|
+
const { join: join14, resolve: resolve11 } = await import("path");
|
|
1548
|
+
const root = resolve11(cwd);
|
|
1543
1549
|
let envContent = "";
|
|
1544
1550
|
for (const f of [".env.local", ".env"]) {
|
|
1545
1551
|
try {
|
|
1546
|
-
envContent = await readFile3(
|
|
1552
|
+
envContent = await readFile3(join14(root, f), "utf8");
|
|
1547
1553
|
break;
|
|
1548
1554
|
} catch {
|
|
1549
1555
|
}
|
|
@@ -1609,7 +1615,7 @@ async function checkOnboardingStatus(config, _consoleBase, cwd, doFetch = global
|
|
|
1609
1615
|
}
|
|
1610
1616
|
async function checkVersionDrift(cwd, doFetch) {
|
|
1611
1617
|
const checks = [];
|
|
1612
|
-
const { MUSHI_CLI_VERSION: MUSHI_CLI_VERSION2 } = await import("./version-
|
|
1618
|
+
const { MUSHI_CLI_VERSION: MUSHI_CLI_VERSION2 } = await import("./version-SLVFYTAI.js");
|
|
1613
1619
|
if (MUSHI_CLI_VERSION2 === "0.0.0-dev") return checks;
|
|
1614
1620
|
const parse2 = (v) => {
|
|
1615
1621
|
const m = v.replace(/^[~^]/, "").match(/^(\d+)\.(\d+)\.(\d+)/);
|
|
@@ -1639,10 +1645,10 @@ async function checkVersionDrift(cwd, doFetch) {
|
|
|
1639
1645
|
}
|
|
1640
1646
|
try {
|
|
1641
1647
|
const { readFile: readFile3 } = await import("fs/promises");
|
|
1642
|
-
const { join:
|
|
1643
|
-
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"));
|
|
1644
1650
|
const deps2 = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
1645
|
-
const candidates = Object.entries(deps2).filter(([name]) => name
|
|
1651
|
+
const candidates = Object.entries(deps2).filter(([name, spec]) => isMushiSdkPackage(name) && !isLauncherOnly(name, spec)).filter(([, v]) => /^[~^]?\d/.test(v));
|
|
1646
1652
|
const drifted = (await Promise.all(
|
|
1647
1653
|
candidates.map(async ([name, v]) => {
|
|
1648
1654
|
try {
|
|
@@ -1766,7 +1772,7 @@ async function runDoctor(config, options = {}) {
|
|
|
1766
1772
|
}
|
|
1767
1773
|
if (sdkCheck) checks.push(sdkCheck);
|
|
1768
1774
|
if (sdkCheck?.ok && !sdkCheck.warn) {
|
|
1769
|
-
const { findSdkImport } = await import("./snippet-inject-
|
|
1775
|
+
const { findSdkImport } = await import("./snippet-inject-ETGBPDYB.js");
|
|
1770
1776
|
const imported = await findSdkImport(options.cwd ?? process.cwd());
|
|
1771
1777
|
checks.push(
|
|
1772
1778
|
imported ? { name: "SDK init snippet wired", ok: true, detail: `Found SDK usage in ${imported.file}` } : {
|
|
@@ -1813,7 +1819,7 @@ async function runDoctor(config, options = {}) {
|
|
|
1813
1819
|
...checks[idx],
|
|
1814
1820
|
ok: true,
|
|
1815
1821
|
warn: true,
|
|
1816
|
-
detail: "No @mushi-mushi/*
|
|
1822
|
+
detail: "No mushi-mushi or @mushi-mushi/* package in cwd package.json \u2014 but live heartbeats confirm the SDK is active. Run from your app repo or install with `npx mushi-mushi`."
|
|
1817
1823
|
};
|
|
1818
1824
|
}
|
|
1819
1825
|
}
|
|
@@ -1902,7 +1908,7 @@ async function runInit(options = {}) {
|
|
|
1902
1908
|
const credentials = await acquireCredentials(options, consoleBase, endpoint);
|
|
1903
1909
|
await verifyCredentials(credentials, options, consoleBase);
|
|
1904
1910
|
const pm = detectPackageManager(cwd);
|
|
1905
|
-
const packagesToInstall = framework.needsWebPackage ? [framework.packageName, "
|
|
1911
|
+
const packagesToInstall = framework.needsWebPackage ? [framework.packageName, "mushi-mushi"] : [framework.packageName];
|
|
1906
1912
|
if (!options.skipInstall) {
|
|
1907
1913
|
await installPackages(pm, packagesToInstall, cwd);
|
|
1908
1914
|
} else {
|
|
@@ -1948,7 +1954,7 @@ function maybeSuggestAudit(pkg) {
|
|
|
1948
1954
|
...pkg?.dependencies,
|
|
1949
1955
|
...pkg?.devDependencies
|
|
1950
1956
|
};
|
|
1951
|
-
if (Object.keys(deps2).some(
|
|
1957
|
+
if (Object.keys(deps2).some(isMushiSdkPackage)) {
|
|
1952
1958
|
p.log.info(
|
|
1953
1959
|
"A Mushi SDK is already installed here. To health-check the existing setup instead, run `npx mushi-mushi --audit`."
|
|
1954
1960
|
);
|
|
@@ -1980,7 +1986,7 @@ async function chooseFramework(detected, options) {
|
|
|
1980
1986
|
options: Object.values(FRAMEWORKS).map((fw) => ({
|
|
1981
1987
|
value: fw.id,
|
|
1982
1988
|
label: `${fw.id === detected.id ? "\u2713 " : " "}${fw.label}`,
|
|
1983
|
-
hint: fw.
|
|
1989
|
+
hint: fw.importPath
|
|
1984
1990
|
}))
|
|
1985
1991
|
});
|
|
1986
1992
|
if (p.isCancel(confirmed)) {
|
|
@@ -2398,7 +2404,7 @@ async function installPackages(pm, packages, cwd) {
|
|
|
2398
2404
|
function runCommand(pm, packages, cwd) {
|
|
2399
2405
|
const verb = pm === "npm" ? "install" : "add";
|
|
2400
2406
|
const command = process.platform === "win32" ? `${pm}.cmd` : pm;
|
|
2401
|
-
return new Promise((
|
|
2407
|
+
return new Promise((resolve11, reject) => {
|
|
2402
2408
|
const child = spawn(command, [verb, ...packages], {
|
|
2403
2409
|
stdio: "inherit",
|
|
2404
2410
|
shell: false,
|
|
@@ -2407,7 +2413,7 @@ function runCommand(pm, packages, cwd) {
|
|
|
2407
2413
|
});
|
|
2408
2414
|
child.on("error", reject);
|
|
2409
2415
|
child.on("exit", (code) => {
|
|
2410
|
-
if (code === 0)
|
|
2416
|
+
if (code === 0) resolve11();
|
|
2411
2417
|
else reject(new Error(`${pm} exited with code ${code ?? "null"}`));
|
|
2412
2418
|
});
|
|
2413
2419
|
});
|
|
@@ -2526,7 +2532,7 @@ function emitWizardFunnelEvent(credentials, endpoint, event, metadata = {}) {
|
|
|
2526
2532
|
}
|
|
2527
2533
|
async function maybeInjectSnippet(cwd, framework, options) {
|
|
2528
2534
|
if (options.yes || !process.stdin.isTTY) return;
|
|
2529
|
-
const { ENTRY_CANDIDATES, injectSnippet, MUSHI_MARKER_START } = await import("./snippet-inject-
|
|
2535
|
+
const { ENTRY_CANDIDATES, injectSnippet, MUSHI_MARKER_START } = await import("./snippet-inject-ETGBPDYB.js");
|
|
2530
2536
|
const candidates = ENTRY_CANDIDATES[framework.id];
|
|
2531
2537
|
if (!candidates) return;
|
|
2532
2538
|
const { readFile: readFile3, writeFile: writeFile3 } = await import("fs/promises");
|
|
@@ -2553,11 +2559,11 @@ function printNextSteps(framework, consoleBase, enableRewards = false) {
|
|
|
2553
2559
|
p.note(framework.snippet(), "Add this to your app:");
|
|
2554
2560
|
if (enableRewards) {
|
|
2555
2561
|
const badgeSnippet = framework.id === "react" ? `// Add to your user menu or profile UI:
|
|
2556
|
-
import { MushiRewardsBadge } from '
|
|
2562
|
+
import { MushiRewardsBadge } from 'mushi-mushi/react';
|
|
2557
2563
|
|
|
2558
2564
|
// Inside your component:
|
|
2559
2565
|
<MushiRewardsBadge showPoints />` : `// Add to your user menu:
|
|
2560
|
-
// import { MushiRewardsBadge } from '
|
|
2566
|
+
// import { MushiRewardsBadge } from 'mushi-mushi/react';
|
|
2561
2567
|
// <MushiRewardsBadge showPoints />`;
|
|
2562
2568
|
p.note(badgeSnippet, "Rewards badge snippet:");
|
|
2563
2569
|
p.log.info(`Enable rewards in your project settings at ${consoleUrl(consoleBase, "/rewards")}`);
|
|
@@ -2582,7 +2588,7 @@ async function maybeOfferConnect(credentials, options, _consoleBase) {
|
|
|
2582
2588
|
if (p.isCancel(answer) || !answer) return;
|
|
2583
2589
|
const endpoint = resolveCloudEndpoint(options.endpoint);
|
|
2584
2590
|
try {
|
|
2585
|
-
const { runConnect: runConnect2 } = await import("./connect-
|
|
2591
|
+
const { runConnect: runConnect2 } = await import("./connect-NKWXYGN7.js");
|
|
2586
2592
|
const saved = loadConfig();
|
|
2587
2593
|
const result = await runConnect2(
|
|
2588
2594
|
{
|
|
@@ -3621,11 +3627,11 @@ async function findMapFiles(dir) {
|
|
|
3621
3627
|
return results;
|
|
3622
3628
|
}
|
|
3623
3629
|
function fileHash(path) {
|
|
3624
|
-
return new Promise((
|
|
3630
|
+
return new Promise((resolve11, reject) => {
|
|
3625
3631
|
const hash = createHash("sha256");
|
|
3626
3632
|
const stream = createReadStream(path);
|
|
3627
3633
|
stream.on("data", (chunk) => hash.update(chunk));
|
|
3628
|
-
stream.on("end", () =>
|
|
3634
|
+
stream.on("end", () => resolve11(hash.digest("hex")));
|
|
3629
3635
|
stream.on("error", reject);
|
|
3630
3636
|
});
|
|
3631
3637
|
}
|
|
@@ -4012,7 +4018,7 @@ error: Could not start browser sign-in: ${err instanceof Error ? err.message : S
|
|
|
4012
4018
|
const projectsList = await listProjects(endpoint, cliToken);
|
|
4013
4019
|
const { createInterface } = await import("readline");
|
|
4014
4020
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
4015
|
-
const ask = (q2) => new Promise((
|
|
4021
|
+
const ask = (q2) => new Promise((resolve11) => rl.question(q2, (a) => resolve11(a.trim())));
|
|
4016
4022
|
let chosen;
|
|
4017
4023
|
let projectId2;
|
|
4018
4024
|
let projectName;
|
|
@@ -4441,7 +4447,7 @@ If you are not signed in yet, setup runs browser sign-in first, then writes the
|
|
|
4441
4447
|
const { createInterface } = await import("readline");
|
|
4442
4448
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
4443
4449
|
const answer = await new Promise(
|
|
4444
|
-
(
|
|
4450
|
+
(resolve11) => rl.question(" Upgrade this key now via browser sign-in? [Y/n] ", (a) => resolve11(a.trim().toLowerCase()))
|
|
4445
4451
|
);
|
|
4446
4452
|
rl.close();
|
|
4447
4453
|
if (answer === "" || answer === "y" || answer === "yes") {
|
|
@@ -5118,14 +5124,36 @@ import { resolve as resolve2 } from "path";
|
|
|
5118
5124
|
import { execSync } from "child_process";
|
|
5119
5125
|
var SAFE_NPM_VERSION = /^\d+\.\d+\.\d+(-[\w.]+)?$/;
|
|
5120
5126
|
var MUSHI_PACKAGES = [
|
|
5127
|
+
// The one package users install (ADR 0060). The scoped names below keep
|
|
5128
|
+
// working for apps that installed them before.
|
|
5129
|
+
"mushi-mushi",
|
|
5121
5130
|
"@mushi-mushi/web",
|
|
5122
5131
|
"@mushi-mushi/core",
|
|
5123
5132
|
"@mushi-mushi/react",
|
|
5133
|
+
"@mushi-mushi/vue",
|
|
5134
|
+
"@mushi-mushi/svelte",
|
|
5135
|
+
"@mushi-mushi/angular",
|
|
5124
5136
|
"@mushi-mushi/react-native",
|
|
5125
5137
|
"@mushi-mushi/capacitor",
|
|
5126
5138
|
"@mushi-mushi/node",
|
|
5127
5139
|
"@mushi-mushi/cli"
|
|
5128
5140
|
];
|
|
5141
|
+
var IN_UMBRELLA = /* @__PURE__ */ new Set([
|
|
5142
|
+
"@mushi-mushi/web",
|
|
5143
|
+
"@mushi-mushi/core",
|
|
5144
|
+
"@mushi-mushi/react",
|
|
5145
|
+
"@mushi-mushi/vue",
|
|
5146
|
+
"@mushi-mushi/svelte",
|
|
5147
|
+
"@mushi-mushi/angular",
|
|
5148
|
+
"@mushi-mushi/node"
|
|
5149
|
+
]);
|
|
5150
|
+
function umbrellaNote(entries) {
|
|
5151
|
+
if (entries.some((e) => e.name === "mushi-mushi")) return "";
|
|
5152
|
+
const scoped = entries.map((e) => e.name).filter((n) => IN_UMBRELLA.has(n));
|
|
5153
|
+
if (scoped.length === 0) return "";
|
|
5154
|
+
return `
|
|
5155
|
+
Tip: the same SDK now ships as one package. \`npm install mushi-mushi\` and import from \`mushi-mushi\` (or \`mushi-mushi/react\`, \`/vue\`, \`/svelte\`, \`/angular\`, \`/node\`). Your ${scoped.join(", ")} install keeps working.`;
|
|
5156
|
+
}
|
|
5129
5157
|
async function planUpgrade(cwd) {
|
|
5130
5158
|
const root = resolve2(cwd);
|
|
5131
5159
|
const pkg = readPackageJson(root);
|
|
@@ -5134,7 +5162,7 @@ async function planUpgrade(cwd) {
|
|
|
5134
5162
|
...pkg?.dependencies ?? {},
|
|
5135
5163
|
...pkg?.devDependencies ?? {}
|
|
5136
5164
|
};
|
|
5137
|
-
const installed = MUSHI_PACKAGES.filter((name) => deps2[name]);
|
|
5165
|
+
const installed = MUSHI_PACKAGES.filter((name) => deps2[name] && !isLauncherOnly(name, deps2[name]));
|
|
5138
5166
|
const entries = await Promise.all(
|
|
5139
5167
|
installed.map(async (name) => {
|
|
5140
5168
|
const current = deps2[name] ?? "";
|
|
@@ -5153,8 +5181,7 @@ async function planUpgrade(cwd) {
|
|
|
5153
5181
|
name,
|
|
5154
5182
|
current,
|
|
5155
5183
|
latest: safeLatest,
|
|
5156
|
-
willUpgrade
|
|
5157
|
-
migrateToWeb: name === "@mushi-mushi/react" && willUpgrade
|
|
5184
|
+
willUpgrade
|
|
5158
5185
|
};
|
|
5159
5186
|
})
|
|
5160
5187
|
);
|
|
@@ -5178,14 +5205,14 @@ async function runUpgrade(opts = {}) {
|
|
|
5178
5205
|
const plan = await planUpgrade(opts.cwd ?? process.cwd());
|
|
5179
5206
|
if (opts.check) {
|
|
5180
5207
|
const exit = evaluateUpgradeCheckExit(plan);
|
|
5181
|
-
const message = exit === 0 ? "All installed Mushi packages are already at the latest stable version." : exit === 2 ? "Could not reach the npm registry to check for updates \u2014 try again in a moment." : plan.entries.length === 0 ? "No @mushi-mushi/*
|
|
5208
|
+
const message = exit === 0 ? "All installed Mushi packages are already at the latest stable version." : exit === 2 ? "Could not reach the npm registry to check for updates \u2014 try again in a moment." : plan.entries.length === 0 ? "No Mushi Mushi package (mushi-mushi or @mushi-mushi/*) in package.json \u2014 run `npx mushi-mushi` first." : "One or more Mushi packages are behind the latest stable npm release.";
|
|
5182
5209
|
return { plan, upgraded: false, message };
|
|
5183
5210
|
}
|
|
5184
5211
|
if (plan.entries.length === 0) {
|
|
5185
5212
|
return {
|
|
5186
5213
|
plan,
|
|
5187
5214
|
upgraded: false,
|
|
5188
|
-
message: "No @mushi-mushi/*
|
|
5215
|
+
message: "No Mushi Mushi package (mushi-mushi or @mushi-mushi/*) in package.json \u2014 run `npx mushi-mushi` first."
|
|
5189
5216
|
};
|
|
5190
5217
|
}
|
|
5191
5218
|
if (!plan.installCmd) {
|
|
@@ -5210,8 +5237,7 @@ async function runUpgrade(opts = {}) {
|
|
|
5210
5237
|
${plan.installCmd}`
|
|
5211
5238
|
};
|
|
5212
5239
|
}
|
|
5213
|
-
const
|
|
5214
|
-
const migrateNote = reactEntry ? "\nNote: @mushi-mushi/react is legacy \u2014 prefer @mushi-mushi/web for Vite/Capacitor/SPA apps." : "";
|
|
5240
|
+
const migrateNote = umbrellaNote(plan.entries);
|
|
5215
5241
|
return {
|
|
5216
5242
|
plan,
|
|
5217
5243
|
upgraded: true,
|
|
@@ -5329,7 +5355,7 @@ ${via}` };
|
|
|
5329
5355
|
|
|
5330
5356
|
// src/commands/upgrade-cli.ts
|
|
5331
5357
|
function registerUpgradeCommand(program2) {
|
|
5332
|
-
program2.command("upgrade").description("Bump installed @mushi-mushi/* packages to the latest stable npm release").option("--cwd <path>", "Target repo (default: cwd)").option("--self", "Upgrade the globally-installed `mushi` CLI itself (not the project SDK deps)").option("--dry-run", "Print the install command without running it").option("--check", "Plan only: exit 0 current, 1 outdated, 2 registry unreachable").option("--json", "Machine-readable plan + result").addHelpText("after", `
|
|
5358
|
+
program2.command("upgrade").description("Bump the installed mushi-mushi package (and any @mushi-mushi/* packages) to the latest stable npm release").option("--cwd <path>", "Target repo (default: cwd)").option("--self", "Upgrade the globally-installed `mushi` CLI itself (not the project SDK deps)").option("--dry-run", "Print the install command without running it").option("--check", "Plan only: exit 0 current, 1 outdated, 2 registry unreachable").option("--json", "Machine-readable plan + result").addHelpText("after", `
|
|
5333
5359
|
Examples:
|
|
5334
5360
|
mushi upgrade
|
|
5335
5361
|
mushi upgrade --dry-run
|
|
@@ -13861,6 +13887,44 @@ ${"lane".padEnd(16)} ${"app".padEnd(16)} ${"mode".padEnd(10)} ${"state".padEnd(1
|
|
|
13861
13887
|
});
|
|
13862
13888
|
}
|
|
13863
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
|
+
|
|
13864
13928
|
// src/index.ts
|
|
13865
13929
|
installSignalHandlers();
|
|
13866
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) => {
|
|
@@ -13932,6 +13996,10 @@ registerVerifyCommands(program);
|
|
|
13932
13996
|
registerWorkCommands(program);
|
|
13933
13997
|
registerWorkerCommands(program);
|
|
13934
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
|
+
}
|
|
13935
14003
|
program.parseAsync().catch((err) => {
|
|
13936
14004
|
printAndExit(err);
|
|
13937
14005
|
});
|