giton 0.1.2__tar.gz → 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. {giton-0.1.2 → giton-0.1.4}/.idea/workspace.xml +52 -74
  2. giton-0.1.4/CHANGELOG.md +133 -0
  3. {giton-0.1.2 → giton-0.1.4}/PKG-INFO +70 -6
  4. {giton-0.1.2 → giton-0.1.4}/README.md +69 -5
  5. giton-0.1.4/VERSION +1 -0
  6. giton-0.1.4/examples/advanced/Dockerfile +33 -0
  7. giton-0.1.4/examples/advanced/README.md +55 -0
  8. giton-0.1.4/examples/advanced/logs/log.txt +64 -0
  9. giton-0.1.4/examples/advanced/main.py +156 -0
  10. giton-0.1.4/examples/basic/Dockerfile +33 -0
  11. giton-0.1.4/examples/basic/README.md +51 -0
  12. giton-0.1.4/examples/basic/logs/log.txt +13 -0
  13. giton-0.1.4/examples/basic/main.py +67 -0
  14. giton-0.1.4/examples/testing/Dockerfile +37 -0
  15. giton-0.1.4/examples/testing/README.md +166 -0
  16. giton-0.1.4/examples/testing/docker-compose.yml +11 -0
  17. giton-0.1.4/examples/testing/logs/log.txt +17 -0
  18. giton-0.1.4/examples/testing/sample_project/pyproject.toml +12 -0
  19. giton-0.1.4/examples/testing/sample_project/src/example.py +20 -0
  20. giton-0.1.4/examples/testing/sample_project/tests/test_example.py +30 -0
  21. giton-0.1.4/examples/testing/test_giton_integration.py +178 -0
  22. {giton-0.1.2 → giton-0.1.4}/goal.yaml +2 -2
  23. {giton-0.1.2 → giton-0.1.4}/pyproject.toml +1 -1
  24. {giton-0.1.2 → giton-0.1.4}/src/giton/__init__.py +1 -1
  25. giton-0.1.4/src/giton/cli.py +421 -0
  26. giton-0.1.4/src/giton/history.py +140 -0
  27. {giton-0.1.2 → giton-0.1.4}/src/giton/hooks.py +1 -1
  28. giton-0.1.4/src/giton/interactive.py +58 -0
  29. giton-0.1.4/src/giton/policies.py +165 -0
  30. giton-0.1.4/src/giton/repo_config.py +101 -0
  31. {giton-0.1.2 → giton-0.1.4}/src/giton/runner.py +46 -9
  32. {giton-0.1.2 → giton-0.1.4}/src/giton/shell.py +39 -2
  33. giton-0.1.4/tests/test_history.py +133 -0
  34. giton-0.1.4/tests/test_policies.py +98 -0
  35. {giton-0.1.2 → giton-0.1.4}/uv.lock +1 -1
  36. giton-0.1.2/CHANGELOG.md +0 -52
  37. giton-0.1.2/VERSION +0 -1
  38. giton-0.1.2/src/giton/cli.py +0 -171
  39. {giton-0.1.2 → giton-0.1.4}/.gitignore +0 -0
  40. {giton-0.1.2 → giton-0.1.4}/.idea/.gitignore +0 -0
  41. {giton-0.1.2 → giton-0.1.4}/.koru/event-store.jsonl +0 -0
  42. {giton-0.1.2 → giton-0.1.4}/.koru/events/observability.jsonl +0 -0
  43. {giton-0.1.2 → giton-0.1.4}/.koru/history.jsonl +0 -0
  44. {giton-0.1.2 → giton-0.1.4}/.koru/onboarding.json +0 -0
  45. {giton-0.1.2 → giton-0.1.4}/.koru/project.json +0 -0
  46. {giton-0.1.2 → giton-0.1.4}/.planfile/.koru/autonomous-state.json +0 -0
  47. {giton-0.1.2 → giton-0.1.4}/.planfile/.koru/autonomy-telemetry.json +0 -0
  48. {giton-0.1.2 → giton-0.1.4}/.planfile/.koru/event-store.jsonl +0 -0
  49. {giton-0.1.2 → giton-0.1.4}/.planfile/.koru/nfo-events.jsonl +0 -0
  50. {giton-0.1.2 → giton-0.1.4}/.planfile/.koru/operator-steps/mcp_koru.ticket +0 -0
  51. {giton-0.1.2 → giton-0.1.4}/.planfile/.koru/operator-steps/self_control.ticket +0 -0
  52. {giton-0.1.2 → giton-0.1.4}/.planfile/.koru/queue-runner.lock +0 -0
  53. {giton-0.1.2 → giton-0.1.4}/.planfile/.koru/serve-endpoint.json +0 -0
  54. {giton-0.1.2 → giton-0.1.4}/.planfile/config.yaml +0 -0
  55. {giton-0.1.2 → giton-0.1.4}/.planfile/sprints/current.yaml +0 -0
  56. {giton-0.1.2 → giton-0.1.4}/.planfile/sprints/current.yaml.lock +0 -0
  57. {giton-0.1.2 → giton-0.1.4}/LICENSE +0 -0
  58. {giton-0.1.2 → giton-0.1.4}/TODO.md +0 -0
  59. {giton-0.1.2 → giton-0.1.4}/koru.yaml +0 -0
  60. {giton-0.1.2 → giton-0.1.4}/src/giton/__main__.py +0 -0
  61. {giton-0.1.2 → giton-0.1.4}/src/giton/catalog.py +0 -0
  62. {giton-0.1.2 → giton-0.1.4}/src/giton/config.py +0 -0
  63. {giton-0.1.2 → giton-0.1.4}/src/giton/context.py +0 -0
  64. {giton-0.1.2 → giton-0.1.4}/src/giton/plugins.py +0 -0
  65. {giton-0.1.2 → giton-0.1.4}/tests/__init__.py +0 -0
  66. {giton-0.1.2 → giton-0.1.4}/tests/test_basic.py +0 -0
