mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-24 16:02:55 +08:00
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:
@@ -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)
|
||||
},
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user