feat(config): list valid providers in unknown provider error#221
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
📜 Recent review details🧰 Additional context used📓 Path-based instructions (3)src/**/*.ts📄 CodeRabbit inference engine (AGENTS.md)
Files:
src/providers/**/*.ts📄 CodeRabbit inference engine (AGENTS.md)
Files:
tests/**/*.mjs📄 CodeRabbit inference engine (AGENTS.md)
Files:
🔇 Additional comments (3)
📝 WalkthroughWalkthroughThe config command now lists valid provider keys when rejecting an unknown provider. The provider-key helper is exported for reuse, and the config command test verifies the expanded error message. ChangesProvider validation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
commit-echo config set provider <key>rejected unknown provider keys with onlyUnknown provider: <key>., giving users no hint about which providers are available. This aligns the error message with the pattern already used inassertKnownProviderinside the provider layer.Root cause
parseConfigSetValueinsrc/commands/config.tsthrew a bare error mentioning only the invalid key, whileassertKnownProviderinsrc/providers/index.tsalready listed valid options in its error. The two paths were inconsistent.Changes
src/providers/index.ts: exportgetValidProviderKeys()so it can be reused by the config command.src/commands/config.ts: importgetValidProviderKeysand include the valid provider list in theconfig set providererror message.tests/config-command.test.mjs: extend the existing unknown-provider test to assert that the error output containsValid providers:and mentions at leastopenaiandanthropic.Testing
npm run build— compiles cleanlynode --test tests/config-command.test.mjs— 24 tests, 22 pass (2 pre-existing unrelated JSON-output failures)node --test tests/provider-validation.test.mjs— 3 tests, all passnpm run format:check— no formatting issues in changed filesCompatibility
No breaking changes. The error message now includes extra helpful text; existing scripts that regex-match
Unknown provider:will still match.Fixes #216
Summary by CodeRabbit
Bug Fixes
Documentation