Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .changeset/cli-catalog-consumers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
'aicodeman': minor
---

`install.sh` and the Docker agent image now read the shipped CLI catalogue instead of
hand-maintaining their own lists.

Adding a CLI to `src/config/cli-registry/stock.ts` and running
`npm run generate:cli-catalog` wires it into the installer's detection, its install menu and
its closing reminder, and into the agent image's npm layer. Previously each of those was a
separate hand-written list that had to be kept in step and was not: upstream `b6d0f1fa` is
"wire OMP into install.sh's CLI detection (it had none)", where a user with only `omp`
installed was told no AI CLI was found and offered Claude Code, and the section comment above
that code named six of the nine CLIs.

The generator emits two committed artifacts, because neither consumer can import TypeScript:
`config/clis.stock.json` for the Docker build, and a marked block inside `install.sh` itself,
which runs via `curl | bash` before any checkout exists. The embedded copy is the FULL
catalogue: an earlier attempt fetched it and fell back to a hardcoded two-CLI list, degrading
silently on an empty response, and there is no degraded mode to fall into now — nor a network
fetch at all, since a `curl | bash` from master already carries a catalogue exactly as fresh as
the script itself.

**Trust model is unchanged and now mechanical.** The server still never executes an entry's
install command. `install.sh` executes only commands embedded in itself — same file, same TLS
fetch, same commit as the `curl | bash` line that fetched it — and nothing pulled from the
network at install time is ever run, because nothing is fetched at install time at all.

**The agent image respects `enabled`.** The generated catalogue carries that flag, so a CLI
shipping disabled is no longer baked into every image. It reads the stock catalogue rather than
the merged registry, so a user's `~/.codeman/clis.json` cannot change what is inside an image
tagged `codeman/agent:base`.

User-visible changes, all in the installer:

- The install menu is built from the catalogue, so it offers every enabled CLI with an install command that can drive a pane on its own — eight today, rather than the previous fixed two. Gemini had a command in the registry and appeared in no list in the script at all. DeepSeek is the one enabled CLI with a registry command that is deliberately NOT offered: `npm install -g @deepseek-ai/dsh` installs only the launcher, which ships no profile that can drive a terminal on its own, so choosing it used to leave the user with an AI CLI the installer considered "found" but that could not actually run anything. It still gets a hint pointing at its docs.
- Its entries use the registry's labels ("Claude" rather than "Claude Code"), the same trade already made for `codeman doctor` rows. A suffix map would just be the hand-maintained list again.
- On a `wget`-only host, only the menu entries that actually need `curl` are held back (still shown as copy-paste hints); the `npm install -g` entries, which never needed it, are unaffected. Rewriting `curl` to `wget` inside a string about to be executed is the wrong instinct either way.
- `CODEMAN_NONINTERACTIVE=1` still defaults to Claude Code, unchanged.

`install.sh` remains bash 3.2 compatible (macOS ships it): parallel indexed arrays with
offset/length windows instead of delimiters, no associative arrays, namerefs, `mapfile` or
here-strings. CI now runs `bash -n`, executes the script inside a real `bash:3.2` container —
which is what catches expanding an empty array under `set -u`, a runtime abort `bash -n` cannot
see — and checks the generated artifacts are in sync.

`docker/server.Dockerfile` is deliberately untouched; its narrower CLI list is now asserted as
a declared omission list so the divergence is visible rather than accidental.
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,35 @@ jobs:
- name: Format check
run: npm run format:check

# install.sh reaches users through `curl | bash` with nothing between it and
# them, and until now nothing in this repo checked it at all: no shellcheck,
# no bats, and the vitest gate is Node-only.
- name: install.sh syntax
run: bash -n install.sh

