Skip to content

Commit 25b50bd

Browse files
authored
Merge pull request #19 from unic/feature/pre-review/doc-context-enrichment
feat(pr-review): re-review feature v0.8.0 + doc context enrichment planning
2 parents 88eaf31 + 839bb58 commit 25b50bd

59 files changed

Lines changed: 2510 additions & 72 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ apps/claude-code/pr-review/docs/plans/
2323
apps/claude-code/auto-format/docs/plans/
2424
apps/claude-code/unic-confluence/docs/plans/
2525
.agents/skills/
26+
27+
# Plugin changelogs — em-dash dates must not be reflowed
28+
**/CHANGELOG.md

apps/claude-code/auto-format/ralph.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# Ralph Orchestrator Configuration
2-
# Generated for: unic-claude-code-format
2+
# Generated by: ralph init --backend claude
3+
# Project: unic-auto-format
34
# Docs: https://github.com/mikeyobrien/ralph-orchestrator
45

56
cli:
6-
backend: "claude"
7+
backend: 'claude'
78

89
event_loop:
9-
prompt_file: "PROMPT.md"
10-
completion_promise: "LOOP_COMPLETE"
11-
max_iterations: 100
12-
max_runtime_seconds: 14400 # 4 hours max
13-
10+
prompt_file: 'PROMPT.md'
11+
completion_promise: 'LOOP_COMPLETE'
12+
max_iterations: 100 # 15 specs * generous retry budget
13+
max_runtime_seconds: 28800 # 8 hours; abort if a spec stalls
1414

1515
# ─────────────────────────────────────────────────────────────────────────────
1616
# Additional Configuration (uncomment to customize)

apps/claude-code/pr-review/.claude-plugin/marketplace.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"name": "pr-review",
2222
"source": "./",
2323
"tags": ["code-quality", "azure-devops"],
24-
"version": "0.1.2"
24+
"version": "0.8.0"
2525
}
2626
]
2727
}

