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.
This commit is contained in:
Mark IJbema
2026-03-16 13:04:07 +01:00
parent 9507b01c4c
commit cfe4e8c46c
5 changed files with 47 additions and 33 deletions
+4 -1
View File
@@ -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)
}
@@ -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)
},
+15 -12
View File
@@ -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<ThrowOnError extends boolean = false>(
parameters: {
parameters?: {
directory?: string
workspace?: string
location: string
location?: string
},
options?: Options<never, ThrowOnError>,
) {
@@ -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<KilocodeRemoveSkillResponses, KilocodeRemoveSkillErrors, ThrowOnError>(
{
url: "/kilocode/skill/remove",
...options,
...params,
headers: {
"Content-Type": "application/json",
...options?.headers,
...params.headers,
},
},
)
}
}
+7 -6
View File
@@ -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 = {
+17 -10
View File
@@ -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",