Skip to content
Merged
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
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# Changelog

## Fork notice — 2026-05-24

This repository is now `protoLabsAI/protoPatch`, a protoLabs-maintained fork
of `openclaw/clawpatch`. The version stream is renumbered (`0.5.0` and on)
to make our releases unambiguous against upstream. The CLI binary stays as
`clawpatch` for downstream compatibility; `protopatch` is also installed as
an alias for explicitness.

## 0.5.0 - Unreleased (protoLabs fork)

- **fork**: protoLabs took ownership 2026-05-24. Package renamed to
`@protolabsai/protopatch` on npm. Install via
`pnpm add -g @protolabsai/protopatch` (or
`pnpm add -g github:protoLabsAI/protoPatch` direct from this repo).
- **provider**: added `gateway` — POSTs the assembled prompt to any
OpenAI-compatible `/chat/completions` endpoint with structured outputs
(`response_format: json_schema`). No CLI subprocess; no auth handshake.
Designed for the protoLabs LiteLLM gateway but works against any
OpenAI-compatible server (vanilla OpenAI, vLLM, LM Studio, Ollama with the
OpenAI shim). Env: `GATEWAY_API_KEY` (or `OPENAI_API_KEY`), `OPENAI_BASE_URL`
(default `https://api.proto-labs.ai/v1`), `CLAWPATCH_GATEWAY_MODEL`
(default `protolabs/smart`), `CLAWPATCH_GATEWAY_TIMEOUT_MS` (default 300000).
See [`docs/providers.md`](docs/providers.md#gateway).
- **bin**: `protopatch` added as an alias alongside `clawpatch` — both
resolve to the same CLI entry. Useful when the upstream `clawpatch` is
also on PATH (e.g., during the migration window).

## 0.4.1 - Unreleased

## 0.4.0 - 2026-05-22
Expand Down
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# 🩹 clawpatch
# 🩹 clawpatch — protoLabs fork

> This is a protoLabs-maintained fork of [`openclaw/clawpatch`](https://github.com/openclaw/clawpatch).
> We took ownership 2026-05-24 to land features we needed without waiting on
> upstream, principally a **`gateway` provider** that talks to any OpenAI-
> compatible HTTP endpoint instead of shelling out to a CLI agent. See
> [`docs/providers.md`](docs/providers.md#gateway) for details.
> Source: [`protoLabsAI/protoPatch`](https://github.com/protoLabsAI/protoPatch).

Automated code review that lands fixes.

Expand All @@ -12,6 +19,20 @@ resulting worktree changes.

## Install

From npm (this fork, includes the `gateway` provider):

```bash
pnpm add -g @protolabsai/protopatch
```

Or directly from the repo (tracks `main`):

```bash
pnpm add -g github:protoLabsAI/protoPatch
```

Upstream `openclaw/clawpatch` (no `gateway` provider) is unaffected:

```bash
pnpm add -g clawpatch
```
Expand All @@ -24,6 +45,9 @@ pnpm build
pnpm link --global
```

Both `clawpatch` and `protopatch` are installed as CLI binaries — they point
at the same entry. Use whichever fits.

## Workflow

```bash
Expand Down
24 changes: 20 additions & 4 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,34 @@ description: "How to install clawpatch from npm or source"

# Installation

> This is the **protoLabs fork** (`protoLabsAI/protoPatch`). The upstream
> `openclaw/clawpatch` on npm does not include the `gateway` provider —
> see [Providers → gateway](providers.md#gateway) for what that adds.

## npm/pnpm

From the protoLabs npm package:

```bash
pnpm add -g clawpatch
pnpm add -g @protolabsai/protopatch
```

Or with npm:

```bash
npm install -g clawpatch
npm install -g @protolabsai/protopatch
```

Or pull straight from the repo to track `main`:

```bash
pnpm add -g github:protoLabsAI/protoPatch
```

Both `clawpatch` and `protopatch` are installed as CLI binaries — they point
at the same entry. The fork keeps `clawpatch` so existing workflows and the
rest of this documentation work unchanged.

Verify:

```bash
Expand All @@ -28,8 +44,8 @@ clawpatch --version
Clone and build:

```bash
git clone https://github.com/openclaw/clawpatch.git
cd clawpatch
git clone https://github.com/protoLabsAI/protoPatch.git
cd protoPatch
pnpm install
pnpm build
pnpm link --global
Expand Down
76 changes: 72 additions & 4 deletions docs/providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ Provider names today:
- `opencode`: shells out to `opencode run --format json`
- `pi`: shells out to `pi -p` (non-interactive print mode)
- `cursor`: shells out to `cursor-agent -p --output-format json`
- `gateway`: HTTP POST to any OpenAI-compatible `/chat/completions` endpoint
with structured outputs — no CLI dependency. **Added in the protoLabs fork
(`@protolabsai/protopatch`).** See [Gateway](#gateway) below.
- `mock`: deterministic provider for tests and fixtures
- `mock-fail`: failure provider for tests

Expand Down Expand Up @@ -317,7 +320,72 @@ uses `--force` or `--yolo`. Complete HITL verification before promoting this to
default provider support, especially for ambient rules, MCP configuration,
temporary prompt file handling, timeout behavior, and any claimed read-only mode.

Direct OpenAI API, local-model, and multi-model panel providers are not
implemented yet. The `acpx` provider is the generic route for ACP-compatible
agents; the `grok`, `opencode`, `pi`, and `cursor` providers are direct integrations
for local CLIs.
## Gateway

> Added in the protoLabs fork (`@protolabsai/protopatch`, 0.5.0). Not present
> in upstream `openclaw/clawpatch`.

POSTs the already-assembled prompt to any **OpenAI-compatible
`/chat/completions` endpoint** with structured outputs
(`response_format: json_schema`). No CLI subprocess, no auth handshake — just
a Bearer token and a URL. The provider's `check()` validates env without
making a network call so `clawpatch doctor` won't spend tokens on a probe.

Designed for the protoLabs LiteLLM gateway:

- inside the docker network: `http://gateway:4000/v1`
- externally: `https://api.proto-labs.ai/v1`

…but works against anything that speaks the OpenAI Chat Completions API:
vanilla OpenAI, vLLM, LM Studio, Ollama with the OpenAI shim, etc.

### When to use it

Pick `gateway` over `claude` / `codex` / `acpx` when:

- You are running clawpatch inside a container or CI runner where installing
+ OAuth-ing a per-agent CLI is impractical.
- You already have an OpenAI-compatible LLM endpoint and want a uniform
provider abstraction across multiple tools.
- You want a provider that fails fast on auth and reports HTTP errors
verbatim instead of parsing a CLI's stdout envelope.

### Configuration

```bash
clawpatch review --provider gateway --model protolabs/smart
```

Or set the provider once in `.clawpatch/config.json`:

```json
{
"provider": { "name": "gateway", "model": "protolabs/smart" }
}
```

### Environment

| Variable | Default | Notes |
| --- | --- | --- |
| `GATEWAY_API_KEY` (preferred) or `OPENAI_API_KEY` | required | Bearer token. The gateway provider refuses to start without one. |
| `OPENAI_BASE_URL` | `https://api.proto-labs.ai/v1` | Trailing slashes are stripped. |
| `CLAWPATCH_GATEWAY_MODEL` | `protolabs/smart` | `--model` on the CLI overrides. |
| `CLAWPATCH_GATEWAY_TIMEOUT_MS` (or `CLAWPATCH_PROVIDER_TIMEOUT_MS`) | `300000` (5 min) | Reasoning models on large features can be slow; raise this if you see frequent timeouts. |
| `--reasoning-effort none|minimal|low|medium|high|xhigh` | (unset) | Forwarded as `reasoning_effort` body field for models that honor it. |

### Why this can be the minimal provider

The `buildReviewPrompt` / `buildMapPrompt` / `buildFixPrompt` helpers already
inline the relevant file contents as `Files:` blocks in the prompt body. The
gateway provider therefore needs zero file IO — it's effectively the smallest
possible provider implementation: prompt in, JSON out. All schema enforcement
happens via the same `response_format: json_schema` contract every other
provider already negotiates.

---

Direct OpenAI API, local-model, and multi-model panel providers (other than
`gateway`) are not implemented yet. The `acpx` provider is the generic route
for ACP-compatible agents; the `grok`, `opencode`, `pi`, and `cursor`
providers are direct integrations for local CLIs.
23 changes: 18 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
{
"name": "clawpatch",
"version": "0.4.0",
"description": "Automated code review that lands fixes.",
"name": "@protolabsai/protopatch",
"version": "0.5.0",
"description": "Automated code review that lands fixes — protoLabs fork of clawpatch with a `gateway` provider for OpenAI-compatible endpoints.",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/protoLabsAI/protoPatch.git"
},
"homepage": "https://github.com/protoLabsAI/protoPatch#readme",
"bugs": {
"url": "https://github.com/protoLabsAI/protoPatch/issues"
},
"publishConfig": {
"access": "public"
},
"bin": {
"clawpatch": "dist/cli.js"
"clawpatch": "dist/cli.js",
"protopatch": "dist/cli.js"
},
"files": [
"dist",
"README.md",
"LICENSE"
"LICENSE",
"CHANGELOG.md"
],
"type": "module",
"scripts": {
Expand Down
Loading