03e20e6ac1
Extract error handling, parsing logic, and variable substitution into dedicated modules. This reduces duplication between tui.json and opencode.json parsing and makes the config system easier to extend for future config formats.
22 lines
471 B
TypeScript
22 lines
471 B
TypeScript
export * as ConfigError from "./error"
|
|
|
|
import z from "zod"
|
|
import { NamedError } from "@opencode-ai/shared/util/error"
|
|
|
|
export const JsonError = NamedError.create(
|
|
"ConfigJsonError",
|
|
z.object({
|
|
path: z.string(),
|
|
message: z.string().optional(),
|
|
}),
|
|
)
|
|
|
|
export const InvalidError = NamedError.create(
|
|
"ConfigInvalidError",
|
|
z.object({
|
|
path: z.string(),
|
|
issues: z.custom<z.core.$ZodIssue[]>().optional(),
|
|
message: z.string().optional(),
|
|
}),
|
|
)
|