mirror of
https://github.com/aljazceru/opencode.git
synced 2026-01-11 20:04:59 +01:00
17 lines
623 B
TypeScript
17 lines
623 B
TypeScript
import { Config } from "../config/config"
|
|
import { MCP } from "../mcp"
|
|
|
|
export function FormatError(input: unknown) {
|
|
if (MCP.Failed.isInstance(input))
|
|
return `MCP server "${input.data.name}" failed. Note, opencode does not support MCP authentication yet.`
|
|
if (Config.JsonError.isInstance(input))
|
|
return `Config file at ${input.data.path} is not valid JSON`
|
|
if (Config.InvalidError.isInstance(input))
|
|
return [
|
|
`Config file at ${input.data.path} is invalid`,
|
|
...(input.data.issues?.map(
|
|
(issue) => "↳ " + issue.message + " " + issue.path.join("."),
|
|
) ?? []),
|
|
].join("\n")
|
|
}
|