mirror of
https://github.com/yamadashy/repomix.git
synced 2026-05-30 11:18:53 +02:00
refactor(cli): Clean up binary files detection output format
Remove redundant explanatory message from binary file listing to simplify output. The main header already explains the detection method, making individual file annotations unnecessary. Changes: - Remove "Detected as binary despite text extension" message from each file - Improve type safety by using FileSkipReason type instead of string - Update corresponding test expectations - Clean up unused import in fileCollectWorker The simplified output is cleaner while maintaining clarity about why files were excluded.
This commit is contained in:
@@ -169,7 +169,7 @@ export const reportSkippedFiles = (rootDir: string, skippedFiles: SkippedFileInf
|
||||
}
|
||||
|
||||
logger.log(pc.white('📄 Binary Files Detected:'));
|
||||
logger.log(pc.dim('──────────────────────────'));
|
||||
logger.log(pc.dim('─────────────────────────'));
|
||||
|
||||
if (binaryContentFiles.length === 1) {
|
||||
logger.log(pc.yellow('1 file detected as binary by content inspection:'));
|
||||
@@ -180,7 +180,6 @@ export const reportSkippedFiles = (rootDir: string, skippedFiles: SkippedFileInf
|
||||
binaryContentFiles.forEach((file, index) => {
|
||||
const relativeFilePath = path.relative(rootDir, file.path);
|
||||
logger.log(`${pc.white(`${index + 1}.`)} ${pc.white(relativeFilePath)}`);
|
||||
logger.log(pc.dim(' - Detected as binary despite text extension'));
|
||||
});
|
||||
|
||||
logger.log(pc.yellow('\nThese files have been excluded from the output.'));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import path from 'node:path';
|
||||
import { logger, setLogLevelByWorkerData } from '../../../shared/logger.js';
|
||||
import { readRawFile } from '../fileRead.js';
|
||||
import { setLogLevelByWorkerData } from '../../../shared/logger.js';
|
||||
import { FileSkipReason, readRawFile } from '../fileRead.js';
|
||||
import type { RawFile } from '../fileTypes.js';
|
||||
|
||||
// Initialize logger configuration from workerData at module load time
|
||||
@@ -15,7 +15,7 @@ export interface FileCollectTask {
|
||||
|
||||
export interface SkippedFileInfo {
|
||||
path: string;
|
||||
reason: string;
|
||||
reason: FileSkipReason;
|
||||
}
|
||||
|
||||
export interface FileCollectResult {
|
||||
|
||||
@@ -30,7 +30,6 @@ describe('reportSkippedFiles', () => {
|
||||
expect(logger.log).toHaveBeenCalledWith(expect.stringContaining('📄 Binary Files Detected:'));
|
||||
expect(logger.log).toHaveBeenCalledWith(expect.stringContaining('1 file detected as binary'));
|
||||
expect(logger.log).toHaveBeenCalledWith(expect.stringContaining('dir/malformed.txt'));
|
||||
expect(logger.log).toHaveBeenCalledWith(expect.stringContaining('Detected as binary despite text extension'));
|
||||
});
|
||||
|
||||
test('should report multiple binary-content files', () => {
|
||||
|
||||
Reference in New Issue
Block a user