Skip to content

[unic-pr-review] ADO first-review preview (provider dispatch + ADO Fetcher) #148

@orioltf

Description

@orioltf

Parent

docs/issues/unic-pr-review/PRD.md

What to build

Open up the ADO path: /unic-pr-review:review-pr <ADO URL> detects the provider, fans out the ADO Fetcher to read PR metadata / Revisions / Threads / changed files / raw diff via az devops invoke, normalises the PR's linked Work Items into the contract the Intent Checker already consumes (#147), and runs the aspect-agent fan-out exactly as Pre-PR does. Renders the full preview (Intent Check + Severity sections) to the terminal. Still no writes — the Approval Loop and ADO Writer come in the next two slices.

Per ADR-0010 (planned, lands with this slice): providers ship as a folder bundle so future GitHub/GitLab support is a contained PR. Per the planned ADR-0001 amendment (also lands with this slice) + US 41: work-item discovery is a provider contract — for ADO this reads the PR's native Work Item field, not regex-scraped from the description. This issue is responsible for both authoring ADR-0010 and amending ADR-0001 — those records do not exist yet on develop.

Acceptance criteria

  • apps/claude-code/unic-pr-review/docs/adr/0010-provider-folder-bundle.md is authored in MADR-lite format and committed alongside the implementation; captures the folder-bundle decision over a single-file alternative.
  • apps/claude-code/unic-pr-review/docs/adr/0001-multi-source-intent-with-shared-atlassian-credentials.md gains an amendment block noting that work-item discovery is a Provider contract (discoverWorkItems(prMetadata) → [{ id, type, url, raw }]) and the Intent Checker consumes the normalised list.
  • apps/claude-code/unic-pr-review/docs/adr/README.md is updated: ADR-0010 moves from the "Planned" section to the main list; the amendment note for ADR-0001 is removed from "Planned".
  • PRD §105/107 (docs/issues/unic-pr-review/PRD.md) is updated: ADR-0010's "(planned)" qualifier is removed and the trailing amendment paragraph is updated to past tense.
  • providers/index.mjs exposes detectProvider(url) → ProviderModule | null that matches against each registered provider's prUrlPattern.
  • providers/azure_devops/ folder bundle contains provider.mjs, manifest.json, README.md, fixtures/, tests/. The module exports name, label, prUrlPattern, parsePrUrl(url) → { orgUrl, project, repo, prId }, agents.{fetcher, writer} (with the unic-pr-review:* namespace), and discoverWorkItems(prMetadata) → [{ id, type, url, raw }].
  • agents/ado-fetcher.md exists with distinct name + colour; every read goes through az devops invoke. Reads PR metadata, Revisions, Threads, changed files, raw diff. Identity caching: runs az account show + az devops user show --user me once and caches { id, displayName } for the run.
  • discoverWorkItems reads the PR's Work Item field from the metadata (not regex-scraping the description). Returns a normalised list the Intent Checker can consume directly.
  • When given an ADO URL, the orchestrator: detects the provider → invokes the provider's fetcher agent → passes the normalised work-item list to the Intent Checker → runs the aspect-agent fan-out → renders the preview. No writes.
  • Intent Checker (from [unic-pr-review] Intent gathering via Atlassian (Pre-PR pasted URLs) #147) treats provider-discovered Work Items and Pre-PR pasted URLs identically: any Confluence URL referenced from a Work Item is fetched via scripts/atlassian-fetch.mjs (clean-slate, same path-routing logic).
  • providers/azure_devops/tests/provider.test.mjs covers prUrlPattern match/non-match, parsePrUrl parsing, discoverWorkItems against fixtures (with-WI, without-WI, multiple-WI).
  • tests/ado-cli-smoke.test.mjs asserts that every az devops invoke invocation the fetcher emits is present in providers/azure_devops/fixtures/ado-cli-inventory.* (mirrors the inventory pattern from earlier plugins but is written fresh).
  • Cross-platform CI green.

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew capabilityfeature/unic-pr-reviewIssues from the unic-pr-review featureready-for-agentFully specified, ready for an AFK agent

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions