feat: add "Anthropic — via Claude CLI" as a first-class provider
Replaces the stray useClaudeCli settings checkbox + onboarding question
with a proper provider-card UX. The card lives next to OAuth + API-key
cards in onboarding and settings, with Enable/Disable + Test actions.
Backend:
- Vendors rchern/pi-claude-cli@0.3.1 as packages/pi-claude-cli
(MIT, attribution in UPSTREAM.md). Lets us bump peer-dep on
pi-coding-agent in lockstep with Fusion (upstream pinned ^0.52.0
vs ours ^0.62.0) and fix bugs without waiting on upstream.
- Adds @fusion/pi-claude-cli as a workspace dep of @runfusion/fusion
so users don't have to `npm install -g pi-claude-cli` manually.
- serve/daemon/dashboard conditionally load the extension via
discoverAndLoadExtensions() when GlobalSettings.useClaudeCli is on;
no side-effects on user ~/.fusion/agent/settings.json.
- New GET /api/providers/claude-cli/status: claude --version probe
+ toggle state + cached extension resolution.
- New POST /api/auth/claude-cli: flips useClaudeCli, refuses if the
claude binary is missing, fires the existing skill-backfill hook.
- /api/auth/status now injects a synthetic {id:"claude-cli", type:"cli"}
provider entry so onboarding + settings see a consistent list.
Frontend:
- New ClaudeCliProviderCard component shared between ModelOnboardingModal
and SettingsModal's Authentication section.
- New AuthProvider.type = "cli" variant.
- Removed the old "Route AI calls through the Claude CLI" checkbox from
Global Models settings and the opt-in step from the onboarding wizard.
- ProviderIcon gets a composite Anthropic-mark-plus-terminal glyph for
the claude-cli provider id.
Tests:
- 8 unit tests for extension resolution (@fusion/pi-claude-cli is
workspace-linked so these run in-tree).
- 2 unit tests for the binary probe.
- Existing /auth/status tests filter out the new synthetic entry so
they keep asserting structural OAuth/API-key behavior in isolation.
- The vendored package's own 296 tests still pass unchanged.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
40
packages/pi-claude-cli/README.md
Normal file
40
packages/pi-claude-cli/README.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# pi-claude-cli
|
||||
|
||||
A [pi](https://github.com/mariozechner/pi-coding-agent) extension that routes LLM calls through the [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) as a subprocess. Use your Claude Pro/Max subscription as the LLM backend — no API key, no separate billing.
|
||||
|
||||
## How it works
|
||||
|
||||
The extension registers as a custom pi provider exposing all Claude models. Each request spawns a `claude -p` subprocess using the stream-json wire protocol, with `--resume` on follow-up turns to reuse the CLI's session state instead of replaying full history. Claude proposes tool calls, pi executes them natively. Custom pi tools are exposed to Claude via a schema-only MCP server.
|
||||
|
||||
## Requirements
|
||||
|
||||
- [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) installed and authenticated (`claude` on PATH)
|
||||
- A Claude Pro or Max subscription
|
||||
- [pi](https://github.com/mariozechner/pi-coding-agent) or [GSD](https://github.com/gsd-build/gsd-2)
|
||||
|
||||
## Installation
|
||||
|
||||
Add to `~/.gsd/agent/settings.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"packages": ["npm:pi-claude-cli"]
|
||||
}
|
||||
```
|
||||
|
||||
Then select a Claude model via `/model` in the interactive UI. All Claude models appear under the `pi-claude-cli` provider.
|
||||
|
||||
## Features
|
||||
|
||||
- Streams text, thinking, and tool call tokens in real-time
|
||||
- Maps tool names and arguments bidirectionally between Claude and pi
|
||||
- Exposes custom pi tools to Claude via MCP (schema-only, no execution)
|
||||
- Break-early pattern prevents Claude CLI from auto-executing tools
|
||||
- Session resume via `--resume` eliminates history replay on follow-up turns
|
||||
- Configurable thinking effort with elevated budgets for Opus models
|
||||
- Cross-platform subprocess management (Windows, macOS, Linux)
|
||||
- Inactivity timeout and process registry for cleanup
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
Reference in New Issue
Block a user