Modular AI push-hook workflow runner
Project description
ai-push-hooks
AI-assisted pre-push workflow runner for modular repo checks, docs sync, Beads alignment, and PR creation.
Install
Python / uv
uv tool install ai-push-hooks
# or
pipx install ai-push-hooks
npm
npm install --save-dev ai-push-hooks
# or
pnpm add -D ai-push-hooks
The npm binary wraps the bundled Python module, so python3 (or python) must be available.
Maintainer Release
This repo supports automated dual publishing to PyPI and npm from a git tag.
- Bump
versioninpyproject.tomlandpackage.jsonto the same value. - Commit and tag:
git tag vX.Y.Z. - Push commit + tag:
git push && git push --tags.
The GitHub Actions release workflow then:
- verifies the tag matches both package versions
- runs tests
- builds and validates Python distributions
- smoke-tests the installed Python CLI
- publishes to PyPI (Trusted Publishing)
- publishes to npm (
NPM_TOKENsecret)
Required one-time setup:
- Configure PyPI Trusted Publisher for this repository.
- Add repository secret
NPM_TOKENwith publish access toai-push-hooks.
Commands
ai-push-hooks hook <remote-name> <remote-url>
ai-push-hooks init --template minimal-docs
init supports exactly one template: minimal-docs. Use --force to overwrite an existing config.
Lefthook Usage
pre-push:
commands:
ai-push-hooks:
run: ai-push-hooks hook {1} {2}
For local source checkout usage, ./run.sh works as a wrapper entrypoint.
Configuration
Put .ai-push-hooks.toml in the target repo root. If no file is present, built-in modular defaults are used.
Prompt resolution precedence is:
- inline
prompt prompt_file- built-in
fallback_prompt_id
Minimal docs example:
[workflow]
modules = ["docs"]
[modules.docs]
enabled = true
[[modules.docs.steps]]
id = "collect"
type = "collect"
collector = "docs_context"
[[modules.docs.steps]]
id = "query"
type = "llm"
prompt = "Return a JSON array of documentation search queries. JSON only."
inputs = ["collect/push.diff", "collect/changed-files.txt"]
output = "queries.json"
schema = "string_array"
[[modules.docs.steps]]
id = "analyze"
type = "llm"
prompt = "Return JSON issues only for factual documentation drift."
inputs = ["collect/push.diff", "collect/docs-context.txt", "query/queries.json", "collect/recent-commits.txt"]
output = "issues.json"
schema = "docs_issue_array"
[[modules.docs.steps]]
id = "apply"
type = "apply"
prompt = "Apply the minimum Markdown fixes required."
inputs = ["collect/push.diff", "collect/docs-context.txt", "analyze/issues.json"]
allow_paths = ["README.md", "docs/**/*.md"]
[[modules.docs.steps]]
id = "assert"
type = "assert"
assertion = "docs_apply_requires_manual_commit"
inputs = ["apply/result.json"]
Example config that recreates the current docs + beads + PR behavior through configuration only:
The sample below is runnable as-is because each prompt_file step also declares a built-in fallback_prompt_id. If you add local prompt files, they override the built-ins.
[workflow]
modules = ["beads", "docs", "pr"]
[modules.beads]
enabled = true
[[modules.beads.steps]]
id = "collect"
type = "collect"
collector = "beads_status_context"
[[modules.beads.steps]]
id = "plan"
type = "llm"
prompt_file = ".ai-push-hooks.prompts/beads-status.txt"
fallback_prompt_id = "beads-plan-basic"
inputs = ["collect/branch-context.txt", "collect/changed-files.txt", "collect/push.diff", "collect/commits.txt"]
output = "beads-plan.json"
schema = "beads_alignment_result"
[[modules.beads.steps]]
id = "apply"
type = "exec"
executor = "beads_alignment"
inputs = ["plan/beads-plan.json"]
[[modules.beads.steps]]
id = "assert"
type = "assert"
assertion = "beads_alignment_clean"
inputs = ["plan/beads-plan.json"]
[modules.docs]
enabled = true
[[modules.docs.steps]]
id = "collect"
type = "collect"
collector = "docs_context"
[[modules.docs.steps]]
id = "query"
type = "llm"
prompt_file = ".ai-push-hooks.prompts/query.txt"
fallback_prompt_id = "docs-query-basic"
inputs = ["collect/push.diff", "collect/changed-files.txt"]
output = "queries.json"
schema = "string_array"
[[modules.docs.steps]]
id = "analyze"
type = "llm"
prompt_file = ".ai-push-hooks.prompts/analysis.txt"
fallback_prompt_id = "docs-analysis-basic"
inputs = ["collect/push.diff", "collect/docs-context.txt", "query/queries.json", "collect/recent-commits.txt"]
output = "issues.json"
schema = "docs_issue_array"
[[modules.docs.steps]]
id = "apply"
type = "apply"
prompt_file = ".ai-push-hooks.prompts/apply.txt"
fallback_prompt_id = "docs-apply-basic"
inputs = ["collect/push.diff", "collect/docs-context.txt", "analyze/issues.json"]
allow_paths = ["README.md", "docs/**/*.md"]
[[modules.docs.steps]]
id = "assert"
type = "assert"
assertion = "docs_apply_requires_manual_commit"
inputs = ["apply/result.json"]
[modules.pr]
enabled = true
[[modules.pr.steps]]
id = "collect"
type = "collect"
collector = "pr_context"
[[modules.pr.steps]]
id = "compose"
type = "llm"
prompt_file = ".ai-push-hooks.prompts/create-pr.txt"
fallback_prompt_id = "pr-compose-basic"
inputs = ["collect/pr-context.txt", "collect/changed-files.txt", "collect/push.diff", "collect/commits.txt"]
output = "pr-draft.json"
schema = "pr_create_payload"
[[modules.pr.steps]]
id = "create"
type = "exec"
executor = "gh_pr_create"
when_env = "AI_PUSH_HOOKS_CREATE_PR"
inputs = ["compose/pr-draft.json"]
Layout
src/ai_push_hooks/cli.py- CLI entrypointsrc/ai_push_hooks/config.py- config loading and validationsrc/ai_push_hooks/engine.py- scheduler and workflow runtimesrc/ai_push_hooks/artifacts.py- run-directory artifact storesrc/ai_push_hooks/prompts_builtin.py- built-in fallback promptssrc/ai_push_hooks/modules/- docs, beads, and PR collectorssrc/ai_push_hooks/executors/- LLM, apply, exec, and assertion handlersrun.sh- source checkout wrapperbin/ai-push-hooks.js- npm bin wrapper.ai-push-hooks.toml- sample config
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai_push_hooks-0.1.3.tar.gz.
File metadata
- Download URL: ai_push_hooks-0.1.3.tar.gz
- Upload date:
- Size: 29.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1280b37d4cb30bcfc88bd8d1105faf4f64eb4073ccc8c4a7c46e6c89a3639569
|
|
| MD5 |
d087ba1486634715d230f6f1269267b1
|
|
| BLAKE2b-256 |
52bbd96c52e5335944b49fe2bd7255b38306bffe9d03f89c8472160306979d57
|
Provenance
The following attestation bundles were made for ai_push_hooks-0.1.3.tar.gz:
Publisher:
release.yml on shanebishop1/ai-push-hooks
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_push_hooks-0.1.3.tar.gz -
Subject digest:
1280b37d4cb30bcfc88bd8d1105faf4f64eb4073ccc8c4a7c46e6c89a3639569 - Sigstore transparency entry: 1145194519
- Sigstore integration time:
-
Permalink:
shanebishop1/ai-push-hooks@b24d3158619a8f00a1cb52a9e50d7a16e7dbb9fe -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/shanebishop1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b24d3158619a8f00a1cb52a9e50d7a16e7dbb9fe -
Trigger Event:
push
-
Statement type:
File details
Details for the file ai_push_hooks-0.1.3-py3-none-any.whl.
File metadata
- Download URL: ai_push_hooks-0.1.3-py3-none-any.whl
- Upload date:
- Size: 31.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4273602a51f6c8791129eed72bd1af1b06155d8ae463011a523af16f4b8d2a9b
|
|
| MD5 |
92e3cd6fe18b0a33f3c0ba7098e93f37
|
|
| BLAKE2b-256 |
694eacfec6a6f141cffb4ae362e5c047c559de172d2e74e9800ad54273a3991c
|
Provenance
The following attestation bundles were made for ai_push_hooks-0.1.3-py3-none-any.whl:
Publisher:
release.yml on shanebishop1/ai-push-hooks
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_push_hooks-0.1.3-py3-none-any.whl -
Subject digest:
4273602a51f6c8791129eed72bd1af1b06155d8ae463011a523af16f4b8d2a9b - Sigstore transparency entry: 1145194583
- Sigstore integration time:
-
Permalink:
shanebishop1/ai-push-hooks@b24d3158619a8f00a1cb52a9e50d7a16e7dbb9fe -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/shanebishop1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b24d3158619a8f00a1cb52a9e50d7a16e7dbb9fe -
Trigger Event:
push
-
Statement type: