export declare const HOST_CONFIG_MANIFEST_REL = "installed-host-config.json"; export type CodexPlanAction = "host-absent" | "already-present" | "append-table" | "insert-key" | "extend-array" | "replace-value" | "manual"; export interface CodexConfigPlan { readonly action: CodexPlanAction; readonly detail: string; readonly nextText?: string; readonly wroteText?: string; readonly previousText?: string; } export interface HostConfigRecord { readonly host: string; readonly path: string; readonly key: string; readonly value: string; readonly action: CodexPlanAction; readonly wroteText: string; readonly previousText: string; } /** * 호스트 전역 설정을 건드려도 되는 설치인지. 허용되는 경우는 하나뿐이다 — * 지금 HOME 기준의 기본 okstra 홈을 설치할 때. * * `~/.codex/config.toml` 은 OKSTRA_HOME 밖에 있는 사용자 전역 파일이라, 홈만 * 격리한 샌드박스(테스트·CI)에서 install 이 돌면 그 샌드박스 경로가 사용자의 진짜 * codex 설정에 남는다. 실제로 e2e 시나리오 하나가 `okstra preflight` → * `ensure-installed` 를 거쳐 임시 경로 다섯 개를 사용자 설정에 써 넣었다. * 그래서 판정 기준을 "무엇을 막을까"가 아니라 "무엇만 허용할까"로 둔다. */ export declare function managesHostConfig(okstraHome: string, env?: NodeJS.ProcessEnv): boolean; export declare function codexHome(env?: NodeJS.ProcessEnv): string; export declare function codexConfigPath(env?: NodeJS.ProcessEnv): string; /** * codex config.toml 텍스트에 okstra 홈을 쓰기 가능 루트로 넣는 계획을 만든다. * 디스크를 건드리지 않는 순수 함수라서 테스트가 파일 없이 형태별로 돈다. */ export declare function planCodexWritableRoot(text: string | null, root: string): CodexConfigPlan; export type RevertOutcome = "reverted" | "absent" | "modified"; export declare function planCodexQuestionPicker(text: string | null): CodexConfigPlan; export interface CodexRevertPlan { readonly outcome: RevertOutcome; readonly detail: string; readonly nextText?: string; } /** * install 이 남긴 기록을 현재 파일에 되돌린다. okstra 가 쓴 텍스트가 정확히 한 번 * 나올 때만 되돌리고, 없거나 여러 번이면 사용자가 손댄 것으로 보고 그대로 둔다. */ export declare function planCodexHostConfigRevert(text: string | null, record: HostConfigRecord): CodexRevertPlan; export declare function readTextOrNull(path: string): Promise; export interface HostConfigOptions { readonly dryRun?: boolean | undefined; readonly quiet?: boolean | undefined; readonly env?: NodeJS.ProcessEnv | undefined; } /** * codex 가 설치되어 있으면 okstra 홈을 쓰기 가능 루트로 만들고, 되돌리기에 필요한 * 기록을 반환한다. codex 가 없으면 아무것도 만들지 않는다 — 쓰지도 않는 CLI 의 * 설정 파일을 okstra 가 새로 만들지는 않는다. */ export declare function ensureCodexWritableRoot(okstraHome: string, opts?: HostConfigOptions): Promise; export declare function ensureCodexQuestionPicker(okstraHome: string, opts?: HostConfigOptions): Promise; export interface HostConfigManifest { readonly version: number; readonly installedAt: string; readonly entries: readonly HostConfigRecord[]; } export declare function buildHostConfigManifest(records: readonly (HostConfigRecord | null)[], now: string, previousRecords?: readonly HostConfigRecord[]): HostConfigManifest; export declare function readHostConfigRecords(raw: unknown): HostConfigRecord[]; /** * 매니페스트에 남은 호스트 설정 변경을 되돌린다. 반환값은 사람에게 보여줄 줄 목록. */ export declare function revertHostConfig(records: readonly HostConfigRecord[], opts?: { readonly dryRun?: boolean; }): Promise;