Introduce a config module to manage configuration (#22)

* Introduce a config module to manage configuration

* Remove public modifier
This commit is contained in:
Jaana Dogan
2025-04-18 11:12:18 -07:00
committed by GitHub
parent e1fac40256
commit 3afaa8033b
10 changed files with 131 additions and 174 deletions

View File

@@ -3,6 +3,7 @@ import { SchemaUnion, Type } from '@google/genai'; // Assuming these types exist
import { GeminiClient } from '../core/gemini-client.js'; // Assuming this path
import { exec } from 'child_process'; // Needed for Windows process check
import { promisify } from 'util'; // To promisify exec
import { globalConfig } from '../config/config.js';
// Promisify child_process.exec for easier async/await usage
const execAsync = promisify(exec);
@@ -60,7 +61,7 @@ export class BackgroundTerminalAnalyzer {
initialDelayMs?: number;
} = {}, // Provide default options
) {
this.ai = aiClient || new GeminiClient(); // Call constructor without model
this.ai = aiClient || new GeminiClient(globalConfig); // Call constructor without model
this.pollIntervalMs = options.pollIntervalMs ?? 5000; // Default 5 seconds
this.maxAttempts = options.maxAttempts ?? 6; // Default 6 attempts (approx 30s total)
this.initialDelayMs = options.initialDelayMs ?? 500; // Default 0.5s initial delay

View File

@@ -1,13 +1,5 @@
import process from 'node:process';
import path from 'node:path'; // Import the 'path' module
/**
* Returns the target directory, using the provided argument or the current working directory.
*/
export function getTargetDirectory(targetDirArg: string | undefined): string {
return targetDirArg || process.cwd();
}
/**
* Shortens a path string if it exceeds maxLen, prioritizing the start and end segments.
* Example: /path/to/a/very/long/file.txt -> /path/.../long/file.txt