(context: vscode.ExtensionContext)
| 6 | import { ensureSettingsDirectoryExists } from "../../../utils/globalContext" |
| 7 | |
| 8 | export async function getModesSection(context: vscode.ExtensionContext): Promise<string> { |
| 9 | // Make sure path gets created |
| 10 | await ensureSettingsDirectoryExists(context) |
| 11 | |
| 12 | // Get all modes with their overrides from extension state |
| 13 | const allModes = await getAllModesWithPrompts(context) |
| 14 | |
| 15 | const modesContent = `==== |
| 16 | |
| 17 | MODES |
| 18 | |
| 19 | - These are the currently available modes: |
| 20 | ${allModes |
| 21 | .map((mode: ModeConfig) => { |
| 22 | let description: string |
| 23 | if (mode.whenToUse && mode.whenToUse.trim() !== "") { |
| 24 | // Use whenToUse as the primary description, indenting subsequent lines for readability |
| 25 | description = mode.whenToUse.replace(/\n/g, "\n ") |
| 26 | } else { |
| 27 | // Fallback to the first sentence of roleDefinition if whenToUse is not available |
| 28 | description = mode.roleDefinition.split(".")[0] |
| 29 | } |
| 30 | return ` * "${mode.name}" mode (${mode.slug}) - ${description}` |
| 31 | }) |
| 32 | .join("\n")}` |
| 33 | |
| 34 | return modesContent |
| 35 | } |
no test coverage detected