git-graphable 0.3.0__tar.gz → 0.5.0__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 (64) hide show
  1. {git_graphable-0.3.0 → git_graphable-0.5.0}/.github/workflows/ci.yml +8 -0
  2. git_graphable-0.5.0/.github/workflows/pages.yml +46 -0
  3. {git_graphable-0.3.0 → git_graphable-0.5.0}/.gitignore +1 -3
  4. git_graphable-0.5.0/CHANGELOG.md +60 -0
  5. {git_graphable-0.3.0 → git_graphable-0.5.0}/Justfile +9 -1
  6. {git_graphable-0.3.0 → git_graphable-0.5.0}/PKG-INFO +78 -19
  7. {git_graphable-0.3.0 → git_graphable-0.5.0}/README.md +76 -17
  8. {git_graphable-0.3.0 → git_graphable-0.5.0}/STYLING.md +6 -1
  9. {git_graphable-0.3.0 → git_graphable-0.5.0}/USAGE.md +33 -8
  10. git_graphable-0.5.0/action.yml +77 -0
  11. {git_graphable-0.3.0 → git_graphable-0.5.0}/examples/EXAMPLES.md +29 -11
  12. git_graphable-0.5.0/examples/index_template.html +24 -0
  13. git_graphable-0.5.0/examples/publish_demos.py +110 -0
  14. git_graphable-0.5.0/graph.html +573 -0
  15. {git_graphable-0.3.0 → git_graphable-0.5.0}/pyproject.toml +15 -1
  16. git_graphable-0.5.0/report_output/final_report.json +34 -0
  17. {git_graphable-0.3.0 → git_graphable-0.5.0}/report_output/plus_metadata.json +1 -1
  18. {git_graphable-0.3.0 → git_graphable-0.5.0}/report_output/report.html +102 -48
  19. git_graphable-0.5.0/report_output/screenshots/test_interactivity_toggling_chromium__failure.png +0 -0
  20. git_graphable-0.5.0/src/git_graphable/bare_cli.py +329 -0
  21. git_graphable-0.5.0/src/git_graphable/cli.py +29 -0
  22. git_graphable-0.5.0/src/git_graphable/cli_utils.py +17 -0
  23. {git_graphable-0.3.0 → git_graphable-0.5.0}/src/git_graphable/commands.py +62 -25
  24. {git_graphable-0.3.0 → git_graphable-0.5.0}/src/git_graphable/core.py +30 -0
  25. git_graphable-0.5.0/src/git_graphable/default_config.toml +54 -0
  26. {git_graphable-0.3.0 → git_graphable-0.5.0}/src/git_graphable/highlighter.py +162 -145
  27. {git_graphable-0.3.0 → git_graphable-0.5.0}/src/git_graphable/hygiene.py +20 -11
  28. {git_graphable-0.3.0 → git_graphable-0.5.0}/src/git_graphable/issues.py +1 -2
  29. {git_graphable-0.3.0 → git_graphable-0.5.0}/src/git_graphable/parser.py +46 -25
  30. git_graphable-0.5.0/src/git_graphable/rich_cli.py +348 -0
  31. {git_graphable-0.3.0 → git_graphable-0.5.0}/src/git_graphable/styler.py +332 -13
  32. git_graphable-0.5.0/src/git_graphable/templates.py +137 -0
  33. git_graphable-0.5.0/tests/test_bare_cli.py +88 -0
  34. git_graphable-0.5.0/tests/test_cli.py +30 -0
  35. git_graphable-0.5.0/tests/test_cli_utils.py +16 -0
  36. git_graphable-0.5.0/tests/test_examples_html.py +110 -0
  37. {git_graphable-0.3.0 → git_graphable-0.5.0}/tests/test_hygiene.py +4 -3
  38. git_graphable-0.5.0/tests/test_interactive_html.py +120 -0
  39. git_graphable-0.5.0/tests/test_parser.py +93 -0
  40. git_graphable-0.5.0/tests/test_rich_cli.py +99 -0
  41. {git_graphable-0.3.0 → git_graphable-0.5.0}/tests/test_styler.py +1 -2
  42. git_graphable-0.5.0/tests/test_ui_interactive.py +95 -0
  43. {git_graphable-0.3.0 → git_graphable-0.5.0}/uv.lock +132 -1
  44. git_graphable-0.3.0/CHANGELOG.md +0 -26
  45. git_graphable-0.3.0/report_output/final_report.json +0 -30
  46. git_graphable-0.3.0/src/git_graphable/cli.py +0 -627
  47. git_graphable-0.3.0/tests/test_cli.py +0 -139
  48. git_graphable-0.3.0/tests/test_parser.py +0 -43
  49. {git_graphable-0.3.0 → git_graphable-0.5.0}/.gemini/GEMINI.md +0 -0
  50. {git_graphable-0.3.0 → git_graphable-0.5.0}/.gemini/code-ordering.md +0 -0
  51. {git_graphable-0.3.0 → git_graphable-0.5.0}/.github/dependabot.yml +0 -0
  52. {git_graphable-0.3.0 → git_graphable-0.5.0}/.github/workflows/publish.yml +0 -0
  53. {git_graphable-0.3.0 → git_graphable-0.5.0}/.python-version +0 -0
  54. {git_graphable-0.3.0 → git_graphable-0.5.0}/SECURITY.md +0 -0
  55. {git_graphable-0.3.0 → git_graphable-0.5.0}/examples/generate_demos.py +0 -0
  56. {git_graphable-0.3.0 → git_graphable-0.5.0}/src/git_graphable/__init__.py +0 -0
  57. {git_graphable-0.3.0 → git_graphable-0.5.0}/src/git_graphable/github.py +0 -0
  58. {git_graphable-0.3.0 → git_graphable-0.5.0}/src/git_graphable/models.py +0 -0
  59. {git_graphable-0.3.0 → git_graphable-0.5.0}/tests/test_config.py +0 -0
  60. {git_graphable-0.3.0 → git_graphable-0.5.0}/tests/test_core.py +0 -0
  61. {git_graphable-0.3.0 → git_graphable-0.5.0}/tests/test_github.py +0 -0
  62. {git_graphable-0.3.0 → git_graphable-0.5.0}/tests/test_highlighter.py +0 -0
  63. {git_graphable-0.3.0 → git_graphable-0.5.0}/tests/test_issues.py +0 -0
  64. {git_graphable-0.3.0 → git_graphable-0.5.0}/tests/test_models.py +0 -0
