refactor(prime-agent): extract the /mcpctl switcher to typechecked source; pi --dry-run; docs
Some checks failed
CI/CD / lint (pull_request) Successful in 1m11s
CI/CD / test (pull_request) Successful in 1m24s
CI/CD / typecheck (pull_request) Successful in 3m20s
CI/CD / smoke (pull_request) Failing after 2m1s
CI/CD / build (pull_request) Successful in 2m37s
CI/CD / publish (pull_request) Has been skipped
Some checks failed
CI/CD / lint (pull_request) Successful in 1m11s
CI/CD / test (pull_request) Successful in 1m24s
CI/CD / typecheck (pull_request) Successful in 3m20s
CI/CD / smoke (pull_request) Failing after 2m1s
CI/CD / build (pull_request) Successful in 2m37s
CI/CD / publish (pull_request) Has been skipped
The prime-agent switcher existed only as a 275-line string literal inside
prime-agent-extension.ts, so nothing typechecked or linted it — the exact gap
that let a wrong ctx.ui.select() option shape ship in the pi extension. It now
lives at src/prime-agent-ext/mcpctl-switch.ts with a generator, a tsconfig
checking it against the real @earendil-works/pi-coding-agent types, eslint
coverage and an embed-freshness test, matching pi and opencode.
The extraction was verified byte-identical before any edit, so the behaviour
shipped today is exactly what was captured. Linting it then found six problems
in code nothing had ever checked: object-truthiness null guards, a nullable
string conditional and a missing return type. All behaviour-preserving to fix,
but exactly the class of thing that ships silently when nothing is looking.
Also:
- `config pi` gains --dry-run, the last agent without it.
- The SessionStart hook installer now drops untagged duplicates of its own
exact command — rows left behind before the marker existed, or by a suite
that used to write into a real ~/.claude. Invisible in the UI; they just run
the sync twice per session. A hook the user wrote is never touched, even one
calling `mcpctl skills sync` with different flags.
- docs/claude-integration.md and docs/prime-agent-extension.md, the two
integrations that had no page.
prime-agent deliberately keeps its per-project MCP entry name rather than the
constant `mcpctl` claude and opencode now use: its switcher already unmounts the
previous project, so it never accumulates entries, and re-keying auth.json from
mcp:<project> to mcp:mcpctl would give up per-project token caching and needs a
migration. Documented as its own change rather than folded in here.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BVwuCjuMoA13gmzYEfcrNP
This commit is contained in:
10
README.md
10
README.md
@@ -164,12 +164,22 @@ The `/mcpctl` switcher runs with `--skip-extension --skip-marker`, so switching
|
||||
projects from inside prime-agent never re-scopes whichever repository
|
||||
prime-agent happened to be started in.
|
||||
|
||||
See [docs/prime-agent-extension.md](docs/prime-agent-extension.md) for full details.
|
||||
|
||||
Preview the change without writing anything:
|
||||
|
||||
```bash
|
||||
mcpctl config prime-agent --project monitoring --dry-run
|
||||
```
|
||||
|
||||
Inside Claude Code:
|
||||
|
||||
- `/mcpctl [project]` — switch projects, then reconnect the `mcpctl` server from
|
||||
`/mcp` (no restart)
|
||||
- the active project shows in the status line at the bottom of the screen
|
||||
|
||||
See [docs/claude-integration.md](docs/claude-integration.md) for full details.
|
||||
|
||||
### Connect pi
|
||||
|
||||
[pi](https://github.com/earendil-works/pi) does not support MCP, but it supports
|
||||
|
||||
Reference in New Issue
Block a user