mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-18 20:17:45 +00:00
Issue #1161. Sweeps 127 files to import from src/config/config-loader-facade.ts instead of unified-config-loader or utils/config-manager directly. WRITE callers (32 files): replaced raw saveUnifiedConfig / mutateUnifiedConfig / updateUnifiedConfig calls with the facade's cache-coherent wrappers saveConfig / mutateConfig / updateConfig. This fixes a latent stale-cache window where direct writes through the underlying loader bypassed the facade's memoization. READ callers (95 files): mechanical import-path migration only — function names unchanged because the facade re-exports them. No behavior change. Also updated: - tests/unit/utils/browser/browser-setup.test.ts (DI interface rename) - src/management/checks/image-analysis-check.ts (dynamic import rename) - src/web-server/health-service.ts (dynamic require rename) - src/ccs.ts (path prefix fix from sweep script) After sweep: zero raw write callers remain outside src/config/. Direct imports of config-manager remain only for symbols not in the facade (getConfigPath, getCcsDirSource, etc). Behavior unchanged; full suite passes 1824/1824. Out of scope: switching loadOrCreateUnifiedConfig() callers to getCachedConfig() — needs per-callsite cache-safety analysis. Tracked as follow-up. Refs #1161
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
/**
|
|
* Image Analyzer Hook Configuration
|
|
*
|
|
* Manages hook configuration for image analysis in Claude settings.
|
|
*
|
|
* @module utils/hooks/image-analyzer-hook-config
|
|
*/
|
|
|
|
import * as path from 'path';
|
|
|
|
import { getCcsHooksDir } from '../config-manager';
|
|
import { getImageAnalysisConfig } from '../../config/config-loader-facade';
|
|
|
|
// Hook file name
|
|
const IMAGE_ANALYZER_HOOK = 'image-analyzer-transformer.cjs';
|
|
|
|
/**
|
|
* Get path to image analyzer hook
|
|
*/
|
|
export function getImageAnalyzerHookPath(): string {
|
|
return path.join(getCcsHooksDir(), IMAGE_ANALYZER_HOOK);
|
|
}
|
|
|
|
/**
|
|
* Get hook config for settings.json injection
|
|
* Timeout includes buffer for CLI overhead
|
|
*/
|
|
export function getImageAnalyzerHookConfig(): Record<string, unknown> {
|
|
const hookPath = getImageAnalyzerHookPath();
|
|
const imageConfig = getImageAnalysisConfig();
|
|
|
|
// Add 5 second buffer to analysis timeout for hook execution overhead
|
|
const hookTimeout = imageConfig.timeout * 1000 + 5000;
|
|
|
|
return {
|
|
PreToolUse: [
|
|
{
|
|
matcher: 'Read',
|
|
hooks: [
|
|
{
|
|
type: 'command',
|
|
command: `node "${hookPath}"`,
|
|
timeout: hookTimeout,
|
|
},
|
|
],
|
|
},
|
|
],
|
|
};
|
|
}
|