refactor: extract cli_config.py from cli.py (−605 lines) - #79784
Open
xandgate wants to merge 1 commit into
Open
Conversation
Extracts config loading/saving, prefill message handling, reasoning/service-tier parsing, and content-processing helpers into cli_config.py. cli.py re-imports all moved names, so existing `from cli import X` call sites keep working. Tests that monkeypatched `_hermes_home` now patch `cli_config`. Supersedes NousResearch#12355 which was stale (main moved 3993 commits ahead).
Collaborator
Related: this is the focused Part 1 split of the broader open #12355 cli.py extraction. It is a subset, not a duplicate. |
This was referenced Aug 6, 2026
Author
|
Thanks @alt-glitch. Correct — this is the focused Part 1 of 3 PRs splitting the stale #12355 into independently reviewable extractions. Parts 2 and 3 are now open: #79789 (cli_git.py) and #79790 (cli_display.py). Each can be reviewed and merged independently. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Extracts config loading/saving, prefill message handling, reasoning/service-tier parsing, and content-processing helpers into cli_config.py.
cli.py re-imports all moved names, so existing
from cli import Xcall sites keep working. Tests that monkeypatched_hermes_homenow patchcli_config.Supersedes #12355 which was stale (main moved 3993 commits ahead).
What does this PR do?
Extracts the configuration cluster from
cli.py(18,485 lines) into a focusedcli_config.pymodule (641 lines), as part of the god-file modularization goal inAGENTS.md("Refactor god-files into clean modules").The config cluster is a self-contained group of 10 top-level functions that handle config loading/saving, prefill message resolution, and reasoning/service-tier parsing. They have clean boundaries and no dependencies on the
HermesCLIclass ormain(). This is the first of 3 small PRs splitting the old #12355 into independently reviewable extractions.Related Issue
Supersedes #12355 (same extraction, re-done from current main after 3,993 commits diverged). Split into 3 smaller PRs for easier review:
Type of Change
Changes Made
cli_config.py(641 lines) with verbatim moves of:_REASONING_TAGS,_strip_reasoning_tags(),_assistant_content_as_text(),_assistant_copy_text()_load_prefill_messages(),_resolve_prefill_messages_file()_parse_reasoning_config(),_parse_service_tier_config()load_cli_config()(~491 lines),save_config_value()cli.py(18,485 → 17,880 lines, −605 net):from cli_config import (...)re-import block after existing importscli_config._hermes_homeinstead ofcli._hermes_home:tests/cli/test_cli_init.py(4 sites)tests/cli/test_cli_save_config_value.pytests/hermes_cli/test_config_env_expansion.py(2 sites)tests/hermes_cli/test_ignore_user_config_flags.pytests/hermes_cli/test_managed_scope_cli_config.pytests/hermes_cli/test_reasoning_full_command.pytests/hermes_cli/test_timestamps_command.pytests/test_tui_gateway_server.pyHow to Test
python -c "import cli_config; print('ok')"— module imports cleanlypython -c "import cli; print('ok')"— cli.py still imports with re-exportspytest tests/cli tests/hermes_cli -x→761 passed, 1 skipped, 1 pre-existing failure (test_resume_quiet_stderr.py— fails on cleanmaintoo)Checklist
Code
refactor: extract cli_config.py from cli.py (−605 lines))pytest tests/ -qand all tests pass (761 passed, 1 skipped; 1 pre-existing failure on clean main)Documentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs