open-index/open-npm huggingface dataset:
npm package: @getdiff/acp
Description: ACP agent wrapper — run GetDiff in any ACP-compatible editor
Latest version: 0.1.0

# @getdiff/acp

ACP (Agent Control Protocol) wrapper for GetDiff. Run GetDiff as a coding agent in any ACP-compatible editor — Zed, JetBrains, Neovim, Emacs, VS Code — with one package.

## What This Does

Wraps `@getdiff/sdk` as an ACP-compatible subprocess. Editors spawn it, send prompts over stdin, and receive streaming responses on stdout via JSON-RPC 2.0. The editor handles all UI (chat panel, diffs, terminal, approvals). This package handles the agent logic.

## Quick Start

```bash
# Install globally
npm install -g @getdiff/acp

# Or run directly
npx @getdiff/acp
```

No API key needed — defaults to the free Diff hosted provider.

## Editor Setup

### Zed

GetDiff appears in Zed's agent picker once registered in the ACP registry. Select "GetDiff" and start chatting.

### VS Code

Install the [ACP extension](https://marketplace.visualstudio.com/items?itemName=acp.vscode-acp), then configure it to use GetDiff:

```json
{
  "acp.agents": [{
    "name": "GetDiff",
    "command": "npx",
    "args": ["@getdiff/acp"]
  }]
}
```

### JetBrains / Neovim / Emacs

Any editor with ACP support can spawn `getdiff-acp` (or `npx @getdiff/acp`) as a subprocess.

## Configuration

Config is read from `~/.getdiff/config.json`:

```json
{
  "provider": "anthropic",
  "model": "claude-sonnet-4-6",
  "apiKey": "sk-..."
}
```

Environment variables override the config file:

| Variable | Description |
|----------|-------------|
| `GETDIFF_PROVIDER` | Provider name (`diff`, `anthropic`, `openai`, `google`, etc.) |
| `GETDIFF_MODEL` | Model identifier |
| `GETDIFF_API_KEY` | API key for the provider |
| `GETDIFF_API_BASE_URL` | Custom API base URL |

## How It Works

```
Editor (Zed, VS Code, etc.)          @getdiff/acp
  │                                      │
  ├─── session/initialize ──────────────►│  negotiate capabilities
  ├─── session/new ─────────────────────►│  create session
  ├─── session/prompt ──────────────────►│  user message
  │                                      │
  │◄─── agent_message_chunk ────────────┤  streaming text
  │◄─── agent_thought_chunk ────────────┤  thinking (if enabled)
  │◄─── tool_call ─────────────────────┤  Read, Edit, Bash, etc.
  │                                      │
  ├─── requestPermission ──────────────►│  editor shows approval UI
  │◄─── permission result ─────────────┤
  │                                      │
  │◄─── tool_call_update ──────────────┤  tool result
  │◄─── PromptResponse ───────────────┤  done
```

The agent runs `@getdiff/sdk`'s `query()` in-process (no CLI subprocess). SDK messages are translated to ACP notifications in real time.

## Development

```bash
# From the monorepo root
npm install

# Build
cd acp && npm run build

# Type-check
npm run typecheck

# Run locally
node dist/index.js
```

## License

Apache-2.0