feat(utils): add claude-code LLM provider - #66
Conversation
Add support for Claude Code LLM provider via ai-sdk-provider-claude-code. Extends existing LLM interface with claude-code provider option, settings, model defaults, pricing, and full test coverage. Changes: - Add ai-sdk-provider-claude-code@^3.4.0 dependency - Extend LLMProvider type with 'claude-code' - Add ClaudeCodeSettings import/export and provider creation - Add DEFAULT_MODELS and MODEL_PRICING for claude-code - Add claudeCodeSettings to LLMOptions and SemanticOptions - Add 5 unit tests for claude-code provider functionality - Update CLAUDE.md Semantic Extraction table with Claude Code row All tests pass (485 unit tests), typecheck OK, lint OK.
Summary of ChangesHello @amondnet, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the project's large language model capabilities by integrating the Claude Code provider. This expansion offers users more flexibility and choice in their LLM selection for semantic feature extraction, ensuring broader compatibility and potentially improved performance for code-related tasks. The changes are seamlessly integrated into the existing LLM client architecture, maintaining consistency and ease of use. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Code Review
This pull request effectively adds support for the Claude Code LLM provider. The changes are comprehensive, touching dependencies, type definitions, provider logic, and options integration. I appreciate the thoroughness, including the addition of new unit tests and documentation updates. The implementation is solid. I have one minor suggestion regarding code duplication in the model pricing configuration to enhance future maintainability.
…rovider return type RPGEvolver.createLLMClient() was missing claudeCodeSettings passthrough, causing silent config loss when using claude-code provider in evolution pipeline. Also widened detectProvider() return type to LLMProvider | null for type consistency.
There was a problem hiding this comment.
Pull request overview
Adds a new claude-code option to the project’s unified LLM abstraction, wiring Claude Code provider creation and settings passthrough through utils and encoder layers, with accompanying tests and documentation.
Changes:
- Added Claude Code provider support to
LLMClient(defaults, provider factory wiring, pricing/cost estimation keys). - Plumbed
claudeCodeSettingsthroughSemanticOptionsand encoder construction paths. - Added unit tests and updated semantic-extraction documentation; updated dependencies/lockfile.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
packages/utils/src/llm.ts |
Adds claude-code provider option, default model, pricing entries, and provider creation wiring. |
packages/encoder/src/semantic.ts |
Extends SemanticOptions to accept claudeCodeSettings and passes them into LLMClient. |
packages/encoder/src/encoder.ts |
Passes claudeCodeSettings from encoder semantic options into LLMClient. |
tests/utils/llm.test.ts |
Adds mocks and tests for Claude Code provider defaults, settings passthrough, completion, and cost estimation. |
packages/utils/package.json |
Adds ai-sdk-provider-claude-code dependency to utils package. |
package.json |
Adds ai-sdk-provider-claude-code to root devDependencies. |
bun.lock |
Updates lockfile with new provider and transitive dependencies (including native optional deps). |
CLAUDE.md |
Documents Claude Code option in the semantic extraction table. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Update JSDoc comments to include claude-code in provider lists - Add Claude Code usage example to LLMClient class documentation - Clarify MODEL_PRICING comment re subscription billing - Add exhaustive default case to createProvider switch - Log warnings in SemanticExtractor catch blocks instead of silently swallowing errors - Update README requirements and LLM interface description - Add tests for createClaudeCode undefined settings, apiKey isolation, and opus/haiku cost estimation
…lection Add parseModelString() utility to parse "provider/model" format strings (e.g., claude-code/haiku, openai/gpt-5.2) and wire it into the CLI. - Add parseModelString() and validateProvider() to @pleaseai/rpg-utils/llm - Add model?: string to SemanticOptions interface - Pass model through SemanticExtractor, RPGEncoder, and RPGEvolver - Add -m/--model and --no-llm options to encode, evolve, and generate commands - Implement evolve CLI command (was previously a TODO stub) - Add 7 unit tests for parseModelString
There was a problem hiding this comment.
4 issues found across 7 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/encoder/src/semantic.ts">
<violation number="1" location="packages/encoder/src/semantic.ts:118">
P2: The `console.warn` addition is good, but per your team's convention, non-fatal catch blocks should also push the diagnostic message to a `warnings: string[]` instance property so callers can programmatically detect partial failures (e.g., to surface them in CLI output or test assertions). Consider adding a `private warnings: string[] = []` field and a `getWarnings()` accessor, then push `msg` into it alongside each `console.warn`.
(Based on your team's feedback about pushing warnings to an array for caller visibility.) [FEEDBACK_USED]</violation>
</file>
<file name="packages/utils/src/llm.ts">
<violation number="1" location="packages/utils/src/llm.ts:174">
P2: Hardcoded provider list in `validateProvider` will silently reject new providers. Use `DEFAULT_MODELS` (which is `Record<LLMProvider, string>` and thus enforced by TypeScript to be exhaustive) instead of maintaining a duplicate list.</violation>
</file>
<file name="packages/cli/src/cli.ts">
<violation number="1" location="packages/cli/src/cli.ts:36">
P1: The `--model` and `--no-llm` options are added to the `generate` command but never used in its action handler. Unlike the `encode` and `evolve` commands, `buildSemanticOptions(options.model, options.llm)` is never called here, so these flags are silently ignored. Either wire up semantic options to `ZeroRepo` or remove the unused flags to avoid misleading users.</violation>
<violation number="2" location="packages/cli/src/cli.ts:264">
P2: When evolution errors occur, only the count is logged—the actual error details are swallowed. Consider iterating over `result.errors` and printing each one (e.g., entity, phase, and message) so users can diagnose partial failures.
(Based on your team's feedback about returning collected errors to callers instead of only logging.) [FEEDBACK_USED]</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
- Remove unused --model/--no-llm options from generate command (ZeroRepo does not support semantic options) - Print evolution error details (entity, phase, message) instead of just error count - Relocate LLMClient JSDoc to directly above class definition and remove duplicate comment block - Derive validateProvider() list from DEFAULT_MODELS keys instead of maintaining a hardcoded duplicate
- Extract shared Claude pricing constants to avoid duplication between full model names and Claude Code shortcuts - Add warnings[] array to SemanticExtractor so callers can programmatically detect LLM fallback events
|




Summary
Adds support for Claude Code LLM provider to the RPG project via
ai-sdk-provider-claude-code. This extends the existing LLM interface to support Claude Code as an additional provider option alongside OpenAI, Anthropic, and Google providers.Changes
ai-sdk-provider-claude-code@^3.4.0to root andpackages/utils/package.jsonLLMProvidertype with'claude-code'optionClaudeCodeSettingsimport/export,DEFAULT_MODELS,MODEL_PRICING, and provider creation logicclaudeCodeSettingsfield toLLMOptions,SemanticOptions, and encoder passthroughCLAUDE.mdSemantic Extraction table with Claude Code provider rowTest Plan
bun run typecheck)bun run lint)bun run build)Test Coverage
New tests verify:
Files Changed
CLAUDE.md- Documentation updatebun.lock- Dependency lock filepackage.json- Root dependencypackages/encoder/src/encoder.ts- Settings passthroughpackages/encoder/src/semantic.ts- Options integrationpackages/utils/package.json- Utils package dependencypackages/utils/src/llm.ts- Provider implementationtests/utils/llm.test.ts- Test coverage8 files changed, 132 insertions(+), 15 deletions(-)
Summary by cubic
Add Claude Code as a new LLM provider and enable model selection in the CLI for encode/evolve. Implement evolve with detailed error output, add default model "sonnet", cost estimation, model/settings passthrough, and expose LLM fallback warnings.
New Features
Migration
Written for commit 5a421bc. Summary will update on new commits.