Skip to content

Improve baml-cli help and global options - #4267

Merged
codeshaunted merged 4 commits into
canaryfrom
codex/cli-help-audit
Jul 29, 2026
Merged

codeshaunted merged 4 commits into
canaryfrom
codex/cli-help-audit

Conversation

@codeshaunted

@codeshaunted codeshaunted commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • align baml-cli command and option naming with Cargo and uv conventions, including global project and output controls with compatibility aliases
  • add concise root help plus styled detailed help with labeled examples for every public command
  • keep help pager-free for agent and PTY safety, and compact enum and feature documentation
  • use BAML purple for headings and terminal-controlled magenta for value placeholders

Testing

  • cargo test -p baml_exec
  • cargo test -p baml_cli
  • cargo clippy -p baml_cli -p baml_exec --all-targets -- -D warnings
  • cargo fmt --all -- --check

Summary by CodeRabbit

  • New Features

    • Added a dedicated baml help command with concise/detailed output and improved “unknown command” suggestions.
    • Added --include-generated to baml run.
    • Added --no-progress to disable progress output.
  • Improvements

    • Standardized project selection on --project; legacy --from remains hidden as an alias.
    • Updated workflows to clearer flags: agent install now uses --source, and editor install now uses --output-dir.
    • Improved --file vs project handling and updated/expanded help examples across many commands.
  • Documentation

    • Refreshed examples for baml check and baml playground to match the new flag usage.

@vercel

vercel Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
beps Ready Ready Preview, Comment Jul 29, 2026 1:56am
promptfiddle Ready Ready Preview, Comment Jul 29, 2026 1:56am
promptfiddle2 Ready Ready Preview, Comment Jul 29, 2026 1:56am

Request Review

@vercel
vercel Bot temporarily deployed to Preview – beps July 29, 2026 00:21 Inactive
@coderabbitai

coderabbitai Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e7262bed-b611-4bc1-a5e2-fa1ff585cb87

📥 Commits

Reviewing files that changed from the base of the PR and between 1878eeb and 03991b3.

📒 Files selected for processing (2)
  • baml_language/crates/baml_cli/src/commands.rs
  • baml_language/crates/baml_cli/src/help_command.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • baml_language/crates/baml_cli/src/commands.rs

📝 Walkthrough

Walkthrough

The CLI now centralizes global and compiler options, standardizes project-related aliases, adds a dedicated help command, expands command examples and headings, updates run/install behavior, and revises reporter and terminal help styling.

Changes

CLI overhaul

