mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-24 16:02:55 +08:00
refactor: rename to KilocodeRoutes at /kilocode prefix
Rename routes/skill.ts to routes/kilocode.ts with KilocodeRoutes export, mounted at /kilocode. This is the single home for all future kilo-specific CLI endpoints, avoiding conflicts with the existing /kilo gateway routes and keeping all kilo changes out of server.ts. SDK: client.kilocode.removeSkill()
This commit is contained in:
@@ -1139,7 +1139,7 @@ export class KiloProvider implements vscode.WebviewViewProvider, TelemetryProper
|
||||
if (!this.client) return
|
||||
try {
|
||||
const dir = this.getWorkspaceDirectory()
|
||||
await this.client.skill.remove({ location, directory: dir }, { throwOnError: true })
|
||||
await this.client.kilocode.removeSkill({ location, directory: dir }, { throwOnError: true })
|
||||
} catch (error) {
|
||||
console.error("[Kilo New] KiloProvider: Failed to remove skill:", error)
|
||||
}
|
||||
|
||||
+5
-3
@@ -1,4 +1,6 @@
|
||||
// kilocode_change - new file
|
||||
// Kilo-specific routes that live in the CLI package (direct access to internals).
|
||||
// All future kilo-specific endpoints should be added here.
|
||||
import { Hono } from "hono"
|
||||
import { describeRoute, validator, resolver } from "hono-openapi"
|
||||
import z from "zod"
|
||||
@@ -6,13 +8,13 @@ import { Skill } from "../../skill/skill"
|
||||
import { lazy } from "../../util/lazy"
|
||||
import { errors } from "../error"
|
||||
|
||||
export const SkillRoutes = lazy(() =>
|
||||
export const KilocodeRoutes = lazy(() =>
|
||||
new Hono().delete(
|
||||
"/",
|
||||
"/skill",
|
||||
describeRoute({
|
||||
summary: "Remove a skill",
|
||||
description: "Remove a skill by deleting its directory from disk and clearing it from cache.",
|
||||
operationId: "skill.remove",
|
||||
operationId: "kilocode.removeSkill",
|
||||
responses: {
|
||||
200: {
|
||||
description: "Skill removed",
|
||||
@@ -47,7 +47,7 @@ import { HTTPException } from "hono/http-exception"
|
||||
import { errors } from "./error"
|
||||
import { CommitMessageRoutes } from "./routes/commit-message"
|
||||
import { EnhancePromptRoutes } from "./routes/enhance-prompt" // kilocode_change
|
||||
import { SkillRoutes } from "./routes/skill" // kilocode_change
|
||||
import { KilocodeRoutes } from "./routes/kilocode" // kilocode_change
|
||||
import { QuestionRoutes } from "./routes/question"
|
||||
import { PermissionRoutes } from "./routes/permission"
|
||||
import { GlobalRoutes } from "./routes/global"
|
||||
@@ -269,7 +269,7 @@ export namespace Server {
|
||||
.route("/telemetry", TelemetryRoutes()) // kilocode_change
|
||||
.route("/commit-message", CommitMessageRoutes()) // kilocode_change
|
||||
.route("/enhance-prompt", EnhancePromptRoutes()) // kilocode_change
|
||||
.route("/skill", SkillRoutes()) // kilocode_change
|
||||
.route("/kilocode", KilocodeRoutes()) // kilocode_change
|
||||
// kilocode_change start - Kilo Gateway routes
|
||||
.route(
|
||||
"/kilo",
|
||||
|
||||
@@ -57,6 +57,8 @@ import type {
|
||||
KiloCloudSessionImportResponses,
|
||||
KiloCloudSessionsErrors,
|
||||
KiloCloudSessionsResponses,
|
||||
KilocodeRemoveSkillErrors,
|
||||
KilocodeRemoveSkillResponses,
|
||||
KiloFimErrors,
|
||||
KiloFimResponses,
|
||||
KiloNotificationsErrors,
|
||||
@@ -168,8 +170,6 @@ import type {
|
||||
SessionUnshareResponses,
|
||||
SessionUpdateErrors,
|
||||
SessionUpdateResponses,
|
||||
SkillRemoveErrors,
|
||||
SkillRemoveResponses,
|
||||
SubtaskPartInput,
|
||||
TelemetryCaptureErrors,
|
||||
TelemetryCaptureResponses,
|
||||
@@ -2930,13 +2930,13 @@ export class EnhancePrompt extends HeyApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
export class Skill extends HeyApiClient {
|
||||
export class Kilocode extends HeyApiClient {
|
||||
/**
|
||||
* Remove a skill
|
||||
*
|
||||
* Remove a skill by deleting its directory from disk and clearing it from cache.
|
||||
*/
|
||||
public remove<ThrowOnError extends boolean = false>(
|
||||
public removeSkill<ThrowOnError extends boolean = false>(
|
||||
parameters: {
|
||||
directory?: string
|
||||
workspace?: string
|
||||
@@ -2956,115 +2956,12 @@ export class Skill extends HeyApiClient {
|
||||
},
|
||||
],
|
||||
)
|
||||
return (options?.client ?? this.client).delete<SkillRemoveResponses, SkillRemoveErrors, ThrowOnError>({
|
||||
url: "/skill",
|
||||
...options,
|
||||
...params,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class App extends HeyApiClient {
|
||||
/**
|
||||
* List skills
|
||||
*
|
||||
* Get a list of all available skills in the OpenCode system.
|
||||
*/
|
||||
public skills<ThrowOnError extends boolean = false>(
|
||||
parameters?: {
|
||||
directory?: string
|
||||
workspace?: string
|
||||
},
|
||||
options?: Options<never, ThrowOnError>,
|
||||
) {
|
||||
const params = buildClientParams(
|
||||
[parameters],
|
||||
[
|
||||
{
|
||||
args: [
|
||||
{ in: "query", key: "directory" },
|
||||
{ in: "query", key: "workspace" },
|
||||
],
|
||||
},
|
||||
],
|
||||
)
|
||||
return (options?.client ?? this.client).get<AppSkillsResponses, unknown, ThrowOnError>({
|
||||
url: "/skill",
|
||||
...options,
|
||||
...params,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Write log
|
||||
*
|
||||
* Write a log entry to the server logs with specified level and metadata.
|
||||
*/
|
||||
public log<ThrowOnError extends boolean = false>(
|
||||
parameters?: {
|
||||
directory?: string
|
||||
workspace?: string
|
||||
service?: string
|
||||
level?: "debug" | "info" | "error" | "warn"
|
||||
message?: string
|
||||
extra?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
},
|
||||
options?: Options<never, ThrowOnError>,
|
||||
) {
|
||||
const params = buildClientParams(
|
||||
[parameters],
|
||||
[
|
||||
{
|
||||
args: [
|
||||
{ in: "query", key: "directory" },
|
||||
{ in: "query", key: "workspace" },
|
||||
{ in: "body", key: "service" },
|
||||
{ in: "body", key: "level" },
|
||||
{ in: "body", key: "message" },
|
||||
{ in: "body", key: "extra" },
|
||||
],
|
||||
},
|
||||
],
|
||||
)
|
||||
return (options?.client ?? this.client).post<AppLogResponses, AppLogErrors, ThrowOnError>({
|
||||
url: "/log",
|
||||
...options,
|
||||
...params,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...options?.headers,
|
||||
...params.headers,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* List agents
|
||||
*
|
||||
* Get a list of all available AI agents in the OpenCode system.
|
||||
*/
|
||||
public agents<ThrowOnError extends boolean = false>(
|
||||
parameters?: {
|
||||
directory?: string
|
||||
workspace?: string
|
||||
},
|
||||
options?: Options<never, ThrowOnError>,
|
||||
) {
|
||||
const params = buildClientParams(
|
||||
[parameters],
|
||||
[
|
||||
{
|
||||
args: [
|
||||
{ in: "query", key: "directory" },
|
||||
{ in: "query", key: "workspace" },
|
||||
],
|
||||
},
|
||||
],
|
||||
)
|
||||
return (options?.client ?? this.client).get<AppAgentsResponses, unknown, ThrowOnError>({
|
||||
url: "/agent",
|
||||
return (options?.client ?? this.client).delete<
|
||||
KilocodeRemoveSkillResponses,
|
||||
KilocodeRemoveSkillErrors,
|
||||
ThrowOnError
|
||||
>({
|
||||
url: "/kilocode/skill",
|
||||
...options,
|
||||
...params,
|
||||
})
|
||||
@@ -4397,6 +4294,113 @@ export class Command extends HeyApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
export class App extends HeyApiClient {
|
||||
/**
|
||||
* Write log
|
||||
*
|
||||
* Write a log entry to the server logs with specified level and metadata.
|
||||
*/
|
||||
public log<ThrowOnError extends boolean = false>(
|
||||
parameters?: {
|
||||
directory?: string
|
||||
workspace?: string
|
||||
service?: string
|
||||
level?: "debug" | "info" | "error" | "warn"
|
||||
message?: string
|
||||
extra?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
},
|
||||
options?: Options<never, ThrowOnError>,
|
||||
) {
|
||||
const params = buildClientParams(
|
||||
[parameters],
|
||||
[
|
||||
{
|
||||
args: [
|
||||
{ in: "query", key: "directory" },
|
||||
{ in: "query", key: "workspace" },
|
||||
{ in: "body", key: "service" },
|
||||
{ in: "body", key: "level" },
|
||||
{ in: "body", key: "message" },
|
||||
{ in: "body", key: "extra" },
|
||||
],
|
||||
},
|
||||
],
|
||||
)
|
||||
return (options?.client ?? this.client).post<AppLogResponses, AppLogErrors, ThrowOnError>({
|
||||
url: "/log",
|
||||
...options,
|
||||
...params,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...options?.headers,
|
||||
...params.headers,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* List agents
|
||||
*
|
||||
* Get a list of all available AI agents in the OpenCode system.
|
||||
*/
|
||||
public agents<ThrowOnError extends boolean = false>(
|
||||
parameters?: {
|
||||
directory?: string
|
||||
workspace?: string
|
||||
},
|
||||
options?: Options<never, ThrowOnError>,
|
||||
) {
|
||||
const params = buildClientParams(
|
||||
[parameters],
|
||||
[
|
||||
{
|
||||
args: [
|
||||
{ in: "query", key: "directory" },
|
||||
{ in: "query", key: "workspace" },
|
||||
],
|
||||
},
|
||||
],
|
||||
)
|
||||
return (options?.client ?? this.client).get<AppAgentsResponses, unknown, ThrowOnError>({
|
||||
url: "/agent",
|
||||
...options,
|
||||
...params,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* List skills
|
||||
*
|
||||
* Get a list of all available skills in the OpenCode system.
|
||||
*/
|
||||
public skills<ThrowOnError extends boolean = false>(
|
||||
parameters?: {
|
||||
directory?: string
|
||||
workspace?: string
|
||||
},
|
||||
options?: Options<never, ThrowOnError>,
|
||||
) {
|
||||
const params = buildClientParams(
|
||||
[parameters],
|
||||
[
|
||||
{
|
||||
args: [
|
||||
{ in: "query", key: "directory" },
|
||||
{ in: "query", key: "workspace" },
|
||||
],
|
||||
},
|
||||
],
|
||||
)
|
||||
return (options?.client ?? this.client).get<AppSkillsResponses, unknown, ThrowOnError>({
|
||||
url: "/skill",
|
||||
...options,
|
||||
...params,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class Lsp extends HeyApiClient {
|
||||
/**
|
||||
* Get LSP status
|
||||
@@ -4581,14 +4585,9 @@ export class KiloClient extends HeyApiClient {
|
||||
return (this._enhancePrompt ??= new EnhancePrompt({ client: this.client }))
|
||||
}
|
||||
|
||||
private _skill?: Skill
|
||||
get skill(): Skill {
|
||||
return (this._skill ??= new Skill({ client: this.client }))
|
||||
}
|
||||
|
||||
private _app?: App
|
||||
get app(): App {
|
||||
return (this._app ??= new App({ client: this.client }))
|
||||
private _kilocode?: Kilocode
|
||||
get kilocode(): Kilocode {
|
||||
return (this._kilocode ??= new Kilocode({ client: this.client }))
|
||||
}
|
||||
|
||||
private _kilo?: Kilo
|
||||
@@ -4636,6 +4635,11 @@ export class KiloClient extends HeyApiClient {
|
||||
return (this._command ??= new Command({ client: this.client }))
|
||||
}
|
||||
|
||||
private _app?: App
|
||||
get app(): App {
|
||||
return (this._app ??= new App({ client: this.client }))
|
||||
}
|
||||
|
||||
private _lsp?: Lsp
|
||||
get lsp(): Lsp {
|
||||
return (this._lsp ??= new Lsp({ client: this.client }))
|
||||
|
||||
@@ -4402,7 +4402,7 @@ export type EnhancePromptEnhanceResponses = {
|
||||
|
||||
export type EnhancePromptEnhanceResponse = EnhancePromptEnhanceResponses[keyof EnhancePromptEnhanceResponses]
|
||||
|
||||
export type SkillRemoveData = {
|
||||
export type KilocodeRemoveSkillData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query: {
|
||||
@@ -4410,50 +4410,26 @@ export type SkillRemoveData = {
|
||||
workspace?: string
|
||||
location: string
|
||||
}
|
||||
url: "/skill"
|
||||
url: "/kilocode/skill"
|
||||
}
|
||||
|
||||
export type SkillRemoveErrors = {
|
||||
export type KilocodeRemoveSkillErrors = {
|
||||
/**
|
||||
* Bad request
|
||||
*/
|
||||
400: BadRequestError
|
||||
}
|
||||
|
||||
export type SkillRemoveError = SkillRemoveErrors[keyof SkillRemoveErrors]
|
||||
export type KilocodeRemoveSkillError = KilocodeRemoveSkillErrors[keyof KilocodeRemoveSkillErrors]
|
||||
|
||||
export type SkillRemoveResponses = {
|
||||
export type KilocodeRemoveSkillResponses = {
|
||||
/**
|
||||
* Skill removed
|
||||
*/
|
||||
200: boolean
|
||||
}
|
||||
|
||||
export type SkillRemoveResponse = SkillRemoveResponses[keyof SkillRemoveResponses]
|
||||
|
||||
export type AppSkillsData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
workspace?: string
|
||||
}
|
||||
url: "/skill"
|
||||
}
|
||||
|
||||
export type AppSkillsResponses = {
|
||||
/**
|
||||
* List of skills
|
||||
*/
|
||||
200: Array<{
|
||||
name: string
|
||||
description: string
|
||||
location: string
|
||||
content: string
|
||||
}>
|
||||
}
|
||||
|
||||
export type AppSkillsResponse = AppSkillsResponses[keyof AppSkillsResponses]
|
||||
export type KilocodeRemoveSkillResponse = KilocodeRemoveSkillResponses[keyof KilocodeRemoveSkillResponses]
|
||||
|
||||
export type KiloProfileData = {
|
||||
body?: never
|
||||
@@ -5536,6 +5512,30 @@ export type AppAgentsResponses = {
|
||||
|
||||
export type AppAgentsResponse = AppAgentsResponses[keyof AppAgentsResponses]
|
||||
|
||||
export type AppSkillsData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
workspace?: string
|
||||
}
|
||||
url: "/skill"
|
||||
}
|
||||
|
||||
export type AppSkillsResponses = {
|
||||
/**
|
||||
* List of skills
|
||||
*/
|
||||
200: Array<{
|
||||
name: string
|
||||
description: string
|
||||
location: string
|
||||
content: string
|
||||
}>
|
||||
}
|
||||
|
||||
export type AppSkillsResponse = AppSkillsResponses[keyof AppSkillsResponses]
|
||||
|
||||
export type LspStatusData = {
|
||||
body?: never
|
||||
path?: never
|
||||
|
||||
+62
-60
@@ -5372,9 +5372,9 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/skill": {
|
||||
"/kilocode/skill": {
|
||||
"delete": {
|
||||
"operationId": "skill.remove",
|
||||
"operationId": "kilocode.removeSkill",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "query",
|
||||
@@ -5426,64 +5426,7 @@
|
||||
"x-codeSamples": [
|
||||
{
|
||||
"lang": "js",
|
||||
"source": "import { createKiloClient } from \"@kilocode/sdk\n\nconst client = createKiloClient()\nawait client.skill.remove({\n ...\n})"
|
||||
}
|
||||
]
|
||||
},
|
||||
"get": {
|
||||
"operationId": "app.skills",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "query",
|
||||
"name": "directory",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"in": "query",
|
||||
"name": "workspace",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"summary": "List skills",
|
||||
"description": "Get a list of all available skills in the OpenCode system.",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "List of skills",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"location": {
|
||||
"type": "string"
|
||||
},
|
||||
"content": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["name", "description", "location", "content"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-codeSamples": [
|
||||
{
|
||||
"lang": "js",
|
||||
"source": "import { createKiloClient } from \"@kilocode/sdk\n\nconst client = createKiloClient()\nawait client.app.skills({\n ...\n})"
|
||||
"source": "import { createKiloClient } from \"@kilocode/sdk\n\nconst client = createKiloClient()\nawait client.kilocode.removeSkill({\n ...\n})"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -7994,6 +7937,65 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/skill": {
|
||||
"get": {
|
||||
"operationId": "app.skills",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "query",
|
||||
"name": "directory",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"in": "query",
|
||||
"name": "workspace",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"summary": "List skills",
|
||||
"description": "Get a list of all available skills in the OpenCode system.",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "List of skills",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"location": {
|
||||
"type": "string"
|
||||
},
|
||||
"content": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["name", "description", "location", "content"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-codeSamples": [
|
||||
{
|
||||
"lang": "js",
|
||||
"source": "import { createKiloClient } from \"@kilocode/sdk\n\nconst client = createKiloClient()\nawait client.app.skills({\n ...\n})"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/lsp": {
|
||||
"get": {
|
||||
"operationId": "lsp.status",
|
||||
|
||||
Reference in New Issue
Block a user