@mushi-mushi/cli 0.29.1 → 0.30.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 CHANGED
@@ -2,447 +2,88 @@
2
2
 
3
3
  > **Your AI wrote it. Mushi tells you why it broke.**
4
4
 
5
- Set up the Mushi SDK, wire Cursor MCP, and review bugs from your terminal.
5
+ The `mushi` command for [Mushi Mushi](https://github.com/kensaurus/mushi-mushi). Install the SDK in your app, connect your editor, then read bugs, dispatch fixes and merge them without leaving the terminal.
6
6
 
7
- Positioning and product overview: [docs site](https://github.com/kensaurus/mushi-mushi/blob/master/apps/docs/content/quickstart/index.mdx) · [VISION.md](https://github.com/kensaurus/mushi-mushi/blob/master/VISION.md)
7
+ ```mermaid
8
+ flowchart LR
9
+ A["mushi init<br/>SDK in your app"] --> B["mushi setup<br/>editor reads diagnoses"] --> C["mushi reports<br/>see what broke"] --> D["mushi fix<br/>agent opens a draft PR"] --> E["mushi fixes merge"]
10
+ ```
8
11
 
9
12
  ## Quick start
10
13
 
11
14
  ```bash
12
- npx @mushi-mushi/cli init
15
+ npx mushi-mushi # the SDK wizard (same as: npx @mushi-mushi/cli init)
16
+ npx mushi-mushi setup --ide cursor # connect your editor: cursor, claude, continue or zed
17
+ npm install -g @mushi-mushi/cli # optional: a global `mushi` command
13
18
  ```
14
19
 
15
- ## Console ↔ CLI loop
16
-
17
- Before pasting credentials, create a project in the admin console:
18
-
19
- | Environment | Console base | Override |
20
- | --- | --- | --- |
21
- | Hosted | `https://kensaur.us/mushi-mushi/admin` | — |
22
- | Local monorepo | `http://localhost:6464` (after `pnpm dev`) | auto-probed |
23
- | Custom | Set `MUSHI_CONSOLE_URL` | wins over heuristics |
24
-
25
- **Where to find credentials:**
20
+ The wizard detects your framework and package manager, checks your credentials, installs the right SDK, writes framework-prefixed env vars (`NEXT_PUBLIC_`, `VITE_`, `EXPO_PUBLIC_`…) to `.env.local`, prints the snippet to paste, and offers to send a test report. It never overwrites an existing env var or edits your code.
26
21
 
27
- - **Project ID** — UUID from the success panel after **Create**, or Projects → UUID chip
28
- - **API key** — **Setup → Verify → Generate API key** (`report:write`). Not Settings → BYOK
22
+ **Credentials** come from the [console](https://kensaur.us/mushi-mushi/admin): the **project ID** is on the Projects page; the **API key** is under **Setup → Verify → Generate API key** (`report:write`), not the AI keys in Settings. No project yet? The wizard can open the console for you.
29
23
 
30
- The wizard opens `/onboarding?tab=steps&setup=cli` when you choose "No — open the console to create one."
24
+ For your editor, `mushi setup` writes the hosted MCP entry by default: the editor opens a browser sign-in on first use and no key is stored on disk. Add `--stdio` for a local server instead.
31
25
 
32
- 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
+ ## Commands
33
27
 
34
- ## Command cheat sheet
35
-
36
- | Command | Purpose |
28
+ | Group | Commands |
37
29
  | --- | --- |
38
- | `mushi init` / `npx mushi-mushi` | SDK wizard: framework detect, install, `.env.local`, optional test report |
39
- | `mushi connect` | Non-interactive: config + env + Cursor MCP + optional `--wait` heartbeat |
40
- | `mushi login` | Save credentials to `~/.config/mushi/config.json` |
41
- | `mushi setup` | Wire Cursor/Claude MCP only (reads saved config — run `login` first) |
42
- | `mushi nudge` | Phase-tuned `Mushi.init()` snippet (`alpha` / `beta` / `ga`) |
43
- | `mushi doctor` | Local + optional server preflight checks |
44
-
45
- ## One-command setup
46
-
47
- ```bash
48
- npx @mushi-mushi/cli init
49
- # equivalently:
50
- npx mushi-mushi
51
- ```
52
-
53
- The wizard:
54
-
55
- 1. **Prerequisite step** (unless flags/config already present): open console to create a project, paste existing credentials, or exit to run `mushi login` first.
56
- 2. Detects your framework (Next.js, Remix, Astro, Nuxt, SvelteKit, Angular, Expo, Capacitor, Create React App, Solid/SolidStart, plain React/Vue/Svelte, Express/Fastify/Hono, or vanilla JS) from `package.json` and config files — and writes the correct client env-var prefix for each (`NEXT_PUBLIC_`, `VITE_`, `PUBLIC_`, `REACT_APP_`, `EXPO_PUBLIC_`, or bare `MUSHI_*`).
57
- 3. Calls **`GET /v1/sync/whoami`** to verify Project ID + API key before installing anything.
58
- 4. Picks the right SDK package (`@mushi-mushi/react`, `@mushi-mushi/vue`, etc.) plus `@mushi-mushi/web` when the framework SDK is API-only.
59
- 5. Detects your package manager (npm / pnpm / yarn / bun) from your lockfile and installs with that — `shell: false`, with Windows `.cmd` shim resolution.
60
- 6. Writes `MUSHI_PROJECT_ID` and `MUSHI_API_KEY` (with the right framework prefix — `NEXT_PUBLIC_`, `NUXT_PUBLIC_`, `VITE_`) to `.env.local` (or `.env`).
61
- 7. Warns you if `.env.local` isn't in `.gitignore` (covers `.env*.local`, `*.local`, etc.).
62
- 8. Prints the framework-specific provider snippet to copy-paste.
63
- 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`.
64
- 10. Optionally runs **`mushi connect --write-env --wire-ide --wait`** for Cursor MCP + heartbeat proof.
65
-
66
- 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:
67
-
68
- - Project ID: UUID (`xxxxxxxx-xxxx-…`) or future `proj_` + 10+ alphanumeric chars
69
- - API key: `mushi_` or `mush_pk_` + 10+ alphanumeric chars
70
-
71
- ### Flags
72
-
73
- ```bash
74
- mushi init --framework next # skip framework detection
75
- mushi init --project-id bdafa28d-b153-482f-bd4f-42981f3fd3a4 --api-key mushi_xxx # skip prompts
76
- mushi init --skip-install # print the install command instead
77
- mushi init --skip-test-report # don't offer to send a test report
78
- mushi init --cwd apps/web # run in a sub-package of a monorepo
79
- mushi init --endpoint https://mushi.your-company.com # self-hosted Mushi API
80
- mushi init -y # accept the detected framework
81
- ```
82
-
83
- 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.
84
-
85
- 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`.
86
-
87
- 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`).
88
-
89
- Console URL resolution: `MUSHI_CONSOLE_URL` → saved `consoleUrl` in config → localhost `:6464` probe → mushi-mushi monorepo heuristic → hosted default. Saved on successful `mushi login`.
90
-
91
- ### Browser sign-in reliability
92
-
93
- Device auth (RFC 8628) uses a stable per-machine `client_id` stored in
94
- `~/.config/mushi/config.json`. Starting a new login on the same machine supersedes
95
- any older pending approval for that id.
96
-
97
- During token polling the CLI retries **429** and **408** responses automatically.
98
- If saved credentials exist, re-running the wizard validates them with
99
- `GET /v1/sync/whoami` before reinstalling.
30
+ | Set up | `init`, `login`, `setup`, `connect`, `doctor`, `upgrade`, `nudge`, `completion` |
31
+ | Bugs | `reports list/show/search/triage`, `lessons list/show` |
32
+ | Fixes | `fix <reportId>`, `fixes tail/merge/refresh-ci` |
33
+ | Ship | `sourcemaps upload`, `deploy check`, `migrate`, `audit` |
34
+ | Test and UX | `qa stories/runs/run`, `tdd gen/pending/approve/improve`, `stories map`, `ux` |
35
+ | Account | `whoami`, `status`, `usage`, `billing`, `keys`, `integrations`, `slack` |
100
36
 
101
- The browser approval page waits until the CLI actually claims the token (not
102
- just when you click Approve). Full flow + troubleshooting:
103
- [CLI ↔ console loop](https://kensaur.us/mushi-mushi/docs/quickstart/cli-console-loop).
37
+ `mushi --help` and `mushi <command> --help` list every command and flag.
104
38
 
105
- ## Install globally
39
+ ## Common tasks
106
40
 
107
41
  ```bash
108
- npm install -g @mushi-mushi/cli
109
- mushi --help
110
- mushi --version
42
+ mushi doctor --fix # check SDK, ingest and dispatch; fix what's safe locally
43
+ mushi reports list --status new --severity critical # what broke
44
+ mushi fix <reportId> --wait # an agent opens a draft PR for it
45
+ mushi fixes merge <fixId> # merge it and mark the report Fixed
46
+ mushi upgrade # bump @mushi-mushi/* to the latest stable
47
+ mushi upgrade --check # CI: exit 0 current, 1 outdated, 2 registry down
48
+ mushi sourcemaps upload --release "$GITHUB_SHA" --dir ./dist
49
+ mushi ux ui # the local UX studio (see @mushi-mushi/ux)
111
50
  ```
112
51
 
113
- ## Other commands
114
-
115
- ```bash
116
- mushi login --api-key mushi_xxx # store credentials in ~/.config/mushi/config.json (mode 0o600)
117
- mushi setup # wire Cursor MCP from saved config (not SDK install)
118
- mushi connect --project-id <uuid> --endpoint <url> --write-env --wire-ide --wait
119
- # one-shot wiring: config + .env.local + .cursor/mcp.json + heartbeat wait
120
- mushi upgrade # bump installed @mushi-mushi/* packages to latest stable
121
- mushi status # project overview
122
- mushi reports list # recent reports
123
- mushi reports show <id> # one report
124
- mushi reports triage <id> --status acknowledged --severity high
125
- mushi deploy check # edge-function health probe
126
- mushi index <path> # walk a local repo and feed RAG
127
- mushi test # submit a test report end-to-end
128
- mushi migrate # suggest the most relevant migration guide
129
- mushi migrate --json # machine-readable JSON for CI
130
- mushi config endpoint https://... # set API endpoint (https:// required outside localhost)
131
- mushi sourcemaps upload --release <ver> --dir <dist> # upload .js.map / .css.map (sha256-idempotent)
132
- ```
133
-
134
- ### `mushi connect`
135
-
136
- Non-interactive wiring for agents and scripts — connects a repo to an existing project:
137
-
138
- 1. Saves credentials to `~/.config/mushi/config.json` (mode `0o600`).
139
- 2. Merges `MUSHI_*` / framework-prefixed env vars into `.env.local` —
140
- existing keys are never overwritten (skip with `--no-env`; explicit with `--write-env`).
141
- 3. Writes the `@mushi-mushi/mcp` server block into `.cursor/mcp.json` and
142
- ensures that file is gitignored, since it embeds the API key (skip with
143
- `--no-ide`; explicit with `--wire-ide`).
144
- 4. With `--wait`, polls `GET /v1/sync/ingest-setup` every 3 s until the SDK
145
- heartbeat (or first report) lands, up to `--wait-timeout <sec>`
146
- (default 120). Rejected credentials (401/403/404) fail fast instead of
147
- polling out the timeout.
148
-
149
- ```bash
150
- # Recommended: pass the key via env so it stays out of shell history
151
- MUSHI_API_KEY=mushi_xxx mushi connect --project-id <uuid> \
152
- --endpoint https://dxptnwrhwsqckaftyymj.supabase.co/functions/v1/api \
153
- --write-env --wire-ide --wait
154
- mushi connect --api-key mushi_xxx --project-id <uuid> --endpoint <url> --no-ide --json
155
- ```
156
-
157
- Exits non-zero when `--wait` times out or credentials are rejected, so it
158
- composes in setup scripts and CI.
159
-
160
- ### `mushi setup`
161
-
162
- Writes IDE MCP config from `~/.config/mushi/config.json` — run `mushi login` first.
163
- Does **not** install SDK packages or write app env vars (use `mushi init` for that).
164
-
165
- ```bash
166
- mushi setup # wire Cursor (default)
167
- mushi setup --ide claude # Claude Code / Desktop
168
- mushi setup --all-projects # one MCP server entry per accessible project
169
- ```
170
-
171
- ### `mushi upgrade`
172
-
173
- Reads `package.json`, checks the npm registry for each installed
174
- `@mushi-mushi/*` package, and runs the right install command for your package
175
- manager (npm / pnpm / yarn / bun) to bump them to the latest stable release.
176
-
177
- **Console equivalent:** **Connect & Update → Create Upgrade PR** opens a GitHub
178
- draft PR for the linked repo (backed by `sdk-upgrade-worker`). Use the CLI for
179
- local bumps; use the PR flow when you want review + CI on the dependency change.
180
-
181
- ```bash
182
- mushi upgrade # plan + install
183
- mushi upgrade --dry-run # print the install command without running it
184
- mushi upgrade --check # plan only: exit 0 current, 1 outdated, 2 registry down
185
- mushi upgrade --json # machine-readable plan + result
186
- mushi upgrade --cwd ../app # target another repo
187
- ```
188
-
189
- `--check` never installs. Use it in a **non-required** CI job so a one-patch
190
- drift cannot freeze production deploys. Exit `2` (registry unreachable) should
191
- not fail a required gate — retry or treat as a warning.
192
-
193
- Pre-release versions are never auto-selected, registry versions are validated
194
- against strict semver before being interpolated into the install command, and
195
- non-registry specifiers (`workspace:`, `file:`, git URLs, dist-tags) are left
196
- untouched. Legacy `@mushi-mushi/react` installs get a migration note pointing
197
- at `@mushi-mushi/web`.
198
-
199
- ### `mushi sourcemaps upload`
200
-
201
- Recursively scans `--dir` for `.js.map` and `.css.map` files and uploads them
202
- under the given `--release`. Each file is hashed (sha256) and skipped if the
203
- server already has it for that release, so the command is safe to run from
204
- every CI build without churning storage.
205
-
206
- ```bash
207
- mushi sourcemaps upload --release 1.4.2 --dir ./dist
208
- mushi sourcemaps upload --release "$GITHUB_SHA" --dir ./build --dry-run
209
- mushi sourcemaps upload --release "$GITHUB_SHA" --dir ./build --silent
210
- ```
211
-
212
- Requires `MUSHI_API_ENDPOINT` and `MUSHI_API_KEY` (or pass `--endpoint` /
213
- `--api-key`). Exits non-zero on any upload failure so CI gates fail fast.
214
-
215
- ### `mushi migrate`
216
-
217
- Reads `package.json` (deps + devDeps + peerDeps) and prints links to the
218
- matching guides on the docs site. Detects:
219
-
220
- - **In-transition shapes** — Capacitor + React Native side-by-side, Cordova
221
- (or `cordova-ios`/`cordova-android`), Create React App.
222
- - **Competitor SDKs** — Instabug / Luciq, Shake, LogRocket Feedback,
223
- BugHerd, Pendo Feedback.
224
-
225
- Exits non-zero when nothing matches, so it composes in shell scripts:
226
-
227
- ```bash
228
- mushi migrate || echo "no migration suggestions for this project"
229
- ```
230
-
231
- Only `published` guides ever surface — `draft` entries are filtered out so
232
- the CLI never points users at a 404. This safety property is unit-pinned in
233
- `packages/cli/src/migrate.test.ts` (positive control + negative control +
234
- real-catalog regression guard).
235
-
236
- ### `mushi completion`
237
-
238
- Prints a tab-completion script for bash, zsh, or fish, generated from the
239
- CLI's live command tree — so it never drifts as commands are added.
52
+ **In CI or scripts**, skip the prompts:
240
53
 
241
54
  ```bash
242
- eval "$(mushi completion bash)" # try it for the current session
243
- mushi completion bash >> ~/.bashrc # bash: persist across sessions
244
- mushi completion zsh > "${fpath[1]}/_mushi" # zsh: needs a dir already on $fpath
245
- mushi completion fish > ~/.config/fish/completions/mushi.fish
55
+ mushi init --yes --project-id <uuid> --api-key mushi_xxx --skip-test-report
56
+ MUSHI_API_KEY=mushi_xxx mushi connect --project-id <uuid> --endpoint <url> --wait # wire a repo, wait for the first SDK heartbeat
246
57
  ```
247
58
 
248
- ### `mushi doctor`
249
-
250
- Checks CLI and SDK health. **Ingest and dispatch (server) checks run by
251
- default** — pass `--no-server` / `--no-ingest` to limit it to local checks.
252
-
253
- ```bash
254
- mushi doctor # local + ingest + dispatch readiness (the full picture)
255
- mushi doctor --no-server # skip the dispatch-readiness /preflight checks
256
- mushi doctor --no-ingest # skip the ingest-setup checks (SDK heartbeat, first report)
257
- mushi doctor --fix # apply safe local fixes, then re-run and report the post-fix state
258
- mushi doctor --json # machine-readable JSON output (exits 1 if any check fails)
259
- mushi doctor --qa-stories # also flag enabled QA stories with setup issues (needs server creds)
260
- mushi doctor --host-app # also verify host-app wiring (env vars, Cursor MCP, Capacitor notes)
261
- ```
262
-
263
- `--fix` writes any missing `.env.local` lines and wires the Cursor MCP config
264
- (via `mushi connect`), then re-runs every check so the printed result and exit
265
- code reflect the post-fix state rather than the stale pre-fix failures.
266
-
267
- ### `mushi nudge`
268
-
269
- Generate a ready-to-paste `Mushi.init()` snippet tuned for your release phase
270
- (proactive triggers, cooldowns, feature-request card, beta-mode UI).
271
-
272
- ```bash
273
- mushi nudge --phase beta # default phase
274
- mushi nudge --phase alpha --explain # + human-readable summary of the preset
275
- mushi nudge --phase ga --max 2 --cooldown 24 --dwell 5 --welcome 10
276
- ```
277
-
278
- | Flag | Meaning |
279
- |------|---------|
280
- | `--phase <alpha\|beta\|ga>` | Release phase preset (default `beta`) |
281
- | `--explain` | Print a human-readable summary of what the preset does |
282
- | `--max <n>` | Override `maxProactivePerSession` (≥ 1) |
283
- | `--cooldown <hours>` | Override `dismissCooldownHours` (≥ 0) |
284
- | `--dwell <minutes>` | Override page-dwell threshold (`0` disables) |
285
- | `--welcome <seconds>` | Override first-session welcome delay (`0` disables) |
286
-
287
- Local checks performed:
288
-
289
- | Check | What it verifies |
290
- |---|---|
291
- | CLI config | `~/.config/mushi/config.json` exists, `projectId` and `apiKey` fields are present |
292
- | Endpoint reachability | `GET /v1/sdk/config?project_id=...` returns 200 |
293
- | SDK install | `@mushi-mushi/web` or framework-specific SDK is in `node_modules` |
294
-
295
- The dispatch-readiness checks (on by default; skip with `--no-server`) call
296
- `GET /v1/admin/projects/:id/preflight` (the same 4 checks the admin console
297
- dispatch popover uses) and merge the results. The four server checks (`key`
298
- values returned by the endpoint):
299
-
300
- | `key` | What it verifies |
301
- |---|---|
302
- | `github` | A GitHub repo URL is linked (`project_repos.repo_url` or `project_settings.codebase_repo_url`) |
303
- | `codebase` | Codebase indexing is enabled AND `pgvector` has at least one non-tombstoned file AND `last_indexed_at` is set |
304
- | `anthropic` | A BYOK Anthropic key is stored in Supabase Vault (`project_settings.byok_anthropic_key_ref`) |
305
- | `autofix` | The autofix toggle is ON (`project_settings.autofix_enabled = true`) |
306
-
307
- The dispatch-readiness checks require `adminOrApiKey` credentials — set
308
- `MUSHI_API_KEY` to an admin key (not a public SDK key). If you only have an SDK
309
- key, pass `--no-server` to skip them.
310
-
311
- The ingest checks (on by default; skip with `--no-ingest`) call
312
- `GET /v1/sync/ingest-setup` (authenticated with the SDK API key) and report each
313
- **required ingest step** — project exists, active API key, SDK heartbeat, at
314
- least one ingested report — plus a `Last SDK heartbeat` diagnostic with the
315
- timestamp and endpoint host. This is the same payload `mushi connect --wait`
316
- polls, so a failing step here tells you exactly why the banner isn't showing up.
317
-
318
- ### `mushi reset <projectId>`
319
-
320
- Archives a project and wipes its test data so the full onboarding flow can be
321
- re-run. Useful for development and QA.
322
-
323
- ```bash
324
- mushi reset proj_xxx --confirm # required flag prevents accidental wipes
325
- ```
326
-
327
- Wipes: `fix_attempts`, `project_codebase_files`, `reports`, `fix_dispatch_jobs`.
328
- Sets `projects.archived_at`. **Irreversible.**
329
-
330
- ### `mushi fixes tail --report-id <id>`
331
-
332
- Streams dispatch events for a report in real-time via SSE. Pairs with
333
- `mushi doctor --server` for headless debugging without opening the admin console.
334
-
335
- ```bash
336
- mushi fixes tail --report-id 11111111-2222-3333-4444-555555555555
337
- ```
338
-
339
- Exits automatically when the job reaches a terminal status (`completed`,
340
- `failed`, `cancelled`, `skipped`).
341
-
342
- ### `mushi fixes merge <fixId>`
343
-
344
- Squash-merge (or merge/rebase) the fix PR on GitHub and run the same post-merge
345
- bookkeeping as the admin console: `merged_at`, report → **Fixed**, reporter
346
- notification, `fix.applied` webhooks.
347
-
348
- ```bash
349
- mushi fixes merge 75199dde-f726-404a-b5f7-be17bf7a3a46
350
- mushi fixes merge <fixId> --method squash # default
351
- mushi fixes merge <fixId> --method merge
352
- mushi fixes merge <fixId> --method rebase
353
- mushi fixes merge <fixId> --json
354
- ```
355
-
356
- Requires an admin API key with `mcp:write` scope and a connected GitHub App or PAT.
357
- Draft PRs are auto-readied via GraphQL before merge.
358
-
359
- ### `mushi fixes refresh-ci <fixId>`
360
-
361
- Pull the latest GitHub Actions check-run status on demand (same as **Refresh CI
362
- status** in the console). Useful when webhooks drop or you just pushed to the PR
363
- branch.
364
-
365
- ```bash
366
- mushi fixes refresh-ci <fixId>
367
- mushi fixes refresh-ci <fixId> --json
368
- ```
369
-
370
- ---
371
-
372
- ## QA coverage & TDD
373
-
374
- ```bash
375
- mushi stories map --url https://your-app.com --wait
376
- mushi tdd gen <storyId> --mode review
377
- mushi tdd pending
378
- mushi tdd approve <qaStoryId>
379
- mushi tdd improve
380
- mushi qa stories
381
- mushi qa runs <storyId>
382
- mushi qa run <storyId>
383
- mushi audit
384
- ```
385
-
386
- ---
387
-
388
- ## Skill pipelines
389
-
390
- ```bash
391
- mushi skills list [--category workflow] [--search "fix"]
392
- mushi skills show workflow-fix-and-ship
393
- mushi skills sync
394
-
395
- mushi pipeline start <reportId> --skill workflow-fix-and-ship [--mode cloud|handoff]
396
- mushi pipeline watch <runId-or-prefix>
397
- mushi pipeline checkin <runId-or-prefix> --step 0 --status passed
398
- ```
399
-
400
- ---
401
-
402
- ## Integrations & BYOK
403
-
404
- ```bash
405
- mushi integrations list
406
- mushi integrations test slack|sentry|github
407
- mushi keys list
408
- MUSHI_BYOK_KEY=sk-ant-... mushi keys add --provider anthropic --label "Backup"
409
- mushi slack status
410
- mushi slack test
411
- ```
59
+ Other `init` flags: `--framework next`, `--cwd apps/web` (monorepos), `--endpoint <url>` (self-hosted), `--skip-install`.
412
60
 
413
61
  ## Environment variables
414
62
 
415
63
  | Variable | Purpose |
416
64
  | --- | --- |
417
- | `MUSHI_API_KEY` | Admin or ingest API key (prefer env over `--api-key` flag) |
418
- | `MUSHI_API_ENDPOINT` | API base URL (defaults to Mushi Cloud when unset) |
65
+ | `MUSHI_API_KEY` | API key. Prefer it over `--api-key`, which shows up in `ps` |
419
66
  | `MUSHI_PROJECT_ID` | Project UUID |
420
- | `MUSHI_CONSOLE_URL` | Admin console base for hints + browser opens |
421
- | `MUSHI_BYOK_KEY` | BYOK key for `mushi keys add` (keeps key out of shell history) |
422
- | `MUSHI_NO_UPDATE_CHECK=1` | Skip npm registry version nudge in `mushi init` |
423
-
424
- Config file: `~/.config/mushi/config.json` (Unix mode `0o600`; legacy `~/.mushirc` auto-migrates).
425
-
426
- ## Security notes
427
-
428
- - `~/.config/mushi/config.json` is written with mode `0o600` on Unix. Legacy configs with looser permissions are tightened on load.
429
- - `--endpoint` values are parsed through `new URL()` and required to use `https://` except for `localhost` / `127.0.0.1` / `*.local`.
430
- - The `--api-key` flag leaks into `ps -ef` — prefer the interactive prompt on shared machines.
431
- - Full stack traces on error: `MUSHI_DEBUG=1 mushi init`.
67
+ | `MUSHI_API_ENDPOINT` | API base URL (defaults to Mushi Cloud) |
68
+ | `MUSHI_CONSOLE_URL` | Console base for links and browser opens |
69
+ | `MUSHI_BYOK_KEY` | Key for `mushi keys add`, kept out of shell history |
70
+ | `MUSHI_NO_UPDATE_CHECK=1` | Skip the "newer version" hint |
71
+ | `MUSHI_DEBUG=1` | Full stack traces on error |
432
72
 
433
- ## Programmatic imports
73
+ Config lives in `~/.config/mushi/config.json`, written with mode `0o600` (a legacy `~/.mushirc` is auto-migrated). `--endpoint` must be `https://` except on localhost.
434
74
 
435
- The CLI is also importable for tooling (used by `create-mushi-mushi`):
75
+ ## Programmatic use
436
76
 
437
- | Subpath | Exports |
77
+ | Import | Exports |
438
78
  | --- | --- |
439
79
  | `@mushi-mushi/cli/init` | `runInit`, `InitOptions` |
440
- | `@mushi-mushi/cli/detect` | Framework / package-manager detection |
80
+ | `@mushi-mushi/cli/detect` | Framework and package-manager detection |
441
81
  | `@mushi-mushi/cli/version` | `MUSHI_CLI_VERSION` |
442
82
 
83
+ ## Learn more
84
+
85
+ [CLI reference](https://kensaur.us/mushi-mushi/docs/sdks/cli) · [CLI and console loop](https://kensaur.us/mushi-mushi/docs/quickstart/cli-console-loop) · [MCP setup](https://kensaur.us/mushi-mushi/docs/quickstart/mcp)
86
+
443
87
  ## License
444
88
 
445
89
  MIT
446
-
447
- <!-- mushi-readme-stats-footer -->
448
- <sub>Monorepo scale (July 2026): 64 edge functions · 410 SQL migrations · 13 outbound plugins · 11 inbound adapters · 19 pipeline agents. Canonical counts: <a href="https://github.com/kensaurus/mushi-mushi/blob/master/docs/stats.md">docs/stats.md</a> · <code>pnpm docs-stats</code></sub>
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/version.ts
4
+ var MUSHI_CLI_VERSION = true ? "0.30.0" : "0.0.0-dev";
5
+ var MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.24.4";
6
+
7
+ export {
8
+ MUSHI_CLI_VERSION,
9
+ MUSHI_MCP_PIN_SPEC
10
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MUSHI_CLI_VERSION
3
- } from "./chunk-JE3STWB2.js";
3
+ } from "./chunk-WNKM6APL.js";
4
4
  import {
5
5
  assertEndpoint,
6
6
  normalizeEndpoint
@@ -95,7 +95,7 @@ function loadConfig(path = CONFIG_PATH, opts = {}) {
95
95
  if (isMultiProfileFile(parsed)) {
96
96
  const name = resolveProfileName(opts.profile, parsed.activeProfile);
97
97
  file = parsed.profiles[name] ?? {};
98
- } else {
98
+ } else if (resolveProfileName(opts.profile, void 0) === DEFAULT_PROFILE) {
99
99
  file = parsed ?? {};
100
100
  }
101
101
  } catch {
@@ -391,9 +391,9 @@ async function openInBrowser(url) {
391
391
  ) : process.platform === "darwin" ? ["open", [safeUrl]] : ["xdg-open", [safeUrl]];
392
392
  await new Promise((resolve) => {
393
393
  try {
394
- const child = spawn(command, [...args], { stdio: "ignore", shell: false });
395
- child.on("error", () => resolve());
396
- child.on("exit", () => resolve());
394
+ const child = spawn(command, [...args], { stdio: "ignore", shell: false, detached: process.platform !== "win32" });
395
+ child.once("spawn", () => resolve());
396
+ child.once("error", () => resolve());
397
397
  child.unref();
398
398
  } catch {
399
399
  resolve();
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  MUSHI_CLI_VERSION,
4
4
  MUSHI_MCP_PIN_SPEC
5
- } from "./chunk-HHOPCVNI.js";
5
+ } from "./chunk-27FTLLR2.js";
6
6
  import {
7
7
  detectFramework,
8
8
  envVarsToWrite,
@@ -109,7 +109,7 @@ function loadConfig(path = CONFIG_PATH, opts = {}) {
109
109
  if (isMultiProfileFile(parsed)) {
110
110
  const name = resolveProfileName(opts.profile, parsed.activeProfile);
111
111
  file = parsed.profiles[name] ?? {};
112
- } else {
112
+ } else if (resolveProfileName(opts.profile, void 0) === DEFAULT_PROFILE) {
113
113
  file = parsed ?? {};
114
114
  }
115
115
  } catch {
@@ -505,9 +505,9 @@ async function openInBrowser(url) {
505
505
  ) : process.platform === "darwin" ? ["open", [safeUrl]] : ["xdg-open", [safeUrl]];
506
506
  await new Promise((resolve2) => {
507
507
  try {
508
- const child = spawn(command, [...args], { stdio: "ignore", shell: false });
509
- child.on("error", () => resolve2());
510
- child.on("exit", () => resolve2());
508
+ const child = spawn(command, [...args], { stdio: "ignore", shell: false, detached: process.platform !== "win32" });
509
+ child.once("spawn", () => resolve2());
510
+ child.once("error", () => resolve2());
511
511
  child.unref();
512
512
  } catch {
513
513
  resolve2();
@@ -0,0 +1,8 @@
1
+ // src/version.ts
2
+ var MUSHI_CLI_VERSION = true ? "0.30.0" : "0.0.0-dev";
3
+ var MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.24.4";
4
+
5
+ export {
6
+ MUSHI_CLI_VERSION,
7
+ MUSHI_MCP_PIN_SPEC
8
+ };
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  resolveSdkEnvKey,
4
4
  runConnect
5
- } from "./chunk-MDYYLRWB.js";
6
- import "./chunk-HHOPCVNI.js";
5
+ } from "./chunk-LCCMRMPN.js";
6
+ import "./chunk-27FTLLR2.js";
7
7
  import "./chunk-KOBEOGNF.js";
8
8
  import "./chunk-LDPFTQLE.js";
9
9
  import "./chunk-PDX44BCA.js";
@@ -6,10 +6,10 @@ import {
6
6
  saveConfig,
7
7
  savedSdkKeyFor,
8
8
  waitForIngestReady
9
- } from "./chunk-KQ6POXZH.js";
9
+ } from "./chunk-HIIZZEAH.js";
10
10
  import {
11
11
  MUSHI_MCP_PIN_SPEC
12
- } from "./chunk-JE3STWB2.js";
12
+ } from "./chunk-WNKM6APL.js";
13
13
  import {
14
14
  detectFramework,
15
15
  envVarsToWrite,