add: solvent config — view and edit local configuration#44
Conversation
- solvent config show all values (aligned columns) - solvent config get <key> print a single value - solvent config set <key> v update and persist; validates on write - solvent config reset restore all defaults - --json flag on show/get for scripting - Type coercion: bool (true/false/yes/no/1/0), int, float, str - Full validation via SolventConfig.validate() before every save Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SGjM79GJpSksy9wSSBa7e6
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8edb0c11ce
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| p.add_argument("--json", dest="as_json", action="store_true", | ||
| help="output as JSON") |
There was a problem hiding this comment.
Accept --json after get and show
When callers use the documented/scriptable form solvent config get model --json, argparse treats --json as an argument to the get subparser; because it is only registered on the parent parser here, the command exits with unrecognized arguments: --json. Scripts following the advertised get <key> --json usage have to know to put --json before the subcommand instead, so please add the option to the show/get subparsers or otherwise parse both positions.
Useful? React with 👍 / 👎.
| return int(value) | ||
| if field_type == "float": | ||
| return float(value) | ||
| return value # str and anything else |
There was a problem hiding this comment.
Handle list-valued config fields before saving
When users set telegram_allow_from, _field_type_name returns list[str] | None, so this fallback persists the raw CLI string even though the config field is a list. Later apply_config treats it as a list and does ','.join(config.telegram_allow_from), which turns an ID like 123456789 into 1,2,3,4,5,6,7,8,9, so allowlist mode will not recognize the intended user. Please parse this field into a list or reject unsupported non-scalar types instead of saving a string.
Useful? React with 👍 / 👎.
Summary
solvent config— show all config values in aligned columnssolvent config get <key>— print a single value (scriptable)solvent config set <key> <value>— update and persist with full validationsolvent config reset— restore all defaults--jsonflag onshow/getfor piping tojqType coercion handles bool (
true/false/yes/no/1/0), int, float, and str. EverysetrunsSolventConfig.validate()before writing, so invalid values are rejected with a clear error.Wraps the existing
solvent/config.pydataclass — no schema changes.Test plan
python3 -m pytest tests/test_config_cmd.py -v→ 22 passedpython3 -m pytest -q→ 436 passed, 6 skippedsolvent config→ aligned table of all keyssolvent config set model nemotron→ persists to.solvent/config.jsonsolvent config set model bad-value→ exits 1 with validation errorsolvent config get model --json→"nemotron"solvent config reset→ resets tooffline🤖 Generated with Claude Code
https://claude.ai/code/session_01SGjM79GJpSksy9wSSBa7e6
Generated by Claude Code