Summary
Every CLI command handler calls discover_project once to obtain the project root (for constructing providers, loading configs, etc.), then passes the ProjectProvider into an operation struct whose execute method calls discover_project again.
This means the entire project discovery — including the expensive filesystem traversal in collect_matching_dirs — happens twice per command invocation.
A flame graph on cargo changeset verify shows two nearly equal towers of discover_project → collect_matching_dirs:
- Left tower (~53%): CLI-side call in
verify::run
- Right tower (~47%): Operation-side call in
VerifyOperation::execute
Affected Commands
| Command |
CLI call site |
Operation call site |
CLI-side usage |
verify |
commands/verify.rs:15 |
operations/verify.rs:66 |
load_configs for base branch default, project.root() for provider construction |
add |
commands/add.rs:21 |
operations/add.rs:72 |
project.kind() for single-package detection, project.root() for provider construction |
status |
commands/status.rs:14 |
operations/status.rs:65 |
project.root() for provider construction |
release |
commands/release.rs:40 |
operations/release/operation.rs:180 |
project.root() for provider construction, project.packages() for prerelease inference |
init |
commands/init.rs:26 |
operations/init.rs:159 (+ lines 64, 78, 143) |
load_configs, project.kind(), project.root() for changeset dir |
The manage command is not affected — it delegates entirely to operations without a CLI-side discovery call.
Suggested Fix
Refactor the operation structs to accept an already-discovered CargoProject (and optionally pre-loaded configs) instead of re-discovering from scratch. The CLI handler already has the project; pass it through.
Flame Graph

Summary
Every CLI command handler calls
discover_projectonce to obtain the project root (for constructing providers, loading configs, etc.), then passes theProjectProviderinto an operation struct whoseexecutemethod callsdiscover_projectagain.This means the entire project discovery — including the expensive filesystem traversal in
collect_matching_dirs— happens twice per command invocation.A flame graph on
cargo changeset verifyshows two nearly equal towers ofdiscover_project→collect_matching_dirs:verify::runVerifyOperation::executeAffected Commands
verifycommands/verify.rs:15operations/verify.rs:66load_configsfor base branch default,project.root()for provider constructionaddcommands/add.rs:21operations/add.rs:72project.kind()for single-package detection,project.root()for provider constructionstatuscommands/status.rs:14operations/status.rs:65project.root()for provider constructionreleasecommands/release.rs:40operations/release/operation.rs:180project.root()for provider construction,project.packages()for prerelease inferenceinitcommands/init.rs:26operations/init.rs:159(+ lines 64, 78, 143)load_configs,project.kind(),project.root()for changeset dirThe
managecommand is not affected — it delegates entirely to operations without a CLI-side discovery call.Suggested Fix
Refactor the operation structs to accept an already-discovered
CargoProject(and optionally pre-loaded configs) instead of re-discovering from scratch. The CLI handler already has the project; pass it through.Flame Graph