Add release readiness checks and installation instructions#67
Conversation
There was a problem hiding this comment.
Pull request overview
Adds release-readiness CI checks and improves end-user install/docs by introducing a small CLI “preflight” layer (help/version/completions) and documenting installation + shell completion setup.
Changes:
- Add
--help,--version, and--print-completion <shell>handling before starting the TUI. - Introduce a release sanity script (release build, binary size threshold, and bench compile sanity) and a GitHub Actions workflow to run it.
- Expand README with Linux/macOS install instructions and shell completion generation/install examples; mark related PROGRESS items complete.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/main.rs |
Adds CLI preflight handling (help/version/completion script output) before initializing the TUI. |
scripts/release_sanity.sh |
New script to validate release build, enforce binary size threshold, and ensure benchmark targets compile. |
README.md |
Adds install instructions (cargo install + binary download) and shell completion generation/install guidance. |
PROGRESS.md |
Marks packaging/install readiness tasks as completed. |
.github/workflows/release-readiness.yml |
New workflow running the release sanity script on pushes and PRs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if handle_cli_preflight()? { | ||
| return Ok(()); | ||
| } | ||
|
|
||
| color_eyre::install()?; |
There was a problem hiding this comment.
handle_cli_preflight() can return an error before color_eyre::install() is called (e.g., missing/unsupported shell), which means the error output/panic hooks won’t use the project’s configured color-eyre formatting. Consider moving color_eyre::install()?; before handle_cli_preflight() (or installing only when an error is about to be returned).
| if handle_cli_preflight()? { | |
| return Ok(()); | |
| } | |
| color_eyre::install()?; | |
| color_eyre::install()?; | |
| if handle_cli_preflight()? { | |
| return Ok(()); | |
| } |
| fn handle_cli_preflight() -> color_eyre::Result<bool> { | ||
| let mut args = env::args().skip(1); | ||
| let Some(first) = args.next() else { | ||
| return Ok(false); |
There was a problem hiding this comment.
Using env::args() will panic if any CLI argument is not valid UTF-8. Since this code runs before the TUI starts, it introduces a new panic path for otherwise valid OS-level arguments. Prefer env::args_os() and handle conversion (e.g., lossy) when parsing these preflight flags.
| } | ||
|
|
||
| fn print_help() { | ||
| println!( |
There was a problem hiding this comment.
print_help() uses println!() while the format string already ends with a trailing \n, which results in an extra blank line at the end of the help output. Consider removing the final newline from the string or using print!() instead.
| println!( | |
| print!( |
| fn completion_script(shell: &str) -> Option<&'static str> { | ||
| match shell { | ||
| "bash" => Some( | ||
| r#"_forge_completions() { | ||
| local cur | ||
| cur="${COMP_WORDS[COMP_CWORD]}" | ||
| COMPREPLY=( $(compgen -W "--help --version --print-completion" -- "$cur") ) | ||
| } | ||
| complete -F _forge_completions forge | ||
| "#, | ||
| ), | ||
| "zsh" => Some( | ||
| r#"#compdef forge | ||
| _forge() { | ||
| _arguments \ | ||
| '--help[Show help]' \ | ||
| '--version[Show version]' \ | ||
| '--print-completion[Print completion script]:shell:(bash zsh fish)' | ||
| } | ||
| _forge "$@" | ||
| "#, | ||
| ), | ||
| "fish" => Some( | ||
| r#"complete -c forge -l help -d 'Show help' | ||
| complete -c forge -l version -d 'Show version' | ||
| complete -c forge -l print-completion -d 'Print completion script' -a 'bash zsh fish' | ||
| "#, | ||
| ), |
There was a problem hiding this comment.
The generated completion scripts only complete the long options (--help, --version) even though the CLI also supports the short flags (-h, -V). Also, the bash completion currently doesn’t offer argument completion for --print-completion (bash/zsh/fish). Updating the scripts to cover the supported short flags and --print-completion’s shell argument would make the completion output consistent with the actual CLI behavior.
30c781e
into
Pre-Usable-Release-(stabilization-+-onboarding)
Introduce release size and benchmark sanity checks in the CI process. Enhance documentation with installation instructions for Linux/macOS and shell completion script generation. Mark packaging and install tasks as completed.