@@ -4,29 +4,7 @@
4
4
  <option name="autoReloadType" value="SELECTIVE" />
5
5
  </component>
6
6
  <component name="ChangeListManager">
7
- <list default="true" id="9532a670-1f01-4d5e-9501-f3491f105c64" name="Changes" comment="">
8
- <change afterPath="$PROJECT_DIR$/.koru/event-store.jsonl" afterDir="false" />
9
- <change afterPath="$PROJECT_DIR$/.koru/events/observability.jsonl" afterDir="false" />
10
- <change afterPath="$PROJECT_DIR$/.koru/history.jsonl" afterDir="false" />
11
- <change afterPath="$PROJECT_DIR$/.koru/onboarding.json" afterDir="false" />
12
- <change afterPath="$PROJECT_DIR$/.koru/project.json" afterDir="false" />
13
- <change afterPath="$PROJECT_DIR$/.planfile/.koru/autonomous-state.json" afterDir="false" />
14
- <change afterPath="$PROJECT_DIR$/.planfile/.koru/autonomy-telemetry.json" afterDir="false" />
15
- <change afterPath="$PROJECT_DIR$/.planfile/.koru/event-store.jsonl" afterDir="false" />
16
- <change afterPath="$PROJECT_DIR$/.planfile/.koru/nfo-events.jsonl" afterDir="false" />
17
- <change afterPath="$PROJECT_DIR$/.planfile/.koru/operator-steps/mcp_koru.ticket" afterDir="false" />
18
- <change afterPath="$PROJECT_DIR$/.planfile/.koru/operator-steps/self_control.ticket" afterDir="false" />
19
- <change afterPath="$PROJECT_DIR$/.planfile/.koru/queue-runner.lock" afterDir="false" />
20
- <change afterPath="$PROJECT_DIR$/.planfile/.koru/serve-endpoint.json" afterDir="false" />
21
- <change afterPath="$PROJECT_DIR$/.planfile/config.yaml" afterDir="false" />
22
- <change afterPath="$PROJECT_DIR$/.planfile/sprints/current.yaml" afterDir="false" />
23
- <change afterPath="$PROJECT_DIR$/.planfile/sprints/current.yaml.lock" afterDir="false" />
24
- <change afterPath="$PROJECT_DIR$/koru.yaml" afterDir="false" />
25
- <change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
26
- <change beforePath="$PROJECT_DIR$/goal.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/goal.yaml" afterDir="false" />
27
- <change beforePath="$PROJECT_DIR$/pyproject.toml" beforeDir="false" afterPath="$PROJECT_DIR$/pyproject.toml" afterDir="false" />
28
- <change beforePath="$PROJECT_DIR$/src/gix/cli.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/gix/cli.py" afterDir="false" />
29
- </list>
7
+ <list default="true" id="9532a670-1f01-4d5e-9501-f3491f105c64" name="Changes" comment="" />
30
8
  <option name="SHOW_DIALOG" value="false" />
31
9
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
32
10
  <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@@ -45,61 +23,61 @@
45
23
  </component>
46
24
  <component name="NextEditCompletionFeaturesState">
47
25
  <decayedCancelled>
