You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bang_shell powers the !<command> shell mode — a zero-token-cost shortcut the CLI relies on. The three pure helpers (is_bang_command, parse_bang_command, bang_shell_enabled) had no direct test coverage.
What
tests/hermes_cli/test_bang_shell.py:
is_bang_command: leading !, leading spaces + !, bare !, mid-text ! not matched, empty string, None, non-string, double !!.
parse_bang_command: strips !, strips spaces after !, bare ! → empty, !! → !, leading spaces, non-bang → empty, None → empty, multi-word command preserved.
bang_shell_enabled: enabled in plain local session, disabled by HERMES_GATEWAY_SESSION, disabled by HERMES_CRON_SESSION, disabled when HERMES_SESSION_PLATFORM set, enabled when platform is empty string.
AI code review — automated review for reference; please use your judgment.
Overall: Adds tests for bang_shell parser helpers.
What it does
New tests/hermes_cli/test_bang_shell.py covers is_bang_command (leading !, spaces, bare !, mid-text false, empty/None/non-string, !!), parse_bang_command (strip ! and spaces, bare ! empty, !! -> !, multiword), and bang_shell_enabled — pure helpers for ! shell mode, no subprocess execution to keep suite fast.
KEEP pure unit coverage for is_bang_command / parse_bang_command / bang_shell_enabled / USAGE_HINT / DEFAULT_TIMEOUT in tests/hermes_cli/test_bang_shell.py — parser mid-text !, leading spaces, !!, None/non-string, and session-gate env helpers. Complements (does not replace) #81989's timeout/drain execution tests.
CHECK: no subprocess execution here (author correctly scoped). CHECK: stay green if bang_shell_enabled gate env names move — pin the current public helpers only. CHECK: do not expand this PR into a second interactive PTY bang shell (#100017 already open).
Author salch-cred not kvnloo. No competing PR from me.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
comp/cliCLI entry point, hermes_cli/, setup wizardP3Low — cosmetic, nice to havetool/terminalTerminal execution and process managementtype/testTest coverage or test infrastructure
4 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
bang_shellpowers the!<command>shell mode — a zero-token-cost shortcut the CLI relies on. The three pure helpers (is_bang_command,parse_bang_command,bang_shell_enabled) had no direct test coverage.What
tests/hermes_cli/test_bang_shell.py:is_bang_command: leading!, leading spaces +!, bare!, mid-text!not matched, empty string,None, non-string, double!!.parse_bang_command: strips!, strips spaces after!, bare!→ empty,!!→!, leading spaces, non-bang → empty,None→ empty, multi-word command preserved.bang_shell_enabled: enabled in plain local session, disabled byHERMES_GATEWAY_SESSION, disabled byHERMES_CRON_SESSION, disabled whenHERMES_SESSION_PLATFORMset, enabled when platform is empty string.DEFAULT_TIMEOUT > 0,USAGE_HINTmentions!.