feat(cli): add effectCmd wrapper + convert models command (#25429)

This commit is contained in:
Kit Langton
2026-05-02 12:08:04 -04:00
committed by GitHub
parent 0d0ec7dc46
commit 146ff8ad85
4 changed files with 101 additions and 60 deletions

View File

@@ -15,6 +15,13 @@ function isTaggedError(error: unknown, tag: string): boolean {
}
export function FormatError(input: unknown) {
// CliError: domain failure surfaced from an effectCmd handler via fail("...")
if (isTaggedError(input, "CliError")) {
const data = input as ErrorLike & { exitCode?: number }
if (data.exitCode != null) process.exitCode = data.exitCode
return data.message ?? ""
}
// MCPFailed: { name: string }
if (NamedError.hasName(input, "MCPFailed")) {
return `MCP server "${(input as ErrorLike).data?.name}" failed. Note, opencode does not support MCP authentication yet.`