GeezerVison is showing github.com — Move schema utilities into core (#26565) · githubhjs/opencode@dcdbdb2
File treeExpand file treeCollapse file tree Open diff view settings server/routes/instance/httpapi
Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboard File renamed without changes. Collapse file Copy file name to clipboard File renamed without changes. Collapse file Copy file name to clipboardExpand all lines: packages/opencode/specs/effect/migration.md +2-2Lines changed: 2 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -59,10 +59,10 @@ Rules: | 59 | 59 |
| 60 | 60 | ## Schema → Zod interop | 61 | 61 |
| 62 | | -When a service uses Effect Schema internally but needs Zod schemas for the HTTP layer, derive Zod from Schema using the `zod()` helper from `@/util/effect-zod`: | | 62 | +When a service uses Effect Schema internally but needs Zod schemas for the HTTP layer, derive Zod from Schema using the `zod()` helper from `@opencode-ai/core/effect-zod`: | 63 | 63 |
| 64 | 64 | ```ts | 65 | | -import { zod } from "@/util/effect-zod" | | 65 | +import { zod } from "@opencode-ai/core/effect-zod" | 66 | 66 |
| 67 | 67 | export const ZodInfo = zod(Info) // derives z.ZodType from Schema.Union | 68 | 68 | ``` | |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/specs/effect/schema.md +3-3Lines changed: 3 additions & 3 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -8,7 +8,7 @@ Zod-first definitions to Effect Schema with Zod compatibility shims. | 8 | 8 | Use Effect Schema as the source of truth for domain models, IDs, inputs, | 9 | 9 | outputs, and typed errors. Keep Zod available at existing HTTP, tool, and | 10 | 10 | compatibility boundaries by exposing a `.zod` static derived from the Effect | 11 | | -schema via `@/util/effect-zod`. | | 11 | +schema via `@opencode-ai/core/effect-zod`. | 12 | 12 |
| 13 | 13 | The long-term driver is `specs/effect/http-api.md` — once the HTTP server | 14 | 14 | moves to `@effect/platform`, every Schema-first DTO can flow through | @@ -97,7 +97,7 @@ creating a parallel schema source of truth. | 97 | 97 |
| 98 | 98 | ## Escape hatches | 99 | 99 |
| 100 | | -The walker in `@/util/effect-zod` exposes two explicit escape hatches for | | 100 | +The walker in `@opencode-ai/core/effect-zod` exposes two explicit escape hatches for | 101 | 101 | cases the pure-Schema path cannot express. Each one stays in the codebase | 102 | 102 | only as long as its upstream or local dependency requires it — inline | 103 | 103 | comments document when each can be deleted. | @@ -389,7 +389,7 @@ piecewise. | 389 | 389 |
| 390 | 390 | ## Notes | 391 | 391 |
| 392 | | -- Use `@/util/effect-zod` for all Schema → Zod conversion. | | 392 | +- Use `@opencode-ai/core/effect-zod` for all Schema → Zod conversion. | 393 | 393 | - Prefer one canonical schema definition. Avoid maintaining parallel Zod and | 394 | 394 | Effect definitions for the same domain type. | 395 | 395 | - Keep the migration incremental. Converting the domain model first is more | |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/src/agent/agent.ts +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -24,8 +24,8 @@ import { Effect, Context, Layer, Schema } from "effect" | 24 | 24 | import { InstanceState } from "@/effect/instance-state" | 25 | 25 | import * as Option from "effect/Option" | 26 | 26 | import * as OtelTracer from "@effect/opentelemetry/Tracer" | 27 | | -import { zod } from "@/util/effect-zod" | 28 | | -import { withStatics, type DeepMutable } from "@/util/schema" | | 27 | +import { zod } from "@opencode-ai/core/effect-zod" | | 28 | +import { withStatics, type DeepMutable } from "@opencode-ai/core/schema" | 29 | 29 |
| 30 | 30 | type ReferenceEntry = NonNullable<Config.Info["reference"]>[string] | 31 | 31 | type ResolvedReference = { kind: "git"; repository: string; branch?: string } | { kind: "local"; path: string } | |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/src/auth/index.ts +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import path from "path" | 2 | 2 | import { Effect, Layer, Record, Result, Schema, Context } from "effect" | 3 | | -import { zod } from "@/util/effect-zod" | 4 | | -import { NonNegativeInt } from "@/util/schema" | | 3 | +import { zod } from "@opencode-ai/core/effect-zod" | | 4 | +import { NonNegativeInt } from "@opencode-ai/core/schema" | 5 | 5 | import { Global } from "@opencode-ai/core/global" | 6 | 6 | import { AppFileSystem } from "@opencode-ai/core/filesystem" | 7 | 7 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/src/cli/cmd/tui/event.ts +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import { BusEvent } from "@/bus/bus-event" | 2 | 2 | import { SessionID } from "@/session/schema" | 3 | | -import { PositiveInt } from "@/util/schema" | | 3 | +import { PositiveInt } from "@opencode-ai/core/schema" | 4 | 4 | import { Effect, Schema } from "effect" | 5 | 5 |
| 6 | 6 | const DEFAULT_TOAST_DURATION = 5000 | |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/src/command/index.ts +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -5,8 +5,8 @@ import type { InstanceContext } from "@/project/instance" | 5 | 5 | import { SessionID, MessageID } from "@/session/schema" | 6 | 6 | import { Effect, Layer, Context, Schema } from "effect" | 7 | 7 | import z from "zod" | 8 | | -import { zod, ZodOverride } from "@/util/effect-zod" | 9 | | -import { withStatics } from "@/util/schema" | | 8 | +import { zod, ZodOverride } from "@opencode-ai/core/effect-zod" | | 9 | +import { withStatics } from "@opencode-ai/core/schema" | 10 | 10 | import { Config } from "@/config/config" | 11 | 11 | import { MCP } from "../mcp" | 12 | 12 | import { Skill } from "../skill" | |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/src/config/agent.ts +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2,8 +2,8 @@ export * as ConfigAgent from "./agent" | 2 | 2 |
| 3 | 3 | import { Exit, Schema, SchemaGetter } from "effect" | 4 | 4 | import { Bus } from "@/bus" | 5 | | -import { zod } from "@/util/effect-zod" | 6 | | -import { PositiveInt, withStatics } from "@/util/schema" | | 5 | +import { zod } from "@opencode-ai/core/effect-zod" | | 6 | +import { PositiveInt, withStatics } from "@opencode-ai/core/schema" | 7 | 7 | import * as Log from "@opencode-ai/core/util/log" | 8 | 8 | import { NamedError } from "@opencode-ai/core/util/error" | 9 | 9 | import { Glob } from "@opencode-ai/core/util/glob" | |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/src/config/command.ts +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -5,8 +5,8 @@ import { Schema } from "effect" | 5 | 5 | import { NamedError } from "@opencode-ai/core/util/error" | 6 | 6 | import { Glob } from "@opencode-ai/core/util/glob" | 7 | 7 | import { Bus } from "@/bus" | 8 | | -import { zod } from "@/util/effect-zod" | 9 | | -import { withStatics } from "@/util/schema" | | 8 | +import { zod } from "@opencode-ai/core/effect-zod" | | 9 | +import { withStatics } from "@opencode-ai/core/schema" | 10 | 10 | import { configEntryNameFromPath } from "./entry-name" | 11 | 11 | import { InvalidError } from "./error" | 12 | 12 | import * as ConfigMarkdown from "./markdown" | |
|