Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions .changeset/quiet-config-unset.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@kilocode/cli": patch
---

Allow clearing a nested project setting when no project config file exists yet.
4 changes: 4 additions & 0 deletions packages/opencode/src/kilocode/config/writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ export namespace KilocodeConfigWriter {

function patchJsonc(input: string, patch: unknown, parts: string[] = []): string {
if (!isRecord(patch)) {
if (patch === null) {
const tree = parseTree(input)
if (!tree || !findNodeAtLocation(tree, parts)) return input
Comment thread
marius-kilocode marked this conversation as resolved.
Resolved
}
return applyEdits(
input,
modify(input, parts, patch === null ? undefined : patch, {
Expand Down
12 changes: 12 additions & 0 deletions packages/opencode/test/kilocode/server/config-overlay.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,18 @@ describe("config overlay routes", () => {
expect(await Bun.file(target.path).text()).toContain('"model": "test/model"')
})

test("ignores a nested unset path when the project target is missing", async () => {
Comment thread
marius-kilocode marked this conversation as resolved.
Resolved
await using project = await tmpdir()
const response = await req(project.path, "/config/overlay", {
method: "PATCH",
headers: { "content-type": "application/json" },
body: JSON.stringify({ scope: "project", unset: [["agent", "explore", "model"]] }),
})

expect(response.status).toBe(200)
expect(await Bun.file(path.join(project.path, ".kilo", "kilo.jsonc")).exists()).toBe(false)
})

test("returns exact raw target data and a stable missing-file revision", async () => {
await using project = await tmpdir()
const first = await KilocodeConfigOverlay.target({ scope: "project", directory: project.path })
Expand Down
Loading