feat(skill): union-of-scopes детект изменений для code-режима
- Зачем:
- типичный PR-флоу: ветка ahead of base + (часто) локальный твик поверх. Прежняя логика смотрела только unstaged/staged и пропускала коммиты ветки, давая пустое или неполное ревью.
- Что:
- Step 1 auto-detect: добавлен третий независимый scope `git diff <base>...HEAD` с резолвом base (`symbolic-ref refs/remotes/origin/HEAD` → `origin/main` → `origin/master` → `main` → `master`).
- Step 2 dispatch: briefing для `code` и `code-vs-plan` переписан с fallback на union трёх скоупов, явное "do not skip branch-vs-base because working tree is non-empty".
- reviewer-prompt.md: `{ARTIFACT}` placeholder теперь спеллует все три scope (a)(b)(c) с инструкцией про labeling mixed-state.
- README.md: таблица "Three modes" и пояснение синхронизированы с union-семантикой.
- Проверка:
- на ветке feat/cross-platform-receiving-review одновременно непустые `git diff` и `git diff origin/main...HEAD` — финальная формулировка прошла Codex review (3 раунда, VERDICT: APPROVED).
This commit is contained in:
@@ -56,9 +56,20 @@ message "Plan mode is active" → mode = `plan`, skip git.
|
||||
|
||||
**3. Auto-detect** (no explicit argument, not in Plan Mode):
|
||||
|
||||
1. Check for code changes (any non-empty output means changes exist):
|
||||
1. Check for code changes — there are **three independent scopes**, and
|
||||
any non-empty output from any of them means code changes exist:
|
||||
- `git diff --name-only` — unstaged
|
||||
- `git diff --cached --name-only` — staged
|
||||
- `git diff --name-only <base>...HEAD` — committed on the current
|
||||
branch since it diverged from its base. Resolve `<base>` by trying
|
||||
in order: `git symbolic-ref refs/remotes/origin/HEAD` (canonical
|
||||
remote default), then `origin/main`, `origin/master`, `main`,
|
||||
`master`. If none resolve, skip this check.
|
||||
|
||||
The three scopes are independent, not a fallback chain. The typical
|
||||
PR has commits on the branch *and* often an in-progress local tweak
|
||||
on top; the briefing in Step 2 reviews the union, not just the first
|
||||
non-empty one.
|
||||
2. Check if a **structured plan artifact** exists in the current
|
||||
conversation context. This means one of:
|
||||
- The user pasted or referenced a markdown plan document with
|
||||
@@ -112,8 +123,16 @@ commands, and reads files on its own. **Do not pre-collect diffs or file
|
||||
lists for it.** Pass mode-specific context only:
|
||||
|
||||
- For `plan` — path to plan file, or inline plan text
|
||||
- For `code` — instruct it to use git status / git diff
|
||||
- For `code-vs-plan` — pass the plan and instruct git lookup for changes
|
||||
- For `code` — instruct the reviewer to review the **union of three
|
||||
scopes**: unstaged (`git diff`), staged (`git diff --cached`), and
|
||||
committed since base (`git diff <base>...HEAD`, base resolved the
|
||||
same way as in Step 1). Branch-vs-base is *not* a fallback — do not
|
||||
skip it just because the working tree is non-empty. The typical PR
|
||||
has both. When scopes are mixed, the reviewer should label findings
|
||||
by scope where it matters and surface the mixed-state to the
|
||||
operator.
|
||||
- For `code-vs-plan` — pass the plan and instruct the same union git
|
||||
lookup as `code` (all three scopes, not a fallback chain)
|
||||
|
||||
Fill the placeholders in `reviewer-prompt.md` and pass the result as the
|
||||
subagent's prompt. The template includes operating stance, finding bar,
|
||||
|
||||
Reference in New Issue
Block a user