import { BoilerplateConfig } from './types'; /** * Result of scanning for boilerplates. */ export interface ScannedBoilerplate { /** * The relative path from the scan root to the boilerplate directory. * For example: "default/module", "default/workspace" */ relativePath: string; /** * The absolute path to the boilerplate directory. */ absolutePath: string; /** * The boilerplate configuration from .boilerplate.json */ config: BoilerplateConfig; } /** * Options for scanning boilerplates. */ export interface ScanBoilerplatesOptions { /** * Maximum depth to recurse into directories. * Default: 10 (should be enough for any reasonable structure) */ maxDepth?: number; /** * Additional directory names to skip during scanning. */ skipDirectories?: string[]; } /** * Read the .boilerplate.json configuration from a directory. * * @param dirPath - The directory path to check * @returns The boilerplate config or null if not found */ export declare function readBoilerplateConfig(dirPath: string): BoilerplateConfig | null; /** * Recursively scan a directory for boilerplate templates. * * A boilerplate is any directory containing a `.boilerplate.json` file. * This function recursively searches the entire directory tree (with sensible * pruning of common non-template directories like node_modules, .git, etc.) * and returns all discovered boilerplates with their relative paths. * * This is useful when: * - The user specifies `--dir .` to bypass `.boilerplates.json` * - You want to discover all available boilerplates regardless of nesting * - You need to match a `fromPath` against available boilerplates * * @param baseDir - The root directory to start scanning from * @param options - Scanning options * @returns Array of discovered boilerplates with relative paths * * @example * ```typescript * // Given structure: * // repo/ * // default/ * // module/.boilerplate.json * // workspace/.boilerplate.json * // scripts/ (no .boilerplate.json) * * const boilerplates = scanBoilerplatesRecursive('/path/to/repo'); * // Returns: * // [ * // { relativePath: 'default/module', absolutePath: '...', config: {...} }, * // { relativePath: 'default/workspace', absolutePath: '...', config: {...} } * // ] * // Note: 'scripts' is not included because it has no .boilerplate.json * ``` */ export declare function scanBoilerplatesRecursive(baseDir: string, options?: ScanBoilerplatesOptions): ScannedBoilerplate[]; /** * Find a boilerplate by matching against a fromPath. * * This function attempts to match a user-provided `fromPath` against * discovered boilerplates. It supports: * 1. Exact match: `fromPath` matches a relative path exactly * 2. Basename match: `fromPath` matches the last segment of a relative path * (only if unambiguous - i.e., exactly one match) * * @param boilerplates - Array of scanned boilerplates * @param fromPath - The path to match against * @returns The matching boilerplate, or null if no match or ambiguous * * @example * ```typescript * const boilerplates = scanBoilerplatesRecursive('/path/to/repo'); * * // Exact match * findBoilerplateByPath(boilerplates, 'default/module'); * // Returns the 'default/module' boilerplate * * // Basename match (unambiguous) * findBoilerplateByPath(boilerplates, 'module'); * // Returns the 'default/module' boilerplate if it's the only one ending in 'module' * * // Ambiguous basename match * // If both 'default/module' and 'supabase/module' exist: * findBoilerplateByPath(boilerplates, 'module'); * // Returns null (ambiguous) * ``` */ export declare function findBoilerplateByPath(boilerplates: ScannedBoilerplate[], fromPath: string): ScannedBoilerplate | null; /** * Find a boilerplate by type within a scanned list. * * @param boilerplates - Array of scanned boilerplates * @param type - The type to find (e.g., 'workspace', 'module') * @returns The matching boilerplate or undefined */ export declare function findBoilerplateByType(boilerplates: ScannedBoilerplate[], type: string): ScannedBoilerplate | undefined; /** * Get all boilerplates of a specific type. * * @param boilerplates - Array of scanned boilerplates * @param type - The type to filter by * @returns Array of matching boilerplates */ export declare function filterBoilerplatesByType(boilerplates: ScannedBoilerplate[], type: string): ScannedBoilerplate[];