import { isInsidePath } from '../ide/shared/safe-path.js'; import type { IdeId } from '../ide/ide-types.js'; /** * Installs (and removes) the Peaks statusLine entry in an IDE's settings * file. The settings file location is adapter-driven * (`getAdapter(ide).settings.dirName` + `settingsFileName`) so a future slice * adding a Trae / Cursor / Codex adapter does not need to touch this file. * * Slice #1 only registers claude-code, so the resolved path is still * `/.claude/settings.json` — the same as before the refactor. The * statusLine entry is rendered as `{ type: 'command', command: 'peaks * statusline' }` because that is the shape Claude Code expects; future * adapters may need a different entry shape (e.g. Cursor's `statusBar` * field) and would override this in their adapter. * * Slice #3 refactor (this commit): the service is now per-IDE aware via an * optional `options.ide` parameter. The CLI command is responsible for * resolving the IDE (env → stdin shape → cwd → fallback to 'claude-code') * via `detectIdeFromContext` and passing the result here. When `ide` is * omitted, the service defaults to `'claude-code'` so existing tests and * downstream callers continue to work without modification. * * Writes preserve all other settings keys, reject symlinked targets, and use an * atomic rename so a partial write can never corrupt an existing settings file. */ export type StatusLineScope = 'project' | 'global'; export type StatusLineSettingsOptions = { /** * Which IDE's adapter to install for. Defaults to `'claude-code'` for * backward compatibility. The CLI command should resolve this from * `detectIdeFromContext({ env, cwd, parsedStdin })` and pass the result. * Throws if the IDE is not registered in the adapter registry. */ readonly ide?: IdeId; }; export type StatusLineSettingsPlan = { scope: StatusLineScope; settingsPath: string; exists: boolean; alreadyInstalled: boolean; conflict: boolean; conflictCommand: string | null; desiredCommand: string; }; export type StatusLineSettingsResult = StatusLineSettingsPlan & { applied: boolean; }; export declare const STATUSLINE_COMMAND = "peaks statusline"; export { isInsidePath }; export declare function planStatusLineInstall(scope: StatusLineScope, projectRoot?: string, options?: StatusLineSettingsOptions): StatusLineSettingsPlan; export declare function applyStatusLineInstall(scope: StatusLineScope, projectRoot?: string, options?: { force?: boolean; ide?: IdeId; }): StatusLineSettingsResult; export declare function removeStatusLineInstall(scope: StatusLineScope, projectRoot?: string, options?: StatusLineSettingsOptions): { scope: StatusLineScope; settingsPath: string; removed: boolean; };