mushi-mushi 0.4.0 → 0.5.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.
@@ -0,0 +1,51 @@
1
+ <!--
2
+ AUTO-SYNCED from repo root by scripts/sync-community-files.mjs.
3
+ Do not edit here — edit the canonical file at the repository root and
4
+ re-run `node scripts/sync-community-files.mjs` (pre-commit hook does this
5
+ automatically).
6
+ -->
7
+
8
+ # Contributor Covenant Code of Conduct
9
+
10
+ ## Our Pledge
11
+
12
+ We as members, contributors, and leaders pledge to make participation in our
13
+ community a harassment-free experience for everyone, regardless of age, body
14
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
15
+ identity and expression, level of experience, education, socio-economic status,
16
+ nationality, personal appearance, race, caste, color, religion, or sexual
17
+ identity and orientation.
18
+
19
+ We pledge to act and interact in ways that contribute to an open, welcoming,
20
+ diverse, inclusive, and healthy community.
21
+
22
+ ## Our Standards
23
+
24
+ Examples of behavior that contributes to a positive environment:
25
+
26
+ - Using welcoming and inclusive language
27
+ - Being respectful of differing viewpoints and experiences
28
+ - Gracefully accepting constructive criticism
29
+ - Focusing on what is best for the community
30
+ - Showing empathy towards other community members
31
+
32
+ Examples of unacceptable behavior:
33
+
34
+ - The use of sexualized language or imagery, and sexual attention or advances of any kind
35
+ - Trolling, insulting or derogatory comments, and personal or political attacks
36
+ - Public or private harassment
37
+ - Publishing others' private information without explicit permission
38
+ - Other conduct which could reasonably be considered inappropriate in a professional setting
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
43
+ reported to the project team at **security@mushimushi.dev**.
44
+
45
+ All complaints will be reviewed and investigated promptly and fairly.
46
+
47
+ ## Attribution
48
+
49
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/),
50
+ version 2.1, available at
51
+ https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
@@ -0,0 +1,122 @@
1
+ <!--
2
+ AUTO-SYNCED from repo root by scripts/sync-community-files.mjs.
3
+ Do not edit here — edit the canonical file at the repository root and
4
+ re-run `node scripts/sync-community-files.mjs` (pre-commit hook does this
5
+ automatically).
6
+ -->
7
+
8
+ # Contributing to Mushi Mushi
9
+
10
+ Thanks for wanting to help. Here's everything you need to get started.
11
+
12
+ ## Prerequisites
13
+
14
+ - **Node.js >= 22** (see `.node-version`)
15
+ - **pnpm >= 10** — install with `corepack enable`
16
+
17
+ ## Setup
18
+
19
+ ```bash
20
+ git clone https://github.com/kensaurus/mushi-mushi.git
21
+ cd mushi-mushi
22
+ pnpm install
23
+ pnpm build
24
+ ```
25
+
26
+ ## Development
27
+
28
+ ```bash
29
+ pnpm dev # Start all dev servers (admin on :6464)
30
+ pnpm test # Run Vitest across all packages
31
+ pnpm typecheck # TypeScript checks
32
+ pnpm lint # ESLint
33
+ pnpm format # Prettier
34
+ ```
35
+
36
+ ### Working on a single package
37
+
38
+ ```bash
39
+ cd packages/core
40
+ pnpm dev # Watch mode
41
+ pnpm test # Tests for this package only
42
+ ```
43
+
44
+ ## Project Structure
45
+
46
+ ```
47
+ packages/
48
+ core/ Types, API client, offline queue (MIT)
49
+ web/ Browser SDK — widget, capture (MIT)
50
+ react/ React bindings (MIT)
51
+ vue/ Vue 3 plugin (MIT)
52
+ svelte/ Svelte SDK (MIT)
53
+ angular/ Angular SDK (MIT)
54
+ react-native/ React Native SDK (MIT)
55
+ cli/ CLI tool (MIT)
56
+ mcp/ MCP server for coding agents (MIT)
57
+ server/ Supabase Edge Functions (BSL)
58
+ agents/ Agentic fix pipeline (BSL)
59
+ verify/ Fix verification (BSL)
60
+ apps/
61
+ admin/ Admin dashboard (React + Tailwind)
62
+ docs/ Documentation site (planned)
63
+ tooling/
64
+ eslint-config/ Shared ESLint flat config
65
+ tsconfig/ Shared TypeScript configs
66
+ ```
67
+
68
+ ## Making Changes
69
+
70
+ 1. Create a feature branch from `master`
71
+ 2. Make your changes
72
+ 3. Add tests for new functionality
73
+ 4. Run `pnpm typecheck && pnpm lint && pnpm test` to verify
74
+ 5. Create a changeset if your change affects published packages:
75
+ ```bash
76
+ pnpm changeset
77
+ ```
78
+ 6. Open a pull request
79
+
80
+ ## Changesets
81
+
82
+ We use [Changesets](https://github.com/changesets/changesets) for versioning. If your PR modifies a published package (`core`, `web`, `react`, `vue`, `svelte`, `angular`, `react-native`, `cli`, `mcp`), add a changeset:
83
+
84
+ ```bash
85
+ pnpm changeset
86
+ ```
87
+
88
+ Select the affected packages, the semver bump type, and write a summary. The changeset file gets committed with your PR.
89
+
90
+ ## Code Style
91
+
92
+ - **TypeScript strict mode** — no `any` unless absolutely necessary
93
+ - **Prettier** formats everything — run `pnpm format` before committing
94
+ - **ESLint** catches bugs — `pnpm lint` must pass
95
+ - **No default exports** in library packages — use named exports
96
+ - **Dual ESM/CJS** builds via tsup for all SDK packages
97
+
98
+ ## Commit Messages
99
+
100
+ Use conventional commits:
101
+
102
+ ```
103
+ feat(core): add batch report submission
104
+ fix(web): prevent widget from opening during screenshot
105
+ docs(react): update provider usage example
106
+ chore: bump dependencies
107
+ ```
108
+
109
+ ## Tests
110
+
111
+ - **Framework:** Vitest
112
+ - **Location:** Co-located with source (`src/foo.test.ts`)
113
+ - **Coverage:** Required for `core`, `web`, `react` — encouraged for all packages
114
+
115
+ ## License
116
+
117
+ - SDK packages are MIT — your contributions will be MIT-licensed
118
+ - Server/agents/verify are BSL 1.1 — contributions to those packages fall under BSL
119
+
120
+ ## Questions?
121
+
122
+ Open an issue or start a discussion. We're happy to help.
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 does it do?
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 | Package |
37
- | ----------------- | -------------------------------- |
38
- | React | `@mushi-mushi/react` |
39
- | Next.js | `@mushi-mushi/react` |
40
- | Vue 3 / Nuxt | `@mushi-mushi/vue` + `@mushi-mushi/web` |
41
- | Svelte / SvelteKit| `@mushi-mushi/svelte` + `@mushi-mushi/web` |
42
- | Angular | `@mushi-mushi/angular` + `@mushi-mushi/web` |
43
- | React Native / Expo | `@mushi-mushi/react-native` |
44
- | Capacitor / Ionic | `@mushi-mushi/capacitor` |
45
- | Vanilla JS | `@mushi-mushi/web` |
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/SECURITY.md ADDED
@@ -0,0 +1,50 @@
1
+ <!--
2
+ AUTO-SYNCED from repo root by scripts/sync-community-files.mjs.
3
+ Do not edit here — edit the canonical file at the repository root and
4
+ re-run `node scripts/sync-community-files.mjs` (pre-commit hook does this
5
+ automatically).
6
+ -->
7
+
8
+ # Security Policy
9
+
10
+ ## Supported Versions
11
+
12
+ | Version | Supported |
13
+ |---------|-----------|
14
+ | 0.x | Yes |
15
+
16
+ ## Reporting a Vulnerability
17
+
18
+ If you discover a security vulnerability, please report it responsibly.
19
+
20
+ **Do NOT open a public GitHub issue.**
21
+
22
+ Instead, email: **security@mushimushi.dev**
23
+
24
+ Include:
25
+ - Description of the vulnerability
26
+ - Steps to reproduce
27
+ - Impact assessment
28
+ - Suggested fix (if any)
29
+
30
+ We will acknowledge receipt within 48 hours and aim to release a patch within 7 days for critical issues.
31
+
32
+ ## Scope
33
+
34
+ - All `@mushi-mushi/*` npm packages
35
+ - Supabase Edge Functions (server-side)
36
+ - Admin console application
37
+ - CLI tool
38
+
39
+ ## Out of Scope
40
+
41
+ - Self-hosted deployments configured by the user
42
+ - Third-party integrations (Jira, Linear, PagerDuty)
43
+ - Vulnerabilities requiring physical access
44
+
45
+ ## Security Best Practices for Users
46
+
47
+ - **Never commit your API keys** — use environment variables
48
+ - **Rotate API keys** regularly via the admin console
49
+ - **Enable SSO** for team projects (Enterprise tier)
50
+ - **Review audit logs** periodically for suspicious activity
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.1" : "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 (next, react, vue, nuxt,
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 (!VALID_FRAMEWORKS.includes(fw)) {
68
- throw new Error(`Unknown framework: ${fw}. Valid: ${VALID_FRAMEWORKS.join(", ")}`);
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
- console.error(err instanceof Error ? err.message : String(err));
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
- console.log(HELP);
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
- console.error(err instanceof Error ? err.message : String(err));
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.4.0",
3
+ "version": "0.5.1",
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.4.0"
10
+ "@mushi-mushi/cli": "^0.5.1"
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,13 +27,21 @@
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",
34
40
  "README.md",
35
- "LICENSE"
41
+ "LICENSE",
42
+ "CONTRIBUTING.md",
43
+ "CODE_OF_CONDUCT.md",
44
+ "SECURITY.md"
36
45
  ],
37
46
  "sideEffects": false,
38
47
  "keywords": [
@@ -70,6 +79,7 @@
70
79
  "scripts": {
71
80
  "build": "tsup",
72
81
  "lint": "eslint src/",
82
+ "test": "vitest run",
73
83
  "typecheck": "tsc --noEmit"
74
84
  }
75
85
  }