Centralize agent configuration resolution logic#229
Conversation
Fixes #220 - Custom Claude Code command not being used. Changes: - Export getDefaultAgentConfig() from config/index.ts for reuse - Update doctor.ts to use centralized config resolution (includes command) - Update info.ts to use centralized config resolution and display command - Add agentCommand prop to RunApp and RunAppWrapper components - Display custom command in brackets in UI (e.g., "claude (claude-glm)") The issue was that diagnostic commands (doctor, info) were manually building agent configs without checking the [[agents]] array for agents with default=true and their custom command settings. Now all agent config resolution uses the centralized getDefaultAgentConfig() which properly: 1. Checks CLI override 2. Checks shorthand agent field 3. Checks stored defaultAgent 4. Finds agent with default: true in agents array 5. Falls back to first agent or built-in claude
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
WalkthroughThis pull request centralises agent command configuration by exporting Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #229 +/- ##
==========================================
- Coverage 44.93% 44.93% -0.01%
==========================================
Files 84 84
Lines 24475 24479 +4
==========================================
+ Hits 10998 10999 +1
- Misses 13477 13480 +3
🚀 New features to boost your workflow:
|
Adds tests for the new centralized getDefaultAgentConfig usage: doctor.test.ts: - Test that agents from [[agents]] array with default=true and command are used - Test that agent-level command takes precedence over top-level command info.test.ts: - Test that agents from [[agents]] array with default=true are resolved - Test that custom command is included in SystemInfo - Test that command is displayed in formatSystemInfo output - Test that command is undefined when not configured
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
…MQXTJ Centralize agent configuration resolution logic
Summary
This PR refactors agent configuration resolution to use a centralized
getDefaultAgentConfig()function across all commands and components. This eliminates duplicate logic for determining which agent to use and ensures consistent handling of agent configuration, including command overrides and environment variable settings.Key Changes
Exported
getDefaultAgentConfig()function fromsrc/config/index.tsto make it available throughout the codebase. This function implements a clear precedence order for agent selection:options.agent)storedConfig.agentfielddefaultAgentsettingdefault: truein agents arrayUpdated
doctor.tscommand to usegetDefaultAgentConfig()instead of inline agent selection logic. Now properly passes the full agent configuration (including command, envExclude, envPassthrough) toregistry.getInstance().Updated
info.tscommand to usegetDefaultAgentConfig()for consistent agent resolution. Addedcommandfield to theSystemInfo.agentinterface and displays custom command paths in the formatted output.Updated
run.tsxandRunApp.tsxto accept and pass through theagentCommandproperty. The display name now shows the custom command in parentheses when configured (e.g., "claude (claude-glm)").Simplified environment variable resolution in both
doctor.tsandinfo.tsby relying on the pre-resolved settings inagentConfigrather than manually merging agent-level and top-level settings.Implementation Details
getDefaultAgentConfig()function returns anAgentPluginConfigobject that includes all necessary configuration: name, plugin, options, command, envExclude, and envPassthrough.Summary by CodeRabbit
New Features
Tests
✏️ Tip: You can customize this high-level summary in your review settings.