Skip to content

[Maintainability] Unused analysisPreview variable in suggestCommand #282

Description

@404-Page-Found

Description

suggestCommand computes const analysisPreview = options.showDiff ? getPreview() : undefined; and never reads it again — the value is dead. It also re-triggers getPreview() (which throws if the preview wasn't built) for no effect, adding confusion to the --show-diff path.

Location

src/commands/suggest.ts line 242

Code

const analysisPreview = options.showDiff ? getPreview() : undefined;

(grep for analysisPreview shows it is only assigned, never used.)

Suggested fix

Delete the line. If a preview was meant to be passed through to the streaming/generation calls (e.g. to avoid recomputing truncation), wire it up as precomputedTruncation — the generateSuggestions/generateSuggestionsStream signatures already accept a precomputedTruncation parameter that callers never pass.

Impact

Dead code and a latent trap: calling getPreview() here throws if preview is undefined, so any future reordering of the --show-diff block can crash the command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions