chore(cli): drop the unused anyhow dependency - #491
Merged
Conversation
`anyhow` was declared in `cli/Cargo.toml` but nothing in the crate ever used it beyond naming `main`'s return type. That return type could not carry a value either: every error path in `main` ends in `std::process::exit`, which diverges, so `Ok(())` was the only value the function could ever produce and no `Err` ever reached the runtime's `Termination` impl. Return `()` from `main` instead and drop the dependency. `cargo tree -i anyhow` now prints nothing for the targets this crate builds, so the crate is no longer compiled at all; it stays in `Cargo.lock` only as a transitive of the wasm-only `wit-*` crates, which are never built here. Exit codes are unchanged — `AwareError::exit_code` already decided them. Verified: 0 on success, 7 on a not-found agent, both before and after.
Contributor
Author
|
@codex review Generated by Claude Code |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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.
Scheduled dead-code sweep, 2026-09-04. One deletion; the rest of the run is the evidence for what it deliberately spared.
Deleted
anyhow(dependency) —cli/Cargo.toml, and the return type it existed to name incli/src/main.rs.Evidence it was unreachable:
grep -rEn "\b(use|extern crate)\s+anyhow\b|\banyhow::|anyhow!" src tests build.rsreturns exactly one line:src/main.rs:196: async fn main() -> anyhow::Result<()>. Nouse anyhow, noanyhow!, noContext.maincontains no?operator (0 occurrences in its body), and both of its error paths end instd::process::exit(err.exit_code()), which returns!. SoOk(())was the only valuemaincould ever produce, and noErrever reached the runtime'sTerminationimpl..github/workflows/,scripts/,cli-npm/, orcli/tests/(includinglint_gates.rs, which gates several otherCargo.tomlandmain.rsproperties).Effect:
cargo tree -i anyhownow prints nothing for the targets this crate builds, so the crate is no longer compiled. It stays inCargo.lockas a transitive of the wasm-onlywit-*/wasm-metadatacrates, which are never built here — that lock entry is not ours to remove.Behaviour is unchanged.
AwareError::exit_codealready decided the process's exit status; the returned value never did. Verified against the built binary:--version→ 0,agent describe does-not-exist→ 7,agent list→ 0.This also brings
mainin line with CLAUDE.md §Code style, which asks for concrete error types viathiserror— the crate'sAwareError— rather than an erased one.Deliberately spared, with reasons
The whole Rust
pub-item hunting ground is structurally empty, and I verified that rather than assuming it. This crate has no library target, so rustc'sdead_codelint treats reachability frommainas the root set and fires on unusedpubitems too — andcargo clippy --all-targets -- -D warningsmakes that an error. Probe: appendingpub fn zzz_dead_probe_fn() -> u8 { 42 }tosrc/text.rsproducedwarning: function 'zzz_dead_probe_fn' is never used. So an unreachablepubitem, module, struct field or enum variant cannot land here. Baseline was clean before this change.cfg(windows)code — the one placedead_codecannot see on Linux. I installedx86_64-pc-windows-gnu+ mingw and rancargo check --target x86_64-pc-windows-gnu --all-targets: clean, both before and after this change. Nothing dead in the ~20 Windows-gated blocks undermodel_reader_host.rs,pidfile.rs,invoker.rsand friends. All fivewindows-sysfeatures and all threewin32jobuses are live.#[allow(dead_code)]items (manifest/agent.rs,manifest/app.rs,manifest/loader.rs,sidecar.rs,app_lock.rs,auth/keychain.rs,lockfile.rs,receipt.rs). Each already carries a written rationale, and each holds up: the manifest fields are what type-check the keysagent-spec.md/app-spec.mdpublish, and since there is nodeny_unknown_fields, deleting a field would stop rejecting a malformed declaration rather than start.NoteKind::Error+CompileNote::errortrack a contract the app-spec still publishes;keychain::delete_app_secretis a wired-up-call away from closing a real gap, so the missing thing is the call, not the function. Re-litigating these would be churn.#[allow(unused_imports)]facade inregistry/mod.rs— a genuine compiler blind spot, so I checked all six names by hand.Index,IndexEntry,VersionEntry,check_subdir_portable,checkout_relative_subdirandportable_subdir_keyare each reached throughcrate::registry::by at least one caller. Nothing to remove; a previous sweep already took the three that were dead.cli/Cargo.tomlhas a real use, including the thin ones:rand_core(OsRnginreceipt.rs),cssparserandlol_html(the report sanitizer),webbrowser(the OAuth flow). No[features]section exists, so there are no feature flags to strand.atoms/. Onlyis-newer-thanandat-leastare named by an example app, but atoms are resolved dynamically byatom://generic/<id>URI and the library is published content in its own right — exactly the string-keyed reach the sweep is told not to delete.registry-index.jsonandregistry-catalog.json, with no entry in either pointing at an agent that is gone. All 3,346 skill files are declared by their agent's manifest and every declared skill has a file — a clean 1:1, zero orphans either way. All 10 Blender agent scripts are referenced. All 39.mjsmodules incli-connection-reader/are reachable from the package'sbin,build.mjsor a test. Every script inscripts/is invoked by a workflow exceptregen-nuget-agents.py(see below).cli/tests/browser/— a documented manual pre-PR gate, referenced fromviewer_3d.rsand three specs. Not CI, not dead.cli-connection-reader/model-provider-v2.schema.json— reachable only from a design doc today, but feat: add isolated RVT connection reader runtime #480 is open on exactly this runtime. Not mine to delete mid-flight.Two things worth a maintainer's eye (not touched here)
Neither is a deletion, so neither belongs in this PR — but the sweep surfaced them and they would otherwise go unrecorded.
validate.rsraisesW_COMMAND_DOC_ORPHANfor acommands/<stem>.mdwhose stem is not a key inmanifest.commands, andsketchup-2025(1,589 of 1,684 docs) andsketchup-2026(1,618 of 1,725) trip it wholesale. It is a naming drift, not dead content: the docs carry a module prefix the manifest keys drop (geom-bounding-box-add.mdvs keybounding-box-add), and Ruby's?becomes-qin the key but is dropped in the filename (array-on-line.mdvsarray-on-line-q). ~930 of them match a key after stripping one leading segment. Critically, the prefixed file is the only doc for that command —bounding-box-add.mddoes not exist — so deleting them would destroy real documentation. The fix is a rename on one side or the other, and it needs someone to decide which side is canonical. Meanwhile 1,337 declared commands per agent have no doc at all.scripts/regen-nuget-agents.pyis referenced by nothing — no workflow, no doc, no script — and hardcodescli/target/release/aware.exeplus abin/Debug/net10.0/sidecar path, so it is stale as well as unreferenced. But a maintenance script a human runs by hand is reachable by a human, which is not something a sweep can disprove. Left alone deliberately; delete it if it has served its purpose.Gates
Run from
cli/on the pinned 1.95.0 toolchain, with CI's apt packages (clang libsecret-1-dev libdbus-1-dev pkg-config) installed:cargo fmt --all -- --check— passcargo clippy --all-targets -- -D warnings— passcargo test— pass, 1,195 + 1 unit and every integration binary green, 0 failedcargo check --target x86_64-pc-windows-gnu --all-targets— pass (extra, not a CI gate)🤖 Generated with Claude Code
https://claude.ai/code/session_01QVFTHfkqpjZHNusWXEaTXT
Generated by Claude Code