@@ -43,6 +43,7 @@ npm run build
4343 source : "project" ,
4444 filePath : path . join ( "/test/cwd" , ".roo" , "commands" , "setup.md" ) ,
4545 description : "Sets up the development environment" ,
46+ argumentHint : undefined ,
4647 } )
4748 } )
4849
@@ -66,6 +67,7 @@ npm run build
6667 source : "project" ,
6768 filePath : path . join ( "/test/cwd" , ".roo" , "commands" , "setup.md" ) ,
6869 description : undefined ,
70+ argumentHint : undefined ,
6971 } )
7072 } )
7173
@@ -108,6 +110,7 @@ Command content here.`
108110 source : "project" ,
109111 filePath : path . join ( "/test/cwd" , ".roo" , "commands" , "setup.md" ) ,
110112 description : undefined ,
113+ argumentHint : undefined ,
111114 } )
112115 } )
113116
@@ -142,6 +145,7 @@ Global setup instructions.`
142145 source : "project" ,
143146 filePath : path . join ( "/test/cwd" , ".roo" , "commands" , "setup.md" ) ,
144147 description : "Project-specific setup" ,
148+ argumentHint : undefined ,
145149 } )
146150 } )
147151
@@ -168,10 +172,118 @@ Global setup instructions.`
168172 source : "global" ,
169173 filePath : expect . stringContaining ( path . join ( ".roo" , "commands" , "setup.md" ) ) ,
170174 description : "Global setup command" ,
175+ argumentHint : undefined ,
171176 } )
172177 } )
173178 } )
174179
180+ describe ( "argument-hint functionality" , ( ) => {
181+ it ( "should load command with argument-hint from frontmatter" , async ( ) => {
182+ const commandContent = `---
183+ description: Create a new release of the Roo Code extension
184+ argument-hint: patch | minor | major
185+ ---
186+
187+ # Release Command
188+
189+ Create a new release.`
190+
191+ mockFs . stat = vi . fn ( ) . mockResolvedValue ( { isDirectory : ( ) => true } )
192+ mockFs . readFile = vi . fn ( ) . mockResolvedValue ( commandContent )
193+
194+ const result = await getCommand ( "/test/cwd" , "release" )
195+
196+ expect ( result ) . toEqual ( {
197+ name : "release" ,
198+ content : "# Release Command\n\nCreate a new release." ,
199+ source : "project" ,
200+ filePath : path . join ( "/test/cwd" , ".roo" , "commands" , "release.md" ) ,
201+ description : "Create a new release of the Roo Code extension" ,
202+ argumentHint : "patch | minor | major" ,
203+ } )
204+ } )
205+
206+ it ( "should handle command with both description and argument-hint" , async ( ) => {
207+ const commandContent = `---
208+ description: Deploy application to environment
209+ argument-hint: staging | production
210+ author: DevOps Team
211+ ---
212+
213+ # Deploy Command
214+
215+ Deploy the application.`
216+
217+ mockFs . stat = vi . fn ( ) . mockResolvedValue ( { isDirectory : ( ) => true } )
218+ mockFs . readFile = vi . fn ( ) . mockResolvedValue ( commandContent )
219+
220+ const result = await getCommand ( "/test/cwd" , "deploy" )
221+
222+ expect ( result ) . toEqual ( {
223+ name : "deploy" ,
224+ content : "# Deploy Command\n\nDeploy the application." ,
225+ source : "project" ,
226+ filePath : path . join ( "/test/cwd" , ".roo" , "commands" , "deploy.md" ) ,
227+ description : "Deploy application to environment" ,
228+ argumentHint : "staging | production" ,
229+ } )
230+ } )
231+
232+ it ( "should handle empty argument-hint in frontmatter" , async ( ) => {
233+ const commandContent = `---
234+ description: Test command
235+ argument-hint: ""
236+ ---
237+
238+ # Test Command
239+
240+ Test content.`
241+
242+ mockFs . stat = vi . fn ( ) . mockResolvedValue ( { isDirectory : ( ) => true } )
243+ mockFs . readFile = vi . fn ( ) . mockResolvedValue ( commandContent )
244+
245+ const result = await getCommand ( "/test/cwd" , "test" )
246+
247+ expect ( result ?. argumentHint ) . toBeUndefined ( )
248+ } )
249+
250+ it ( "should handle whitespace-only argument-hint in frontmatter" , async ( ) => {
251+ const commandContent = `---
252+ description: Test command
253+ argument-hint: " "
254+ ---
255+
256+ # Test Command
257+
258+ Test content.`
259+
260+ mockFs . stat = vi . fn ( ) . mockResolvedValue ( { isDirectory : ( ) => true } )
261+ mockFs . readFile = vi . fn ( ) . mockResolvedValue ( commandContent )
262+
263+ const result = await getCommand ( "/test/cwd" , "test" )
264+
265+ expect ( result ?. argumentHint ) . toBeUndefined ( )
266+ } )
267+
268+ it ( "should handle non-string argument-hint in frontmatter" , async ( ) => {
269+ const commandContent = `---
270+ description: Test command
271+ argument-hint: 123
272+ ---
273+
274+ # Test Command
275+
276+ Test content.`
277+
278+ mockFs . stat = vi . fn ( ) . mockResolvedValue ( { isDirectory : ( ) => true } )
279+ mockFs . readFile = vi . fn ( ) . mockResolvedValue ( commandContent )
280+
281+ const result = await getCommand ( "/test/cwd" , "test" )
282+
283+ expect ( result ?. argumentHint ) . toBeUndefined ( )
284+ } )
285+ } )
286+
175287 describe ( "getCommands with frontmatter" , ( ) => {
176288 it ( "should load multiple commands with descriptions" , async ( ) => {
177289 const setupContent = `---
@@ -215,14 +327,62 @@ Build instructions without frontmatter.`
215327 expect . objectContaining ( {
216328 name : "setup" ,
217329 description : "Sets up the development environment" ,
330+ argumentHint : undefined ,
218331 } ) ,
219332 expect . objectContaining ( {
220333 name : "deploy" ,
221334 description : "Deploys the application to production" ,
335+ argumentHint : undefined ,
222336 } ) ,
223337 expect . objectContaining ( {
224338 name : "build" ,
225339 description : undefined ,
340+ argumentHint : undefined ,
341+ } ) ,
342+ ] ) ,
343+ )
344+ } )
345+
346+ it ( "should load multiple commands with argument hints" , async ( ) => {
347+ const releaseContent = `---
348+ description: Create a new release
349+ argument-hint: patch | minor | major
350+ ---
351+
352+ # Release Command
353+
354+ Create a release.`
355+
356+ const deployContent = `---
357+ description: Deploy to environment
358+ argument-hint: staging | production
359+ ---
360+
361+ # Deploy Command
362+
363+ Deploy the app.`
364+
365+ mockFs . stat = vi . fn ( ) . mockResolvedValue ( { isDirectory : ( ) => true } )
366+ mockFs . readdir = vi . fn ( ) . mockResolvedValue ( [
367+ { name : "release.md" , isFile : ( ) => true } ,
368+ { name : "deploy.md" , isFile : ( ) => true } ,
369+ ] )
370+ mockFs . readFile = vi . fn ( ) . mockResolvedValueOnce ( releaseContent ) . mockResolvedValueOnce ( deployContent )
371+
372+ const result = await getCommands ( "/test/cwd" )
373+
374+ expect ( result ) . toHaveLength ( 2 )
375+ expect ( result ) . toEqual (
376+ expect . arrayContaining ( [
377+ expect . objectContaining ( {
378+ name : "release" ,
379+ description : "Create a new release" ,
380+ argumentHint : "patch | minor | major" ,
381+ } ) ,
382+ expect . objectContaining ( {
383+ name : "deploy" ,
384+ description : "Deploy to environment" ,
385+ argumentHint : "staging | production" ,
226386 } ) ,
227387 ] ) ,
228388 )
0 commit comments