| 1 | import { CustomCommand, SlashCommandWithSource } from "../.."; |
| 2 | |
| 3 | export function convertCustomCommandToSlashCommand( |
| 4 | customCommand: CustomCommand, |
| 5 | ): SlashCommandWithSource { |
| 6 | const commandName = customCommand.name.startsWith("/") |
| 7 | ? customCommand.name.substring(1) |
| 8 | : customCommand.name; |
| 9 | return { |
| 10 | name: commandName, |
| 11 | description: customCommand.description ?? "", |
| 12 | prompt: customCommand.prompt, |
| 13 | source: "json-custom-command", |
| 14 | promptFile: customCommand.sourceFile, // TODO refactor promptFile to align with sourceFile |
| 15 | }; |
| 16 | } |