hermes - 💡(How to fix) Fix [Feature]: Unify ACP command parsing with CLI shared utilities [1 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Fix Action

Fixed

Code Example

# tools/command_parser.py (or shared module)
class ModelCommandParser:
    def parse(self, args: list[str]) -> ParsedModelCommand:
        flags, model_str = parse_model_flags(" ".join(args))
        return ParsedModelCommand(model=model_str, provider=flags.provider, global_=flags.global_)

# Both CLI and ACP use the same parser:
parser = ModelCommandParser()
result = parser.parse(args)
RAW_BUFFERClick to expand / collapse

Problem

The ACP adapter (acp_adapter/server.py) reimplements command parsing logic that already exists in the CLI (hermes_cli/). Each _cmd_* handler manually parses its arguments without calling the CLI's shared utilities:

  • _cmd_model did not call parse_model_flags() — fixed in PR #27130 for /model only
  • Other commands (/provider, /tools, etc.) likely have the same gap but are not yet reported

This architectural gap means every ACP command must be independently audited and kept in sync with its CLI equivalent. When the CLI adds a new flag or changes parsing behavior, the ACP path silently diverges — users see "works in CLI but not in ACP" bugs.

Proposed Solution

Extract shared command parsing into a CommandParser class or module that both hermes_cli/ and acp_adapter/server.py import:

# tools/command_parser.py (or shared module)
class ModelCommandParser:
    def parse(self, args: list[str]) -> ParsedModelCommand:
        flags, model_str = parse_model_flags(" ".join(args))
        return ParsedModelCommand(model=model_str, provider=flags.provider, global_=flags.global_)

# Both CLI and ACP use the same parser:
parser = ModelCommandParser()
result = parser.parse(args)

Phase 1 (minimal): Audit all _cmd_* handlers in acp_adapter/server.py against their CLI equivalents. For each, verify shared utilities are called. Fix any gaps (expected: 3-5 handlers need fixes, similar to the parse_model_flags gap).

Phase 2 (architectural): Extract a CommandParser registry that maps command names to shared parse+execute functions, eliminating the dual-maintenance problem.

Alternatives Considered

  1. Status quo (fix per-command) — what we did in PR #27130. Works but reactive; next ACP flag gap will be discovered by users, not by design.
  2. Generate ACP handlers from CLI definitions — ideal but requires significant refactoring of the CLI command registry.

Impact

Affects every user of ACP-compatible editors (Zed, Neovim with Copilot, Windsurf, Toad, etc.) — estimated thousands of users. Every ACP command is potentially affected, not just /model.

Implementation Notes

  • Files: acp_adapter/server.py, new shared module in tools/ or hermes_cli/
  • LOC estimate: Phase 1 ~50-80 lines (audit + fixes), Phase 2 ~200-300 lines
  • No breaking changes — purely additive (shared imports replace inline parsing)
  • Related: #27119 (the specific /model bug), PR #27130 (the fix)

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix [Feature]: Unify ACP command parsing with CLI shared utilities [1 pull requests]