fix: AIラッパーの環境変数を隔離して実行ファイルを直接呼び出す - #115
Merged
Merged
Conversation
- Use subshell exports for claudex and claude-headroom to avoid leaking proxy settings - Escape AI executable names and bypass shell functions in command wrappers - Add regression checks for executable resolution, arguments, environment isolation, and exit status
- Keep the pull request limited to AI alias configuration changes
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.
概要・背景
Linuxでも
claudexが起動できるようにし、プロキシ用の環境変数を呼び出し元のシェルに残さないようにする。従来のenv ... command claudeは外部のcommand実行ファイルを必要とし、それがないLinux環境ではenv: ‘command’: No such file or directoryで失敗していた。関連Issue
なし
実装方針
claudexとclaude-headroomの関数本体をサブシェルにし、その中で環境変数をexportする。command \claudeでシェル組み込みのcommandを使い、alias展開と同名のシェル関数を回避してPATH上の実行ファイルを呼び出す。変更内容
影響範囲
AIコマンドのラッパーに適用。既存のモデル指定と起動オプションを維持。
検証結果
変更前の定義でLinuxの起動失敗を再現し、変更後に次のコマンドが成功。
macOSおよび実際のAPI接続の確認は未実施。ShellCheckは実行したが、zsh固有の構文をサポートしていないため診断が発生し、成功とは扱っていない。zsh自身の構文検査とリポジトリ指定のshfmt検査は成功。