48
- <entry key="MS100" value="1.3718424857785465" />
49
- <entry key="MS500" value="3.3112573847521194" />
50
- <entry key="S2" value="5.757179828705393" />
51
- <entry key="S5" value="7.6841756824539456" />
52
- <entry key="S10" value="8.699229618740706" />
53
- <entry key="S30" value="9.717210745606021" />
54
- <entry key="S60" value="11.113347666363076" />
55
- <entry key="M2" value="13.75095879930024" />
56
- <entry key="M5" value="17.495199423296118" />
57
- <entry key="M10" value="19.469986695045137" />
58
- <entry key="M15" value="20.244063435580596" />
59
- <entry key="M30" value="21.085273253896926" />
60
- <entry key="H1" value="21.53302338793371" />
61
- <entry key="H2" value="21.76405315334236" />
62
- <entry key="H4" value="21.881404889788154" />
63
- <entry key="D1" value="21.98014719736049" />
64
- <entry key="W1" value="21.997161747982677" />
26
+ <entry key="MS100" value="1.0000000000016394" />
27
+ <entry key="MS500" value="1.0048613472986452" />
28
+ <entry key="S2" value="1.4823918958692175" />
29
+ <entry key="S5" value="2.8376475316493615" />
30
+ <entry key="S10" value="4.922604928729161" />
31
+ <entry key="S30" value="9.864672845622724" />
32
+ <entry key="S60" value="13.583591778561955" />
33
+ <entry key="M2" value="17.041617563213695" />
34
+ <entry key="M5" value="20.757341980798056" />
35
+ <entry key="M10" value="25.02246746072541" />
36
+ <entry key="M15" value="28.451169700309723" />
37
+ <entry key="M30" value="34.39884597183689" />
38
+ <entry key="H1" value="38.92647076782689" />
39
+ <entry key="H2" value="41.73910183913682" />
40
+ <entry key="H4" value="43.30911009867646" />
41
+ <entry key="D1" value="44.709387797247686" />
42
+ <entry key="W1" value="44.95826307398721" />
65
43
  </decayedCancelled>
66
44
  <decayedSelected>
67
- <entry key="MS100" value="0.0" />
68
- <entry key="MS500" value="0.0" />
69
- <entry key="S2" value="0.0" />
70
- <entry key="S5" value="0.0" />
71
- <entry key="S10" value="0.0" />
72
- <entry key="S30" value="0.0" />
73
- <entry key="S60" value="0.0" />
74
- <entry key="M2" value="0.0" />
75
- <entry key="M5" value="0.0" />
76
- <entry key="M10" value="0.0" />
77
- <entry key="M15" value="0.0" />
78
- <entry key="M30" value="0.0" />
79
- <entry key="H1" value="0.0" />
80
- <entry key="H2" value="0.0" />
81
- <entry key="H4" value="0.0" />
82
- <entry key="D1" value="0.0" />
83
- <entry key="W1" value="0.0" />
45
+ <entry key="MS100" value="7.240933422514253E-81" />
46
+ <entry key="MS500" value="9.374733072317971E-17" />
47
+ <entry key="S2" value="9.83987831412314E-5" />
48
+ <entry key="S5" value="0.02495720182405458" />
49
+ <entry key="S10" value="0.15797848532016817" />
50
+ <entry key="S30" value="0.5405874782871696" />
51
+ <entry key="S60" value="0.7352465425196977" />
52
+ <entry key="M2" value="0.857465184435903" />
53
+ <entry key="M5" value="0.9403436543432286" />
54
+ <entry key="M10" value="0.9697131814836945" />
55
+ <entry key="M15" value="0.9797054697103257" />
56
+ <entry key="M30" value="0.9898007222215619" />
57
+ <entry key="H1" value="0.9948872912152219" />
58
+ <entry key="H2" value="0.9974403697541132" />
59
+ <entry key="H4" value="0.9987193648638809" />
60
+ <entry key="D1" value="0.9997864468307152" />
61
+ <entry key="W1" value="0.9999694896118787" />
84
62
  </decayedSelected>
85
63
  <decayedShown>
