Skip to content

feat: add /model pro|flash shortcuts and CLI model set command#3350

Closed
KUK4 wants to merge 2 commits into
Hmbown:mainfrom
KUK4:main
Closed

feat: add /model pro|flash shortcuts and CLI model set command#3350
KUK4 wants to merge 2 commits into
Hmbown:mainfrom
KUK4:main

Conversation

@KUK4

@KUK4 KUK4 commented Jun 20, 2026

Copy link
Copy Markdown
Contributor
  • Add 'pro' and 'flash' aliases to canonical_model_name in tui config
  • Add 'codewhale model set' CLI subcommand with pro/flash shortcuts
  • Supports deepseek-v4-pro, deepseek-v4-flash, and future deepseek models

Summary

Testing

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features
  • cargo test --workspace --all-features

Checklist

  • Updated docs or comments as needed
  • Added or updated tests where relevant
  • Verified TUI behavior manually if UI changes
  • Harvested/co-authored credit uses a GitHub numeric noreply address

- Add 'pro' and 'flash' aliases to canonical_model_name in tui config
- Add 'codewhale model set' CLI subcommand with pro/flash shortcuts
- Supports deepseek-v4-pro, deepseek-v4-flash, and future deepseek models
@KUK4 KUK4 requested a review from Hmbown as a code owner June 20, 2026 09:53

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@github-actions

Copy link
Copy Markdown

Thanks @KUK4 for taking the time to contribute.

This repository is observing a maintainer-managed PR intake gate in dry-run mode, so this pull request is staying open. This note helps maintainers prepare the allowlist before any enforcement is considered.

Please read CONTRIBUTING.md for the expected contribution shape. A maintainer can grant recurring PR access by commenting /lgtm on a pull request.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new ModelCommand::Set subcommand to the CLI, allowing users to set a default text model with shortcuts for 'pro' and 'flash' models, and updates the TUI configuration to recognize these shortcuts. However, the review feedback notes that the current implementation of ModelCommand::Set is overly restrictive because it rejects non-DeepSeek models, which breaks the ability to set other supported providers. Additionally, a widespread character encoding issue has corrupted various non-ASCII characters (such as em-dashes, arrows, bullets, and checkmarks) into ? or ? across multiple files, which needs to be reverted.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread crates/cli/src/lib.rs
Comment on lines +1527 to +1545
ModelCommand::Set { model } => {
let canonical = match model.trim().to_ascii_lowercase().as_str() {
"pro" | "deepseek-v4-pro" | "deepseek-v4pro" => "deepseek-v4-pro",
"flash" | "deepseek-v4-flash" | "deepseek-v4flash" => "deepseek-v4-flash",
other => {
if other.starts_with("deepseek") {
other
} else {
bail!(
"Invalid model '{model}'. Use 'pro', 'flash', 'deepseek-v4-pro', or 'deepseek-v4-flash'."
);
}
}
};
store.config.default_text_model = Some(canonical.to_string());
store.save()?;
println!("Default model set to '{canonical}'");
Ok(())
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The current implementation of ModelCommand::Set strictly rejects any model name that does not start with "deepseek" (unless it matches the "pro" or "flash" shortcuts). Since CodeWhale supports other providers (such as OpenAI, Anthropic, etc.), this restriction completely breaks the ability for non-DeepSeek users to set their default model (e.g., codewhale model set claude-sonnet-4-6 will fail).

We should allow any non-empty model name to be set, while still supporting the "pro" and "flash" shortcuts for DeepSeek.

        ModelCommand::Set { model } => {
            let trimmed = model.trim();
            if trimmed.is_empty() {
                bail!("Model name cannot be empty");
            }
            let canonical = match trimmed.to_ascii_lowercase().as_str() {
                "pro" | "deepseek-v4-pro" | "deepseek-v4pro" => "deepseek-v4-pro".to_string(),
                "flash" | "deepseek-v4-flash" | "deepseek-v4flash" => "deepseek-v4-flash".to_string(),
                _ => trimmed.to_string(),
            };
            store.config.default_text_model = Some(canonical.clone());
            store.save()?;
            println!("Default model set to '{canonical}'");
            Ok(())
        }

Comment thread crates/cli/src/lib.rs Outdated
#[arg(long, value_enum)]
provider: ProviderArg,
/// Inline value (discouraged appears in shell history).
/// Inline value (discouraged �?appears in shell history).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

It appears that a character encoding issue has corrupted several non-ASCII characters (such as em-dashes , arrows , bullets , and checkmarks ) into ? or ? across multiple files in this pull request. Please restore the original UTF-8 characters to prevent corrupted help text and CLI output.

Suggested change
/// Inline value (discouraged �?appears in shell history).
/// Inline value (discouraged appears in shell history).

Comment thread crates/cli/src/lib.rs Outdated
Comment on lines +2003 to +2005
�?npm: npm install -g codewhale (downloads both binaries)\n\
�?cargo: cargo install codewhale-cli codewhale-tui --locked\n\
�?GitHub Releases: download BOTH `codewhale-<platform>` AND \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The bullet points in this user-facing help message have been corrupted to ?. Please restore the original bullet characters.

- ModelCommand::Set now accepts any non-empty model name, not just deepseek*
- Keeps pro/flash shortcuts for DeepSeek models
- Restore UTF-8 characters corrupted by prior Set-Content

Addresses review feedback on PR Hmbown#3350

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Hmbown added a commit that referenced this pull request Jun 22, 2026
Harvest the useful model shortcut slice from PR #3350 by @KUK4 while preserving existing case-sensitive model ID behavior. The CLI now accepts model set pro or flash, and config normalization maps the short aliases to the current DeepSeek v4 IDs without rewriting already-valid model IDs.

Harvested from PR #3350 by @KUK4

Co-authored-by: KUK4 <246008043+KUK4@users.noreply.github.com>
@Hmbown

Hmbown commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Thanks @KUK4 — I harvested the useful model shortcut slice into the v0.8.64 integration branch as 7bfc87062, with your numeric GitHub noreply credit recorded in .github/AUTHOR_MAP and the commit trailer.

I kept the pro / flash shortcuts, but tightened the implementation so already-valid mixed-case model IDs keep their existing case-preserving behavior. Local verification included:

  • cargo test -p codewhale-cli --locked parses_model_command_matrix
  • cargo test -p codewhale-tui --bin codewhale-tui --locked normalize_model_name_preserves_v_series_snapshots
  • RUSTFLAGS=-Dwarnings cargo check -p codewhale-cli -p codewhale-tui --locked
  • python3 scripts/check-coauthor-trailers.py --author-map .github/AUTHOR_MAP --range origin/codex/v0.8.64-integration..HEAD --check-authors

I am leaving this PR open until the integration branch lands so the public state stays accurate.

@github-actions

Copy link
Copy Markdown

Thanks @KUK4 — your contribution landed in 7bfc8706224d on main:

feat(models): add pro and flash shortcuts

Closing this PR now that the code is on main. Credit lives in the commit message and (where applicable) the CHANGELOG.md entry for the next release. Apologies for not closing this at the time of the merge — the auto-close workflow is new in v0.8.31.

If you want to land more work and would prefer your future PRs merge cleanly without a harvest step, the CONTRIBUTING.md doc has a short note on what makes a contribution mergeable as-is.

@github-actions github-actions Bot closed this Jun 22, 2026
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