feat: support custom Claude CLI path and config directory#224
Open
JingkaiTang wants to merge 1 commit intoop7418:mainfrom
Open
feat: support custom Claude CLI path and config directory#224JingkaiTang wants to merge 1 commit intoop7418:mainfrom
JingkaiTang wants to merge 1 commit intoop7418:mainfrom
Conversation
7 tasks
953aeea to
d432d23
Compare
|
@JingkaiTang is attempting to deploy a commit to the op7418's projects Team on Vercel. A member of the Team first needs to authorize it. |
a3764c8 to
7310a6d
Compare
Add centralized CLI configuration module (cli-config.ts) that replaces 15+ hardcoded ~/.claude references across the codebase. New features: - Custom CLI binary path (claude_cli_path app setting) - Custom config directory (claude_config_dir app setting) - expandTilde() for ~ path expansion - Path validation on save (file exists / directory exists) - Cache invalidation when settings change Backend changes: - cli-config.ts: getClaudeConfigDir(), getCustomCliPath(), etc. - claude-client.ts: findClaudePath() prioritizes custom CLI path - settings/app/route.ts: validates and saves new path settings - All route files (plugins, skills, settings, chat) now use cli-config helpers instead of hardcoded os.homedir()/.claude paths Frontend changes: - GeneralSection.tsx: CLI path and config dir input fields with debounced auto-save and validation feedback - i18n: 7 new translation keys (en + zh) Tests: - 33 new unit tests for cli-config module (all passing) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
7310a6d to
5aebcf1
Compare
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
cli-config.tsmodule to support custom Claude CLI binary path and config directory (e.g.claude-internal/~/.claude-internal)~/.claudereferences with configurable helpers~tilde expansion in all path settingsMotivation
For teams using internal forks of Claude Code (e.g.
claude-internalwith~/.claude-internalconfig dir), there was no way to configure CodePilot to use a different CLI binary or config directory. All paths were hardcoded toclaudeand~/.claude.Changes
New files
src/lib/cli-config.ts— Centralized config module withexpandTilde(),getClaudeConfigDir(),getClaudeBinaryName(),getCustomCliPath(), and convenience helpers for commands/skills/projects/settings/plugins/bin directoriessrc/__tests__/unit/cli-config.test.ts— 33 unit tests covering all functionsSettings UI
claude~/.claudeModified files (14 total)
src/lib/claude-client.ts—findClaudePath()prioritizes custom CLI path +clearClaudePathCache()exportsrc/lib/claude-session-parser.ts— projects dir viacliConfig.getClaudeProjectsDir()src/app/api/chat/route.ts— MCP config paths via cli-config helperssrc/app/api/settings/app/route.ts— new allowed keys + path validation + cache invalidationsrc/app/api/settings/route.ts— settings path viagetClaudeSettingsPath()src/app/api/plugins/route.ts,[id]/route.ts,mcp/route.ts,mcp/[name]/route.ts— config dir via cli-configsrc/app/api/skills/route.ts,[name]/route.ts— commands/plugins/skills dirs via cli-configsrc/components/settings/GeneralSection.tsx— new CLI path/config dir inputs with debounced savesrc/i18n/en.ts,src/i18n/zh.ts— 7 new translation keys eachReview feedback addressed (from #138)
feat/custom-cli-path) instead ofmain→mainimportstatements (norequire())expandTilde()in single location (cli-config.ts)Test plan
claude-internal~/.claude-internal🤖 Generated with Claude Code