apps/claude-code/pr-review/.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pr-review",
3-
"version": "0.1.2",
3+
"version": "0.8.0",
44
"description": "Review Azure DevOps pull requests with multi-agent analysis and post threaded comments back to the PR.",
55
"author": {
66
"name": "Unic AG",

apps/claude-code/pr-review/CHANGELOG.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,124 @@
33
## [Unreleased]
44

55
### Breaking
6+
- (none)
7+
8+
### Added
9+
- (none)
10+
11+
### Fixed
12+
- (none)
13+
14+
## [0.8.0] — 2026-05-06
15+
16+
### Breaking
17+
- (none)
18+
19+
### Added
20+
- Re-review: detect prior Claude Code threads in Step 3.5; set `IS_REREVIEW`, `PRIOR_THREADS_FILE`, `SUMMARY_THREAD_ID`, and `PRIOR_ITERATION_ID`; normalize signature format to `🤖 *Reviewed by Claude Code* — Iteration N` for detection and iteration targeting (specs 01–02)
21+
- Re-review: resolve `LATEST_ITERATION_ID` and `LATEST_COMMIT_ID` from PR iterations API; compute `PRIOR_COMMIT_ID` from prior review signature; replace hardcoded `iterationId=1` (spec 03)
22+
- Re-review: incremental diff between `PRIOR_COMMIT_ID` and `LATEST_COMMIT_ID` in Step 5; early exit with pending thread list when no new commits detected (spec 04)
23+
- Re-review: classify each prior bot thread as `addressed`, `disputed`, `pending`, or `obsolete` in Step 5.5; detect deleted-file threads as `obsolete` (spec 05)
24+
- Re-review: reply to existing bot threads instead of posting new duplicates in Step 10; apply per-classification actions and post run-completion marker on every successful run (spec 06)
25+
- Re-review: skip full summary when no new or addressed findings; post delta reply (counts + new finding bullets) to existing summary thread; fall back to full summary if prior summary thread was deleted (spec 07)
26+
27+
### Fixed
28+
- (none)
29+
30+
## [0.7.0] — 2026-05-06
31+
32+
### Breaking
33+
- (none)
34+
35+
### Added
36+
- On re-review, skip full summary when nothing changed; post delta reply (counts + new finding bullet list) to existing summary thread when findings exist; fall back to full summary if prior summary thread was deleted (spec 07)
37+
38+
### Fixed
39+
- (none)
40+
41+
## [0.6.0] — 2026-05-06
42+
43+
### Breaking
44+
- (none)
45+
46+
### Added
47+
- Reply to existing bot threads instead of duplicating them on re-review: match prior threads by file path and line-range overlap (±3 line drift), branch Step 10 on `IS_REREVIEW`, apply per-classification actions (skip `pending`, reply `disputed`/`addressed`, ignore `obsolete`), post run-completion marker on every successful run (spec 06)
48+
49+
### Fixed
50+
- (none)
51+
52+
## [0.5.0] — 2026-05-06
53+
54+
### Breaking
55+
- (none)
56+
57+
### Added
58+
- Classify each prior bot thread as `addressed`, `disputed`, `pending`, or `obsolete` in Step 5.5; print summary count before Step 6; detect deleted-file threads as `obsolete` (spec 05)
59+
60+
### Fixed
61+
- (none)
62+
63+
## [0.4.0] — 2026-05-06
64+
65+
### Breaking
66+
- (none)
67+
68+
### Added
69+
- Branch Step 5 on `IS_REREVIEW`: incremental diff between `PRIOR_COMMIT_ID` and `LATEST_COMMIT_ID` for re-reviews; early exit with pending thread list when no new commits; fallback warnings with both commit IDs on fetch failure or missing commit IDs; hunk boundaries exported to `DIFF_HUNKS_FILE` for spec 05 (spec 04)
70+
71+
### Fixed
72+
- (none)
73+
74+
## [0.3.0] — 2026-05-06
675

76+
### Breaking
77+
- (none)
78+
79+
### Added
80+
- Fetch PR iterations to resolve `LATEST_ITERATION_ID` and `LATEST_COMMIT_ID`; replace hardcoded `iterationId=1` in Step 4; add `PRIOR_COMMIT_ID` resolution for re-review mode (spec 03)
81+
82+
### Fixed
83+
- (none)
84+
85+
## [0.2.1] — 2026-05-06
86+
87+
### Breaking
788
- (none)
889

990
### Added
91+
- (none)
92+
93+
### Fixed
94+
- Set `isSummaryThread` flag only on the most-recent prior summary thread (not all matching threads) to avoid ambiguity in re-review targeting
95+
96+
## [0.2.0] — 2026-05-06
97+
98+
### Breaking
1099

11100
- (none)
12101

102+
### Added
103+
104+
- Added Step 3.5 (Detect prior review): paginated fetch of all PR threads, bot-comment detection via signature prefix, and export of `IS_REREVIEW`, `PRIOR_THREADS_FILE`, `SUMMARY_THREAD_ID`, and `PRIOR_ITERATION_ID` for use by later re-review steps
105+
13106
### Fixed
14107

15108
- (none)
16109

110+
## [0.1.3] — 2026-05-06
111+
112+
### Breaking
113+
114+
- (none)
115+
116+
### Added
117+
118+
- (none)
119+
120+
### Fixed
121+
122+
- Normalized all emitted comment signatures to asterisk italics and added `— Iteration {LATEST_ITERATION_ID}` suffix; documented detection prefix in Notes and Comment signature sections
123+
17124
## [0.1.2] — 2026-04-30
18125

19126
### Breaking

apps/claude-code/pr-review/CLAUDE.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ When bumping the version, update it in **both** files:
3434

3535
- YAML frontmatter declares `allowed-tools` — add any new tools the command needs there
3636
- Auto-generated files are explicitly skipped in Step 6 (serialization YAMLs, `*.g.cs`, generated types output, `swagger.md`)
37-
- All comments posted to ADO **must** end with the exact signature: `---\n🤖 *Reviewed by Claude Code*`
37+
- All comments posted to ADO **must** end with the exact signature: `---\n🤖 *Reviewed by Claude Code* — Iteration N` (where N = LATEST_ITERATION_ID)
3838
- Inline threads use ADO REST `pullRequestThreads` via `az devops invoke`; file paths must match ADO format (leading `/`, forward slashes)
39-
- `iterationId=1` is always used unless there's a specific reason to target a later iteration
39+
- Always use the latest iteration of the PR. `iterationId=1` is never used. Re-reviews additionally compute `PRIOR_ITERATION_ID` from the prior review's signature — see spec 02.
4040
- If `az devops invoke` returns a `threadContext` error, fall back to posting without `threadContext` (general comment)
4141

4242
## External dependencies
@@ -64,5 +64,4 @@ Then add `"pr-review@unic": true` to `enabledPlugins` and restart Claude Code.
6464

6565
- GitHub PR support
6666
- Vote on PR (approve/reject) after review
67-
- Re-review: detect existing Claude Code threads and update instead of duplicating
6867
- PR description generation from diff

apps/claude-code/pr-review/CONTEXT.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ _Avoid_: response, follow-up comment
5959
A fixed text marker appended to every Plugin-authored comment, used to identify Review Threads and Replies created by this Plugin.
6060
_Avoid_: watermark, marker, signature
6161

62+
### Doc context enrichment
63+
64+
**Doc Context**:
65+
The aggregated summaries of linked work items and Confluence pages passed to Review Aspect agents as background on the business intent of the PR. Produced before the review phase and injected as a preamble into each agent's prompt.
66+
_Avoid_: ticket context, background info, extra context
67+
68+
**Doc Context Sub-agent**:
69+
A short-lived agent spawned to fetch and summarise a single source — either a work item description or a Confluence page — in a diff-aware way. Multiple Doc Context Sub-agents run in parallel; their outputs are merged into the Doc Context.
70+
_Avoid_: context agent, doc agent, fetcher agent
71+
6272
### Re-review classification
6373

6474
**Thread Classification**:
@@ -85,6 +95,8 @@ A Thread Classification state. The relevant code was deleted or moved; the comme
8595
- A **Reply** is added to an existing **Review Thread** — it does not open a new one
8696
- The **Bot Signature** is present on every comment authored by the Plugin, enabling prior-review detection
8797
- A **Revision** is the code snapshot a **Review** or **Re-review** analyses
98+
- A **Doc Context** is assembled by one or more **Doc Context Sub-agents** before the Review phase and injected into every Review Aspect agent
99+
- A **Doc Context Sub-agent** operates on a single source (work item or Confluence page) and receives the changed files list and the local diff when available
88100

89101
## Example dialogue
90102

apps/claude-code/pr-review/PROMPT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ You are implementing the **re-review** capability for the `unic-pr-review` plugi
44

55
## Step 1 — Determine what's next
66

7-
Open `docs/plans/README.md`. Scan spec files in order (00 → 09) and find the first file whose status is **not** `done`.
7+
Open `docs/plans/README.md`. Scan spec files in order and find the first file whose status is **not** `done` nor `ignore`.
88

99
If **all** specs contain `**Status: done**`, output exactly:
1010

apps/claude-code/pr-review/README.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Run `/pr-review:review-pr <ADO-PR-URL>` to:
1111
3. Post each finding as an inline comment at the exact file and line in the ADO web UI
1212
4. Post a summary comment with severity-grouped findings and positive observations
1313

14-
All comments are signed `🤖 *Reviewed by Claude Code*` so reviewers know they are AI-generated.
14+
All comments are signed `🤖 *Reviewed by Claude Code* — Iteration N` so reviewers know they are AI-generated and can track which review iteration produced each finding.
1515

1616
---
1717

@@ -127,18 +127,39 @@ Every comment posted to the PR ends with:
127127

128128
```
129129
---
130-
🤖 *Reviewed by Claude Code*
130+
🤖 *Reviewed by Claude Code* — Iteration N
131131
```
132132

133-
This consistent signature lets team members immediately identify AI-generated review comments.
133+
This consistent signature lets team members immediately identify AI-generated review comments and track which review iteration produced each finding.
134+
135+
---
136+
137+
## Re-review
138+
139+
Running `/pr-review:review-pr <url>` on a PR that already has Claude Code review threads triggers re-review mode automatically.
140+
141+
**What changes in re-review mode:**
142+
143+
- **Detection** — Step 3.5 scans all existing PR threads for the bot signature and extracts their file paths, line ranges, and classification metadata.
144+
- **Thread reuse** — New findings are posted as replies to the matching prior thread (matched by file path and line-range overlap ±3 lines) rather than creating duplicate threads.
145+
- **Classification** — Each prior thread is classified as `addressed` (resolved), `disputed` (active disagreement), `pending` (still open), or `obsolete` (file deleted or lines moved far).
146+
- **Incremental diff** — The diff is computed between the prior review's commit and the latest commit, so only new changes are analysed.
147+
- **Delta summary** — Instead of a full summary, a short reply is posted to the existing summary thread listing new findings and counts. If nothing changed, no summary is posted.
148+
- **Completion marker** — Every successful run appends a completion marker to the summary thread so subsequent runs can detect partial-run failures.
149+
150+
**Signature format:** `🤖 *Reviewed by Claude Code* — Iteration N` (N = ADO PR iteration number).
151+
152+
**Known limitations:**
153+
154+
- Force-push that rewrites history falls back to a full diff (prior commit no longer exists in the remote).
155+
- If a run was interrupted before posting the completion marker, the next run treats it as a partial run and skips to a recovery path.
134156

135157
---
136158

137159
## Roadmap
138160

139161
- **GitHub PR support** — detect `https://github.com/...` URLs and route to `gh pr review`
140162
- **Vote on PR** — optionally set approval/rejection after review
141-
- **Re-review** — detect existing Claude Code threads and update rather than duplicate
142163
- **PR description generation** — generate a PR description from the diff
143164

144165
---

0 commit comments

Comments
 (0)