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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

- Make Codex and Claude plugins reuse the global CodeJury CLI, install globally
when missing, and stop on setup errors instead of using private or npx copies.

- Preserve single-PR push preferences on resume, and keep fixes local when an
older run has no saved preference unless pushing is explicitly enabled.
- Scope agent temporary files and default Go caches to owned invocation directories,
Expand Down
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,25 +134,24 @@ for prerequisites, agent selection, and saved reviews.

## Claude Code plugin

Code Jury is also a [Claude Code plugin](https://code.claude.com/docs/en/plugins). Add this
repository as a plugin marketplace and install it:
Install from your **terminal** and start a new Claude Code session:

```sh
claude plugin marketplace add agentsdance/codejury
claude plugin install codejury@codejury
claude
```

In a session, `/codejury:review <pr-url>` runs `jury review` (or `npx @agentsdance/codejury`
when `jury` is not installed). In Claude Code it always sets `--judge claude --reviewer claude`,
overriding supplied and saved role choices for new and resumed runs. The two roles use separate
sessions. Other flags take precedence over the `--web=true` and `--push=false` defaults.
Claude shares the web console link, summarizes the findings and verdicts when the review ends,
and leaves the console running. Pass `--web=false` to disable it. The plugin requires a PR URL;
if omitted, Claude asks for it before starting. The plugin also ships the
`codejury` skill for running the review loop by hand. Agent CLIs are still installed
and authenticated separately. `--push=false` disables pushing; it does not make the review read-only.
Single-PR checkouts are temporary and their unpushed fixes are removed during cleanup.
See the [plugin guide](plugin/README.md) for prerequisites, updates, and local installation checks.
At the **Claude Code prompt**, enter your PR URL:

```text
/codejury:review https://github.com/owner/repo/pull/123
```

Claude reviews and fixes the PR in separate reviewer and judge sessions, and opens
a browser console. Pushing is off by default; add `--push` to push fixes.
Unpushed fixes in temporary single-PR checkouts are removed during cleanup.
See the [plugin guide](plugin/README.md) for prerequisites, options, and updates.

## Screenshots

Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ claude plugin install codejury@codejury
```

在会话中运行 `/codejury:review <pr-url>`,插件会调用 `jury review`;
如果没有安装 `jury`,则使用 `npx @agentsdance/codejury`。
插件先检查全局 `jury`;未安装时通过 npm 全局安装,不使用独立目录或临时副本。
在 Claude Code 中,插件始终设置 `--judge claude --reviewer claude`,
对新任务和恢复的任务都会覆盖传入或已保存的角色选择。两种角色使用独立会话。
其他显式传入的参数优先于默认的 `--web=true` 和 `--push=false`。
Expand Down
9 changes: 5 additions & 4 deletions docs/codex-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ In a new Codex chat, select **CodeJury** and ask:
> Set up CodeJury and check which agents I can use.

Setup checks prerequisites without starting a review. The plugin uses your global
CodeJury CLI if available on PATH, or installs its fallback release automatically.
Agent installation and login are separate.
CodeJury CLI, or installs it globally with `npm install --global @agentsdance/codejury@latest`
if missing. Agent installation and login are separate.

## Review a PR

Expand All @@ -41,8 +41,9 @@ To continue or inspect a saved review, ask:
## Development and packaging

The plugin source is in [`plugins/codejury`](../plugins/codejury). Its launcher
checks for an installed `jury` or `codejury` on PATH before downloading its fallback
CLI release from npm. The plugin and CLI have separate versions.
checks npm's global package directory and reuses CodeJury there. If missing, it
installs globally; it never creates a separate plugin CLI installation. The plugin
and CLI have separate versions.

Build the submission archive from the repository root:

Expand Down
87 changes: 26 additions & 61 deletions plugin/README.md
Original file line number Diff line number Diff line change
@@ -1,85 +1,50 @@
# Code Jury for Claude Code

Review PRs with independent AI code reviewers and a judge from a Claude Code session. The judge
triages findings and fixes accepted issues; Jury repeats the loop until the reviewers agree or the run
reaches its limit.
Review and fix pull requests with a Claude reviewer and a separate Claude judge.

You need Node.js 20.10+, npm, Git, and a signed-in Claude Code CLI. GitHub PRs
also need a signed-in `gh` CLI. The plugin checks your global `jury` installation
and installs it globally if missing.

## Install

In your **terminal**, install the plugin and start a new Claude Code session:

```sh
claude plugin marketplace add agentsdance/codejury
claude plugin install codejury@codejury
claude
```

Start a new Claude Code session after installing, then run:
## Review

At the **Claude Code prompt**, enter this with your PR URL:

```text
/codejury:review https://github.com/owner/repo/pull/123
/codejury:review https://github.com/owner/repo/pull/123 --rounds 3
```

Both examples use Claude as judge and jury, in separate sessions. The second sets the round limit.
Both open the web console and display its link in Claude Code.

A PR URL is required. If you run `/codejury:review` without one, Claude asks for the URL before
starting. Local-branch and local-directory reviews are outside this plugin's scope.
You can pass multiple related PR URLs or other `jury review` flags. With a PR URL, `--dir` selects
where checkouts and run records are stored. Resuming a run also requires its original PR URL(s).

You need Node.js 20.10 or newer, npm, Git, and installed, authenticated agent CLIs. GitHub PR URLs
also need an authenticated `gh` CLI. The plugin uses an installed `jury`, or
`npx -y @agentsdance/codejury` if `jury` is absent. It does not bundle or authenticate agent CLIs.
Use `jury agents` (or `npx -y @agentsdance/codejury agents`) to inspect your setup.

If an older CLI rejects Claude in both roles, the plugin retries once with the repository CLI
using `npx -y --package=git+https://github.com/agentsdance/codejury.git jury`. This leaves your
installed CLI and saved configuration unchanged.

## Behavior

- `/codejury:review` runs only when invoked by the user. It always sets `--judge claude` and
`--reviewer claude`, including on resume. Supplied role flags and saved CLI role choices are
overridden for this run; model and other settings still apply. Saved settings are not changed.
- Jury launches separate Claude sessions for the two roles. The reviewer is read-only; the judge
can make fixes. Your Claude Code session monitors the run. Both roles use the same agent, so
this does not provide model diversity.
- It defaults to `--web=true`: the browser console opens and Claude shares its URL. Claude reports
the review result when it is ready and leaves the console running for you to inspect.
Pass `--web=false` for results only in Claude Code and a command that exits after review.
- It defaults to `--push=false`, so Jury does not push. The judge can still edit files and Jury
can create commits. Pass `--push` to publish them. Single-PR URL checkouts are temporary and
their unpushed fixes are removed during cleanup.
- Explicit `--web` and `--push` values take precedence.
- `codejury` provides guidance for manually coordinating reviewers and triaging
findings. Its source moved from `skill/SKILL.md` to `plugin/skills/codejury/SKILL.md`;
update any copies or symlinks that used the old path.
Claude starts the review, opens a browser console, and summarizes the findings
and fixes when it finishes. Both reviewer and judge use separate Claude sessions.
A PR URL is required.

## Update
**Pushing is off by default.** The judge can still edit and commit. Single-PR
checkouts are temporary; unpushed fixes are removed during cleanup.

```sh
claude plugin marketplace update codejury
claude plugin update codejury@codejury
```
Optional flags to add to the review command:

The plugin deliberately omits a version field so updates follow the repository without maintaining
a second release number. The installed Code Jury CLI is separate; update a global CLI installation
with `npm install -g @agentsdance/codejury` when needed.
- `--push` — push fixes to the PR branch.
- `--rounds 3` — stop after at most three rounds.
- `--web=false` — skip the browser console, which otherwise stays open after review.

## Develop and validate
## Update

From the repository root:
Run in your terminal, then start a new Claude Code session:

```sh
claude plugin validate ./plugin
claude plugin validate .
node --test test/plugin.test.js
claude --plugin-dir ./plugin
claude plugin marketplace update codejury
claude plugin update codejury@codejury
```

To test marketplace installation, add the local repository path as a marketplace and install
`codejury@codejury`. Use an isolated `CLAUDE_CONFIG_DIR` for development so this does not change your
normal marketplace settings. `claude plugin details codejury` should list `codejury` and `review`.

The plugin lives under `plugin/` so installation includes only its manifest, skills, and this guide.
Skill references to repository documentation use GitHub URLs because the rest of the source tree
is not part of the installed plugin.
For saved results, resuming, and troubleshooting, see the
[CLI usage guide](https://github.com/agentsdance/codejury/blob/master/docs/usage.md).
43 changes: 43 additions & 0 deletions plugin/scripts/jury.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Both plugins use npm's global CodeJury installation. Keep the two shipped runners in sync.
import { spawnSync } from 'node:child_process';
import { existsSync, readFileSync } from 'node:fs';
import path from 'node:path';
import { pathToFileURL } from 'node:url';

const [major, minor] = process.versions.node.split('.').map(Number);
if (major < 20 || (major === 20 && minor < 10)) throw new Error('CodeJury requires Node.js 20.10+.');

function npm(args, capture = false) {
const result = spawnSync(process.platform === 'win32' ? 'npm.cmd' : 'npm', args, {
encoding: 'utf8', stdio: capture ? ['ignore', 'pipe', 'inherit'] : 'inherit',
shell: process.platform === 'win32',
});
if (result.error || result.status !== 0) {
throw new Error(`npm ${args.join(' ')} failed (${result.error?.message ?? result.status ?? result.signal}). Fix npm's global installation and retry.`, { cause: result.error });
}
return capture ? result.stdout.trim() : undefined;
}

const globalRoot = npm(['root', '--global'], true);
if (!path.isAbsolute(globalRoot)) throw new Error('npm did not return an absolute global package directory.');
const packageRoot = path.join(globalRoot, '@agentsdance', 'codejury');
const entry = path.join(packageRoot, 'bin', 'jury.js');
function installed() {
try {
const metadata = JSON.parse(readFileSync(path.join(packageRoot, 'package.json'), 'utf8'));
return metadata.name === '@agentsdance/codejury' && existsSync(entry) ? metadata : null;
} catch { return null; }
}

let metadata = installed();
if (!metadata) {
console.error('Installing CodeJury globally with npm.');
npm(['install', '--global', '--ignore-scripts', '--no-audit', '--no-fund', '@agentsdance/codejury@latest']);
metadata = installed();
}
if (!metadata) throw new Error(`Global CodeJury installation is incomplete at ${packageRoot}. Run npm install --global @agentsdance/codejury@latest and retry.`);
console.error(`Using global CodeJury ${metadata.version} at ${entry}`);

// Import in this process so cancellation reaches the CLI and its agent cleanup.
process.argv = [process.execPath, entry, ...process.argv.slice(2)];
await import(pathToFileURL(entry).href);
7 changes: 5 additions & 2 deletions plugin/skills/codejury/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ The CLI owns the mechanics; you own the judgement. See [DESIGN.md](https://githu
For the automated loop, use `/codejury:review`; it always selects Claude as both judge and jury
in separate sessions, and only the judge owns fixes. The guidance
below is for explicitly requested manual review and triage. Do not edit a checkout while an
automated Jury run is using it. In CLI examples, substitute `npx -y @agentsdance/codejury` for
`jury` if it is not installed, and keep the same `--dir` and `--run` when working with saved findings.
automated Jury run is using it. Resolve `<plugin-root>` as two directories above this
skill folder and run `node "<plugin-root>/scripts/jury.mjs" version` first. The runner
checks npm's global CodeJury installation and installs globally if missing; it stops
on errors instead of using npx or a private copy. Use this runner in place of `jury`
in the examples below. Keep the same `--dir` and `--run` for saved findings.

## The loop

Expand Down
25 changes: 14 additions & 11 deletions plugin/skills/review/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ or start a local review. Flags alone, including `--dir` or `--resume`, do not su

## 2. Find the CLI

Use `jury` when `command -v jury` finds it. Otherwise run it without installing, as
`npx -y @agentsdance/codejury`. It needs Node.js 20.10 or newer and npm; if neither works, explain
which prerequisite is missing and how to install it. Use the same CLI prefix for every command
below, including `agents`, `runs`, and reopening the console.
Resolve `<plugin-root>` as two directories above this skill folder. Run
`node "<plugin-root>/scripts/jury.mjs" version` to check the global CLI. The runner
uses `npm root --global` to find the installed CodeJury package; if missing, it
installs the latest stable release globally. It reports the version and absolute
CLI path, and stops on installation errors. Node.js 20.10+ and npm are required.
Use this runner in place of `jury` in every command below, including `agents`,
`runs`, and reopening the console. Never use npx or install a private CLI copy.

## 3. Build the command

Start from `jury review` (or `npx -y @agentsdance/codejury review`). Normalize the role flags as
Start from `node "<plugin-root>/scripts/jury.mjs" review`. Normalize the role flags as
described below, preserve the remaining arguments, and quote each value safely for the shell.
Do not evaluate argument text as shell code.

Expand Down Expand Up @@ -66,12 +69,12 @@ missing or unauthenticated agent CLI, a missing `gh` login for a GitHub URL), sh
the fix it names; `jury agents` lists which agent CLIs are installed.

Older CLIs, including 0.8.1, reject a reviewer that is also the judge. If that specific error
appears, explain that the installed CLI is too old and retry once using
`npx -y --package=git+https://github.com/agentsdance/codejury.git jury` with the same normalized
arguments. The repository CLI supports separate sessions for both roles. Use that CLI prefix
for subsequent commands too. If the retry fails, show the error; do not substitute another agent
or keep retrying. Explicitly disabled Claude or missing authentication still requires fixing
that prerequisite.
appears, explain that the global CLI is too old. Upgrade it with
`npm install --global @agentsdance/codejury@latest`, then retry once through the
same runner with the same normalized arguments. Honor an explicitly requested
CLI version instead of upgrading it silently. If the upgrade or retry fails,
report the error and stop. Do not use npx, a private install, or another agent
as a fallback. Disabled Claude or missing authentication still needs to be fixed.

Monitor the background output while the review runs. With the console enabled, do not rely on a
background-task completion notification: the server keeps the process alive after review ends.
Expand Down
6 changes: 3 additions & 3 deletions plugins/codejury/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
"name": "codejury",
"version": "0.1.3",
"version": "0.1.4",
"description": "Review pull requests supplied by URL with CodeJury's independent AI reviewers and judge, resume PR reviews, and inspect saved findings.",
"author": {
"name": "ZHOU ZHENGXI",
Expand All @@ -22,7 +22,7 @@
"interface": {
"displayName": "CodeJury",
"shortDescription": "AI pull request review",
"longDescription": "Review pull requests supplied by URL with independent coding agents and a judge that investigates findings, applies fixes, and asks reviewers to check again. Set up the CLI, run or resume a PR review, and inspect saved findings and conversations. A new review requires a PR link; arbitrary local files and folders are not supported plugin review targets. PR reviews use a local checkout. Desktop only: requires Node.js 20.10+, npm, Git, and separately installed and authenticated coding-agent CLIs. GitHub PRs also require GitHub CLI. This plugin uses your installed CodeJury CLI when available on PATH, or downloads CodeJury CLI 0.9.0 from npm as a fallback. Reviews can edit files, create commits, and push fixes to the PR by default; ask to keep fixes local or use --push=false to disable pushing. Code and prompts are processed by your selected agents and their providers, subject to their terms and usage charges. CodeJury keeps review records locally and operates no hosted review service. The included console screenshot shows a real prior review; results vary by repository and agent.",
"longDescription": "Review pull requests supplied by URL with independent coding agents and a judge that investigates findings, applies fixes, and asks reviewers to check again. Set up the CLI, run or resume a PR review, and inspect saved findings and conversations. A new review requires a PR link; arbitrary local files and folders are not supported plugin review targets. PR reviews use a local checkout. Desktop only: requires Node.js 20.10+, npm, Git, and separately installed and authenticated coding-agent CLIs. GitHub PRs also require GitHub CLI. This plugin reuses your npm-global CodeJury CLI, or installs the latest stable CLI globally if missing. It does not create a private CLI installation. Reviews can edit files, create commits, and push fixes to the PR by default; ask to keep fixes local or use --push=false to disable pushing. Code and prompts are processed by your selected agents and their providers, subject to their terms and usage charges. CodeJury keeps review records locally and operates no hosted review service. The included console screenshot shows a real prior review; results vary by repository and agent.",
"developerName": "ZHOU ZHENGXI",
"category": "Developer Tools",
"capabilities": [
Expand All @@ -47,7 +47,7 @@
]
},
"publication": {
"release_notes": "Push PR fixes by default, while preserving explicit local-only requests. Reuse an installed CodeJury CLI on PATH before downloading the fallback release."
"release_notes": "Reuse the global CodeJury CLI and install globally when missing. Remove private CLI downloads and stop on installation errors."
}
}
}
Expand Down
Loading
Loading