@@ -17,6 +17,8 @@ jobs:
17
17
  steps:
18
18
  - name: Checkout repository
19
19
  uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
20
+ with:
21
+ fetch-depth: 0
20
22
 
21
23
  - name: Install uv
22
24
  uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
@@ -31,3 +33,9 @@ jobs:
31
33
 
32
34
  - name: Run checks
33
35
  run: just check
36
+
37
+ - name: Git Graph Reports
38
+ uses: ./
39
+ with:
40
+ production_branch: 'main'
41
+ output_dir: 'git-graph-reports'
@@ -0,0 +1,46 @@
1
+ name: Deploy Demos to Pages
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+ pages: write
11
+ id-token: write
12
+
13
+ jobs:
14
+ deploy:
15
+ environment:
16
+ name: github-pages
17
+ url: ${{ steps.deployment.outputs.page_url }}
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - name: Checkout
21
+ uses: actions/checkout@v4
22
+ with:
23
+ fetch-depth: 0
24
+
25
+ - name: Setup uv
26
+ uses: astral-sh/setup-uv@v5
27
+ with:
28
+ enable-cache: true
29
+
30
+ - name: Install dependencies
31
+ run: uv sync --all-extras
32
+
33
+ - name: Generate Demos
34
+ run: uv run python examples/publish_demos.py
35
+
36
+ - name: Setup Pages
37
+ uses: actions/configure-pages@v4
38
+
39
+ - name: Upload artifact
40
+ uses: actions/upload-pages-artifact@v3
41
+ with:
42
+ path: 'demo-site'
43
+
44
+ - name: Deploy to GitHub Pages
45
+ id: deployment
46
+ uses: actions/deploy-pages@v4
@@ -131,8 +131,6 @@ cython_debug/
131
131
  .DS_Store
132
132
 
133
133
  # Examples
134
+ demo-site/
134
135
  examples/repos/
135
136
  examples/assets/
