|
|
@@ -6,6 +6,7 @@ import { Identifier } from "../id/id"
|
|
|
import PROMPT_INITIALIZE from "./template/initialize.txt"
|
|
|
import PROMPT_REVIEW from "./template/review.txt"
|
|
|
import { MCP } from "../mcp"
|
|
|
+import { Skill } from "../skill"
|
|
|
|
|
|
export namespace Command {
|
|
|
export const Event = {
|
|
|
@@ -26,7 +27,7 @@ export namespace Command {
|
|
|
description: z.string().optional(),
|
|
|
agent: z.string().optional(),
|
|
|
model: z.string().optional(),
|
|
|
- mcp: z.boolean().optional(),
|
|
|
+ source: z.enum(["command", "mcp", "skill"]).optional(),
|
|
|
// workaround for zod not supporting async functions natively so we use getters
|
|
|
// https://zod.dev/v4/changelog?id=zfunction
|
|
|
template: z.promise(z.string()).or(z.string()),
|
|
|
@@ -94,7 +95,7 @@ export namespace Command {
|
|
|
for (const [name, prompt] of Object.entries(await MCP.prompts())) {
|
|
|
result[name] = {
|
|
|
name,
|
|
|
- mcp: true,
|
|
|
+ source: "mcp",
|
|
|
description: prompt.description,
|
|
|
get template() {
|
|
|
// since a getter can't be async we need to manually return a promise here
|
|
|
@@ -118,6 +119,21 @@ export namespace Command {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // Add skills as invokable commands
|
|
|
+ for (const skill of await Skill.all()) {
|
|
|
+ // Skip if a command with this name already exists
|
|
|
+ if (result[skill.name]) continue
|
|
|
+ result[skill.name] = {
|
|
|
+ name: skill.name,
|
|
|
+ description: skill.description,
|
|
|
+ source: "skill",
|
|
|
+ get template() {
|
|
|
+ return skill.content
|
|
|
+ },
|
|
|
+ hints: [],
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return result
|
|
|
})
|
|
|
|