/** * Walk up from startDir looking for a Unity project root. * Checks for `.unity-agentic/` first, then `Assets/`. */ export declare function find_unity_project_root(startDir?: string): string | null; /** * Resolve an explicit project path or default to the current working directory. */ export declare function resolve_project_path(project_path?: string): string; /** * Ensure the parent directory of a file path exists, creating it recursively if needed. */ export declare function ensure_parent_dir(file_path: string): void; export interface AtomicWriteResult { success: boolean; file_path: string; bytes_written?: number; error?: string; } /** * Atomic write: write to temp file, then rename to prevent partial writes. * Uses randomized temp file names to prevent collisions from concurrent writes. * Handles ENOENT gracefully for TOCTOU races (e.g., Unity AssetDatabase deleting files). */ export declare function atomicWrite(filePath: string, content: string): AtomicWriteResult; /** * Normalize property path: convert dot-notation array indices to bracket notation. * e.g. "m_Materials.Array.data.0" -> "m_Materials.Array.data[0]" * This provides a shell-safe alternative to bracket syntax which triggers glob expansion in zsh. */ export declare function normalize_property_path(path: string): string; /** * Check if a pattern matches everything (wildcard-all). * Patterns like "*", ".", "**" mean "all objects" — not a real filter. */ export declare function is_match_all(pattern: string): boolean; /** * Match a string against a glob pattern (* and ? wildcards) or exact equality. * Case-insensitive. If the pattern has no glob chars, does exact equality. */ export declare function glob_match(pattern: string, text: string): boolean; /** * Convert a glob pattern to a RegExp for matching against file paths. * Handles ** (match across directories), * (match within one segment), ? (single char). * Without wildcards, performs case-insensitive substring match. * Unlike glob_match, this is designed for path filtering (no anchoring, path-aware). */ export declare function path_glob_to_regex(pattern: string): RegExp; /** * Validate a name (GameObject, tag, etc.) for characters that are illegal in Unity. * Returns an error string if invalid, or null if the name is acceptable. */ export declare function validate_name(name: string, label: string): string | null; /** * Generate a new GUID (32 hex characters). */ export declare function generateGuid(): string; /** * Validate that a file path is safe for Unity operations. * Rejects file:// URIs, path traversal, and Packages/ writes. * Note: Absolute paths ARE allowed (this is a CLI tool, not a web API). * * @param file_path - The file path to validate * @param operation - Whether this is a 'read' or 'write' operation * @returns Error message if invalid, null if valid */ export declare function validate_file_path(file_path: string, operation: 'read' | 'write'): string | null; /** * Validate Vector3 structure for Unity YAML. * * @param value - The value to validate as Vector3 * @returns Error message if invalid, null if valid */ export declare function validate_vector3(value: unknown): string | null; /** * Validate GUID format (32-character hex string). * * @param guid - The GUID to validate * @returns Error message if invalid, null if valid */ export declare function validate_guid(guid: string): string | null; //# sourceMappingURL=utils.d.ts.map