136
-
137
- # Temporary test assets
138
- test_pr.mmd
@@ -0,0 +1,60 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [0.5.0] - 2026-03-06
6
+
7
+ ### Added
8
+ - **Interactive Demos**: Implemented `examples/publish_demos.py` to generate and host live HTML demos via GitHub Pages.
9
+ - **Marketplace Preparation**: Moved `action.yml` to the root directory for GitHub Marketplace publishing and updated related documentation and CI workflows.
10
+
11
+ ### Fixed
12
+ - **Squash Merge Detection**: Resolved a `KeyError` and `CycleError` in the logical merge visualization for squashed pull requests when local branch tips were present.
13
+
14
+ ## [0.4.0] - 2026-03-05
15
+
16
+ ### Added
17
+ - **Interactive HTML Viewer**: New `--engine html` output that generates a self-contained interactive graph using Cytoscape.js.
18
+ - Includes searchable nodes and a details sidebar with live highlight toggling.
19
+ - Preserves all visual themes and highlighting styles.
20
+ - Lightweight and portable with zero local dependencies.
21
+ - **Performance Optimizations**:
22
+ - **Parallel Log Parsing**: Parallelized `GitCommit` instantiation using `ProcessPoolExecutor` for large repositories.
23
+ - **Parallel Hygiene Scoring**: Concurrent execution of hygiene checks using `ThreadPoolExecutor` for faster report generation.
24
+ - **Modular CLI Architecture**:
25
+ - Split into `rich_cli` (Typer/Rich) and `bare_cli` (Argparse) for better environment support.
26
+ - Intelligent switcher logic in `cli.py` handles optional dependencies and fallbacks.
27
+ - **New `init` Command**: Easily initialize a default `.git-graphable.toml` configuration file.
28
+ - **Reusable GitHub Action**: Added a composite action in `.github/actions/git-graphable/` for automated reporting.
29
+ - **Robust Distance/Divergence Highlights**: Enhanced visualization of branch distance and divergence with clearer legend labels.
30
+ - **Remote URL Support**: Restored and improved ability to pass remote Git URLs (HTTPS/SSH) as the repository path.
31
+ - **Comprehensive UI Testing**: Integrated Playwright for automated browser-based UI testing of the interactive graph.
32
+
33
+ ### Changed
34
+ - **Command Renamed**: Renamed the primary command from `convert` to `analyze` for better semantic alignment.
35
+ - **Decoupled Hygiene Scoring**: Scoring logic is now independent of visual highlighting options, allowing for more granular configuration.
36
+ - **Template System Refactor**: Extracted large HTML/JS blocks into `src/git_graphable/templates.py` for improved maintainability.
37
+ - **Removed PlantUML Support**: Support for PlantUML has been removed in favor of more customizable engines (Mermaid, D2, HTML).
38
+
39
+ ## [0.3.0] - 2026-03-05
40
+
41
+ ### Added
42
+ - **Customizable Visual Styling**: Full override of node and edge styles (colors, widths, dash patterns) via CLI (`--style`) and TOML (`[git-graphable.theme]`).
43
+ - **Configurable Hygiene Scoring**: Customization of hygiene penalties and caps via TOML (`[git-graphable.hygiene_weights]`).
44
+ - **Advanced Issue Tracker Integration**:
45
+ - **Longevity Mismatch**: Detection of large time gaps between ticket creation and the first commit.
46
+ - **Collaboration Gaps**: Highlighting when the Git author doesn't match the Issue Tracker assignee.
47
+ - **Release Validation**: Verification that "Released" tickets are tagged in Git.
48
+ - **New Documentation**: Added `STYLING.md` guide for visual customization.
49
+ - **Engine Consistency**: Unified styling logic across Mermaid, D2, and Graphviz engines.
50
+
51
+ ### Changed
52
+ - **CLI Refactor**: Migrated to a more robust Typer/Rich implementation with enhanced command-line options.
53
+ - **Issue Engine**: Refactored `IssueTracker` to support richer metadata (assignees, timestamps).
54
+
55
+ ### Fixed
56
+ - Fixed inconsistent color application in Mermaid graphs.
57
+ - Improved cleanup of temporary files during image export.
58
+
59
+ ## [0.2.0] - 2026-03-04
60
+ - Initial functional release with basic Git hygiene scoring and GitHub/Jira integration.
@@ -77,7 +77,15 @@ lint:
77
77
 
78
78
  [group('qa')]
79
79
  @test *args:
80
- uv run -m pytest --git-branch {{ GIT_BRANCH }} --git-commit {{ GIT_COMMIT }} --html-output htmlrep -n auto --should-open-report never {{ args }}
80
+ uv run -m pytest --git-branch {{ GIT_BRANCH }} --git-commit {{ GIT_COMMIT }} --html-output htmlrep -n auto --should-open-report never -m "not ui" {{ args }}
81
+
82
+ [group('qa')]
83
+ install-ui:
84
+ uv run --group ui playwright install chromium
85
+
86
+ [group('qa')]
87
+ @test-ui *args:
88
+ uv run --group ui -m pytest --git-branch {{ GIT_BRANCH }} --git-commit {{ GIT_COMMIT }} --html-output htmlrep -n 1 --should-open-report never -m "ui" {{ args }}
81
89
 
82
90
  [group('qa')]
83
91
  [group('view')]
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: git-graphable
3
- Version: 0.3.0
3
+ Version: 0.5.0
4
4
  Summary: A powerful Git history visualizer and hygiene linter with CI gating.
5
5
  Project-URL: Homepage, https://github.com/TheTrueSCU/git-graphable
6
6
  Project-URL: Issues, https://github.com/TheTrueSCU/git-graphable/issues
7
7
  Project-URL: Repository, https://github.com/TheTrueSCU/git-graphable
8
8
  Author-email: Richard West <dopplereffect.us@gmail.com>
9
- Keywords: analysis,ci,d2,git,git-flow,github,graph,hygiene,lint,mermaid,topology,visualization
9
+ Keywords: analysis,automation,ci,cytoscape,d2,git,git-flow,github,github-actions,graph,html,hygiene,interactive,lint,mermaid,topology,visualization
10
10
  Requires-Python: >=3.13
11
11
  Requires-Dist: graphable>=0.6.0
12
12
  Provides-Extra: cli
@@ -16,17 +16,21 @@ Description-Content-Type: text/markdown
16
16
 
17
17
  # Git Graphable
18
18
 
19
- A powerful Python tool to convert Git commit history into beautiful, interactive flowcharts using the `graphable` library. Supporting Mermaid, D2, Graphviz, and PlantUML.
19
+ A powerful Python tool to convert Git commit history into beautiful, interactive flowcharts using the `graphable` library. Supporting Mermaid, D2, Graphviz, and HTML.
20
20
 
21
21
  ## Git Plugin Support
22
22
  When installed in your PATH, you can use this as a native Git plugin:
23
23
  ```bash
24
- git graphable .
24
+ git graphable analyze .
25
25
  ```
26
26
 
