You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(config): tighten Zod-backed surfaces after v2.12.0 review (#354)
Cleanup pass on the surfaces the post-v2.12.0 code review flagged but
left as follow-up:
- Convert `ValidationResult` from an interface with optional fields to a
discriminated union. Callers now narrow with `if (result.success)`
instead of optional chaining or `as` casts.
- Isolate Zod private-internals reads (`_def.type`, `_def.innerType`,
`_def.shape`) behind a new `scripts/lib/zod-internals.ts` adapter
module. The codegen's required-array post-process no longer reaches
into Zod's private surface inline — one place to update on a future
zod major bump instead of three.
- Drop the unused `isConfigSchemaError` export. No production consumers
remained after v2.12.0 landed.
- Add semver validation to the docs generator's `--version` flag,
mirroring the sibling `generate-config-schema.ts` pattern. Empty or
malformed values now exit 1 instead of being interpolated into the
generated `$schema` URL.
While in `generate-config-schema.ts`, the required-array walker was
split into two helpers (`unwrapZodWrappers`, `pruneRequiredArray`) so
the main function stays under the lint cognitive-complexity threshold
after the adapter indirection lands.
Test count: 710 → 723. Schema output byte-identical (drift check passes
with no regeneration needed). Lint warnings: 7 → 6 across the repo.
|`config-schema.ts`|`SystematicConfigSchema`, `validateConfig`, `SECURITY_OVERLAY_FIELDS`, `AgentOverlaySchema`, `CategoryOverlaySchema`, `BootstrapSchema`| Canonical Zod schema for user config; security field list |
46
46
|`agent-colors.ts`|`isValidAgentColor`, `OPENCODE_AGENT_COLOR_TOKENS`| Color validator (hex or named token) + accepted token enum |
0 commit comments