mirror of
https://github.com/alibaba/open-code-review.git
synced 2026-08-04 22:11:05 +00:00
|
Some checks are pending
CI / test (push) Waiting to run
CI / cross-compile (amd64, darwin) (push) Waiting to run
CI / cross-compile (amd64, windows) (push) Waiting to run
CI / cross-compile (arm64, darwin) (push) Waiting to run
CI / cross-compile (arm64, linux) (push) Waiting to run
CI / cross-compile (arm64, windows) (push) Waiting to run
Deploy Pages / build (push) Waiting to run
Deploy Pages / deploy (push) Blocked by required conditions
* refactor(cli): migrate to Cobra framework for shell completion support Replace the hand-rolled ocrFlagSet + switch dispatch with spf13/cobra, enabling native bash/zsh/fish/powershell completion via `ocr completion`. Key changes: - Add root.go (rootCmd definition, version flag with -V shorthand) - Add completion.go (ocr completion [bash|zsh|fish|powershell]) - Add shared_flags.go (reusable flag registration helpers + validation) - Rewrite all *_cmd.go to use cobra.Command with RunE - Delete flags.go (ocrFlagSet, expandShortFlags, parseXxxFlags) - Add compat_test.go (test compatibility wrappers for existing tests) - Promote github.com/spf13/cobra from indirect to direct dependency Behavioral improvements over the previous implementation: - Shell completion for all commands, flags, and enum values - "Did you mean?" suggestions for misspelled commands - cobra.NoArgs on review/scan prevents silent positional arg ignoring - Cleaner error messages on unknown flags (no full flag dump) - Consistent help output format across all subcommands Closes #576 * fix(cli): add Args: cobra.NoArgs to viewerCmd Prevents `ocr viewer localhost:3000` from silently ignoring the positional argument and starting on the default address. Consistent with reviewCmd and scanCmd. * feat(cli): add "Did you mean?" suggestions for misspelled flags Cobra only suggests corrections for unknown subcommands, not flags. Add a levenshtein-distance based suggestion that fires when cobra returns an "unknown flag" error, matching the same UX pattern. Examples: --hel → Did you mean this? --help --audienc → Did you mean this? --audience --comit → Did you mean this? --commit * fix(deps): promote spf13/pflag to direct dependency After the Cobra migration, pflag is directly imported but was still marked as indirect in go.mod, causing CI's go-mod-tidy check to fail. * refactor(cli): use idiomatic cobra patterns for args validation and flag errors Replace hand-rolled argument validation in configSetCmd/configUnsetCmd with cobra.ExactArgs, and move flag typo suggestions from post-hoc error string parsing into SetFlagErrorFunc where cobra provides the command context directly. |
||
|---|---|---|
| .. | ||
| background_file.go | ||
| background_file_test.go | ||
| budget_output_test.go | ||
| compat_test.go | ||
| completion.go | ||
| config_cmd.go | ||
| config_cmd_test.go | ||
| config_dispatch_test.go | ||
| delegate_cmd.go | ||
| emit_run_result_test.go | ||
| flag_suggest.go | ||
| flags_test.go | ||
| git.go | ||
| git_test.go | ||
| llm_cmd.go | ||
| main.go | ||
| output.go | ||
| output_helpers_test.go | ||
| output_test.go | ||
| procattr_unix.go | ||
| procattr_windows.go | ||
| provider_cmd.go | ||
| provider_cmd_test.go | ||
| provider_tui.go | ||
| provider_tui_funcs_test.go | ||
| provider_tui_test.go | ||
| review_cmd.go | ||
| review_cmd_test.go | ||
| root.go | ||
| rules_cmd.go | ||
| scan_cmd.go | ||
| scan_cmd_test.go | ||
| session_cmd.go | ||
| session_cmd_test.go | ||
| shared.go | ||
| shared_flags.go | ||
| shared_test.go | ||
| shell_unix.go | ||
| shell_windows.go | ||
| smallfiles_test.go | ||
| version.go | ||
| viewer_cmd.go | ||