@mushi-mushi/cli 0.37.2 → 0.39.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/README.md +1 -1
- package/dist/{chunk-AIZRI665.js → chunk-AWASJDQI.js} +62 -33
- package/dist/{chunk-NP4I7OFD.js → chunk-BG2TVTBN.js} +1 -1
- package/dist/{chunk-KOBEOGNF.js → chunk-CG5KPP4S.js} +62 -33
- package/dist/chunk-HQM2WZVF.js +8 -0
- package/dist/chunk-JQPLY3ZT.js +10 -0
- package/dist/{chunk-5IWVPXSZ.js → chunk-OZPDPF6G.js} +4 -4
- package/dist/{chunk-O7VVIYYE.js → chunk-PPES6C4Y.js} +1 -1
- package/dist/{chunk-ZOC2HI4D.js → chunk-UVAADP4O.js} +3 -3
- package/dist/{connect-6GMMSSE2.js → connect-BCCGBCYR.js} +4 -4
- package/dist/{connect-AJ7OD4CE.js → connect-RZV3PXP3.js} +4 -4
- package/dist/{daemon-ISF6BNDH.js → daemon-ASMMT73O.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 +197 -34
- package/dist/init.js +22 -17
- 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-6CFPSCG6.js → version-MGHYYC2T.js} +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wizard-args.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-TPDK6BVO.js +0 -10
- package/dist/chunk-VMPVQL26.js +0 -8
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
resolveSdkEnvKey,
|
|
4
4
|
runConnect
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-OZPDPF6G.js";
|
|
6
|
+
import "./chunk-CG5KPP4S.js";
|
|
7
|
+
import "./chunk-PPES6C4Y.js";
|
|
8
|
+
import "./chunk-JQPLY3ZT.js";
|
|
9
9
|
import "./chunk-LGGE3LH7.js";
|
|
10
10
|
export {
|
|
11
11
|
resolveSdkEnvKey,
|
|
@@ -10,9 +10,9 @@ import {
|
|
|
10
10
|
readWorkerKey,
|
|
11
11
|
runDaemon,
|
|
12
12
|
workerHostId
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-UVAADP4O.js";
|
|
14
|
+
import "./chunk-PPES6C4Y.js";
|
|
15
|
+
import "./chunk-JQPLY3ZT.js";
|
|
16
16
|
import "./chunk-LGGE3LH7.js";
|
|
17
17
|
export {
|
|
18
18
|
assertWorkerKey,
|
|
@@ -7,8 +7,10 @@ import {
|
|
|
7
7
|
envVarsToWrite,
|
|
8
8
|
installCommand,
|
|
9
9
|
isFrameworkId,
|
|
10
|
+
isLauncherOnly,
|
|
11
|
+
isMushiSdkPackage,
|
|
10
12
|
readPackageJson
|
|
11
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-CG5KPP4S.js";
|
|
12
14
|
export {
|
|
13
15
|
FRAMEWORKS,
|
|
14
16
|
FRAMEWORK_IDS,
|
|
@@ -17,5 +19,7 @@ export {
|
|
|
17
19
|
envVarsToWrite,
|
|
18
20
|
installCommand,
|
|
19
21
|
isFrameworkId,
|
|
22
|
+
isLauncherOnly,
|
|
23
|
+
isMushiSdkPackage,
|
|
20
24
|
readPackageJson
|
|
21
25
|
};
|
package/dist/detect.d.ts
CHANGED
|
@@ -7,7 +7,10 @@ type FrameworkId = 'next' | 'react' | 'cra' | 'remix' | 'astro' | 'solid' | 'vue
|
|
|
7
7
|
interface Framework {
|
|
8
8
|
id: FrameworkId;
|
|
9
9
|
label: string;
|
|
10
|
+
/** What the wizard installs: `mushi-mushi`, or the scoped native package (React Native, Capacitor). */
|
|
10
11
|
packageName: string;
|
|
12
|
+
/** Where the snippet imports from, e.g. `mushi-mushi/react`. */
|
|
13
|
+
importPath: string;
|
|
11
14
|
needsWebPackage: boolean;
|
|
12
15
|
snippet: () => string;
|
|
13
16
|
}
|
|
@@ -21,10 +24,23 @@ type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun';
|
|
|
21
24
|
declare const FRAMEWORK_IDS: ReadonlyArray<FrameworkId>;
|
|
22
25
|
declare function isFrameworkId(value: unknown): value is FrameworkId;
|
|
23
26
|
declare const FRAMEWORKS: Record<FrameworkId, Framework>;
|
|
27
|
+
/**
|
|
28
|
+
* True for a dependency name that is a Mushi Mushi package: the `mushi-mushi`
|
|
29
|
+
* umbrella or any scoped `@mushi-mushi/*` package (older installs keep working).
|
|
30
|
+
*/
|
|
31
|
+
declare function isMushiSdkPackage(name: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* True for `mushi-mushi` pinned below 1.0. Before ADR 0060 that package was
|
|
34
|
+
* only the `npx mushi-mushi` setup command; the SDK ships in it from 1.x. A
|
|
35
|
+
* project that keeps `mushi-mushi@^0.8` to run the wizard has no SDK from it,
|
|
36
|
+
* and moving it to 1.x would add the whole SDK, so neither `mushi upgrade` nor
|
|
37
|
+
* `mushi doctor` treats it as one. Mirrors the server's isUmbrellaLauncherOnly.
|
|
38
|
+
*/
|
|
39
|
+
declare function isLauncherOnly(name: string, spec: string | undefined): boolean;
|
|
24
40
|
declare function readPackageJson(cwd: string): PackageJson | null;
|
|
25
41
|
declare function detectFramework(cwd: string, pkg: PackageJson | null): Framework;
|
|
26
42
|
declare function detectPackageManager(cwd: string): PackageManager;
|
|
27
43
|
declare function installCommand(pm: PackageManager, packages: string[]): string;
|
|
28
44
|
declare function envVarsToWrite(apiKey: string, projectId: string, framework: Framework, endpoint?: string): string;
|
|
29
45
|
|
|
30
|
-
export { FRAMEWORKS, FRAMEWORK_IDS, type Framework, type FrameworkId, type PackageJson, type PackageManager, detectFramework, detectPackageManager, envVarsToWrite, installCommand, isFrameworkId, readPackageJson };
|
|
46
|
+
export { FRAMEWORKS, FRAMEWORK_IDS, type Framework, type FrameworkId, type PackageJson, type PackageManager, detectFramework, detectPackageManager, envVarsToWrite, installCommand, isFrameworkId, isLauncherOnly, isMushiSdkPackage, readPackageJson };
|
package/dist/detect.js
CHANGED
|
@@ -6,8 +6,10 @@ import {
|
|
|
6
6
|
envVarsToWrite,
|
|
7
7
|
installCommand,
|
|
8
8
|
isFrameworkId,
|
|
9
|
+
isLauncherOnly,
|
|
10
|
+
isMushiSdkPackage,
|
|
9
11
|
readPackageJson
|
|
10
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-AWASJDQI.js";
|
|
11
13
|
export {
|
|
12
14
|
FRAMEWORKS,
|
|
13
15
|
FRAMEWORK_IDS,
|
|
@@ -16,5 +18,7 @@ export {
|
|
|
16
18
|
envVarsToWrite,
|
|
17
19
|
installCommand,
|
|
18
20
|
isFrameworkId,
|
|
21
|
+
isLauncherOnly,
|
|
22
|
+
isMushiSdkPackage,
|
|
19
23
|
readPackageJson
|
|
20
24
|
};
|
package/dist/index.js
CHANGED
|
@@ -22,15 +22,17 @@ import {
|
|
|
22
22
|
sanitizeEndpoint,
|
|
23
23
|
sanitizeProjectId,
|
|
24
24
|
writeMcpServerEntry
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-OZPDPF6G.js";
|
|
26
26
|
import {
|
|
27
27
|
FRAMEWORKS,
|
|
28
28
|
detectFramework,
|
|
29
29
|
detectPackageManager,
|
|
30
30
|
envVarsToWrite,
|
|
31
31
|
installCommand,
|
|
32
|
+
isLauncherOnly,
|
|
33
|
+
isMushiSdkPackage,
|
|
32
34
|
readPackageJson
|
|
33
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-CG5KPP4S.js";
|
|
34
36
|
import {
|
|
35
37
|
LANE_NAME_RE,
|
|
36
38
|
MODEL_RE,
|
|
@@ -50,7 +52,7 @@ import {
|
|
|
50
52
|
registerUxCommands,
|
|
51
53
|
registerWorkCommands,
|
|
52
54
|
validateWorkerConfig
|
|
53
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-UVAADP4O.js";
|
|
54
56
|
import {
|
|
55
57
|
CONFIG_PATH,
|
|
56
58
|
MushiCliError,
|
|
@@ -89,11 +91,11 @@ import {
|
|
|
89
91
|
tryLoadKeyFromKeychain,
|
|
90
92
|
trySaveKeyToKeychain,
|
|
91
93
|
trySaveWorkerKey
|
|
92
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-PPES6C4Y.js";
|
|
93
95
|
import {
|
|
94
96
|
MUSHI_CLI_VERSION,
|
|
95
97
|
MUSHI_MCP_PIN_SPEC
|
|
96
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-JQPLY3ZT.js";
|
|
97
99
|
import {
|
|
98
100
|
CLOUD_API_ENDPOINT,
|
|
99
101
|
CLOUD_MCP_OAUTH_URL,
|
|
@@ -616,7 +618,7 @@ error: Could not start login session: ${err instanceof Error ? err.message : Str
|
|
|
616
618
|
choice = await resolveProjectChoice(projectsList, ask);
|
|
617
619
|
rl.close();
|
|
618
620
|
} else {
|
|
619
|
-
const { readPackageJson: readPackageJson2 } = await import("./detect-
|
|
621
|
+
const { readPackageJson: readPackageJson2 } = await import("./detect-SOXPECZ3.js");
|
|
620
622
|
const cwd = process.cwd();
|
|
621
623
|
const nonInteractive = chooseProjectNonInteractive(
|
|
622
624
|
projectsList,
|
|
@@ -978,6 +980,7 @@ async function checkSdkInstall(cwd) {
|
|
|
978
980
|
const pkg = JSON.parse(await readFile3(pkgPath, "utf8"));
|
|
979
981
|
const deps2 = { ...pkg.dependencies ?? {}, ...pkg.devDependencies ?? {} };
|
|
980
982
|
const sdks = [
|
|
983
|
+
"mushi-mushi",
|
|
981
984
|
"@mushi-mushi/react",
|
|
982
985
|
"@mushi-mushi/web",
|
|
983
986
|
"@mushi-mushi/core",
|
|
@@ -988,11 +991,11 @@ async function checkSdkInstall(cwd) {
|
|
|
988
991
|
"@mushi-mushi/capacitor",
|
|
989
992
|
"@mushi-mushi/node"
|
|
990
993
|
];
|
|
991
|
-
const installed = sdks.filter((s) => deps2[s]);
|
|
994
|
+
const installed = sdks.filter((s) => deps2[s] && !isLauncherOnly(s, deps2[s]));
|
|
992
995
|
return {
|
|
993
996
|
name: "SDK installed in this repo",
|
|
994
997
|
ok: installed.length > 0,
|
|
995
|
-
detail: installed.length > 0 ? installed.map((s) => `${s}@${deps2[s]}`).join(", ") : "No
|
|
998
|
+
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
999
|
};
|
|
997
1000
|
} catch {
|
|
998
1001
|
return null;
|
|
@@ -1223,11 +1226,13 @@ async function checkHostAppWiring(cwd) {
|
|
|
1223
1226
|
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
1227
|
});
|
|
1225
1228
|
if (isCapHybrid) {
|
|
1226
|
-
const hasWebSdk = Boolean(
|
|
1229
|
+
const hasWebSdk = Boolean(
|
|
1230
|
+
deps2["mushi-mushi"] && !isLauncherOnly("mushi-mushi", deps2["mushi-mushi"]) || deps2["@mushi-mushi/web"] || deps2["@mushi-mushi/react"]
|
|
1231
|
+
);
|
|
1227
1232
|
checks.push({
|
|
1228
1233
|
name: "[host] Capacitor hybrid \u2014 WebView SDK",
|
|
1229
1234
|
ok: hasWebSdk,
|
|
1230
|
-
detail: hasWebSdk ? "Use
|
|
1235
|
+
detail: hasWebSdk ? "Use mushi-mushi (or mushi-mushi/react) in the WebView (initMushi in main.tsx)" : "Install mushi-mushi for Capacitor WebView reporting"
|
|
1231
1236
|
});
|
|
1232
1237
|
checks.push({
|
|
1233
1238
|
name: "[host] Capacitor native plugin (optional)",
|
|
@@ -1609,7 +1614,7 @@ async function checkOnboardingStatus(config, _consoleBase, cwd, doFetch = global
|
|
|
1609
1614
|
}
|
|
1610
1615
|
async function checkVersionDrift(cwd, doFetch) {
|
|
1611
1616
|
const checks = [];
|
|
1612
|
-
const { MUSHI_CLI_VERSION: MUSHI_CLI_VERSION2 } = await import("./version-
|
|
1617
|
+
const { MUSHI_CLI_VERSION: MUSHI_CLI_VERSION2 } = await import("./version-MGHYYC2T.js");
|
|
1613
1618
|
if (MUSHI_CLI_VERSION2 === "0.0.0-dev") return checks;
|
|
1614
1619
|
const parse2 = (v) => {
|
|
1615
1620
|
const m = v.replace(/^[~^]/, "").match(/^(\d+)\.(\d+)\.(\d+)/);
|
|
@@ -1642,7 +1647,7 @@ async function checkVersionDrift(cwd, doFetch) {
|
|
|
1642
1647
|
const { join: join13 } = await import("path");
|
|
1643
1648
|
const pkg = JSON.parse(await readFile3(join13(cwd, "package.json"), "utf8"));
|
|
1644
1649
|
const deps2 = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
1645
|
-
const candidates = Object.entries(deps2).filter(([name]) => name
|
|
1650
|
+
const candidates = Object.entries(deps2).filter(([name, spec]) => isMushiSdkPackage(name) && !isLauncherOnly(name, spec)).filter(([, v]) => /^[~^]?\d/.test(v));
|
|
1646
1651
|
const drifted = (await Promise.all(
|
|
1647
1652
|
candidates.map(async ([name, v]) => {
|
|
1648
1653
|
try {
|
|
@@ -1766,7 +1771,7 @@ async function runDoctor(config, options = {}) {
|
|
|
1766
1771
|
}
|
|
1767
1772
|
if (sdkCheck) checks.push(sdkCheck);
|
|
1768
1773
|
if (sdkCheck?.ok && !sdkCheck.warn) {
|
|
1769
|
-
const { findSdkImport } = await import("./snippet-inject-
|
|
1774
|
+
const { findSdkImport } = await import("./snippet-inject-ETGBPDYB.js");
|
|
1770
1775
|
const imported = await findSdkImport(options.cwd ?? process.cwd());
|
|
1771
1776
|
checks.push(
|
|
1772
1777
|
imported ? { name: "SDK init snippet wired", ok: true, detail: `Found SDK usage in ${imported.file}` } : {
|
|
@@ -1813,7 +1818,7 @@ async function runDoctor(config, options = {}) {
|
|
|
1813
1818
|
...checks[idx],
|
|
1814
1819
|
ok: true,
|
|
1815
1820
|
warn: true,
|
|
1816
|
-
detail: "No @mushi-mushi/*
|
|
1821
|
+
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
1822
|
};
|
|
1818
1823
|
}
|
|
1819
1824
|
}
|
|
@@ -1902,7 +1907,7 @@ async function runInit(options = {}) {
|
|
|
1902
1907
|
const credentials = await acquireCredentials(options, consoleBase, endpoint);
|
|
1903
1908
|
await verifyCredentials(credentials, options, consoleBase);
|
|
1904
1909
|
const pm = detectPackageManager(cwd);
|
|
1905
|
-
const packagesToInstall = framework.needsWebPackage ? [framework.packageName, "
|
|
1910
|
+
const packagesToInstall = framework.needsWebPackage ? [framework.packageName, "mushi-mushi"] : [framework.packageName];
|
|
1906
1911
|
if (!options.skipInstall) {
|
|
1907
1912
|
await installPackages(pm, packagesToInstall, cwd);
|
|
1908
1913
|
} else {
|
|
@@ -1948,7 +1953,7 @@ function maybeSuggestAudit(pkg) {
|
|
|
1948
1953
|
...pkg?.dependencies,
|
|
1949
1954
|
...pkg?.devDependencies
|
|
1950
1955
|
};
|
|
1951
|
-
if (Object.keys(deps2).some(
|
|
1956
|
+
if (Object.keys(deps2).some(isMushiSdkPackage)) {
|
|
1952
1957
|
p.log.info(
|
|
1953
1958
|
"A Mushi SDK is already installed here. To health-check the existing setup instead, run `npx mushi-mushi --audit`."
|
|
1954
1959
|
);
|
|
@@ -1980,7 +1985,7 @@ async function chooseFramework(detected, options) {
|
|
|
1980
1985
|
options: Object.values(FRAMEWORKS).map((fw) => ({
|
|
1981
1986
|
value: fw.id,
|
|
1982
1987
|
label: `${fw.id === detected.id ? "\u2713 " : " "}${fw.label}`,
|
|
1983
|
-
hint: fw.
|
|
1988
|
+
hint: fw.importPath
|
|
1984
1989
|
}))
|
|
1985
1990
|
});
|
|
1986
1991
|
if (p.isCancel(confirmed)) {
|
|
@@ -2526,7 +2531,7 @@ function emitWizardFunnelEvent(credentials, endpoint, event, metadata = {}) {
|
|
|
2526
2531
|
}
|
|
2527
2532
|
async function maybeInjectSnippet(cwd, framework, options) {
|
|
2528
2533
|
if (options.yes || !process.stdin.isTTY) return;
|
|
2529
|
-
const { ENTRY_CANDIDATES, injectSnippet, MUSHI_MARKER_START } = await import("./snippet-inject-
|
|
2534
|
+
const { ENTRY_CANDIDATES, injectSnippet, MUSHI_MARKER_START } = await import("./snippet-inject-ETGBPDYB.js");
|
|
2530
2535
|
const candidates = ENTRY_CANDIDATES[framework.id];
|
|
2531
2536
|
if (!candidates) return;
|
|
2532
2537
|
const { readFile: readFile3, writeFile: writeFile3 } = await import("fs/promises");
|
|
@@ -2553,11 +2558,11 @@ function printNextSteps(framework, consoleBase, enableRewards = false) {
|
|
|
2553
2558
|
p.note(framework.snippet(), "Add this to your app:");
|
|
2554
2559
|
if (enableRewards) {
|
|
2555
2560
|
const badgeSnippet = framework.id === "react" ? `// Add to your user menu or profile UI:
|
|
2556
|
-
import { MushiRewardsBadge } from '
|
|
2561
|
+
import { MushiRewardsBadge } from 'mushi-mushi/react';
|
|
2557
2562
|
|
|
2558
2563
|
// Inside your component:
|
|
2559
2564
|
<MushiRewardsBadge showPoints />` : `// Add to your user menu:
|
|
2560
|
-
// import { MushiRewardsBadge } from '
|
|
2565
|
+
// import { MushiRewardsBadge } from 'mushi-mushi/react';
|
|
2561
2566
|
// <MushiRewardsBadge showPoints />`;
|
|
2562
2567
|
p.note(badgeSnippet, "Rewards badge snippet:");
|
|
2563
2568
|
p.log.info(`Enable rewards in your project settings at ${consoleUrl(consoleBase, "/rewards")}`);
|
|
@@ -2582,7 +2587,7 @@ async function maybeOfferConnect(credentials, options, _consoleBase) {
|
|
|
2582
2587
|
if (p.isCancel(answer) || !answer) return;
|
|
2583
2588
|
const endpoint = resolveCloudEndpoint(options.endpoint);
|
|
2584
2589
|
try {
|
|
2585
|
-
const { runConnect: runConnect2 } = await import("./connect-
|
|
2590
|
+
const { runConnect: runConnect2 } = await import("./connect-RZV3PXP3.js");
|
|
2586
2591
|
const saved = loadConfig();
|
|
2587
2592
|
const result = await runConnect2(
|
|
2588
2593
|
{
|
|
@@ -5118,14 +5123,36 @@ import { resolve as resolve2 } from "path";
|
|
|
5118
5123
|
import { execSync } from "child_process";
|
|
5119
5124
|
var SAFE_NPM_VERSION = /^\d+\.\d+\.\d+(-[\w.]+)?$/;
|
|
5120
5125
|
var MUSHI_PACKAGES = [
|
|
5126
|
+
// The one package users install (ADR 0060). The scoped names below keep
|
|
5127
|
+
// working for apps that installed them before.
|
|
5128
|
+
"mushi-mushi",
|
|
5121
5129
|
"@mushi-mushi/web",
|
|
5122
5130
|
"@mushi-mushi/core",
|
|
5123
5131
|
"@mushi-mushi/react",
|
|
5132
|
+
"@mushi-mushi/vue",
|
|
5133
|
+
"@mushi-mushi/svelte",
|
|
5134
|
+
"@mushi-mushi/angular",
|
|
5124
5135
|
"@mushi-mushi/react-native",
|
|
5125
5136
|
"@mushi-mushi/capacitor",
|
|
5126
5137
|
"@mushi-mushi/node",
|
|
5127
5138
|
"@mushi-mushi/cli"
|
|
5128
5139
|
];
|
|
5140
|
+
var IN_UMBRELLA = /* @__PURE__ */ new Set([
|
|
5141
|
+
"@mushi-mushi/web",
|
|
5142
|
+
"@mushi-mushi/core",
|
|
5143
|
+
"@mushi-mushi/react",
|
|
5144
|
+
"@mushi-mushi/vue",
|
|
5145
|
+
"@mushi-mushi/svelte",
|
|
5146
|
+
"@mushi-mushi/angular",
|
|
5147
|
+
"@mushi-mushi/node"
|
|
5148
|
+
]);
|
|
5149
|
+
function umbrellaNote(entries) {
|
|
5150
|
+
if (entries.some((e) => e.name === "mushi-mushi")) return "";
|
|
5151
|
+
const scoped = entries.map((e) => e.name).filter((n) => IN_UMBRELLA.has(n));
|
|
5152
|
+
if (scoped.length === 0) return "";
|
|
5153
|
+
return `
|
|
5154
|
+
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.`;
|
|
5155
|
+
}
|
|
5129
5156
|
async function planUpgrade(cwd) {
|
|
5130
5157
|
const root = resolve2(cwd);
|
|
5131
5158
|
const pkg = readPackageJson(root);
|
|
@@ -5134,7 +5161,7 @@ async function planUpgrade(cwd) {
|
|
|
5134
5161
|
...pkg?.dependencies ?? {},
|
|
5135
5162
|
...pkg?.devDependencies ?? {}
|
|
5136
5163
|
};
|
|
5137
|
-
const installed = MUSHI_PACKAGES.filter((name) => deps2[name]);
|
|
5164
|
+
const installed = MUSHI_PACKAGES.filter((name) => deps2[name] && !isLauncherOnly(name, deps2[name]));
|
|
5138
5165
|
const entries = await Promise.all(
|
|
5139
5166
|
installed.map(async (name) => {
|
|
5140
5167
|
const current = deps2[name] ?? "";
|
|
@@ -5153,8 +5180,7 @@ async function planUpgrade(cwd) {
|
|
|
5153
5180
|
name,
|
|
5154
5181
|
current,
|
|
5155
5182
|
latest: safeLatest,
|
|
5156
|
-
willUpgrade
|
|
5157
|
-
migrateToWeb: name === "@mushi-mushi/react" && willUpgrade
|
|
5183
|
+
willUpgrade
|
|
5158
5184
|
};
|
|
5159
5185
|
})
|
|
5160
5186
|
);
|
|
@@ -5178,14 +5204,14 @@ async function runUpgrade(opts = {}) {
|
|
|
5178
5204
|
const plan = await planUpgrade(opts.cwd ?? process.cwd());
|
|
5179
5205
|
if (opts.check) {
|
|
5180
5206
|
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/*
|
|
5207
|
+
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
5208
|
return { plan, upgraded: false, message };
|
|
5183
5209
|
}
|
|
5184
5210
|
if (plan.entries.length === 0) {
|
|
5185
5211
|
return {
|
|
5186
5212
|
plan,
|
|
5187
5213
|
upgraded: false,
|
|
5188
|
-
message: "No @mushi-mushi/*
|
|
5214
|
+
message: "No Mushi Mushi package (mushi-mushi or @mushi-mushi/*) in package.json \u2014 run `npx mushi-mushi` first."
|
|
5189
5215
|
};
|
|
5190
5216
|
}
|
|
5191
5217
|
if (!plan.installCmd) {
|
|
@@ -5210,8 +5236,7 @@ async function runUpgrade(opts = {}) {
|
|
|
5210
5236
|
${plan.installCmd}`
|
|
5211
5237
|
};
|
|
5212
5238
|
}
|
|
5213
|
-
const
|
|
5214
|
-
const migrateNote = reactEntry ? "\nNote: @mushi-mushi/react is legacy \u2014 prefer @mushi-mushi/web for Vite/Capacitor/SPA apps." : "";
|
|
5239
|
+
const migrateNote = umbrellaNote(plan.entries);
|
|
5215
5240
|
return {
|
|
5216
5241
|
plan,
|
|
5217
5242
|
upgraded: true,
|
|
@@ -5329,7 +5354,7 @@ ${via}` };
|
|
|
5329
5354
|
|
|
5330
5355
|
// src/commands/upgrade-cli.ts
|
|
5331
5356
|
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", `
|
|
5357
|
+
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
5358
|
Examples:
|
|
5334
5359
|
mushi upgrade
|
|
5335
5360
|
mushi upgrade --dry-run
|
|
@@ -7809,8 +7834,8 @@ function toHex(c) {
|
|
|
7809
7834
|
function num(token, scale) {
|
|
7810
7835
|
const t = token.trim();
|
|
7811
7836
|
if (t === "none") return 0;
|
|
7812
|
-
const
|
|
7813
|
-
if (
|
|
7837
|
+
const pct3 = /^(-?[\d.]+)%$/.exec(t);
|
|
7838
|
+
if (pct3) return Number(pct3[1]) / 100 * scale;
|
|
7814
7839
|
const deg = /^(-?[\d.]+)(deg|turn|rad|grad)?$/.exec(t);
|
|
7815
7840
|
if (!deg) return null;
|
|
7816
7841
|
const v = Number(deg[1]);
|
|
@@ -10262,6 +10287,143 @@ function registerCodeHealthCommands(program2) {
|
|
|
10262
10287
|
});
|
|
10263
10288
|
}
|
|
10264
10289
|
|
|
10290
|
+
// src/commands/journeys.ts
|
|
10291
|
+
var JOURNEY_KINDS = [
|
|
10292
|
+
"broken",
|
|
10293
|
+
"dead_end",
|
|
10294
|
+
"high_exit",
|
|
10295
|
+
"loop",
|
|
10296
|
+
"reload",
|
|
10297
|
+
"duplicate_page",
|
|
10298
|
+
"route_variant",
|
|
10299
|
+
"duplicate_title",
|
|
10300
|
+
"orphan",
|
|
10301
|
+
"deep_page",
|
|
10302
|
+
"unvisited"
|
|
10303
|
+
];
|
|
10304
|
+
var DAY_OPTIONS = ["7", "30", "90"];
|
|
10305
|
+
function safeBlock(text2) {
|
|
10306
|
+
return String(text2 ?? "").replace(/[\u0000-\u0009\u000b-\u001f\u007f]+/g, " ").trim();
|
|
10307
|
+
}
|
|
10308
|
+
function pct(n) {
|
|
10309
|
+
return n == null ? "\u2014" : `${Math.round(n * 100)}%`;
|
|
10310
|
+
}
|
|
10311
|
+
function renderJourneys(data, findings, opts) {
|
|
10312
|
+
const { stats, score, flows } = data.map;
|
|
10313
|
+
const lines = [
|
|
10314
|
+
`Journeys \xB7 last ${data.days} days \xB7 score ${score}/100`,
|
|
10315
|
+
`${stats.sessions} session(s) \xB7 ${stats.pageViews} page view(s) \xB7 ${stats.pages} page(s) \xB7 ${stats.avgPagesPerSession ?? "\u2014"} pages/session \xB7 bounce ${pct(stats.bounceRate)}${stats.sampled ? " (newest visits sampled)" : ""}`
|
|
10316
|
+
];
|
|
10317
|
+
if (data.mapScan) {
|
|
10318
|
+
lines.push(`Site scan: ${data.mapScan.pageCount} page(s) of ${oneLine(data.mapScan.baseUrl, 80)}, ${fmtDate(data.mapScan.finishedAt ?? data.mapScan.createdAt)}`);
|
|
10319
|
+
} else {
|
|
10320
|
+
lines.push("No site scan yet. Run: mushi journeys scan");
|
|
10321
|
+
}
|
|
10322
|
+
if (data.scan?.status === "running") lines.push("A scan is running; it usually takes a few minutes.");
|
|
10323
|
+
else if (data.scan?.status === "failed" && data.scan.error) lines.push(`The last scan failed: ${oneLine(data.scan.error, 160)}`);
|
|
10324
|
+
if (flows.length > 0) {
|
|
10325
|
+
lines.push("", "Common paths:");
|
|
10326
|
+
for (const f of flows.slice(0, 5)) lines.push(` ${f.sessions}\xD7 ${f.pages.map((p5) => oneLine(p5, 60)).join(" \u2192 ")}`);
|
|
10327
|
+
}
|
|
10328
|
+
lines.push("");
|
|
10329
|
+
if (findings.length === 0) {
|
|
10330
|
+
lines.push(opts.kind ? `No ${opts.kind} findings.` : "No findings: nothing in the map gets in people's way.");
|
|
10331
|
+
return lines;
|
|
10332
|
+
}
|
|
10333
|
+
lines.push(opts.kind ? `${findings.length} ${opts.kind} finding(s):` : `${findings.length} finding(s):`);
|
|
10334
|
+
for (const f of findings) {
|
|
10335
|
+
lines.push(` ${f.severity.toUpperCase().padEnd(6)} ${oneLine(f.title, 110)} [${f.kind}]`);
|
|
10336
|
+
if (f.pages.length > 0) lines.push(` Pages: ${f.pages.slice(0, 5).map((p5) => oneLine(p5, 60)).join(", ")}${f.pages.length > 5 ? ", \u2026" : ""}`);
|
|
10337
|
+
lines.push(` Fix: ${oneLine(f.suggestion, 160)}`);
|
|
10338
|
+
if (opts.prompts) {
|
|
10339
|
+
lines.push(" Prompt:");
|
|
10340
|
+
for (const l of safeBlock(f.prompt).split("\n")) lines.push(` ${l}`);
|
|
10341
|
+
}
|
|
10342
|
+
}
|
|
10343
|
+
if (!opts.prompts) lines.push("", "Add --prompts for a ready prompt per finding to paste into your coding agent.");
|
|
10344
|
+
return lines;
|
|
10345
|
+
}
|
|
10346
|
+
function registerJourneysCommands(program2) {
|
|
10347
|
+
const journeys = program2.command("journeys").description("Where people get stuck in your app, with a fix prompt per finding (Journey optimizer)").option("--project-id <id>", "Project ID (defaults to the configured project)").option("--days <n>", "Window of visits: 7, 30 or 90", "30").option("--kind <kind>", `Only findings of one kind (${JOURNEY_KINDS.join(", ")})`).option("--prompts", "Print each finding's prompt for a coding agent").option("--json", "Machine-readable JSON output (the whole map)").addHelpText("after", `
|
|
10348
|
+
Examples:
|
|
10349
|
+
mushi journeys
|
|
10350
|
+
mushi journeys --days 90 --kind dead_end --prompts
|
|
10351
|
+
mushi journeys scan --url https://example.com
|
|
10352
|
+
mushi journeys record --hours 24 --sample 0.1`).action(async (opts) => {
|
|
10353
|
+
if (!DAY_OPTIONS.includes(opts.days)) throw new MushiCliError("E_INVALID_INPUT", "--days must be 7, 30 or 90");
|
|
10354
|
+
if (opts.kind && !JOURNEY_KINDS.includes(opts.kind)) {
|
|
10355
|
+
throw new MushiCliError("E_INVALID_INPUT", `--kind must be one of ${JOURNEY_KINDS.join(", ")}`);
|
|
10356
|
+
}
|
|
10357
|
+
const config = requireConfig();
|
|
10358
|
+
const projectId2 = resolveProjectId(opts.projectId, config.projectId);
|
|
10359
|
+
const result = await apiCall(`/v1/admin/projects/${encodeURIComponent(projectId2)}/journeys?days=${opts.days}`, config);
|
|
10360
|
+
if (!result.ok) die(result);
|
|
10361
|
+
const data = result.data;
|
|
10362
|
+
const findings = opts.kind ? data.map.findings.filter((f) => f.kind === opts.kind) : data.map.findings;
|
|
10363
|
+
if (outputIsJson(opts.json)) {
|
|
10364
|
+
console.log(JSON.stringify({ ...data, map: { ...data.map, findings } }, null, 2));
|
|
10365
|
+
return;
|
|
10366
|
+
}
|
|
10367
|
+
for (const line of renderJourneys(data, findings, opts)) console.log(line);
|
|
10368
|
+
});
|
|
10369
|
+
journeys.command("scan").description("Scan the live site (up to 40 pages, no LLM) so the map knows its links; at most once every 10 minutes").option("--project-id <id>", "Project ID (defaults to the configured project)").option("--url <url>", "The site's public https:// address (defaults to the one Mushi Mushi already knows)").option("--json", "Machine-readable JSON output").action(async (opts) => {
|
|
10370
|
+
const config = requireConfig();
|
|
10371
|
+
const projectId2 = resolveProjectId(opts.projectId, config.projectId);
|
|
10372
|
+
const result = await apiCall(`/v1/admin/projects/${encodeURIComponent(projectId2)}/journeys/scan`, config, {
|
|
10373
|
+
method: "POST",
|
|
10374
|
+
body: JSON.stringify(opts.url ? { base_url: opts.url } : {})
|
|
10375
|
+
});
|
|
10376
|
+
if (!result.ok) die(result);
|
|
10377
|
+
if (outputIsJson(opts.json)) {
|
|
10378
|
+
console.log(JSON.stringify(result.data, null, 2));
|
|
10379
|
+
return;
|
|
10380
|
+
}
|
|
10381
|
+
const s = result.data.scan;
|
|
10382
|
+
console.log(`Scan started for ${oneLine(s.baseUrl, 100)} [${s.id}].`);
|
|
10383
|
+
console.log("It usually takes a few minutes. Then run: mushi journeys");
|
|
10384
|
+
});
|
|
10385
|
+
journeys.command("record").description("Open, extend or stop the visit recording window for apps whose SDK uses trackSessions: 'on-demand'").option("--project-id <id>", "Project ID (defaults to the configured project)").option("--hours <n>", `Record for this many hours from now (1-${RECORDING_MAX_HOURS}); 0 stops`).option("--sample <rate>", "Share of visitors to record, above 0 and at most 1 (0.1 = one in ten; unset keeps the current share)").option("--stop", "Stop recording now (same as --hours 0)").option("--json", "Machine-readable JSON output").addHelpText("after", `
|
|
10386
|
+
Examples:
|
|
10387
|
+
mushi journeys record --hours 24 --sample 0.1
|
|
10388
|
+
mushi journeys record --stop`).action(async (opts) => {
|
|
10389
|
+
const body = recordingBody(opts);
|
|
10390
|
+
const config = requireConfig();
|
|
10391
|
+
const projectId2 = resolveProjectId(opts.projectId, config.projectId);
|
|
10392
|
+
const result = await apiCall(
|
|
10393
|
+
`/v1/admin/projects/${encodeURIComponent(projectId2)}/journeys/recording`,
|
|
10394
|
+
config,
|
|
10395
|
+
{ method: "PUT", body: JSON.stringify(body) }
|
|
10396
|
+
);
|
|
10397
|
+
if (!result.ok) die(result);
|
|
10398
|
+
if (outputIsJson(opts.json)) {
|
|
10399
|
+
console.log(JSON.stringify(result.data, null, 2));
|
|
10400
|
+
return;
|
|
10401
|
+
}
|
|
10402
|
+
const r = result.data.recording;
|
|
10403
|
+
if (!r.until) {
|
|
10404
|
+
console.log("Recording is off. Apps with trackSessions: 'on-demand' send no visits until you open a new window.");
|
|
10405
|
+
return;
|
|
10406
|
+
}
|
|
10407
|
+
console.log(`Recording ${Math.round(r.sampleRate * 100)}% of visitors until ${fmtDate(r.until)}.`);
|
|
10408
|
+
console.log("Only apps whose SDK uses trackSessions: 'on-demand' wait for this window. Read the results with: mushi journeys");
|
|
10409
|
+
});
|
|
10410
|
+
}
|
|
10411
|
+
var RECORDING_MAX_HOURS = 168;
|
|
10412
|
+
function recordingBody(opts) {
|
|
10413
|
+
if (opts.stop && opts.hours !== void 0) throw new MushiCliError("E_INVALID_INPUT", "Pass --hours or --stop, not both.");
|
|
10414
|
+
if (!opts.stop && opts.hours === void 0) {
|
|
10415
|
+
throw new MushiCliError("E_INVALID_INPUT", "Pass --hours <n> to record, or --stop.", "e.g. mushi journeys record --hours 24 --sample 0.1");
|
|
10416
|
+
}
|
|
10417
|
+
const hours = opts.stop ? 0 : Number(opts.hours);
|
|
10418
|
+
if (!Number.isInteger(hours) || hours < 0 || hours > RECORDING_MAX_HOURS) {
|
|
10419
|
+
throw new MushiCliError("E_INVALID_INPUT", `--hours must be a whole number from 0 to ${RECORDING_MAX_HOURS}`);
|
|
10420
|
+
}
|
|
10421
|
+
if (opts.sample === void 0) return { hours };
|
|
10422
|
+
const rate = Number(opts.sample);
|
|
10423
|
+
if (!(rate > 0 && rate <= 1)) throw new MushiCliError("E_INVALID_INPUT", "--sample must be above 0 and at most 1 (0.1 = one visitor in ten)");
|
|
10424
|
+
return { hours, sample_rate: rate };
|
|
10425
|
+
}
|
|
10426
|
+
|
|
10265
10427
|
// src/commands/releases.ts
|
|
10266
10428
|
import { readFileSync as readFileSync6 } from "fs";
|
|
10267
10429
|
var DRAFT_TIMEOUT_MS = 12e4;
|
|
@@ -12176,7 +12338,7 @@ function formatDuration(s) {
|
|
|
12176
12338
|
if (s < 90 * 60) return `${Math.round(s / 60)} min`;
|
|
12177
12339
|
return `${Math.round(s / 3600 * 10) / 10} h`;
|
|
12178
12340
|
}
|
|
12179
|
-
function
|
|
12341
|
+
function pct2(n) {
|
|
12180
12342
|
return typeof n === "number" && Number.isFinite(n) ? `${Math.round(n * 100)}%` : "\u2014";
|
|
12181
12343
|
}
|
|
12182
12344
|
function runsOnLabel(r) {
|
|
@@ -12214,7 +12376,7 @@ function renderCompare(data, opts = {}) {
|
|
|
12214
12376
|
const repo = `${row.repo}${v === "public" ? " (public)" : v === "private" ? " (private)" : ""}`;
|
|
12215
12377
|
const cost = row.costBasis === "github_public_free" ? "free" : row.costBasis === "github_larger_unpriced" ? "unpriced" : formatMoney(row.monthCost, row.currency);
|
|
12216
12378
|
lines.push(
|
|
12217
|
-
`${pad2(repo, 36)} ${pad2(runsOnLabel(row), 44)} ${String(row.jobs ?? 0).padStart(5)} ${formatDuration(row.queueP95s).padStart(9)} ${formatDuration(row.runP50s).padStart(8)} ${
|
|
12379
|
+
`${pad2(repo, 36)} ${pad2(runsOnLabel(row), 44)} ${String(row.jobs ?? 0).padStart(5)} ${formatDuration(row.queueP95s).padStart(9)} ${formatDuration(row.runP50s).padStart(8)} ${pct2(row.prPassRate).padStart(8)} ${String(row.billedMinutes ?? 0).padStart(7)} ${cost.padStart(13)}`
|
|
12218
12380
|
);
|
|
12219
12381
|
}
|
|
12220
12382
|
if (rows.length > (opts.maxRows ?? 40)) lines.push(` \u2026 ${rows.length - (opts.maxRows ?? 40)} more (use --json)`);
|
|
@@ -12222,7 +12384,7 @@ function renderCompare(data, opts = {}) {
|
|
|
12222
12384
|
if (machines.length > 0) {
|
|
12223
12385
|
lines.push("", "Your machines (busy time counts parallel jobs once; electricity is the extra draw under load, your figures):");
|
|
12224
12386
|
for (const m of machines) {
|
|
12225
|
-
lines.push(` ${m.name}${m.online === false ? " (offline)" : ""}: busy ${m.busyHours ?? 0} h (${
|
|
12387
|
+
lines.push(` ${m.name}${m.online === false ? " (offline)" : ""}: busy ${m.busyHours ?? 0} h (${pct2(m.busyShare)}) \xB7 electricity ${formatMoney(m.monthEnergyCost, m.currency)}/month \xB7 wear ${formatMoney(m.monthWearCost, m.currency)}/month \xB7 wait p95 ${formatDuration(m.queueP95s)}`);
|
|
12226
12388
|
}
|
|
12227
12389
|
}
|
|
12228
12390
|
const measured = (data.speed ?? []).filter((s) => s.factor != null);
|
|
@@ -13779,6 +13941,7 @@ registerPortfolioCommands(program);
|
|
|
13779
13941
|
registerConnectorsCommands(program);
|
|
13780
13942
|
registerFunnelCommands(program);
|
|
13781
13943
|
registerCodeHealthCommands(program);
|
|
13944
|
+
registerJourneysCommands(program);
|
|
13782
13945
|
registerReleasesCommands(program);
|
|
13783
13946
|
registerSentryCommands(program);
|
|
13784
13947
|
registerOutboxCommands(program);
|