Repository navigation
Improve baml-cli help and global options - #4267
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe 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. ChangesCLI overhaul
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
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
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 winDe-duplicate
validate_file_project_flags.This function is copy-pasted verbatim in
baml_language/crates/baml_cli/src/run_command.rs(lines 22-33) andbaml_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/--projectmutual-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.rsandpack_command.rscallcrate::project_load::validate_file_project_flagsinstead 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
⛔ Files ignored due to path filters (6)
baml_language/crates/baml_cli/src/snapshots/baml_cli__describe_command_tests__render_keyword_check.snapis excluded by!**/*.snapbaml_language/crates/baml_cli/src/snapshots/baml_cli__describe_command_tests__render_keyword_playground.snapis excluded by!**/*.snapbaml_language/crates/baml_cli/src/snapshots/baml_cli__help_command__tests__describe_detailed_help.snapis excluded by!**/*.snapbaml_language/crates/baml_cli/src/snapshots/baml_cli__help_command__tests__root_concise_help.snapis excluded by!**/*.snapbaml_language/crates/baml_cli/src/snapshots/baml_cli__help_command__tests__run_detailed_help.snapis excluded by!**/*.snapbaml_language/crates/baml_cli/src/snapshots/baml_cli__help_command__tests__test_detailed_help.snapis excluded by!**/*.snap
📒 Files selected for processing (25)
baml_language/crates/baml_builtins2/keyword_docs/baml_keywords.yamlbaml_language/crates/baml_cli/Cargo.tomlbaml_language/crates/baml_cli/src/agent_command.rsbaml_language/crates/baml_cli/src/auth.rsbaml_language/crates/baml_cli/src/check_command.rsbaml_language/crates/baml_cli/src/commands.rsbaml_language/crates/baml_cli/src/describe_command.rsbaml_language/crates/baml_cli/src/feedback_command.rsbaml_language/crates/baml_cli/src/format.rsbaml_language/crates/baml_cli/src/generate.rsbaml_language/crates/baml_cli/src/help_command.rsbaml_language/crates/baml_cli/src/ide_command.rsbaml_language/crates/baml_cli/src/init_command.rsbaml_language/crates/baml_cli/src/lib.rsbaml_language/crates/baml_cli/src/lsp.rsbaml_language/crates/baml_cli/src/output.rsbaml_language/crates/baml_cli/src/pack_command.rsbaml_language/crates/baml_cli/src/playground_command.rsbaml_language/crates/baml_cli/src/project_load.rsbaml_language/crates/baml_cli/src/reporter.rsbaml_language/crates/baml_cli/src/run_command.rsbaml_language/crates/baml_cli/src/telemetry_command.rsbaml_language/crates/baml_cli/src/test_command.rsbaml_language/crates/baml_cli/tests/agent_install_e2e.rsbaml_language/crates/baml_exec/src/clap_target.rs
There was a problem hiding this comment.
🧹 Nitpick comments (1)
baml_language/crates/baml_cli/src/output.rs (1)
43-51: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMissing
envsupport 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_progressbreaks this pattern with noenvattribute, 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
📒 Files selected for processing (4)
baml_language/crates/baml_cli/src/commands.rsbaml_language/crates/baml_cli/src/output.rsbaml_language/crates/baml_cli/src/reporter.rsbaml_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
f2e5cf7 to
1878eeb
Compare
⏭️ Performance benchmarks were skippedPerf benchmarks (CodSpeed) are opt-in on pull requests — they no longer run on every push. They always run automatically after merge to To run them on this PR, do any of the following, then push a commit (or re-run CI):
|
Binary size checks passed✅ 7 passed
Generated by |
Summary
Testing
Summary by CodeRabbit
New Features
baml helpcommand with concise/detailed output and improved “unknown command” suggestions.--include-generatedtobaml run.--no-progressto disable progress output.Improvements
--project; legacy--fromremains hidden as an alias.agent installnow uses--source, and editor install now uses--output-dir.--filevs project handling and updated/expanded help examples across many commands.Documentation
baml checkandbaml playgroundto match the new flag usage.