Unify CLI output and wrapper-owned help - #4243
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
⏭️ 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):
|
📝 WalkthroughWalkthroughThis PR adds the shared ChangesShell and CLI integration
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant Baml as baml wrapper
participant CLI as baml-cli
participant Shell as baml_shell::Shell
User->>Baml: request root help
Baml->>CLI: request RootHelpV1 metadata
CLI-->>Baml: return serialized help metadata
Baml->>Baml: add toolchain and self-update commands
Baml->>Shell: render merged help
Shell-->>User: print root help
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts
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 |
Binary size checks passed✅ 7 passed
Generated by |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
baml_language/crates/baml/src/main.rs (1)
406-435: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider logging the discarded root-help fallback reason.
toolchain_root_help's failure (spawn error, non-zero exit, JSON parse error, orvalidate()failure) is discarded viaErr(_)before falling back topass_through_resolved. If a futurebaml-cliregresses its root-help metadata, this fails silently every time with no diagnostic trail. The file already has a convention for this (crate::bytecode_cache::cache_debuginrun_command.rs) — consider a similar low-noise debug log here.♻️ Example
- Err(_) => pass_through_resolved(shell, original_args, resolved), + Err(err) => { + // Low-noise breadcrumb; doesn't affect user-visible fallback behavior. + crate::debug_log(format_args!("root-help metadata rejected: {err:#}")); + pass_through_resolved(shell, original_args, resolved) + }🤖 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/src/main.rs` around lines 406 - 435, Update the Err(_) branch in root_help to capture the toolchain_root_help failure and emit a low-noise debug diagnostic using the existing crate::bytecode_cache::cache_debug convention before calling pass_through_resolved. Preserve the fallback behavior and original arguments unchanged, while including enough error context to identify why root-help metadata was unavailable.
🤖 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/src/main.rs`:
- Around line 406-435: Update the Err(_) branch in root_help to capture the
toolchain_root_help failure and emit a low-noise debug diagnostic using the
existing crate::bytecode_cache::cache_debug convention before calling
pass_through_resolved. Preserve the fallback behavior and original arguments
unchanged, while including enough error context to identify why root-help
metadata was unavailable.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 891c4484-bef6-4a21-b371-0006d3ba8954
⛔ Files ignored due to path filters (1)
baml_language/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (27)
baml_language/Cargo.tomlbaml_language/crates/baml/Cargo.tomlbaml_language/crates/baml/src/main.rsbaml_language/crates/baml/tests/freshness_e2e.rsbaml_language/crates/baml/tests/no_self_update_e2e.rsbaml_language/crates/baml_cli/Cargo.tomlbaml_language/crates/baml_cli/src/auth.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/grep_command.rsbaml_language/crates/baml_cli/src/lib.rsbaml_language/crates/baml_cli/src/main.rsbaml_language/crates/baml_cli/src/output.rsbaml_language/crates/baml_cli/src/reporter.rsbaml_language/crates/baml_cli/src/run_command.rsbaml_language/crates/baml_cli/src/telemetry/storage.rsbaml_language/crates/baml_cli/src/telemetry_command.rsbaml_language/crates/baml_cli/src/test_command.rsbaml_language/crates/baml_exec/Cargo.tomlbaml_language/crates/baml_exec/src/clap_target.rsbaml_language/crates/baml_exec/src/diag_print.rsbaml_language/crates/baml_exec/src/lib.rsbaml_language/crates/baml_pack_host/src/main.rsbaml_language/crates/baml_shell/Cargo.tomlbaml_language/crates/baml_shell/src/lib.rsbaml_language/stow.toml
Changes
baml_shell::Shellfor diagnostics, statuses, color policy, Clap styling, and root-help rendering__baml-root-help-v1metadata command tobaml-clitoolchainandself-updateTesting
baml_cliunit tests (412 passed)Tested on macOS.
Summary by CodeRabbit
New Features
Bug Fixes