Skip to content

Comments

Add CLI command typo detection (#34836)#10

Open
MitchLewis930 wants to merge 1 commit intopr_040_beforefrom
pr_040_after
Open

Add CLI command typo detection (#34836)#10
MitchLewis930 wants to merge 1 commit intopr_040_beforefrom
pr_040_after

Conversation

@MitchLewis930
Copy link

@MitchLewis930 MitchLewis930 commented Jan 30, 2026

PR_040


Note

Low Risk
Small, additive CLI error-handling change with integration tests; main risk is false-positive suggestions in the ENOENT path causing earlier exits for edge-case directory names.

Overview
Improves next CLI UX by detecting mistyped subcommands and suggesting the closest valid command (e.g. next buidl �� next build) instead of only reporting an invalid directory.

This exports the CLI commands map for reuse, adds a small edit-distance based detectTypo helper, wires it into getProjectDir to emit a targeted error + exit when a typo is detected, and adds integration tests covering common misspellings.

Written by Cursor Bugbot for commit ed43c03. This will update automatically on new commits. Configure here.

* Add CLI command typo detection

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

previousRow = currentRow
}
return previousRow[previousRow.length - 1]
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused threshold parameter in minDistance function

Low Severity

The threshold parameter in minDistance is accepted but never used inside the function body. It's only passed through the recursive call on line 7, but the actual Levenshtein distance calculation (lines 10-28) never references it. The threshold filtering happens in detectTypo after all distances are already computed. This suggests an early-termination optimization was intended but never implemented, leaving dead code that could mislead future developers about how the function behaves.

Fix in Cursor Fix in Web

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