Skip to content
Development
Command

/fix

Act on the findings a review left on a PR — takes or declines each by severity, edits code at pwd to match the project, 1 commit, replies once pushed.

From plugin
open-pr
426 skills6 commands
Install
> /plugin marketplace add TOMOSIA-VIETNAM/open-pr
> /plugin install open-pr@open-pr

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/fix

Context preview

What this command does when you run it.

Act on the findings a review left on a PR — takes or declines each by severity, edits code at pwd to match the project, 1 commit, replies once pushed.

Command definition

fix.md
argument-hint: "[PR URL] [content]"
description: Act on the findings a review left on a PR — takes or declines each by severity, edits code at pwd to match the project, 1 commit, replies once pushed.

> **CRITICAL:** `Read` `"${CLAUDE_PLUGIN_ROOT}"/core/guardrails.md` FIRST, and `core/cli.md` with it — > they carry the shared rules and the `<op>` runtime. `<op>` ≡ `sh "${CLAUDE_PLUGIN_ROOT}"/bin/open-pr.sh`, > exactly as THIS line spells it — no env var exists in the shell. On top of those: > - This command EDITS REAL CODE at pwd, then commits/pushes — higher risk than the > read-only `/open-pr:review`. Step 1 MUST run BEFORE ANY other action. FORBIDDEN: "helpfully" > fixing the remote/branch just to pass it. > - FORBIDDEN: `git commit --amend`, `git push --force`/`--force-with-lease`, `git add -A`/`git add .`, > `git branch -D`, `git reset --hard`, resolving a PR thread, editing/committing when the PR's branch > is protected or the remote/branch doesn't match the PR, deciding alone on a 🔵/📝 finding, RAW-git > branch checkouts or worktree add/remove (Step 1b's `<op> checkout` is the ONLY sanctioned one), > close/merge/reopen, `<op> post`/`publish` (this command only replies; posting is `review.md`'s job). `cd` is allowed ONLY between the invocation > directory, the 1a directory (once its git remote proves the match — never by name), and the > Step 1b worktree. This bullet + the one above are the SOLE > enforcement layer — no `allowed-tools` backs them (deliberate).

Step 0 — Target

`<op> target <url>`; exit 4 or no URL → the block below. `Read` `"${CLAUDE_PLUGIN_ROOT}"/core/pr-target.md`, taking its no-store branch (§2): this command never persists `git_remote_type`, it uses the parsed vendor as-is.

❌ Error: No PR URL provided.
Usage: /open-pr:fix <PR URL> [content]
Example (GitHub): /open-pr:fix https://github.com/org/repo/pull/123
Example (GitLab): /open-pr:fix https://gitlab.com/org/repo/-/merge_requests/123
Example with instructions: /open-pr:fix https://github.com/org/repo/pull/123 only fix the security part

Free-form text outside the URL narrows this run's scope (Step 3 item 3).

No URL → take the PR THIS session already establishes (its review ran here, the user named it, pwd is its worktree), say which in 1 short sentence, continue. NOT exactly 1 ⇒ the `Usage:` block. FORBIDDEN: guessing past it.

Context

`<op> context --sections info,head,comments,reviews,account,threads` — labels "PR info", "Head SHA", "Old comments", "Reviews", "Account", "Review threads". Plus 2 plain `git` commands, label "Git remote + current branch": `git remote -v` && `git branch --show-current` — pwd may be no repo (exit 128) or the wrong one; not fatal, Step 1 re-checks everything at the 1a directory.

"Reviews" empty ⇒ Step 3 item 2 does not apply; LINE-level handling continues normally.

`core/pr-target.md` §4-5 give `<repo>` and the empty-"PR info" stop.

Step 1 — Verify a safe context (STOP IMMEDIATELY on failure)

**1a.** `<op> locate-repo` → `<repo_dir>` (exit 5 → ask with a CHOICE in plain language, STOP if unresolved). `<memory-dir>` = `notebooks/review/<repo>` at THIS invocation directory, ABSOLUTE — the place review.md writes from its own pwd; `<repo_dir>` = a `review` worktree (`notebooks/review/*/worktrees/pr<pull_number>-*`) ⇒ its `../../`. FORBIDDEN: resolving memory inside `<repo_dir>` — a repo that is a subdirectory of the workspace grows a second, drifting copy. Then `cd` into `<repo_dir>` — this command EDITS that repo's files ⇒ works from inside.

**1b. Check BOTH at the 1a directory.** Either failing → print that error, STOP COMPLETELY. FORBIDDEN: touching any file, proceeding to Step 2.

1. the current branch matches `headRefName` EXACTLY **and its tip prefix-matches "Head SHA"** ⇒ fix in place — a matching name on a stale tip edits a tree the findings do not describe and the push cannot fast-forward. Else `<repo_dir>` = a review worktree whose `git rev-parse HEAD` prefix-matches "Head SHA" ⇒ fix there (DETACHED is normal). Anything else — wrong branch, stale tip, stale worktree — ⇒ ONE CHOICE per `core/guardrails.md`: `Fix in a fresh worktree (Recommended)` — `<op> checkout`, run FROM the invocation directory so the worktree lands under `<memory-dir>`, gates it to "Head SHA"; the user's own branch/tree stays untouched; `cd` into the printed worktree, continue there — vs stop-and-checkout yourself, printing:

   ❌ Current branch (`<current branch>`) doesn't match the PR's branch (`<headRefName>`). Check
      out the correct branch `<headRefName>` and call this again.

2. `headRefName` is NOT one of `main`, `master`, `production`, `prod`, `staging`, `stg`, `release`, `rls`, `dev`, `development`, `develop` (case-insensitive, EXACT match, not substring). Read off the PR ⇒ holds detached too, and a PR may itself target a protected branch:

   ❌ The PR's branch (`<headRefName>`) is a protected branch — this command does NOT commit to
      one. Move the change onto a dedicated feature branch and open the PR from that.

Step 2 — Settings

`<op> settings --dir <memory-dir>` (`core/repo-settings.md` names what each field means). Resolve `chat_language` per that file.

  • the FILE carries a `.fix` node → use its values, do NOT ask again
  • absent, or no file at all → `Read` `"${CLAUDE_PLUGIN_ROOT}"/setup/fix-bootstrap.md`, follow it

Step 3 — Identify findings to handle

2 KINDS, differing in data source and in how "still open" is decided; `Read` `"${CLAUDE_PLUGIN_ROOT}"/core/finding-markers.md` — it defines how both are recognized.

1. **LINE-level** (from "Old comments") → drop a finding when EITHER holds: its `id` belongs to a thread in "Review threads" with `resolved: true`, || that same thread is already handled (`core/finding-markers.md`). 2. **FILE-level / OVERVIEW-level** (from "Reviews") → an individual bullet has no resolve concept and no readable reply history, so EVE

Read more
Ships withopen-pr

AI code review that lands on the PR, not in your terminal — GitHub, GitLab, Bitbucket. Learns each repo's conventions: 1 review, 1 fix commit, replies in thread. Claude Code · Cursor · Codex · Gemini CLI · Antigravity.

Get the whole plugin

Other commands on open-pr.