From b0dff7a148c795994c2e3f871db9f60dd1cc737a Mon Sep 17 00:00:00 2001 From: "Kai (Tam Nhu) Tran" <61256810+kaitranntt@users.noreply.github.com> Date: Fri, 6 Feb 2026 23:33:12 -0500 Subject: [PATCH] fix(hooks): add image analysis env vars for settings-based profiles (#484) * chore(release): 7.38.0 [skip ci] ## [7.38.0](https://github.com/kaitranntt/ccs/compare/v7.37.1...v7.38.0) (2026-02-07) ### Features * **release:** v7.38.0 - Extended Context, Qwen Models, Bug Fixes ([#480](https://github.com/kaitranntt/ccs/issues/480)) ([b454834](https://github.com/kaitranntt/ccs/commit/b4548341750804339c87c48259dd8741425d2acf)), closes [#472](https://github.com/kaitranntt/ccs/issues/472) [#474](https://github.com/kaitranntt/ccs/issues/474) [#103](https://github.com/kaitranntt/ccs/issues/103) [#478](https://github.com/kaitranntt/ccs/issues/478) [#482](https://github.com/kaitranntt/ccs/issues/482) * fix(hooks): add image analysis env vars for settings-based profiles Image analysis hook was injected into settings files for API profiles but the CCS_IMAGE_ANALYSIS_* env vars were never set, causing the hook to skip. Add getImageAnalysisHookEnv() call to both settings-based and GLMT proxy execution paths, matching CLIProxy profile behavior. Closes #440 * fix(hooks): add hook env vars to copilot executor Copilot profile had same gap as settings-based profiles: hooks installed but webSearch/imageAnalysis env vars and CCS_PROFILE_TYPE never set. Add missing env var injection matching other profile flows. --------- Co-authored-by: semantic-release-bot --- src/ccs.ts | 5 +++++ src/copilot/copilot-executor.ts | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ccs.ts b/src/ccs.ts index 1d447e48..5150ff00 100644 --- a/src/ccs.ts +++ b/src/ccs.ts @@ -14,6 +14,7 @@ import { } from './utils/websearch-manager'; import { getGlobalEnvConfig } from './config/unified-config-loader'; import { ensureProfileHooks as ensureImageAnalyzerHooks } from './utils/hooks/image-analyzer-profile-hook-injector'; +import { getImageAnalysisHookEnv } from './utils/hooks'; import { fail, info } from './utils/ui'; // Import centralized error handling @@ -165,10 +166,12 @@ async function execClaudeWithProxy( const isWindows = process.platform === 'win32'; const needsShell = isWindows && /\.(cmd|bat|ps1)$/i.test(claudeCli); const webSearchEnv = getWebSearchHookEnv(); + const imageAnalysisEnv = getImageAnalysisHookEnv(profileName); const env = { ...process.env, ...envVars, ...webSearchEnv, + ...imageAnalysisEnv, CCS_PROFILE_TYPE: 'settings', // Signal to WebSearch hook this is a third-party provider }; @@ -619,6 +622,7 @@ async function main(): Promise { // Use --settings flag (backward compatible) const expandedSettingsPath = getSettingsPath(profileInfo.name); const webSearchEnv = getWebSearchHookEnv(); + const imageAnalysisEnv = getImageAnalysisHookEnv(profileInfo.name); // Get global env vars (DISABLE_TELEMETRY, etc.) for third-party profiles const globalEnvConfig = getGlobalEnvConfig(); const globalEnv = globalEnvConfig.enabled ? globalEnvConfig.env : {}; @@ -640,6 +644,7 @@ async function main(): Promise { ...globalEnv, ...settingsEnv, // Explicitly inject all settings env vars ...webSearchEnv, + ...imageAnalysisEnv, CCS_PROFILE_TYPE: 'settings', // Signal to WebSearch hook this is a third-party provider }; execClaude(claudeCli, ['--settings', expandedSettingsPath, ...remainingArgs], envVars); diff --git a/src/copilot/copilot-executor.ts b/src/copilot/copilot-executor.ts index d2364aba..98908496 100644 --- a/src/copilot/copilot-executor.ts +++ b/src/copilot/copilot-executor.ts @@ -13,6 +13,8 @@ import { isDaemonRunning, startDaemon } from './copilot-daemon'; import { ensureCopilotApi } from './copilot-package-manager'; import { CopilotStatus } from './types'; import { fail, info, ok } from '../utils/ui'; +import { getWebSearchHookEnv } from '../utils/websearch-manager'; +import { getImageAnalysisHookEnv } from '../utils/hooks'; /** * Get full copilot status (auth + daemon). @@ -133,11 +135,16 @@ export async function executeCopilotProfile( const globalEnvConfig = getGlobalEnvConfig(); const globalEnv = globalEnvConfig.enabled ? globalEnvConfig.env : {}; - // Merge with current environment (global env first, copilot overrides) + // Merge with current environment (global env first, copilot overrides, then hook env vars) + const webSearchEnv = getWebSearchHookEnv(); + const imageAnalysisEnv = getImageAnalysisHookEnv('copilot'); const env = { ...process.env, ...globalEnv, ...copilotEnv, + ...webSearchEnv, + ...imageAnalysisEnv, + CCS_PROFILE_TYPE: 'copilot', }; console.log(info(`Using GitHub Copilot proxy (model: ${config.model})`));