@mushi-mushi/cli 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
@@ -6,41 +6,52 @@ CLI for Mushi Mushi — set up the SDK in one command, then triage reports and m
6
6
 
7
7
  ```bash
8
8
  npx @mushi-mushi/cli init
9
- # or, equivalently:
10
- npx mushi-mushi init
9
+ # equivalently:
10
+ npx mushi-mushi
11
11
  ```
12
12
 
13
13
  The wizard:
14
14
 
15
15
  1. Detects your framework (Next.js, Nuxt, SvelteKit, Angular, Expo, Capacitor, plain React/Vue/Svelte, or vanilla JS) from `package.json` and config files.
16
16
  2. Picks the right SDK package (`@mushi-mushi/react`, `@mushi-mushi/vue`, etc.) plus `@mushi-mushi/web` when the framework SDK is API-only.
17
- 3. Detects your package manager (npm / pnpm / yarn / bun) from your lockfile and installs with that.
17
+ 3. Detects your package manager (npm / pnpm / yarn / bun) from your lockfile and installs with that — `shell: false`, with Windows `.cmd` shim resolution.
18
18
  4. Writes `MUSHI_PROJECT_ID` and `MUSHI_API_KEY` (with the right framework prefix — `NEXT_PUBLIC_`, `NUXT_PUBLIC_`, `VITE_`) to `.env.local` (or `.env`).
19
- 5. Warns you if `.env.local` isn't in `.gitignore`.
19
+ 5. Warns you if `.env.local` isn't in `.gitignore` (covers `.env*.local`, `*.local`, etc.).
20
20
  6. Prints the framework-specific provider snippet to copy-paste.
21
+ 7. Offers to **send a real test report** so you see your first classified bug in the console immediately. Opt out via `--skip-test-report`.
21
22
 
22
- It never silently overwrites existing env vars or modifies application code.
23
+ It never silently overwrites existing env vars or modifies application code. Pasted credentials are sanitized (stripped of quotes / CR / LF / NUL) and validated against `^proj_[A-Za-z0-9_-]{10,}$` / `^mushi_[A-Za-z0-9_-]{10,}$` before anything is written to disk.
23
24
 
24
25
  ### Flags
25
26
 
26
27
  ```bash
27
- mushi init --framework next # skip framework detection
28
- mushi init --project-id proj_xxx --api-key mushi_xxx # skip credential prompts
29
- mushi init --skip-install # print the install command instead of running it
30
- mushi init -y # accept the detected framework without confirmation
28
+ mushi init --framework next # skip framework detection
29
+ mushi init --project-id proj_xxx --api-key mushi_xxx # skip credential prompts
30
+ mushi init --skip-install # print the install command instead
31
+ mushi init --skip-test-report # don't offer to send a test report
32
+ mushi init --cwd apps/web # run in a sub-package of a monorepo
33
+ mushi init --endpoint https://mushi.your-company.com # self-hosted Mushi API
34
+ mushi init -y # accept the detected framework
31
35
  ```
32
36
 
37
+ Non-interactive use (CI): pass `--yes --project-id proj_xxx --api-key mushi_xxx` or the wizard exits with a clear error instead of hanging on a prompt.
38
+
39
+ Stale-version hint: the wizard checks the npm registry (2s timeout) and prints a one-line upgrade nudge if a newer stable is published. Opt out with `MUSHI_NO_UPDATE_CHECK=1`.
40
+
41
+ Monorepo awareness: if you run the wizard at a workspace root with no framework dep, it scans `apps/*`, `packages/*`, `examples/*` and tells you which sub-package you probably meant (`mushi init --cwd apps/web`).
42
+
33
43
  ## Install globally
34
44
 
35
45
  ```bash
36
46
  npm install -g @mushi-mushi/cli
37
47
  mushi --help
48
+ mushi --version
38
49
  ```
39
50
 
40
51
  ## Other commands
41
52
 
42
53
  ```bash
43
- mushi login --api-key mushi_xxx # store credentials in ~/.mushirc
54
+ mushi login --api-key mushi_xxx # store credentials in ~/.mushirc (mode 0o600)
44
55
  mushi status # project overview
45
56
  mushi reports list # recent reports
46
57
  mushi reports show <id> # one report
@@ -48,8 +59,16 @@ mushi reports triage <id> --status acknowledged --severity high
48
59
  mushi deploy check # edge-function health probe
49
60
  mushi index <path> # walk a local repo and feed RAG
50
61
  mushi test # submit a test report end-to-end
62
+ mushi config endpoint https://... # set API endpoint (https:// required outside localhost)
51
63
  ```
