@mushi-mushi/cli 0.26.1 → 0.27.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/README.md +25 -0
- package/SECURITY.md +49 -0
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/chunk-DBAEB56N.js +10 -0
- package/dist/{chunk-QOY3DULB.js → chunk-M7CDSRZM.js} +125 -7
- package/dist/{chunk-2ZLYNNA3.js → chunk-NNB2NONG.js} +207 -9
- package/dist/chunk-PDX44BCA.js +11 -0
- package/dist/chunk-XLGHUOKY.js +8 -0
- package/dist/{connect-PXLW4D64.js → connect-5EQA7G3U.js} +8 -4
- package/dist/{connect-2LCLLN7R.js → connect-TWO2ZNFB.js} +3 -2
- package/dist/detect.js +1 -0
- package/dist/{endpoint-DGS73AVM.js → endpoint-TEBF4IH6.js} +1 -0
- package/dist/index.js +650 -176
- package/dist/init.js +75 -5
- package/dist/{snippet-inject-NDAPEL2T.js → snippet-inject-7ABYE57O.js} +2 -0
- package/dist/{snippet-inject-LPRWTQDE.js → snippet-inject-CCXILWYZ.js} +1 -0
- package/dist/{version-5DCYWDRK.js → version-AYMUW3UQ.js} +2 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +2 -1
- package/dist/wizard-args.js +1 -0
- package/package.json +4 -1
- package/dist/chunk-6XYPFV23.js +0 -10
- package/dist/chunk-PCTMFRKN.js +0 -8
package/dist/init.js
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
ensureClientId,
|
|
9
9
|
fetchIngestSetup,
|
|
10
10
|
loadConfig,
|
|
11
|
+
maybeShowTelemetryNotice,
|
|
11
12
|
normalizeEndpoint,
|
|
12
13
|
openInBrowser,
|
|
13
14
|
projectIdHint,
|
|
@@ -18,10 +19,10 @@ import {
|
|
|
18
19
|
sanitizeCliCredentials,
|
|
19
20
|
sanitizeEndpoint,
|
|
20
21
|
saveConfig
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-M7CDSRZM.js";
|
|
22
23
|
import {
|
|
23
24
|
MUSHI_CLI_VERSION
|
|
24
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-XLGHUOKY.js";
|
|
25
26
|
import {
|
|
26
27
|
FRAMEWORKS,
|
|
27
28
|
detectFramework,
|
|
@@ -30,6 +31,7 @@ import {
|
|
|
30
31
|
installCommand,
|
|
31
32
|
readPackageJson
|
|
32
33
|
} from "./chunk-AIZRI665.js";
|
|
34
|
+
import "./chunk-3RG5ZIWI.js";
|
|
33
35
|
|
|
34
36
|
// src/init.ts
|
|
35
37
|
import * as p from "@clack/prompts";
|
|
@@ -821,6 +823,71 @@ async function checkHostAppWiring(cwd) {
|
|
|
821
823
|
}
|
|
822
824
|
return checks;
|
|
823
825
|
}
|
|
826
|
+
var HASH_ROUTER_PATTERNS = [
|
|
827
|
+
/\bHashRouter\b/,
|
|
828
|
+
/\bcreateHashRouter\b/,
|
|
829
|
+
/location\.hash\b/,
|
|
830
|
+
/addEventListener\(['"]hashchange['"]/
|
|
831
|
+
];
|
|
832
|
+
var HASH_TEMPLATE_PATTERN = /['"`]#\//;
|
|
833
|
+
async function scanDirForPattern(dir, patterns, maxDepth = 6, maxFiles = 2e3) {
|
|
834
|
+
const { readdir, readFile } = await import("fs/promises");
|
|
835
|
+
const { join: join3 } = await import("path");
|
|
836
|
+
let count = 0;
|
|
837
|
+
async function walk(d, depth) {
|
|
838
|
+
if (depth > maxDepth || count > maxFiles) return null;
|
|
839
|
+
let entries = [];
|
|
840
|
+
try {
|
|
841
|
+
entries = await readdir(d, { withFileTypes: true });
|
|
842
|
+
} catch {
|
|
843
|
+
return null;
|
|
844
|
+
}
|
|
845
|
+
for (const e of entries) {
|
|
846
|
+
if (e.name.startsWith(".") || e.name === "node_modules" || e.name === "dist") continue;
|
|
847
|
+
const full = join3(d, e.name);
|
|
848
|
+
if (e.isDirectory()) {
|
|
849
|
+
const found = await walk(full, depth + 1);
|
|
850
|
+
if (found) return found;
|
|
851
|
+
} else if (/\.[cm]?[jt]sx?$/.test(e.name)) {
|
|
852
|
+
count++;
|
|
853
|
+
try {
|
|
854
|
+
const src = await readFile(full, "utf8");
|
|
855
|
+
if (patterns.some((p2) => p2.test(src))) return full;
|
|
856
|
+
} catch {
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
return null;
|
|
861
|
+
}
|
|
862
|
+
const { resolve: resolve2 } = await import("path");
|
|
863
|
+
for (const sub of ["src", "app", "pages", "lib", "components"]) {
|
|
864
|
+
const found = await walk(join3(resolve2(dir), sub), 0);
|
|
865
|
+
if (found) return found;
|
|
866
|
+
}
|
|
867
|
+
return walk(resolve2(dir), 0);
|
|
868
|
+
}
|
|
869
|
+
async function checkHashRouterCapture(cwd) {
|
|
870
|
+
const hashFile = await scanDirForPattern(cwd, HASH_ROUTER_PATTERNS);
|
|
871
|
+
if (!hashFile) return [];
|
|
872
|
+
const templateFile = await scanDirForPattern(cwd, [HASH_TEMPLATE_PATTERN]);
|
|
873
|
+
if (templateFile) {
|
|
874
|
+
return [
|
|
875
|
+
{
|
|
876
|
+
name: "[host] Hash-router route capture",
|
|
877
|
+
ok: true,
|
|
878
|
+
detail: `Hash-router detected (${hashFile}) and /#/ route templates found in Mushi config \u2014 routes will be captured correctly.`
|
|
879
|
+
}
|
|
880
|
+
];
|
|
881
|
+
}
|
|
882
|
+
return [
|
|
883
|
+
{
|
|
884
|
+
name: "[host] Hash-router route capture",
|
|
885
|
+
ok: true,
|
|
886
|
+
warn: true,
|
|
887
|
+
detail: `Hash-router detected (${hashFile}) but no /#/ route templates found in your Mushi init call. Add discoverInventory.routeTemplates with /#/-prefixed patterns (e.g. ['/#/article/[slug]']) so Mushi captures parametric hash routes correctly \u2014 without these, all hash navigations appear as a single "/#/" route in the inventory.`
|
|
888
|
+
}
|
|
889
|
+
];
|
|
890
|
+
}
|
|
824
891
|
async function checkMcpConfig(config, cwd, doFetch = globalThis.fetch) {
|
|
825
892
|
const checks = [];
|
|
826
893
|
const { readFile } = await import("fs/promises");
|
|
@@ -1075,7 +1142,7 @@ async function runDoctor(config, options = {}) {
|
|
|
1075
1142
|
const sdkCheck = await checkSdkInstall(options.cwd ?? process.cwd());
|
|
1076
1143
|
if (sdkCheck) checks.push(sdkCheck);
|
|
1077
1144
|
if (sdkCheck?.ok && !sdkCheck.warn) {
|
|
1078
|
-
const { findSdkImport } = await import("./snippet-inject-
|
|
1145
|
+
const { findSdkImport } = await import("./snippet-inject-7ABYE57O.js");
|
|
1079
1146
|
const imported = await findSdkImport(options.cwd ?? process.cwd());
|
|
1080
1147
|
checks.push(
|
|
1081
1148
|
imported ? { name: "SDK init snippet wired", ok: true, detail: `Found SDK usage in ${imported.file}` } : {
|
|
@@ -1103,6 +1170,8 @@ async function runDoctor(config, options = {}) {
|
|
|
1103
1170
|
if (isFull || options.hostApp) {
|
|
1104
1171
|
const hostChecks = await checkHostAppWiring(options.cwd ?? process.cwd());
|
|
1105
1172
|
checks.push(...hostChecks);
|
|
1173
|
+
const hashChecks = await checkHashRouterCapture(options.cwd ?? process.cwd());
|
|
1174
|
+
checks.push(...hashChecks);
|
|
1106
1175
|
}
|
|
1107
1176
|
if (isFull || options.mcp) {
|
|
1108
1177
|
const mcpChecks = await checkMcpConfig(config, options.cwd ?? process.cwd(), doFetch);
|
|
@@ -1287,6 +1356,7 @@ async function acquireCredentials(options, consoleBase, endpoint) {
|
|
|
1287
1356
|
};
|
|
1288
1357
|
}
|
|
1289
1358
|
const existing = loadConfig();
|
|
1359
|
+
maybeShowTelemetryNotice(existing);
|
|
1290
1360
|
if (!options.projectId && !options.apiKey && existing.projectId && existing.apiKey) {
|
|
1291
1361
|
const reuse = options.yes ? true : await p.confirm({
|
|
1292
1362
|
message: "Use the Mushi credentials saved from your last sign-in?",
|
|
@@ -1677,7 +1747,7 @@ function emitWizardFunnelEvent(credentials, endpoint, event, metadata = {}) {
|
|
|
1677
1747
|
}
|
|
1678
1748
|
async function maybeInjectSnippet(cwd, framework, options) {
|
|
1679
1749
|
if (options.yes || !process.stdin.isTTY) return;
|
|
1680
|
-
const { ENTRY_CANDIDATES, injectSnippet, MUSHI_MARKER_START } = await import("./snippet-inject-
|
|
1750
|
+
const { ENTRY_CANDIDATES, injectSnippet, MUSHI_MARKER_START } = await import("./snippet-inject-7ABYE57O.js");
|
|
1681
1751
|
const candidates = ENTRY_CANDIDATES[framework.id];
|
|
1682
1752
|
if (!candidates) return;
|
|
1683
1753
|
const { readFile, writeFile } = await import("fs/promises");
|
|
@@ -1733,7 +1803,7 @@ async function maybeOfferConnect(credentials, options, _consoleBase) {
|
|
|
1733
1803
|
if (p.isCancel(answer) || !answer) return;
|
|
1734
1804
|
const endpoint = resolveCloudEndpoint(options.endpoint);
|
|
1735
1805
|
try {
|
|
1736
|
-
const { runConnect } = await import("./connect-
|
|
1806
|
+
const { runConnect } = await import("./connect-5EQA7G3U.js");
|
|
1737
1807
|
await runConnect({
|
|
1738
1808
|
apiKey: credentials.apiKey,
|
|
1739
1809
|
projectId: credentials.projectId,
|
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.
|
|
17
|
+
declare const MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.20.1";
|
|
18
18
|
|
|
19
19
|
export { MUSHI_CLI_VERSION, MUSHI_MCP_PIN_SPEC };
|
package/dist/version.js
CHANGED
package/dist/wizard-args.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mushi-mushi/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "CLI for Mushi Mushi — `mushi init` wizard installs the right SDK for your framework, plus report triage and pipeline health commands",
|
|
6
6
|
"bin": {
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
"@clack/prompts": "^1.5.1",
|
|
11
11
|
"commander": "^15.0.0"
|
|
12
12
|
},
|
|
13
|
+
"optionalDependencies": {
|
|
14
|
+
"@napi-rs/keyring": "^1.1.5"
|
|
15
|
+
},
|
|
13
16
|
"devDependencies": {
|
|
14
17
|
"@types/node": "^22.20.0",
|
|
15
18
|
"eslint": "^10.6.0",
|
package/dist/chunk-6XYPFV23.js
DELETED