git-graphable 0.5.0__tar.gz → 0.7.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 (107) hide show
  1. {git_graphable-0.5.0 → git_graphable-0.7.0}/.github/workflows/ci.yml +13 -0
  2. git_graphable-0.7.0/.github/workflows/pages.yml +65 -0
  3. {git_graphable-0.5.0 → git_graphable-0.7.0}/.gitignore +2 -0
  4. git_graphable-0.7.0/CHANGELOG.md +110 -0
  5. git_graphable-0.7.0/HYGIENE.md +168 -0
  6. git_graphable-0.7.0/LICENSE +21 -0
  7. {git_graphable-0.5.0 → git_graphable-0.7.0}/PKG-INFO +22 -16
  8. {git_graphable-0.5.0 → git_graphable-0.7.0}/README.md +18 -14
  9. {git_graphable-0.5.0 → git_graphable-0.7.0}/USAGE.md +7 -2
  10. {git_graphable-0.5.0 → git_graphable-0.7.0}/action.yml +13 -2
  11. {git_graphable-0.5.0 → git_graphable-0.7.0}/pyproject.toml +13 -1
  12. {git_graphable-0.5.0 → git_graphable-0.7.0}/src/git_graphable/bare_cli.py +43 -7
  13. {git_graphable-0.5.0 → git_graphable-0.7.0}/src/git_graphable/commands.py +5 -2
  14. {git_graphable-0.5.0 → git_graphable-0.7.0}/src/git_graphable/core.py +16 -1
  15. {git_graphable-0.5.0 → git_graphable-0.7.0}/src/git_graphable/default_config.toml +1 -1
  16. git_graphable-0.7.0/src/git_graphable/github.py +25 -0
  17. git_graphable-0.7.0/src/git_graphable/highlighter.py +7 -0
  18. git_graphable-0.7.0/src/git_graphable/highlights/core.py +59 -0
  19. git_graphable-0.7.0/src/git_graphable/highlights/external.py +259 -0
  20. git_graphable-0.7.0/src/git_graphable/highlights/hygiene.py +242 -0
  21. git_graphable-0.7.0/src/git_graphable/highlights/visual.py +119 -0
  22. {git_graphable-0.5.0 → git_graphable-0.7.0}/src/git_graphable/hygiene.py +96 -11
  23. git_graphable-0.7.0/src/git_graphable/issues/__init__.py +47 -0
  24. git_graphable-0.7.0/src/git_graphable/issues/base.py +35 -0
  25. git_graphable-0.7.0/src/git_graphable/issues/github.py +50 -0
  26. git_graphable-0.7.0/src/git_graphable/issues/gitlab.py +40 -0
  27. git_graphable-0.7.0/src/git_graphable/issues/jira.py +76 -0
  28. git_graphable-0.7.0/src/git_graphable/issues/script.py +69 -0
  29. {git_graphable-0.5.0 → git_graphable-0.7.0}/src/git_graphable/parser.py +1 -1
  30. git_graphable-0.7.0/src/git_graphable/prs/__init__.py +37 -0
  31. git_graphable-0.7.0/src/git_graphable/prs/base.py +40 -0
  32. git_graphable-0.7.0/src/git_graphable/prs/github.py +61 -0
  33. git_graphable-0.7.0/src/git_graphable/prs/gitlab.py +55 -0
  34. git_graphable-0.7.0/src/git_graphable/prs/script.py +56 -0
  35. {git_graphable-0.5.0 → git_graphable-0.7.0}/src/git_graphable/rich_cli.py +35 -2
  36. git_graphable-0.7.0/src/git_graphable/styler.py +79 -0
  37. git_graphable-0.7.0/src/git_graphable/styling/base.py +133 -0
  38. git_graphable-0.7.0/src/git_graphable/styling/generic.py +132 -0
  39. git_graphable-0.7.0/src/git_graphable/styling/html.py +343 -0
  40. git_graphable-0.7.0/src/git_graphable/styling/mermaid.py +87 -0
  41. git_graphable-0.7.0/tests/__init__.py +0 -0
  42. git_graphable-0.7.0/tests/conftest.py +33 -0
  43. git_graphable-0.7.0/tests/highlights/__init__.py +0 -0
  44. git_graphable-0.7.0/tests/highlights/test_external.py +328 -0
  45. git_graphable-0.7.0/tests/highlights/test_hygiene.py +202 -0
  46. git_graphable-0.7.0/tests/highlights/test_visual.py +59 -0
  47. git_graphable-0.7.0/tests/issues/__init__.py +0 -0
  48. git_graphable-0.7.0/tests/issues/test_github.py +14 -0
  49. git_graphable-0.7.0/tests/issues/test_gitlab.py +25 -0
  50. git_graphable-0.7.0/tests/issues/test_jira_engine.py +25 -0
  51. git_graphable-0.7.0/tests/issues/test_script.py +107 -0
  52. git_graphable-0.7.0/tests/prs/__init__.py +0 -0
  53. git_graphable-0.7.0/tests/prs/test_github.py +32 -0
  54. git_graphable-0.7.0/tests/prs/test_gitlab.py +38 -0
  55. git_graphable-0.7.0/tests/prs/test_script.py +71 -0
  56. git_graphable-0.7.0/tests/styling/__init__.py +0 -0
  57. git_graphable-0.7.0/tests/styling/test_generic.py +111 -0
  58. git_graphable-0.7.0/tests/styling/test_mermaid.py +58 -0
  59. {git_graphable-0.5.0 → git_graphable-0.7.0}/tests/test_bare_cli.py +54 -25
  60. git_graphable-0.7.0/tests/test_commands.py +60 -0
  61. git_graphable-0.7.0/tests/test_highlighter.py +9 -0
  62. git_graphable-0.7.0/tests/test_hygiene_scorer.py +91 -0
  63. {git_graphable-0.5.0 → git_graphable-0.7.0}/tests/test_parser.py +10 -0
  64. {git_graphable-0.5.0 → git_graphable-0.7.0}/tests/test_rich_cli.py +26 -0
  65. git_graphable-0.7.0/tests/test_styler.py +15 -0
  66. {git_graphable-0.5.0 → git_graphable-0.7.0}/uv.lock +1 -1
  67. git_graphable-0.5.0/.github/workflows/pages.yml +0 -46
  68. git_graphable-0.5.0/CHANGELOG.md +0 -60
  69. git_graphable-0.5.0/graph.html +0 -573
  70. git_graphable-0.5.0/report_output/final_report.json +0 -34
  71. git_graphable-0.5.0/report_output/plus_metadata.json +0 -8
  72. git_graphable-0.5.0/report_output/report.html +0 -700
  73. git_graphable-0.5.0/report_output/screenshots/test_interactivity_toggling_chromium__failure.png +0 -0
  74. git_graphable-0.5.0/src/git_graphable/github.py +0 -77
  75. git_graphable-0.5.0/src/git_graphable/highlighter.py +0 -644
  76. git_graphable-0.5.0/src/git_graphable/issues.py +0 -177
  77. git_graphable-0.5.0/src/git_graphable/styler.py +0 -709
  78. git_graphable-0.5.0/tests/test_highlighter.py +0 -198
  79. git_graphable-0.5.0/tests/test_hygiene.py +0 -540
  80. git_graphable-0.5.0/tests/test_issues.py +0 -42
  81. git_graphable-0.5.0/tests/test_styler.py +0 -64
  82. {git_graphable-0.5.0 → git_graphable-0.7.0}/.gemini/GEMINI.md +0 -0
  83. {git_graphable-0.5.0 → git_graphable-0.7.0}/.gemini/code-ordering.md +0 -0
  84. {git_graphable-0.5.0 → git_graphable-0.7.0}/.github/dependabot.yml +0 -0
  85. {git_graphable-0.5.0 → git_graphable-0.7.0}/.github/workflows/publish.yml +0 -0
  86. {git_graphable-0.5.0 → git_graphable-0.7.0}/.python-version +0 -0
  87. {git_graphable-0.5.0 → git_graphable-0.7.0}/Justfile +0 -0
  88. {git_graphable-0.5.0 → git_graphable-0.7.0}/SECURITY.md +0 -0
  89. {git_graphable-0.5.0 → git_graphable-0.7.0}/STYLING.md +0 -0
  90. {git_graphable-0.5.0 → git_graphable-0.7.0}/examples/EXAMPLES.md +0 -0
  91. {git_graphable-0.5.0 → git_graphable-0.7.0}/examples/generate_demos.py +0 -0
  92. {git_graphable-0.5.0 → git_graphable-0.7.0}/examples/index_template.html +0 -0
  93. {git_graphable-0.5.0 → git_graphable-0.7.0}/examples/publish_demos.py +0 -0
  94. {git_graphable-0.5.0 → git_graphable-0.7.0}/src/git_graphable/__init__.py +0 -0
  95. {git_graphable-0.5.0 → git_graphable-0.7.0}/src/git_graphable/cli.py +0 -0
  96. {git_graphable-0.5.0 → git_graphable-0.7.0}/src/git_graphable/cli_utils.py +0 -0
  97. {git_graphable-0.5.0 → git_graphable-0.7.0}/src/git_graphable/models.py +0 -0
  98. {git_graphable-0.5.0 → git_graphable-0.7.0}/src/git_graphable/templates.py +0 -0
  99. {git_graphable-0.5.0 → git_graphable-0.7.0}/tests/test_cli.py +0 -0
  100. {git_graphable-0.5.0 → git_graphable-0.7.0}/tests/test_cli_utils.py +0 -0
  101. {git_graphable-0.5.0 → git_graphable-0.7.0}/tests/test_config.py +0 -0
  102. {git_graphable-0.5.0 → git_graphable-0.7.0}/tests/test_core.py +0 -0
  103. {git_graphable-0.5.0 → git_graphable-0.7.0}/tests/test_examples_html.py +0 -0
  104. {git_graphable-0.5.0 → git_graphable-0.7.0}/tests/test_github.py +0 -0
  105. {git_graphable-0.5.0 → git_graphable-0.7.0}/tests/test_interactive_html.py +0 -0
  106. {git_graphable-0.5.0 → git_graphable-0.7.0}/tests/test_models.py +0 -0
  107. {git_graphable-0.5.0 → git_graphable-0.7.0}/tests/test_ui_interactive.py +0 -0