86
- <entry key="MS100" value="1.3130341694304903" />
87
- <entry key="MS500" value="3.279711290013356" />
88
- <entry key="S2" value="5.74254019350286" />
89
- <entry key="S5" value="7.676080681885882" />
90
- <entry key="S10" value="8.694587478942692" />
91
- <entry key="S30" value="9.715431623419397" />
92
- <entry key="S60" value="11.112211704324547" />
93
- <entry key="M2" value="13.750130059214802" />
94
- <entry key="M5" value="17.494711142555076" />
95
- <entry key="M10" value="19.469700036990325" />
96
- <entry key="M15" value="20.2438611107584" />
97
- <entry key="M30" value="21.085165964837984" />
98
- <entry key="H1" value="21.532968106864043" />
99
- <entry key="H2" value="21.76402508981725" />
100
- <entry key="H4" value="21.881390750497314" />
101
- <entry key="D1" value="21.98014482572406" />
102
- <entry key="W1" value="21.997161408805948" />
64
+ <entry key="MS100" value="0.9526379980455318" />
65
+ <entry key="MS500" value="0.9951714126125024" />
66
+ <entry key="S2" value="1.4781636163341547" />
67
+ <entry key="S5" value="2.8565972146403893" />
68
+ <entry key="S10" value="5.071579479848386" />
69
+ <entry key="S30" value="10.396989018197777" />
70
+ <entry key="S60" value="14.313077677096812" />
71
+ <entry key="M2" value="17.895511330798325" />
72
+ <entry key="M5" value="21.695995713345905" />
73
+ <entry key="M10" value="25.991240654090763" />
74
+ <entry key="M15" value="29.430206044829276" />
75
+ <entry key="M30" value="35.38827737807125" />
76
+ <entry key="H1" value="39.92116050202656" />
77
+ <entry key="H2" value="42.73643945634703" />
78
+ <entry key="H4" value="44.307776981552585" />
79
+ <entry key="D1" value="45.70916533298035" />
80
+ <entry key="W1" value="45.958231286421686" />
103
81
  </decayedShown>
104
82
  </component>
