feat(unic-pr-review): remaining five aspect agents + conditional spawning#158
Conversation
…ning Wire changed-file-analyser into the review-pr command (Step 4a/4b): the orchestrator now calls decideSpawnSet to resolve which aspect agents apply to the diff, then fans them all out in parallel via the Task tool, merges findings before rendering. Adds a CLI entry point to changed-file-analyser.mjs so the command can pipe git --name-only output directly into node without a heredoc. Closes #146 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🔍 Comprehensive PR ReviewPR: #158 — feat(unic-pr-review): remaining five aspect agents + conditional spawning SummaryThe PR cleanly implements the five remaining Review Aspect agents and rewrites Verdict:
🔴 HIGH Issues (Fix Before Merge)1. CLI guard uses non-portable
|
| Issue | Location | Suggestion |
|---|---|---|
| Agent files use wrong-domain JSON examples | agents/code-simplifier.md etc. |
Replace "Null pointer" example with a domain-appropriate finding per agent |
README outdated — review-pr command missing |
README.md |
Add review-pr to Commands table; update Quick Start from "coming soon" to functional |
✅ What's Good
- Table-driven
SPAWN_TABLEis clean and extensible — one entry per aspect agent - Predicate unit tests are excellent: all 6 entries have positive + negative fixtures, threshold boundary tests, and a mixed-content integration scenario
review-pr.mdaccurately reflects the implementation: invocation, spawn-set print, parallel launch, merge step, and agent-name-to-file mapping- Five new agent prompts follow the same structure as
code-reviewer.md— consistent and immediately readable decideSpawnSetreturnsSet<string>— O(1) membership checks, no duplicates- Zero new runtime dependencies — consistent with the plugin's zero-dep philosophy
Next Steps
- 🔴 Fix HIGH issues 1 & 2 (URL guard + CLI tests)
- 🟡 Fix trivial MEDIUMs in this PR: 3, 4, 5, 7, 10
- 📋 Create issues for 6 (predicate alignment), 8 (ADR), 9 (CONTEXT.md)
Reviewed by Archon comprehensive-pr-review workflow
Full artifacts: /Users/oriol.torrent/.archon/workspaces/unic/unic-agents-plugins/artifacts/runs/70d84536fd313df77c802e42714464e8/review/
Fixed: - CLI guard: use pathToFileURL() instead of new URL() — portable on Windows - isTypeFile: match .tsx files (was matching only .ts) - stdin 'error' handler added to CLI entry block - Test description: rename misleading test that listed wrong agents Tests added: - CLI entry point: 5 spawnSync integration tests covering stdin→stdout pipeline - Windows backslash paths: 5 predicate tests exercising [/\\] branch Docs updated: - AGENTS.md: two-part checklist for adding new Review Aspect agents - CONTEXT.md: glossary entries for Review Aspect and Spawn Set; accurate Intent Brief note - ADR-0008: update future-tense Consequences, add Spawn Table for all 6 agents - README: add review-pr row to Commands table, update Quick Start - 5 agent .md files: replace wrong-domain JSON examples with domain-accurate ones Skipped: - Issue 6 (comment-analyzer predicate for source files): needs ADR-0008 owner sign-off Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
⚡ Self-Fix Report (Aggressive)Status: COMPLETE Fixes Applied (11 total)
View all fixes
Tests Added
Total: 211 tests, 0 failures Skipped (1)
Suggested follow-up: "Align comment-analyzer spawn predicate with JSDoc-in-source use case" (P2) Validation✅ Type check | ✅ Lint (exit 0) | ✅ Tests (211 passed) Self-fix by Archon · aggressive mode · fixes pushed to |
…formatting Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Agent frontmatter carried only description; without an explicit name, tooling that expects it (e.g. plugin-dev validate-agent.sh) chokes and identity relied on filename derivation. Set name to match each filename. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…rose The colour was declared in each agent's prose body where nothing reads it — agents emit JSON and the orchestrator renders. Moving it to the frontmatter color field puts it where the UI consumes it and removes the duplicate that would silently drift if only one copy were updated. Persona names are kept; they shape voice and are distinct from the kebab-case name identifier. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…stream toolkit The agents were ported from Anthropic's pr-review-toolkit but narrowed during the port, dropping substantive checks the upstream versions detect. Restore the genuine detection gaps while keeping unic's JSON output and confidence rubric: - silent-failure-hunter: log-and-continue, silent optional-chaining, unexplained fallback chains, silent retry exhaustion, errors that should propagate - type-design-analyzer: anemic models, mutable internals, doc-only invariants, inconsistent enforcement, missing construction-boundary validation + an explicit invariant-discovery step in the procedure - code-simplifier: nested-ternary check + over-simplification guardrail - pr-test-analyzer: trivial-accessor and unseen-coverage false-positive guardrails - comment-analyzer: contradicted perf/complexity claims + transitional-state rot Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
.d.ts declaration files end in .ts and were matching isSourceFile, which incorrectly spawned silent-failure-hunter and counted toward the code-simplifier 3-source-file threshold for type-only changes. They remain type files (isTypeFile). A literal d.ts (no dot before d) stays a source file. Tests lock both behaviours in. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The CLI split stdin on '\n' only, leaving a trailing '\r' on each line on CRLF platforms so extension/path regexes missed matches. Extract a pure, exported parseStdin helper that splits on /\r?\n/ and trims each line; the CLI now uses it. decideSpawnSet API is unchanged. Unit tests cover the helper plus a CRLF spawn integration test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The README advertised /unic-pr-review:review-pr <ADO-PR-URL> as an AI-powered review against an Azure DevOps PR, but the command prints "ADO mode is not yet supported in this release" for a URL and only Pre-PR mode (no argument) works today, per ADR-0009. Update the quick start and commands table so users are pointed at the path that actually runs and ADO URL support is marked coming soon. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…pawn predicate The Decision narrative claimed silent-failure-hunter spawns "only when error handling changed", but the Spawn Table and changed-file-analyser.mjs spawn it when at least one non-test source file changed — a path/extension heuristic with no diff-content inspection. Reword the narrative to match reality. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ect contract
The six aspect agent prompts each said on line 11 they emit Findings 'as
a JSON array', but every file's Output format section requires a JSON
object { findings, positiveObservations }. Reviewers flagged the
mismatch as a non-parseable-output risk. Reword line 11 in all six to
point at the JSON object (the real contract).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ged-file-analyser Buffer.concat + parseStdin ran outside the try in the CLI stdin 'end' handler, so a synchronous throw (e.g. Buffer.concat RangeError on huge input) escaped both the local catch and the stream 'error' listener and surfaced as an uncaught V8 stack trace. Moving them inside the try routes every synchronous failure through the same tagged-stderr + exit(1) path. Happy-path output is byte-identical. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The implemented isSourceFile predicate excludes .d.ts declaration files, but the spawn table's silent-failure-hunter and code-simplifier rows did not mention this load-bearing behaviour. Add the clarification so the canonical reference matches the code. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…matter The frontmatter declares the Agent tool (authoritative for permissions), but Step 4b prose referred to the Task tool. Reconcile the body wording to Agent so the command is internally consistent. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Post-merge review (PR #159) found the merge of #158's multi-aspect fan-out and #159's intent gathering left two stale single-agent references: - Step 3.6 said 'Use the Task tool' to spawn the intent-checker, but the frontmatter allowed-tools declares only `Agent` and develop had deliberately aligned every body reference to 'Agent tool' — the merge reintroduced the exact mismatch (and a tool not in allowed-tools). Use 'Agent tool'. - The Step 3 large-diff warning and the CHANGELOG entry still described a single 'agent' / broadcasting 'to the code-reviewer'; Step 4 now fans out to every aspect agent in SPAWN_SET. Reword both to the plural fan-out reality. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Summary
changed-file-analyser.mjsto exportdecideSpawnSet(changedFiles) → Set<string>with a full table-driven spawn-decision implementation (ADR-0008)tests/changed-file-analyser.test.mjsto cover all six spawn predicates with positive and negative fixtures eachWhy
Closes #146. Completes the six-agent fan-out specified in ADR-0008 —
code-reviewerwas the only aspect agent that existed; the other five conditional agents were deferred from issue #145.Test plan
pnpm --filter unic-pr-review testgreenpnpm --filter unic-pr-review typecheckcleanpnpm ci:checkclean🤖 Generated with Claude Code