import { mkdirSync } from 'node:fs'; /** * Re-export every pure path helper so the package barrel keeps exposing the * exact same surface it always has. The pure definitions themselves live in * `./path-core.ts`, which imports nothing but `node:path` — see that file's * header for why the split exists. * * This preserves the BARREL only. `@vibe-agent-toolkit/utils/fs` no longer * re-exports the pure helpers — they moved to `@vibe-agent-toolkit/utils/path`, * which is a breaking change for `./fs` consumers (see CHANGELOG and * `test/path-fs-subpaths.test.ts`). */ export * from './path-core.js'; /** * Normalize any path (resolve short names on Windows) * * Resolves Windows 8.3 short names (e.g., RUNNER~1) and symlinks. * Accepts multiple path segments like path.resolve() for convenience. * * **Why this matters:** * - Windows may create paths with short names (8.3 format) * - Node.js operations may use long names while paths contain short names * - This causes path comparison failures and existsSync() issues * - realpathSync.native() resolves these to their actual filesystem paths * * @param paths - Path segments to join and normalize * @returns Real (normalized) path with **OS-native separators** (backslashes on Windows). * Use `toForwardSlash()` if you need forward slashes for string comparison or display. * * @example * ```typescript * // Single path * const shortPath = 'C:\\PROGRA~1\\nodejs'; * const longPath = normalizePath(shortPath); * // Result: 'C:\\Program Files\\nodejs' * * // Multiple segments (like path.resolve) * const cliPath = normalizePath(__dirname, '../../dist/bin.js'); * // Resolves to absolute path AND normalizes short names * * // Backward compatible with old signature * normalizePath('./docs/../README.md', '/project') * // Returns: '/project/README.md' (normalized) * ``` */ export declare function normalizePath(...paths: string[]): string; /** * Get normalized temp directory path * * On Windows, tmpdir() may return 8.3 short names like: * - C:\Users\RUNNER~1\AppData\Local\Temp * * This function returns the real (long) path: * - C:\Users\runneradmin\AppData\Local\Temp * * **Why this matters:** * - Node.js operations create directories with LONG names * - Tests using SHORT paths from tmpdir() will fail existsSync() checks * - This is a "works on Mac, fails on Windows CI" bug pattern * * @returns Normalized temp directory path with **OS-native separators** (resolves short names on Windows) * * @example * ```typescript * // ❌ WRONG - May return short path on Windows * const testDir = join(tmpdir(), 'test-dir'); * * // ✅ RIGHT - Always returns real path * const testDir = join(normalizedTmpdir(), 'test-dir'); * ``` */ export declare function normalizedTmpdir(): string; /** * Create directory and return normalized path * * Combines mkdirSync + realpathSync to ensure the returned path * matches the actual filesystem path (resolves Windows short names). * * **Why this matters:** * - After mkdirSync(), the path might not match what filesystem uses * - On Windows, short path input creates long path output * - Subsequent existsSync() checks with original path may fail * * @param path - Directory path to create * @param options - Options for mkdirSync (e.g., recursive: true) * @returns Real (normalized) path to the created directory with **OS-native separators** * * @example * ```typescript * // ❌ WRONG - Path mismatch on Windows * const testDir = join(tmpdir(), 'test-dir'); * mkdirSync(testDir, { recursive: true }); * // testDir might be: C:\Users\RUNNER~1\...\test-dir * // But filesystem created: C:\Users\runneradmin\...\test-dir * * // ✅ RIGHT - Normalized path guaranteed * const testDir = mkdirSyncReal( * join(tmpdir(), 'test-dir'), * { recursive: true } * ); * // testDir is now: C:\Users\runneradmin\...\test-dir (real path) * ``` */ export declare function mkdirSyncReal(dirPath: string, options?: Parameters[1]): string; /** * Resolve an OS-native absolute path from an ESM module's `import.meta.url` and * optional relative path segments. * * Safer than `new URL(rel, importMetaUrl).pathname`, which returns `/D:/...` on * Windows and breaks `fs` operations. * * @returns An **OS-native absolute path** (backslashes on Windows). Wrap with * `toForwardSlash()` if you need forward slashes for display or comparison. * * @example * ```typescript * import { resolveFromImportMeta } from '@vibe-agent-toolkit/utils'; * * const fixturePath = resolveFromImportMeta(import.meta.url, '../fixtures/data.yaml'); * readFileSync(fixturePath, 'utf8'); * ``` */ export declare function resolveFromImportMeta(importMetaUrl: string, ...segments: string[]): string; /** * Dynamically import a module from an OS-native absolute filesystem path. * * Wraps `pathToFileURL()` because `await import(absPath)` fails on Windows — * ESM dynamic import requires a `file://` URL. * * @example * ```typescript * import { dynamicImportPath } from '@vibe-agent-toolkit/utils'; * * const mod = await dynamicImportPath<{ default: Config }>(absConfigPath); * ``` */ export declare function dynamicImportPath(absPath: string): Promise; //# sourceMappingURL=path-utils.d.ts.map