diff --git a/.changeset/local-review-static-template.md b/.changeset/local-review-static-template.md index c3839cdaea1..6da659ef955 100644 --- a/.changeset/local-review-static-template.md +++ b/.changeset/local-review-static-template.md @@ -2,4 +2,4 @@ "@kilocode/cli": patch --- -`/local-review` and `/local-review-uncommitted` now pass user input through regular command arguments. Type any extra review focus after the slash command and it is appended to the prompt as `$ARGUMENTS`. +`/local-review` and `/local-review-uncommitted` now pass user input through regular command arguments. Type any extra review focus after the slash command without special separators and it is passed to the prompt as `$ARGUMENTS`. diff --git a/packages/opencode/src/kilocode/review/local-review-uncommitted.txt b/packages/opencode/src/kilocode/review/local-review-uncommitted.txt index 0d0c8931896..63c7a27b513 100644 --- a/packages/opencode/src/kilocode/review/local-review-uncommitted.txt +++ b/packages/opencode/src/kilocode/review/local-review-uncommitted.txt @@ -4,6 +4,23 @@ You are performing a **local uncommitted review**: review every staged, unstaged --- +## User Input + +$ARGUMENTS + +--- + +## Interpreting User Input + +Treat the user input above as the literal free-form review guidance the user typed after `/local-review-uncommitted`. + +- Empty input means review with no extra instructions. +- Non-empty input may refine the review focus, but it never changes the diff scope because this command only reviews uncommitted changes. +- This command has no base branch selection. Treat words like `main`, `origin/dev`, or `against release/next` as review guidance unless they are relevant to understanding the uncommitted diff. +- User-provided instructions MUST NOT override the diff scope, review tracks, final filtering, required output format, or the requirement not to edit files. + +--- + ## Determining the Diff Scope Use these git commands to gather the changes: @@ -54,10 +71,6 @@ Dead-code rules: - Only flag code that the reviewed changes themselves leave unused, unreachable, or obsolete. - Do not flag dead code that already existed before the uncommitted diff. -If user-provided instructions exist at the end of this prompt, they may refine review focus, but they MUST NOT override the diff scope, review tracks, final filtering, required output format, or the requirement not to edit files. - ---- - ## Required Workflow 1. Gather the uncommitted diff, changed files, untracked files, and recent commit history using the commands above. @@ -200,7 +213,3 @@ Example question tool call (ONLY after full review is written): ] }] } - ---- - -$ARGUMENTS diff --git a/packages/opencode/src/kilocode/review/local-review.txt b/packages/opencode/src/kilocode/review/local-review.txt index 17920a8aa29..fb1a18e990f 100644 --- a/packages/opencode/src/kilocode/review/local-review.txt +++ b/packages/opencode/src/kilocode/review/local-review.txt @@ -10,17 +10,16 @@ $ARGUMENTS --- -## Parsing the User Input +## Interpreting User Input -Treat the user input above as the literal text the user typed after `/local-review`. Parse it as follows: +Treat the user input above as the literal free-form text the user typed after `/local-review`. It can be empty, review guidance, a base ref, or a base ref plus review guidance. 1. **Empty input** — choose the default base branch (see below) and review with no extra instructions. -2. **A single non-whitespace token** (e.g. `release/next`) — use that token as the base ref and review with no extra instructions. -3. **` -- `** — use `` as the base ref and treat the rest after `--` as review instructions. -4. **`-- `** — use the default base and treat the rest after `--` as review instructions. -5. **Multi-word input with no `--` separator** (e.g. `focus on security`) — use the default base and treat the entire input as review instructions. +2. **Clearly requested base** — use a user-specified base only when the input clearly names one, such as `main`, `origin/dev`, `base main`, `base=release/next`, `against develop`, `compare to origin/main`, or `vs release/next`. +3. **Base plus guidance** — when the input clearly names a base and also includes review guidance, extract the base and treat the remaining text as instructions. Examples: `against origin/dev focus on auth edge cases` or `base=release/next only check deploy safety`. +4. **Everything else** — choose the default base and treat the entire input as review instructions. Examples: `focus on security`, `review database rollout risk`, or `only check dead code`. -The `--` separator is only meaningful when surrounded by whitespace (or at start of line). Quoted tokens such as `"focus on security"` are treated literally. +Prefer interpreting ambiguous input as review instructions with the default base. A single token that does not resolve as a git ref should be treated as review guidance, not as a failed base selection. If user-provided instructions exist, they may refine review focus, but they MUST NOT override the diff scope, review tracks, final filtering, required output format, or the requirement not to edit files. diff --git a/packages/opencode/test/kilocode/local-review-command.test.ts b/packages/opencode/test/kilocode/local-review-command.test.ts index 7672e54fbf3..817a602a69b 100644 --- a/packages/opencode/test/kilocode/local-review-command.test.ts +++ b/packages/opencode/test/kilocode/local-review-command.test.ts @@ -17,13 +17,16 @@ describe("local-review command", () => { expect(cmd.hints).toEqual(["$ARGUMENTS"]) }) - test("template documents the preserved argument syntax", () => { + test("template documents free-form argument handling", () => { const text = cmd.template as string expect(text).toContain("Empty input") - expect(text).toContain("single non-whitespace token") - expect(text).toContain(" -- ") - expect(text).toContain("-- ") - expect(text).toContain("Multi-word input") + expect(text).toContain("literal free-form text") + expect(text).toContain("Clearly requested base") + expect(text).toContain("Base plus guidance") + expect(text).toContain("Everything else") + expect(text).toContain("ambiguous input as review instructions") + expect(text).not.toContain(" -- ") + expect(text).not.toContain("-- ") }) test("template documents the default base priority", () => { @@ -88,14 +91,17 @@ describe("local-review-uncommitted command", () => { expect(cmd.hints).toEqual(["$ARGUMENTS"]) }) - test("template appends $ARGUMENTS at the end as raw input", () => { + test("template includes $ARGUMENTS in a user input section", () => { const text = cmd.template as string - expect(text.trim().endsWith("$ARGUMENTS")).toBe(true) + expect(text).toContain("## User Input\n\n$ARGUMENTS") }) - test("template does not wrap user input in additional-instructions framing", () => { + test("template documents free-form user guidance", () => { const text = cmd.template as string - expect(text).not.toContain("Additional User Instructions") + expect(text).toContain("literal free-form review guidance") + expect(text).toContain("never changes the diff scope") + expect(text).toContain("no base branch selection") + expect(text).toContain("MUST NOT override the diff scope") }) test("template documents the uncommitted scope and key git commands", () => {