Skip to content

Commit 01c5dba

Browse files
feat: add shell completion for analyze command types (#321)
## Summary - Adds a `ValidArgsFunction` to the `analyze` cobra command so that tab-completing the first positional argument suggests the 7 available analyzer types (`test-fixtures`, `duplication`, `refactor`, `complexity`, `api-design`, `dead-code`, `architecture`) with their descriptions - After the analyzer type is selected, completion falls back to default file path completion ## Test plan - [ ] Run `roborev analyze <TAB>` and verify all 7 analyzer types appear with descriptions - [ ] Run `roborev analyze refactor <TAB>` and verify file path completion works - [ ] Verify `go build ./...` passes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9a7c3ff commit 01c5dba

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

cmd/roborev/analyze.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,18 @@ func analyzeCmd() *cobra.Command {
4545
cmd := &cobra.Command{
4646
Use: "analyze <type> <files...>",
4747
Short: "Run built-in analysis on files",
48+
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
49+
if len(args) == 0 {
50+
// Complete analysis type names
51+
var completions []string
52+
for _, t := range analyze.AllTypes {
53+
completions = append(completions, t.Name+"\t"+t.Description)
54+
}
55+
return completions, cobra.ShellCompDirectiveNoFileComp
56+
}
57+
// After the type, complete file paths
58+
return nil, cobra.ShellCompDirectiveDefault
59+
},
4860
Long: `Run a built-in analysis type on one or more files.
4961
5062
This command provides predefined analysis prompts for common code review

0 commit comments

Comments
 (0)