@@ -34,8 +34,21 @@ jobs:
34
34
  - name: Run checks
35
35
  run: just check
36
36
 
37
+ - name: Generate Coverage Badge
38
+ run: |
39
+ if [ -f "htmlcov/index.html" ]; then
40
+ COVERAGE=$(grep -oP 'pc_cov">\d+%' htmlcov/index.html | head -1 | grep -oP '\d+')
41
+ echo "{\"schemaVersion\": 1, \"label\": \"coverage\", \"message\": \"$COVERAGE%\", \"color\": \"brightgreen\"}" > coverage.json
42
+ fi
43
+
37
44
  - name: Git Graph Reports
38
45
  uses: ./
39
46
  with:
40
47
  production_branch: 'main'
41
48
  output_dir: 'git-graph-reports'
49
+
50
+ - name: Copy Coverage to Reports
51
+ run: |
52
+ if [ -f "coverage.json" ]; then
53
+ cp coverage.json git-graph-reports/
54
+ fi
@@ -0,0 +1,65 @@
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: Install just
34
+ uses: extractions/setup-just@v3
35
+
36
+ - name: Generate Demos
37
+ run: uv run python examples/publish_demos.py
38
+
39
+ - name: Generate Coverage Badge
40
+ run: |
41
+ just coverage
42
+ if [ -f "htmlcov/index.html" ]; then
43
+ COVERAGE=$(grep -oP 'pc_cov">\d+%' htmlcov/index.html | head -1 | grep -oP '\d+')
44
+ echo "{\"schemaVersion\": 1, \"label\": \"coverage\", \"message\": \"$COVERAGE%\", \"color\": \"brightgreen\"}" > demo-site/coverage.json
45
+ fi
46
+
47
+ - name: Generate Hygiene Badge
48
+ run: |
49
+ uv run git-graphable analyze . --bare --hygiene-output hygiene.json --output -
50
+ SCORE=$(grep -oP '"score": \d+' hygiene.json | grep -oP '\d+')
51
+ GRADE=$(grep -oP '"grade": "[^"]+"' hygiene.json | cut -d'"' -f4)
52
+ COLOR=$(grep -oP '"color": "[^"]+"' hygiene.json | cut -d'"' -f4)
53
+ echo "{\"schemaVersion\": 1, \"label\": \"hygiene\", \"message\": \"$SCORE% ($GRADE)\", \"color\": \"$COLOR\"}" > demo-site/hygiene_badge.json
54
+
55
+ - name: Setup Pages
56
+ uses: actions/configure-pages@v4
57
+
58
+ - name: Upload artifact
59
+ uses: actions/upload-pages-artifact@v3
60
+ with:
61
+ path: 'demo-site'
62
+
63
+ - name: Deploy to GitHub Pages
64
+ id: deployment
65
+ uses: actions/deploy-pages@v4
@@ -39,6 +39,7 @@ pip-delete-this-directory.txt
39
39
  # Unit test / coverage reports
