diff --git a/src/utils/config-manager.ts b/src/utils/config-manager.ts index adb8bf01..655f5b30 100644 --- a/src/utils/config-manager.ts +++ b/src/utils/config-manager.ts @@ -26,6 +26,14 @@ export function getCcsDir(): string { return path.join(getCcsHome(), '.ccs'); } +/** + * Get CCS hooks directory (respects CCS_HOME for test isolation) + * @returns Path to hooks directory + */ +export function getCcsHooksDir(): string { + return path.join(getCcsDir(), 'hooks'); +} + /** * Get config file path (legacy JSON path) * @deprecated Use getActiveConfigPath() for mode-aware config path diff --git a/src/utils/hooks/image-analyzer-hook-configuration.ts b/src/utils/hooks/image-analyzer-hook-configuration.ts index a11f4239..45de9481 100644 --- a/src/utils/hooks/image-analyzer-hook-configuration.ts +++ b/src/utils/hooks/image-analyzer-hook-configuration.ts @@ -8,18 +8,11 @@ import * as path from 'path'; import { getImageAnalysisConfig } from '../../config/unified-config-loader'; -import { getCcsDir } from '../config-manager'; +import { getCcsHooksDir } from '../config-manager'; // Hook file name const IMAGE_ANALYZER_HOOK = 'image-analyzer-transformer.cjs'; -/** - * Get CCS hooks directory (respects CCS_HOME for test isolation) - */ -export function getCcsHooksDir(): string { - return path.join(getCcsDir(), 'hooks'); -} - /** * Get path to image analyzer hook */ diff --git a/src/utils/hooks/image-analyzer-hook-installer.ts b/src/utils/hooks/image-analyzer-hook-installer.ts index a4e92ecc..26f32224 100644 --- a/src/utils/hooks/image-analyzer-hook-installer.ts +++ b/src/utils/hooks/image-analyzer-hook-installer.ts @@ -10,7 +10,8 @@ import * as fs from 'fs'; import * as path from 'path'; import { info, warn } from '../ui'; -import { getImageAnalyzerHookPath, getCcsHooksDir } from './image-analyzer-hook-configuration'; +import { getImageAnalyzerHookPath } from './image-analyzer-hook-configuration'; +import { getCcsHooksDir } from '../config-manager'; import { getImageAnalysisConfig } from '../../config/unified-config-loader'; import { removeMigrationMarker } from './image-analyzer-profile-hook-injector'; diff --git a/src/utils/image-analysis/hook-installer.ts b/src/utils/image-analysis/hook-installer.ts index 3832131b..75838707 100644 --- a/src/utils/image-analysis/hook-installer.ts +++ b/src/utils/image-analysis/hook-installer.ts @@ -9,20 +9,13 @@ import * as fs from 'fs'; import * as path from 'path'; import { info, warn } from '../ui'; -import { getCcsDir } from '../config-manager'; - -/** - * Get CCS hooks directory - */ -export function getCcsHooksDir(): string { - return path.join(getCcsDir(), 'hooks'); -} +import { getCcsHooksDir } from '../config-manager'; /** * Get prompts directory for image analysis */ export function getPromptsDir(): string { - return path.join(getCcsDir(), 'prompts', 'image-analysis'); + return path.join(getCcsHooksDir(), '..', 'prompts', 'image-analysis'); } /** diff --git a/src/utils/image-analysis/index.ts b/src/utils/image-analysis/index.ts index 3a322ac9..e239ae6d 100644 --- a/src/utils/image-analysis/index.ts +++ b/src/utils/image-analysis/index.ts @@ -4,4 +4,4 @@ * Exports hook installer functions for prompt management */ -export { getCcsHooksDir, getPromptsDir, installImageAnalysisPrompts } from './hook-installer'; +export { getPromptsDir, installImageAnalysisPrompts } from './hook-installer'; diff --git a/src/utils/websearch/hook-config.ts b/src/utils/websearch/hook-config.ts index ad88b0bb..cc2754ce 100644 --- a/src/utils/websearch/hook-config.ts +++ b/src/utils/websearch/hook-config.ts @@ -11,7 +11,7 @@ import * as path from 'path'; import * as os from 'os'; import { info, warn } from '../ui'; import { getWebSearchConfig } from '../../config/unified-config-loader'; -import { getCcsDir } from '../config-manager'; +import { getCcsHooksDir } from '../config-manager'; import { isCcsWebSearchHook, deduplicateCcsHooks } from './hook-utils'; // Hook file name @@ -32,13 +32,6 @@ function getClaudeSettingsPath(): string { return path.join(os.homedir(), '.claude', 'settings.json'); } -/** - * Get CCS hooks directory (respects CCS_HOME for test isolation) - */ -export function getCcsHooksDir(): string { - return path.join(getCcsDir(), 'hooks'); -} - // Buffer time added to max provider timeout for hook timeout (seconds) const HOOK_TIMEOUT_BUFFER = 30; diff --git a/src/utils/websearch/hook-installer.ts b/src/utils/websearch/hook-installer.ts index 16985043..49bccb8f 100644 --- a/src/utils/websearch/hook-installer.ts +++ b/src/utils/websearch/hook-installer.ts @@ -10,7 +10,8 @@ import * as fs from 'fs'; import * as path from 'path'; import { info, warn } from '../ui'; import { getWebSearchConfig } from '../../config/unified-config-loader'; -import { getHookPath, getCcsHooksDir } from './hook-config'; +import { getCcsHooksDir } from '../config-manager'; +import { getHookPath } from './hook-config'; import { removeMigrationMarker } from './profile-hook-injector'; // Re-export from hook-config for backward compatibility