feat(command): identify command sources
This commit is contained in:
parent
0e705e2a05
commit
3cd894d40a
4 changed files with 10 additions and 3 deletions
|
|
@ -85,6 +85,7 @@ export const layer = (options?: ShellSelect.Options) => Layer.effect(
|
|||
name: mcpCommandName(prompt.server, prompt.name),
|
||||
template: "",
|
||||
description: prompt.description,
|
||||
source: "mcp",
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
|
@ -98,7 +99,10 @@ export const layer = (options?: ShellSelect.Options) => Layer.effect(
|
|||
return (yield* mcpCommands()).find((command) => command.name === name)
|
||||
}),
|
||||
list: Effect.fn("CommandV2.list")(function* () {
|
||||
const commands = Array.from(state.get().commands.values()) as Info[]
|
||||
const commands = Array.from(state.get().commands.values()).map((command) => ({
|
||||
...command,
|
||||
source: command.source ?? "command" as const,
|
||||
}))
|
||||
const names = new Set(commands.map((command) => command.name))
|
||||
return [
|
||||
...commands,
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ describe("CommandV2", () => {
|
|||
providerID: ProviderV2.ID.make("anthropic"),
|
||||
variant: ModelV2.VariantID.make("high"),
|
||||
},
|
||||
source: "command",
|
||||
}),
|
||||
])
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -95,9 +95,10 @@ Review files`,
|
|||
variant: ModelV2.VariantID.make("high"),
|
||||
},
|
||||
subtask: true,
|
||||
source: "command",
|
||||
}),
|
||||
CommandV2.Info.make({ name: "empty", template: "" }),
|
||||
CommandV2.Info.make({ name: "nested/docs", template: "Write docs" }),
|
||||
CommandV2.Info.make({ name: "empty", template: "", source: "command" }),
|
||||
CommandV2.Info.make({ name: "nested/docs", template: "Write docs", source: "command" }),
|
||||
])
|
||||
|
||||
yield* Effect.promise(() => fs.writeFile(path.join(tmp.path, "commands", "review.md"), "Review again"))
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ export const Info = Schema.Struct({
|
|||
agent: Agent.ID.pipe(optional),
|
||||
model: Model.Ref.pipe(optional),
|
||||
subtask: Schema.Boolean.pipe(optional),
|
||||
source: Schema.Literals(["command", "mcp"]).pipe(optional),
|
||||
}).annotate({ identifier: "Command.Info" })
|
||||
|
||||
export const Event = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue