Skip to content

feat(pr-review): doc context enrichment from work items and Confluence pages (v0.9.0)#21

Merged
orioltf merged 5 commits intodevelopfrom
feature/pr-review/doc-context-enrichment
May 6, 2026
Merged

feat(pr-review): doc context enrichment from work items and Confluence pages (v0.9.0)#21
orioltf merged 5 commits intodevelopfrom
feature/pr-review/doc-context-enrichment

Conversation

@orioltf
Copy link
Copy Markdown
Member

@orioltf orioltf commented May 6, 2026

Summary

  • Adds step 4a to review-pr.md: fetches ADO work items linked to the PR and spawns parallel Doc Context Sub-agents to produce diff-aware business context summaries
  • Extends each sub-agent to follow Confluence page URLs found in work item descriptions, fetching page content via the new confluence-client.mjs script
  • New scripts/confluence-client.mjs: zero-dependency Node.js script that loads Confluence credentials (env vars → ~/.unic-confluence.json) and fetches page storage-format XML via the Confluence v2 REST API; includes full node:test suite
  • Graceful degradation: missing credentials emit a console warning only; individual page fetch failures skip that page with a per-page warning; PRs with no linked work items are unaffected

Why

Review agents previously had no visibility into the business intent of a PR. This enrichment gives them structured, diff-aware context from ADO work items and linked Confluence pages before they analyse the diff — without requiring any new comments or threads on the PR.

Test plan

  • pnpm --filter pr-review test passes (confluence-client unit tests, no live connection needed)
  • pnpm check passes
  • Manual smoke: node scripts/confluence-client.mjs --check-creds exits 0 with credentials configured
  • Manual smoke: PR with a linked ADO work item produces a ## Business context for this PR preamble in review agent prompts
  • PR with no linked work items: behaviour unchanged

🤖 Generated with Claude Code

orioltf and others added 2 commits May 6, 2026 12:53
…nce pages (v0.9.0)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All four issues were implemented by Ralph in feat(spec-10). Housekeeping
to sync issue state with the shipped code.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds “Doc Context” enrichment to the pr-review Claude Code plugin by pulling business intent from linked Azure DevOps work items and (optionally) linked Confluence pages, then injecting that context into review-agent prompts. Also ships a new Confluence client script + tests and bumps the plugin to v0.9.0.

Changes:

  • Documented a new Step 4a in commands/review-pr.md to gather work-item + Confluence-derived business context and prepend it to agent prompts.
  • Added scripts/confluence-client.mjs (credentials loading + Confluence v2 page fetch) and a node:test suite for credential/URL parsing helpers.
  • Version bump + changelog/docs/issue status updates to reflect completion.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
docs/issues/pr-review-doc-context-enrichment/01-confluence-page-client.md Issue status updated to resolved
docs/issues/pr-review-doc-context-enrichment/02-work-item-doc-context-enrichment.md Issue status updated to resolved
docs/issues/pr-review-doc-context-enrichment/03-confluence-page-doc-context-enrichment.md Issue status updated to resolved
docs/issues/pr-review-doc-context-enrichment/04-version-bump-and-docs.md Issue status updated to resolved
apps/claude-code/pr-review/tests/confluence-client.test.mjs Adds unit tests for credential loading + page-id extraction
apps/claude-code/pr-review/scripts/confluence-client.mjs New Confluence credential loader + page fetch CLI/module
apps/claude-code/pr-review/package.json Bumps version to 0.9.0; adds new test file to pnpm test
apps/claude-code/pr-review/docs/plans/README.md Marks doc-context enrichment spec as done
apps/claude-code/pr-review/docs/plans/10-doc-context-enrichment.md Marks spec status as done with date
apps/claude-code/pr-review/commands/review-pr.md Adds Step 4a doc-context workflow + prompt preamble; updates allowed-tools
apps/claude-code/pr-review/CHANGELOG.md Adds 0.9.0 entry describing doc-context enrichment
apps/claude-code/pr-review/.claude-plugin/plugin.json Bumps plugin version to 0.9.0
apps/claude-code/pr-review/.claude-plugin/marketplace.json Bumps marketplace version to 0.9.0

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/claude-code/pr-review/commands/review-pr.md Outdated
Comment thread apps/claude-code/pr-review/commands/review-pr.md Outdated
Comment thread apps/claude-code/pr-review/scripts/confluence-client.mjs Outdated
Comment thread apps/claude-code/pr-review/scripts/confluence-client.mjs
orioltf and others added 3 commits May 6, 2026 13:29
…ment

- Remove WebFetch from allowed-tools (Confluence fetching goes via Bash/node, not WebFetch directly)
- Fix dead reference to push-to-confluence.mjs --setup in both review-pr.md and confluence-client.mjs error messages; replace with correct env-var / ~/.unic-confluence.json instructions
- Guard isMain check against undefined/relative process.argv[1] with try/catch to prevent module-load crash in node -e / REPL contexts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…xt fallbacks

Improve Confluence credential and fetch error handling so failures surface
with actionable messages instead of being swallowed: differentiate JSON
parse failures from missing-fields, fix extractPageId for URLs with query
strings or anchors, attach error causes through the network stack, and add
a response-stream error handler. Add reviewer-facing fallbacks in step 4a
for work-item fetch failures, --check-creds timeout, and total Confluence
failure on a work item.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…se tests

Adds tests for query-string and anchor-fragment URLs in extractPageId, a
partial env-var fallback case for loadCredentials, and a full fetchPageText
suite covering 2xx/4xx/non-JSON/missing-body/network-error paths.

To make fetchPageText testable without mocking node:https (experimental),
the function now accepts an optional injectable httpGet transport that
defaults to the internal httpsGet — public callers are unaffected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@orioltf orioltf merged commit 79a53f2 into develop May 6, 2026
4 checks passed
@orioltf orioltf deleted the feature/pr-review/doc-context-enrichment branch May 6, 2026 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants