{"id":36753830,"url":"https://github.com/openshift-hyperfleet/rh-hooks-ai","last_synced_at":"2026-01-12T12:47:41.671Z","repository":{"id":321812988,"uuid":"1087220275","full_name":"openshift-hyperfleet/rh-hooks-ai","owner":"openshift-hyperfleet","description":"A collection of opinionated, AI-first, pre-commit hooks to enforce best practices.","archived":false,"fork":false,"pushed_at":"2025-12-15T14:39:50.000Z","size":61,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-18T19:03:46.747Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openshift-hyperfleet.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"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":"AGENTS.md","dco":null,"cla":null}},"created_at":"2025-10-31T14:59:59.000Z","updated_at":"2025-12-15T14:39:54.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/openshift-hyperfleet/rh-hooks-ai","commit_stats":null,"previous_names":["openshift-hyperfleet/rh-hooks-ai"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/openshift-hyperfleet/rh-hooks-ai","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openshift-hyperfleet%2Frh-hooks-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openshift-hyperfleet%2Frh-hooks-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openshift-hyperfleet%2Frh-hooks-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openshift-hyperfleet%2Frh-hooks-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openshift-hyperfleet","download_url":"https://codeload.github.com/openshift-hyperfleet/rh-hooks-ai/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openshift-hyperfleet%2Frh-hooks-ai/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"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-12T12:47:41.621Z","updated_at":"2026-01-12T12:47:41.665Z","avatar_url":"https://github.com/openshift-hyperfleet.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Red Hat AI-Ready Hooks\n\nPre-commit hooks enforcing AI-readiness best practices for Red Hat development teams.\n\nCurrently, the hooks available from this repo have minimal scope. This serves to drive\nearly adoption to solicit feedback and identify additional practices that can be codified, without\nsignificant adopter friction.\n\n[Issues](https://github.com/openshift-hyperfleet/rh-hooks-ai/issues/new) and PRs that add hooks\nfor enforcing AI-enabled software development practices are welcomed!\n\n## Installation\n\nFirst, navigate to the repository that you want to configure with Red Hat security and AI-readiness practices.\n\nThen run the quick setup script:\n\n```bash\ncurl -sSL https://raw.githubusercontent.com/openshift-hyperfleet/rh-hooks-ai/main/bootstrap/quick-setup.sh | bash\n```\n\nOr manually add to `.pre-commit-config.yaml`:\n\n```yaml\nrepos:\n  - repo: https://github.com/openshift-hyperfleet/rh-hooks-ai\n    rev: v1.0.0  # Use latest release\n    hooks:\n      - id: check-rh-precommit\n      - id: validate-agents-md  # Optional: Remove if not using AGENTS.md\n      - id: ai-attribution-reminder\n      # - id: check-version  # Optional: Enable for update notifications\n```\n\nThen run:\n```bash\npre-commit install\npre-commit install --hook-type pre-push\npre-commit run --all-files # Test\n```\n\n**First-time setup note:** If this is your first time running `pre-commit run --all-files` with rh-pre-commit on this machine, the command may fail with an authentication error. If you see \"Could not find pattern server auth token!\":\n\n**Important:** The error message will display the correct Python path to use, similar to:\n```bash\n# Example (your path will differ):\n/Users/xxx/.cache/pre-commit/repodw86rolm/venv/bin/python3 -m rh_gitleaks login\n```\n\n**Copy the complete path from the error message** and run that command to authenticate.\n\n**About the token:** The authentication token is a **personal credential** tied to your Red Hat account. Do not share it with teammates or commit it to the repository.\n\nAfter logging in and copying the authentication token when prompted, re-run `pre-commit run --all-files` to complete the setup.\n\n## Hooks\n\n### `check-rh-precommit` (blocking)\nEnforces [rh-pre-commit](https://gitlab.cee.redhat.com/infosec-public/developer-workbench/tools/-/tree/main/rh-pre-commit) configuration in `.pre-commit-config.yaml`. Blocks commits if missing.\n\n### `validate-agents-md` (blocking, pre-push only)\nValidates AGENTS.md file exists in git and contains meaningful content (\u003e100 chars). Runs on `git push` to avoid blocking local commits. Based on [agentsmd.net](https://agentsmd.net/) standard.\n\n\n### `ai-attribution-reminder` (non-blocking)\nOne-time reminder to use `Assisted-by:` or `Generated-by:` trailers in commit messages for AI-assisted code.\n\nExample:\n```\nAdd authentication feature\n\nImplements JWT-based auth with refresh tokens.\n\nAssisted-by: Claude Code\n```\n\n### `check-version` (non-blocking, optional)\nChecks for updates once per 24 hours. Commented out by default in baseline config.\n\n## Templates\n\n- `templates/AGENTS.md.template` - Starter template for AI context files\n- `templates/gitmessage.txt` - Commit message template with AI attribution reminder\n\nConfigure commit template:\n```bash\ngit config commit.template .gitmessage\n```\n\n## Important: What to Commit vs. Ignore\n\n**DO commit** `.pre-commit-config.yaml` to your repository - this is a repository-wide configuration that ensures all contributors run the same security and quality checks. It should never be added to `.gitignore`.\n\n**DO add to `.gitignore`:** `.gitmessage` - this is a personal workflow file that each developer can customize locally. The quick-setup script generates it automatically for each user.\n\n## Configuration Examples\n\n**Minimal setup (security enforcement only):**\n```yaml\nrepos:\n  - repo: https://github.com/openshift-hyperfleet/rh-hooks-ai\n    rev: v1.0.0 # Replace with latest tag\n    hooks:\n      - id: check-rh-precommit\n```\n\n**Full AI-ready setup:**\n```yaml\nrepos:\n  - repo: https://github.com/openshift-hyperfleet/rh-hooks-ai\n    rev: v1.0.0 # Replace with latest tag\n    hooks:\n      - id: check-rh-precommit\n      - id: validate-agents-md\n      - id: ai-attribution-reminder\n      - id: check-version\n```\n\n## Resources\n\n- [Red Hat AI Code Assistants Guidelines](https://source.redhat.com/projects_and_programs/ai/wiki/code_assistants_guidelines_for_responsible_use_of_ai_code_assistants)\n- [rh-pre-commit](https://gitlab.cee.redhat.com/infosec-public/developer-workbench/tools/-/tree/main/rh-pre-commit)\n- [AGENTS.md Standard](https://agentsmd.net/)\n- [pre-commit Framework](https://pre-commit.com/)\n\n## Troubleshooting\n\n### Authentication Issues\n\n**\"No module named rh_gitleaks\" error?**\n- Do NOT use system Python (`python3 -m rh_gitleaks`)\n- Copy the full Python path from the error message shown by `pre-commit run --all-files`\n\n**Quick find command** (if error message is unclear):\n```bash\n# Find rh-gitleaks executable (works on all platforms)\nrh_gitleaks=$(find ~/.cache/pre-commit -name \"rh-gitleaks\" -type f 2\u003e/dev/null | head -1)\n\n# Derive Python path from rh-gitleaks\npython_path=\"$(dirname \"$rh_gitleaks\")/python\"\n\n# Use it to login\n\"$python_path\" -m rh_gitleaks login\n```\n\n**Token storage location:** (created automatically after login)\n\nTo check if authenticated:\n```bash\nfind ~/.config -name \"auth*\" -path \"*rh*gitleaks*\" -type f 2\u003e/dev/null\n```\nIf this returns a file path, you're authenticated.\n\n**Token security:**\n- Token is a personal credential tied to your Red Hat account\n- Do not share with teammates\n- Do not commit to repository\n- Each team member needs their own token\n\n### Other Common Issues\n\n**AGENTS.md validation fails?**\n- If not using AGENTS.md, comment out `validate-agents-md` in `.pre-commit-config.yaml`\n- File must be tracked by git and contain \u003e100 characters\n\n**Need help?**\n- Review the complete error message carefully\n- Submit an [Issue](https://github.com/openshift-hyperfleet/rh-hooks-ai/issues)\n- Include error message and output of `pre-commit --version`\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, testing, and release process.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenshift-hyperfleet%2Frh-hooks-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenshift-hyperfleet%2Frh-hooks-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenshift-hyperfleet%2Frh-hooks-ai/lists"}