Add CLI command typo detection (#34836)#10
Add CLI command typo detection (#34836)#10MitchLewis930 wants to merge 1 commit intopr_040_beforefrom
Conversation
* 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>
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||
User description
PR_040
PR Type
Enhancement, Tests
Description
Add CLI command typo detection using Levenshtein distance algorithm
Detect and suggest corrections for mistyped Next.js commands
Export commands object for typo detection module access
Add comprehensive integration tests for typo detection
Diagram Walkthrough
File Walkthrough
detect-typo.ts
Implement typo detection with Levenshtein distancepackages/next/lib/detect-typo.ts
minDistancefunction using dynamic programming to calculateLevenshtein distance
detectTypofunction to find closest matching command withinthreshold
null
get-project-dir.ts
Integrate typo detection into directory validationpackages/next/lib/get-project-dir.ts
commandsobject anddetectTypofunctionnext.ts
Export commands object for module accesspackages/next/bin/next.ts
commandsobject to make it accessible to other modulesindex.test.js
Add integration tests for typo detectiontest/integration/cli/test/index.test.js
detects command typoswith multiple typo scenarios