feat: add optional .gcoderc configuration file support - #48
Conversation
bdb1c38 to
0fc183d
Compare
|
Hi — reviewing this. Two things before it can merge:
Nice, focused feature otherwise — clean precedence rules, good test coverage. cc @aryansk |
Closes shauryagangrade#15. A .gcoderc in the project root (or ~/.gcode/.gcoderc) can set model, auto_approve, bash_timeout, and system_prompt. CLI flags and env vars still take precedence; format is simple key = value with # comments. 7 new tests.
0fc183d to
4879df6
Compare
The loader reads ~/.gcode/.gcoderc, not ~/.gcode/config.
|
Both points are addressed in the merged head |
Problem
Closes #15. GCode settings (default model, auto-approve, tool behavior) were
only configurable via command-line flags or environment variables — there was
no persistent file a user could edit across sessions.
Changes
gcode/config.py: dependency-free loader for a.gcodercfile in theproject root (or
~/.gcode/.gcodercfor user-wide defaults). Simplekey = valueformat with#comments; bool/int/string values are parsed.model,auto_approve,bash_timeout,system_prompt.built-in default (
--model/GCODE_MODELbeatmodel,--yesbeatsauto_approve).gcode/tools.py:set_bash_timeout()lets the config override the bashtool's 300s default.
gcode/cli.py: startup loads the config, resolves the model, auto-approve,timeout, and system prompt (used for new and cleared sessions).
Validation
pytest: 53 passed (7 new tests covering parsing, precedence, andfallbacks)
ruff check/ruff format --check/mypy gcode/compileall: all clean.gcodercis parsed and its model resolved correctly