mpfaffenberger / mpfaffenberger/code_puppy
17 subsystem files exceed the 600-line hard cap; tools/common.py (1599 lines) is a multi-responsibility grab-bag
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 814
- Forks
- 278
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 76
Description
Files: subsystem-wide; the 600-line cap is stated in CONTRIBUTING ("600-line hard cap - split into submodules") and even enforced rhetorically in base_agent.py ("Keep this file under 300 lines").
Severity: Medium (maintainability)
Files in the reviewed subsystems exceeding the 600-line hard cap:
| File | Lines |
|---|---|
| code_puppy/tools/common.py | 1599 |
| code_puppy/tools/command_runner.py | 1411 |
| code_puppy/messaging/rich_renderer.py | 1214 |
| code_puppy/mcp_/server_registry_catalog.py | 1126 |
| code_puppy/tools/file_modifications.py | 935 |
| code_puppy/tools/file_operations.py | 930 |
| code_puppy/mcp_/manager.py | 927 |
| code_puppy/tools/universal_constructor.py | 893 |
| code_puppy/plugins/agent_skills/skills_menu.py | 794 |
| code_puppy/agents/agent_manager.py | 750 |
| code_puppy/plugins/agent_skills/skills_install_menu.py | 691 |
| code_puppy/plugins/claude_code_oauth/utils.py | 658 |
| code_puppy/agents/agent_creator_agent.py | 646 |
| code_puppy/tools/browser/browser_locators.py | 640 |
| code_puppy/messaging/bus.py | 628 |
| code_puppy/agents/_runtime.py | 618 |
| code_puppy/plugins/theme/themes.py | 602 |
tools/common.py is the worst offender and is also a grab-bag violating SRP: ~280 lines of ignore-pattern constants, diff syntax-highlighting, approval UI (sync + async, nearly copy-pasted - see lines ~1095-1290 vs ~1330-1480), arrow-key selectors (sync + async duplicates), atomic file writes, fuzzy matching, and group-id generation all live in one module.
Suggested split for common.py: ignore_patterns.py (DIR_/FILE_IGNORE_PATTERNS + should_ignore_*), diff_render.py (Pygments/diff formatting), approval.py (get_user_approval[_async] + arrow_select[_async]), fs_utils.py (atomic_write_text, _find_best_window, generate_group_id). Similar mechanical splits apply to command_runner.py (keyboard listeners / streaming reader / tool registration) and file_operations.py (rg discovery helpers vs tools).
Filed by Zen Reviewer B (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 CONTRIBUTING and code_puppy/tools/common.py, especially the listed responsibility groups and duplicated approval and selector code. Use the suggested modules—ignore_patterns.py, diff_render.py, approval.py, and fs_utils.py—as the initial split, then assess the other oversized files named in the issue. Done means the responsibilities are separated into submodules, behavior is preserved, and the reviewed files comply with the stated line cap.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100