Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/opencode/src/command/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,15 @@ export const layer = Layer.effect(
}

for (const [name, command] of Object.entries(cfg.command ?? {})) {
if (!command.template) continue
commands[name] = {
name,
agent: command.agent,
model: command.model,
description: command.description,
source: "command",
get template() {
return command.template
return command.template!
},
subtask: command.subtask,
hints: hints(command.template),
Expand Down
2 changes: 1 addition & 1 deletion packages/opencode/src/config/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { ConfigModelID } from "./model-id"
const log = Log.create({ service: "config" })

export const Info = Schema.Struct({
template: Schema.String,
template: Schema.optional(Schema.String),
description: Schema.optional(Schema.String),
agent: Schema.optional(Schema.String),
model: Schema.optional(ConfigModelID),
Expand Down
24 changes: 24 additions & 0 deletions packages/opencode/test/config/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,30 @@ test("handles command configuration", async () => {
})
})

test("accepts partial command override without template", async () => {
await using tmp = await tmpdir({
init: async (dir) => {
await writeConfig(dir, {
$schema: "https://opencode.ai/config.json",
command: {
commit: {
model: "anthropic/claude-4-6-sonnet",
},
},
})
},
})
await WithInstance.provide({
directory: tmp.path,
fn: async () => {
const config = await load()
expect(config.command?.["commit"]).toEqual({
model: "anthropic/claude-4-6-sonnet",
})
},
})
})

test("migrates autoshare to share field", async () => {
await using tmp = await tmpdir({
init: async (dir) => {
Expand Down
Loading