mpfaffenberger / mpfaffenberger/code_puppy

Minor cleanups: dead allow_legacy param, keymap cancel/pause duplication, inline clipboard fallback, lefthook isort never installed, undocumented keybinding config

Open
#433 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
814
Forks
278
Avg merge
2d 5h
Merged PRs (30d)
76

Description

Problem

Grouped minor cleanups across the UI/session/infra layer (each too small for its own issue, all concrete):

  1. Dead parameter: session_storage.py:121-126load_session(..., allow_legacy: bool = False) is immediately discarded (_ = allow_legacy # Kept for API compatibility). Deprecate and remove; grep shows callers don't pass it.

  2. Near-duplicate function family in keymap.py: get_cancel_agent_key / validate_cancel_agent_key / get_cancel_agent_char_code / get_cancel_agent_display_name (lines 96-167) are mirrored verbatim by the pause variants (lines 175-228), differing only in config key, valid-key set, default, and uvx override. One parametrized helper (_get_key(config_key, default, uvx_override) etc.) halves the module and keeps the two features from drifting.

  3. Inline clipboard re-implementation: the Ctrl+V fallback in prompt_toolkit_completion.py (~lines 700-760) shells out to pbpaste/powershell Get-Clipboard/xclip/xsel inline, while command_line/clipboard.py is the designated cross-platform clipboard module. Move text-clipboard reading into clipboard.py (get_clipboard_text() -> Optional[str]) and call it from the key binding.

  4. Commented-out corpse at the top of prompt_toolkit_completion.py (lines 1-8): dead ANSI color constants kept "in case someone needs raw ANSI later". Delete — git remembers.

  5. lefthook.yml references isort, which is not a dev dependency — the isort pre-commit command always takes the "isort not found; using ruff import sorter" fallback path on a fresh clone (verified: no isort in pyproject/uv.lock). Either add isort to the dev group or delete the command and keep only ruff check --select I --fix.

  6. docs/ only covers AGENT_SKILLS / CEREBRAS / HOOKS / LEFTHOOK — none of the session/autosave/keymap behavior reviewed here is documented anywhere except code comments (e.g., the cancel_agent_key/pause_agent_key config keys and their valid values in keymap.py are discoverable only by reading source). A short docs/KEYBINDINGS.md would cover it.

Suggested fix

Each item above contains its fix; all are independent, low-risk deletions/extractions suitable for a cleanup PR.

Filed by Zen Reviewer C (code-puppy-60635a)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading session_storage.py, keymap.py, prompt_toolkit_completion.py, command_line/clipboard.py, lefthook.yml, and the existing docs. Check callers and project configuration before making the independent cleanup changes, then run the available checks and verify the keybinding and clipboard behavior. Done means the dead parameter and constants are removed, duplicated clipboard logic is centralized, lefthook is consistent, and the keybinding behavior is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ci-cd, cli, documentation, tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.