mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-24 16:02:55 +08:00
feat: remove semantic indexing experimental gate
This commit is contained in:
@@ -74,7 +74,7 @@ function mergeConfigConcatArrays(target: Info, source: Info): Info {
|
||||
|
||||
function normalizeLoadedConfig(data: unknown, source: string) {
|
||||
if (!isRecord(data)) return data
|
||||
const copy = { ...data }
|
||||
const copy = KilocodeConfig.retireIndexingFlag({ ...data }, source) // kilocode_change
|
||||
const hadLegacy = "theme" in copy || "keybinds" in copy || "tui" in copy
|
||||
if (!hadLegacy) return copy
|
||||
delete copy.theme
|
||||
@@ -350,9 +350,6 @@ export const Info = Schema.Struct({
|
||||
batch_tool: Schema.optional(Schema.Boolean).annotate({ description: "Enable the batch tool" }),
|
||||
codebase_search: Schema.optional(Schema.Boolean).annotate({ description: "Enable AI-powered codebase search" }), // kilocode_change
|
||||
// kilocode_change start
|
||||
semantic_indexing: Schema.optional(Schema.Boolean).annotate({
|
||||
description: "Enable semantic codebase indexing and the semantic_search tool",
|
||||
}),
|
||||
speech_to_text_model: Schema.optional(Schema.String).annotate({
|
||||
description: "Speech-to-text transcription model ID to use for voice input",
|
||||
}),
|
||||
|
||||
@@ -115,6 +115,14 @@ export namespace KilocodeConfig {
|
||||
return stripGlobalIndexing(info)
|
||||
}
|
||||
|
||||
export function retireIndexingFlag(info: Record<string, unknown>, source: string) {
|
||||
if (!isRecord(info.experimental) || !("semantic_indexing" in info.experimental)) return info
|
||||
const experimental = { ...info.experimental }
|
||||
delete experimental.semantic_indexing
|
||||
log.warn("ignored retired experimental.semantic_indexing config; use indexing.enabled instead", { path: source })
|
||||
return { ...info, experimental }
|
||||
}
|
||||
|
||||
function stripGlobalIndexing(info: Config.Info): Config.Info {
|
||||
// Indexing provider/storage settings can be global, but enablement is exposed separately from project enablement.
|
||||
if (info.indexing?.enabled === undefined) return info
|
||||
|
||||
@@ -9,7 +9,6 @@ type PluginSpec = string | [string, Record<string, unknown>]
|
||||
|
||||
type ConfigLike = {
|
||||
plugin?: readonly PluginSpec[] | null
|
||||
experimental?: { semantic_indexing?: boolean } | null
|
||||
}
|
||||
|
||||
type Req = {
|
||||
@@ -21,7 +20,7 @@ type LogLike = {
|
||||
}
|
||||
|
||||
export function indexingEnabled(config?: ConfigLike | null): boolean {
|
||||
return hasIndexingPlugin(config?.plugin ?? []) && config?.experimental?.semantic_indexing === true
|
||||
return hasIndexingPlugin(config?.plugin ?? [])
|
||||
}
|
||||
|
||||
export function resolveIndexingPlugin(req: Req, log?: LogLike): string {
|
||||
|
||||
@@ -242,15 +242,6 @@ export namespace KiloIndexing {
|
||||
return track(hit, await inert(() => missing()))
|
||||
}
|
||||
|
||||
if (cfg.experimental?.semantic_indexing !== true) {
|
||||
return track(
|
||||
hit,
|
||||
await inert(() =>
|
||||
disabledIndexingStatus("Semantic indexing is disabled. Enable it in the Experimental settings."),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
if (isWorktreePath(dir)) {
|
||||
return track(hit, await inert(() => worktreeDisabled()))
|
||||
}
|
||||
|
||||
@@ -54,9 +54,6 @@ async function writeConfig(dir: string, config: object, name = "kilo.json") {
|
||||
|
||||
const cfg: Partial<Config.Info> = {
|
||||
plugin: ["@kilocode/kilo-indexing"],
|
||||
experimental: {
|
||||
semantic_indexing: true,
|
||||
},
|
||||
indexing: {
|
||||
provider: "ollama",
|
||||
vectorStore: "qdrant",
|
||||
@@ -93,6 +90,22 @@ describe("markdown substitutions", () => {
|
||||
})
|
||||
|
||||
describe("kilocode indexing config", () => {
|
||||
test("ignores retired semantic indexing flags in existing configs", async () => {
|
||||
await using tmp = await tmpdir({ git: true })
|
||||
await writeConfig(tmp.path, {
|
||||
experimental: { semantic_indexing: true, batch_tool: true },
|
||||
})
|
||||
|
||||
await WithInstance.provide({
|
||||
directory: tmp.path,
|
||||
fn: async () => {
|
||||
const config = await load()
|
||||
expect(config.experimental?.batch_tool).toBe(true)
|
||||
expect(config.experimental).not.toHaveProperty("semantic_indexing")
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
test("keeps global indexing enabled in global config", async () => {
|
||||
await using globalTmp = await tmpdir()
|
||||
await using tmp = await tmpdir()
|
||||
|
||||
@@ -9,12 +9,8 @@ import {
|
||||
describe("indexing plugin helpers", () => {
|
||||
test("detects plugin-enabled configs", () => {
|
||||
expect(indexingEnabled({ plugin: ["global-plugin"] })).toBe(false)
|
||||
expect(indexingEnabled({ plugin: [INDEXING_PLUGIN] })).toBe(false)
|
||||
expect(indexingEnabled({ plugin: [INDEXING_PLUGIN], experimental: { semantic_indexing: false } })).toBe(false)
|
||||
expect(indexingEnabled({ plugin: [INDEXING_PLUGIN], experimental: { semantic_indexing: true } })).toBe(true)
|
||||
expect(
|
||||
indexingEnabled({ plugin: ["@kilocode/kilo-indexing@1.0.0"], experimental: { semantic_indexing: true } }),
|
||||
).toBe(true)
|
||||
expect(indexingEnabled({ plugin: [INDEXING_PLUGIN] })).toBe(true)
|
||||
expect(indexingEnabled({ plugin: ["@kilocode/kilo-indexing@1.0.0"] })).toBe(true)
|
||||
})
|
||||
|
||||
test("adds indexing plugin when present but missing from config", () => {
|
||||
|
||||
@@ -16,9 +16,6 @@ const fetch = global.fetch
|
||||
|
||||
const cfg: Partial<Config.Info> = {
|
||||
plugin: ["@kilocode/kilo-indexing"],
|
||||
experimental: {
|
||||
semantic_indexing: true,
|
||||
},
|
||||
indexing: {
|
||||
enabled: true,
|
||||
provider: "ollama",
|
||||
@@ -29,13 +26,9 @@ const cfg: Partial<Config.Info> = {
|
||||
},
|
||||
}
|
||||
|
||||
const off: Partial<Config.Info> = {
|
||||
const unset: Partial<Config.Info> = {
|
||||
plugin: ["@kilocode/kilo-indexing"],
|
||||
experimental: {
|
||||
semantic_indexing: false,
|
||||
},
|
||||
indexing: {
|
||||
enabled: true,
|
||||
provider: "ollama",
|
||||
vectorStore: "qdrant",
|
||||
ollama: {
|
||||
@@ -45,9 +38,6 @@ const off: Partial<Config.Info> = {
|
||||
}
|
||||
const inactive: Partial<Config.Info> = {
|
||||
plugin: ["@kilocode/kilo-indexing"],
|
||||
experimental: {
|
||||
semantic_indexing: true,
|
||||
},
|
||||
indexing: {
|
||||
enabled: false,
|
||||
provider: "ollama",
|
||||
@@ -56,9 +46,6 @@ const inactive: Partial<Config.Info> = {
|
||||
}
|
||||
const kilo: Partial<Config.Info> = {
|
||||
plugin: ["@kilocode/kilo-indexing"],
|
||||
experimental: {
|
||||
semantic_indexing: true,
|
||||
},
|
||||
indexing: {
|
||||
enabled: true,
|
||||
vectorStore: "qdrant",
|
||||
@@ -66,9 +53,6 @@ const kilo: Partial<Config.Info> = {
|
||||
}
|
||||
const implicitOpenAi: Partial<Config.Info> = {
|
||||
plugin: ["@kilocode/kilo-indexing"],
|
||||
experimental: {
|
||||
semantic_indexing: true,
|
||||
},
|
||||
indexing: {
|
||||
enabled: true,
|
||||
vectorStore: "qdrant",
|
||||
@@ -79,9 +63,6 @@ const implicitOpenAi: Partial<Config.Info> = {
|
||||
}
|
||||
const staleKilo: Partial<Config.Info> = {
|
||||
plugin: ["@kilocode/kilo-indexing"],
|
||||
experimental: {
|
||||
semantic_indexing: true,
|
||||
},
|
||||
indexing: {
|
||||
enabled: true,
|
||||
provider: "kilo",
|
||||
@@ -303,8 +284,8 @@ describe("indexing startup degradation", () => {
|
||||
}
|
||||
})
|
||||
|
||||
test("stays disabled when semantic indexing flag is off", async () => {
|
||||
await using tmp = await tmpdir({ git: true, config: off })
|
||||
test("stays disabled when indexing enablement is unset", async () => {
|
||||
await using tmp = await tmpdir({ git: true, config: unset })
|
||||
process.env["KILO_CONFIG_DIR"] = tmp.path
|
||||
const init = spyOn(CodeIndexManager.prototype, "initialize")
|
||||
|
||||
@@ -315,11 +296,11 @@ describe("indexing startup degradation", () => {
|
||||
|
||||
expect(status).toMatchObject({
|
||||
state: "Disabled",
|
||||
message: "Semantic indexing is disabled. Enable it in the Experimental settings.",
|
||||
message: "Indexing disabled.",
|
||||
})
|
||||
expect(await KiloIndexing.available()).toBe(false)
|
||||
expect(KiloIndexing.ready()).toBe(false)
|
||||
expect(await KiloIndexing.search("flag off")).toEqual([])
|
||||
expect(await KiloIndexing.search("disabled")).toEqual([])
|
||||
expect(init).not.toHaveBeenCalled()
|
||||
},
|
||||
})
|
||||
|
||||
@@ -7,9 +7,6 @@ import { disposeAllInstances, tmpdir } from "../fixture/fixture"
|
||||
|
||||
const cfg: Partial<Config.Info> = {
|
||||
plugin: ["@kilocode/kilo-indexing"],
|
||||
experimental: {
|
||||
semantic_indexing: true,
|
||||
},
|
||||
indexing: {
|
||||
enabled: true,
|
||||
provider: "ollama",
|
||||
|
||||
Reference in New Issue
Block a user