@mushi-mushi/cli 0.40.2 → 0.40.3
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-TNTSV54C.js → chunk-4JF7C3MY.js} +6 -0
- package/dist/{chunk-2WDMI34E.js → chunk-5TO6PSO6.js} +3 -3
- package/dist/{chunk-TR7CGZKJ.js → chunk-6ZQFL7SD.js} +266 -32
- package/dist/{chunk-ASM3AHHH.js → chunk-CGQE3GJK.js} +21 -1
- package/dist/{chunk-IKBJJKZX.js → chunk-HNVCLEDF.js} +6 -2
- package/dist/{chunk-6XXPTPFA.js → chunk-JXGVZWRL.js} +25 -1
- package/dist/{snippet-inject-AVGVHTUJ.js → chunk-LFP3NPZT.js} +5 -4
- package/dist/chunk-LWFREQOK.js +8 -0
- package/dist/{snippet-inject-ETGBPDYB.js → chunk-ZDAN3RYF.js} +5 -4
- package/dist/chunk-ZVNRKEVP.js +10 -0
- package/dist/{connect-H52HI4HK.js → connect-FNGAJ532.js} +3 -3
- package/dist/{connect-RKVNHJ6F.js → connect-OJXHNDFB.js} +2 -2
- package/dist/{daemon-ZKCBN6M6.js → daemon-PPOAKQNF.js} +3 -3
- package/dist/index.js +825 -387
- package/dist/init.d.ts +137 -2
- package/dist/init.js +22 -5
- package/dist/snippet-inject-BQO5I2RN.js +15 -0
- package/dist/snippet-inject-CSXHMN7P.js +14 -0
- package/dist/{version-42UVFP3L.js → version-I4APZBTF.js} +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wizard-args.d.ts +2 -0
- package/dist/wizard-args.js +1 -1
- package/dist/wizard-bin.d.ts +7 -1
- package/dist/wizard-bin.js +19 -6
- package/package.json +1 -1
- package/dist/chunk-VACQJBUV.js +0 -8
- package/dist/chunk-VDC2434D.js +0 -10
package/dist/init.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FrameworkId } from './detect.js';
|
|
1
|
+
import { Framework, PackageManager, FrameworkId } from './detect.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* FILE: packages/cli/src/config.ts
|
|
@@ -102,6 +102,29 @@ declare function mintProjectKey(endpoint: string, cliToken: string, projectId: s
|
|
|
102
102
|
label?: string;
|
|
103
103
|
}): Promise<string>;
|
|
104
104
|
|
|
105
|
+
/**
|
|
106
|
+
* FILE: packages/cli/src/freshness.ts
|
|
107
|
+
* PURPOSE: Best-effort "there's a newer version" hint on wizard start.
|
|
108
|
+
*
|
|
109
|
+
* Matches the pattern used by `create-next-app` and `sentry-wizard`. Users
|
|
110
|
+
* who run `npx mushi-mushi` often hit a cached launcher for days — we
|
|
111
|
+
* politely suggest the upgrade path but never block the wizard.
|
|
112
|
+
*
|
|
113
|
+
* - 2s timeout, fails silent on network errors
|
|
114
|
+
* - Opt out via MUSHI_NO_UPDATE_CHECK=1
|
|
115
|
+
* - Uses a naive semver compare, no extra deps
|
|
116
|
+
*/
|
|
117
|
+
interface FreshnessResult {
|
|
118
|
+
current: string;
|
|
119
|
+
latest: string;
|
|
120
|
+
isOutdated: boolean;
|
|
121
|
+
}
|
|
122
|
+
declare function checkFreshness(packageName: string, currentVersion: string, opts?: {
|
|
123
|
+
timeoutMs?: number;
|
|
124
|
+
registry?: string;
|
|
125
|
+
ignoreOptOut?: boolean;
|
|
126
|
+
}): Promise<FreshnessResult | null>;
|
|
127
|
+
|
|
105
128
|
/**
|
|
106
129
|
* FILE: packages/cli/src/init.ts
|
|
107
130
|
* PURPOSE: `mushi init` wizard — detects framework, asks for credentials,
|
|
@@ -122,7 +145,23 @@ interface InitOptions {
|
|
|
122
145
|
sendTestReport?: boolean;
|
|
123
146
|
/** Audit an existing install (doctor checks) instead of running the wizard. */
|
|
124
147
|
audit?: boolean;
|
|
148
|
+
/** Print what the wizard would do and stop: no files, no install, no sign-in. */
|
|
149
|
+
dryRun?: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Which package to check for a newer version. The `mushi-mushi` and
|
|
152
|
+
* `create-mushi-mushi` bins pass their own; `mushi init` defaults to the CLI.
|
|
153
|
+
*/
|
|
154
|
+
freshness?: FreshnessSource;
|
|
125
155
|
}
|
|
156
|
+
/** A package and the version of it that is running, for the "newer version" hint. */
|
|
157
|
+
interface FreshnessSource {
|
|
158
|
+
packageName: string;
|
|
159
|
+
version: string;
|
|
160
|
+
/** What to run to get the newest version. */
|
|
161
|
+
upgradeCommand: string;
|
|
162
|
+
}
|
|
163
|
+
/** `mushi init` run straight from the CLI: compare the CLI with the CLI. */
|
|
164
|
+
declare const CLI_FRESHNESS_SOURCE: FreshnessSource;
|
|
126
165
|
/**
|
|
127
166
|
* The keys the wizard ends up with, one per destination. `sdkKey` goes into
|
|
128
167
|
* the app's env vars, which ship inside the bundle the end user downloads, so
|
|
@@ -216,5 +255,101 @@ declare function isEnvFileCoveredByGitignore(gitignoreContent: string, envFile:
|
|
|
216
255
|
* without a browser sign-in.
|
|
217
256
|
*/
|
|
218
257
|
declare function planCliConfigUpdate(existing: CliConfig, credentials: WizardCredentials, endpoint: string): CliConfig;
|
|
258
|
+
/**
|
|
259
|
+
* Where the init snippet goes for a framework: the injectable entry file that
|
|
260
|
+
* exists, or the file named in the snippet's first comment for a human to
|
|
261
|
+
* edit. Read-only; the caller decides whether to write `next`.
|
|
262
|
+
*/
|
|
263
|
+
type SnippetPlan = {
|
|
264
|
+
kind: 'inject';
|
|
265
|
+
/** Path relative to the app root, e.g. `src/main.ts`. */
|
|
266
|
+
file: string;
|
|
267
|
+
abs: string;
|
|
268
|
+
/** The file's content with the marker block added or refreshed. */
|
|
269
|
+
next: string;
|
|
270
|
+
alreadyInjected: boolean;
|
|
271
|
+
/** The block is already there and up to date: nothing to write. */
|
|
272
|
+
unchanged: boolean;
|
|
273
|
+
} | {
|
|
274
|
+
kind: 'manual';
|
|
275
|
+
/** Where to paste the snippet, from its first comment line. */
|
|
276
|
+
target: string;
|
|
277
|
+
};
|
|
278
|
+
/**
|
|
279
|
+
* The file a framework's snippet says it belongs in ("src/main.tsx",
|
|
280
|
+
* "app/providers.tsx (or pages/_app.tsx …)"), from its first `//` comment.
|
|
281
|
+
* @internal Exported for tests only.
|
|
282
|
+
*/
|
|
283
|
+
declare function snippetTarget(framework: Framework): string;
|
|
284
|
+
/**
|
|
285
|
+
* Plan the snippet edit with the same idempotent marker injection for every
|
|
286
|
+
* mode. Only frameworks in ENTRY_CANDIDATES (a plain top-of-file import) are
|
|
287
|
+
* ever edited; JSX providers have to wrap the render tree, which stays a
|
|
288
|
+
* human edit.
|
|
289
|
+
*/
|
|
290
|
+
declare function planSnippetInjection(cwd: string, framework: Framework): Promise<SnippetPlan>;
|
|
291
|
+
/** What happened to the init snippet, for the next-steps checklist. */
|
|
292
|
+
type SnippetOutcome = {
|
|
293
|
+
kind: 'written';
|
|
294
|
+
file: string;
|
|
295
|
+
} | {
|
|
296
|
+
kind: 'manual';
|
|
297
|
+
target: string;
|
|
298
|
+
};
|
|
299
|
+
/**
|
|
300
|
+
* Put the init snippet in the entry file when that is safe (see
|
|
301
|
+
* planSnippetInjection). Interactive runs ask first; `--yes` runs apply it
|
|
302
|
+
* without asking, since the edit is a marker block a re-run replaces. When
|
|
303
|
+
* nothing can be edited, say exactly which file to paste into.
|
|
304
|
+
* @internal Exported for tests only.
|
|
305
|
+
*/
|
|
306
|
+
declare function applySnippetPlan(plan: SnippetPlan, opts: {
|
|
307
|
+
yes: boolean;
|
|
308
|
+
confirm: (message: string) => Promise<boolean>;
|
|
309
|
+
}): Promise<SnippetOutcome>;
|
|
310
|
+
/**
|
|
311
|
+
* The "newer version" line, or null. Compares a package with its own latest
|
|
312
|
+
* on npm: the launcher with the launcher, the CLI with the CLI. (Comparing
|
|
313
|
+
* the CLI's 0.x with the launcher's 1.x warned on every run, even @latest.)
|
|
314
|
+
* A dev build has no published version to compare, so it never warns.
|
|
315
|
+
* @internal Exported for tests only.
|
|
316
|
+
*/
|
|
317
|
+
declare function freshnessHint(source: FreshnessSource, check?: typeof checkFreshness): Promise<string | null>;
|
|
318
|
+
/**
|
|
319
|
+
* True when the CLI config will hold only the app's ingest key, so the
|
|
320
|
+
* stdio MCP server (which reads that config) would start in setup mode.
|
|
321
|
+
* A key kept from an earlier sign-in is assumed to be the login key.
|
|
322
|
+
* @internal Exported for tests only.
|
|
323
|
+
*/
|
|
324
|
+
declare function needsEditorKey(saved: Pick<CliConfig, 'apiKey'>, credentials: WizardCredentials): boolean;
|
|
325
|
+
/**
|
|
326
|
+
* The smallest code that sends a real bug report from the user's own app,
|
|
327
|
+
* so the first report they see came from their app, not from this terminal.
|
|
328
|
+
* Printed only: the wizard never adds a page or button to the app.
|
|
329
|
+
*/
|
|
330
|
+
declare function sampleBugSnippet(framework: FrameworkId): string;
|
|
331
|
+
/** Inputs for planInitDryRun, gathered with read-only checks. */
|
|
332
|
+
interface DryRunInput {
|
|
333
|
+
cwd: string;
|
|
334
|
+
framework: Framework;
|
|
335
|
+
/** How the framework was chosen. */
|
|
336
|
+
frameworkSource: 'flag' | 'detected';
|
|
337
|
+
pm: PackageManager;
|
|
338
|
+
hasPackageJson: boolean;
|
|
339
|
+
endpoint: string;
|
|
340
|
+
options: Pick<InitOptions, 'projectId' | 'apiKey' | 'skipInstall' | 'sendTestReport' | 'yes'>;
|
|
341
|
+
/** What a previous sign-in saved. Only presence and the project id are used. */
|
|
342
|
+
saved: {
|
|
343
|
+
projectId?: string;
|
|
344
|
+
hasKey: boolean;
|
|
345
|
+
};
|
|
346
|
+
snippet: SnippetPlan;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* What a real run would do, line by line. Reads the env file to tell "add"
|
|
350
|
+
* from "update", and writes nothing.
|
|
351
|
+
* @internal Exported for tests only.
|
|
352
|
+
*/
|
|
353
|
+
declare function planInitDryRun(input: DryRunInput): string[];
|
|
219
354
|
|
|
220
|
-
export { type InitOptions, type SavedCredentialsResolution, type WizardCredentials, type WizardMintDeps, type WizardMintResult, type WizardMintTarget, isEnvFileCoveredByGitignore, mintWizardKeys, planCliConfigUpdate, resolveSavedCredentials, runInit, sanitizeSecret };
|
|
355
|
+
export { CLI_FRESHNESS_SOURCE, type DryRunInput, type FreshnessSource, type InitOptions, type SavedCredentialsResolution, type SnippetOutcome, type SnippetPlan, type WizardCredentials, type WizardMintDeps, type WizardMintResult, type WizardMintTarget, applySnippetPlan, freshnessHint, isEnvFileCoveredByGitignore, mintWizardKeys, needsEditorKey, planCliConfigUpdate, planInitDryRun, planSnippetInjection, resolveSavedCredentials, runInit, sampleBugSnippet, sanitizeSecret, snippetTarget };
|
package/dist/init.js
CHANGED
|
@@ -1,20 +1,37 @@
|
|
|
1
1
|
import {
|
|
2
|
+
CLI_FRESHNESS_SOURCE,
|
|
3
|
+
applySnippetPlan,
|
|
4
|
+
freshnessHint,
|
|
2
5
|
isEnvFileCoveredByGitignore,
|
|
3
6
|
mintWizardKeys,
|
|
7
|
+
needsEditorKey,
|
|
4
8
|
planCliConfigUpdate,
|
|
9
|
+
planInitDryRun,
|
|
10
|
+
planSnippetInjection,
|
|
5
11
|
resolveSavedCredentials,
|
|
6
12
|
runInit,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
sampleBugSnippet,
|
|
14
|
+
sanitizeSecret,
|
|
15
|
+
snippetTarget
|
|
16
|
+
} from "./chunk-6ZQFL7SD.js";
|
|
17
|
+
import "./chunk-LFP3NPZT.js";
|
|
18
|
+
import "./chunk-JXGVZWRL.js";
|
|
19
|
+
import "./chunk-LWFREQOK.js";
|
|
11
20
|
import "./chunk-AWASJDQI.js";
|
|
12
21
|
import "./chunk-2DMHQVRU.js";
|
|
13
22
|
export {
|
|
23
|
+
CLI_FRESHNESS_SOURCE,
|
|
24
|
+
applySnippetPlan,
|
|
25
|
+
freshnessHint,
|
|
14
26
|
isEnvFileCoveredByGitignore,
|
|
15
27
|
mintWizardKeys,
|
|
28
|
+
needsEditorKey,
|
|
16
29
|
planCliConfigUpdate,
|
|
30
|
+
planInitDryRun,
|
|
31
|
+
planSnippetInjection,
|
|
17
32
|
resolveSavedCredentials,
|
|
18
33
|
runInit,
|
|
19
|
-
|
|
34
|
+
sampleBugSnippet,
|
|
35
|
+
sanitizeSecret,
|
|
36
|
+
snippetTarget
|
|
20
37
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
ENTRY_CANDIDATES,
|
|
4
|
+
MUSHI_MARKER_END,
|
|
5
|
+
MUSHI_MARKER_START,
|
|
6
|
+
findSdkImport,
|
|
7
|
+
injectSnippet
|
|
8
|
+
} from "./chunk-ZDAN3RYF.js";
|
|
9
|
+
export {
|
|
10
|
+
ENTRY_CANDIDATES,
|
|
11
|
+
MUSHI_MARKER_END,
|
|
12
|
+
MUSHI_MARKER_START,
|
|
13
|
+
findSdkImport,
|
|
14
|
+
injectSnippet
|
|
15
|
+
};
|
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.31.
|
|
17
|
+
declare const MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.31.5";
|
|
18
18
|
|
|
19
19
|
export { MUSHI_CLI_VERSION, MUSHI_MCP_PIN_SPEC };
|
package/dist/version.js
CHANGED
package/dist/wizard-args.d.ts
CHANGED
|
@@ -53,6 +53,8 @@ interface ParsedArgs {
|
|
|
53
53
|
cwd?: string;
|
|
54
54
|
endpoint?: string;
|
|
55
55
|
audit?: boolean;
|
|
56
|
+
/** `--dry-run`: print what the wizard would do; change nothing. */
|
|
57
|
+
dryRun?: boolean;
|
|
56
58
|
/** `--template <id>`: scaffold a starter app instead of running the wizard. */
|
|
57
59
|
template?: TemplateId;
|
|
58
60
|
/** Optional directory right after the template id. */
|
package/dist/wizard-args.js
CHANGED
package/dist/wizard-bin.d.ts
CHANGED
|
@@ -26,7 +26,13 @@ interface WizardBinOptions {
|
|
|
26
26
|
*/
|
|
27
27
|
usage: string;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* How to run the newest wizard from a given bin: `create-mushi-mushi` runs
|
|
31
|
+
* through `npm create`, the others through `npx`.
|
|
32
|
+
* @internal Exported for tests only.
|
|
33
|
+
*/
|
|
34
|
+
declare function wizardUpgradeCommand(bin: string): string;
|
|
29
35
|
/** Run a bin's argv (`process.argv.slice(2)`), printing failures and exiting 1. */
|
|
30
36
|
declare function runWizardBin(argv: readonly string[], opts: WizardBinOptions): Promise<void>;
|
|
31
37
|
|
|
32
|
-
export { type WizardBinOptions, runWizardBin };
|
|
38
|
+
export { type WizardBinOptions, runWizardBin, wizardUpgradeCommand };
|
package/dist/wizard-bin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runInit
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6ZQFL7SD.js";
|
|
4
4
|
import {
|
|
5
5
|
FLAGS_HELP,
|
|
6
6
|
UNKNOWN_COMMAND_EXIT,
|
|
@@ -9,9 +9,10 @@ import {
|
|
|
9
9
|
newAppHint,
|
|
10
10
|
parseArgs,
|
|
11
11
|
scaffoldTemplate
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-4JF7C3MY.js";
|
|
13
|
+
import "./chunk-LFP3NPZT.js";
|
|
14
|
+
import "./chunk-JXGVZWRL.js";
|
|
15
|
+
import "./chunk-LWFREQOK.js";
|
|
15
16
|
import "./chunk-AWASJDQI.js";
|
|
16
17
|
import "./chunk-2DMHQVRU.js";
|
|
17
18
|
|
|
@@ -83,9 +84,20 @@ ${FLAGS_HELP}
|
|
|
83
84
|
cwd: parsed.cwd,
|
|
84
85
|
endpoint: parsed.endpoint,
|
|
85
86
|
sendTestReport: parsed.skipTestReport ? false : void 0,
|
|
86
|
-
audit: parsed.audit
|
|
87
|
+
audit: parsed.audit,
|
|
88
|
+
dryRun: parsed.dryRun,
|
|
89
|
+
// Compare this bin's own version with its own latest on npm; the CLI's
|
|
90
|
+
// version (0.x) against the launcher's (1.x) warned on every run.
|
|
91
|
+
freshness: {
|
|
92
|
+
packageName: opts.bin,
|
|
93
|
+
version: opts.version,
|
|
94
|
+
upgradeCommand: wizardUpgradeCommand(opts.bin)
|
|
95
|
+
}
|
|
87
96
|
});
|
|
88
97
|
}
|
|
98
|
+
function wizardUpgradeCommand(bin) {
|
|
99
|
+
return bin.startsWith("create-") ? `npm create ${bin.slice("create-".length)}@latest` : `npx ${bin}@latest`;
|
|
100
|
+
}
|
|
89
101
|
function runWizardBin(argv, opts) {
|
|
90
102
|
return main(argv, opts).catch((err) => {
|
|
91
103
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -102,5 +114,6 @@ If this is a bug, please report it at ${ISSUES_URL}
|
|
|
102
114
|
});
|
|
103
115
|
}
|
|
104
116
|
export {
|
|
105
|
-
runWizardBin
|
|
117
|
+
runWizardBin,
|
|
118
|
+
wizardUpgradeCommand
|
|
106
119
|
};
|
package/package.json
CHANGED
package/dist/chunk-VACQJBUV.js
DELETED