From b2694a5515b456c353d4a78eade478c2ccec0366 Mon Sep 17 00:00:00 2001 From: Chrilleweb Date: Mon, 16 Feb 2026 20:06:47 +0100 Subject: [PATCH] chore: fixContext --- src/config/types.ts | 12 ++++++++++++ src/core/fixEnv.ts | 13 +------------ src/services/printScanResult.ts | 11 +++-------- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/src/config/types.ts b/src/config/types.ts index 5841678..e7eec3f 100644 --- a/src/config/types.ts +++ b/src/config/types.ts @@ -337,6 +337,18 @@ export interface ExitResult { exitWithError: boolean; } +/** + * Result of applying fixes to environment files. + */ +export interface FixResult { + /** List of removed duplicate keys */ + removedDuplicates: string[]; + /** List of added environment variables */ + addedEnv: string[]; + /** Whether the .gitignore file was updated */ + gitignoreUpdated: boolean; +} + /** * Warning about environment variable keys that are not uppercase. */ diff --git a/src/core/fixEnv.ts b/src/core/fixEnv.ts index 27ef8f0..01492a5 100644 --- a/src/core/fixEnv.ts +++ b/src/core/fixEnv.ts @@ -2,6 +2,7 @@ import fs from 'fs'; import path from 'path'; import { isEnvIgnoredByGit, isGitRepo, findGitRoot } from '../services/git.js'; import { DEFAULT_GITIGNORE_ENV_PATTERNS } from '../config/constants.js'; +import type { FixResult } from '../config/types.js'; /** * Options for applying fixes to environment files @@ -17,18 +18,6 @@ interface ApplyFixesOptions { ensureGitignore?: boolean; } -/** - * Result of applying fixes to environment files - */ -interface FixResult { - /** List of removed duplicate keys */ - removedDuplicates: string[]; - /** List of added environment variables */ - addedEnv: string[]; - /** Whether the .gitignore file was updated */ - gitignoreUpdated: boolean; -} - /** * Applies fixes to the .env file based on the detected issues. * diff --git a/src/services/printScanResult.ts b/src/services/printScanResult.ts index e0255cf..691c375 100644 --- a/src/services/printScanResult.ts +++ b/src/services/printScanResult.ts @@ -4,6 +4,7 @@ import type { ScanUsageOptions, ScanResult, ExitResult, + FixResult, } from '../config/types.js'; import { DEFAULT_ENV_FILE } from '../config/constants.js'; import { printHeader } from '../ui/scan/printHeader.js'; @@ -26,17 +27,11 @@ import { printExpireWarnings } from '../ui/scan/printExpireWarnings.js'; import { printInconsistentNamingWarning } from '../ui/scan/printInconsistentNamingWarning.js'; /** - * Context for auto-fix operations + * Context for auto-fix operations, extending FixResult with applied status */ -interface FixContext { +interface FixContext extends FixResult { /** Whether any fixes were applied */ fixApplied: boolean; - /** List of removed duplicate keys */ - removedDuplicates: string[]; - /** List of added environment variables */ - addedEnv: string[]; - /** Whether the .gitignore file was updated */ - gitignoreUpdated: boolean; } /**