/** * User Profile Management for Babysitter SDK * * Provides functions to read, write, merge, and render user profiles. * User profiles are stored at `~/.a5c/user-profile.json` * with a companion human-readable markdown file alongside. * * All file operations are synchronous for CJS compatibility. * Writes use an atomic temp-file-then-rename strategy to prevent corruption. */ import { UserProfile } from "./types"; export { renderUserProfileMarkdown } from "./userProfileRender"; /** * Returns the default directory for storing the user profile. * * Uses `~/.a5c/` as the user-level configuration directory. * The directory may not yet exist on disk. * * @returns Absolute path to the user profile directory */ export declare function getUserProfileDir(): string; /** * Reads the user profile from disk. * * Returns `null` if the profile file does not exist or contains * malformed JSON. Does not throw on missing or corrupt files. * * @param profileDir - Directory containing the profile file. Defaults to {@link getUserProfileDir}. * @returns The parsed user profile, or `null` if unavailable */ export declare function readUserProfile(profileDir?: string): UserProfile | null; /** * Writes a user profile to disk atomically. * * Creates the profile directory recursively if it does not exist. * Uses a temporary file with rename to prevent partial writes. * Also writes a companion markdown summary file for human readability. * * @param profile - The complete user profile to persist * @param profileDir - Directory to write the profile to. Defaults to {@link getUserProfileDir}. */ export declare function writeUserProfile(profile: UserProfile, profileDir?: string): void; /** * Deep-merges partial updates into an existing user profile. * * Merge strategy: * - **Scalars** (strings, numbers, booleans): overwritten by the update value * - **Objects**: spread-merged (shallow merge per nested object) * - **Arrays with identifiable items** (having `id`, `name`, `domain`, or `platform` fields): * deduplicated by that key, with update items taking precedence * - **Arrays of primitives**: deduplicated by value * - `updatedAt` is set to the current ISO timestamp * - `version` is incremented by 1 * * @param existing - The current user profile * @param updates - Partial profile fields to merge in * @returns A new merged user profile (does not mutate inputs) */ export declare function mergeUserProfile(existing: UserProfile, updates: Partial): UserProfile; /** * Creates a new user profile with sensible defaults. * * @param name - Display name for the user * @returns A complete user profile with default values */ export declare function createDefaultUserProfile(name: string): UserProfile; //# sourceMappingURL=userProfile.d.ts.map