105
83
  <component name="ProjectColorInfo"><![CDATA[{
@@ -0,0 +1,133 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.4] - 2026-05-27
11
+
12
+ ### Docs
13
+ - Update CHANGELOG.md
14
+ - Update README.md
15
+ - Update examples/advanced/README.md
16
+ - Update examples/basic/README.md
17
+ - Update examples/testing/README.md
18
+
19
+ ### Test
20
+ - Update tests/test_history.py
21
+ - Update tests/test_policies.py
22
+
23
+ ### Other
24
+ - Update VERSION
25
+ - Update examples/advanced/Dockerfile
26
+ - Update examples/advanced/logs/log.txt
27
+ - Update examples/advanced/main.py
28
+ - Update examples/basic/Dockerfile
29
+ - Update examples/basic/logs/log.txt
30
+ - Update examples/basic/main.py
31
+ - Update examples/testing/Dockerfile
32
+ - Update examples/testing/docker-compose.yml
33
+ - Update examples/testing/logs/log.txt
34
+ - ... and 5 more files
35
+
36
+ ## [0.1.4] - 2026-05-27
37
+
38
+ ### Added
39
+ - New `commit-msg` git hook: validates the message file before the
40
+ commit is finalized. Aborts with a tip when policies fail; user's
41
+ message is preserved so they can re-run `git commit`.
42
+ Installed automatically by `giton init`.
43
+ - `giton fixup [--target SHA] [--yes]` — creates a `fixup!` commit
44
+ from the staged index, recording a backup ref under
45
+ `refs/giton/backup/fixup-<timestamp>` first.
46
+ - New `giton history` sub-app:
47
+ - `history log [-n N] [-r RANGE]` — show commits eligible for push,
48
+ highlighting `fixup!` entries.
49
+ - `history clean [--base REF] [--yes] [-i]` — safe
50
+ `git rebase -i --autosquash` with backup ref
51
+ `refs/giton/backup/clean-<timestamp>` and headless edit by default
52
+ (`GIT_SEQUENCE_EDITOR=true GIT_EDITOR=true`).
53
+ - New module `giton/history.py` with reusable primitives:
54
+ `head_sha`, `make_backup_ref`, `list_log`, `upstream_range`,
55
+ `create_fixup`, `has_staged_changes`, `autosquash`.
56
+ - Tests: `tests/test_history.py` (8 cases) covering hook installation,
57
+ backup refs, fixup creation, autosquash, CLI fixup flow, and the
58
+ `commit-msg` hook on both invalid and valid subjects.
59
+
60
+ ### Changed
61
+ - `policies.conventional_commits` and `policies.no_wip_commits` now
62
+ also fire on the `commit-msg` trigger.
63
+ - `repo_config` defaults gained a `commit-msg` entry with
64
+ `fail_on_policy: true`.
65
+ - Fixed `examples/testing/test_giton_integration.py`: positional
66
+ `policy check pre-commit` form replaced with `--trigger pre-commit`
67
+ and the result is now asserted.
68
+
69
+ ## [0.1.3] - 2026-05-27
70
+
71
+ ### Added
72
+ - Built-in policy engine (`giton/policies.py`) with four checks:
73
+ `conventional_commits`, `no_wip_commits`, `no_secrets`,
74
+ `max_file_size`. Runs on every hook trigger, no plugins required.
75
+ - Per-repo configuration file `.giton/config.yaml` with per-policy
76
+ options and per-trigger `fail_on_policy` switch (`giton/repo_config.py`).
77
+ - New CLI sub-app `giton policy` with `check`, `init`, `list` commands.
78
+ - Interactive helper `giton/interactive.py` (`confirm`, `choose`)
79
+ honouring `GITON_NON_INTERACTIVE` and TTY detection.
80
+ - `runner.run_trigger` now returns a `TriggerOutcome` carrying both
81
+ policy findings and plugin results; hooks fail when
82
+ `fail_on_policy` and any error is present.
83
+ - Tests: `tests/test_policies.py` covers all checks, repo-config
84
+ override semantics, and an end-to-end `run_trigger` flow.
85
+
86
+ ### Changed
87
+ - `giton hook pre-commit` / `pre-push` now also evaluate built-in
88
+ policies; `post-commit` runs them advisory by default.
89
+ - Shell REPL gained `policy list|check|init` commands.
90
+
91
+ ## [0.1.2] - 2026-05-27
92
+
93
+ ### Docs
94
+ - Update CHANGELOG.md
95
+ - Update README.md
96
+ - Update TODO.md
97
+
98
+ ### Test
99
+ - Update tests/test_basic.py
100
+
101
+ ### Other
102
+ - Update .gitignore
103
+ - Update .koru/event-store.jsonl
104
+ - Update .koru/events/observability.jsonl
105
+ - Update .koru/history.jsonl
106
+ - Update .koru/onboarding.json
107
+ - Update .koru/project.json
108
+ - Update .planfile/.koru/autonomous-state.json
109
+ - Update .planfile/.koru/autonomy-telemetry.json
110
+ - Update .planfile/.koru/event-store.jsonl
111
+ - Update .planfile/.koru/nfo-events.jsonl
112
+ - ... and 9 more files
113
+
114
+ ## [0.1.1] - 2026-05-27
115
+
116
+ ### Docs
117
+ - Update README.md
118
+
119
+ ### Test
120
+ - Update tests/__init__.py
121
+ - Update tests/test_basic.py
122
+
123
+ ### Other
124
+ - Update .env.example
125
+ - Update .idea/.gitignore
126
+ - Update .idea/giton.iml
127
+ - Update .idea/inspectionProfiles/Project_Default.xml
128
+ - Update .idea/inspectionProfiles/profiles_settings.xml
129
+ - Update .idea/modules.xml
130
+ - Update .idea/pyProjectModel.xml
131
+ - Update .idea/vcs.xml
132
+ - Update uv.lock
133
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: giton
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: Local AI layer for git: orchestrates policies & plugins between commit and push.
5
5
  Author: semcod
6
6
  Author-email: Tom Sapletta <tom@sapletta.com>
@@ -22,10 +22,10 @@ Description-Content-Type: text/markdown
22
22
 
23
23
  ## AI Cost Tracking
24
24
 
25
- ![PyPI](https://img.shields.io/badge/pypi-costs-blue) ![Version](https://img.shields.io/badge/version-0.1.2-blue) ![Python](https://img.shields.io/badge/python-3.9+-blue) ![License](https://img.shields.io/badge/license-Apache--2.0-green)
26
- ![AI Cost](https://img.shields.io/badge/AI%20Cost-$0.41-orange) ![Human Time](https://img.shields.io/badge/Human%20Time-3.0h-blue) ![Model](https://img.shields.io/badge/Model-openrouter%2Fqwen%2Fqwen3--coder--next-lightgrey)
25
+ ![PyPI](https://img.shields.io/badge/pypi-costs-blue) ![Version](https://img.shields.io/badge/version-0.1.4-blue) ![Python](https://img.shields.io/badge/python-3.9+-blue) ![License](https://img.shields.io/badge/license-Apache--2.0-green)
26
+ ![AI Cost](https://img.shields.io/badge/AI%20Cost-$0.51-orange) ![Human Time](https://img.shields.io/badge/Human%20Time-3.0h-blue) ![Model](https://img.shields.io/badge/Model-openrouter%2Fqwen%2Fqwen3--coder--next-lightgrey)
27
27
 
28
- - 🤖 **LLM usage:** $0.4093 (6 commits)
28
+ - 🤖 **LLM usage:** $0.5059 (7 commits)
29
29
  - 👤 **Human dev:** ~$300 (3.0h @ $100/h, 30min dedup)
30
30
 
31
31
  Generated on 2026-05-27 using [openrouter/qwen/qwen3-coder-next](https://openrouter.ai/qwen/qwen3-coder-next)
@@ -45,7 +45,7 @@ What is still missing is one local operator that:
45
45
  - cleans up history before `push`,
46
46
  - integrates plugins via MCP/REST/CLI/gRPC.
47
47
 
48
- ## Proposed direction for `gix`
48
+ ## Proposed direction for `giton`
49
49
 
50
50
  1. **Local-first with safe defaults**
51
51
  - AI proposes changes, user approves them.
@@ -111,7 +111,7 @@ giton plugin install-category lang:python # install everything for a language
111
111
 
112
112
  ### Default plugins
113
113
 
114
- The 3 plugins activated by `gix init` cover the most common
114
+ The 3 plugins activated by `giton init` cover the most common
115
115
  day-to-day needs in a `commit → push` loop:
116
116
 
117
117
  | name | category | trigger | role |
@@ -145,6 +145,40 @@ giton> catalog
145
145
  giton> install prefact
146
146
  ```
147
147
 
148
+ ### Built-in policies
149
+
150
+ `giton` ships with a small zero-dependency policy engine that runs on
151
+ every hook trigger — even before any plugin is installed:
152
+
153
+ - **`conventional_commits`** — subject must match
154
+ `type(scope)?: subject` and stay within `max_subject_length`.
155
+ - **`no_wip_commits`** — blocks subjects matching `wip`, `tmp`, `xxx`, `fixme`.
156
+ - **`no_secrets`** — scans staged additions for AWS keys, private-key
157
+ headers and `api_key=`/`secret=` patterns.
158
+ - **`max_file_size`** — rejects staged files larger than `kb` (default 512 KB).
159
+
160
+ Inspect or customize them per repo:
161
+
162
+ ```bash
163
+ giton policy list # show active policies
164
+ giton policy check -t pre-commit # evaluate without running plugins
165
+ giton policy init # write .giton/config.yaml
166
+ ```
167
+
168
+ `.giton/config.yaml` is a deep-merge over the defaults — disable a
169
+ single check or tweak `max_subject_length` without restating everything:
170
+
171
+ ```yaml
172
+ policies:
173
+ no_wip_commits:
174
+ enabled: false
175
+ conventional_commits:
176
+ max_subject_length: 100
177
+ hooks:
178
+ post-commit:
179
+ fail_on_policy: true # turn advisory checks into blocking
180
+ ```
181
+
148
182
  ### Plugin contract
149
183
 
150
184
  A plugin is any executable command (CLI). The catalog entry declares its
@@ -156,6 +190,36 @@ Future exec types (`mcp`, `rest`) will share the same JSON in/out
156
190
  contract: input = git context + policy findings, output = list of
157
191
  proposed actions (patches, fixup commits, warnings).
158
192
 
193
+ ## Examples
194
+
195
+ The `examples/` directory contains working demonstrations of giton:
196
+
197
+ - **[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.
198
+
199
+ - **[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.
200
+
201
+ - **[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.
202
+
203
+ ### Running examples with Docker
204
+
205
+ All examples include Dockerfiles for containerized execution:
206
+
207
+ ```bash
208
+ # Basic example
209
+ docker build -f examples/basic/Dockerfile -t giton-example-basic .
210
+ docker run --rm -v $(pwd)/examples/basic/logs:/app/logs giton-example-basic
211
+
212
+ # Advanced example
213
+ docker build -f examples/advanced/Dockerfile -t giton-example-advanced .
214
+ docker run --rm -v $(pwd)/examples/advanced/logs:/app/logs giton-example-advanced
215
+
216
+ # Testing example
217
+ docker build -f examples/testing/Dockerfile -t giton-test .
218
+ docker run --rm -v $(pwd)/examples/testing/logs:/app/logs giton-test
219
+ ```
220
+
221
+ See each example's README.md for detailed usage instructions.
222
+
159
223
 
160
224
  ## License
161
225
 
@@ -3,10 +3,10 @@
3
3
 
4
4
  ## AI Cost Tracking
5
5
 
6
- ![PyPI](https://img.shields.io/badge/pypi-costs-blue) ![Version](https://img.shields.io/badge/version-0.1.2-blue) ![Python](https://img.shields.io/badge/python-3.9+-blue) ![License](https://img.shields.io/badge/license-Apache--2.0-green)
7
- ![AI Cost](https://img.shields.io/badge/AI%20Cost-$0.41-orange) ![Human Time](https://img.shields.io/badge/Human%20Time-3.0h-blue) ![Model](https://img.shields.io/badge/Model-openrouter%2Fqwen%2Fqwen3--coder--next-lightgrey)
6
+ ![PyPI](https://img.shields.io/badge/pypi-costs-blue) ![Version](https://img.shields.io/badge/version-0.1.4-blue) ![Python](https://img.shields.io/badge/python-3.9+-blue) ![License](https://img.shields.io/badge/license-Apache--2.0-green)
7
+ ![AI Cost](https://img.shields.io/badge/AI%20Cost-$0.51-orange) ![Human Time](https://img.shields.io/badge/Human%20Time-3.0h-blue) ![Model](https://img.shields.io/badge/Model-openrouter%2Fqwen%2Fqwen3--coder--next-lightgrey)
8
8
 
9
- - 🤖 **LLM usage:** $0.4093 (6 commits)
9
+ - 🤖 **LLM usage:** $0.5059 (7 commits)
10
10
  - 👤 **Human dev:** ~$300 (3.0h @ $100/h, 30min dedup)
11
11
 
12
12
  Generated on 2026-05-27 using [openrouter/qwen/qwen3-coder-next](https://openrouter.ai/qwen/qwen3-coder-next)
@@ -26,7 +26,7 @@ What is still missing is one local operator that:
26
26
  - cleans up history before `push`,
27
27
  - integrates plugins via MCP/REST/CLI/gRPC.
28
28
 
29
- ## Proposed direction for `gix`
29
+ ## Proposed direction for `giton`
30
30
 
31
31
  1. **Local-first with safe defaults**
32
32
  - AI proposes changes, user approves them.
@@ -92,7 +92,7 @@ giton plugin install-category lang:python # install everything for a language
92
92
 
93
93
  ### Default plugins
94
94
 
95
- The 3 plugins activated by `gix init` cover the most common
95
+ The 3 plugins activated by `giton init` cover the most common
96
96
  day-to-day needs in a `commit → push` loop:
97
97
 
98
98
  | name | category | trigger | role |
@@ -126,6 +126,40 @@ giton> catalog
126
126
  giton> install prefact
127
127
  ```
128
128
 
129
+ ### Built-in policies
130
+
131
+ `giton` ships with a small zero-dependency policy engine that runs on
132
+ every hook trigger — even before any plugin is installed:
133
+
134
+ - **`conventional_commits`** — subject must match
135
+ `type(scope)?: subject` and stay within `max_subject_length`.
136
+ - **`no_wip_commits`** — blocks subjects matching `wip`, `tmp`, `xxx`, `fixme`.
137
+ - **`no_secrets`** — scans staged additions for AWS keys, private-key
138
+ headers and `api_key=`/`secret=` patterns.
139
+ - **`max_file_size`** — rejects staged files larger than `kb` (default 512 KB).
140
+
141
+ Inspect or customize them per repo:
142
+
143
+ ```bash
144
+ giton policy list # show active policies
145
+ giton policy check -t pre-commit # evaluate without running plugins
146
+ giton policy init # write .giton/config.yaml
147
+ ```
148
+
149
+ `.giton/config.yaml` is a deep-merge over the defaults — disable a
150
+ single check or tweak `max_subject_length` without restating everything:
151
+
152
+ ```yaml
153
+ policies:
154
+ no_wip_commits:
155
+ enabled: false
156
+ conventional_commits:
157
+ max_subject_length: 100
158
+ hooks:
159
+ post-commit:
160
+ fail_on_policy: true # turn advisory checks into blocking
161
+ ```
162
+
129
163
  ### Plugin contract
130
164
 
131
165
  A plugin is any executable command (CLI). The catalog entry declares its
@@ -137,6 +171,36 @@ Future exec types (`mcp`, `rest`) will share the same JSON in/out
137
171
  contract: input = git context + policy findings, output = list of
138
172
  proposed actions (patches, fixup commits, warnings).
139
173
 
174
+ ## Examples
175
+
176
+ The `examples/` directory contains working demonstrations of giton:
177
+
178
+ - **[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.
179
+
180
+ - **[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.
181
+
182
+ - **[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.
183
+
184
+ ### Running examples with Docker
185
+
186
+ All examples include Dockerfiles for containerized execution:
187
+
188
+ ```bash
189
+ # Basic example
190
+ docker build -f examples/basic/Dockerfile -t giton-example-basic .
191
+ docker run --rm -v $(pwd)/examples/basic/logs:/app/logs giton-example-basic
192
+
193
+ # Advanced example
194
+ docker build -f examples/advanced/Dockerfile -t giton-example-advanced .
195
+ docker run --rm -v $(pwd)/examples/advanced/logs:/app/logs giton-example-advanced
196
+
197
+ # Testing example
198
+ docker build -f examples/testing/Dockerfile -t giton-test .
199
+ docker run --rm -v $(pwd)/examples/testing/logs:/app/logs giton-test
200
+ ```
201
+
202
+ See each example's README.md for detailed usage instructions.
203
+
140
204
 
141
205
  ## License
142
206
 
giton-0.1.4/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.4
@@ -0,0 +1,33 @@
1
+ FROM python:3.13-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Install system dependencies
6
+ RUN apt-get update && apt-get install -y \
7
+ git \
8
+ && rm -rf /var/lib/apt/lists/*
9
+
10
+ # Copy giton source from parent directory (build context is project root)
11
+ COPY ../../src/giton /app/src/giton
12
+ COPY ../../pyproject.toml /app/pyproject.toml
13
+ COPY ../../README.md /app/README.md
14
+
15
+ # Install giton and dependencies
16
+ RUN pip install --no-cache-dir -e .
17
+
18
+ # Install pytest and testing dependencies
19
+ RUN pip install --no-cache-dir pytest pytest-cov
20
+
21
+ # Copy example files
22
+ COPY examples/advanced/main.py /app/main.py
23
+
24
+ # Create log directory
25
+ RUN mkdir -p /app/logs
26
+
27
+ # Set up git repository
28
+ RUN git init && \
29
+ git config user.email "test@example.com" && \
30
+ git config user.name "Test User"
31
+
32
+ # Default command - run example and save logs
33
+ CMD bash -c "python main.py 2>&1 | tee /app/logs/log.txt"
@@ -0,0 +1,55 @@
1
+ # Advanced Giton Example
2
+
3
+ This example demonstrates advanced giton usage including:
4
+ - Custom policy configuration
5
+ - Plugin management
6
+ - Programmatic hook installation
7
+ - Interactive usage patterns
8
+
9
+ ## Setup
10
+
11
+ ```bash
12
+ # Install giton with dev dependencies
13
+ pip install giton[dev]
14
+
15
+ # Initialize giton
16
+ giton init
17
+ ```
18
+
19
+ ## Features Demonstrated
20
+
21
+ The `main.py` script shows:
22
+ - Loading and managing plugins
23
+ - Custom policy evaluation
24
+ - Installing/uninstalling git hooks
25
+ - Running multiple triggers in sequence
26
+ - Handling errors and edge cases
27
+
28
+ ## Running the example
29
+
30
+ ```bash
31
+ cd examples/advanced
32
+ python main.py
33
+ ```
34
+
35
+ ## Advanced Concepts
36
+
37
+ ### Policy Configuration
38
+ Giton uses YAML-based policy files to define rules for:
39
+ - Commit message conventions
40
+ - Code quality standards
41
+ - Security checks
42
+ - Test coverage requirements
43
+
44
+ ### Plugin System
45
+ Plugins can be:
46
+ - CLI tools (exec type)
47
+ - MCP servers
48
+ - REST APIs
49
+ - gRPC services
50
+
51
+ ### Hook Integration
52
+ Giton installs git hooks that delegate to `giton hook <name>`:
53
+ - `pre-commit`: Run checks before committing
54
+ - `post-commit`: Analyze after commit
55
+ - `pre-push`: Final validation before pushing
@@ -0,0 +1,64 @@
1
+ Advanced Giton Example
2
+
3
+ Plugin Catalog
4
+
5
+ Default plugins: 3
6
+
7
+ pyqual
8
+ Category: lang:python
9
+ Description: Python code quality checks (lint, types, complexity).
10
+ Triggers: pre-commit
11
+
12
+ vallm
13
+ Category: task:validate
14
+ Description: Validate LLM-generated code/patches before they land in
15
+ history.
16
+ Triggers: post-commit
17
+
18
+ pretest
19
+ Category: task:test
20
+ Description: Run / generate tests before push.
21
+ Triggers: pre-push
22
+
23
+ Categories: ['integration:mcp', 'lang:any', 'lang:markdown', 'lang:python',
24
+ 'task:autofix', 'task:docs', 'task:fix', 'task:refactor', 'task:security',
25
+ 'task:test', 'task:validate']
26
+
27
+ Plugin Management
28
+
29
+ Current plugins: 0
30
+ ┏━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━┓
31
+ ┃ Name ┃ Category ┃ Triggers ┃ Enabled ┃
32
+ ┡━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━┩
33
+ └──────┴──────────┴──────────┴─────────┘
34
+
35
+ Adding custom plugin...
36
+ ✓ Custom plugin added
37
+
38
+ Removing custom plugin...
39
+ ✓ Custom plugin removed
40
+
41
+ Git Hooks Management
42
+
43
+ Installing git hooks...
44
+ ✓ Installed 4 hooks:
45
+ - pre-commit
46
+ - commit-msg
47
+ - post-commit
48
+ - pre-push
49
+
50
+ Trigger Sequence
51
+
52
+ Running pre-commit...
53
+ giton: no plugins or policies fired for pre-commit
54
+ Outcome: OK
55
+
56
+ Running post-commit...
57
+ giton: no plugins or policies fired for post-commit
58
+ Outcome: OK
59
+
60
+ Running pre-push...
61
+ giton: no plugins or policies fired for pre-push
62
+ Outcome: OK
63
+
64
+ All examples completed successfully!