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:
Michael Bolin
2025-05-13 09:45:46 -07:00
committed by GitHub
parent 05bb5d7d46
commit 557f608f25
9 changed files with 174 additions and 12 deletions

View File

@@ -38,7 +38,10 @@ function assistantMessage(text: string) {
describe("TerminalChatResponseItem", () => {
it("renders a user message", () => {
const { lastFrameStripped } = renderTui(
<TerminalChatResponseItem item={userMessage("Hello world")} />,
<TerminalChatResponseItem
item={userMessage("Hello world")}
fileOpener={undefined}
/>,
);
const frame = lastFrameStripped();
@@ -48,7 +51,10 @@ describe("TerminalChatResponseItem", () => {
it("renders an assistant message", () => {
const { lastFrameStripped } = renderTui(
<TerminalChatResponseItem item={assistantMessage("Sure thing")} />,
<TerminalChatResponseItem
item={assistantMessage("Sure thing")}
fileOpener={undefined}
/>,
);
const frame = lastFrameStripped();