refactor: kilo compat for v1.14.29

This commit is contained in:
Mark IJbema
2026-04-29 17:24:20 +02:00
parent 5e67efc2fd
commit 7d375b93ee
1673 changed files with 1498 additions and 399138 deletions
@@ -221,8 +221,8 @@ describe("Instruction.resolve", () => {
describe("Instruction.system", () => {
test("loads both project and global AGENTS.md when both exist", async () => {
const originalConfigDir = process.env["OPENCODE_CONFIG_DIR"]
delete process.env["OPENCODE_CONFIG_DIR"]
const originalConfigDir = process.env["KILO_CONFIG_DIR"]
delete process.env["KILO_CONFIG_DIR"]
await using globalTmp = await tmpdir({
init: async (dir) => {
@@ -264,30 +264,30 @@ describe("Instruction.system", () => {
} finally {
;(Global.Path as { config: string }).config = originalGlobalConfig
if (originalConfigDir === undefined) {
delete process.env["OPENCODE_CONFIG_DIR"]
delete process.env["KILO_CONFIG_DIR"]
} else {
process.env["OPENCODE_CONFIG_DIR"] = originalConfigDir
process.env["KILO_CONFIG_DIR"] = originalConfigDir
}
}
})
})
describe("Instruction.systemPaths OPENCODE_CONFIG_DIR", () => {
describe("Instruction.systemPaths KILO_CONFIG_DIR", () => {
let originalConfigDir: string | undefined
beforeEach(() => {
originalConfigDir = process.env["OPENCODE_CONFIG_DIR"]
originalConfigDir = process.env["KILO_CONFIG_DIR"]
})
afterEach(() => {
if (originalConfigDir === undefined) {
delete process.env["OPENCODE_CONFIG_DIR"]
delete process.env["KILO_CONFIG_DIR"]
} else {
process.env["OPENCODE_CONFIG_DIR"] = originalConfigDir
process.env["KILO_CONFIG_DIR"] = originalConfigDir
}
})
test("prefers OPENCODE_CONFIG_DIR AGENTS.md over global when both exist", async () => {
test("prefers KILO_CONFIG_DIR AGENTS.md over global when both exist", async () => {
await using profileTmp = await tmpdir({
init: async (dir) => {
await Bun.write(path.join(dir, "AGENTS.md"), "# Profile Instructions")
@@ -300,7 +300,7 @@ describe("Instruction.systemPaths OPENCODE_CONFIG_DIR", () => {
})
await using projectTmp = await tmpdir()
process.env["OPENCODE_CONFIG_DIR"] = profileTmp.path
process.env["KILO_CONFIG_DIR"] = profileTmp.path
const originalGlobalConfig = Global.Path.config
;(Global.Path as { config: string }).config = globalTmp.path
@@ -323,7 +323,7 @@ describe("Instruction.systemPaths OPENCODE_CONFIG_DIR", () => {
}
})
test("falls back to global AGENTS.md when OPENCODE_CONFIG_DIR has no AGENTS.md", async () => {
test("falls back to global AGENTS.md when KILO_CONFIG_DIR has no AGENTS.md", async () => {
await using profileTmp = await tmpdir()
await using globalTmp = await tmpdir({
init: async (dir) => {
@@ -332,7 +332,7 @@ describe("Instruction.systemPaths OPENCODE_CONFIG_DIR", () => {
})
await using projectTmp = await tmpdir()
process.env["OPENCODE_CONFIG_DIR"] = profileTmp.path
process.env["KILO_CONFIG_DIR"] = profileTmp.path
const originalGlobalConfig = Global.Path.config
;(Global.Path as { config: string }).config = globalTmp.path
@@ -355,7 +355,7 @@ describe("Instruction.systemPaths OPENCODE_CONFIG_DIR", () => {
}
})
test("uses global AGENTS.md when OPENCODE_CONFIG_DIR is not set", async () => {
test("uses global AGENTS.md when KILO_CONFIG_DIR is not set", async () => {
await using globalTmp = await tmpdir({
init: async (dir) => {
await Bun.write(path.join(dir, "AGENTS.md"), "# Global Instructions")
@@ -363,7 +363,7 @@ describe("Instruction.systemPaths OPENCODE_CONFIG_DIR", () => {
})
await using projectTmp = await tmpdir()
delete process.env["OPENCODE_CONFIG_DIR"]
delete process.env["KILO_CONFIG_DIR"]
const originalGlobalConfig = Global.Path.config
;(Global.Path as { config: string }).config = globalTmp.path
@@ -35,8 +35,8 @@ description: ${description}
},
})
const home = process.env.OPENCODE_TEST_HOME
process.env.OPENCODE_TEST_HOME = tmp.path
const home = process.env.KILO_TEST_HOME
process.env.KILO_TEST_HOME = tmp.path
try {
await Instance.provide({
@@ -63,7 +63,7 @@ description: ${description}
},
})
} finally {
process.env.OPENCODE_TEST_HOME = home
process.env.KILO_TEST_HOME = home
}
})
})