export { refreshLegacySnapshotIfStale } from './refresh-legacy-snapshot.js'; export declare function isValidProfileName(name: string): boolean; /** Root directory under which all profile dirs live. */ export declare function profilesDir(): string; /** * Resolve `//`, refusing names that fail validation * or that would resolve outside the profiles dir (path traversal). */ export declare function profilePath(name: string): string; export declare function profileExists(name: string): boolean; export declare function listProfiles(): string[]; /** * Create the profile directory. Throws if it already exists, so the * caller can decide whether to overwrite (typically: don't). */ export declare function createProfile(name: string): string; export interface ProfileInfo { name: string; path: string; /** Stable random ID Claude Code generates per CONFIG_DIR. Becomes the * Keychain entry's `account` field on macOS. Null until first run. */ userID: string | null; /** Email of the account currently signed in to this profile, or null * if no `auth login` has been completed yet. */ emailAddress: string | null; /** True if oauthAccount is populated — best-effort signal that the * profile is usable without re-login. */ hasLogin: boolean; } /** * Read profile metadata without spawning claude. Used by `list` and * `status` to summarise profiles in the menu. */ export declare function readProfile(name: string): ProfileInfo; /** * Remove the profile directory. Returns the userID of the now-removed * profile so the caller can also clean up the macOS Keychain entry that * was keyed by it (we don't do this automatically because the Keychain * write was done by Claude Code itself, not by us, and we don't want to * delete entries we didn't create without explicit user confirmation). */ export declare function removeProfile(name: string): { dir: string; userID: string | null; }; interface ImportResult { profileName: string; profilePath: string; userID: string; emailAddress: string; /** True when we wrote credentials to the macOS Keychain. * False when we wrote to the profile's .claude.json (Linux/Windows) * or when no _keychain blob was present in the legacy account. */ wroteToKeychain: boolean; /** True when no `_keychain` blob existed in the legacy account file * — the profile is created with the email but the user will still * need to `profile login` to authenticate. */ needsLogin: boolean; } /** * Convert a legacy `claude switch` account into a fresh isolated profile. * * Default profile name is the local-part of the email (`work@x.com` → * `work`); pass an explicit `profileName` to override. */ export declare function importProfileFromAccount(email: string, accountsDirPath: string, profileName?: string): ImportResult; interface EnsureProfileResult { profileName: string; profilePath: string; emailAddress: string; /** True when the profile exists but has no credentials — user must authenticate. */ needsLogin: boolean; /** True when we created a new profile (as opposed to reusing an existing one). */ created: boolean; } /** * Find or create an isolated profile for the given account email. * * If a profile already linked to `email` exists, it is returned as-is. * Otherwise the legacy saved account is imported into a fresh profile — * no browser re-login required when a Keychain snapshot is present. * * Internally calls `refreshLegacySnapshotIfStale` before any sync * credential-writing so the snapshot landing in the Keychain / per-profile * JSON is always fresh by construction. Refresh failure is silent — we * fall through to the existing "needsLogin" handling. */ export declare function ensureProfileForAccount(email: string, accountsDirPath: string): Promise;