@mushi-mushi/cli 0.22.0 → 0.22.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-YK4LF7AM.js +6 -0
- package/dist/index.js +35 -24
- package/dist/init.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-5KN6S63C.js +0 -6
package/dist/index.js
CHANGED
|
@@ -127,7 +127,7 @@ function getAbortSignal(external) {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
// src/version.ts
|
|
130
|
-
var MUSHI_CLI_VERSION = true ? "0.22.
|
|
130
|
+
var MUSHI_CLI_VERSION = true ? "0.22.1" : "0.0.0-dev";
|
|
131
131
|
|
|
132
132
|
// src/init.ts
|
|
133
133
|
import * as p from "@clack/prompts";
|
|
@@ -2403,7 +2403,7 @@ Examples:
|
|
|
2403
2403
|
mushi index ./src
|
|
2404
2404
|
mushi index ./src --language ts --dry-run`).action(async (path, opts) => {
|
|
2405
2405
|
const config = requireConfig({ needsProject: true });
|
|
2406
|
-
const { readdir: readdir2, readFile:
|
|
2406
|
+
const { readdir: readdir2, readFile: readFile3, stat } = await import("fs/promises");
|
|
2407
2407
|
const nodePath2 = await import("path");
|
|
2408
2408
|
const SKIP = /node_modules|\.git|dist|build|\.next|\.turbo|coverage/;
|
|
2409
2409
|
const EXTS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".py", ".go", ".rs"]);
|
|
@@ -2430,7 +2430,7 @@ Examples:
|
|
|
2430
2430
|
`);
|
|
2431
2431
|
continue;
|
|
2432
2432
|
}
|
|
2433
|
-
const source = await
|
|
2433
|
+
const source = await readFile3(file, "utf8");
|
|
2434
2434
|
const relative2 = nodePath2.relative(root, file).replaceAll("\\", "/");
|
|
2435
2435
|
count++;
|
|
2436
2436
|
bytes += source.length;
|
|
@@ -2478,21 +2478,32 @@ Examples:
|
|
|
2478
2478
|
}
|
|
2479
2479
|
|
|
2480
2480
|
// src/project-bootstrap.ts
|
|
2481
|
-
import { writeFile } from "fs/promises";
|
|
2482
|
-
import { existsSync as existsSync4 } from "fs";
|
|
2481
|
+
import { writeFile, readFile as readFile2 } from "fs/promises";
|
|
2483
2482
|
import nodePath from "path";
|
|
2484
2483
|
async function writeProjectBootstrapFiles(opts) {
|
|
2485
2484
|
const cwd = opts.cwd ?? process.cwd();
|
|
2486
2485
|
const envPath = nodePath.join(cwd, ".env.local");
|
|
2487
|
-
const
|
|
2486
|
+
const mushiBlock = [
|
|
2488
2487
|
"# Mushi MCP \u2014 drop into .env.local (gitignored). The MCP binary picks these up on spawn.",
|
|
2489
2488
|
`MUSHI_API_ENDPOINT=${opts.endpoint}`,
|
|
2490
2489
|
`MUSHI_PROJECT_ID=${opts.projectId}`,
|
|
2491
|
-
`MUSHI_API_KEY=${opts.apiKey}
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2490
|
+
`MUSHI_API_KEY=${opts.apiKey}`
|
|
2491
|
+
].join("\n");
|
|
2492
|
+
let existing = "";
|
|
2493
|
+
let envUpdated = false;
|
|
2494
|
+
try {
|
|
2495
|
+
existing = await readFile2(envPath, "utf8");
|
|
2496
|
+
envUpdated = true;
|
|
2497
|
+
} catch {
|
|
2498
|
+
}
|
|
2499
|
+
const MUSHI_LINE_RE = /^(NEXT_PUBLIC_|NUXT_PUBLIC_|VITE_|EXPO_PUBLIC_)?MUSHI_[A-Z_]+=.*/gm;
|
|
2500
|
+
const MUSHI_COMMENT_RE = /^# Mushi MCP\b.*/gm;
|
|
2501
|
+
const stripped = existing.replace(MUSHI_LINE_RE, "").replace(MUSHI_COMMENT_RE, "").replace(/\n{3,}/g, "\n\n").trimEnd();
|
|
2502
|
+
const prefix = stripped.length > 0 ? `${stripped}
|
|
2503
|
+
|
|
2504
|
+
` : "";
|
|
2505
|
+
await writeFile(envPath, `${prefix}${mushiBlock}
|
|
2506
|
+
`, "utf8");
|
|
2496
2507
|
const mcpPath = nodePath.join(cwd, ".cursor", "mcp.json");
|
|
2497
2508
|
const serverName = buildMcpServerName({ legacy: true });
|
|
2498
2509
|
const serverBlock = buildMcpServerBlock({
|
|
@@ -2649,8 +2660,8 @@ Supported IDEs:
|
|
|
2649
2660
|
zed \u2014 writes ~/.config/zed/settings.json mcpServers block
|
|
2650
2661
|
|
|
2651
2662
|
The command reads credentials from ~/.config/mushi/config.json (run \`mushi login\` first).`).action(async (opts) => {
|
|
2652
|
-
const { writeFile: writeFile2, mkdir, readFile:
|
|
2653
|
-
const { existsSync:
|
|
2663
|
+
const { writeFile: writeFile2, mkdir, readFile: readFile3 } = await import("fs/promises");
|
|
2664
|
+
const { existsSync: existsSync4 } = await import("fs");
|
|
2654
2665
|
const nodePath2 = await import("path");
|
|
2655
2666
|
const os = await import("os");
|
|
2656
2667
|
const config = requireConfig({ needsProject: true });
|
|
@@ -2762,9 +2773,9 @@ The command reads credentials from ~/.config/mushi/config.json (run \`mushi logi
|
|
|
2762
2773
|
}
|
|
2763
2774
|
} else if (ideEntry.format === "zed") {
|
|
2764
2775
|
let settings = {};
|
|
2765
|
-
if (
|
|
2776
|
+
if (existsSync4(configPath)) {
|
|
2766
2777
|
try {
|
|
2767
|
-
const raw = await
|
|
2778
|
+
const raw = await readFile3(configPath, "utf8");
|
|
2768
2779
|
settings = JSON.parse(raw);
|
|
2769
2780
|
} catch {
|
|
2770
2781
|
}
|
|
@@ -3463,11 +3474,11 @@ async function checkEndpointReachability(endpoint, doFetch = globalThis.fetch) {
|
|
|
3463
3474
|
}
|
|
3464
3475
|
async function checkSdkInstall(cwd) {
|
|
3465
3476
|
try {
|
|
3466
|
-
const { readFile:
|
|
3477
|
+
const { readFile: readFile3 } = await import("fs/promises");
|
|
3467
3478
|
const { join: join5, resolve: resolve3 } = await import("path");
|
|
3468
3479
|
const root = resolve3(cwd);
|
|
3469
3480
|
const pkgPath = join5(root, "package.json");
|
|
3470
|
-
const pkg = JSON.parse(await
|
|
3481
|
+
const pkg = JSON.parse(await readFile3(pkgPath, "utf8"));
|
|
3471
3482
|
const deps = { ...pkg.dependencies ?? {}, ...pkg.devDependencies ?? {} };
|
|
3472
3483
|
const sdks = [
|
|
3473
3484
|
"@mushi-mushi/react",
|
|
@@ -3662,18 +3673,18 @@ async function checkQaStoriesHealth(config, doFetch = globalThis.fetch) {
|
|
|
3662
3673
|
async function checkHostAppWiring(cwd) {
|
|
3663
3674
|
const checks = [];
|
|
3664
3675
|
try {
|
|
3665
|
-
const { readFile:
|
|
3676
|
+
const { readFile: readFile3, access } = await import("fs/promises");
|
|
3666
3677
|
const { join: join5, resolve: resolve3 } = await import("path");
|
|
3667
3678
|
const root = resolve3(cwd);
|
|
3668
3679
|
const pkgPath = join5(root, "package.json");
|
|
3669
|
-
const pkg = JSON.parse(await
|
|
3680
|
+
const pkg = JSON.parse(await readFile3(pkgPath, "utf8"));
|
|
3670
3681
|
const deps = { ...pkg.dependencies ?? {}, ...pkg.devDependencies ?? {} };
|
|
3671
3682
|
const isCapHybrid = Boolean(deps["@capacitor/core"] && deps["react"]);
|
|
3672
3683
|
const envCandidates = [".env.local", ".env"];
|
|
3673
3684
|
let envContent = "";
|
|
3674
3685
|
for (const f of envCandidates) {
|
|
3675
3686
|
try {
|
|
3676
|
-
envContent = await
|
|
3687
|
+
envContent = await readFile3(join5(root, f), "utf8");
|
|
3677
3688
|
break;
|
|
3678
3689
|
} catch {
|
|
3679
3690
|
}
|
|
@@ -3720,7 +3731,7 @@ async function checkHostAppWiring(cwd) {
|
|
|
3720
3731
|
}
|
|
3721
3732
|
async function checkMcpConfig(config, cwd, doFetch = globalThis.fetch) {
|
|
3722
3733
|
const checks = [];
|
|
3723
|
-
const { readFile:
|
|
3734
|
+
const { readFile: readFile3 } = await import("fs/promises");
|
|
3724
3735
|
const { join: join5, resolve: resolve3 } = await import("path");
|
|
3725
3736
|
const { homedir } = await import("os");
|
|
3726
3737
|
const root = resolve3(cwd);
|
|
@@ -3732,7 +3743,7 @@ async function checkMcpConfig(config, cwd, doFetch = globalThis.fetch) {
|
|
|
3732
3743
|
let mcpRaw = null;
|
|
3733
3744
|
for (const candidate of candidates) {
|
|
3734
3745
|
try {
|
|
3735
|
-
const raw = await
|
|
3746
|
+
const raw = await readFile3(candidate, "utf8");
|
|
3736
3747
|
let parsed = {};
|
|
3737
3748
|
try {
|
|
3738
3749
|
parsed = JSON.parse(raw);
|
|
@@ -3878,13 +3889,13 @@ async function checkOnboardingStatus(config, _consoleBase, cwd, doFetch = global
|
|
|
3878
3889
|
};
|
|
3879
3890
|
}
|
|
3880
3891
|
try {
|
|
3881
|
-
const { readFile:
|
|
3892
|
+
const { readFile: readFile3 } = await import("fs/promises");
|
|
3882
3893
|
const { join: join5, resolve: resolve3 } = await import("path");
|
|
3883
3894
|
const root = resolve3(cwd);
|
|
3884
3895
|
let envContent = "";
|
|
3885
3896
|
for (const f of [".env.local", ".env"]) {
|
|
3886
3897
|
try {
|
|
3887
|
-
envContent = await
|
|
3898
|
+
envContent = await readFile3(join5(root, f), "utf8");
|
|
3888
3899
|
break;
|
|
3889
3900
|
} catch {
|
|
3890
3901
|
}
|
package/dist/init.js
CHANGED
package/dist/version.js
CHANGED
package/package.json
CHANGED