import type { PathCtx } from '../config/paths.js'; /** * Wiring ccx into Claude's own status line, automatically. * * Without this, a fresh machine gives no sign that ccx is running: the shim is * transparent by design, so `claude` looks exactly like `claude`. That is the * right default for the command, and the wrong default for knowing whether * your account switching is on. Claude's status line is the one piece of the * screen ccx can write to during a session without stepping on the interface. * * This is the ONLY thing ccx writes into ~/.claude, and it writes exactly one * key. The planning is pure and separate from the file work because the file * belongs to the user: hooks, permissions and MCP servers live in it, and * losing them to a careless write would be far worse than having no status * line at all. */ export declare const CCX_COMMAND = "ccx statusline"; /** A statusLine value in Claude's settings, in the shape Claude expects. */ export interface StatusLineValue { type: string; command: string; [key: string]: unknown; } export type InstallPlan = /** Nothing there before; ours goes in clean. */ { kind: 'installed'; settings: Record; } /** Someone else's line was there; it now runs inside ours. */ | { kind: 'wrapped'; settings: Record; displaced: unknown; } /** Already ours. No write needed. */ | { kind: 'already'; }; /** True when this value is a status line ccx installed (wrapped or not). */ export declare function isOurs(value: unknown): boolean; /** Shell-quote a command so wrapping someone's line survives spaces and quotes. */ export declare function quoteForWrap(command: string): string; /** * What installing would change, given the settings as they are now. * * Every other key is carried through untouched. An existing status line is * never discarded: it becomes the argument to `--wrap`, so it keeps printing * and ccx appends to it. */ export declare function planInstall(settings: Record): InstallPlan; export type RemovalPlan = /** Ours is gone and the key is empty again. */ { kind: 'removed'; settings: Record; } /** Ours is gone and the line that was there before is back. */ | { kind: 'restored'; settings: Record; } /** Not ours, or not there. Left exactly as found. */ | { kind: 'untouched'; }; /** * What removing would change. `backup` is the value ccx displaced when it * installed, kept in ccx's own directory rather than parsed back out of the * `--wrap` argument, so restoring returns the ORIGINAL object with all of its * fields, not a string this code reassembled. * * A status line the user set themselves is never removed. */ export declare function planRemoval(settings: Record, backup?: unknown): RemovalPlan; export declare function settingsPath(c?: PathCtx): string; export type ReadResult = { ok: true; settings: Record; } | { ok: false; reason: 'unreadable'; }; /** * Read the user's settings. A file that exists but does not parse reports * failure rather than defaulting to empty: treating a broken file as `{}` * would overwrite it and take the user's hooks and permissions with it. */ export declare function readSettings(file: string): ReadResult; export type InstallOutcome = 'installed' | 'wrapped' | 'already' | 'unreadable' | 'failed'; /** Put ccx into the user's Claude status line. Safe to run repeatedly. */ export declare function installStatusline(c?: PathCtx): { outcome: InstallOutcome; file: string; }; export type RemoveOutcome = 'removed' | 'restored' | 'untouched' | 'unreadable' | 'failed'; /** Take ccx back out, putting back whatever was there before it. */ export declare function removeStatusline(c?: PathCtx): { outcome: RemoveOutcome; file: string; };