@mushi-mushi/cli 0.18.2 → 0.19.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/CONTRIBUTING.md CHANGED
@@ -27,12 +27,24 @@ pnpm build
27
27
 
28
28
  ```bash
29
29
  pnpm dev # Start all dev servers (admin on :6464)
30
+ ```
31
+
32
+ | Surface | URL |
33
+ | --- | --- |
34
+ | Admin console | http://localhost:6464 |
35
+ | Docs site | http://localhost:3000 |
36
+ | CLI console override | `MUSHI_CONSOLE_URL=http://localhost:6464` |
37
+
38
+ ```bash
30
39
  pnpm test # Run Vitest across all packages
31
40
  pnpm typecheck # TypeScript checks
32
41
  pnpm lint # ESLint
33
42
  pnpm format # Prettier
43
+ pnpm smoke:cli-setup # Playwright: onboarding ?setup=cli + success panel (skips headless if unsigned)
34
44
  ```
35
45
 
46
+ Set `CLI_SETUP_SMOKE_STRICT=1` to fail the smoke script when Playwright is not signed in (CI gate).
47
+
36
48
  Ad-hoc screenshots captured during UI reviews can live temporarily at the repo
37
49
  root, but root-level `*.png` files are intentionally ignored. Canonical
38
50
  screenshots that should be versioned belong under `docs/screenshots/`.
package/README.md CHANGED
@@ -3,7 +3,35 @@
3
3
  > **Your AI wrote it. Mushi tells you why it broke.**
4
4
  > Plain-English diagnosis + a paste-ready fix, right inside Cursor. MIT-licensed SDKs · self-hostable · no second LLM key.
5
5
 
