mushi-mushi 0.4.0 → 0.5.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 +33 -11
- package/dist/index.js +62 -24
- package/package.json +10 -3
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ npx mushi-mushi
|
|
|
8
8
|
|
|
9
9
|
That's it. The wizard auto-detects your framework, installs the right SDK package, writes your env vars, and prints the snippet to paste into your app.
|
|
10
10
|
|
|
11
|
-
## What
|
|
11
|
+
## What it does
|
|
12
12
|
|
|
13
13
|
1. **Detects your framework** — Next.js, Nuxt, SvelteKit, Angular, Expo, Capacitor, plain React/Vue/Svelte, or vanilla JS — by reading `package.json` and looking for config files.
|
|
14
14
|
2. **Picks the right SDK** — installs `@mushi-mushi/react`, `@mushi-mushi/vue`, `@mushi-mushi/svelte`, `@mushi-mushi/angular`, `@mushi-mushi/react-native`, `@mushi-mushi/capacitor`, or `@mushi-mushi/web` depending on what you're using.
|
|
@@ -16,6 +16,7 @@ That's it. The wizard auto-detects your framework, installs the right SDK packag
|
|
|
16
16
|
4. **Writes env vars** — `MUSHI_PROJECT_ID` and `MUSHI_API_KEY` go into `.env.local` with the right framework prefix (`NEXT_PUBLIC_`, `NUXT_PUBLIC_`, or `VITE_`).
|
|
17
17
|
5. **Warns about `.gitignore`** — never commits secrets if `.env.local` isn't ignored.
|
|
18
18
|
6. **Prints the integration snippet** — framework-specific provider/init code you can paste straight in.
|
|
19
|
+
7. **Sends a test report** (opt-in) — so you see your first classified bug in the console without leaving the wizard.
|
|
19
20
|
|
|
20
21
|
It is **non-destructive**: never silently overwrites existing env vars and never modifies your application code.
|
|
21
22
|
|
|
@@ -25,7 +26,11 @@ It is **non-destructive**: never silently overwrites existing env vars and never
|
|
|
25
26
|
npx mushi-mushi --framework next # skip framework detection
|
|
26
27
|
npx mushi-mushi --project-id proj_xxx --api-key mushi_xxx
|
|
27
28
|
npx mushi-mushi --skip-install # print install command instead of running it
|
|
29
|
+
npx mushi-mushi --skip-test-report # don't offer to send a test report
|
|
30
|
+
npx mushi-mushi --cwd apps/web # run in a sub-package of a monorepo
|
|
31
|
+
npx mushi-mushi --endpoint https://mushi.your-company.com
|
|
28
32
|
npx mushi-mushi -y # accept the detected framework without prompting
|
|
33
|
+
npx mushi-mushi -v # print version
|
|
29
34
|
npx mushi-mushi --help
|
|
30
35
|
```
|
|
31
36
|
|
|
@@ -33,16 +38,32 @@ npx mushi-mushi --help
|
|
|
33
38
|
|
|
34
39
|
If you'd rather wire it up yourself, install the framework SDK directly:
|
|
35
40
|
|
|
36
|
-
| Framework
|
|
37
|
-
|
|
|
38
|
-
| React
|
|
39
|
-
| Next.js
|
|
40
|
-
| Vue 3 / Nuxt
|
|
41
|
-
| Svelte / SvelteKit| `@mushi-mushi/svelte` + `@mushi-mushi/web` |
|
|
42
|
-
| Angular
|
|
43
|
-
| React Native / Expo | `@mushi-mushi/react-native`
|
|
44
|
-
| Capacitor / Ionic
|
|
45
|
-
| Vanilla JS
|
|
41
|
+
| Framework | Package |
|
|
42
|
+
| ------------------- | ------------------------------------------ |
|
|
43
|
+
| React | `@mushi-mushi/react` |
|
|
44
|
+
| Next.js | `@mushi-mushi/react` |
|
|
45
|
+
| Vue 3 / Nuxt | `@mushi-mushi/vue` + `@mushi-mushi/web` |
|
|
46
|
+
| Svelte / SvelteKit | `@mushi-mushi/svelte` + `@mushi-mushi/web` |
|
|
47
|
+
| Angular | `@mushi-mushi/angular` + `@mushi-mushi/web`|
|
|
48
|
+
| React Native / Expo | `@mushi-mushi/react-native` |
|
|
49
|
+
| Capacitor / Ionic | `@mushi-mushi/capacitor` |
|
|
50
|
+
| Vanilla JS | `@mushi-mushi/web` |
|
|
51
|
+
|
|
52
|
+
## Troubleshooting
|
|
53
|
+
|
|
54
|
+
- **Wrong framework detected?** Pass `--framework <id>`. Valid: `next, react, vue, nuxt, svelte, sveltekit, angular, expo, react-native, capacitor, vanilla`.
|
|
55
|
+
- **Monorepo?** `cd` into the package first, or pass `--cwd apps/web`.
|
|
56
|
+
- **Stale `npx` cache?** `npm cache clean --force` or `npx mushi-mushi@latest`.
|
|
57
|
+
- **Non-interactive terminal (CI)?** Pass `--yes --project-id proj_xxx --api-key mushi_xxx`. The wizard exits with a clear error otherwise — it will not hang.
|
|
58
|
+
- **Node version too old?** Requires Node ≥ 18. Upgrade at [nodejs.org](https://nodejs.org/).
|
|
59
|
+
- **Want full stack traces on error?** `DEBUG=mushi npx mushi-mushi`.
|
|
60
|
+
|
|
61
|
+
## Security
|
|
62
|
+
|
|
63
|
+
- Credentials accepted via `--api-key` flag are visible to other users on the same machine via `ps -ef`. Use the interactive prompt on shared boxes.
|
|
64
|
+
- `~/.mushirc` (the CLI credentials cache) is written with mode `0o600` on Unix; the CLI will also tighten the permissions of any existing file on first load.
|
|
65
|
+
- The wizard rejects pasted secrets containing CR/LF/NUL to prevent `.env` injection.
|
|
66
|
+
- All prompts validate formats: `proj_[A-Za-z0-9_-]{10,}` and `mushi_[A-Za-z0-9_-]{10,}`.
|
|
46
67
|
|
|
47
68
|
## Other CLI commands
|
|
48
69
|
|
|
@@ -62,6 +83,7 @@ mushi deploy check
|
|
|
62
83
|
- 🌐 [Console](https://kensaur.us/mushi-mushi/) — view and triage reports
|
|
63
84
|
- 📦 [GitHub](https://github.com/kensaurus/mushi-mushi)
|
|
64
85
|
- 📚 [Docs](https://github.com/kensaurus/mushi-mushi#readme)
|
|
86
|
+
- 🐛 [Report a bug](https://github.com/kensaurus/mushi-mushi/issues)
|
|
65
87
|
|
|
66
88
|
## License
|
|
67
89
|
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import { runInit } from "@mushi-mushi/cli/init";
|
|
5
|
+
import { FRAMEWORK_IDS, isFrameworkId } from "@mushi-mushi/cli/detect";
|
|
6
|
+
var VERSION = true ? "0.5.0" : "0.0.0-dev";
|
|
7
|
+
var MIN_NODE_MAJOR = 18;
|
|
8
|
+
var ISSUES_URL = "https://github.com/kensaurus/mushi-mushi/issues";
|
|
5
9
|
var HELP = `mushi-mushi \u2014 bug-reporting SDK launcher
|
|
6
10
|
|
|
7
11
|
Usage:
|
|
@@ -10,12 +14,14 @@ Usage:
|
|
|
10
14
|
|
|
11
15
|
Flags (forwarded to \`mushi init\`):
|
|
12
16
|
--project-id <id> skip the project ID prompt
|
|
13
|
-
--api-key <key> skip the API key prompt
|
|
14
|
-
--framework <id> force a framework (
|
|
15
|
-
svelte, sveltekit, angular, expo,
|
|
16
|
-
react-native, capacitor, vanilla)
|
|
17
|
+
--api-key <key> skip the API key prompt (CI only \u2014 leaks into \`ps\`)
|
|
18
|
+
--framework <id> force a framework (${FRAMEWORK_IDS.join(", ")})
|
|
17
19
|
--skip-install print the install command instead of running it
|
|
20
|
+
--skip-test-report don't offer to send a test report at the end
|
|
21
|
+
--cwd <path> run in a different directory
|
|
22
|
+
--endpoint <url> override the Mushi API endpoint (self-hosted)
|
|
18
23
|
-y, --yes accept the detected framework without prompting
|
|
24
|
+
-v, --version print the launcher version and exit
|
|
19
25
|
-h, --help show this help
|
|
20
26
|
|
|
21
27
|
Other commands (status, reports, deploy, test, login, config, index) live
|
|
@@ -24,28 +30,19 @@ in @mushi-mushi/cli \u2014 install with \`npm i -g @mushi-mushi/cli\` and use
|
|
|
24
30
|
|
|
25
31
|
Docs: https://github.com/kensaurus/mushi-mushi
|
|
26
32
|
Console: https://kensaur.us/mushi-mushi/`;
|
|
27
|
-
var VALID_FRAMEWORKS = [
|
|
28
|
-
"next",
|
|
29
|
-
"react",
|
|
30
|
-
"vue",
|
|
31
|
-
"nuxt",
|
|
32
|
-
"svelte",
|
|
33
|
-
"sveltekit",
|
|
34
|
-
"angular",
|
|
35
|
-
"expo",
|
|
36
|
-
"react-native",
|
|
37
|
-
"capacitor",
|
|
38
|
-
"vanilla"
|
|
39
|
-
];
|
|
40
33
|
function parseArgs(argv) {
|
|
41
34
|
const args = argv[0] === "init" ? argv.slice(1) : argv;
|
|
42
|
-
const out = { showHelp: false };
|
|
35
|
+
const out = { showHelp: false, showVersion: false };
|
|
43
36
|
for (let i = 0; i < args.length; i++) {
|
|
44
37
|
const a = args[i];
|
|
45
38
|
if (a === "-h" || a === "--help") {
|
|
46
39
|
out.showHelp = true;
|
|
47
40
|
continue;
|
|
48
41
|
}
|
|
42
|
+
if (a === "-v" || a === "--version") {
|
|
43
|
+
out.showVersion = true;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
49
46
|
if (a === "-y" || a === "--yes") {
|
|
50
47
|
out.yes = true;
|
|
51
48
|
continue;
|
|
@@ -54,6 +51,10 @@ function parseArgs(argv) {
|
|
|
54
51
|
out.skipInstall = true;
|
|
55
52
|
continue;
|
|
56
53
|
}
|
|
54
|
+
if (a === "--skip-test-report") {
|
|
55
|
+
out.skipTestReport = true;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
57
58
|
if (a === "--project-id") {
|
|
58
59
|
out.projectId = args[++i];
|
|
59
60
|
continue;
|
|
@@ -62,10 +63,18 @@ function parseArgs(argv) {
|
|
|
62
63
|
out.apiKey = args[++i];
|
|
63
64
|
continue;
|
|
64
65
|
}
|
|
66
|
+
if (a === "--cwd") {
|
|
67
|
+
out.cwd = args[++i];
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (a === "--endpoint") {
|
|
71
|
+
out.endpoint = args[++i];
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
65
74
|
if (a === "--framework") {
|
|
66
75
|
const fw = args[++i];
|
|
67
|
-
if (!
|
|
68
|
-
throw new Error(`Unknown framework: ${fw}. Valid: ${
|
|
76
|
+
if (!isFrameworkId(fw)) {
|
|
77
|
+
throw new Error(`Unknown framework: ${fw}. Valid: ${FRAMEWORK_IDS.join(", ")}`);
|
|
69
78
|
}
|
|
70
79
|
out.framework = fw;
|
|
71
80
|
continue;
|
|
@@ -76,16 +85,33 @@ function parseArgs(argv) {
|
|
|
76
85
|
}
|
|
77
86
|
return out;
|
|
78
87
|
}
|
|
88
|
+
function assertNodeVersion() {
|
|
89
|
+
const major = Number(process.versions.node.split(".")[0]);
|
|
90
|
+
if (!Number.isFinite(major) || major < MIN_NODE_MAJOR) {
|
|
91
|
+
process.stderr.write(
|
|
92
|
+
`mushi-mushi requires Node.js ${MIN_NODE_MAJOR} or newer. You are on ${process.versions.node}.
|
|
93
|
+
Upgrade Node (https://nodejs.org/) and try again.
|
|
94
|
+
`
|
|
95
|
+
);
|
|
96
|
+
process.exit(1);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
79
99
|
async function main() {
|
|
100
|
+
assertNodeVersion();
|
|
80
101
|
let parsed;
|
|
81
102
|
try {
|
|
82
103
|
parsed = parseArgs(process.argv.slice(2));
|
|
83
104
|
} catch (err) {
|
|
84
|
-
|
|
105
|
+
process.stderr.write(`${err instanceof Error ? err.message : String(err)}
|
|
106
|
+
`);
|
|
85
107
|
process.exit(1);
|
|
86
108
|
}
|
|
87
109
|
if (parsed.showHelp) {
|
|
88
|
-
|
|
110
|
+
process.stdout.write(HELP + "\n");
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (parsed.showVersion) {
|
|
114
|
+
process.stdout.write(VERSION + "\n");
|
|
89
115
|
return;
|
|
90
116
|
}
|
|
91
117
|
await runInit({
|
|
@@ -93,10 +119,22 @@ async function main() {
|
|
|
93
119
|
apiKey: parsed.apiKey,
|
|
94
120
|
framework: parsed.framework,
|
|
95
121
|
skipInstall: parsed.skipInstall,
|
|
96
|
-
yes: parsed.yes
|
|
122
|
+
yes: parsed.yes,
|
|
123
|
+
cwd: parsed.cwd,
|
|
124
|
+
endpoint: parsed.endpoint,
|
|
125
|
+
sendTestReport: parsed.skipTestReport ? false : void 0
|
|
97
126
|
});
|
|
98
127
|
}
|
|
99
128
|
main().catch((err) => {
|
|
100
|
-
|
|
129
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
130
|
+
process.stderr.write(`
|
|
131
|
+
mushi-mushi: ${message}
|
|
132
|
+
`);
|
|
133
|
+
if (process.env.DEBUG?.includes("mushi") && err instanceof Error && err.stack) {
|
|
134
|
+
process.stderr.write(err.stack + "\n");
|
|
135
|
+
}
|
|
136
|
+
process.stderr.write(`
|
|
137
|
+
If this is a bug, please report it at ${ISSUES_URL}
|
|
138
|
+
`);
|
|
101
139
|
process.exit(1);
|
|
102
140
|
});
|
package/package.json
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mushi-mushi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Mushi Mushi launcher — `npx mushi-mushi` (or `npx mushi-mushi init`) auto-detects your framework and installs the right SDK. Bug-reporting + AI triage SDK for React, Vue, Svelte, Angular, React Native, Expo, Capacitor, and vanilla JS.",
|
|
6
6
|
"bin": {
|
|
7
7
|
"mushi-mushi": "./dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@mushi-mushi/cli": "^0.
|
|
10
|
+
"@mushi-mushi/cli": "^0.5.0"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@types/node": "^22.15.3",
|
|
14
14
|
"eslint": "^10.2.0",
|
|
15
15
|
"tsup": "^8.5.1",
|
|
16
16
|
"typescript": "^6.0.2",
|
|
17
|
+
"vitest": "^4.1.4",
|
|
17
18
|
"@mushi-mushi/eslint-config": "0.0.0"
|
|
18
19
|
},
|
|
19
20
|
"author": "Kenji Sakuramoto",
|
|
@@ -26,8 +27,13 @@
|
|
|
26
27
|
"bugs": {
|
|
27
28
|
"url": "https://github.com/kensaurus/mushi-mushi/issues"
|
|
28
29
|
},
|
|
30
|
+
"funding": {
|
|
31
|
+
"type": "github",
|
|
32
|
+
"url": "https://github.com/sponsors/kensaurus"
|
|
33
|
+
},
|
|
29
34
|
"publishConfig": {
|
|
30
|
-
"access": "public"
|
|
35
|
+
"access": "public",
|
|
36
|
+
"provenance": true
|
|
31
37
|
},
|
|
32
38
|
"files": [
|
|
33
39
|
"dist",
|
|
@@ -70,6 +76,7 @@
|
|
|
70
76
|
"scripts": {
|
|
71
77
|
"build": "tsup",
|
|
72
78
|
"lint": "eslint src/",
|
|
79
|
+
"test": "vitest run",
|
|
73
80
|
"typecheck": "tsc --noEmit"
|
|
74
81
|
}
|
|
75
82
|
}
|