/** * Claude Code config helpers for logins Crewly performs. * * Claude Code shows two interactive screens that an agent PTY cannot get * past, and a login done through Crewly (token or API key in the env) does * not dismiss either of them: * - the first-run theme picker ("Choose the text style"), shown until * `hasCompletedOnboarding` is true in `~/.claude.json` — Crewly already * refuses to start agents while it is up (CLAUDE_STARTUP_BLOCKERS); * - "Detected a custom API key … use it?", shown for an `ANTHROPIC_API_KEY` * whose last 20 characters are not in `customApiKeyResponses.approved`. * * After a successful Crewly login these helpers record both answers, the way * Claude Code itself does when a person answers them. Other keys in the file * are preserved; an unreadable file is left untouched. * * @module services/harness/claude-config.utils */ /** Inputs, injectable for tests. */ export interface ClaudeConfigLocation { env?: NodeJS.ProcessEnv; homeDir?: string; } /** * Directory holding Claude's data (`$CLAUDE_CONFIG_DIR` or `~/.claude`). * * @param location - env / home overrides * @returns Absolute directory */ export declare function getClaudeDataDir(location?: ClaudeConfigLocation): string; /** * Claude's global config file (`$CLAUDE_CONFIG_DIR/.claude.json` or `~/.claude.json`). * * @param location - env / home overrides * @returns Absolute path */ export declare function getClaudeConfigFile(location?: ClaudeConfigLocation): string; /** * Claude's credentials file (Linux; macOS keeps credentials in the keychain). * * @param location - env / home overrides * @returns Absolute path */ export declare function getClaudeCredentialsFile(location?: ClaudeConfigLocation): string; /** Result of {@link prepareClaudeConfigForCrewlyLogin}. */ export interface PrepareClaudeConfigResult { /** The file was written */ changed: boolean; /** Why nothing was written, when the file could not be read */ skippedReason?: string; } /** * Mark Claude Code's first-run setup as done and, for an API key, pre-approve it. * * @param options - `apiKey` to approve (only its last 20 characters are written) * @param location - env / home overrides * @returns Whether the file changed; never throws * * @example * ```ts * prepareClaudeConfigForCrewlyLogin({ apiKey: 'sk-ant-api03-…' }); * ``` */ export declare function prepareClaudeConfigForCrewlyLogin(options?: { apiKey?: string; }, location?: ClaudeConfigLocation): PrepareClaudeConfigResult; //# sourceMappingURL=claude-config.utils.d.ts.map