6
- CLI for Mushi Mushi — set up the SDK in one command, then triage reports and monitor the pipeline from your terminal.
6
+ CLI for Mushi Mushi — set up the SDK in one command, wire Cursor MCP, then triage reports and monitor the pipeline from your terminal.
7
+
8
+ ## Console ↔ CLI loop
9
+
10
+ Before pasting credentials, create a project in the admin console:
11
+
12
+ | Environment | Console base | Override |
13
+ | --- | --- | --- |
14
+ | Hosted | `https://kensaur.us/mushi-mushi/admin` | — |
15
+ | Local monorepo | `http://localhost:6464` (after `pnpm dev`) | auto-probed |
16
+ | Custom | Set `MUSHI_CONSOLE_URL` | wins over heuristics |
17
+
18
+ **Where to find credentials:**
19
+
20
+ - **Project ID** — UUID from the success panel after **Create**, or Projects → UUID chip
21
+ - **API key** — **Setup → Verify → Generate API key** (`report:write`). Not Settings → BYOK
22
+
23
+ The wizard opens `/onboarding?tab=steps&setup=cli` when you choose "No — open the console to create one."
24
+
25
+ Full walkthrough: [CLI ↔ console loop](https://github.com/kensaurus/mushi-mushi/blob/master/apps/docs/content/quickstart/cli-console-loop.mdx) on the docs site.
26
+
27
+ ## Command cheat sheet
28
+
29
+ | Command | Purpose |
30
+ | --- | --- |
31
+ | `mushi init` / `npx mushi-mushi` | SDK wizard: framework detect, install, `.env.local`, optional test report |
32
+ | `mushi connect` | Non-interactive: config + env + Cursor MCP + optional `--wait` heartbeat |
33
+ | `mushi login` | Save credentials to `~/.config/mushi/config.json` |
34
+ | `mushi setup` | Wire Cursor/Claude MCP only (reads saved config — run `login` first) |
7
35
 
8
36
  ## One-command setup
9
37
 
@@ -15,34 +43,42 @@ npx mushi-mushi
15
43
 
16
44
  The wizard:
17
45
 
18
- 1. Detects your framework (Next.js, Nuxt, SvelteKit, Angular, Expo, Capacitor, plain React/Vue/Svelte, or vanilla JS) from `package.json` and config files.
19
- 2. Picks the right SDK package (`@mushi-mushi/react`, `@mushi-mushi/vue`, etc.) plus `@mushi-mushi/web` when the framework SDK is API-only.
20
- 3. Detects your package manager (npm / pnpm / yarn / bun) from your lockfile and installs with that — `shell: false`, with Windows `.cmd` shim resolution.
21
- 4. Writes `MUSHI_PROJECT_ID` and `MUSHI_API_KEY` (with the right framework prefix — `NEXT_PUBLIC_`, `NUXT_PUBLIC_`, `VITE_`) to `.env.local` (or `.env`).
22
- 5. Warns you if `.env.local` isn't in `.gitignore` (covers `.env*.local`, `*.local`, etc.).
23
- 6. Prints the framework-specific provider snippet to copy-paste.
24
- 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`.
46
+ 1. **Prerequisite step** (unless flags/config already present): open console to create a project, paste existing credentials, or exit to run `mushi login` first.
47
+ 2. Detects your framework (Next.js, Nuxt, SvelteKit, Angular, Expo, Capacitor, plain React/Vue/Svelte, or vanilla JS) from `package.json` and config files.
48
+ 3. Calls **`GET /v1/sync/whoami`** to verify Project ID + API key before installing anything.
49
+ 4. Picks the right SDK package (`@mushi-mushi/react`, `@mushi-mushi/vue`, etc.) plus `@mushi-mushi/web` when the framework SDK is API-only.
50
+ 5. Detects your package manager (npm / pnpm / yarn / bun) from your lockfile and installs with that — `shell: false`, with Windows `.cmd` shim resolution.
51
+ 6. Writes `MUSHI_PROJECT_ID` and `MUSHI_API_KEY` (with the right framework prefix — `NEXT_PUBLIC_`, `NUXT_PUBLIC_`, `VITE_`) to `.env.local` (or `.env`).
52
+ 7. Warns you if `.env.local` isn't in `.gitignore` (covers `.env*.local`, `*.local`, etc.).
53
+ 8. Prints the framework-specific provider snippet to copy-paste.
54
+ 9. Offers to **send a real test report** so you see your first classified bug in the console immediately. Opt out via `--skip-test-report`.
55
+ 10. Optionally runs **`mushi connect --write-env --wire-ide --wait`** for Cursor MCP + heartbeat proof.
25
56
 
26
- 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.
57
+ It never silently overwrites existing env vars or modifies application code. Pasted credentials are sanitized (stripped of quotes / CR / LF / NUL) and validated before anything is written to disk:
58
+
59
+ - Project ID: UUID (`xxxxxxxx-xxxx-…`) or future `proj_` + 10+ alphanumeric chars
60
+ - API key: `mushi_` or `mush_pk_` + 10+ alphanumeric chars
27
61
 
28
62
  ### Flags
29
63
 
30
64
  ```bash
31
- mushi init --framework next # skip framework detection
32
- mushi init --project-id proj_xxx --api-key mushi_xxx # skip credential prompts
33
- mushi init --skip-install # print the install command instead
34
- mushi init --skip-test-report # don't offer to send a test report
35
- mushi init --cwd apps/web # run in a sub-package of a monorepo
36
- mushi init --endpoint https://mushi.your-company.com # self-hosted Mushi API
37
- mushi init -y # accept the detected framework
65
+ mushi init --framework next # skip framework detection
66
+ mushi init --project-id bdafa28d-b153-482f-bd4f-42981f3fd3a4 --api-key mushi_xxx # skip prompts
67
+ mushi init --skip-install # print the install command instead
68
+ mushi init --skip-test-report # don't offer to send a test report
69
+ mushi init --cwd apps/web # run in a sub-package of a monorepo
70
+ mushi init --endpoint https://mushi.your-company.com # self-hosted Mushi API
71
+ mushi init -y # accept the detected framework
38
72
  ```
39
73
 
40
- 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.
74
+ Non-interactive use (CI): pass `--yes --project-id <uuid> --api-key mushi_xxx` or the wizard exits with a clear error instead of hanging on a prompt.
41
75
 
42
76
  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`.
43
77
 
44
78
  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`).
45
79
 
80
+ Console URL resolution: `MUSHI_CONSOLE_URL` → saved `consoleUrl` in config → localhost `:6464` probe → mushi-mushi monorepo heuristic → hosted default. Saved on successful `mushi login`.
81
+
46
82
  ## Install globally
47
83
 
48
84
  ```bash
@@ -55,8 +91,9 @@ mushi --version
55
91
 
56
92
  ```bash
57
93
  mushi login --api-key mushi_xxx # store credentials in ~/.config/mushi/config.json (mode 0o600)
58
- mushi connect --api-key mushi_xxx --project-id <uuid> --endpoint <url> --wait
59
- # one-shot wiring: ~/.config/mushi/config.json + .env.local + .cursor/mcp.json + heartbeat wait
94
+ mushi setup # wire Cursor MCP from saved config (not SDK install)
95
+ mushi connect --project-id <uuid> --endpoint <url> --write-env --wire-ide --wait
96
+ # one-shot wiring: config + .env.local + .cursor/mcp.json + heartbeat wait
60
97
  mushi upgrade # bump installed @mushi-mushi/* packages to latest stable
61
98
  mushi status # project overview
62
99
  mushi reports list # recent reports
@@ -73,15 +110,14 @@ mushi sourcemaps upload --release <ver> --dir <dist> # upload .js.map / .css.m
73
110
 
74
111
  ### `mushi connect`
75
112
 
76
- Non-interactive equivalent of `mushi init` for agents and scripts — wires a
77
- repo to an existing project in one shot:
113
+ Non-interactive wiring for agents and scripts — connects a repo to an existing project:
78
114
 
79
115
  1. Saves credentials to `~/.config/mushi/config.json` (mode `0o600`).
80
116
  2. Merges `MUSHI_*` / framework-prefixed env vars into `.env.local` —
81
- existing keys are never overwritten (skip with `--no-env`).
117
+ existing keys are never overwritten (skip with `--no-env`; explicit with `--write-env`).
82
118
  3. Writes the `@mushi-mushi/mcp` server block into `.cursor/mcp.json` and
83
119
  ensures that file is gitignored, since it embeds the API key (skip with
84
- `--no-ide`).
120
+ `--no-ide`; explicit with `--wire-ide`).
85
121
  4. With `--wait`, polls `GET /v1/sync/ingest-setup` every 3 s until the SDK
86
122
  heartbeat (or first report) lands, up to `--wait-timeout <sec>`
87
123
  (default 120). Rejected credentials (401/403/404) fail fast instead of
@@ -90,13 +126,25 @@ repo to an existing project in one shot:
90
126
  ```bash
91
127
  # Recommended: pass the key via env so it stays out of shell history
92
128
  MUSHI_API_KEY=mushi_xxx mushi connect --project-id <uuid> \
93
- --endpoint https://<ref>.supabase.co/functions/v1/api --wait
129
+ --endpoint https://dxptnwrhwsqckaftyymj.supabase.co/functions/v1/api \
130
+ --write-env --wire-ide --wait
94
131
  mushi connect --api-key mushi_xxx --project-id <uuid> --endpoint <url> --no-ide --json
95
132
  ```
96
133
 
97
134
  Exits non-zero when `--wait` times out or credentials are rejected, so it
98
135
  composes in setup scripts and CI.
99
136
 
137
+ ### `mushi setup`
138
+
139
+ Writes IDE MCP config from `~/.config/mushi/config.json` — run `mushi login` first.
140
+ Does **not** install SDK packages or write app env vars (use `mushi init` for that).
141
+
142
+ ```bash
143
+ mushi setup # wire Cursor (default)
144
+ mushi setup --ide claude # Claude Code / Desktop
145
+ mushi setup --all-projects # one MCP server entry per accessible project
146
+ ```
147
+
100
148
  ### `mushi upgrade`
101
149
 
102
150
  Reads `package.json`, checks the npm registry for each installed
@@ -302,6 +350,19 @@ mushi slack status
302
350
  mushi slack test
303
351
  ```
304
352
 
353
+ ## Environment variables
354
+
355
+ | Variable | Purpose |
356
+ | --- | --- |
357
+ | `MUSHI_API_KEY` | Admin or ingest API key (prefer env over `--api-key` flag) |
358
+ | `MUSHI_API_ENDPOINT` | API base URL (defaults to Mushi Cloud when unset) |
359
+ | `MUSHI_PROJECT_ID` | Project UUID |
360
+ | `MUSHI_CONSOLE_URL` | Admin console base for hints + browser opens |
361
+ | `MUSHI_BYOK_KEY` | BYOK key for `mushi keys add` (keeps key out of shell history) |
362
+ | `MUSHI_NO_UPDATE_CHECK=1` | Skip npm registry version nudge in `mushi init` |
363
+
364
+ Config file: `~/.config/mushi/config.json` (Unix mode `0o600`; legacy `~/.mushirc` auto-migrates).
365
+
305
366
  ## Security notes
306
367
 
307
368
  - `~/.config/mushi/config.json` is written with mode `0o600` on Unix. Legacy configs with looser permissions are tightened on load.