Repository navigation
Commit a2827ac
authored
Nix-free plugin launcher — consumers launch via bun on PATH (#2)
## What
The Claude Code plugin required **Nix on the consumer's PATH**:
`.mcp.json` launched the MCP server via `nix run
path:${CLAUDE_PLUGIN_ROOT}#default -- … server.ts`, and the PreToolUse
hook resolved bun via `nix build`. The plugin's flake only ever provided
`pkgs.bun`, so every external installer of `commy@commy` needed Nix for
no reason beyond pinning bun.
Nix stays fully supported for those who use it (the flake and dev shell
are untouched) — it just no longer sits in the **consumer** launch path.
Vanilla `bun`-on-PATH is the baseline; nix is an opt-in addition.
## How
- **Launcher → `clients/claude-code/launch.sh`**, a POSIX-`sh`
bun-on-PATH bootstrap (no bashisms, so it imposes no shell of our
choosing — dash/ash/busybox/bash all run it). Claude Code installs a
plugin by cloning the marketplace repo and installs **no** JS deps, so a
fresh checkout has no `node_modules`; the launcher stages the workspace
deps **once** — `bun install --frozen-lockfile` at the workspace root,
guarded by a portable `mkdir` mutex + a re-check so concurrently-booting
sessions can't race to EEXIST — then `exec`s bun against the server
entrypoint.
- `exec` keeps the server Claude Code's **direct child**, so a session
disconnect reaches it (no orphaned server).
- The stage runs **only** when `node_modules` is absent; every launch
after the first is a plain `exec`, no install at connect.
- **PreToolUse hook → `bun` on PATH directly**; the now-vestigial
`hooks/bun-wrap.sh` (the nix-build wrapper) and its test are removed.
The hook entrypoint imports no workspace packages, so it needs only bun,
nothing staged.
- **Bun pin** moves from the flake to `packageManager: "bun@1.3.13"` + a
documented minimum (`bun ≥ 1.3.13`) in the plugin README.
## Prereq for consumers
**`bun ≥ 1.3.13` on PATH** — that's the whole prerequisite. No Nix, no
global installs.
## Verification
- Clean clone + `launch.sh` **cold-boots** (stages deps, answers MCP
`initialize` with `serverInfo`) and **warm-boots** (no reinstall, pure
`exec`) — both under POSIX `sh`.
- `shellcheck -s sh` clean; `sh -n` clean.
- Full `bun run check` green; new tests pin the contracts (bun-not-nix,
`exec` direct-child, no run/start indirection, guarded one-time stage,
POSIX-sh shebath/no-bashisms).1 parent 331eeb3 commit a2827ac
9 files changed
Lines changed: 121 additions & 275 deletions
File tree
- clients/claude-code
- hooks
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
| 4 | + | |
12 | 5 | | |
13 | 6 | | |
14 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
24 | 30 | | |
25 | 31 | | |
26 | 32 | | |
| |||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
68 | 68 | | |
69 | | - | |
70 | | - | |
| 69 | + | |
71 | 70 | | |
72 | 71 | | |
73 | 72 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
0 commit comments