| 1 | import { |
| 2 | SlashCommand, |
| 3 | SlashCommandDescription, |
| 4 | SlashCommandWithSource, |
| 5 | } from "../../.."; |
| 6 | import GenerateTerminalCommand from "./cmd"; |
| 7 | import CommitMessageCommand from "./commit"; |
| 8 | import DraftIssueCommand from "./draftIssue"; |
| 9 | import HttpSlashCommand from "./http"; |
| 10 | import OnboardSlashCommand from "./onboard"; |
| 11 | import ReviewMessageCommand from "./review"; |
| 12 | import ShareSlashCommand from "./share"; |
| 13 | |
| 14 | const LegacyBuiltInSlashCommands: SlashCommand[] = [ |
| 15 | DraftIssueCommand, |
| 16 | ShareSlashCommand, |
| 17 | GenerateTerminalCommand, |
| 18 | HttpSlashCommand, |
| 19 | CommitMessageCommand, |
| 20 | ReviewMessageCommand, |
| 21 | OnboardSlashCommand, |
| 22 | ]; |
| 23 | |
| 24 | export function getLegacyBuiltInSlashCommandFromDescription( |
| 25 | desc: SlashCommandDescription, |
| 26 | ): SlashCommandWithSource | undefined { |
| 27 | const cmd = LegacyBuiltInSlashCommands.find((cmd) => cmd.name === desc.name); |
| 28 | if (!cmd) { |
| 29 | return undefined; |
| 30 | } |
| 31 | return { |
| 32 | ...cmd, |
| 33 | params: desc.params, |
| 34 | description: desc.description ?? cmd.description, |
| 35 | source: "built-in-legacy", |
| 36 | }; |
| 37 | } |