fix(command-list): include custom commands in plain output and deduplicate API fetch#3010
Merged
tusharmath merged 3 commits intomainfrom Apr 14, 2026
Merged
fix(command-list): include custom commands in plain output and deduplicate API fetch#3010tusharmath merged 3 commits intomainfrom
tusharmath merged 3 commits intomainfrom
Conversation
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.
Summary
Fix
command-listto include custom commands in non-porcelain output and eliminate a redundant API call by hoistingget_commandsbefore the porcelain branch.Context
The
on_show_commandshandler had two bugs:--porcelainwas not set (e.g., running:commandsin the REPL or via the CLI in human-readable mode), custom commands were never registered into theForgeCommandManager, so they were silently absent from the output.get_commands()was called inside the porcelain branch only. Moving it above the branch avoids a second network/IO round-trip when both paths need the same data.Additionally, this PR includes a broad cleanup across the codebase as part of a Clippy
indexing_slicing/string_slicelint pass. The two string-safety lints were removed from the CI autofix step and replaced with direct index access (slice[i]) in places where bounds are already guaranteed, eliminating noisyget(...).unwrap_or_default()boilerplate.Changes
ForgeCommandManager::register_all(custom_commands)is now called in the non-porcelain path so custom commands appear in the human-readable listing.get_commands()is hoisted above theif porcelainbranch so it is fetched once and shared by both paths..get(i).unwrap_or(...),.first().unwrap_or(...), and.get(a..b).map(...)patterns with direct indexing across ~35 files where the bounds are statically or logically guaranteed.Cargo Clippy String Safetystep fromautofix.yml; the main Clippy step now covers all lints in one pass.UIErrorvariants:MissingHeaderLine,NoAuthMethodsAvailable, andAuthMethodNotFoundwere removed in favour of directanyhow::bail!/expectcalls, shrinking the error module and deletingsrc/error.rsfrom the main crate.Key Implementation Details
The custom-command fix is minimal: the
register_allcall was already present inside the porcelain branch; it just needed to be mirrored in theelsebranch. Hoistingget_commandsmakes this sharing natural and removes the risk of the two branches diverging again.All index-access conversions are safe because the surrounding code already guards the collection length (e.g.,
if auth_methods.len() == 1beforeauth_methods[0], or table rows known to have a header).Testing