Skip to content

feat: replace unknown-command list with closest-match suggestions - #2063

Merged
hatayama merged 2 commits into
feat/pause-point-r13-leftovers-integrationfrom
feat/unknown-command-suggestions
Jul 29, 2026
Merged

feat: replace unknown-command list with closest-match suggestions#2063
hatayama merged 2 commits into
feat/pause-point-r13-leftovers-integrationfrom
feat/unknown-command-suggestions

Conversation

@hatayama

@hatayama hatayama commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • Unknown-command error details now return up to five closest SuggestedCommands (Levenshtein distance, name tie-break) instead of the full AvailableCommands list.
  • Shared release input stamps updated for the cli/common change.

User Impact

Typo recovery stays useful without dumping every command name into the error envelope.

Test plan

  • scripts/check-go-cli.sh → exit 0
  • scripts/stamp-release-inputs.sh twice → content-idempotent
  • Live typo check:
{
  "ErrorCode": "UNKNOWN_COMMAND",
  "Command": "compil",
  "Details": {
    "SuggestedCommands": [
      "compile",
      "completion",
      "install",
      "launch",
      "list"
    ]
  }
}
  • Repo CI may not fire for integration-branch PRs (pull_request.branches: [main, v3-beta]); full CI on the final PR to v3-beta

Review in cubic

Dumping every available command wastes tokens on typos. Rank a short
Levenshtein suggestion list instead, and stamp shared release inputs for
the cli/common change.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fe7e5c38-b0d4-4aeb-a388-7b6ceead3dfe

📥 Commits

Reviewing files that changed from the base of the PR and between 4bcdb22 and 2e442eb.

📒 Files selected for processing (6)
  • cli/common/errors/command_suggestions.go
  • cli/common/errors/command_suggestions_test.go
  • cli/common/errors/error_envelope.go
  • cli/common/errors/error_envelope_test.go
  • cli/dispatcher/shared-inputs-stamp.json
  • cli/project-runner/shared-inputs-stamp.json

📝 Walkthrough

Walkthrough

Unknown command errors now include up to five ranked command suggestions based on Levenshtein distance, with alphabetical tie-breaking. Tests cover ranking, limits, empty inputs, and error payload changes; two shared-input stamps are updated.

Changes

Command suggestion errors

Layer / File(s) Summary
Suggestion ranking engine
cli/common/errors/command_suggestions.go, cli/common/errors/command_suggestions_test.go
Adds bounded Levenshtein-based command ranking with deterministic tie-breaking and unit coverage for core cases.
Unknown command error integration
cli/common/errors/error_envelope.go, cli/common/errors/error_envelope_test.go, cli/*/shared-inputs-stamp.json
Stores ranked values under SuggestedCommands, removes AvailableCommands from the tested payload, and updates shared-input hashes.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant UnknownCommandError
  participant suggestCommands
  participant levenshteinDistance
  UnknownCommandError->>suggestCommands: pass unknown and available commands
  suggestCommands->>levenshteinDistance: calculate candidate distances
  levenshteinDistance-->>suggestCommands: return edit distances
  suggestCommands-->>UnknownCommandError: return up to five ranked suggestions
Loading
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/unknown-command-suggestions

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

The previous stamps were computed before command_suggestions.go was
tracked, so git ls-files omitted it from the manifest hash.

Co-authored-by: Cursor <cursoragent@cursor.com>
@hatayama
hatayama merged commit f1469db into feat/pause-point-r13-leftovers-integration Jul 29, 2026
1 of 2 checks passed
@hatayama
hatayama deleted the feat/unknown-command-suggestions branch July 29, 2026 10:45
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.

1 participant