merge main branch functionalities

This commit is contained in:
koalazf.99
2025-08-02 14:47:37 +08:00
parent b69b2ce376
commit 23f6ae8513
30 changed files with 1378 additions and 420 deletions

View File

@@ -45,7 +45,7 @@ describe('getFolderStructure', () => {
const structure = await getFolderStructure(testRootDir);
expect(structure.trim()).toBe(
`
Showing up to 200 items (files + folders).
Showing up to 20 items (files + folders).
${testRootDir}${path.sep}
├───fileA1.ts
@@ -60,7 +60,7 @@ ${testRootDir}${path.sep}
const structure = await getFolderStructure(testRootDir);
expect(structure.trim()).toBe(
`
Showing up to 200 items (files + folders).
Showing up to 20 items (files + folders).
${testRootDir}${path.sep}
`
@@ -81,7 +81,7 @@ ${testRootDir}${path.sep}
const structure = await getFolderStructure(testRootDir);
expect(structure.trim()).toBe(
`
Showing up to 200 items (files + folders). Folders or files indicated with ... contain more items not shown, were ignored, or the display limit (200 items) was reached.
Showing up to 20 items (files + folders). Folders or files indicated with ... contain more items not shown, were ignored, or the display limit (20 items) was reached.
${testRootDir}${path.sep}
├───.hiddenfile
@@ -108,7 +108,7 @@ ${testRootDir}${path.sep}
ignoredFolders: new Set(['subfolderA', 'node_modules']),
});
const expected = `
Showing up to 200 items (files + folders). Folders or files indicated with ... contain more items not shown, were ignored, or the display limit (200 items) was reached.
Showing up to 20 items (files + folders). Folders or files indicated with ... contain more items not shown, were ignored, or the display limit (20 items) was reached.
${testRootDir}${path.sep}
├───.hiddenfile
@@ -129,7 +129,7 @@ ${testRootDir}${path.sep}
fileIncludePattern: /\.ts$/,
});
const expected = `
Showing up to 200 items (files + folders).
Showing up to 20 items (files + folders).
${testRootDir}${path.sep}
├───fileA1.ts

View File

@@ -12,7 +12,7 @@ import { FileDiscoveryService } from '../services/fileDiscoveryService.js';
import { FileFilteringOptions } from '../config/config.js';
import { DEFAULT_FILE_FILTERING_OPTIONS } from '../config/config.js';
const MAX_ITEMS = 200;
const MAX_ITEMS = 20;
const TRUNCATION_INDICATOR = '...';
const DEFAULT_IGNORED_FOLDERS = new Set(['node_modules', '.git', 'dist']);
@@ -20,7 +20,7 @@ const DEFAULT_IGNORED_FOLDERS = new Set(['node_modules', '.git', 'dist']);
/** Options for customizing folder structure retrieval. */
interface FolderStructureOptions {
/** Maximum number of files and folders combined to display. Defaults to 200. */
/** Maximum number of files and folders combined to display. Defaults to 20. */
maxItems?: number;
/** Set of folder names to ignore completely. Case-sensitive. */
ignoredFolders?: Set<string>;