@@ -352,23 +352,64 @@ function nonEmptyProbeString(value: string): string | undefined {
352352function parseClaudeInitializationCommands (
353353 commands : ReadonlyArray < ClaudeSlashCommand > | undefined ,
354354) : ReadonlyArray < ServerProviderSlashCommand > {
355- return ( commands ?? [ ] ) . flatMap ( ( command ) => {
355+ return dedupeSlashCommands (
356+ ( commands ?? [ ] ) . flatMap ( ( command ) => {
357+ const name = nonEmptyProbeString ( command . name ) ;
358+ if ( ! name ) {
359+ return [ ] ;
360+ }
361+
362+ const description = nonEmptyProbeString ( command . description ) ;
363+ const argumentHint = nonEmptyProbeString ( command . argumentHint ) ;
364+
365+ return [
366+ {
367+ name,
368+ ...( description ? { description } : { } ) ,
369+ ...( argumentHint ? { input : { hint : argumentHint } } : { } ) ,
370+ } satisfies ServerProviderSlashCommand ,
371+ ] ;
372+ } ) ,
373+ ) ;
374+ }
375+
376+ function dedupeSlashCommands (
377+ commands : ReadonlyArray < ServerProviderSlashCommand > ,
378+ ) : ReadonlyArray < ServerProviderSlashCommand > {
379+ const commandsByName = new Map < string , ServerProviderSlashCommand > ( ) ;
380+
381+ for ( const command of commands ) {
356382 const name = nonEmptyProbeString ( command . name ) ;
357383 if ( ! name ) {
358- return [ ] ;
384+ continue ;
359385 }
360386
361- const description = nonEmptyProbeString ( command . description ) ;
362- const argumentHint = nonEmptyProbeString ( command . argumentHint ) ;
363-
364- return [
365- {
387+ const key = name . toLowerCase ( ) ;
388+ const existing = commandsByName . get ( key ) ;
389+ if ( ! existing ) {
390+ commandsByName . set ( key , {
391+ ... command ,
366392 name,
367- ...( description ? { description } : { } ) ,
368- ...( argumentHint ? { input : { hint : argumentHint } } : { } ) ,
369- } satisfies ServerProviderSlashCommand ,
370- ] ;
371- } ) ;
393+ } ) ;
394+ continue ;
395+ }
396+
397+ commandsByName . set ( key , {
398+ ...existing ,
399+ ...( existing . description
400+ ? { }
401+ : command . description
402+ ? { description : command . description }
403+ : { } ) ,
404+ ...( existing . input ?. hint
405+ ? { }
406+ : command . input ?. hint
407+ ? { input : { hint : command . input . hint } }
408+ : { } ) ,
409+ } ) ;
410+ }
411+
412+ return [ ...commandsByName . values ( ) ] ;
372413}
373414
374415/**
@@ -534,6 +575,7 @@ export const checkClaudeProviderStatus = Effect.fn("checkClaudeProviderStatus")(
534575 Effect . orElseSucceed ( ( ) => undefined ) ,
535576 )
536577 : undefined ) ?? [ ] ;
578+ const dedupedSlashCommands = dedupeSlashCommands ( slashCommands ) ;
537579
538580 // ── Auth check + subscription detection ────────────────────────────
539581
@@ -569,7 +611,7 @@ export const checkClaudeProviderStatus = Effect.fn("checkClaudeProviderStatus")(
569611 enabled : claudeSettings . enabled ,
570612 checkedAt,
571613 models,
572- slashCommands,
614+ slashCommands : dedupedSlashCommands ,
573615 probe : {
574616 installed : true ,
575617 version : parsedVersion ,
@@ -589,7 +631,7 @@ export const checkClaudeProviderStatus = Effect.fn("checkClaudeProviderStatus")(
589631 enabled : claudeSettings . enabled ,
590632 checkedAt,
591633 models,
592- slashCommands,
634+ slashCommands : dedupedSlashCommands ,
593635 probe : {
594636 installed : true ,
595637 version : parsedVersion ,
@@ -607,7 +649,7 @@ export const checkClaudeProviderStatus = Effect.fn("checkClaudeProviderStatus")(
607649 enabled : claudeSettings . enabled ,
608650 checkedAt,
609651 models,
610- slashCommands,
652+ slashCommands : dedupedSlashCommands ,
611653 probe : {
612654 installed : true ,
613655 version : parsedVersion ,
0 commit comments