summaryrefslogtreecommitdiff
path: root/packages/cli/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'packages/cli/src/utils')
-rw-r--r--packages/cli/src/utils/BackgroundTerminalAnalyzer.ts10
-rw-r--r--packages/cli/src/utils/errors.ts28
-rw-r--r--packages/cli/src/utils/getFolderStructure.ts10
3 files changed, 26 insertions, 22 deletions
diff --git a/packages/cli/src/utils/BackgroundTerminalAnalyzer.ts b/packages/cli/src/utils/BackgroundTerminalAnalyzer.ts
index 10448859..ae02e571 100644
--- a/packages/cli/src/utils/BackgroundTerminalAnalyzer.ts
+++ b/packages/cli/src/utils/BackgroundTerminalAnalyzer.ts
@@ -14,7 +14,7 @@ export interface AiClient {
generateJson(
prompt: Content[], // Keep flexible or define a stricter prompt structure type
schema: SchemaUnion,
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
): Promise<any>; // Ideally, specify the expected JSON structure TAnalysisResult | TAnalysisFailure
}
@@ -127,10 +127,14 @@ export class BackgroundTerminalAnalyzer {
// Reread files one last time in case output was written just before exit
try {
currentStdout = await fs.readFile(tempStdoutFilePath, 'utf-8');
- } catch { /* ignore */ }
+ } catch {
+ /* ignore */
+ }
try {
currentStderr = await fs.readFile(tempStderrFilePath, 'utf-8');
- } catch { /* ignore */ }
+ } catch {
+ /* ignore */
+ }
lastAnalysisResult = await this.analyzeOutputWithLLM(
currentStdout,
diff --git a/packages/cli/src/utils/errors.ts b/packages/cli/src/utils/errors.ts
index 7708895a..a7fcc5a3 100644
--- a/packages/cli/src/utils/errors.ts
+++ b/packages/cli/src/utils/errors.ts
@@ -1,18 +1,18 @@
export function isNodeError(error: unknown): error is NodeJS.ErrnoException {
- return error instanceof Error && 'code' in error;
+ return error instanceof Error && 'code' in error;
}
export function getErrorMessage(error: unknown): string {
- if (error instanceof Error) {
- return error.message;
- } else {
- // Attempt to convert the non-Error value to a string for logging
- try {
- const errorMessage = String(error);
- return errorMessage;
- } catch {
- // If String() itself fails (highly unlikely)
- return 'Failed to get error details';
- }
- }
-} \ No newline at end of file
+ if (error instanceof Error) {
+ return error.message;
+ } else {
+ // Attempt to convert the non-Error value to a string for logging
+ try {
+ const errorMessage = String(error);
+ return errorMessage;
+ } catch {
+ // If String() itself fails (highly unlikely)
+ return 'Failed to get error details';
+ }
+ }
+}
diff --git a/packages/cli/src/utils/getFolderStructure.ts b/packages/cli/src/utils/getFolderStructure.ts
index 8192fc96..42d6bbc3 100644
--- a/packages/cli/src/utils/getFolderStructure.ts
+++ b/packages/cli/src/utils/getFolderStructure.ts
@@ -137,7 +137,10 @@ async function readFullStructure(
folderInfo.subFolders.length +
folderInfo.subFolders.reduce((sum, sf) => sum + sf.totalChildren, 0);
} catch (error: unknown) {
- if (isNodeError(error) && (error.code === 'EACCES' || error.code === 'ENOENT')) {
+ if (
+ isNodeError(error) &&
+ (error.code === 'EACCES' || error.code === 'ENOENT')
+ ) {
console.warn(
`Warning: Could not read directory ${folderPath}: ${error.message}`,
);
@@ -345,10 +348,7 @@ export async function getFolderStructure(
}
// 2. Reduce the structure (handles ignored folders specifically)
- const reducedRoot = reduceStructure(
- fullInfo,
- mergedOptions.maxItems,
- );
+ const reducedRoot = reduceStructure(fullInfo, mergedOptions.maxItems);
// 3. Count items in the *reduced* structure for the summary
const rootNodeItselfCount = 0; // Don't count the root node in the items summary