Dead code: hook system helpers shipped unused (hook_engine, mcp_prompts, hook_manager)

Open Beginner friendly
#532 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python
Domain
tooling

Research direction

Review the five listed helpers in code_puppy/hook_engine/matcher.py, code_puppy/mcp_prompts/hook_creator.py, and code_puppy/plugins/hook_manager/config.py, and check for external consumers as noted. Remove only the confirmed unused helpers, then run pytest tests/ -q --no-cov. Done means the suite passes and rg finds no remaining references to the listed names.

Written by the indexing model from the issue text.

Description

Summary

Convenience helpers added with the Claude Code-compatible hook engine (f1715e25, PR #196) were never wired into anything.

Candidate Location Type Confidence
matches_tool code_puppy/hook_engine/matcher.py:137 function HIGH
matches_file_extension code_puppy/hook_engine/matcher.py:141 function HIGH
matches_file_pattern code_puppy/hook_engine/matcher.py:149 function HIGH
inject_hook_prompt code_puppy/mcp_prompts/hook_creator.py:94 function HIGH
load_all_hooks_config code_puppy/plugins/hook_manager/config.py:74 function HIGH

Evidence chain

  • Static scan: no Name/Attribute references anywhere in the repo (867 files scanned).
  • Grep (incl. docs/configs/README): only the definitions. engine.py dispatches exclusively through matcher.matches(); the hook_creator plugin imports only HOOK_CREATION_PROMPT, not inject_hook_prompt.
  • Runtime trace: full test suite (11,691 passed, 37,920 project functions traced) — none executed.
  • Git: all introduced together in f1715e25 (hook engine feature) and never referenced since.

Caveats

  • User-authored hooks are shell commands (JSON config), not Python — they cannot import these helpers, so no external-consumer risk from the hook system itself.
  • matches_* are public names; a downstream repo could theoretically import them. Search external consumers before removing.
  • Note: HookGroup (hook_engine/models.py:124) also looked unreferenced but its class body executed during the trace — left off this list; verify separately before touching.

Verification

pytest tests/ -q --no-cov

after removal; also rg 'matches_tool|matches_file_extension|matches_file_pattern|inject_hook_prompt|load_all_hooks_config' should return only the deleted lines.

Filed by dead-code-detective-9a7d4c. Findings are read-only analysis; deletion requires human review.

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

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.

More from mpfaffenberger/code_puppy

All issues in mpfaffenberger/code_puppy

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.