Skip to content

Commit 7f571d3

Browse files
thdxrCopilot
andauthored
refactor(core): move database schema ownership (#29068)
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
1 parent 6bcb9cb commit 7f571d3

390 files changed

Lines changed: 11106 additions & 9143 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.opencode/opencode.jsonc‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"$schema": "https://opencode.ai/config.json",
33
"provider": {},
44
"permission": {},
5+
"reference": {
6+
"effect": "github.com/Effect-TS/effect-smol",
7+
},
58
"mcp": {},
69
"tools": {
710
"github-triage": false,

‎AGENTS.md‎

Lines changed: 6 additions & 0 deletions

‎bun.lock‎

Lines changed: 19 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/cli/src/debug/agents.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { AgentV2 } from "@opencode-ai/core/agent"
33
import { PluginBoot } from "@opencode-ai/core/plugin/boot"
44
import * as Effect from "effect/Effect"
55
import * as Command from "effect/unstable/cli/Command"
6+
import { LocationServiceMap } from "@opencode-ai/core/location-layer"
7+
import { AbsolutePath } from "@opencode-ai/core/schema"
68

79
export const AgentsCommand = Command.make("agents", {}, () =>
810
Effect.gen(function* () {
@@ -15,5 +17,11 @@ export const AgentsCommand = Command.make("agents", {}, () =>
1517
2,
1618
) + EOL,
1719
)
18-
}),
20+
}).pipe(
21+
Effect.provide(
22+
LocationServiceMap.get({
23+
directory: AbsolutePath.make(process.cwd()),
24+
}),
25+
),
26+
),
1927
).pipe(Command.withDescription("List all agents"))

‎packages/cli/src/index.ts‎

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,17 @@
22

33
import * as NodeRuntime from "@effect/platform-node/NodeRuntime"
44
import * as NodeServices from "@effect/platform-node/NodeServices"
5-
import { AccountV2 } from "@opencode-ai/core/account"
6-
import { AgentV2 } from "@opencode-ai/core/agent"
7-
import { Catalog } from "@opencode-ai/core/catalog"
8-
import { Config } from "@opencode-ai/core/config"
9-
import { EventV2 } from "@opencode-ai/core/event"
10-
import { Location } from "@opencode-ai/core/location"
11-
import { Npm } from "@opencode-ai/core/npm"
12-
import { PluginV2 } from "@opencode-ai/core/plugin"
13-
import { PluginBoot } from "@opencode-ai/core/plugin/boot"
14-
import { Policy } from "@opencode-ai/core/policy"
15-
import { AbsolutePath } from "@opencode-ai/core/schema"
165
import * as Effect from "effect/Effect"
176
import * as Layer from "effect/Layer"
187
import * as Command from "effect/unstable/cli/Command"
198
import { DebugCommand } from "./debug"
9+
import { LocationServiceMap } from "@opencode-ai/core/location-layer"
2010

2111
const cli = Command.make("opencode", {}, () => Effect.void).pipe(
2212
Command.withDescription("OpenCode command line interface"),
2313
Command.withSubcommands([DebugCommand]),
2414
)
2515

26-
const locationLayer = Location.defaultLayer({
27-
directory: AbsolutePath.make(process.cwd()),
28-
})
29-
30-
const policyLayer = Policy.defaultLayer.pipe(Layer.provideMerge(locationLayer))
31-
const pluginLayer = PluginV2.defaultLayer
32-
const eventLayer = EventV2.defaultLayer
33-
34-
const layer = PluginBoot.layer.pipe(
35-
Layer.provideMerge(
36-
Layer.mergeAll(
37-
NodeServices.layer,
38-
Catalog.layer.pipe(Layer.provideMerge(Layer.mergeAll(eventLayer, pluginLayer, policyLayer))),
39-
eventLayer,
40-
pluginLayer,
41-
AccountV2.defaultLayer,
42-
AgentV2.defaultLayer,
43-
Config.defaultLayer.pipe(Layer.provideMerge(policyLayer)),
44-
Npm.defaultLayer,
45-
),
46-
),
47-
)
16+
const layer = Layer.mergeAll(LocationServiceMap.layer, NodeServices.layer)
4817

4918
Command.run(cli, { version: "local" }).pipe(Effect.provide(layer), Effect.scoped, NodeRuntime.runMain)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { defineConfig } from "drizzle-kit"
22

33
export default defineConfig({
44
dialect: "sqlite",
5-
schema: "./src/**/*.sql.ts",
5+
schema: ["./src/**/*.sql.ts", "./src/**/sql.ts"],
66
out: "./migration",
77
dbCredentials: {
88
url: "/home/thdxr/.local/share/opencode/opencode.db",

packages/opencode/migration/20260127222353_familiar_lady_ursula/migration.sql renamed to packages/core/migration/20260127222353_familiar_lady_ursula/migration.sql

File renamed without changes.

packages/opencode/migration/20260127222353_familiar_lady_ursula/snapshot.json renamed to packages/core/migration/20260127222353_familiar_lady_ursula/snapshot.json

File renamed without changes.

packages/opencode/migration/20260211171708_add_project_commands/migration.sql renamed to packages/core/migration/20260211171708_add_project_commands/migration.sql

File renamed without changes.

packages/opencode/migration/20260211171708_add_project_commands/snapshot.json renamed to packages/core/migration/20260211171708_add_project_commands/snapshot.json

File renamed without changes.

0 commit comments

Comments
 (0)