40
40
  htmlcov/
41
41
  htmlrep/
42
+ report_output/
42
43
  .pytest_worker_jsons/
43
44
  .tox/
44
45
  .nox/
@@ -134,3 +135,4 @@ cython_debug/
134
135
  demo-site/
135
136
  examples/repos/
136
137
  examples/assets/
138
+ graph.html
@@ -0,0 +1,110 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [0.7.0] - 2026-03-07
6
+
7
+ ### Added
8
+ - **Security Trust Enforcement**: Custom scripts (`issue_script`, `pr_script`) and sensitive API integrations (Jira) are now disabled by default for untrusted local configurations. Users must explicitly use `--trust` to enable these features for repository-local configs.
9
+ - **Actionable Hygiene Intelligence**: The hygiene summary now provides specific details (commit hashes, branch names) for every deduction, allowing users to precisely identify and fix hygiene issues.
10
+ - **Selective Hygiene Ignore**: Introduced a SHA-based ignore mechanism to suppress specific hygiene rules. Supported via `.git-graphable.toml` (or `pyproject.toml`) and the `--ignore` CLI flag.
11
+ - **Remediation Guidelines**: Added a comprehensive [HYGIENE.md](HYGIENE.md) guide with actionable Git commands to help users improve their project's hygiene score.
12
+
13
+ ### Fixed
14
+ - **Critical Command Injection Mitigation**: Fixed a vulnerability in `ScriptIssueEngine` where malicious `issue_id` strings could inject shell commands. Switched to `sh -c` with positional arguments for safe execution.
15
+ - **Credential Theft Prevention**: Prevented potential Jira token exposure to untrusted URLs by enforcing the trust model for Jira configurations.
16
+ - **XSS Mitigation**: Fixed a medium-severity XSS vulnerability in interactive HTML export legend generation by properly escaping repository-derived data.
17
+
18
+ ## [0.6.0] - 2026-03-06
19
+
20
+ ### Added
21
+ - **Native GitLab Support**: Added support for GitLab Merge Requests and Issues using the `glab` CLI.
22
+ - **Pull Request Provider Abstraction**: Introduced a new `PullRequestProvider` interface, decoupling PR status logic from GitHub.
23
+ - Added `GitHubPullRequestProvider` (default) using the `gh` CLI.
24
+ - Added `ScriptPullRequestProvider` for custom script-based PR status lookups.
25
+ - **Configuration Trust Mechanism**: Introduced a security layer for local repository configurations.
26
+ - Added `--trust` CLI flag to explicitly trust automatically loaded `.git-graphable.toml` or `pyproject.toml` files.
27
+ - Users are now warned when executing custom scripts from untrusted configurations.
28
+ - **Dynamic Project Badges**:
29
+ - Added automated generation of Shields.io-compatible JSON badges for **Git Hygiene** and **Code Coverage**.
30
+ - Updated `README.md` to display live status from GitHub Pages.
31
+ - Added `--hygiene-output <path>` to CLI for machine-readable (JSON) hygiene summaries.
32
+ - **Improved Automatic Visualization**:
33
+ - Restored the behavior of automatically opening a graph if no output path is provided.
34
+ - Changed default automatic visualization export format from SVG to **PNG** for broader compatibility.
35
+ - **Modular Architecture Refactor**: Substantially reorganized the codebase into specialized sub-packages for better maintainability:
36
+ - `src/git_graphable/prs/`: Modular PR providers.
37
+ - `src/git_graphable/issues/`: Modular issue tracker engines.
38
+ - `src/git_graphable/highlights/`: Specialized highlighting logic (visual, hygiene, external).
39
+ - `src/git_graphable/styling/`: Specialized styling logic per visualization engine.
40
+ - **Enhanced Issue Scripting**: `ScriptIssueEngine` now supports robust JSON output from scripts (with legacy CSV fallback).
41
+ - **Project Governance**: Added official **MIT License** to the repository.
42
+ - **Reorganized Test Suite**: Refactored tests into a modular structure mirroring the source code, including a global `conftest.py` for shared fixtures.
43
+
44
+ ### Fixed
45
+ - **Comprehensive Security Hardening**:
46
+ - Protected against argument injection in `git clone`, `glab`, `gh`, and `git rev-list` commands using the `--` separator.
47
+ - Resolved potential path traversal and SSRF risks in Jira issue lookups by properly URL-encoding IDs.
48
+ - Corrected argument passing logic for `git log` limits.
49
+ - **Mermaid Parser Reliability**: Fixed parsing errors in Mermaid graphs by substituting sensitive characters (brackets and parentheses) with visually similar full-width Unicode characters.
50
+ - **CI Stability**: Fixed CI failures in GitHub Pages deployment by preventing automatic visualization triggers during badge generation.
51
+ - **Naming Collisions**: Resolved pytest module collision issues by adding `__init__.py` files to test directories.
52
+ - **Code Maintenance**: Updated `.gitignore` to prevent tracking of build artifacts and coverage data.
53
+
54
+
55
+ ## [0.5.0] - 2026-03-06
56
+
57
+ ### Added
58
+ - **Interactive Demos**: Implemented `examples/publish_demos.py` to generate and host live HTML demos via GitHub Pages.
59
+ - **Marketplace Preparation**: Moved `action.yml` to the root directory for GitHub Marketplace publishing and updated related documentation and CI workflows.
60
+
61
+ ### Fixed
62
+ - **Squash Merge Detection**: Resolved a `KeyError` and `CycleError` in the logical merge visualization for squashed pull requests when local branch tips were present.
63
+
64
+ ## [0.4.0] - 2026-03-05
65
+
66
+ ### Added
67
+ - **Interactive HTML Viewer**: New `--engine html` output that generates a self-contained interactive graph using Cytoscape.js.
68
+ - Includes searchable nodes and a details sidebar with live highlight toggling.
69
+ - Preserves all visual themes and highlighting styles.
70
+ - Lightweight and portable with zero local dependencies.
71
+ - **Performance Optimizations**:
72
+ - **Parallel Log Parsing**: Parallelized `GitCommit` instantiation using `ProcessPoolExecutor` for large repositories.
73
+ - **Parallel Hygiene Scoring**: Concurrent execution of hygiene checks using `ThreadPoolExecutor` for faster report generation.
74
+ - **Modular CLI Architecture**:
75
+ - Split into `rich_cli` (Typer/Rich) and `bare_cli` (Argparse) for better environment support.
76
+ - Intelligent switcher logic in `cli.py` handles optional dependencies and fallbacks.
77
+ - **New `init` Command**: Easily initialize a default `.git-graphable.toml` configuration file.
78
+ - **Reusable GitHub Action**: Added a composite action in `.github/actions/git-graphable/` for automated reporting.
79
+ - **Robust Distance/Divergence Highlights**: Enhanced visualization of branch distance and divergence with clearer legend labels.
80
+ - **Remote URL Support**: Restored and improved ability to pass remote Git URLs (HTTPS/SSH) as the repository path.
81
+ - **Comprehensive UI Testing**: Integrated Playwright for automated browser-based UI testing of the interactive graph.
82
+
83
+ ### Changed
84
+ - **Command Renamed**: Renamed the primary command from `convert` to `analyze` for better semantic alignment.
85
+ - **Decoupled Hygiene Scoring**: Scoring logic is now independent of visual highlighting options, allowing for more granular configuration.
86
+ - **Template System Refactor**: Extracted large HTML/JS blocks into `src/git_graphable/templates.py` for improved maintainability.
87
+ - **Removed PlantUML Support**: Support for PlantUML has been removed in favor of more customizable engines (Mermaid, D2, HTML).
88
+
89
+ ## [0.3.0] - 2026-03-05
90
+
91
+ ### Added
92
+ - **Customizable Visual Styling**: Full override of node and edge styles (colors, widths, dash patterns) via CLI (`--style`) and TOML (`[git-graphable.theme]`).
93
+ - **Configurable Hygiene Scoring**: Customization of hygiene penalties and caps via TOML (`[git-graphable.hygiene_weights]`).
94
+ - **Advanced Issue Tracker Integration**:
95
+ - **Longevity Mismatch**: Detection of large time gaps between ticket creation and the first commit.
96
+ - **Collaboration Gaps**: Highlighting when the Git author doesn't match the Issue Tracker assignee.
97
+ - **Release Validation**: Verification that "Released" tickets are tagged in Git.
98
+ - **New Documentation**: Added `STYLING.md` guide for visual customization.
99
+ - **Engine Consistency**: Unified styling logic across Mermaid, D2, and Graphviz engines.
100
+
101
+ ### Changed
102
+ - **CLI Refactor**: Migrated to a more robust Typer/Rich implementation with enhanced command-line options.
103
+ - **Issue Engine**: Refactored `IssueTracker` to support richer metadata (assignees, timestamps).
104
+
105
+ ### Fixed
106
+ - Fixed inconsistent color application in Mermaid graphs.
107
+ - Improved cleanup of temporary files during image export.
108
+
109
+ ## [0.2.0] - 2026-03-04
110
+ - Initial functional release with basic Git hygiene scoring and GitHub/Jira integration.
@@ -0,0 +1,168 @@
1
+ # Git Hygiene Guidelines
2
+
3
+ This document explains the hygiene metrics analyzed by `git-graphable` and provides actionable steps to remediate common issues.
4
+
5
+ ## 1. Process Integrity
6
+
7
+ ### Direct Pushes to Protected Branches
8
+ **Detection:** Commits made directly to `production_branch` or `development_branch` without a merge commit.
9
+ **Why it matters:** Bypassing the Pull Request process avoids code review and CI checks, increasing the risk of bugs.
10
+ **Remediation:**
11
+ 1. **Stop**: Do not push directly to main/master/develop.
12
+ 2. **Fix History** (if not yet shared/stable):
13
+ ```bash
14
+ # Move the commit to a new branch
15
+ git checkout -b feature/my-fix
16
+
17
+ # Reset main back to before the direct push
18
+ git checkout main
19
+ git reset --hard <commit-before-push>
20
+
21
+ # Push the new branch and open a PR
22
+ git push -u origin feature/my-fix
23
+ ```
24
+ 3. **Protection**: Enable "Branch Protection Rules" in GitHub/GitLab settings to physically prevent direct pushes.
25
+
26
+ ### Conflicting Pull Requests
27
+ **Detection:** Open PRs marked as `CONFLICTING` by the VCS provider.
28
+ **Why it matters:** Conflicts block merging and indicate divergent development paths that get harder to resolve over time.
29
+ **Remediation:**
30
+ ```bash
31
+ git checkout feature/my-branch
32
+ git pull origin main
33
+ # Resolve conflicts in editor
34
+ git add .
35
+ git commit -m "Merge branch 'main' into feature/my-branch"
36
+ git push
37
+ ```
38
+
39
+ ### Orphan/Dangling Commits
40
+ **Detection:** Commits that are not reachable from any branch or tag.
41
+ **Why it matters:** These are often lost code or mistakes.
42
+ **Remediation:**
43
+ - **Garbage Collect**: `git gc --prune=now`
44
+ - **Recover**: If valuable, checkout the SHA and create a branch: `git checkout -b recover-work <sha>`
45
+
46
+ ## 2. Cleanliness
47
+
48
+ ### WIP / Fixup Commits
49
+ **Detection:** Commit messages containing "wip", "todo", "fixup", "temp".
50
+ **Why it matters:** messy history makes debugging and `git bisect` difficult.
51
+ **Remediation:**
52
+ - **Interactive Rebase**: Squash WIP commits into meaningful units.
53
+ ```bash
54
+ git rebase -i HEAD~n # where n is number of commits back
55
+ # Change 'pick' to 'squash' or 'fixup' for the WIP commits
56
+ ```
57
+
58
+ ### Stale Branches
59
+ **Detection:** Feature branches with no activity for `stale_days` (default: 30).
60
+ **Why it matters:** Clutters the repository and indicates abandoned work.
61
+ **Remediation:**
62
+ - **Delete Local**: `git branch -d branch-name`
63
+ - **Delete Remote**: `git push origin --delete branch-name`
64
+ - **Archive**: Tag it if you need to keep it: `git tag archive/branch-name branch-name`
65
+
66
+ ## 3. Connectivity & Flow
67
+
68
+ ### Long-Running Branches
69
+ **Detection:** Feature branches that have diverged from the base for more than `long_running_days` (default: 14).
70
+ **Why it matters:** Increases the risk of massive merge conflicts (The "Merge Hell").
71
+ **Remediation:**
72
+ - **Merge Often**: Merge `main` into your feature branch frequently.
73
+ - **Ship Smaller**: Break large features into smaller, mergeable PRs.
74
+
75
+ ### Divergence (Behind Base)
76
+ **Detection:** Feature branches that are missing commits from the base branch (`main`).
77
+ **Why it matters:** You are testing against outdated code.
78
+ **Remediation:**
79
+ ```bash
80
+ git checkout feature/my-feature
81
+ git pull origin main
82
+ git push
83
+ ```
84
+
85
+ ### Redundant Back-Merges
86
+ **Detection:** Merging `main` into a feature branch, but doing it recursively or unnecessarily often creates a "railroad track" history.
87
+ **Why it matters:** Makes history hard to read.
88
+ **Remediation:**
89
+ - Use `git rebase main` instead of `git merge main` for feature branches (if your team policy allows rewriting feature branch history).
90
+
91
+ ## 4. Collaboration
92
+
93
+ ### Contributor Silos
94
+ **Detection:** Long sequences of commits on a branch by a single author without interaction from others.
95
+ **Why it matters:** Risk of "Bus Factor". No code review or shared knowledge.
96
+ **Remediation:**
97
+ - **Pair Program**: Involve others earlier.
98
+ - **Early PRs**: Open a Draft PR to get feedback before the feature is done.
99
+
100
+ ### Collaboration Gaps
101
+ **Detection:** The Git commit author does not match the assignee of the linked Issue Tracker ticket.
102
+ **Remediation:**
103
+ - Update the Issue Tracker ticket to assign it to the actual developer.
104
+ - Configure `author_mapping` in `.git-graphable.toml` if names just don't match (e.g., "John Doe" vs "jdoe").
105
+
106
+ ## 5. Consistency (Issue Tracking)
107
+
108
+ ### Issue / Git Desync
109
+ **Detection:**
110
+ - Ticket is `OPEN` but PR is `MERGED`.
111
+ - Ticket is `CLOSED` but PR is `OPEN`.
112
+ **Remediation:**
113
+ - **Sync Status**: Manually update the ticket status.
114
+ - **Automation**: Configure GitHub/Jira to auto-close issues when PRs are merged.
115
+
116
+ ### Release Inconsistencies
117
+ **Detection:** Ticket is marked `RELEASED` but the commit is not included in any Git Tag.
118
+ **Remediation:**
119
+ - **Cut a Release**: Create a Git tag for the deployment.
120
+ ```bash
121
+ git tag v1.0.0
122
+ git push --tags
123
+ ```
124
+
125
+ ### Longevity Mismatch
126
+ **Detection:** A large time gap (>14 days) exists between when a ticket was created and when work (commits) started.
127
+ **Why it matters:** Planning failure or stale requirements.
128
+ **Remediation:**
129
+ - **Review Backlog**: Don't open tickets until work is ready to start.
130
+ - **Re-evaluate**: If a ticket sits for 2 weeks, check if requirements have changed before starting code.
131
+
132
+ ## 6. Ignoring Hygiene Rules
133
+
134
+ Sometimes a commit or branch is flagged for a reason that is acceptable or intended. You can selectively ignore these rules.
135
+
136
+ ### Via Configuration (`.git-graphable.toml`)
137
+
138
+ Add an `[git-graphable.ignore]` section to your configuration:
139
+
140
+ ```toml
141
+ [git-graphable.ignore]
142
+ # Ignore specific rules for specific SHAs (prefix or full SHA)
143
+ "9bd5377" = ["wip", "direct_push"]
144
+ "abc1234" = ["all"] # Ignore all hygiene rules for this commit
145
+ ```
146
+
147
+ ### Via CLI
148
+
149
+ Use the `--ignore` flag:
150
+
151
+ ```bash
152
+ # Ignore WIP rule for a specific SHA
153
+ uv run git-graphable analyze . --ignore 9bd5377:wip
154
+
155
+ # Ignore multiple items
156
+ uv run git-graphable analyze . --ignore 9bd5377:wip --ignore abc1234:all
157
+ ```
158
+
159
+ ### Supported Rule Names
160
+ - `wip`
161
+ - `direct_push`
162
+ - `divergence`
163
+ - `orphan`
164
+ - `stale`
165
+ - `long_running`
166
+ - `back_merge`
167
+ - `silo`
168
+ - `all` (ignores everything for that SHA)
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Richard West
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,12 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: git-graphable
3
- Version: 0.5.0
3
+ Version: 0.7.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,automation,ci,cytoscape,d2,git,git-flow,github,github-actions,graph,html,hygiene,interactive,lint,mermaid,topology,visualization
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: analysis,automation,badges,ci,cytoscape,d2,devops,git,git-flow,github,github-actions,gitlab,graph,html,hygiene,interactive,jira,lint,mermaid,metrics,topology,visualization
10
12
  Requires-Python: >=3.13