# macOS ships bash 3.2 and this runner has bash 5, so the constructs that
# actually break a Mac install are invisible here without a container. This
# step is what catches them — in particular expanding an EMPTY array under
# `set -u`, which bash 3.2 treats as an unbound variable and `bash -n`
# cannot see because it is a runtime error, not a syntax one.
- name: install.sh runs on bash 3.2 (macOS's version)
run: |
set -euo pipefail
docker run --rm -v "$PWD":/w -w /w bash:3.2 bash -n /w/install.sh
docker run --rm -v "$PWD":/w -w /w -e CODEMAN_INSTALL_SH_LIB=1 bash:3.2 bash -c '
set -euo pipefail
. /w/install.sh
detect_all_clis
# `shell` declares no binaries, so its offset/length window is length 0.
# Iterating it is the empty-array case; reaching here means it did not abort.
echo "bash $BASH_VERSION: ${#CLI_IDS[@]} CLIs, $CLI_FOUND_COUNT found"
cli_catalog_names >/dev/null
cli_catalog_print_install_hints >/dev/null
'

- name: CLI catalogue artifacts are in sync with stock.ts
run: npm run generate:cli-catalog -- --check

- name: Server boot smoke test
run: |
set -u
Expand Down
3 changes: 2 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ Codeman is a Claude Code session manager with web interface and autonomous Ralph
| Test coverage | `npm run test:coverage` |
| Dead-code sweep | `npm run knip` (config in `config/knip.json`, passed via `--config`) |
| Rebuild gesture overlay | `npm run build:gesture` (esbuild `packages/gesture-control/src/codeman/entry.ts` → `src/web/public/gesture/gesture-codeman.js`; commit the result) |
| Regenerate the CLI catalogue | `npm run generate:cli-catalog` (`--check` to fail on drift). Rewrites `config/clis.stock.json` **and** the marked block in `install.sh` from `stock.ts`. ⚠ **Commit both.** They are what `install.sh` and the Docker agent image read, since neither can import TypeScript; `test/cli-catalog-sync.test.ts` and a CI `--check` step fail if either goes stale. See `docs/cli-registry.md` |
| Build the docker agent image | `node scripts/build-agent-image.mjs --no-cache` (builds `codeman/agent:base` from `docker/agent.Dockerfile`; prerequisite for Docker cases; `--engine`/`--image`). ⚠ **Always `--no-cache`** — a plain rebuild re-uses the cached `npm install -g` layer and silently keeps the CLIs frozen at their original versions, which once shipped a BROKEN codex while reporting success. See `docs/docker-cases.md` |
| Gesture playground | `npm run dev` **in** `packages/gesture-control/` (standalone vite demo, fake tabs) |
| Check public-asset formatting | `npm run check:public-assets` (prettier-checks `src/web/public/**` text assets; `scripts/check-public-assets.mjs`) |
Expand Down Expand Up @@ -449,6 +450,6 @@ Two constraints worth knowing before you touch them: the env-derived PTY buffer

## Scripts & Tunnel

**`install.sh`** (repo root, 104KB) is the public entry point: `curl -fsSL <raw url> | bash` installs Node/tmux if missing, clones to `~/.codeman/app`, builds, and offers a systemd/launchd service. The network-access prompt is 3-way: **Tailscale** (loopback bind + guided `tailscale serve --bg <port>` HTTPS setup: install/login/operator/tailnet-HTTPS-toggle, then curl-verified end-to-end), **LAN** (0.0.0.0 + password prompt), or **local-only**; it preserves the existing binding on re-runs via `read_existing_binding()`. Tailscale state is detected dynamically from `tailscale serve status --json` (no marker files); the installer must NEVER `tailscale serve reset` or touch serve mappings other than 443→Codeman's port (users have unrelated serve config). `install.sh update`, `install.sh uninstall`, and `install.sh tailscale` (retrofit Tailscale access onto an existing install) also exist; `CODEMAN_NONINTERACTIVE=1` approves system changes for automation, `CODEMAN_TAILSCALE=1` presets the Tailscale choice (never installs Tailscale non-interactively).
**`install.sh`** (repo root, ~112KB) is the public entry point: `curl -fsSL <raw url> | bash` installs Node/tmux if missing, clones to `~/.codeman/app`, builds, and offers a systemd/launchd service. The network-access prompt is 3-way: **Tailscale** (loopback bind + guided `tailscale serve --bg <port>` HTTPS setup: install/login/operator/tailnet-HTTPS-toggle, then curl-verified end-to-end), **LAN** (0.0.0.0 + password prompt), or **local-only**; it preserves the existing binding on re-runs via `read_existing_binding()`. Tailscale state is detected dynamically from `tailscale serve status --json` (no marker files); the installer must NEVER `tailscale serve reset` or touch serve mappings other than 443→Codeman's port (users have unrelated serve config). `install.sh update`, `install.sh uninstall`, and `install.sh tailscale` (retrofit Tailscale access onto an existing install) also exist; `CODEMAN_NONINTERACTIVE=1` approves system changes for automation, `CODEMAN_TAILSCALE=1` presets the Tailscale choice (never installs Tailscale non-interactively). Its CLI knowledge is a GENERATED block (`npm run generate:cli-catalog`, markers in the file), not a hand-written list: detection, the install menu and the closing reminder all read it, which is what stops the class of bug upstream `b6d0f1fa` fixed by hand (a user with only omp installed being told no AI CLI was found). ⚠️ It must stay **bash 3.2** clean — macOS ships it and the documented install is `curl | bash` under `set -euo pipefail`, so `declare -A`, `mapfile`, namerefs, `${x,,}` and here-strings are all fatal there; CI runs `bash -n` plus a real `bash:3.2` container, since expanding an EMPTY array under `set -u` is a runtime abort `bash -n` cannot see. ⚠️ It executes ONLY commands from the embedded block (`CLI_INSTALL_CMD_TRUSTED`) — there is no network fetch of the catalogue at install time to worry about at all.

Other key scripts: `scripts/tmux-manager.sh` (safe tmux mgmt), `scripts/tunnel.sh [quick|named] start|stop|status|url` (quick = random trycloudflare URL, default; `named setup|enable` = fixed-hostname tunnel via `scripts/codeman-tunnel-named.service`; bare `start|stop|url` still means quick), `scripts/run-beta.sh` (isolated beta instance), `scripts/build-agent-image.mjs` (docker base image), `scripts/self-update.sh` (detached updater). Production services: `scripts/codeman-web.service`, `scripts/codeman-tunnel.service`. **Always set `CODEMAN_PASSWORD`** before exposing via tunnel.
281 changes: 281 additions & 0 deletions config/clis.stock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,281 @@
[
{
"id": "claude",
"label": "Claude",
"shortBadge": "CC",
"enabled": true,
"order": 0,
"kind": "agent",
"discovery": {
"binaries": [
"claude"
],
"searchDirs": [
"~/.local/bin",
"~/.claude/local",
"/usr/local/bin",
"~/.npm-global/bin",
"~/bin"
],
"install": {
"command": {
"linux": "curl -fsSL https://claude.ai/install.sh | bash",
"darwin": "curl -fsSL https://claude.ai/install.sh | bash",
"wsl": "curl -fsSL https://claude.ai/install.sh | bash"
},
"npmPackage": "@anthropic-ai/claude-code",
"docsUrl": "https://docs.claude.com/claude-code"
}
}
},
{
"id": "shell",
"label": "Shell",
"shortBadge": "SH",
"enabled": true,
"order": 1,
"kind": "shell",
"discovery": {
"binaries": [],
"searchDirs": [],
"install": {
"command": {}
}
}
},
{
"id": "opencode",
"label": "OpenCode",
"shortBadge": "OC",
"enabled": true,
"order": 10,
"kind": "agent",
"discovery": {
"binaries": [
"opencode"
],
"searchDirs": [
"~/.opencode/bin",
"~/.local/bin",
"/usr/local/bin",
"~/go/bin",
"~/.bun/bin",
"~/.npm-global/bin",
"~/bin"
],
"install": {
"command": {
"linux": "curl -fsSL https://opencode.ai/install | bash",
"darwin": "curl -fsSL https://opencode.ai/install | bash"
},
"npmPackage": "opencode-ai",
"docsUrl": "https://opencode.ai/docs"
}
}
},
{
"id": "codex",
"label": "Codex",
"shortBadge": "CX",
"enabled": true,
"order": 20,
"kind": "agent",
"discovery": {
"binaries": [
"codex"
],
"searchDirs": [
"~/.codex/bin",
"~/.local/bin",
"/usr/local/bin",
"~/.bun/bin",
"~/.npm-global/bin",
"~/bin"
],
"install": {
"command": {
"linux": "npm install -g @openai/codex",
"darwin": "npm install -g @openai/codex"
},
"npmPackage": "@openai/codex",
"docsUrl": "https://developers.openai.com/codex/cli"
}
}
},
{
"id": "gemini",
"label": "Gemini",
"shortBadge": "GM",
"enabled": true,
"order": 30,
"kind": "agent",
"discovery": {
"binaries": [
"gemini"
],
"searchDirs": [
"~/.gemini/bin",
"~/.local/bin",
"/usr/local/bin",
"~/.bun/bin",
"~/.npm-global/bin",
"~/bin"
],
"install": {
"command": {
"linux": "npm install -g @google/gemini-cli",
"darwin": "npm install -g @google/gemini-cli"
},
"npmPackage": "@google/gemini-cli",
"docsUrl": "https://github.com/google-gemini/gemini-cli"
}
}
},
{
"id": "antigravity",
"label": "Antigravity",
"shortBadge": "AG",
"enabled": true,
"order": 40,
"kind": "agent",
"discovery": {
"binaries": [
"agy"
],
"searchDirs": [
"~/.local/bin",
"~/.antigravity/bin",
"/usr/local/bin",
"~/bin"
],
"install": {
"command": {
"linux": "curl -fsSL https://antigravity.google/cli/install.sh | bash",
"darwin": "curl -fsSL https://antigravity.google/cli/install.sh | bash"
},
"docsUrl": "https://antigravity.google/cli"
}
}
},
{
"id": "pi",
"label": "Pi",
"shortBadge": "PI",
"enabled": true,
"order": 50,
"kind": "agent",
"discovery": {
"binaries": [
"pi"
],
"searchDirs": [
"~/.local/bin",
"/usr/local/bin",
"~/.bun/bin",
"~/.npm-global/bin",
"~/bin"
],
"install": {
"command": {
"linux": "npm install -g --ignore-scripts @earendil-works/pi-coding-agent",
"darwin": "npm install -g --ignore-scripts @earendil-works/pi-coding-agent"
},
"npmPackage": "@earendil-works/pi-coding-agent",
"docsUrl": "https://pi.dev",
"agentImageLayer": {
"kind": "dedicated",
"reason": "installed with --ignore-scripts in its own layer, so the flag cannot leak to the shared block"
}
}
}
},
{
"id": "grok",
"label": "Grok",
"shortBadge": "GK",
"enabled": true,
"order": 70,
"kind": "agent",
"discovery": {
"binaries": [
"grok"
],
"searchDirs": [
"~/.grok/bin",
"~/.local/bin",
"/usr/local/bin",
"~/bin"
],
"install": {
"command": {
"linux": "curl -fsSL https://x.ai/cli/install.sh | bash",
"darwin": "curl -fsSL https://x.ai/cli/install.sh | bash"
},
"docsUrl": "https://github.com/xai-org/grok-build"
}
}
},
{
"id": "deepseek",
"label": "DeepSeek",
"shortBadge": "DS",
"enabled": true,
"order": 80,
"kind": "agent",
"discovery": {
"binaries": [
"dsh"
],
"searchDirs": [
"~/.local/bin",
"/usr/local/bin",
"~/.npm-global/bin",
"~/bin"
],
"identity": {
"arg": "--help",
"regex": "DeepSeek\\s+Harness"
},
"install": {
"command": {
"linux": "npm install -g @deepseek-ai/dsh",
"darwin": "npm install -g @deepseek-ai/dsh"
},
"npmPackage": "@deepseek-ai/dsh",
"docsUrl": "https://github.com/deepseek-ai/deepseek-harness",
"agentImageLayer": {
"kind": "dedicated",
"reason": "needs pnpm alongside it (dsh plugin, issue #352) and a dsh-tui profile install"
}
}
}
},
{
"id": "omp",
"label": "OMP",
"shortBadge": "OM",
"enabled": true,
"order": 90,
"kind": "agent",
"discovery": {
"binaries": [
"omp"
],
"searchDirs": [
"~/.local/bin",
"~/.omp/bin",
"/usr/local/bin",
"~/.bun/bin",
"~/.npm-global/bin",
"~/bin"
],
"install": {
"command": {
"linux": "curl -fsSL https://omp.sh/install | sh",
"darwin": "brew install can1357/tap/omp"
},
"docsUrl": "https://omp.sh"
}
}
}
]
Loading