import { saveRegistry } from './registry.js'; import type { PathCtx } from '../config/paths.js'; /** * Renaming an account. * * The name is used as a key in more than one place, so a rename that only edits * the registry leaves the account's limit history and usage numbers behind under * the old name, which reads as "my usage reset itself". Everything keyed by name * moves together here. * * The profile FOLDER is moved too when it is safe: a folder still named after the * old account is exactly the confusing mismatch that makes these profiles hard to * reason about. It is left alone (and said so) when a session is using it, when it * lives somewhere custom, or when the destination already exists, because none of * those can be moved without risking a running session or someone's data. */ export interface RenameResult { from: string; to: string; /** True when the profile folder moved along with the name. */ folderMoved: boolean; /** Why the folder stayed where it was, when it did. */ folderNote?: string; } export interface RenameDeps { /** Injected in tests, to exercise the failure that moves a folder then cannot record it. */ saveRegistry?: typeof saveRegistry; } export declare function renameAccount(from: string, to: string, config: { profilesDir?: string; }, c?: PathCtx, deps?: RenameDeps): RenameResult;