Skip to content

feat(ai): add configurable model env vars and ai env flags#19

Merged
dubscode merged 1 commit intomainfrom
codex/configurable-ai-model-env
Mar 3, 2026
Merged

feat(ai): add configurable model env vars and ai env flags#19
dubscode merged 1 commit intomainfrom
codex/configurable-ai-model-env

Conversation

@dubscode
Copy link
Copy Markdown
Contributor

@dubscode dubscode commented Mar 3, 2026

Summary

  • add model override env vars for AI provider selection: DUBSTACK_GEMINI_MODEL and DUBSTACK_AI_GATEWAY_MODEL
  • extend dub ai env with --gemini-model and --gateway-model, and allow model-only updates
  • apply soft validation for model values (non-empty; Gemini model rejects / form)
  • use model overrides in both dub ai ask and dub create --ai with existing defaults unchanged
  • update README examples and add/expand tests for env config + model resolution paths

Test Plan

  • pnpm vitest run src/commands/ai-env.test.ts src/commands/ai.test.ts src/commands/create.test.ts src/lib/history.test.ts
  • pnpm test
  • pnpm typecheck
  • pnpm checks

- add DUBSTACK_GEMINI_MODEL and DUBSTACK_AI_GATEWAY_MODEL support

- extend dub ai env with --gemini-model and --gateway-model

- allow model-only env updates with soft validation

- update ask/create model resolution, docs, and tests
Copilot AI review requested due to automatic review settings March 3, 2026 02:10
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds configurable AI model environment variables (DUBSTACK_GEMINI_MODEL and DUBSTACK_AI_GATEWAY_MODEL) that allow users to override the model used by both dub ai ask and dub create --ai without changing provider credentials. It also extends dub ai env with --gemini-model and --gateway-model flags for writing model overrides to shell profiles, updates the README with examples, and adds validation (blocking empty or slash-containing Gemini model names via the CLI).

Changes:

  • ai-env.ts/ai-env.test.ts: Added model validation functions (normalizeGeminiModel, normalizeGatewayModel) and updated the guard logic to allow model-only updates without keys
  • ai.ts/create.ts + their tests: Updated resolveModel in both commands to read DUBSTACK_GEMINI_MODEL/DUBSTACK_AI_GATEWAY_MODEL env vars, falling back to the new defaults (gemini-3-flash-preview and google/gemini-3-flash)
  • README.md/index.ts/history.test.ts: Documentation and CLI option registration for the new flags

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/commands/ai-env.ts Adds model options, validation functions, and updated no-op guard
src/commands/ai-env.test.ts Tests for model writes, key+model together, empty/slash validation, and updated no-arg error
src/commands/ai.ts resolveModel now reads DUBSTACK_GEMINI_MODEL/DUBSTACK_AI_GATEWAY_MODEL with fallback defaults
src/commands/create.ts Same resolveModel update as ai.ts
src/commands/ai.test.ts Tests for Gemini and Gateway model overrides in askAi; updates default model expectation
src/commands/create.test.ts Tests for Gemini and Gateway model overrides in create --ai
src/lib/history.test.ts Confirms --gemini-model / --gateway-model args are not redacted from history
src/index.ts Registers --gemini-model and --gateway-model options on dub ai env
README.md Updated provider/key selection docs and added model-override examples

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
@dubscode dubscode merged commit 776c0a7 into main Mar 3, 2026
7 checks passed
@dubscode dubscode deleted the codex/configurable-ai-model-env branch March 3, 2026 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants