fix: add support for fileOpener in config.json (#911)
This PR introduces the following type: ```typescript export type FileOpenerScheme = "vscode" | "cursor" | "windsurf"; ``` and uses it as the new type for a `fileOpener` option in `config.json`. If set, this will be used to linkify file annotations in the output using the URI-based file opener supported in VS Code-based IDEs. Currently, this does not pass: Updated `codex-cli/tests/markdown.test.tsx` to verify the new behavior. Note it required mocking `supports-hyperlinks` and temporarily modifying `chalk.level` to yield the desired output.
This commit is contained in:
@@ -135,6 +135,8 @@ export function getApiKey(provider: string = "openai"): string | undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export type FileOpenerScheme = "vscode" | "cursor" | "windsurf";
|
||||
|
||||
// Represents config as persisted in config.json.
|
||||
export type StoredConfig = {
|
||||
model?: string;
|
||||
@@ -162,6 +164,12 @@ export type StoredConfig = {
|
||||
/** User-defined safe commands */
|
||||
safeCommands?: Array<string>;
|
||||
reasoningEffort?: ReasoningEffort;
|
||||
|
||||
/**
|
||||
* URI-based file opener. This is used when linking code references in
|
||||
* terminal output.
|
||||
*/
|
||||
fileOpener?: FileOpenerScheme;
|
||||
};
|
||||
|
||||
// Minimal config written on first run. An *empty* model string ensures that
|
||||
@@ -206,6 +214,7 @@ export type AppConfig = {
|
||||
maxLines: number;
|
||||
};
|
||||
};
|
||||
fileOpener?: FileOpenerScheme;
|
||||
};
|
||||
|
||||
// Formatting (quiet mode-only).
|
||||
@@ -429,6 +438,7 @@ export const loadConfig = (
|
||||
},
|
||||
disableResponseStorage: storedConfig.disableResponseStorage === true,
|
||||
reasoningEffort: storedConfig.reasoningEffort,
|
||||
fileOpener: storedConfig.fileOpener,
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user