@@ -17,6 +17,8 @@ import { FileContextTracker } from "../context-tracking/FileContextTracker"
1717
1818import { RooIgnoreController } from "../ignore/RooIgnoreController"
1919import { getCommand , type Command } from "../../services/command/commands"
20+ import { buildSkillResult , resolveSkillContentForMode , type SkillLookup } from "../../services/skills/skillInvocation"
21+ import type { SkillContent } from "../../shared/skills"
2022
2123export async function openMention ( cwd : string , mention ?: string ) : Promise < void > {
2224 if ( ! mention ) {
@@ -102,9 +104,12 @@ export async function parseMentions(
102104 showRooIgnoredFiles : boolean = false ,
103105 includeDiagnosticMessages : boolean = true ,
104106 maxDiagnosticMessages : number = 50 ,
107+ skillsManager ?: SkillLookup ,
108+ currentMode : string = "code" ,
105109) : Promise < ParseMentionsResult > {
106110 const mentions : Set < string > = new Set ( )
107111 const validCommands : Map < string , Command > = new Map ( )
112+ const validSkills : Map < string , SkillContent > = new Map ( )
108113 const contentBlocks : MentionContentBlock [ ] = [ ]
109114 let commandMode : string | undefined // Track mode from the first slash command that has one
110115
@@ -116,29 +121,39 @@ export async function parseMentions(
116121 Array . from ( uniqueCommandNames ) . map ( async ( commandName ) => {
117122 try {
118123 const command = await getCommand ( cwd , commandName )
119- return { commandName, command }
124+ if ( command ) {
125+ return { commandName, command, skillContent : null }
126+ }
127+
128+ const skillContent = await resolveSkillContentForMode ( skillsManager , commandName , currentMode )
129+ return { commandName, command : undefined , skillContent }
120130 } catch ( error ) {
121131 // If there's an error checking command existence, treat it as non-existent
122- return { commandName, command : undefined }
132+ return { commandName, command : undefined , skillContent : null }
123133 }
124134 } ) ,
125135 )
126136
127137 // Store valid commands for later use and capture the first mode found
128- for ( const { commandName, command } of commandExistenceChecks ) {
138+ for ( const { commandName, command, skillContent } of commandExistenceChecks ) {
129139 if ( command ) {
130140 validCommands . set ( commandName , command )
131141 // Capture the mode from the first command that has one
132142 if ( ! commandMode && command . mode ) {
133143 commandMode = command . mode
134144 }
145+ continue
146+ }
147+
148+ if ( skillContent ) {
149+ validSkills . set ( commandName , skillContent )
135150 }
136151 }
137152
138153 // Only replace text for commands that actually exist (keep "see below" for commands)
139154 let parsedText = text
140155 for ( const [ match , commandName ] of commandMatches ) {
141- if ( validCommands . has ( commandName ) ) {
156+ if ( validCommands . has ( commandName ) || validSkills . has ( commandName ) ) {
142157 parsedText = parsedText . replace ( match , `Command '${ commandName } ' (see below for command content)` )
143158 }
144159 }
@@ -231,6 +246,10 @@ export async function parseMentions(
231246 }
232247 }
233248
249+ for ( const [ skillName , skillContent ] of validSkills ) {
250+ slashCommandHelp += `\n\n${ buildSkillResult ( skillName , undefined , skillContent ) } `
251+ }
252+
234253 return {
235254 text : parsedText ,
236255 contentBlocks,
0 commit comments