Repository navigation
Conversation
Fixes google-gemini#27847 `gemini --list-models` prints the available model options from the default model configuration as JSON and exits, enabling programmatic model discovery without entering the interactive REPL.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the CLI by adding a --list-models flag, which provides a machine-readable JSON output of available models. This change simplifies integration for external tools by allowing them to programmatically discover model options without entering the interactive REPL, while maintaining consistency with existing CLI exit patterns. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
📊 PR Size: size/S
|
|
You already have 7 pull requests open. Please work on getting existing PRs merged before opening more. |
There was a problem hiding this comment.
Code Review
This pull request introduces a new --list-models CLI option to print available model configurations as JSON. The review feedback points out that the imports for ModelConfigService and DEFAULT_MODEL_CONFIGS from @google/gemini-cli-core should be imported directly from the package entry point rather than using deep imports from the internal src/ directory, which violates package boundaries and repository import conventions.
| import { ModelConfigService } from '@google/gemini-cli-core/src/services/modelConfigService.js'; | ||
| import { DEFAULT_MODEL_CONFIGS } from '@google/gemini-cli-core/src/config/defaultModelConfigs.js'; |
There was a problem hiding this comment.
Avoid deep imports from the internal src/ directory of other packages (e.g., @google/gemini-cli-core/src/...). This violates package boundaries, can cause issues with bundling/compilation, and goes against the repository's import conventions. Instead, export ModelConfigService and DEFAULT_MODEL_CONFIGS from the @google/gemini-cli-core entry point and import them directly from the package.
| import { ModelConfigService } from '@google/gemini-cli-core/src/services/modelConfigService.js'; | |
| import { DEFAULT_MODEL_CONFIGS } from '@google/gemini-cli-core/src/config/defaultModelConfigs.js'; | |
| import { ModelConfigService, DEFAULT_MODEL_CONFIGS } from '@google/gemini-cli-core'; |
References
- Imports: Use specific imports and avoid restricted relative imports between packages (enforced by ESLint). (link)
Summary
gemini --list-modelsflag that prints available model options as JSON and exits.--helpand--version.ModelConfigService.getAvailableModelOptions({})on the default model config — no auth required, reflects what is available without preview access.Example output
$ gemini --list-models [ { "modelId": "auto", "name": "Auto", "description": "...", "tier": "auto" }, ... ]Related Issues
Fixes #27847
How to Validate
npm run build node packages/cli/dist/gemini.js --list-models # Should print JSON array of model objects and exitPre-Merge Checklist