Skip to content

fix(cli): preserve tab completion inside space-containing paths#26230

Open
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:hermes/fix-26223-tab-complete-spaces
Open

fix(cli): preserve tab completion inside space-containing paths#26230
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:hermes/fix-26223-tab-complete-spaces

Conversation

@LeonSGP43

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes CLI path completion after completing into a directory whose name contains
spaces. Hermes now keeps the full path token under the cursor instead of
dropping the earlier path segment, so repeated Tab presses can continue
completing inside directories like ./My Documents/.

Related Issue

Fixes #26223

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • Updated hermes_cli/commands.py so
    _extract_path_word() returns the nearest path-like token chain ending at the
    cursor, including space-separated directory segments.
  • Added regression coverage in
    tests/hermes_cli/test_path_completion.py
    for _extract_path_word() and repeated Tab completion inside a directory with
    spaces.

How to Test

  1. Run:
    python3 -m pytest -o addopts='' tests/hermes_cli/test_path_completion.py
  2. Confirm the suite passes, including the new My Documents regression tests.
  3. Optionally reproduce manually in hermes:
    type edit ./My, press Tab to complete a directory like ./My Documents/,
    then press Tab again and verify nested files are suggested.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS 15.5

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

$ python3 -m pytest -o addopts='' tests/hermes_cli/test_path_completion.py
29 passed in 0.71s

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard labels May 15, 2026
NishantEC

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Tab completion stops working after completing a directory path containing spaces

3 participants