/** * Glob Pattern Utilities * * Shared glob pattern matching for workspace operations. * Uses picomatch for battle-tested glob support including * brace expansion, character classes, negation, and `**`. */ /** * Check if a string contains glob metacharacters. * * @example * isGlobPattern('/docs') // false * isGlobPattern('/docs/**\/*.md') // true * isGlobPattern('*.ts') // true * isGlobPattern('/src/{a,b}') // true */ export declare function isGlobPattern(input: string): boolean; /** * Extract the static directory prefix before the first glob metacharacter. * Returns the deepest non-glob ancestor directory. * * @example * extractGlobBase('docs/**\/*.md') // 'docs' * extractGlobBase('**\/*.md') // '.' * extractGlobBase('src/*.ts') // 'src' * extractGlobBase('exact/path') // 'exact/path' */ export declare function extractGlobBase(pattern: string): string; /** A compiled matcher function: returns true if a path matches */ export type GlobMatcher = (path: string) => boolean; export interface GlobMatcherOptions { /** Match dotfiles (default: false) */ dot?: boolean; } /** * Compile glob pattern(s) into a reusable matcher function. * The matcher tests paths using workspace-style forward slashes. * * Automatically normalizes leading './' and '/' from both patterns * and test paths, since picomatch does not match these prefixes. * * @example * const match = createGlobMatcher('**\/*.ts'); * match('src/index.ts') // true * match('src/style.css') // false * * const multi = createGlobMatcher(['**\/*.ts', '**\/*.tsx']); * multi('App.tsx') // true */ export declare function createGlobMatcher(patterns: string | string[], options?: GlobMatcherOptions): GlobMatcher; /** * One-off convenience: test if a path matches a glob pattern. * * For repeated matching against the same pattern, prefer createGlobMatcher() * to compile once and reuse. * * @example * matchGlob('src/index.ts', '**\/*.ts') // true */ export declare function matchGlob(path: string, pattern: string | string[], options?: GlobMatcherOptions): boolean; /** A filesystem entry returned by resolvePathPattern */ export interface PathEntry { path: string; type: 'file' | 'directory'; } /** Minimal readdir entry — compatible with both FileEntry and SkillSourceEntry */ export interface ReaddirEntry { name: string; type: 'file' | 'directory'; isSymlink?: boolean; } export interface ResolvePathOptions { /** Match dotfiles (default: false) */ dot?: boolean; /** Maximum directory depth to walk (default: 10) */ maxDepth?: number; } /** * Resolve a path pattern to matching filesystem entries. * * Handles both plain paths and glob patterns consistently: * - Plain paths: determines file vs directory via readdir probe, returns single entry * - Glob patterns: walks from the glob base, matches both files and directories * * @example * // Plain paths * resolvePathPattern('/docs', readdir) // [{ path: '/docs', type: 'directory' }] * resolvePathPattern('/docs/readme.md', readdir) // [{ path: '/docs/readme.md', type: 'file' }] * * // Glob patterns — matches files and directories * resolvePathPattern('/docs/**\/*.md', readdir) // all .md files under /docs * resolvePathPattern('**\/skills', readdir) // all directories (and files) named 'skills' * resolvePathPattern('/skills/**', readdir) // everything under /skills */ export declare function resolvePathPattern(pattern: string, readdir: (dir: string) => Promise, options?: ResolvePathOptions): Promise; //# sourceMappingURL=glob.d.ts.map