diff --git a/packages/kilo-vscode/src/KiloProvider.ts b/packages/kilo-vscode/src/KiloProvider.ts index 34a1a3dbdf5..d833f9e0c09 100644 --- a/packages/kilo-vscode/src/KiloProvider.ts +++ b/packages/kilo-vscode/src/KiloProvider.ts @@ -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) } diff --git a/packages/opencode/src/server/routes/skill.ts b/packages/opencode/src/server/routes/kilocode.ts similarity index 79% rename from packages/opencode/src/server/routes/skill.ts rename to packages/opencode/src/server/routes/kilocode.ts index fbf49607166..60d077fe1b5 100644 --- a/packages/opencode/src/server/routes/skill.ts +++ b/packages/opencode/src/server/routes/kilocode.ts @@ -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", diff --git a/packages/opencode/src/server/server.ts b/packages/opencode/src/server/server.ts index 80ce513cb09..9d7026dc9d4 100644 --- a/packages/opencode/src/server/server.ts +++ b/packages/opencode/src/server/server.ts @@ -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", diff --git a/packages/sdk/js/src/v2/gen/sdk.gen.ts b/packages/sdk/js/src/v2/gen/sdk.gen.ts index 60c3805c7ab..b88b95c24a7 100644 --- a/packages/sdk/js/src/v2/gen/sdk.gen.ts +++ b/packages/sdk/js/src/v2/gen/sdk.gen.ts @@ -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( + public removeSkill( parameters: { directory?: string workspace?: string @@ -2956,115 +2956,12 @@ export class Skill extends HeyApiClient { }, ], ) - return (options?.client ?? this.client).delete({ - url: "/skill", - ...options, - ...params, - }) - } -} - -export class App extends HeyApiClient { - /** - * List skills - * - * Get a list of all available skills in the OpenCode system. - */ - public skills( - parameters?: { - directory?: string - workspace?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "query", key: "directory" }, - { in: "query", key: "workspace" }, - ], - }, - ], - ) - return (options?.client ?? this.client).get({ - url: "/skill", - ...options, - ...params, - }) - } - - /** - * Write log - * - * Write a log entry to the server logs with specified level and metadata. - */ - public log( - parameters?: { - directory?: string - workspace?: string - service?: string - level?: "debug" | "info" | "error" | "warn" - message?: string - extra?: { - [key: string]: unknown - } - }, - options?: Options, - ) { - 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({ - 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( - parameters?: { - directory?: string - workspace?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "query", key: "directory" }, - { in: "query", key: "workspace" }, - ], - }, - ], - ) - return (options?.client ?? this.client).get({ - 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( + parameters?: { + directory?: string + workspace?: string + service?: string + level?: "debug" | "info" | "error" | "warn" + message?: string + extra?: { + [key: string]: unknown + } + }, + options?: Options, + ) { + 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({ + 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( + parameters?: { + directory?: string + workspace?: string + }, + options?: Options, + ) { + const params = buildClientParams( + [parameters], + [ + { + args: [ + { in: "query", key: "directory" }, + { in: "query", key: "workspace" }, + ], + }, + ], + ) + return (options?.client ?? this.client).get({ + url: "/agent", + ...options, + ...params, + }) + } + + /** + * List skills + * + * Get a list of all available skills in the OpenCode system. + */ + public skills( + parameters?: { + directory?: string + workspace?: string + }, + options?: Options, + ) { + const params = buildClientParams( + [parameters], + [ + { + args: [ + { in: "query", key: "directory" }, + { in: "query", key: "workspace" }, + ], + }, + ], + ) + return (options?.client ?? this.client).get({ + 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 })) diff --git a/packages/sdk/js/src/v2/gen/types.gen.ts b/packages/sdk/js/src/v2/gen/types.gen.ts index cc00335cfd2..47c1300d35f 100644 --- a/packages/sdk/js/src/v2/gen/types.gen.ts +++ b/packages/sdk/js/src/v2/gen/types.gen.ts @@ -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 diff --git a/packages/sdk/openapi.json b/packages/sdk/openapi.json index bed3949ac4b..5e09dbd374e 100644 --- a/packages/sdk/openapi.json +++ b/packages/sdk/openapi.json @@ -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",