Skip to content

Commit 182679d

Browse files
authored
Add support for slash command frontmatter descriptions (#6314)
1 parent 03ce1e5 commit 182679d

File tree

26 files changed

+347
-21
lines changed

26 files changed

+347
-21
lines changed

pnpm-lock.yaml

Lines changed: 43 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/core/mentions/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,12 @@ export async function parseMentions(
218218
try {
219219
const command = await getCommand(cwd, commandName)
220220
if (command) {
221-
parsedText += `\n\n<command name="${commandName}">\n${command.content}\n</command>`
221+
let commandOutput = ""
222+
if (command.description) {
223+
commandOutput += `Description: ${command.description}\n\n`
224+
}
225+
commandOutput += command.content
226+
parsedText += `\n\n<command name="${commandName}">\n${commandOutput}\n</command>`
222227
} else {
223228
parsedText += `\n\n<command name="${commandName}">\nCommand '${commandName}' not found. Available commands can be found in .roo/commands/ or ~/.roo/commands/\n</command>`
224229
}

src/core/webview/webviewMessageHandler.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2366,6 +2366,7 @@ export const webviewMessageHandler = async (
23662366
name: command.name,
23672367
source: command.source,
23682368
filePath: command.filePath,
2369+
description: command.description,
23692370
}))
23702371

23712372
await provider.postMessageToWebview({
@@ -2524,6 +2525,7 @@ export const webviewMessageHandler = async (
25242525
name: command.name,
25252526
source: command.source,
25262527
filePath: command.filePath,
2528+
description: command.description,
25272529
}))
25282530
await provider.postMessageToWebview({
25292531
type: "commands",

src/i18n/locales/ca/common.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/de/common.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/en/common.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"no_workspace_for_project_command": "No workspace folder found for project command",
7878
"command_already_exists": "Command \"{{commandName}}\" already exists",
7979
"create_command_failed": "Failed to create command",
80-
"command_template_content": "This is a new slash command. Edit this file to customize the command behavior.",
80+
"command_template_content": "---\ndescription: \"Brief description of what this command does\"\n---\n\nThis is a new slash command. Edit this file to customize the command behavior.",
8181
"claudeCode": {
8282
"processExited": "Claude Code process exited with code {{exitCode}}.",
8383
"errorOutput": "Error output: {{output}}",

src/i18n/locales/es/common.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/fr/common.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/hi/common.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/id/common.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)