{"id":29448229,"url":"https://github.com/johnlindquist/claude-hooks","last_synced_at":"2025-10-21T04:41:50.757Z","repository":{"id":304069176,"uuid":"1013426419","full_name":"johnlindquist/claude-hooks","owner":"johnlindquist","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-08T03:19:00.000Z","size":575,"stargazers_count":157,"open_issues_count":5,"forks_count":8,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-02T19:38:57.626Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johnlindquist.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-03T22:10:37.000Z","updated_at":"2025-10-01T17:12:17.000Z","dependencies_parsed_at":"2025-07-11T05:23:42.942Z","dependency_job_id":null,"html_url":"https://github.com/johnlindquist/claude-hooks","commit_stats":null,"previous_names":["johnlindquist/claude-hooks"],"tags_count":32,"template":false,"template_full_name":null,"purl":"pkg:github/johnlindquist/claude-hooks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnlindquist%2Fclaude-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnlindquist%2Fclaude-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnlindquist%2Fclaude-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnlindquist%2Fclaude-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnlindquist","download_url":"https://codeload.github.com/johnlindquist/claude-hooks/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnlindquist%2Fclaude-hooks/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280207158,"owners_count":26290614,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-13T19:01:01.525Z","updated_at":"2025-10-21T04:41:50.752Z","avatar_url":"https://github.com/johnlindquist.png","language":"TypeScript","funding_links":[],"categories":["Hooks 🪝","AI Coding Agents","Other","TypeScript","钩子 🪝"],"sub_categories":["General","Claude Code","通用"],"readme":"# claude-hooks\n\n[![Version](https://img.shields.io/npm/v/claude-hooks.svg)](https://npmjs.org/package/claude-hooks)\n[![License](https://img.shields.io/npm/l/claude-hooks.svg)](https://github.com/johnlindquist/claude-hooks/blob/main/LICENSE)\n[![CI](https://github.com/johnlindquist/claude-hooks/actions/workflows/test.yml/badge.svg)](https://github.com/johnlindquist/claude-hooks/actions/workflows/test.yml)\n\n\u003e TypeScript-powered hook system for Claude Code - write hooks with full type safety and auto-completion\n\n## Overview\n\n`claude-hooks` gives you a powerful, TypeScript-based way to customize Claude Code's behavior. Write hooks with full type safety, auto-completion, and access to strongly-typed payloads - all in familiar TypeScript syntax. No more guessing payload structures or dealing with untyped data!\n\n## Requirements\n\n- [Bun](https://bun.sh) runtime (required for running hooks)\n- Node.js 18+ (for running the CLI)\n\n## Quick Start\n\n```bash\nnpx claude-hooks\n```\n\nThis will:\n- Create `.claude/settings.json` with hook configuration\n- Generate `.claude/hooks/index.ts` with TypeScript handlers\n- Set up typed payload interfaces for all hook types\n- Create utilities for easy hook development\n\n## Installation\n\n### Using npx (Recommended)\n\n```bash\nnpx claude-hooks\n```\n\n### Global Installation\n\n```bash\nnpm install -g claude-hooks\nclaude-hooks\n```\n\n## What It Does\n\nThe CLI sets up a complete TypeScript development environment for Claude hooks:\n\n1. **Full TypeScript Support** - Write hooks with complete type safety and IntelliSense\n2. **Typed Payloads** - Access strongly-typed payload data for all hook types (PreToolUse, PostToolUse, Notification, Stop)\n3. **Ready-to-Customize** - Simple, clean TypeScript files ready for your custom logic\n4. **Generated Files**:\n   - `.claude/settings.json` - Hook configuration\n   - `.claude/hooks/index.ts` - Your main hook handlers (edit this!)\n   - `.claude/hooks/lib.ts` - Type definitions and utilities\n   - `.claude/hooks/session.ts` - Optional session tracking utilities\n\n## Generated Structure\n\n```\n.claude/\n├── settings.json\n└── hooks/\n    ├── index.ts\n    ├── lib.ts\n    └── session.ts\n```\n\nSession logs are saved to: `\u003csystem-temp-dir\u003e/claude-hooks-sessions/`\n\n## Customizing Hooks\n\nThe real power comes from editing `.claude/hooks/index.ts`. You get full TypeScript support with typed payloads:\n\n```typescript\n// Example: Track and log specific tool usage\nasync function preToolUse(payload: PreToolUsePayload): Promise\u003cHookResponse\u003e {\n  // Full type safety - TypeScript knows exactly what's in the payload!\n  if (payload.tool_name === 'Write' \u0026\u0026 payload.tool_input) {\n    const { file_path, content } = payload.tool_input as WriteToolInput\n    console.log(`Claude is writing to: ${file_path}`)\n    \n    // Add your custom logic here\n    // Maybe notify a webhook, update a dashboard, etc.\n  }\n  \n  return { action: 'continue' }\n}\n\n// Example: React to completed tasks\nasync function postToolUse(payload: PostToolUsePayload): Promise\u003cvoid\u003e {\n  if (payload.tool_name === 'Bash' \u0026\u0026 payload.success) {\n    // TypeScript gives you auto-completion for all payload properties!\n    console.log(`Command completed: ${payload.tool_input.command}`)\n  }\n}\n```\n\nThe beauty is that you're writing regular TypeScript - use any npm packages, async/await, or patterns you're familiar with!\n\n## Command Options\n\n```bash\nclaude-hooks init [OPTIONS]\n\nOPTIONS:\n  -f, --force    Overwrite existing hooks\n  -h, --help     Show help\n```\n\n## Requirements\n\n- Node.js \u003e= 18.0.0\n- **[Bun](https://bun.sh)** - Required to run the hooks\n  ```bash\n  curl -fsSL https://bun.sh/install | bash\n  ```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnlindquist%2Fclaude-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnlindquist%2Fclaude-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnlindquist%2Fclaude-hooks/lists"}