mpfaffenberger / mpfaffenberger/code_puppy
Six core runtime files exceed the 600-line hard cap (config.py is 2151 lines)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 814
- Forks
- 278
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 76
Description
Problem
CONTRIBUTING.md rule 3 states a 600-line hard cap — split into submodules. The core runtime/model layer violates it six times over:
| File | Lines |
|---|---|
code_puppy/config.py |
2151 |
code_puppy/callbacks.py |
1147 |
code_puppy/cli_runner.py |
1134 |
code_puppy/model_factory.py |
986 |
code_puppy/claude_cache_client.py |
843 |
code_puppy/gemini_model.py |
840 |
Why it matters
config.pyis a grab-bag of ~80 getters/setters spanning XDG paths, model settings, banner colors, autosave/TTY session tracking, API keys, and command history — at least six unrelated concerns in one module.callbacks.pyduplicates itsPhaseTypeLiteral (~55 entries) in the hand-maintained_callbacksdict (lines 6–111); these can drift. It could be_callbacks = {p: [] for p in typing.get_args(PhaseType)}.cli_runner.py:interactive_modeis a ~700-line god function (see separate issue).model_factory.py:ModelFactory.get_modelis a ~450-line if/elif chain over model types; a dispatch table ({"openai": _build_openai, "anthropic": _build_anthropic, ...}) would make each builder independently testable and let the plugin handler path share the same mechanism it already uses for custom types.
Suggested fix
Split along existing seams, e.g.:
config/package:paths.py,core.py(get_value/set_value),model_settings.py,sessions.py,colors.py,toggles.py— re-export fromconfig/__init__.pyto preserve the public API.model_factory.py: extract one_build_<type>()function per model type intomodel_builders.pyand dispatch via a dict.callbacks.py: derive_callbacksfromget_args(PhaseType)and consider grouping the thinon_*wrappers.
Filed by Zen Reviewer A (code-puppy-60635a)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with rule 3 in CONTRIBUTING.md, then map imports and public APIs for config.py, callbacks.py, cli_runner.py, model_factory.py, claude_cache_client.py, and gemini_model.py. Review the proposed config/ package and model builder seams before changing structure. Done means the six runtime files are split below 600 lines without breaking their public APIs or behavior; run the repository’s existing checks afterward.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, tooling
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100