Bug Description
When tab-completing a file path in the Hermes CLI, if the completed path contains a space (e.g., My Documents/), subsequent Tab presses no longer show completions for files inside that directory.
Steps to Reproduce
- Start Hermes CLI:
hermes
- Type a partial path to a directory with spaces, e.g.,
./My
- Press Tab → completes to
My Documents/
- Press Tab again (or type a character and press Tab)
- Expected: Show files inside
My Documents/
- Actual: No completions shown
Root Cause
_extract_path_word() in hermes_cli/commands.py walks backwards from the cursor,
stopping at the first space character. After My Documents/ is completed, the function
extracts only Documents/ as the "word", which doesn't match any directory in the current
working directory, so no completions are returned.
Affected Component
CLI (interactive chat)
Proposed Fix
In _extract_path_word(), when encountering a space, check if the text after the space
contains a /. If so, the space is part of a path — keep walking backwards instead of
stopping.
# Before
while i >= 0 and text[i] != " ":
i -= 1
# After
while i >= 0:
if text[i] != " ":
i -= 1
else:
rest = text[i + 1:]
if "/" in rest or rest.startswith("~"):
i -= 1
else:
break
Bug Description
When tab-completing a file path in the Hermes CLI, if the completed path contains a space (e.g.,
My Documents/), subsequent Tab presses no longer show completions for files inside that directory.Steps to Reproduce
hermes./MyMy Documents/My Documents/Root Cause
_extract_path_word()inhermes_cli/commands.pywalks backwards from the cursor,stopping at the first space character. After
My Documents/is completed, the functionextracts only
Documents/as the "word", which doesn't match any directory in the currentworking directory, so no completions are returned.
Affected Component
CLI (interactive chat)
Proposed Fix
In
_extract_path_word(), when encountering a space, check if the text after the spacecontains a
/. If so, the space is part of a path — keep walking backwards instead ofstopping.