{"id":50472474,"url":"https://github.com/semcod/giton","last_synced_at":"2026-06-01T11:04:03.137Z","repository":{"id":360741909,"uuid":"1251519298","full_name":"semcod/giton","owner":"semcod","description":null,"archived":false,"fork":false,"pushed_at":"2026-05-27T18:10:31.000Z","size":1023,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-27T19:04:10.287Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/semcod.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2026-05-27T16:55:00.000Z","updated_at":"2026-05-27T18:10:33.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/semcod/giton","commit_stats":null,"previous_names":["semcod/gix"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/semcod/giton","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semcod%2Fgiton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semcod%2Fgiton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semcod%2Fgiton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semcod%2Fgiton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/semcod","download_url":"https://codeload.github.com/semcod/giton/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semcod%2Fgiton/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33771632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-01T02:00:06.963Z","response_time":115,"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":"2026-06-01T11:04:02.123Z","updated_at":"2026-06-01T11:04:03.132Z","avatar_url":"https://github.com/semcod.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# giton\n\n\n## AI Cost Tracking\n\n![PyPI](https://img.shields.io/badge/pypi-costs-blue) ![Version](https://img.shields.io/badge/version-0.1.8-blue) ![Python](https://img.shields.io/badge/python-3.9+-blue) ![License](https://img.shields.io/badge/license-Apache--2.0-green)\n![AI Cost](https://img.shields.io/badge/AI%20Cost-$0.96-orange) ![Human Time](https://img.shields.io/badge/Human%20Time-3.4h-blue) ![Model](https://img.shields.io/badge/Model-openrouter%2Fqwen%2Fqwen3--coder--next-lightgrey)\n\n- 🤖 **LLM usage:** $0.9599 (11 commits)\n- 👤 **Human dev:** ~$339 (3.4h @ $100/h, 30min dedup)\n\nGenerated on 2026-05-27 using [openrouter/qwen/qwen3-coder-next](https://openrouter.ai/qwen/qwen3-coder-next)\n\n---\n\n`giton` is a local AI layer for Git that works between `commit` and `push`.\nIt helps standardize commits, propose safe code fixes, and orchestrate external tools via plugins.\n\n## Does something like this already exist?\n\nPartially: there are tools for AI commit messages, git hooks, and commit-history rewriting.\nWhat is still missing is one local operator that:\n\n- interacts with the user right after commit,\n- proposes code fixes as additional commits (`fixup!`),\n- cleans up history before `push`,\n- integrates plugins via MCP/REST/CLI/gRPC.\n\n## Proposed direction for `giton`\n\n1. **Local-first with safe defaults**\n   - AI proposes changes, user approves them.\n   - Prefer `fixup!` commits over automatic history rewriting.\n\n2. **Git hook layer**\n   - `pre-commit`: policy validation and quick fixes.\n   - `post-commit`: inspect the fresh commit and propose follow-up patches.\n   - `pre-push`: standardize history (`autosquash`, commit naming, final checks).\n\n3. **Plugin architecture**\n   - Shared input/output contract (JSON schema).\n   - Plugin adapters: MCP, REST, CLI shell, gRPC/protobuf.\n\n## MVP usage example\n\nAfter `giton init`, hooks are installed and run automatically from Git lifecycle events.\nThe commands below show equivalent manual execution for demonstration/debugging.\n\n```bash\n# 1) initialize hooks in the repository\ngiton init\n\n# 2) user makes a normal commit\ngit add -p\ngit commit -m \"update stuff\"\n\n# 3) equivalent manual run: post-commit hook logic\ngiton hook post-commit\n\n# 4) equivalent manual run: pre-push hook logic\ngiton hook pre-push\n```\n\nExample interaction:\n\n```text\ngiton: Found 2 issues (example: null check, commit message policy).\ngiton: Apply patch and add commit \"fixup! ...\"? [Y/n]\n```\n\n## MVP plan\n\n- MVP 1: hooks + policy engine + interactive CLI\n- MVP 2: patching + fixup workflow + pre-push autosquash\n- MVP 3: stable plugin API and MCP/REST/CLI/gRPC integrations\n\n## Install\n\n```bash\npip install giton\n```\n\n## Development\n\n### Setup\n\n```bash\n# Clone the repository\ngit clone \u003crepo-url\u003e\ncd gix\n\n# Install in development mode\npip install -e .[dev]\n```\n\n### Dependencies\n\n**Runtime:**\n- `typer\u003e=0.12`\n- `rich\u003e=13.7`\n- `PyYAML\u003e=6.0`\n\n**Development:**\n- `pytest\u003e=8.0`\n- `goal\u003e=2.1.0`\n- `costs\u003e=0.1.20`\n- `pfix\u003e=0.1.60`\n\n### Testing\n\n```bash\n# Run all tests\npytest\n\n# Run specific test file\npytest tests/test_history.py\n\n# Run with coverage\npytest --cov=src/giton\n```\n\n### Environment Variables\n\nCreate a `.env` file in the project root (see `.env.example`):\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `OPENROUTER_API_KEY` | *(not set)* | Required: OpenRouter API key (https://openrouter.ai/keys) |\n| `LLM_MODEL` | `openrouter/qwen/qwen3-coder-next` | Model to use for AI operations |\n| `PFIX_AUTO_APPLY` | `true` | Automatically apply fixes without asking |\n| `PFIX_AUTO_INSTALL_DEPS` | `true` | Automatically pip/uv install dependencies |\n| `PFIX_AUTO_RESTART` | `false` | Restart process after fix using os.execv |\n| `PFIX_MAX_RETRIES` | `3` | Maximum retry attempts |\n| `PFIX_DRY_RUN` | `false` | Run in dry-run mode without making changes |\n| `PFIX_ENABLED` | `true` | Enable automatic fixing |\n| `PFIX_GIT_COMMIT` | `false` | Automatically commit fixes |\n| `PFIX_GIT_PREFIX` | `pfix:` | Commit message prefix for fixes |\n| `PFIX_CREATE_BACKUPS` | `false` | Create backups in `.pfix_backups/` directory |\n\n### Project Structure\n\n```\ngix/\n├── src/giton/           # Main source code\n│   ├── __init__.py      # Package initialization\n│   ├── __main__.py      # Entry point for `python -m giton`\n│   ├── catalog.py       # Plugin catalog management\n│   ├── cli.py           # Command-line interface (Typer)\n│   ├── config.py        # User plugin configuration\n│   ├── context.py       # Git context collection\n│   ├── history.py       # Safe history operations (fixup, autosquash)\n│   ├── hooks.py         # Git hook installation\n│   ├── interactive.py   # Interactive prompts\n│   ├── plugins.py       # Plugin installation/management\n│   ├── policies.py      # Built-in policy engine\n│   ├── repo_config.py   # Repository configuration\n│   ├── runner.py        # Plugin execution runner\n│   └── shell.py         # Interactive REPL shell\n├── tests/               # Test suite\n│   ├── test_basic.py    # Basic functionality tests\n│   ├── test_history.py  # History operations tests\n│   └── test_policies.py # Policy engine tests\n├── examples/            # Usage examples\n│   ├── basic/           # Basic library usage\n│   ├── advanced/        # Advanced features demo\n│   └── testing/         # CI/CD integration example\n├── pyproject.toml       # Project configuration\n├── README.md            # This file\n├── SUMD.md              # System documentation (SUMD)\n├── TODO.md              # Auto-generated TODO list\n└── CHANGELOG.md         # Version history\n```\n\n## Quick start\n\n```bash\ngiton init                # install git hooks + 3 default plugins\ngiton shell               # interactive REPL\ngiton plugin catalog      # browse all available plugins\ngiton plugin install domd # install a specific extension\ngiton plugin install-category lang:python   # install everything for a language\n```\n\n### Default plugins\n\nThe 3 plugins activated by `giton init` cover the most common\nday-to-day needs in a `commit → push` loop:\n\n| name      | category        | trigger      | role                                       |\n| --------- | --------------- | ------------ | ------------------------------------------ |\n| `pyqual`  | `lang:python`   | `pre-commit` | Python lint / type / complexity checks      |\n| `vallm`   | `task:validate` | `post-commit`| Validate AI-generated code/patches          |\n| `pretest` | `task:test`     | `pre-push`   | Run / generate tests before push            |\n\n### Quick-extend categories\n\nEach plugin in the catalog is tagged with a category, so you can install\ngroups at once:\n\n- **languages:** `lang:python`, `lang:markdown`, `lang:any`\n- **tasks:** `task:validate`, `task:test`, `task:refactor`,\n  `task:autofix`, `task:fix`, `task:docs`, `task:security`\n- **integrations:** `integration:mcp`\n\n```bash\ngiton plugin install-category task:autofix\n```\n\n### Interactive shell\n\n```text\n$ giton shell\ngiton\u003e help\ngiton\u003e install-defaults\ngiton\u003e hook pre-commit\ngiton\u003e catalog\ngiton\u003e install prefact\n```\n\n### Built-in policies\n\n`giton` ships with a small zero-dependency policy engine that runs on\nevery hook trigger — even before any plugin is installed:\n\n- **`conventional_commits`** — subject must match\n  `type(scope)?: subject` and stay within `max_subject_length`.\n- **`no_wip_commits`** — blocks subjects matching `wip`, `tmp`, `xxx`, `fixme`.\n- **`no_secrets`** — scans staged additions for AWS keys, private-key\n  headers and `api_key=`/`secret=` patterns.\n- **`max_file_size`** — rejects staged files larger than `kb` (default 512 KB).\n\nInspect or customize them per repo:\n\n```bash\ngiton policy list                    # show active policies\ngiton policy check -t pre-commit     # evaluate without running plugins\ngiton policy init                    # write .giton/config.yaml\n```\n\n`.giton/config.yaml` is a deep-merge over the defaults — disable a\nsingle check or tweak `max_subject_length` without restating everything:\n\n```yaml\npolicies:\n  no_wip_commits:\n    enabled: false\n  conventional_commits:\n    max_subject_length: 100\nhooks:\n  post-commit:\n    fail_on_policy: true   # turn advisory checks into blocking\n```\n\n### Plugin contract\n\nA plugin is any executable command (CLI). The catalog entry declares its\ntrigger, category, install target (PyPI/local path) and command template.\nThe runner expands `{paths}`, `{diff_file}` and `{root}` placeholders\nwith the current git context before invocation.\n\nFuture exec types (`mcp`, `rest`) will share the same JSON in/out\ncontract: input = git context + policy findings, output = list of\nproposed actions (patches, fixup commits, warnings).\n\n## Examples\n\nThe `examples/` directory contains working demonstrations of giton:\n\n- **[examples/basic](examples/basic/)** - Basic usage example showing how to use giton as a Python library to collect git context, run triggers, and handle policy findings and plugin results. Can be run directly or with pytest.\n\n- **[examples/advanced](examples/advanced/)** - Advanced usage example demonstrating plugin management (add, remove, list), custom policy configuration, hook installation/uninstallation, and running multiple triggers in sequence.\n\n- **[examples/testing](examples/testing/)** - Testing example with pytest integration and Docker support. Shows how to integrate giton into CI/CD pipelines with containerized testing environments. Includes Dockerfile and docker-compose.yml for easy setup.\n\n### Running examples with Docker\n\nAll examples include Dockerfiles for containerized execution:\n\n```bash\n# Basic example\ndocker build -f examples/basic/Dockerfile -t giton-example-basic .\ndocker run --rm -v $(pwd)/examples/basic/logs:/app/logs giton-example-basic\n\n# Advanced example\ndocker build -f examples/advanced/Dockerfile -t giton-example-advanced .\ndocker run --rm -v $(pwd)/examples/advanced/logs:/app/logs giton-example-advanced\n\n# Testing example\ndocker build -f examples/testing/Dockerfile -t giton-test .\ndocker run --rm -v $(pwd)/examples/testing/logs:/app/logs giton-test\n```\n\nSee each example's README.md for detailed usage instructions.\n\n\n## License\n\nLicensed under Apache-2.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemcod%2Fgiton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsemcod%2Fgiton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemcod%2Fgiton/lists"}