52
64
 
65
+ ## Security notes
66
+
67
+ - `~/.mushirc` is written with mode `0o600` on Unix. Legacy configs with looser permissions are tightened on load.
68
+ - `--endpoint` values are parsed through `new URL()` and required to use `https://` except for `localhost` / `127.0.0.1` / `*.local`.
69
+ - The `--api-key` flag leaks into `ps -ef` — prefer the interactive prompt on shared machines.
70
+ - Full stack traces on error: `DEBUG=mushi mushi init`.
71
+
53
72
  ## License
54
73
 
55
74
  MIT
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
@@ -0,0 +1,6 @@
1
+ // src/version.ts
2
+ var MUSHI_CLI_VERSION = true ? "0.5.1" : "0.0.0-dev";
3
+
4
+ export {
5
+ MUSHI_CLI_VERSION
6
+ };
@@ -1,6 +1,22 @@
1
1
  // src/detect.ts
2
2
  import { readFileSync, existsSync } from "fs";
3
3
  import { join } from "path";
4
+ var FRAMEWORK_IDS = [
5
+ "next",
6
+ "react",
7
+ "vue",
8
+ "nuxt",
9
+ "svelte",
10
+ "sveltekit",
11
+ "angular",
12
+ "expo",
13
+ "react-native",
14
+ "capacitor",
15
+ "vanilla"
16
+ ];
17
+ function isFrameworkId(value) {
18
+ return typeof value === "string" && FRAMEWORK_IDS.includes(value);
19
+ }
4
20
  var FRAMEWORKS = {
5
21
  next: {
6
22
  id: "next",
@@ -229,6 +245,8 @@ function collectDeps(pkg) {
229
245
  }
230
246
 
231
247
  export {
248
+ FRAMEWORK_IDS,
249
+ isFrameworkId,
232
250
  FRAMEWORKS,
233
251
  readPackageJson,
234
252
  detectFramework,
package/dist/detect.d.ts CHANGED
@@ -18,6 +18,8 @@ interface PackageJson {
18
18
  peerDependencies?: Record<string, string>;
19
19
  }
20
20
  type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun';
21
+ declare const FRAMEWORK_IDS: ReadonlyArray<FrameworkId>;
22
+ declare function isFrameworkId(value: unknown): value is FrameworkId;
21
23
  declare const FRAMEWORKS: Record<FrameworkId, Framework>;
22
24
  declare function readPackageJson(cwd: string): PackageJson | null;
23
25
  declare function detectFramework(cwd: string, pkg: PackageJson | null): Framework;
@@ -25,4 +27,4 @@ declare function detectPackageManager(cwd: string): PackageManager;
25
27
  declare function installCommand(pm: PackageManager, packages: string[]): string;
26
28
  declare function envVarsToWrite(apiKey: string, projectId: string, framework: Framework): string;
27
29
 
28
- export { FRAMEWORKS, type Framework, type FrameworkId, type PackageJson, type PackageManager, detectFramework, detectPackageManager, envVarsToWrite, installCommand, readPackageJson };
30
+ export { FRAMEWORKS, FRAMEWORK_IDS, type Framework, type FrameworkId, type PackageJson, type PackageManager, detectFramework, detectPackageManager, envVarsToWrite, installCommand, isFrameworkId, readPackageJson };
package/dist/detect.js CHANGED
@@ -1,16 +1,20 @@
1
1
  import {
2
2
  FRAMEWORKS,
3
+ FRAMEWORK_IDS,
3
4
  detectFramework,
4
5
  detectPackageManager,
5
6
  envVarsToWrite,
6
7
  installCommand,
8
+ isFrameworkId,
7
9
  readPackageJson
8
- } from "./chunk-YZOGONU4.js";
10
+ } from "./chunk-ZZNVMBMG.js";
9
11
  export {
10
12
  FRAMEWORKS,
13
+ FRAMEWORK_IDS,
11
14
  detectFramework,
12
15
  detectPackageManager,
13
16
  envVarsToWrite,
14
17
  installCommand,
18
+ isFrameworkId,
15
19
  readPackageJson
16
20
  };