Skip to content

Adapters declare their own category (finish #872 DRY)#887

Merged
rohitg00 merged 1 commit into
mainfrom
fix/adapter-category-872
Jun 10, 2026
Merged

Adapters declare their own category (finish #872 DRY)#887
rohitg00 merged 1 commit into
mainfrom
fix/adapter-category-872

Conversation

@rohitg00

@rohitg00 rohitg00 commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Follow-up to #883 (reporter feedback). The onboarding picker now derives its agent set from connect's ADAPTERS, but it still kept a hardcoded NATIVE_AGENTS set to choose the "native plugin" vs "MCP server" hint, decoupled from the adapters and prone to the same drift class as the original bug. It had even mislabeled openclaw (a factory/MCP adapter) as native.

Change

  • Add category?: "native" | "mcp" to ConnectAdapter (defaults to mcp).
  • createJsonMcpAdapter sets mcp (MCP-only by construction; OpenClaw passes native).
  • The 7 native plugin/hook adapters (claude-code, copilot-cli, codex, hermes, openhuman, pi, openclaw) declare category: "native"; opencode/continue declare mcp.
  • Onboarding reads a.category and the hardcoded set is gone — ADAPTERS is now the single source for both the agent set and its grouping.
  • Regression test: every adapter must declare a category, so a future adapter missing one fails CI (this caught a missing continue category during development).

Displayed grouping is unchanged (same 7 native); only the source of truth moved onto the adapters. build + full suite (1413) pass.

Summary by CodeRabbit

  • New Features

    • Added adapter categorization system to distinguish between native plugins and MCP servers, improving organization during onboarding.
  • Tests

    • Added validation test ensuring all adapters declare a valid category type.

…ardcoded list

Onboarding still kept a hardcoded NATIVE_AGENTS set to label the picker (native plugin vs MCP server), decoupled from the adapters and prone to the same drift as the agent list (#872) — it had even mislabeled openclaw. Add a category field to ConnectAdapter (default mcp; factory sets mcp; the 7 native plugin/hook adapters set native), derive the onboarding hint from a.category, and assert every adapter declares one so a future adapter without a category fails CI.
@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agentmemory Ready Ready Preview, Comment Jun 10, 2026 5:06pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e5cd55a9-0416-4709-abb6-ca0a9ed00d2b

📥 Commits

Reviewing files that changed from the base of the PR and between a842ade and 9e85039.

📒 Files selected for processing (13)
  • src/cli/connect/claude-code.ts
  • src/cli/connect/codex.ts
  • src/cli/connect/continue.ts
  • src/cli/connect/copilot-cli.ts
  • src/cli/connect/hermes.ts
  • src/cli/connect/json-mcp-adapter.ts
  • src/cli/connect/openclaw.ts
  • src/cli/connect/opencode.ts
  • src/cli/connect/openhuman.ts
  • src/cli/connect/pi.ts
  • src/cli/connect/types.ts
  • src/cli/onboarding.ts
  • test/cli-connect.test.ts

📝 Walkthrough

Walkthrough

This PR introduces an adapter category field to classify connectors as either native plugins or MCP servers, then refactors onboarding to use this declarative field instead of a hardcoded set to determine how agents are grouped in the picker.

Changes

Adapter Category Classification

Layer / File(s) Summary
Type contract and configuration factory
src/cli/connect/types.ts, src/cli/connect/json-mcp-adapter.ts
ConnectAdapter gains an optional category?: "native" | "mcp" field. JsonMcpAdapterConfig is extended to accept a category option, and createJsonMcpAdapter propagates it from config to the returned adapter, defaulting to "mcp".
Adapter implementations
src/cli/connect/claude-code.ts, src/cli/connect/codex.ts, src/cli/connect/continue.ts, src/cli/connect/copilot-cli.ts, src/cli/connect/hermes.ts, src/cli/connect/openclaw.ts, src/cli/connect/opencode.ts, src/cli/connect/openhuman.ts, src/cli/connect/pi.ts
All adapter exports are updated with the category field: native plugins (claude-code, codex, copilot-cli, hermes, openclaw, openhuman, pi) set "native", while MCP servers (continue, opencode) set "mcp".
Onboarding agent picker integration
src/cli/onboarding.ts
Hardcoded NATIVE_AGENTS set is removed; buildAgentOptions() now derives the native-vs-MCP hint from each adapter's category field, assigning "native plugin" when category === "native" and "MCP server" otherwise.
Category validation test
test/cli-connect.test.ts
New test validates that every adapter in ADAPTERS declares a category value limited to "native" or "mcp".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • rohitg00/agentmemory#883: Also modifies onboarding adapter grouping logic and adapter metadata in the same code paths.
  • rohitg00/agentmemory#677: Extends JsonMcpAdapterConfig and createJsonMcpAdapter with additional configuration fields.
  • rohitg00/agentmemory#651: Introduces new adapters created via createJsonMcpAdapter, which will use the new category support.

Poem

🐰 A category springs to life so bright,
Sorting native plugins left and right,
MCP servers tucked in rows below,
No hardcoded lists—just let the categories flow!
Onboarding grouped with just a glance,
Meet your agents in a cleaner dance! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adapters now declare their own category metadata instead of relying on a hardcoded set, which completes issue #872 and applies DRY principles.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/adapter-category-872

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@rohitg00 rohitg00 merged commit 25e7701 into main Jun 10, 2026
7 checks passed
@rohitg00 rohitg00 deleted the fix/adapter-category-872 branch June 10, 2026 17:33
@HaleTom

HaleTom commented Jun 11, 2026

Copy link
Copy Markdown

@rohitg00 I see for opencode that it's not classed as native, with comment:

For full auto-capture, also install the bundled plugin in plugin/opencode/.

Any reason that this wouldnt' be the default? If it were, would it be classsed as 'native', or is the bar higher than that (and could it be reached)?

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