feat: add top-level 'command' config for custom agent executables#119
Conversation
|
@carmandale is attempting to deploy a commit to the plgeek Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughAdds a new top-level public Changes
Sequence Diagram(s)sequenceDiagram
participant ProjectConfig as Project TOML
participant GlobalConfig as Global TOML
participant Merger as mergeConfigs
participant AgentFactory as getDefaultAgentConfig
participant Agent as AgentPluginConfig
ProjectConfig->>Merger: provide project StoredConfig (may include command)
GlobalConfig->>Merger: provide global StoredConfig (may include command)
Merger->>Merger: merge configs (project.command overrides global.command)
Merger->>AgentFactory: supply merged StoredConfig
AgentFactory->>Agent: if Agent.command undefined and merged.command set → set Agent.command = merged.command
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
|
This is the simple approach we need - will look at this properly later and get it in before the 0.2.0 release, thanks @carmandale |
Improves PR #119 with the following changes: - Rename 'command' field to 'executable' for clarity - Avoids confusion with existing 'agentCommand' (which selects the agent plugin) - The new 'executable' field specifies the binary/path to run - Add shell metacharacter validation (security) - Rejects executables containing: ; & | \` $ ( ) - Prevents command injection via config files - Users must use wrapper scripts for complex commands - Add comprehensive JSDoc documentation - Documents precedence: agent-specific > top-level > plugin default - Includes usage examples - Add unit tests - Schema validation tests for valid/invalid executable paths - Config merging tests for executable field precedence
61cb1b0 to
580593f
Compare
|
Thanks for this feature! I've pushed some refinements to your branch: Security: Added validation that rejects shell metacharacters (;, &, |, `, $, (, )) in the executable path. This prevents potential command injection via config files. Users needing complex commands should use a wrapper script. Docs & Tests: Added to docs on website, and added JSDoc documenting the precedence order (agent-specific > top-level > plugin default). Also added comprehensive unit tests for both validation and config merging. Let me know if you have any questions! PS - for future PRs it would be great if you could include tests and (if applicable) docs updates |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #119 +/- ##
==========================================
+ Coverage 45.61% 46.72% +1.10%
==========================================
Files 58 58
Lines 13000 12947 -53
==========================================
+ Hits 5930 6049 +119
+ Misses 7070 6898 -172
🚀 New features to boost your workflow:
|
…bsy#102) Users can now specify a custom command/executable for their agent: ```toml agent = "claude" command = "ccr code" ``` This enables use of wrapper tools like Claude Code Router (CCR) that proxy requests to alternative AI providers while using the Claude agent plugin. The 'command' field: - Added to StoredConfig schema and types - Merged from project config (project overrides global) - Applied to agent config via applyAgentOptions() - Only applied if not already set on the agent config Closes subsy#102
Improves PR subsy#119 with the following changes: - Rename 'command' field to 'executable' for clarity - Avoids confusion with existing 'agentCommand' (which selects the agent plugin) - The new 'executable' field specifies the binary/path to run - Add shell metacharacter validation (security) - Rejects executables containing: ; & | \` $ ( ) - Prevents command injection via config files - Users must use wrapper scripts for complex commands - Add comprehensive JSDoc documentation - Documents precedence: agent-specific > top-level > plugin default - Includes usage examples - Add unit tests - Schema validation tests for valid/invalid executable paths - Config merging tests for executable field precedence
- Add executable to Core Settings table in options.mdx - Add detailed Custom Executable section with CCR example - Document precedence order and security constraints - Add Alternative AI Provider example in config-file.mdx - Update complete example to show executable option
- Add executable tip to Claude plugin options section - Add executable tip to OpenCode plugin options section - Add executable config as solution in "Agent not found" troubleshooting
Reverts the rename from 'command' to 'executable' to maintain consistency with the existing agent-level 'command' field in [[agents]] array. Changes: - Rename 'executable' back to 'command' in schema, types, and config - Update all docs to use 'command' instead of 'executable' - Add buildConfig tests for command shorthand (improves coverage 38%->67%) - Test command precedence: agent-level > top-level > plugin default The top-level 'command' now matches the agent-level 'command', making the config more intuitive: they do the same thing at different levels.
279f575 to
10a653d
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Thank you @subsy & @carmandale for getting my feature request in! |
Improves PR subsy#119 with the following changes: - Rename 'command' field to 'executable' for clarity - Avoids confusion with existing 'agentCommand' (which selects the agent plugin) - The new 'executable' field specifies the binary/path to run - Add shell metacharacter validation (security) - Rejects executables containing: ; & | \` $ ( ) - Prevents command injection via config files - Users must use wrapper scripts for complex commands - Add comprehensive JSDoc documentation - Documents precedence: agent-specific > top-level > plugin default - Includes usage examples - Add unit tests - Schema validation tests for valid/invalid executable paths - Config merging tests for executable field precedence
…ent-command feat: add top-level 'command' config for custom agent executables
Summary
Adds a top-level
commandconfig option that allows users to specify a custom executable for their agent, enabling use of wrapper tools like Claude Code Router (CCR).Usage
This uses the Claude agent plugin but routes requests through CCR, which can proxy to alternative AI providers like OpenRouter, DeepSeek, Ollama, or Gemini.
Changes
commandfield toStoredConfigSchema(zod validation)commandfield toStoredConfigtypecommandfrom project configapplyAgentOptions()to apply command override to agent configTesting
bun run typecheckpassesbun run lintpassesbun run buildpassesNotes
The existing per-agent
commandfield in the[[agents]]array already worked:This PR adds the shorthand version for simpler configs.
Closes #102
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.