{"id":40605679,"url":"https://github.com/danielnachumdev/githooklib","last_synced_at":"2026-01-21T04:43:23.678Z","repository":{"id":328061377,"uuid":"1110848608","full_name":"danielnachumdev/githooklib","owner":"danielnachumdev","description":"A Python framework for creating, managing, and installing Git hooks with automatic discovery and CLI tools.","archived":false,"fork":false,"pushed_at":"2026-01-19T20:33:43.000Z","size":345,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-20T02:11:22.682Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/danielnachumdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-05T20:19:19.000Z","updated_at":"2026-01-19T20:33:47.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/danielnachumdev/githooklib","commit_stats":null,"previous_names":["danielnachumdev/githooklib"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/danielnachumdev/githooklib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielnachumdev%2Fgithooklib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielnachumdev%2Fgithooklib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielnachumdev%2Fgithooklib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielnachumdev%2Fgithooklib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielnachumdev","download_url":"https://codeload.github.com/danielnachumdev/githooklib/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielnachumdev%2Fgithooklib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28626971,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T02:47:06.670Z","status":"ssl_error","status_checked_at":"2026-01-21T02:45:44.886Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2026-01-21T04:43:23.541Z","updated_at":"2026-01-21T04:43:23.634Z","avatar_url":"https://github.com/danielnachumdev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# githooklib\n\nA Python framework for creating, managing, and installing Git hooks with automatic discovery and CLI tools.\n\n## Installation\n\n```bash\npip install githooklib\n```\n\n## Quick Start\n\n### 1. Create a Hook\n\nCreate a hook by subclassing `GitHook` in a `githooks/` directory:\n\n```python\n# githooks/pre_commit.py\nfrom githooklib import GitHook, HookResult, GitHookContext\n\n\nclass PreCommitHook(GitHook):\n    @property\n    def hook_name(self) -\u003e str:\n        return \"pre-commit\"\n\n    def execute(self, context: GitHookContext) -\u003e HookResult:\n        self.logger.info(\"Running pre-commit checks...\")\n        result = self.command_executor.run([\"python\", \"-m\", \"pytest\"])\n        if not result.success:\n            return HookResult(\n                success=False,\n                message=\"Tests failed. Commit aborted.\",\n                exit_code=1\n            )\n        return HookResult(success=True, message=\"All checks passed!\")\n```\n\n### 2. Install the Hook\n\n```bash\ngithooklib install pre-commit\n```\n\n### 3. Seed Example Hooks\n\n```bash\ngithooklib seed                    # List available examples\ngithooklib seed pre_commit_black   # Seed an example\n```\n\n## CLI Commands\n\n```bash\ngithooklib list                    # List available hooks\ngithooklib show                    # Show installed hooks\ngithooklib install \u003chook-name\u003e     # Install a hook\ngithooklib uninstall \u003chook-name\u003e   # Uninstall a hook\ngithooklib run \u003chook-name\u003e         # Run a hook manually\ngithooklib run \u003chook-name\u003e --debug # Run with debug logging\ngithooklib seed [example-name]     # Seed example hooks\n```\n\n## API Reference\n\n### GitHook\n\nBase class for all Git hooks. Subclass and implement:\n\n- `hook_name` (property): The name of the Git hook (e.g., \"pre-commit\", \"pre-push\")\n- `execute(context: GitHookContext) -\u003e HookResult`: Your hook logic\n\nAvailable attributes:\n- `logger`: Logger instance for logging messages\n- `command_executor`: CommandExecutor instance for running shell commands\n\n### GitHookContext\n\nProvides context when a hook is executed:\n\n- `hook_name`: The name of the hook being executed\n- `stdin_lines`: List of lines from stdin\n- `project_root`: Path to the project root\n- `get_stdin_line(index: int, default: Optional[str]) -\u003e Optional[str]`: Get a specific line from stdin\n- `has_stdin() -\u003e bool`: Check if stdin contains data\n\n### HookResult\n\nReturn value from `execute()`:\n\n- `success`: Whether the hook passed (bool)\n- `message`: Optional message to display (str)\n- `exit_code`: Exit code (0 for success, non-zero for failure)\n\n## Requirements\n\n- Python 3.8+\n\n## License\n\nSee LICENSE file for details.\n\n## Homepage\n\nhttps://github.com/danielnachumdev/githooklib\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielnachumdev%2Fgithooklib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielnachumdev%2Fgithooklib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielnachumdev%2Fgithooklib/lists"}