Skip to content

Commit 7fa56c0

Browse files
committed
fix: Make Claude Code wrapper work in CI environment
Remove hardcoded local paths from claude_code_wrapper.py that prevented AI validation from working in CI. The wrapper now relies on claude being in PATH, which works in both local and CI environments. Also adds Claude CLI verification step to CI workflow matching the pattern used in spring-ai-agents.
1 parent 60b9213 commit 7fa56c0

File tree

2 files changed

+34
-13
lines changed

2 files changed

+34
-13
lines changed

.github/workflows/integration-tests.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ jobs:
218218
if: steps.check.outputs.should_run == 'true'
219219
run: |
220220
npm install -g @anthropic-ai/claude-code --silent
221-
echo "Claude Code CLI installed"
221+
echo "Claude Code CLI installed via npm"
222222
223223
- name: Install JBang
224224
if: steps.check.outputs.should_run == 'true'
@@ -230,6 +230,15 @@ jobs:
230230
if: steps.check.outputs.should_run == 'true'
231231
run: |
232232
export PATH="$HOME/.jbang/bin:$PATH"
233+
echo "=== Verifying CLI installations ==="
234+
if command -v claude >/dev/null 2>&1; then
235+
echo "✅ Claude CLI verified: $(claude --version 2>&1)"
236+
else
237+
echo "❌ Claude CLI not found in PATH"
238+
echo "PATH: $PATH"
239+
ls -la /usr/local/bin/ | grep claude || echo "No claude in /usr/local/bin/"
240+
exit 1
241+
fi
233242
jbang version
234243
java -version
235244
@@ -377,13 +386,28 @@ jobs:
377386
- name: Install Claude Code CLI
378387
run: |
379388
npm install -g @anthropic-ai/claude-code --silent
380-
echo "Claude Code CLI installed"
389+
echo "Claude Code CLI installed via npm"
381390
382391
- name: Install JBang
383392
run: |
384393
curl -Ls https://sh.jbang.dev | bash -s - app setup
385394
echo "$HOME/.jbang/bin" >> "$GITHUB_PATH"
386395
396+
- name: Verify CLI installations
397+
run: |
398+
export PATH="$HOME/.jbang/bin:$PATH"
399+
echo "=== Verifying CLI installations ==="
400+
if command -v claude >/dev/null 2>&1; then
401+
echo "✅ Claude CLI verified: $(claude --version 2>&1)"
402+
else
403+
echo "❌ Claude CLI not found in PATH"
404+
echo "PATH: $PATH"
405+
ls -la /usr/local/bin/ | grep claude || echo "No claude in /usr/local/bin/"
406+
exit 1
407+
fi
408+
jbang version
409+
java -version
410+
387411
- name: Verify services
388412
run: |
389413
echo "Checking pgvector..."

integration-testing/ai-validator/lib/claude_code_wrapper.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ def __init__(self, claude_binary_path: str = None, logs_dir: Path = None):
2525
result = subprocess.run(['which', 'claude'], capture_output=True, text=True, check=True)
2626
self.claude_binary_path = result.stdout.strip()
2727
except subprocess.CalledProcessError:
28-
# Fallback to hardcoded path
29-
self.claude_binary_path = '/home/mark/.nvm/versions/node/v22.15.0/bin/claude'
28+
# Fallback to just 'claude' and let the system find it
29+
self.claude_binary_path = 'claude'
3030
else:
3131
self.claude_binary_path = claude_binary_path
3232

@@ -43,10 +43,9 @@ def __init__(self, claude_binary_path: str = None, logs_dir: Path = None):
4343
def is_available(self) -> bool:
4444
"""Check if Claude Code is available"""
4545
try:
46-
# Use 'claude' command directly and set working directory to avoid yoga.wasm issues
47-
result = subprocess.run(['claude', '--version'],
48-
capture_output=True, check=True, timeout=10,
49-
cwd='/home/mark/.nvm/versions/node/v22.15.0/lib/node_modules/@anthropic-ai/claude-code')
46+
# Use 'claude' command directly from PATH
47+
result = subprocess.run(['claude', '--version'],
48+
capture_output=True, check=True, timeout=10)
5049
return True
5150
except (subprocess.CalledProcessError, FileNotFoundError, subprocess.TimeoutExpired) as e:
5251
# Debug: print the actual exception for troubleshooting
@@ -64,9 +63,8 @@ def is_available(self) -> bool:
6463
def get_version(self) -> Optional[str]:
6564
"""Get Claude Code version"""
6665
try:
67-
result = subprocess.run(['claude', '--version'],
68-
capture_output=True, text=True, check=True, timeout=10,
69-
cwd='/home/mark/.nvm/versions/node/v22.15.0/lib/node_modules/@anthropic-ai/claude-code')
66+
result = subprocess.run(['claude', '--version'],
67+
capture_output=True, text=True, check=True, timeout=10)
7068
return result.stdout.strip()
7169
except Exception:
7270
return None
@@ -162,8 +160,7 @@ def analyze_from_file(self, prompt_file_path: str, output_file_path: Optional[st
162160
cmd,
163161
stdout=subprocess.PIPE,
164162
stderr=subprocess.PIPE,
165-
text=True,
166-
cwd='/home/mark/.nvm/versions/node/v22.15.0/lib/node_modules/@anthropic-ai/claude-code'
163+
text=True
167164
)
168165

169166
# Wait for completion with timeout

0 commit comments

Comments
 (0)