Layer / File(s) Summary
Runtime globals and project propagation
baml_language/crates/baml_cli/src/commands.rs, output.rs, reporter.rs, project_load.rs, Cargo.toml
Global project, directory, compiler, verbosity, progress, and help handling are centralized; project/file validation and reporter controls are updated.
Command argument contracts
baml_language/crates/baml_cli/src/*_command.rs, baml_keywords.yaml
Command options adopt flattened compiler arguments, deprecated aliases, renamed install/output flags, grouped help headings, and expanded examples.
Dedicated help rendering
baml_language/crates/baml_cli/src/help_command.rs, commands.rs, lib.rs
A help command resolves nested paths and renders concise or detailed styled output with formatted examples and command-resolution errors.
Execution behavior and validation
baml_language/crates/baml_cli/src/run_command.rs, pack_command.rs, test_command.rs, tests/*, baml_exec/src/clap_target.rs
Run listing, verbose diagnostics, profile validation, install coverage, CLI parsing tests, and terminal help color assertions follow the revised contracts.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant RuntimeCli
  participant HelpCommand
  participant Clap
  User->>RuntimeCli: invoke command or request help
  RuntimeCli->>HelpCommand: resolve requested command path
  HelpCommand->>Clap: render concise or detailed help
  Clap-->>User: print formatted help output
Loading

Possibly related PRs

Poem

A rabbit hops through flags anew,
With project paths in clearer view.
Help blooms bright in terminal light,
Run and install now guide just right.
Quiet paws make progress neat.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: broader baml-cli help improvements and new global option handling.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/cli-help-audit

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 July 29, 2026 00:28 Inactive

@coderabbitai coderabbitai 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.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
baml_language/crates/baml_cli/src/project_load.rs (1)

21-33: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

De-duplicate validate_file_project_flags.

This function is copy-pasted verbatim in baml_language/crates/baml_cli/src/run_command.rs (lines 22-33) and baml_language/crates/baml_cli/src/pack_command.rs (lines 22-33) — same signature, same body, same error text. Three independently-maintained copies means the --file/--project mutual-exclusion rule (and its wording) can silently drift; this PR itself had to edit all three in lockstep to rename the aliased flag.

Have run_command.rs and pack_command.rs call crate::project_load::validate_file_project_flags instead of redefining it.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@baml_language/crates/baml_cli/src/project_load.rs` around lines 21 - 33,
Remove the duplicate validate_file_project_flags definitions from run_command.rs
and pack_command.rs, and call crate::project_load::validate_file_project_flags
from their existing validation flows instead. Keep the shared implementation in
project_load.rs as the single source for the --file/--project mutual-exclusion
rule and error text.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@baml_language/crates/baml_cli/src/help_command.rs`:
- Around line 61-70: The error construction in the nearest-command handling must
account for leaf commands: when the filtered subcommand list produces an empty
choices string, report that the command has no subcommands or omit the
“Available commands” heading; retain the existing choices output when visible
subcommands exist.

In `@baml_language/crates/baml_cli/src/lsp.rs`:
- Around line 19-22: Update LspArgs::run and run_server to accept and propagate
compiler.features from LanguageServerArgs.compiler into server/LSP
initialization, preserving the existing workspace paths. Ensure -F/--features
values such as beta affect LSP diagnostics consistently with other CLI commands
instead of being ignored.

In `@baml_language/crates/baml_cli/src/run_command.rs`:
- Around line 1280-1282: Update the OutputFormat::Json branch and its
print_list_json/build_list_json_value flow to honor self.include_generated by
filtering generated functions when the flag is disabled, while retaining all
functions when enabled. Add JSON tests covering both include-generated states.

In `@baml_language/crates/baml_cli/src/test_command.rs`:
- Around line 66-67: The test command accepts CompilerArgs.features but does not
apply them during test execution. Update run_filtered_report and
list_selected_testset_names to merge CLI/profile CompilerArgs.features into the
effective features passed to testing.TestRegistry, preserving existing selector
arguments; alternatively, explicitly reject compiler features supplied through
profile args.

---

Outside diff comments:
In `@baml_language/crates/baml_cli/src/project_load.rs`:
- Around line 21-33: Remove the duplicate validate_file_project_flags
definitions from run_command.rs and pack_command.rs, and call
crate::project_load::validate_file_project_flags from their existing validation
flows instead. Keep the shared implementation in project_load.rs as the single
source for the --file/--project mutual-exclusion rule and error text.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d0bb4e35-1a0c-4eb3-9c13-2c9b15f5c7c0

📥 Commits

Reviewing files that changed from the base of the PR and between 8c8af41 and 168f824.

⛔ Files ignored due to path filters (6)
  • baml_language/crates/baml_cli/src/snapshots/baml_cli__describe_command_tests__render_keyword_check.snap is excluded by !**/*.snap
  • baml_language/crates/baml_cli/src/snapshots/baml_cli__describe_command_tests__render_keyword_playground.snap is excluded by !**/*.snap
  • baml_language/crates/baml_cli/src/snapshots/baml_cli__help_command__tests__describe_detailed_help.snap is excluded by !**/*.snap
  • baml_language/crates/baml_cli/src/snapshots/baml_cli__help_command__tests__root_concise_help.snap is excluded by !**/*.snap
  • baml_language/crates/baml_cli/src/snapshots/baml_cli__help_command__tests__run_detailed_help.snap is excluded by !**/*.snap
  • baml_language/crates/baml_cli/src/snapshots/baml_cli__help_command__tests__test_detailed_help.snap is excluded by !**/*.snap
📒 Files selected for processing (25)
  • baml_language/crates/baml_builtins2/keyword_docs/baml_keywords.yaml
  • baml_language/crates/baml_cli/Cargo.toml
  • baml_language/crates/baml_cli/src/agent_command.rs
  • baml_language/crates/baml_cli/src/auth.rs
  • baml_language/crates/baml_cli/src/check_command.rs
  • baml_language/crates/baml_cli/src/commands.rs
  • baml_language/crates/baml_cli/src/describe_command.rs
  • baml_language/crates/baml_cli/src/feedback_command.rs
  • baml_language/crates/baml_cli/src/format.rs
  • baml_language/crates/baml_cli/src/generate.rs
  • baml_language/crates/baml_cli/src/help_command.rs
  • baml_language/crates/baml_cli/src/ide_command.rs
  • baml_language/crates/baml_cli/src/init_command.rs
  • baml_language/crates/baml_cli/src/lib.rs
  • baml_language/crates/baml_cli/src/lsp.rs
  • baml_language/crates/baml_cli/src/output.rs
  • baml_language/crates/baml_cli/src/pack_command.rs
  • baml_language/crates/baml_cli/src/playground_command.rs
  • baml_language/crates/baml_cli/src/project_load.rs
  • baml_language/crates/baml_cli/src/reporter.rs
  • baml_language/crates/baml_cli/src/run_command.rs
  • baml_language/crates/baml_cli/src/telemetry_command.rs
  • baml_language/crates/baml_cli/src/test_command.rs
  • baml_language/crates/baml_cli/tests/agent_install_e2e.rs
  • baml_language/crates/baml_exec/src/clap_target.rs

@vercel
vercel Bot temporarily deployed to Preview – promptfiddle July 29, 2026 00:41 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle July 29, 2026 00:57 Inactive
@vercel
vercel Bot temporarily deployed to Preview – beps July 29, 2026 00:58 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 July 29, 2026 01:06 Inactive

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
baml_language/crates/baml_cli/src/output.rs (1)

43-51: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Missing env support for --no-progress, unlike sibling global options.

Every other flag in OutputArgs (preset, color, hyperlinks, diagnostic_format) supports an environment-variable override (BAML_OUTPUT_PRESET, BAML_COLOR, BAML_HYPERLINKS, BAML_DIAGNOSTIC_FORMAT), which is especially useful in CI/agent contexts where flags aren't always convenient to set. no_progress breaks this pattern with no env attribute, making it harder to disable progress output from an environment (e.g. BAML_NO_PROGRESS=1) without threading a CLI flag through every invocation.

♻️ Suggested addition
     #[arg(
         long,
+        env = "BAML_NO_PROGRESS",
         global = true,
         help = "Disable progress output",
+        hide_env = true,
         help_heading = "Global options",
         display_order = 40
     )]
     pub no_progress: bool,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@baml_language/crates/baml_cli/src/output.rs` around lines 43 - 51, Add the
matching environment-variable configuration to the no_progress field in
OutputArgs, using the established env naming and parsing pattern from preset,
color, hyperlinks, and diagnostic_format so BAML_NO_PROGRESS can disable
progress output.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@baml_language/crates/baml_cli/src/output.rs`:
- Around line 43-51: Add the matching environment-variable configuration to the
no_progress field in OutputArgs, using the established env naming and parsing
pattern from preset, color, hyperlinks, and diagnostic_format so
BAML_NO_PROGRESS can disable progress output.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 092d6ba1-4ae3-48e1-9d08-122ef58ce380

📥 Commits

Reviewing files that changed from the base of the PR and between 168f824 and f2e5cf7.

📒 Files selected for processing (4)
  • baml_language/crates/baml_cli/src/commands.rs
  • baml_language/crates/baml_cli/src/output.rs
  • baml_language/crates/baml_cli/src/reporter.rs
  • baml_language/crates/baml_cli/src/test_command.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • baml_language/crates/baml_cli/src/test_command.rs
  • baml_language/crates/baml_cli/src/commands.rs

@codeshaunted
codeshaunted force-pushed the codex/cli-help-audit branch from f2e5cf7 to 1878eeb Compare July 29, 2026 01:32
@github-actions

Copy link
Copy Markdown

⏭️ Performance benchmarks were skipped

Perf benchmarks (CodSpeed) are opt-in on pull requests — they no longer run on every push. They always run automatically after merge to canary/main.

To run them on this PR, do any of the following, then push a commit (or re-run CI):

  • Add RUN_CODSPEED=1 to the PR description, or
  • Include run-perf or /perf in the PR title or any commit message.

@vercel
vercel Bot temporarily deployed to Preview – beps July 29, 2026 01:33 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 July 29, 2026 01:40 Inactive
@github-actions

github-actions Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

Binary size checks passed

✅ 7 passed

Artifact Platform File Gzip Gated on Baseline Delta Status
✅ baml-cli Linux 🔒 27.4 MB 11.7 MB file 27.3 MB +74.9 KB (+0.3%) OK
✅ packed-program Linux 🔒 17.8 MB 7.3 MB file 17.7 MB +30.6 KB (+0.2%) OK
✅ baml-cli macOS 🔒 21.3 MB 10.2 MB file 21.2 MB +49.7 KB (+0.2%) OK
✅ packed-program macOS 🔒 13.9 MB 6.4 MB file 13.9 MB +32 B (+0.0%) OK
✅ baml-cli Windows 🔒 22.9 MB 10.4 MB file 22.9 MB +56.3 KB (+0.2%) OK
✅ packed-program Windows 🔒 14.8 MB 6.5 MB file 14.8 MB +14.7 KB (+0.1%) OK
✅ bridge_wasm WASM 16.6 MB 🔒 4.5 MB gzip 4.5 MB +10.8 KB (+0.2%) OK

🔒 = the size this artifact is GATED on (ceiling + delta). Binaries gate on file size (installed binary); WASM gates on gzip (download size). The other size is shown for information only.


Generated by cargo size-gate · workflow run

@vercel
vercel Bot temporarily deployed to Preview – promptfiddle July 29, 2026 01:48 Inactive
@vercel
vercel Bot temporarily deployed to Preview – beps July 29, 2026 01:49 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 July 29, 2026 01:56 Inactive
@codeshaunted
codeshaunted added this pull request to the merge queue Jul 29, 2026
Merged via the queue into canary with commit fb2527c Jul 29, 2026
83 checks passed
@codeshaunted
codeshaunted deleted the codex/cli-help-audit branch July 29, 2026 02:20

This branch was previously deployed

3 inactive deployments
Preview – promptfiddle2 — 03991b35 Deployed Jul 29, 2026 by vercel[bot]
Preview – beps — 03991b35 Deployed Jul 29, 2026 by vercel[bot]
Preview – promptfiddle — 03991b35 Deployed Jul 29, 2026 by vercel[bot]
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.

1 participant