Skip to content

feat(utils): add claude-code LLM provider - #66

Merged
amondnet merged 6 commits into
mainfrom
feat/claude-code-provider
Feb 12, 2026
Merged

feat(utils): add claude-code LLM provider#66
amondnet merged 6 commits into
mainfrom
feat/claude-code-provider

Conversation

@amondnet

@amondnet amondnet commented Feb 12, 2026

Copy link
Copy Markdown
Contributor

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

  • Dependencies: Added ai-sdk-provider-claude-code@^3.4.0 to root and packages/utils/package.json
  • Type System: Extended LLMProvider type with 'claude-code' option
  • Provider Support: Added ClaudeCodeSettings import/export, DEFAULT_MODELS, MODEL_PRICING, and provider creation logic
  • Options Integration: Added claudeCodeSettings field to LLMOptions, SemanticOptions, and encoder passthrough
  • Testing: Added 5 comprehensive unit tests covering constructor, custom model, complete method, settings passthrough, and cost estimation
  • Documentation: Updated CLAUDE.md Semantic Extraction table with Claude Code provider row

Test Plan

  • ✅ 485 unit tests pass (including 5 new claude-code provider tests)
  • ✅ Type checking passes (bun run typecheck)
  • ✅ Linting passes (bun run lint)
  • ✅ Build succeeds (bun run build)

Test Coverage

New tests verify:

  • Constructor initialization with default model
  • Custom model configuration
  • Complete method integration with AI SDK
  • Settings passthrough to provider
  • Cost estimation with model pricing

Files Changed

  • CLAUDE.md - Documentation update
  • bun.lock - Dependency lock file
  • package.json - Root dependency
  • packages/encoder/src/encoder.ts - Settings passthrough
  • packages/encoder/src/semantic.ts - Options integration
  • packages/utils/package.json - Utils package dependency
  • packages/utils/src/llm.ts - Provider implementation
  • tests/utils/llm.test.ts - Test coverage

8 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

    • Added 'claude-code' provider with default 'sonnet' and pricing for sonnet/opus/haiku.
    • CLI: -m/--model and --no-llm for encode and evolve; evolve now implemented and prints detailed errors.
    • Model passthrough to SemanticOptions/LLMClient (incl. claudeCodeSettings) and parseModelString('provider/model'); SemanticExtractor now logs and exposes warnings[]; docs/tests updated.
  • Migration

    • Use provider: 'claude-code' or -m 'claude-code/haiku' with encode/evolve; use --no-llm to disable LLM.
    • Requires Claude Desktop Pro/Max; no API key needed.
    • Note: generate does not support -m/--no-llm.

Written for commit 5a421bc. Summary will update on new commits.

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.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @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

  • Claude Code LLM Provider Integration: Added support for the Claude Code LLM provider, extending the existing LLM interface to include this new option alongside OpenAI, Anthropic, and Google providers.
  • Dependency Updates: Incorporated ai-sdk-provider-claude-code@^3.4.0 into the project's dependencies, along with related updates in the bun.lock file.
  • Type System and Options Extension: Extended the LLMProvider type to include 'claude-code' and added claudeCodeSettings to LLMOptions and SemanticOptions for configuration.
  • LLM Client Enhancements: Implemented logic for creating the Claude Code provider instance, defined default models and pricing, and ensured claudeCodeSettings are passed through the encoder.
  • Comprehensive Unit Testing: Added five new unit tests to cover the constructor, custom model configuration, complete method integration, settings passthrough, and cost estimation for the Claude Code provider.
  • Documentation Update: Updated the CLAUDE.md documentation to reflect the new Claude Code provider option in the Semantic Extraction table.
Changelog
  • CLAUDE.md
    • Updated the Semantic Extraction table to include Claude Code provider details.
  • bun.lock
    • Added ai-sdk-provider-claude-code and @anthropic-ai/claude-agent-sdk dependencies.
    • Updated various @img/sharp related dependency versions, likely due to transitive dependencies.
  • package.json
    • Added ai-sdk-provider-claude-code as a development dependency.
  • packages/encoder/src/encoder.ts
    • Passed claudeCodeSettings to the LLMClient constructor.
  • packages/encoder/src/semantic.ts
    • Imported ClaudeCodeSettings type.
    • Added claudeCodeSettings property to the SemanticOptions interface.
    • Passed claudeCodeSettings from SemanticOptions to the LLMClient constructor.
  • packages/utils/package.json
    • Added ai-sdk-provider-claude-code as a production dependency.
  • packages/utils/src/llm.ts
    • Imported ClaudeCodeSettings type and createClaudeCode function.
    • Extended LLMProvider type to include 'claude-code'.
    • Added claudeCodeSettings property to the LLMOptions interface and exported ClaudeCodeSettings.
    • Updated DEFAULT_MODELS to include 'claude-code' with 'sonnet' as default.
    • Added pricing information for Claude Code models (sonnet, opus, haiku) to MODEL_PRICING.
    • Modified createProvider function to accept claudeCodeSettings and handle the creation of the Claude Code provider.
    • Updated LLMClient constructor to pass claudeCodeSettings to the createProvider function.
  • tests/utils/llm.test.ts
    • Mocked the ai-sdk-provider-claude-code module.
    • Added unit tests for claude-code provider's default model and custom model selection.
    • Included a test to verify generateText calls with the claude-code provider.
    • Added a test to confirm claudeCodeSettings are correctly passed to createClaudeCode.
    • Implemented a test for cost estimation with the claude-code sonnet model.
Activity
  • The pull request introduces a new feature to support Claude Code LLM.
  • Dependencies were updated to include the new AI SDK provider.
  • Core LLM utility types and functions were modified to accommodate the new provider.
  • Encoder logic was updated to pass through Claude Code specific settings.
  • Comprehensive unit tests were added to ensure the correct functionality and integration of the Claude Code provider.
  • Documentation was updated to reflect the new provider option.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov

codecov Bot commented Feb 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 63.63636% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
packages/encoder/src/semantic.ts 9.09% 10 Missing ⚠️
packages/utils/src/llm.ts 90.47% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread packages/utils/src/llm.ts Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 8 files

…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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 claudeCodeSettings through SemanticOptions and 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.

Comment thread packages/utils/package.json
- 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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread packages/cli/src/cli.ts
Comment thread packages/encoder/src/semantic.ts Outdated
Comment thread packages/utils/src/llm.ts Outdated
Comment thread packages/cli/src/cli.ts Outdated
- 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

Copilot AI commented Feb 12, 2026

Copy link
Copy Markdown

@amondnet I've opened a new pull request, #67, to work on those changes. Once the pull request is ready, I'll request review from you.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@amondnet
amondnet merged commit 00d8ce2 into main Feb 12, 2026
6 of 16 checks passed
@amondnet
amondnet deleted the feat/claude-code-provider branch February 12, 2026 12:07
This was referenced Mar 9, 2026
This was referenced May 27, 2026
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.

3 participants