mirror of
https://github.com/alibaba/open-code-review.git
synced 2026-07-10 01:39:12 +00:00
* feat: add ability to delete custom providers from configuration Implements GitHub issue #136. CLI: add 'ocr config unset custom_providers.<name>' command to delete a custom provider from config. If the deleted provider is the active one, clears 'provider' and 'model' fields and prompts the user. TUI: press 'd' on Custom tab to delete a provider with y/n confirmation. Shows warning when deleting the active provider. Deletions are persisted even if the user cancels provider selection afterward. - Add runConfigUnset() with key validation and active-provider handling - Add 'unset' case to parseConfigArgs() and printConfigUsage() - Add delete confirmation state machine to providerTUIModel - Add applyProviderDeletions() helper in provider_cmd.go - Add 10 new tests covering CLI parsing, deletion logic, and TUI flows - Update README with unset command documentation * fix: address PR review feedback - Add defensive bounds check for deleteTargetIdx before deletion - Use explicit slice copy to avoid retaining references (memory leak) - Update subCmd comment to reflect 'set' and 'unset' values * refactor: extract shared deleteCustomProvider and improve test coverage Address PR review feedback from lizhengfeng101: - Extract deleteCustomProvider() as a pure function shared by both runConfigUnset (CLI) and applyProviderDeletions (TUI) - Extract unsetCustomProvider() accepting configPath for testability - Add existence check in applyProviderDeletions (skip non-existent providers) - Rewrite 3 tests to call actual functions instead of inlining logic - Remove unused strings import from config_cmd_test.go * style: use [ocr] WARNING prefix for active provider deletion messages Align with project convention (output.go, flags.go): warnings use '[ocr] WARNING' prefix and write to stderr instead of stdout. * fix: address second round of PR review feedback - Fix test state pollution in TestUnsetInvalidKey: use t.Run sub-tests with independent config files per case (#7) - Log warning instead of silently swallowing errors in applyProviderDeletions (#9) - Add comment explaining existingCfg snapshot assumption in viewCustomTab (#10) - Simplify runConfigUnset error message to single line for consistency with project style (#11) |
||
|---|---|---|
| .. | ||
| opencodereview | ||
| testdiff | ||