Skip to content

fix(pr-review): rename .agents/ → agents/ so plugin agents are discoverable#38

Merged
orioltf merged 7 commits into
developfrom
feature/pr-review-agents-not-discovered
May 19, 2026
Merged

fix(pr-review): rename .agents/ → agents/ so plugin agents are discoverable#38
orioltf merged 7 commits into
developfrom
feature/pr-review-agents-not-discovered

Conversation

@orioltf
Copy link
Copy Markdown
Member

@orioltf orioltf commented May 19, 2026

Why

Claude Code's agent auto-discovery scans an agents/ directory inside each plugin. The pr-review plugin stored its agents in .agents/ (dot-prefixed, hidden on Unix), which was never scanned. This caused every spawned sub-agent to fail at runtime:

Error: Agent type 'pr-review:ado-fetcher' not found.

The pr-review-toolkit plugin — which works correctly — uses agents/ (no dot). That mismatch was the root cause.

What changed

  • git mv .agents/ agents/ — the directory Claude Code actually scans
  • Added name: <slug> as the first frontmatter field in all five agent files — defensive hardening to match the working pr-review-toolkit convention
  • Updated CLAUDE.md repository layout section and ADR 0013 (in-place correction, no new ADR)
  • Fixed .gitignore scratchpad path (agents/scratchpad/ was .agents/scratchpad/)
  • Fixed hardcoded .agents/ paths in tests/ado-fetcher.test.mjs and tests/ado-writer.test.mjs
  • Added tests/plugin-structure.test.mjs — 4 structural tests that go RED with the old layout and GREEN after the rename
  • Bumped to 1.2.11

Test plan

  • pnpm test — 245/245 passing
  • Restart Claude Code and confirm pr-review:ado-fetcher (and the other four agents) appear in the available agent list
  • If ~/.claude/plugins/cache/unic-agent-plugins/pr-review/1.2.10/.agents/ still exists after restart, delete the cache entry or toggle the plugin in enabledPlugins to force a fresh read
  • Run /pr-review:review-pr <ADO-PR-URL> and confirm the ADO Fetcher launches without "Agent type not found"

Closes: docs/issues/pr-review-agents-not-discovered/01-rename-agents-dir-and-fix-frontmatter.md

🤖 Generated with Claude Code

orioltf and others added 4 commits May 19, 2026 09:17
Track the .agents/ → agents/ rename fix and name: frontmatter
addition needed to make pr-review plugin agents discoverable
by Claude Code's agent auto-discovery system.

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

Claude Code's agent auto-discovery scans agents/ (no dot prefix).
The plugin used .agents/ (hidden dir), which was never scanned, causing
"Agent type 'pr-review:ado-fetcher' not found" at runtime.

Also adds name: frontmatter field to all five agent files to match the
convention used by pr-review-toolkit (defensive hardening).

Fixes: .agents/ → agents/ rename, name: field, CLAUDE.md layout,
ADR 0013 correction, test path references, plugin-structure test suite.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
These implementation-notes files were untracked while hidden under
.agents/ and got accidentally indexed during the rename. Remove them
from the tree; the directory remains on disk for agent use.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
.agents/scratchpad/ → agents/scratchpad/ in .gitignore to match the
renamed agents/ directory.

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

This PR fixes agent auto-discovery for the apps/claude-code/pr-review plugin by moving agent definitions from a hidden .agents/ directory to a discoverable agents/ directory, aligning the plugin with Claude Code’s expected layout.

Changes:

  • Renames the plugin agent directory to agents/ and adds name: to each agent’s YAML frontmatter.
  • Updates tests and adds a new structural test to prevent regressions in plugin layout/agent frontmatter.
  • Updates plugin docs/metadata (CLAUDE.md, ADR 0013, changelog, version bump, .gitignore).

Reviewed changes

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

Show a summary per file
File Description
docs/issues/pr-review-agents-not-discovered/01-rename-agents-dir-and-fix-frontmatter.md New issue doc capturing the problem, root cause, and acceptance criteria for the rename/frontmatter hardening.
apps/claude-code/pr-review/tests/plugin-structure.test.mjs Adds structural tests asserting agents/ exists, .agents/ does not, and agent frontmatter contains a matching name: field.
apps/claude-code/pr-review/tests/ado-writer.test.mjs Updates test fixture path to read agent markdown from agents/.
apps/claude-code/pr-review/tests/ado-fetcher.test.mjs Updates test fixture path to read agent markdown from agents/.
apps/claude-code/pr-review/package.json Adds the new structural test file to the explicit node --test invocation list.
apps/claude-code/pr-review/docs/adr/0013-orchestrator-split-for-review-pr.md Updates directory name reference; also introduces additional ADR content and references that need follow-up.
apps/claude-code/pr-review/CLAUDE.md Updates repo layout + one prose reference to use agents/ (but still has a remaining .agents/ reference elsewhere).
apps/claude-code/pr-review/CHANGELOG.md Adds 1.2.11 entry describing the rename and frontmatter hardening.
apps/claude-code/pr-review/agents/re-review-coordinator.md Adds name: to agent frontmatter.
apps/claude-code/pr-review/agents/doc-context-synthesizer.md Adds name: to agent frontmatter.
apps/claude-code/pr-review/agents/doc-context-orchestrator.md Adds name: to agent frontmatter.
apps/claude-code/pr-review/agents/ado-writer.md Adds name: to agent frontmatter.
apps/claude-code/pr-review/agents/ado-fetcher.md Adds name: to agent frontmatter.
apps/claude-code/pr-review/.gitignore Updates scratchpad ignore path from .agents/scratchpad/ to agents/scratchpad/.
apps/claude-code/pr-review/.claude-plugin/plugin.json Bumps plugin version to 1.2.11.
apps/claude-code/pr-review/.claude-plugin/marketplace.json Bumps marketplace version to 1.2.11.

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

Comment thread apps/claude-code/pr-review/docs/adr/0013-orchestrator-split-for-review-pr.md Outdated
Comment thread apps/claude-code/pr-review/tests/plugin-structure.test.mjs
Comment thread apps/claude-code/pr-review/CLAUDE.md
orioltf and others added 3 commits May 19, 2026 09:32
- plugin-structure.test.mjs: sort imports (organizeImports)
- notices.test.mjs: @ts-ignore@ts-expect-error (noTsIgnore)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- CLAUDE.md: fix remaining .agents/ → agents/ in Command conventions
  bullet (acceptance criteria gap)
- plugin-structure.test.mjs: tighten frontmatter name check from
  includes() to line-anchored regex — prevents false pass on partial
  matches like 'name: ado-fetcher-extra'
- ADR 0013: revert out-of-scope additions (status 'amended by 0016'
  and 2026-05-14 update paragraph) — those were pre-existing unstaged
  changes accidentally staged; they belong in a future PR that also
  commits ADR 0016

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@orioltf orioltf merged commit 27e79c9 into develop May 19, 2026
4 checks passed
@orioltf orioltf deleted the feature/pr-review-agents-not-discovered branch May 19, 2026 07:38
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