Skip to content

Fix binary auto-discovery to prefer package-named binary over first match#7

Merged
julcst merged 3 commits into
mainfrom
copilot/fix-auto-discovery-binary-selection
Oct 26, 2025
Merged

Fix binary auto-discovery to prefer package-named binary over first match#7
julcst merged 3 commits into
mainfrom
copilot/fix-auto-discovery-binary-selection

Conversation

Copilot AI commented Oct 26, 2025

Copy link
Copy Markdown
Contributor

When a Rust package defines multiple binary targets, the bundler was selecting the first binary from cargo metadata instead of the one matching the package name, violating Cargo conventions.

Changes

  • Binary selection logic (scripts/bundle.sh:130-145)
    • Extract all binary targets in single jq call
    • Prefer binary matching package name via grep -x
    • Fall back to first binary if no package-named match exists

Example

For a package with multiple binaries:

[package]
name = "my-app"

[[bin]]
name = "utility"
path = "src/utility.rs"

[[bin]]
name = "my-app"
path = "src/main.rs"

Before: Selected utility (first in metadata)
After: Selects my-app (matches package name)

Original prompt

You are choosing the wrong binary in auto discovery, you are just using the first target with kind bin you can find, however the default target should be the one that has the same name as the package.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits October 26, 2025 17:36
Co-authored-by: julcst <97609514+julcst@users.noreply.github.com>
Co-authored-by: julcst <97609514+julcst@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix binary selection in auto discovery process Fix binary auto-discovery to prefer package-named binary over first match Oct 26, 2025
Copilot AI requested a review from julcst October 26, 2025 17:41
@julcst julcst marked this pull request as ready for review October 26, 2025 18:36
@julcst julcst merged commit 2899379 into main Oct 26, 2025
6 checks passed
@julcst julcst deleted the copilot/fix-auto-discovery-binary-selection branch October 26, 2025 18:37
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.

2 participants