| 1 | import { SlashCommandWithSource } from "../.."; |
| 2 | import { parsePromptFile } from "../../promptFiles/parsePromptFile"; |
| 3 | |
| 4 | export function slashCommandFromPromptFile( |
| 5 | path: string, |
| 6 | content: string, |
| 7 | ): SlashCommandWithSource | null { |
| 8 | const { name, description, systemMessage, prompt, version } = parsePromptFile( |
| 9 | path, |
| 10 | content, |
| 11 | ); |
| 12 | |
| 13 | return { |
| 14 | name, |
| 15 | description, |
| 16 | prompt, |
| 17 | source: version === 1 ? "prompt-file-v1" : "prompt-file-v2", |
| 18 | promptFile: path, |
| 19 | overrideSystemMessage: systemMessage, |
| 20 | }; |
| 21 | } |