refactor: consolidate MCP factory, add non-TTY support, auto-detect transcript watchers
- Phase 1: Replace 5 duplicate MCP installers with config-driven factory, extract shared context-injection and json-utils utilities, fix process.execPath usage - Phase 2: Add non-TTY fallback for @clack/prompts to prevent ENOENT in CI/Docker - Phase 3: Wire GeminiCliHooksInstaller through hook command framework with adapter - Phase 4: Auto-start transcript watchers on worker boot when config exists Net -107 lines via DRY consolidation of duplicated installer logic. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -137,14 +137,11 @@ export function ensureDirectoryExists(directoryPath: string): void {
|
||||
}
|
||||
}
|
||||
|
||||
export function readJsonFileSafe(filepath: string): any {
|
||||
if (!existsSync(filepath)) return {};
|
||||
try {
|
||||
return JSON.parse(readFileSync(filepath, 'utf-8'));
|
||||
} catch {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @deprecated Use `readJsonSafe` from `../../utils/json-utils.js` instead.
|
||||
* Kept as re-export for backward compatibility.
|
||||
*/
|
||||
export { readJsonSafe } from '../../utils/json-utils.js';
|
||||
|
||||
export function writeJsonFileAtomic(filepath: string, data: any): void {
|
||||
ensureDirectoryExists(dirname(filepath));
|
||||
|
||||
Reference in New Issue
Block a user