Expose install_bundled_cli and HAS_BUNDLED_CLI in the Rust SDK#1489
Merged
Conversation
Lift embeddedcli::path() to a stable public surface so health checks, diagnostics, and version probes can reach the bundled CLI without spinning up a Client. Returns the same path Client::start resolves to for CliProgram::Resolve with no COPILOT_CLI_PATH or extract_dir override. Returns None when bundled-cli is off or the target is unsupported (no fallback to the dev-cache path). HAS_BUNDLED_CLI is a const so callers can branch on bundling presence without forcing extraction. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Exposes a stable public surface (HAS_BUNDLED_CLI constant and install_bundled_cli() function) at the Rust SDK crate root, so consumers like github-app can reach the bundled Copilot CLI path without constructing a Client, eliminating duplicated cache-path logic in downstream crates.
Changes:
- Add
pub const HAS_BUNDLED_CLI(keyed oncfg(has_bundled_cli)) andpub fn install_bundled_cli()as a thin wrapper over the existingpub(crate) embeddedcli::path(). - Document the new surface in the README under "Embedded CLI resolution".
- Add integration tests covering both bundled (idempotent, matches resolver) and non-bundled (
None, no dev-cache fallback) configurations.
Show a summary per file
| File | Description |
|---|---|
| rust/src/lib.rs | Adds public HAS_BUNDLED_CLI const and install_bundled_cli() wrapper around the crate-private embedded CLI installer. |
| rust/README.md | Documents the new "reaching the bundled binary without a Client" pattern with a runnable snippet. |
| rust/tests/cli_resolution_test.rs | Adds three feature/cfg-gated tests: idempotent extraction, parity with Client::start resolver, and None when not bundled. |
Copilot's findings
- Files reviewed: 3/3 changed files
- Comments generated: 0
SteveSandersonMS
approved these changes
May 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
github-app's health panel (and any caller that always sets
CliProgram::Path(...)) needs the bundled CLI's path before aClientexists, butembeddedcli::path()ispub(crate). github-app has had to reinvent the cache-path convention in its own health module, making four copies (build.rs,embeddedcli.rs,resolve.rs, and the consumer) that have to stay byte-for-byte in sync or runtime resolution silently breaks.This lifts the existing extraction path to a stable public surface without adding new logic:
install_bundled_cli()wrapsembeddedcli::path()and returns the same pathClient::startresolves to forCliProgram::Resolvewith noCOPILOT_CLI_PATHand noClientOptions::bundled_cli_extract_diroverride. Lazy on first call, idempotent thereafter,Nonewhen thebundled-clifeature is off or the target isn't supported bybuild.rs.Notes for reviewers
install_bundled_cli()returnsNonerather than chaining into thehas_extracted_cli(bundled-clioff) branch. That's a separate question and callers can still reach it viaCliProgram::Resolve. Consumer asked for this shape explicitly.HAS_BUNDLED_CLIkeys offcfg(has_bundled_cli), not the feature flag. So it stays accurate on unsupported targets even when the feature is on, and callers can branch on bundling presence without forcing extraction.install_atstayspub(crate). No consumer needs the extract-dir variant today. If one shows up we can addinstall_bundled_cli_at(&Path)later.resolve.rsis untouched.Client::startstill goes throughembeddedcli::path()directly; the public wrapper is just another caller of the same function.Companion consumer change is github/github-app#5834, which replaces its hand-rolled
find_bundled_copilot_pathplus the duplicatedsdk_cli_cache_root/sanitize_cli_version/COPILOT_CLI_EXTRACT_DIR_ENVhelpers with this single SDK call.