From cfe4e8c46c704b9d33ef0a007b75e05ae4bc1503 Mon Sep 17 00:00:00 2001 From: Mark IJbema Date: Mon, 16 Mar 2026 12:33:26 +0100 Subject: [PATCH] fix: switch skill removal to POST with JSON body instead of DELETE with query params File paths as query parameters can fail due to URL encoding issues. Switch to POST /kilocode/skill/remove with the location in the JSON request body, which avoids encoding problems entirely. Also log the SDK error response to aid debugging. --- packages/kilo-vscode/src/KiloProvider.ts | 5 +++- .../opencode/src/server/routes/kilocode.ts | 8 +++--- packages/sdk/js/src/v2/gen/sdk.gen.ts | 27 ++++++++++--------- packages/sdk/js/src/v2/gen/types.gen.ts | 13 ++++----- packages/sdk/openapi.json | 27 ++++++++++++------- 5 files changed, 47 insertions(+), 33 deletions(-) diff --git a/packages/kilo-vscode/src/KiloProvider.ts b/packages/kilo-vscode/src/KiloProvider.ts index b8ce386a0ad..f65ba2dc39b 100644 --- a/packages/kilo-vscode/src/KiloProvider.ts +++ b/packages/kilo-vscode/src/KiloProvider.ts @@ -1140,7 +1140,10 @@ export class KiloProvider implements vscode.WebviewViewProvider, TelemetryProper if (!this.client) return try { const dir = this.getWorkspaceDirectory() - await this.client.kilocode.removeSkill({ location, directory: dir }) + const result = await this.client.kilocode.removeSkill({ location, directory: dir }) + if (result.error) { + console.error("[Kilo New] KiloProvider: removeSkill returned error:", result.error) + } } catch (error) { console.error("[Kilo New] KiloProvider: Failed to remove skill:", error) } diff --git a/packages/opencode/src/server/routes/kilocode.ts b/packages/opencode/src/server/routes/kilocode.ts index 60d077fe1b5..3edb468fbc2 100644 --- a/packages/opencode/src/server/routes/kilocode.ts +++ b/packages/opencode/src/server/routes/kilocode.ts @@ -9,8 +9,8 @@ import { lazy } from "../../util/lazy" import { errors } from "../error" export const KilocodeRoutes = lazy(() => - new Hono().delete( - "/skill", + new Hono().post( + "/skill/remove", describeRoute({ summary: "Remove a skill", description: "Remove a skill by deleting its directory from disk and clearing it from cache.", @@ -28,13 +28,13 @@ export const KilocodeRoutes = lazy(() => }, }), validator( - "query", + "json", z.object({ location: z.string(), }), ), async (c) => { - const { location } = c.req.valid("query") + const { location } = c.req.valid("json") await Skill.remove(location) return c.json(true) }, diff --git a/packages/sdk/js/src/v2/gen/sdk.gen.ts b/packages/sdk/js/src/v2/gen/sdk.gen.ts index b88b95c24a7..9fbc4210568 100644 --- a/packages/sdk/js/src/v2/gen/sdk.gen.ts +++ b/packages/sdk/js/src/v2/gen/sdk.gen.ts @@ -2937,10 +2937,10 @@ export class Kilocode extends HeyApiClient { * Remove a skill by deleting its directory from disk and clearing it from cache. */ public removeSkill( - parameters: { + parameters?: { directory?: string workspace?: string - location: string + location?: string }, options?: Options, ) { @@ -2951,20 +2951,23 @@ export class Kilocode extends HeyApiClient { args: [ { in: "query", key: "directory" }, { in: "query", key: "workspace" }, - { in: "query", key: "location" }, + { in: "body", key: "location" }, ], }, ], ) - return (options?.client ?? this.client).delete< - KilocodeRemoveSkillResponses, - KilocodeRemoveSkillErrors, - ThrowOnError - >({ - url: "/kilocode/skill", - ...options, - ...params, - }) + return (options?.client ?? this.client).post( + { + url: "/kilocode/skill/remove", + ...options, + ...params, + headers: { + "Content-Type": "application/json", + ...options?.headers, + ...params.headers, + }, + }, + ) } } diff --git a/packages/sdk/js/src/v2/gen/types.gen.ts b/packages/sdk/js/src/v2/gen/types.gen.ts index 47c1300d35f..fea79d1ecfa 100644 --- a/packages/sdk/js/src/v2/gen/types.gen.ts +++ b/packages/sdk/js/src/v2/gen/types.gen.ts @@ -4403,14 +4403,15 @@ export type EnhancePromptEnhanceResponses = { export type EnhancePromptEnhanceResponse = EnhancePromptEnhanceResponses[keyof EnhancePromptEnhanceResponses] export type KilocodeRemoveSkillData = { - body?: never - path?: never - query: { - directory?: string - workspace?: string + body?: { location: string } - url: "/kilocode/skill" + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/kilocode/skill/remove" } export type KilocodeRemoveSkillErrors = { diff --git a/packages/sdk/openapi.json b/packages/sdk/openapi.json index 5e09dbd374e..5c04569c5f1 100644 --- a/packages/sdk/openapi.json +++ b/packages/sdk/openapi.json @@ -5372,8 +5372,8 @@ ] } }, - "/kilocode/skill": { - "delete": { + "/kilocode/skill/remove": { + "post": { "operationId": "kilocode.removeSkill", "parameters": [ { @@ -5389,14 +5389,6 @@ "schema": { "type": "string" } - }, - { - "in": "query", - "name": "location", - "schema": { - "type": "string" - }, - "required": true } ], "summary": "Remove a skill", @@ -5423,6 +5415,21 @@ } } }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "location": { + "type": "string" + } + }, + "required": ["location"] + } + } + } + }, "x-codeSamples": [ { "lang": "js",