Releases: GowayLee/cchooks
Releases Β· GowayLee/cchooks
v0.1.5
π New Features
Tool Input Modification for PreToolUse Hooks
Hooks can now modify tool parameters before execution. For example, transform file paths or sanitize inputs before tools run.
Notification Type Filtering
Notification hooks can now filter by type (permission prompts, auth success, etc.) for more targeted processing.
Enhanced Session Hooks
- SessionEnd hooks now track working directory (cwd)
- SessionStart supports new "compact" source for transcript compaction events
- New plugin environment variables: CLAUDE_PROJECT_DIR, CLAUDE_CODE_REMOTE, CLAUDE_PLUGIN_ROOT
Full Changelog: v0.1.4...v0.1.5
v0.1.4
- Add session_end hook
- Support
system_messagefield - Support
additional_contextfield
Full Changelog: v0.1.3...v0.1.4
v0.1.3
- feat: Add
SessionStartHook - docs: Update docs
Full Changelog: v0.1.2...v0.1.3
v0.1.2
- feat: Support
UserPromptSubmitHook - feat: Add
cwdfield to hook contexts - feat: Support new
HookSpecificOutputform of JSON output - feat: Add error handling utility functions
Full Changelog: v0.1.0...v0.1.2
π Release v0.1.0 - The Beginning
cchooks is now available on PyPI! This is the initial release of our lightweight Python library for building Claude Code hooks with zero configuration.
β¨ What's New
- Complete hook support for all 6 Claude Code hook types:
- PreToolUse - Block dangerous tools before execution
- PostToolUse - React to tool results after execution
- Notification - Handle Claude's notifications
- Stop - Control when Claude stops working
- SubagentStop - Control subagent behavior
- PreCompact - Customize transcript compaction
- Zero-config setup -
create_context()handles all JSON parsing and validation- Type-safe API - Full type hints and IDE autocompletion support
- Dual-mode operation - Simple exit codes OR advanced JSON control
- All features follow Anthropic's official api reference
πββοΈ Quick Start
pip install cchooks#!/usr/bin/env python3
from cchooks import create_context
c = create_context()
if c.tool_name == "Write" and ".env" in c.tool_input.get("file_path", ""):
c.output.exit_block("Protected file!")
else:
c.output.exit_success()π¦ Installation
# With pip
pip install cchooks
# With uv
uv add cchooksπ§ Development Ready
- Complete test suite with 90%+ coverage
- Type checking with mypy
- Linting with ruff
- Comprehensive documentation
- Real-world examples included
π― Perfect For
- Security teams - Block dangerous commands and file operations
- Developer experience - Auto-format, lint, and commit code
- Automation - Integrate with CI/CD and development workflows
- Monitoring - Log and audit Claude's actions
π Resources
- https://github.com/GowayLee/cchooks
- https://github.com/GowayLee/cchooks/blob/main/docs/api-reference.md
- https://docs.anthropic.com/en/docs/claude-code/hooks
Install now: pip install cchooks or uv add cchooks
GitHub: https://github.com/GowayLee/cchooks
PyPI: https://pypi.org/project/cchooks