Skip to content
dsh.fish
Bundle

@Badegg404/dsh-code-review

DSH Web 插件:一键拉起 Claude 子 agent 评审当前代码,报告送回 UI

Source
Badegg404
License
MIT
Updated
Updated 15 days ago

Readme

# dsh-code-review

> **DSH Plugin** · One-click code review with **Claude Code as the reviewer agent**: the header "评审" button runs the `claude` CLI headless in your workspace, with the model route pointed at a cheap model (AGICTO's flash) — so you get Claude Code's agentic loop at flash-model cost.

[![DSH Plugin](https://img.shields.io/badge/DSH-Plugin-4ade80)](#) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

[中文文档](./README.zh-CN.md)

A persistent web plugin for [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness) that automates the "develop in DSH, review with Claude Code" workflow: click the **评审** button in the session header, and the host runs **Claude Code** (`claude -p`) in the session's workspace with `ANTHROPIC_BASE_URL` / `ANTHROPIC_AUTH_TOKEN` / `ANTHROPIC_MODEL` pointing at your provider (e.g. AGICTO) and a cheap model (e.g. `deepseek-v4-flash`).

The core value is **Claude Code the agent's capability** — its own tool loop, planning, and judgment drive the review; the underlying model is whatever you configure (flash for cost). The severity-graded report is written back to the workspace (`review-report-<timestamp>.md`) and shown in the UI.

## How it works

```
[评审 button] --sessionId--> Host /review/run
      │
      ├─ subprocess.spawn("claude -p <review prompt>", {
      │     cwd: <session workspace>,
      │     env: {
      │       ANTHROPIC_BASE_URL:  https://api.agicto.cn/v1,   // AGICTO Anthropic-compatible API
      │       ANTHROPIC_AUTH_TOKEN: <AGICTO key>,
      │       ANTHROPIC_MODEL:      deepseek-v4-flash,          // flash model
      │       CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1" })
      │
      └─ Claude Code agent: runs git diff, reads context, writes severity-graded report
              │
              ├─ report → workspace/review-report-<ts>.md
              └─ report → UI (client polls /review/status)
```

- **Agent = Claude Code** (`claude` CLI, e.g. installed via `npm i -g @anthropic-ai/claude-code`); its model route is redirected via `ANTHROPIC_*` env vars.
- **Model = your choice** — AGICTO serves Claude models too, but the point is you can use a cheap flash model underneath while keeping Claude Code's agent behavior.
- Review is **read-only**: the prompt forbids modifying files or running state-changing commands.
- Reviews run in the background (up to 5 min); the client polls status until done.

## Install

```bash
dsh plugin --profile web add https://github.com/Badegg404/dsh-code-review.git
# restart dsh web afterwards
```

Or manual: copy to `~/.dsh/profiles/web/plugins/dsh-code-review/`, add `"@Badegg404/dsh-code-review": "file:plugins/dsh-code-review"` to the profile's `dependencies` and the package name to `dsh.profile.bundles`, then `pnpm install` + restart.

Prerequisite: `claude` (Claude Code) on PATH or at the configured path (`npm i -g @anthropic-ai/claude-code`).

## Usage

1. Open a session (the review button lives in the session header, next to the title).
2. Click **评审** → optionally type a per-run instruction in **本次要求** (e.g. "focus on security"); under **配置** you can edit the **角色设定(系统提示词)** (default role) and the agent/`provider`/model fields → **保存配置**.
3. Click **发起评审**. The host runs Claude Code headless in the workspace; it reviews the uncommitted changes.
4. The report appears in the panel when done, and a copy is written to `review-report-<timestamp>.md` in the workspace.

## Configuration

Stored in the DSH credentials store (`~/.dsh/.credentials.yaml`, mode 0600):

| Ref | Default | Meaning |
| --- | --- | --- |
| `REVIEW_PROVIDER` | `agicto` | Provider route; also selects the default base URL |
| `REVIEW_MODEL` | *(empty)* | Underlying model Claude Code calls, e.g. `deepseek-v4-flash` |
| `REVIEW_CLAUDE_BIN` | `~/.npm-global/bin/claude` | Path to the `claude` CLI |
| `REVIEW_BASE_URL` | provider default | Anthropic-compatible API base (`https://api.agicto.cn/v1`) |
| `REVIEW_API_KEY` | `AGICTO_API_KEY` | API key; falls back to the AGICTO credential |
| `REVIEW_AGENT` | `claude` | Local agent to invoke: `claude` (Claude Code) or `custom` (arbitrary command) |
| `REVIEW_CUSTOM_CMD` | *(empty)* | Custom-agent shell command; `$REVIEW_PROMPT` / `$REVIEW_CWD` env available |
| `REVIEW_SYSTEM_PROMPT` | built-in | Role / system prompt (角色设定); `{cwd}` placeholder |

## Routes

All loopback-only (`/review/*`):

| Route | Purpose |
| --- | --- |
| `GET /review/status?session=<id>` | config + job state / report |
| `POST /review/config` | save provider / model / claude path / base URL / key |
| `GET /review/models?provider=<p>` | advertised models (datalist) |
| `POST /review/run` | start a local-agent review (`userPrompt` optional) |

## License

[MIT](LICENSE)

Install

dsh plugin --profile web add github:Badegg404/dsh-code-review

Profile: web

  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source