(stripped string, registry *skills.SkillRegistry, cwd string)
| 99 | } |
| 100 | |
| 101 | func completeSlashCommand(stripped string, registry *skills.SkillRegistry, cwd string) []Completion { |
| 102 | seen := map[string]struct{}{} |
| 103 | items := IterCommandCompletionItems(registry, cwd) |
| 104 | completions := make([]Completion, 0, len(items)) |
| 105 | for _, item := range items { |
| 106 | if _, ok := seen[item.Name]; ok || !strings.HasPrefix(item.Name, stripped) { |
| 107 | continue |
| 108 | } |
| 109 | seen[item.Name] = struct{}{} |
| 110 | meta := item.Description |
| 111 | if commandMeta, ok := CommandMeta[item.Name]; ok { |
| 112 | meta = commandMeta |
| 113 | } |
| 114 | completions = append(completions, Completion{ |
| 115 | Text: item.Name, |
| 116 | StartPosition: -len(stripped), |
| 117 | Display: item.Name, |
| 118 | DisplayMeta: meta, |
| 119 | }) |
| 120 | } |
| 121 | return completions |
| 122 | } |
| 123 | |
| 124 | func splitPathFragment(fragment string) (string, string) { |
| 125 | if fragment == "" { |
no test coverage detected