Add Claude API support alongside Cursor API - #46
Open
jonathanKingston wants to merge 3 commits into
Open
Conversation
Adds claudeApiKey config field and a complete Claude API client (lib/claude-api.ts) mirroring the Cursor API module. All commands (pr-comments, create-issue, artifacts, status TUI, web dashboard) now route to the appropriate agent API based on the PR's agent type. The ApiProvider interface, MockApiProvider, and test suite are extended with Claude-specific methods and coverage. https://claude.ai/code/session_0148LH62Tjtqruhtd5dRE5fd
…deo-0d69 Fix flaky mock-provider status test by bypassing stale disk cache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for Claude agents as an alternative to Cursor agents throughout the codebase. Users can now configure a
claudeApiKeyin.copsercand interact with Claude agents for pull requests, artifacts, and issue automation, with the same feature parity as the existing Cursor integration.Key Changes
New Claude API module (
lib/claude-api.ts): Implements the full Claude API client with support for:Claude replies module (
lib/claude-replies.ts): Mirrors the Cursor replies pattern, handling follow-up vs. launch logic for Claude agentsConfiguration support: Added
claudeApiKeyfield toCopsercconfig interfaceWeb server updates (
web/server.ts):?agent=cursor|claudequery parameter to select which agent type to use/api/cursor/agents/...and/api/claude/agents/...pathsCLI command updates:
status.ts: Watch mode now displays Claude PR agents and fetches Claude artifacts when configuredartifacts.ts: Tries Cursor first, then Claude when downloading artifactspr-comments.ts: Interactive loop supports Claude agent repliescreate-issue.ts: Can launch Claude agents for issues via@claudementionsMock provider support (
lib/mock-api-provider.ts): Added Claude agent mocking for tests with separate tracking of Claude agents, artifacts, followups, and launchesTest coverage: Added comprehensive tests for Claude reply logic and mock provider integration
Implementation Details
agentquery parameter or URL path segmenthttps://claude.ai/code/session_0148LH62Tjtqruhtd5dRE5fd