11
13
  Requires-Dist: graphable>=0.6.0
12
14
  Provides-Extra: cli
@@ -16,6 +18,12 @@ Description-Content-Type: text/markdown
16
18
 
17
19
  # Git Graphable
18
20
 
21
+ [![CI](https://github.com/TheTrueSCU/git-graphable/actions/workflows/ci.yml/badge.svg)](https://github.com/TheTrueSCU/git-graphable/actions/workflows/ci.yml)
22
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
23
+ [![Coverage](https://img.shields.io/endpoint?url=https://thetruescu.github.io/git-graphable/coverage.json)](https://thetruescu.github.io/git-graphable/)
24
+ [![Hygiene](https://img.shields.io/endpoint?url=https://thetruescu.github.io/git-graphable/hygiene_badge.json)](https://thetruescu.github.io/git-graphable/)
25
+
26
+
19
27
  A powerful Python tool to convert Git commit history into beautiful, interactive flowcharts using the `graphable` library. Supporting Mermaid, D2, Graphviz, and HTML.
20
28
 
21
29
  ## Git Plugin Support
@@ -31,18 +39,15 @@ Check out the tool in action with our **[Live Interactive Demos](https://thetrue
31
39
  ## Features
32
40
 
33
41
  - **Multi-Engine Support**: Export to Mermaid (.mmd), D2 (.d2), Graphviz (.dot), or HTML (.html).
34
- - **Automatic Visualization**: Generates and opens an image (SVG/PNG) automatically if no output is specified.
42
+ - **Automatic Visualization**: Generates and opens an image (PNG) automatically if no output is specified.
35
43
  - **Advanced Highlighting**: Visualize author patterns, topological distance, and specific merge paths.
36
- - **GitHub Integration**: Highlight commits based on pull request status (Merged, Open, Closed, Draft) using the `gh` CLI.
37
- - **Hygiene Analysis**: Automatically detect WIP commits, direct pushes to protected branches, squashed PRs, back-merges, and contributor silos.
38
- - **Issue Tracker Integration**: Connect to Jira, GitHub Issues, or custom scripts to highlight status desyncs.
39
- - **Release & Assignment Validation**: Verify that "Released" tickets are actually tagged in Git and that commit authors match ticket assignees.
40
- - **Health Scoring**: Get a numeric "Hygiene Score" (0-100%) with a color-coded grade and detailed breakdown of workflow anti-patterns.
41
- - **Visual Customization**: Fully customize colors, widths, and line styles for nodes and edges. See [STYLING.md](STYLING.md).
42
- - **Configurable Penalties**: Fully customize the scoring logic by adjusting penalties and caps for each metric.
43
- - **CI Gating**: Use the `--check` flag to return a non-zero exit code if the hygiene score falls below a threshold (configurable via `--min-score`).
44
- - **Flexible Input**: Works with local repository paths or remote Git URLs.
45
- - **Dual CLI**: Modern Rich/Typer interface with a robust argparse fallback for bare environments.
44
+ - **VCS Integration**: Highlight commits based on pull request/merge request status using `gh` (GitHub) or `glab` (GitLab) CLIs.
45
+ - **Hygiene Analysis**: Automatically detect WIP commits, direct pushes to protected branches, squashed PRs, back-merges, and contributor silos. Provides actionable intelligence with exact commit hashes and branch names.
46
+ - **Issue Tracker Integration**: Connect to Jira, GitHub Issues, GitLab Issues, or custom scripts to highlight status desyncs.
47
+ - **Security First**: Configuration trust mechanism enforces security by requiring explicit authorization (use `--trust`) to execute custom scripts or send credentials from repository-local configs.
48
+ - **Selective Ignores**: Suppress specific hygiene rules for given commit SHAs using the configuration file or `--ignore` CLI flag.
49
+ - **Remediation Guide**: Detailed guidelines in [HYGIENE.md](HYGIENE.md) help you reach a 100% score.
50
+ - **Dynamic Badges**: Host live Shields.io badges for Git Hygiene and Code Coverage on GitHub Pages.
46
51
 
47
52
  ## Installation
48
53
 
@@ -86,7 +91,7 @@ jobs:
86
91
  fetch-depth: 0 # Required to see full history
87
92
 
88
93
  - name: Generate Git Graph Reports
89
- uses: TheTrueSCU/git-graphable@v0.5.0
94
+ uses: TheTrueSCU/git-graphable@v0.7.0
90
95
  with:
91
96
  production_branch: 'main'
92
97
  output_dir: 'reports'
@@ -125,7 +130,7 @@ Git Graphable provides several ways to highlight commits and relationships. Mult
125
130
  | Option | Target | Effect | Conflicts With |
126
131
  | :--- | :--- | :--- | :--- |
127
132
  | `--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 |
133
+ | `--highlight-pr-status` | **Fill/Stroke**| Color by PR/MR state (Merged=Purple, Open=Green) | Authors, Distance, Stale |
129
134
  | `--highlight-distance-from` | **Fill** | Blue gradient fading by distance | Authors, PR Status, Stale |
130
135
  | `--highlight-stale` | **Fill** | Gradient white to red by age | Authors, PR Status, Distance |
131
136
  | `--highlight-path` | **Edge** | Thick Orange edge connecting nodes | None |
@@ -152,6 +157,7 @@ Identify problematic patterns like direct pushes to `main`, messy WIP commits, b
152
157
  ```bash
153
158
  uv run git-graphable analyze . --highlight-direct-pushes --highlight-wip --highlight-squashed --highlight-back-merges --highlight-silos
154
159
  ```
160
+ > **Tip:** See [HYGIENE.md](HYGIENE.md) for a detailed guide on how to remediate these issues and improve your score.
155
161
 
156
162
  ### PR Status Highlighting
157
163
  View the current state of all PRs in your repository graph:
@@ -200,7 +206,7 @@ highlight_critical = true
200
206
  critical_branches = ["main", "prod"]
201
207
  highlight_pr_status = true
202
208
  highlight_wip = true
203
- wip_keywords = ["wip", "todo", "fixme", "temp"]
209
+ wip_keywords = ["wip", "todo", "fixme", "temp", "fixup!", "squash!"]
204
210
  highlight_direct_pushes = true
205
211
  highlight_squashed = true
206
212
  highlight_back_merges = true
@@ -1,5 +1,11 @@
1
1
  # Git Graphable
2
2
 
3
+ [![CI](https://github.com/TheTrueSCU/git-graphable/actions/workflows/ci.yml/badge.svg)](https://github.com/TheTrueSCU/git-graphable/actions/workflows/ci.yml)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![Coverage](https://img.shields.io/endpoint?url=https://thetruescu.github.io/git-graphable/coverage.json)](https://thetruescu.github.io/git-graphable/)
6
+ [![Hygiene](https://img.shields.io/endpoint?url=https://thetruescu.github.io/git-graphable/hygiene_badge.json)](https://thetruescu.github.io/git-graphable/)
7
+
8
+
3
9
  A powerful Python tool to convert Git commit history into beautiful, interactive flowcharts using the `graphable` library. Supporting Mermaid, D2, Graphviz, and HTML.
4
10
 
5
11
  ## Git Plugin Support
@@ -15,18 +21,15 @@ Check out the tool in action with our **[Live Interactive Demos](https://thetrue
15
21
  ## Features
16
22
 
17
23
  - **Multi-Engine Support**: Export to Mermaid (.mmd), D2 (.d2), Graphviz (.dot), or HTML (.html).
18
- - **Automatic Visualization**: Generates and opens an image (SVG/PNG) automatically if no output is specified.
24
+ - **Automatic Visualization**: Generates and opens an image (PNG) automatically if no output is specified.
19
25
  - **Advanced Highlighting**: Visualize author patterns, topological distance, and specific merge paths.
20
- - **GitHub Integration**: Highlight commits based on pull request status (Merged, Open, Closed, Draft) using the `gh` CLI.
21
- - **Hygiene Analysis**: Automatically detect WIP commits, direct pushes to protected branches, squashed PRs, back-merges, and contributor silos.
22
- - **Issue Tracker Integration**: Connect to Jira, GitHub Issues, or custom scripts to highlight status desyncs.
23
- - **Release & Assignment Validation**: Verify that "Released" tickets are actually tagged in Git and that commit authors match ticket assignees.
24
- - **Health Scoring**: Get a numeric "Hygiene Score" (0-100%) with a color-coded grade and detailed breakdown of workflow anti-patterns.
25
- - **Visual Customization**: Fully customize colors, widths, and line styles for nodes and edges. See [STYLING.md](STYLING.md).
26
- - **Configurable Penalties**: Fully customize the scoring logic by adjusting penalties and caps for each metric.
27
- - **CI Gating**: Use the `--check` flag to return a non-zero exit code if the hygiene score falls below a threshold (configurable via `--min-score`).
28
- - **Flexible Input**: Works with local repository paths or remote Git URLs.
29
- - **Dual CLI**: Modern Rich/Typer interface with a robust argparse fallback for bare environments.
26
+ - **VCS Integration**: Highlight commits based on pull request/merge request status using `gh` (GitHub) or `glab` (GitLab) CLIs.
27
+ - **Hygiene Analysis**: Automatically detect WIP commits, direct pushes to protected branches, squashed PRs, back-merges, and contributor silos. Provides actionable intelligence with exact commit hashes and branch names.
28
+ - **Issue Tracker Integration**: Connect to Jira, GitHub Issues, GitLab Issues, or custom scripts to highlight status desyncs.
29
+ - **Security First**: Configuration trust mechanism enforces security by requiring explicit authorization (use `--trust`) to execute custom scripts or send credentials from repository-local configs.
30
+ - **Selective Ignores**: Suppress specific hygiene rules for given commit SHAs using the configuration file or `--ignore` CLI flag.
31
+ - **Remediation Guide**: Detailed guidelines in [HYGIENE.md](HYGIENE.md) help you reach a 100% score.
32
+ - **Dynamic Badges**: Host live Shields.io badges for Git Hygiene and Code Coverage on GitHub Pages.
30
33
 
31
34
  ## Installation
32
35
 
@@ -70,7 +73,7 @@ jobs:
70
73
  fetch-depth: 0 # Required to see full history
71
74
 
72
75
  - name: Generate Git Graph Reports
73
- uses: TheTrueSCU/git-graphable@v0.5.0
76
+ uses: TheTrueSCU/git-graphable@v0.7.0
74
77
  with:
75
78
  production_branch: 'main'
76
79
  output_dir: 'reports'
@@ -109,7 +112,7 @@ Git Graphable provides several ways to highlight commits and relationships. Mult
109
112
  | Option | Target | Effect | Conflicts With |
110
113
  | :--- | :--- | :--- | :--- |
111
114
  | `--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 |
115
+ | `--highlight-pr-status` | **Fill/Stroke**| Color by PR/MR state (Merged=Purple, Open=Green) | Authors, Distance, Stale |
113
116
  | `--highlight-distance-from` | **Fill** | Blue gradient fading by distance | Authors, PR Status, Stale |
114
117
  | `--highlight-stale` | **Fill** | Gradient white to red by age | Authors, PR Status, Distance |
115
118
  | `--highlight-path` | **Edge** | Thick Orange edge connecting nodes | None |
@@ -136,6 +139,7 @@ Identify problematic patterns like direct pushes to `main`, messy WIP commits, b
136
139
  ```bash
137
140
  uv run git-graphable analyze . --highlight-direct-pushes --highlight-wip --highlight-squashed --highlight-back-merges --highlight-silos
138
141
  ```
142
+ > **Tip:** See [HYGIENE.md](HYGIENE.md) for a detailed guide on how to remediate these issues and improve your score.
139
143
 
140
144
  ### PR Status Highlighting
141
145
  View the current state of all PRs in your repository graph:
@@ -184,7 +188,7 @@ highlight_critical = true
184
188
  critical_branches = ["main", "prod"]
185
189
  highlight_pr_status = true
186
190
  highlight_wip = true
187
- wip_keywords = ["wip", "todo", "fixme", "temp"]
191
+ wip_keywords = ["wip", "todo", "fixme", "temp", "fixup!", "squash!"]
188
192
  highlight_direct_pushes = true
189
193
  highlight_squashed = true
190
194
  highlight_back_merges = true
@@ -50,7 +50,9 @@ Analyze git history and generate a graph. This is the default command; if no com
50
50
  * `--highlight-long-running`: Highlight long-running branches
51
51
  * `--long-running-days INTEGER`: Threshold in days for long-running branches
52
52
  * `--long-running-base TEXT`: Base branch for long-running analysis
53
- * `--highlight-pr-status`: Highlight commits based on GitHub PR status
53
+ * `--highlight-pr-status`: Highlight commits based on PR status (GitHub or GitLab)
54
+ * `--pr-provider [github|gitlab|script]`: Provider to fetch PR statuses (default: github)
55
+ * `--pr-script TEXT`: Path to a script that returns PR data in JSON format
54
56
  * `--highlight-wip`: Highlight WIP/TODO commits
55
57
  * `--wip-keyword TEXT`: Additional keyword to trigger WIP highlighting
56
58
  * `--highlight-direct-pushes`: Highlight non-merge commits on protected branches
@@ -61,7 +63,7 @@ Analyze git history and generate a graph. This is the default command; if no com
61
63
  * `--silo-author-count INTEGER`: Author count threshold for silo detection
62
64
  * `--highlight-issue-inconsistencies`: Highlight mismatches between Git and Issue Tracker
63
65
  * `--issue-pattern TEXT`: Regex pattern to extract issue IDs
64
- * `--issue-engine [github|jira|script]`: Engine to fetch issue statuses
66
+ * `--issue-engine [github|gitlab|jira|script]`: Engine to fetch issue statuses
65
67
  * `--jira-url TEXT`: Base URL for Jira instance
66
68
  * `--issue-script TEXT`: Shell command template for script engine
67
69
  * `--highlight-release-inconsistencies`: Highlight issues marked Released but not tagged
@@ -74,6 +76,9 @@ Analyze git history and generate a graph. This is the default command; if no com
74
76
  * `--check`: Exit with non-zero if hygiene score is below threshold
75
77
  * `--min-score INTEGER`: Minimum hygiene score required for --check
76
78
  * `--bare`: Force bare mode (no rich output)
79
+ * `--hygiene-output TEXT`: Path to save hygiene summary as JSON.
80
+ * `--ignore TEXT`: Ignore hygiene rules for specific SHAs (format: `sha:rule`). Use `all` as the rule to ignore all checks for a commit.
81
+ * `--trust`: Trust configuration files (.git-graphable.toml, pyproject.toml) found in the repository. **Required** to execute custom scripts (`issue_script`, `pr_script`) or use sensitive integrations (Jira) from these sources.
77
82
  * `--help`: Show this message and exit.
78
83
 
79
84
  ---
@@ -52,15 +52,26 @@ runs:
52
52
  shell: bash
53
53
  run: mkdir -p ${{ inputs.output_dir }}
54
54
 
55
- - name: Generate Simplified Graph (Mermaid)
55
+ - name: Generate Simplified Graph (Mermaid) and Hygiene Stats
56
56
  shell: bash
57
57
  run: |
58
- ARGS="--production-branch ${{ inputs.production_branch }} --simplify --engine mermaid -o ${{ inputs.output_dir }}/summary.mmd"
58
+ ARGS="--production-branch ${{ inputs.production_branch }} --simplify --engine mermaid -o ${{ inputs.output_dir }}/summary.mmd --hygiene-output ${{ inputs.output_dir }}/hygiene.json"
59
59
  if [ -n "${{ inputs.issue_engine }}" ]; then ARGS="$ARGS --issue-engine ${{ inputs.issue_engine }}"; fi
60
60
  uv tool run git-graphable --bare ${{ inputs.path }} $ARGS
61
61
  env:
62
62
  GITHUB_TOKEN: ${{ inputs.github_token }}
63
63
 
64
+ - name: Generate Hygiene Badge Data
65
+ shell: bash
66
+ run: |
67
+ if [ -f "${{ inputs.output_dir }}/hygiene.json" ]; then
68
+ SCORE=$(grep -oP '"score": \d+' ${{ inputs.output_dir }}/hygiene.json | grep -oP '\d+')
69
+ GRADE=$(grep -oP '"grade": "[^"]+"' ${{ inputs.output_dir }}/hygiene.json | cut -d'"' -f4)
70
+ COLOR=$(grep -oP '"color": "[^"]+"' ${{ inputs.output_dir }}/hygiene.json | cut -d'"' -f4)
71
+ # Shields.io JSON endpoint format
72
+ echo "{\"schemaVersion\": 1, \"label\": \"hygiene\", \"message\": \"$SCORE% ($GRADE)\", \"color\": \"$COLOR\"}" > ${{ inputs.output_dir }}/hygiene_badge.json
73
+ fi
74
+
64
75
  - name: Generate Full Interactive Graph (HTML)
65
76
  shell: bash
66
77
  run: |