/** * Represents a node in a directory tree structure * @interface Tree * @property {string} id - Unique identifier for the node (full path) * @property {string} label - Display name of the file or directory * @property {Tree[]} [children] - Optional array of child nodes for directories */ export interface Tree { id: string; label: string; children?: Tree[]; } /** * Recursively builds a tree structure from a directory * @param {string} dirPath - The absolute path to the directory to process * @param {string} [basePath] - The base path for generating relative paths (defaults to dirPath) * @returns {Tree} A tree structure representing the directory hierarchy * @throws Will throw an error if directory access fails * * @example * // Create a tree from a directory * const tree = buildDirectoryTree('/path/to/directory'); * * // Structure of returned tree: * // { * // id: '/path/to/directory', * // label: 'directory', * // children: [ * // { id: '/path/to/directory/file.txt', label: 'file.txt' }, * // { id: '/path/to/directory/subdir', label: 'subdir', children: [...] } * // ] * // } */ export declare function buildDirectoryTree(dirPath: string, basePath?: string): Tree;