27
+ ## 🚀 Live Interactive Demo
28
+ Check out the tool in action with our **[Live Interactive Demos](https://thetruescu.github.io/git-graphable/)**. Explore different hygiene scenarios and toggle overlays in real-time.
29
+
30
+
27
31
  ## Features
28
32
 
29
- - **Multi-Engine Support**: Export to Mermaid (.mmd), D2 (.d2), Graphviz (.dot), or PlantUML (.puml).
33
+ - **Multi-Engine Support**: Export to Mermaid (.mmd), D2 (.d2), Graphviz (.dot), or HTML (.html).
30
34
  - **Automatic Visualization**: Generates and opens an image (SVG/PNG) automatically if no output is specified.
31
35
  - **Advanced Highlighting**: Visualize author patterns, topological distance, and specific merge paths.
32
36
  - **GitHub Integration**: Highlight commits based on pull request status (Merged, Open, Closed, Draft) using the `gh` CLI.
@@ -53,30 +57,79 @@ For a complete reference of all command-line options, see the [USAGE.md](USAGE.m
53
57
 
54
58
  ```bash
55
59
  # Basic usage (opens a Mermaid image)
56
- uv run git-graphable .
60
+ uv run git-graphable analyze .
57
61
 
58
62
  # Highlight PR status (requires gh CLI)
59
- uv run git-graphable . --highlight-pr-status
63
+ uv run git-graphable analyze . --highlight-pr-status
60
64
 
61
65
  # Specify an engine and output file
62
- uv run git-graphable https://github.com/TheTrueSCU/graphable/ --engine d2 -o graph.svg
66
+ uv run git-graphable analyze https://github.com/TheTrueSCU/graphable/ --engine d2 -o graph.svg
67
+
68
+ # Initialize a default configuration file
69
+ uv run git-graphable init
63
70
 
64
71
  # Simplify the graph (only show branches/tags)
65
- uv run git-graphable . --simplify
72
+ uv run git-graphable analyze . --simplify
73
+ ```
74
+
75
+ ## GitHub Action
76
+
77
+ Git Graphable can be easily integrated into your GitHub workflows to automatically generate hygiene reports on every push or pull request.
78
+
79
+ ```yaml
80
+ jobs:
81
+ git-hygiene:
82
+ runs-on: ubuntu-latest
83
+ steps:
84
+ - uses: actions/checkout@v4
85
+ with:
86
+ fetch-depth: 0 # Required to see full history
87
+
88
+ - name: Generate Git Graph Reports
89
+ uses: TheTrueSCU/git-graphable@v0.5.0
90
+ with:
91
+ production_branch: 'main'
92
+ output_dir: 'reports'
66
93
  ```
67
94
 
95
+ ### Inputs
96
+
97
+ The following inputs are available for the `git-graphable` action:
98
+
99
+ * **`path`**
100
+ * Description: Path to the git repository
101
+ * Required: `false`
102
+ * Default: `'.'`
103
+ * **`production_branch`**
104
+ * Description: The main production branch (e.g. main, master)
105
+ * Required: `false`
106
+ * Default: `'main'`
107
+ * **`issue_engine`**
108
+ * Description: Issue tracker engine (github or jira)
109
+ * Required: `false`
110
+ * **`github_token`**
111
+ * Description: GitHub token for issue integration
112
+ * Required: `false`
113
+ * Default: `${{ github.token }}`
114
+ * **`output_dir`**
115
+ * Description: Directory to save the generated reports
116
+ * Required: `false`
117
+ * Default: `'git-graph-reports'`
118
+
119
+ The action generates a **simplified Mermaid summary** (for quick review) and a **full interactive HTML graph** (for deep-dive auditing), uploading them as workflow artifacts.
120
+
68
121
  ## Highlighting Options
69
122
 
70
123
  Git Graphable provides several ways to highlight commits and relationships. Multiple options can be combined to layer information.
71
124
 
72
125
  | Option | Target | Effect | Conflicts With |
73
126
  | :--- | :--- | :--- | :--- |
74
- | `--highlight-authors` | **Fill** | Unique color per author | PR Status, Distance, Stale, WIP |
75
- | `--highlight-pr-status` | **Fill/Stroke**| Color by PR state (Merged=Purple, Open=Green) | Authors, Distance, Stale, WIP |
76
- | `--highlight-distance-from` | **Fill** | Blue gradient fading by distance | Authors, PR Status, Stale, WIP |
77
- | `--highlight-stale` | **Fill** | Gradient white to red by age | Authors, PR Status, Distance, WIP |
78
- | `--highlight-wip` | **Fill** | Yellow fill for WIP/TODO commits | Authors, PR Status, Distance, Stale |
127
+ | `--highlight-authors` | **Fill** | Unique color per author | PR Status, Distance, Stale |
128
+ | `--highlight-pr-status` | **Fill/Stroke**| Color by PR state (Merged=Purple, Open=Green) | Authors, Distance, Stale |
129
+ | `--highlight-distance-from` | **Fill** | Blue gradient fading by distance | Authors, PR Status, Stale |
130
+ | `--highlight-stale` | **Fill** | Gradient white to red by age | Authors, PR Status, Distance |
79
131
  | `--highlight-path` | **Edge** | Thick Orange edge connecting nodes | None |
132
+ | `--highlight-wip` | **Stroke/Fill** | Yellow highlight for WIP/TODO commits | None |
80
133
  | `--highlight-critical` | **Stroke** | Thick Red Solid outline | None |
81
134
  | `--highlight-diverging-from` | **Stroke** | Orange Dashed outline | None |
82
135
  | `--highlight-orphans` | **Stroke** | Grey Dashed outline | None |
@@ -97,32 +150,38 @@ For a full reference of the default visual styles and how to customize them, see
97
150
  ### Hygiene Analysis
98
151
  Identify problematic patterns like direct pushes to `main`, messy WIP commits, back-merges from `main`, or contributor silos:
99
152
  ```bash
100
- uv run git-graphable . --highlight-direct-pushes --highlight-wip --highlight-squashed --highlight-back-merges --highlight-silos
153
+ uv run git-graphable analyze . --highlight-direct-pushes --highlight-wip --highlight-squashed --highlight-back-merges --highlight-silos
101
154
  ```
102
155
 
103
156
  ### PR Status Highlighting
104
157
  View the current state of all PRs in your repository graph:
105
158
  ```bash
106
- uv run git-graphable . --highlight-pr-status
159
+ uv run git-graphable analyze . --highlight-pr-status
107
160
  ```
108
161
 
109
162
  ### Divergence Analysis (Hygiene)
110
163
  Highlight commits that exist in `main` but are missing from your feature branches:
111
164
  ```bash
112
- uv run git-graphable . --highlight-diverging-from main
165
+ uv run git-graphable analyze . --highlight-diverging-from main
113
166
  ```
114
167
 
115
168
  ### Issue Tracker Integration
116
169
  Flag mismatches between your code and your tickets:
117
170
  ```bash
118
- uv run git-graphable . --highlight-issue-inconsistencies --issue-pattern "[A-Z]+-[0-9]+" --issue-engine jira --jira-url "https://your-org.atlassian.net"
171
+ uv run git-graphable analyze . --highlight-issue-inconsistencies --issue-pattern "[A-Z]+-[0-9]+" --issue-engine jira --jira-url "https://your-org.atlassian.net"
119
172
  ```
120
173
 
121
174
  ### Customizable Scoring & Styling
122
175
  Adjust hygiene penalties and visual styles to match your team's workflow:
123
176
  ```bash
124
177
  # Aggressive penalty for direct pushes and custom teal color for critical branches
125
- uv run git-graphable . --check --penalty direct_push_penalty:50 --style critical:stroke:teal
178
+ uv run git-graphable analyze . --check --penalty direct_push_penalty:50 --style critical:stroke:teal
179
+ ```
180
+
181
+ ### Interactive HTML Viewer
182
+ Generate a self-contained HTML file with a searchable graph, details sidebar, and an interactive legend to live-toggle all highlight modes:
183
+ ```bash
184
+ uv run git-graphable analyze . --engine html -o graph.html
126
185
  ```
127
186
 
128
187
  ## Configuration
@@ -1,16 +1,20 @@
1
1
  # Git Graphable
2
2
 
3
- A powerful Python tool to convert Git commit history into beautiful, interactive flowcharts using the `graphable` library. Supporting Mermaid, D2, Graphviz, and PlantUML.
3
+ A powerful Python tool to convert Git commit history into beautiful, interactive flowcharts using the `graphable` library. Supporting Mermaid, D2, Graphviz, and HTML.
4
4
 
5
5
  ## Git Plugin Support
6
6
  When installed in your PATH, you can use this as a native Git plugin:
7
7
  ```bash
8
- git graphable .
8
+ git graphable analyze .
9
9
  ```
10
10
 
11
+ ## 🚀 Live Interactive Demo
12
+ Check out the tool in action with our **[Live Interactive Demos](https://thetruescu.github.io/git-graphable/)**. Explore different hygiene scenarios and toggle overlays in real-time.
13
+
14
+
11
15
  ## Features
12
16
 
13
- - **Multi-Engine Support**: Export to Mermaid (.mmd), D2 (.d2), Graphviz (.dot), or PlantUML (.puml).
17
+ - **Multi-Engine Support**: Export to Mermaid (.mmd), D2 (.d2), Graphviz (.dot), or HTML (.html).
14
18
  - **Automatic Visualization**: Generates and opens an image (SVG/PNG) automatically if no output is specified.
15
19
  - **Advanced Highlighting**: Visualize author patterns, topological distance, and specific merge paths.
16
20
  - **GitHub Integration**: Highlight commits based on pull request status (Merged, Open, Closed, Draft) using the `gh` CLI.
@@ -37,30 +41,79 @@ For a complete reference of all command-line options, see the [USAGE.md](USAGE.m
37
41
 
38
42
  ```bash
39
43
  # Basic usage (opens a Mermaid image)
40
- uv run git-graphable .
44
+ uv run git-graphable analyze .
41
45
 
42
46
  # Highlight PR status (requires gh CLI)
43
- uv run git-graphable . --highlight-pr-status
47
+ uv run git-graphable analyze . --highlight-pr-status
44
48
 
45
49
  # Specify an engine and output file
46
- uv run git-graphable https://github.com/TheTrueSCU/graphable/ --engine d2 -o graph.svg
50
+ uv run git-graphable analyze https://github.com/TheTrueSCU/graphable/ --engine d2 -o graph.svg
51
+
52
+ # Initialize a default configuration file
53
+ uv run git-graphable init
47
54
 
48
55
  # Simplify the graph (only show branches/tags)
49
- uv run git-graphable . --simplify
56
+ uv run git-graphable analyze . --simplify
57
+ ```
58
+
59
+ ## GitHub Action
60
+
61
+ Git Graphable can be easily integrated into your GitHub workflows to automatically generate hygiene reports on every push or pull request.
62
+
63
+ ```yaml
64
+ jobs:
65
+ git-hygiene:
66
+ runs-on: ubuntu-latest
67
+ steps:
68
+ - uses: actions/checkout@v4
69
+ with:
70
+ fetch-depth: 0 # Required to see full history
71
+
72
+ - name: Generate Git Graph Reports
73
+ uses: TheTrueSCU/git-graphable@v0.5.0
74
+ with:
75
+ production_branch: 'main'
76
+ output_dir: 'reports'
50
77
  ```
51
78
 
79
+ ### Inputs
80
+
81
+ The following inputs are available for the `git-graphable` action:
82
+
83
+ * **`path`**
84
+ * Description: Path to the git repository
85
+ * Required: `false`
86
+ * Default: `'.'`
87
+ * **`production_branch`**
88
+ * Description: The main production branch (e.g. main, master)
89
+ * Required: `false`
90
+ * Default: `'main'`
91
+ * **`issue_engine`**
92
+ * Description: Issue tracker engine (github or jira)
93
+ * Required: `false`
94
+ * **`github_token`**
95
+ * Description: GitHub token for issue integration
96
+ * Required: `false`
97
+ * Default: `${{ github.token }}`
98
+ * **`output_dir`**
99
+ * Description: Directory to save the generated reports
100
+ * Required: `false`
101
+ * Default: `'git-graph-reports'`
102
+
103
+ The action generates a **simplified Mermaid summary** (for quick review) and a **full interactive HTML graph** (for deep-dive auditing), uploading them as workflow artifacts.
104
+
52
105
  ## Highlighting Options
53
106
 
54
107
  Git Graphable provides several ways to highlight commits and relationships. Multiple options can be combined to layer information.
55
108
 
56
109
  | Option | Target | Effect | Conflicts With |
57
110
  | :--- | :--- | :--- | :--- |
58
- | `--highlight-authors` | **Fill** | Unique color per author | PR Status, Distance, Stale, WIP |
59
- | `--highlight-pr-status` | **Fill/Stroke**| Color by PR state (Merged=Purple, Open=Green) | Authors, Distance, Stale, WIP |
60
- | `--highlight-distance-from` | **Fill** | Blue gradient fading by distance | Authors, PR Status, Stale, WIP |
61
- | `--highlight-stale` | **Fill** | Gradient white to red by age | Authors, PR Status, Distance, WIP |
62
- | `--highlight-wip` | **Fill** | Yellow fill for WIP/TODO commits | Authors, PR Status, Distance, Stale |
111
+ | `--highlight-authors` | **Fill** | Unique color per author | PR Status, Distance, Stale |
112
+ | `--highlight-pr-status` | **Fill/Stroke**| Color by PR state (Merged=Purple, Open=Green) | Authors, Distance, Stale |
113
+ | `--highlight-distance-from` | **Fill** | Blue gradient fading by distance | Authors, PR Status, Stale |
114
+ | `--highlight-stale` | **Fill** | Gradient white to red by age | Authors, PR Status, Distance |
63
115
  | `--highlight-path` | **Edge** | Thick Orange edge connecting nodes | None |
116
+ | `--highlight-wip` | **Stroke/Fill** | Yellow highlight for WIP/TODO commits | None |
64
117
  | `--highlight-critical` | **Stroke** | Thick Red Solid outline | None |
65
118
  | `--highlight-diverging-from` | **Stroke** | Orange Dashed outline | None |
66
119
  | `--highlight-orphans` | **Stroke** | Grey Dashed outline | None |
@@ -81,32 +134,38 @@ For a full reference of the default visual styles and how to customize them, see
81
134
  ### Hygiene Analysis
82
135
  Identify problematic patterns like direct pushes to `main`, messy WIP commits, back-merges from `main`, or contributor silos:
83
136
  ```bash
84
- uv run git-graphable . --highlight-direct-pushes --highlight-wip --highlight-squashed --highlight-back-merges --highlight-silos
137
+ uv run git-graphable analyze . --highlight-direct-pushes --highlight-wip --highlight-squashed --highlight-back-merges --highlight-silos
85
138
  ```
86
139
 
87
140
  ### PR Status Highlighting
88
141
  View the current state of all PRs in your repository graph:
89
142
  ```bash
90
- uv run git-graphable . --highlight-pr-status
143
+ uv run git-graphable analyze . --highlight-pr-status
91
144
  ```
92
145
 
93
146
  ### Divergence Analysis (Hygiene)
94
147
  Highlight commits that exist in `main` but are missing from your feature branches:
95
148
  ```bash
96
- uv run git-graphable . --highlight-diverging-from main
149
+ uv run git-graphable analyze . --highlight-diverging-from main
97
150
  ```
98
151
 
99
152
  ### Issue Tracker Integration
100
153
  Flag mismatches between your code and your tickets:
101
154
  ```bash
102
- uv run git-graphable . --highlight-issue-inconsistencies --issue-pattern "[A-Z]+-[0-9]+" --issue-engine jira --jira-url "https://your-org.atlassian.net"
155
+ uv run git-graphable analyze . --highlight-issue-inconsistencies --issue-pattern "[A-Z]+-[0-9]+" --issue-engine jira --jira-url "https://your-org.atlassian.net"
103
156
  ```
104
157
 
105
158
  ### Customizable Scoring & Styling
106
159
  Adjust hygiene penalties and visual styles to match your team's workflow:
107
160
  ```bash
108
161
  # Aggressive penalty for direct pushes and custom teal color for critical branches
109
- uv run git-graphable . --check --penalty direct_push_penalty:50 --style critical:stroke:teal
162
+ uv run git-graphable analyze . --check --penalty direct_push_penalty:50 --style critical:stroke:teal
163
+ ```
164
+
165
+ ### Interactive HTML Viewer
166
+ Generate a self-contained HTML file with a searchable graph, details sidebar, and an interactive legend to live-toggle all highlight modes:
167
+ ```bash
168
+ uv run git-graphable analyze . --engine html -o graph.html
110
169
  ```
111
170
 
112
171
  ## Configuration
@@ -10,13 +10,17 @@ These styles are applied to commit nodes based on their state or identified hygi
10
10
  | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
11
11
  | **Critical** | `red` | - | `4` | `solid` | - | Thick Red Solid outline |
12
12
  | **WIP** | - | `#ffff00` | - | - | - | Yellow background |
13
- | **Behind Base** | `orange` | - | `2` | `dashed`| - | Orange Dashed outline (Divergence) |
13
+ | **Divergence** | `orange` | - | `2` | `dashed`| - | Orange Dashed outline |
14
14
  | **Orphan** | `grey` | - | - | `dashed`| `0.6` | Faded Grey Dashed outline |
15
15
  | **Long Running**| `purple` | - | `3` | `solid` | - | Purple Solid outline |
16
16
  | **PR Conflict** | `red` | - | `6` | `solid` | - | Very Thick Red outline |
17
17
  | **Direct Push** | `#ff0000` | - | `8` | `dashed`| - | Thickest Red Dashed outline |
18
18
  | **Back Merge** | `orange` | - | `4` | `dashed`| - | Thick Orange Dashed outline |
19
19
  | **Silo** | `blue` | - | `6` | `solid` | - | Thick Blue Solid outline |
20
+ | **Issue Desync** | `orange` | - | `4` | `solid` | - | Thick Orange outline |
21
+ | **Release Gap** | `red` | - | `2` | `dashed`| - | Red Dashed outline |
22
+ | **Collab Gap** | `purple` | - | `4` | `dotted`| - | Purple Dotted outline |
23
+ | **Longevity** | `brown` | - | `3` | `solid` | - | Brown Solid outline |
20
24
 
21
25
  ## PR Status Colors
22
26
 
@@ -118,3 +122,4 @@ fill = "#00FF00"
118
122
  * **Mermaid**: Supports all properties. Width is mapped to `stroke-width`. Dash is mapped to `stroke-dasharray`.
119
123
  * **D2**: Supports all properties. `double-border` is automatically enabled for Critical nodes.
120
124
  * **Graphviz**: Supports all properties. `penwidth` is used for width. Dash is mapped to `style=dashed/dotted`.
125
+ * **HTML**: Supports all properties via Cytoscape.js.
@@ -1,13 +1,24 @@
1
1
  # `git-graphable`
2
2
 
3
- Git graph to Mermaid/Graphviz/D2/PlantUML converter.
3
+ Git history hygiene analyzer and visualizer.
4
4
 
5
- **Usage**:
5
+ ## Usage
6
6
 
7
7
  ```console
8
- $ git-graphable [OPTIONS] PATH
8
+ $ git-graphable [COMMAND] [ARGS]...
9
9
  ```
10
10
 
11
+ **Commands**:
12
+
13
+ * `analyze`: Analyze git history and generate a graph (default).
14
+ * `init`: Initialize a default `.git-graphable.toml` configuration file.
15
+
16
+ ---
17
+
18
+ ## `analyze`
19
+
20
+ Analyze git history and generate a graph. This is the default command; if no command is specified, `analyze` is assumed.
21
+
11
22
  **Arguments**:
12
23
 
13
24
  * `PATH`: Path to local directory or git URL [required]
@@ -17,9 +28,13 @@ $ git-graphable [OPTIONS] PATH
17
28
  * `--config TEXT`: Path to TOML configuration file
18
29
  * `--production-branch TEXT`: Production branch name (e.g. main, master)
19
30
  * `--development-branch TEXT`: Development branch name (e.g. develop, main)
20
- * `--date-format TEXT`: Date format for commit labels [default: %Y%m%d%H%M%S]
21
- * `--engine [mermaid|graphviz|d2|plantuml]`: Visualization engine [default: mermaid]
22
- * `-o, --output TEXT`: Output file path
31
+ * `--date-format TEXT`: Date format for commit labels
32
+ * `--engine [mermaid|graphviz|d2|html]`: Visualization engine.
33
+ * **mermaid**: Static text export (default).
34
+ * **graphviz**: Static text export.
35
+ * **d2**: Static text export.
36
+ * **html**: **Interactive HTML Viewer**. Generates a self-contained file with a searchable graph, details sidebar, and a **dynamic legend** to toggle all highlight modes on/off.
37
+ * `-o, --output TEXT`: Output file path. If no output is provided, a temporary file is created and opened automatically.
23
38
  * `--image`: Export as image even when output path is provided
24
39
  * `--simplify`: Pass --simplify-by-decoration to git log
25
40
  * `--limit INTEGER`: Limit the number of commits to process
@@ -59,6 +74,16 @@ $ git-graphable [OPTIONS] PATH
59
74
  * `--check`: Exit with non-zero if hygiene score is below threshold
60
75
  * `--min-score INTEGER`: Minimum hygiene score required for --check
61
76
  * `--bare`: Force bare mode (no rich output)
62
- * `--install-completion`: Install completion for the current shell.
63
- * `--show-completion`: Show completion for the current shell, to copy it or customize the installation.
77
+ * `--help`: Show this message and exit.
78
+
79
+ ---
80
+
81
+ ## `init`
82
+
83
+ Initialize a default `.git-graphable.toml` configuration file.
84
+
85
+ **Options**:
86
+
87
+ * `-o, --output TEXT`: Path to create the config file [default: .git-graphable.toml]
88
+ * `-f, --force`: Overwrite existing config file
64
89
  * `--help`: Show this message and exit.
@@ -0,0 +1,77 @@
1
+ name: 'Git Graphable'
2
+ description: 'Analyze and visualize Git history hygiene with interactive graphs and reports.'
3
+ author: 'TheTrueSCU'
4
+ branding:
5
+ icon: 'bar-chart'
6
+ color: 'green'
7
+
8
+ inputs:
9
+ path:
10
+ description: 'Path to the git repository'
11
+ required: false
12
+ default: '.'
13
+ production_branch:
14
+ description: 'The main production branch (e.g. main, master)'
15
+ required: false
16
+ default: 'main'
17
+ issue_engine:
18
+ description: 'Issue tracker engine (github or jira)'
19
+ required: false
20
+ github_token:
21
+ description: 'GitHub token for issue integration'
22
+ required: false
23
+ default: ${{ github.token }}
24
+ output_dir:
25
+ description: 'Directory to save the generated reports'
26
+ required: false
27
+ default: 'git-graph-reports'
28
+
29
+ runs:
30
+ using: 'composite'
31
+ steps:
32
+ - name: Setup uv
33
+ uses: astral-sh/setup-uv@v5
34
+ with:
35
+ enable-cache: true
36
+
37
+ - name: Install git-graphable
38
+ shell: bash
39
+ run: |
40
+ # Prefer installing local source if we are in the git-graphable repo
41
+ # github.action_path points to the root in this case
42
+ ROOT_DIR="${{ github.action_path }}"
43
+ if [ -f "$ROOT_DIR/pyproject.toml" ] && grep -q "name = \"git-graphable\"" "$ROOT_DIR/pyproject.toml"; then
44
+ echo "Installing git-graphable from local source: $ROOT_DIR"
45
+ uv tool install "$ROOT_DIR"
46
+ else
47
+ echo "Installing git-graphable from PyPI"
48
+ uv tool install git-graphable
49
+ fi
50
+
51
+ - name: Create output directory
52
+ shell: bash
53
+ run: mkdir -p ${{ inputs.output_dir }}
54
+
55
+ - name: Generate Simplified Graph (Mermaid)
56
+ shell: bash
57
+ run: |
58
+ ARGS="--production-branch ${{ inputs.production_branch }} --simplify --engine mermaid -o ${{ inputs.output_dir }}/summary.mmd"
59
+ if [ -n "${{ inputs.issue_engine }}" ]; then ARGS="$ARGS --issue-engine ${{ inputs.issue_engine }}"; fi
60
+ uv tool run git-graphable --bare ${{ inputs.path }} $ARGS
61
+ env:
62
+ GITHUB_TOKEN: ${{ inputs.github_token }}
63
+
64
+ - name: Generate Full Interactive Graph (HTML)
65
+ shell: bash
66
+ run: |
67
+ ARGS="--production-branch ${{ inputs.production_branch }} --engine html -o ${{ inputs.output_dir }}/graph.html"
68
+ if [ -n "${{ inputs.issue_engine }}" ]; then ARGS="$ARGS --issue-engine ${{ inputs.issue_engine }}"; fi
69
+ uv tool run git-graphable --bare ${{ inputs.path }} $ARGS
70
+ env:
71
+ GITHUB_TOKEN: ${{ inputs.github_token }}
72
+
73
+ - name: Upload Reports
74
+ uses: actions/upload-artifact@v4
75
+ with:
76
+ name: git-graph-reports
77
+ path: ${{ inputs.output_dir }}