test(cli): cover json permission migration

This commit is contained in:
noobezlol
2026-06-01 17:18:44 +05:30
committed by Catriel Müller
parent ab1c90b68c
commit 941007b68d
2 changed files with 36 additions and 0 deletions
@@ -0,0 +1,5 @@
---
"kilo-code": patch
---
Handle string-form permission values when migrating bash permissions.
@@ -403,6 +403,37 @@ test("migrates string-form global permission in jsonc without throwing", async (
}
})
test("migrates string-form global permission in json without throwing", async () => {
await using globalTmp = await tmpdir({
init: async (dir) => {
await Filesystem.write(
path.join(dir, "kilo.json"),
JSON.stringify({
$schema: "https://app.kilo.ai/config.json",
permission: "allow",
}),
)
},
})
const prev = Global.Path.config
;(Global.Path as { config: string }).config = globalTmp.path
await clear(true)
try {
await KilocodeConfig.migrateBashPermission()
const writtenConfig = await Filesystem.readJson<Config.Info>(path.join(globalTmp.path, "kilo.json"))
expect(writtenConfig.permission).toEqual({
"*": "allow",
bash: "allow",
})
} finally {
;(Global.Path as { config: string }).config = prev
await clear(true)
}
})
test("migrates object-form global permission in jsonc", async () => {
await using globalTmp = await tmpdir({
init: async (dir) => {