gitpulse-ai 0.1.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.
- gitpulse_ai-0.1.0/.gitignore +31 -0
- gitpulse_ai-0.1.0/CHANGELOG.md +27 -0
- gitpulse_ai-0.1.0/LICENSE +21 -0
- gitpulse_ai-0.1.0/PKG-INFO +244 -0
- gitpulse_ai-0.1.0/README.md +210 -0
- gitpulse_ai-0.1.0/pyproject.toml +71 -0
- gitpulse_ai-0.1.0/src/git_pulse/__init__.py +1 -0
- gitpulse_ai-0.1.0/src/git_pulse/analyst/__init__.py +0 -0
- gitpulse_ai-0.1.0/src/git_pulse/analyst/engine.py +55 -0
- gitpulse_ai-0.1.0/src/git_pulse/analyst/models.py +34 -0
- gitpulse_ai-0.1.0/src/git_pulse/analyst/prompts.py +79 -0
- gitpulse_ai-0.1.0/src/git_pulse/cli.py +159 -0
- gitpulse_ai-0.1.0/src/git_pulse/collector/__init__.py +0 -0
- gitpulse_ai-0.1.0/src/git_pulse/collector/git_history.py +102 -0
- gitpulse_ai-0.1.0/src/git_pulse/collector/hotspot_detector.py +142 -0
- gitpulse_ai-0.1.0/src/git_pulse/collector/metrics.py +144 -0
- gitpulse_ai-0.1.0/src/git_pulse/collector/models.py +83 -0
- gitpulse_ai-0.1.0/src/git_pulse/config.py +68 -0
- gitpulse_ai-0.1.0/src/git_pulse/renderer/__init__.py +0 -0
- gitpulse_ai-0.1.0/src/git_pulse/renderer/json_output.py +11 -0
- gitpulse_ai-0.1.0/src/git_pulse/renderer/terminal.py +150 -0
- gitpulse_ai-0.1.0/tests/conftest.py +1 -0
- gitpulse_ai-0.1.0/tests/test_analyst/__init__.py +0 -0
- gitpulse_ai-0.1.0/tests/test_analyst/test_engine.py +83 -0
- gitpulse_ai-0.1.0/tests/test_analyst/test_prompts.py +56 -0
- gitpulse_ai-0.1.0/tests/test_cli.py +57 -0
- gitpulse_ai-0.1.0/tests/test_collector/__init__.py +0 -0
- gitpulse_ai-0.1.0/tests/test_collector/test_git_history.py +85 -0
- gitpulse_ai-0.1.0/tests/test_collector/test_hotspot_detector.py +95 -0
- gitpulse_ai-0.1.0/tests/test_collector/test_metrics.py +98 -0
- gitpulse_ai-0.1.0/tests/test_collector/test_models.py +79 -0
- gitpulse_ai-0.1.0/tests/test_config.py +33 -0
- gitpulse_ai-0.1.0/tests/test_renderer/__init__.py +0 -0
- gitpulse_ai-0.1.0/tests/test_renderer/test_json_output.py +25 -0
- gitpulse_ai-0.1.0/tests/test_renderer/test_terminal.py +79 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.pyc
|
|
3
|
+
*.pyo
|
|
4
|
+
*.egg-info/
|
|
5
|
+
dist/
|
|
6
|
+
build/
|
|
7
|
+
.eggs/
|
|
8
|
+
*.egg
|
|
9
|
+
.pytest_cache/
|
|
10
|
+
.coverage
|
|
11
|
+
htmlcov/
|
|
12
|
+
|
|
13
|
+
# IDE
|
|
14
|
+
.idea/
|
|
15
|
+
.vscode/
|
|
16
|
+
|
|
17
|
+
# Environment
|
|
18
|
+
.env
|
|
19
|
+
.env.*
|
|
20
|
+
.venv/
|
|
21
|
+
venv/
|
|
22
|
+
env/
|
|
23
|
+
|
|
24
|
+
# Claude Code
|
|
25
|
+
.claude/
|
|
26
|
+
|
|
27
|
+
# Generated reports
|
|
28
|
+
*-report.json
|
|
29
|
+
|
|
30
|
+
# Internal dev docs
|
|
31
|
+
docs/superpowers/
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to git-pulse are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-08-23
|
|
9
|
+
|
|
10
|
+
Initial release.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `git-pulse analyze` — walks git history and reports development hotspots with
|
|
15
|
+
LLM-generated insights across five categories: rework reduction, codebase
|
|
16
|
+
health, prompt guidance, agent effectiveness, and workflow optimization.
|
|
17
|
+
- Deterministic collector layer: git history walking, spatiotemporal hotspot
|
|
18
|
+
clustering, file churn, change velocity, rework rate, and work-session
|
|
19
|
+
analysis.
|
|
20
|
+
- Coding-agent attribution detection from commit metadata (`Co-Authored-By`,
|
|
21
|
+
bracket tags, `aider:` prefixes).
|
|
22
|
+
- LLM analyst layer via [LiteLLM](https://docs.litellm.ai/), supporting 100+
|
|
23
|
+
providers.
|
|
24
|
+
- Output renderers: rich terminal and JSON.
|
|
25
|
+
- TOML configuration via `.gitpulse.toml` or `~/.config/gitpulse/config.toml`.
|
|
26
|
+
|
|
27
|
+
[0.1.0]: https://github.com/srikanth1003/git-pulse/releases/tag/v0.1.0
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 git-pulse contributors
|
|
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.
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: gitpulse-ai
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Analyze git repo history for development hotspots with LLM-powered insights
|
|
5
|
+
Project-URL: Homepage, https://github.com/srikanth1003/git-pulse
|
|
6
|
+
Project-URL: Repository, https://github.com/srikanth1003/git-pulse
|
|
7
|
+
Project-URL: Issues, https://github.com/srikanth1003/git-pulse/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/srikanth1003/git-pulse/blob/main/CHANGELOG.md
|
|
9
|
+
Author: srikanth1003
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: ai,code-analysis,code-quality,coding-agents,developer-productivity,git,git-history,hotspots,llm,technical-debt
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
23
|
+
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
24
|
+
Classifier: Topic :: Utilities
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Requires-Dist: gitpython>=3.1.0
|
|
27
|
+
Requires-Dist: litellm>=1.0.0
|
|
28
|
+
Requires-Dist: rich>=13.0.0
|
|
29
|
+
Requires-Dist: typer>=0.9.0
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# git-pulse
|
|
36
|
+
|
|
37
|
+
**Analyze git repository history for development hotspots and get LLM-powered insights to optimize your workflow.**
|
|
38
|
+
|
|
39
|
+
git-pulse examines your commit history to find rework patterns, codebase health issues, and — when coding agents are detected — specific prompt engineering guidance to reduce wasted iterations. It works on any git repo, with any LLM provider.
|
|
40
|
+
|
|
41
|
+
## What It Does
|
|
42
|
+
|
|
43
|
+
git-pulse reads your git history and produces actionable insights across five categories:
|
|
44
|
+
|
|
45
|
+
| Category | What It Finds |
|
|
46
|
+
|----------|--------------|
|
|
47
|
+
| **Rework Reduction** | Files rewritten multiple times — what went wrong and how to get it right faster |
|
|
48
|
+
| **Codebase Health** | Chronic hotspots, architectural issues causing repeated churn |
|
|
49
|
+
| **Prompt Guidance** | Specific before/after prompt examples when coding agents are detected (Co-Authored-By, aider tags, etc.) |
|
|
50
|
+
| **Agent Effectiveness** | How well agents are being utilized — where they struggle or excel |
|
|
51
|
+
| **Workflow Optimization** | Session patterns, productivity signals, process improvements |
|
|
52
|
+
|
|
53
|
+
### Agent-Aware Analysis
|
|
54
|
+
|
|
55
|
+
git-pulse auto-detects coding agent attribution from commit metadata — `Co-Authored-By: Claude`, `[copilot]`, `aider:` tags, and more. When agent commits are found, it provides **prompt guidance** with realistic bad/better prompt examples showing exactly what to change in how you talk to your agent.
|
|
56
|
+
|
|
57
|
+
## Install
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pip install git-pulse-cli
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Requires Python 3.10+. The installed command is `git-pulse`.
|
|
64
|
+
|
|
65
|
+
## Quick Start
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Analyze current repo (last 30 days)
|
|
69
|
+
git-pulse analyze .
|
|
70
|
+
|
|
71
|
+
# Analyze a specific repo, last 14 days
|
|
72
|
+
git-pulse analyze /path/to/repo --days 14
|
|
73
|
+
|
|
74
|
+
# Last 50 commits only
|
|
75
|
+
git-pulse analyze . --commits 50
|
|
76
|
+
|
|
77
|
+
# JSON output
|
|
78
|
+
git-pulse analyze . --json
|
|
79
|
+
|
|
80
|
+
# Save report to file
|
|
81
|
+
git-pulse analyze . --output report.json
|
|
82
|
+
|
|
83
|
+
# Use a specific model
|
|
84
|
+
git-pulse analyze . --model openai/gpt-4o
|
|
85
|
+
|
|
86
|
+
# Show raw collector metrics alongside LLM insights
|
|
87
|
+
git-pulse analyze . --verbose
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Example Output
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
────────────────────────────────────────────────────────────────────────────────
|
|
94
|
+
Git-Pulse Report — my-project (main)
|
|
95
|
+
19 days · 100 commits · 242 files changed
|
|
96
|
+
────────────────────────────────────────────────────────────────────────────────
|
|
97
|
+
|
|
98
|
+
╭────────────────────────────────── Summary ───────────────────────────────────╮
|
|
99
|
+
│ Repository shows intensive development with 100 commits across 242 files. │
|
|
100
|
+
│ High rework rate (40%) suggests agent prompts need improvement, with │
|
|
101
|
+
│ multiple iterations on workflow configuration and model updates. │
|
|
102
|
+
╰──────────────────────────────────────────────────────────────────────────────╯
|
|
103
|
+
|
|
104
|
+
Top Actions
|
|
105
|
+
1. Create design documents before implementing GitHub Actions workflows
|
|
106
|
+
2. Establish centralized model configuration to reduce scattered updates
|
|
107
|
+
3. Improve agent prompts with dependency analysis before changes
|
|
108
|
+
|
|
109
|
+
─────────────────────── Rework Reduction (2 insights) ────────────────────────
|
|
110
|
+
|
|
111
|
+
[HIGH] GitHub Workflows Churning Through Multiple Iterations
|
|
112
|
+
.github/workflows/deploy.yml modified 9 times in 2.4 hours
|
|
113
|
+
Same file tweaked for permissions, triggers, and comments repeatedly
|
|
114
|
+
→ Plan workflow requirements upfront. Create a design doc specifying trigger
|
|
115
|
+
events, permissions, and behavior before coding.
|
|
116
|
+
|
|
117
|
+
──────────────────────── Prompt Guidance (1 insight) ────────────────────────
|
|
118
|
+
|
|
119
|
+
[HIGH] Workflow Configuration Requires Context and Constraints
|
|
120
|
+
PROBLEM: Developer asked agent to 'create GitHub workflow' without
|
|
121
|
+
specifying security constraints or existing patterns.
|
|
122
|
+
|
|
123
|
+
BAD PROMPT EXAMPLE:
|
|
124
|
+
╭──────────────────────────────────────────────────────────────────────────╮
|
|
125
|
+
│ Create a GitHub workflow that runs tests automatically. │
|
|
126
|
+
╰──────────────────────────────────────────────────────────────────────────╯
|
|
127
|
+
|
|
128
|
+
BETTER PROMPT EXAMPLE:
|
|
129
|
+
╭──────────────────────────────────────────────────────────────────────────╮
|
|
130
|
+
│ Create a GitHub workflow for CI. Before you start, look at our │
|
|
131
|
+
│ existing .github/workflows/ to understand our patterns for │
|
|
132
|
+
│ permissions and triggers. Use contents:read permission. Follow the │
|
|
133
|
+
│ same job naming pattern as deploy.yml. If you're unsure about which │
|
|
134
|
+
│ events to use, ask me rather than guessing. │
|
|
135
|
+
╰──────────────────────────────────────────────────────────────────────────╯
|
|
136
|
+
|
|
137
|
+
WHY THIS WORKS: Points to existing workflows to learn patterns, sets
|
|
138
|
+
explicit security constraints, and prevents the agent from making
|
|
139
|
+
permission guesses that need rework.
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## LLM Provider Setup
|
|
143
|
+
|
|
144
|
+
git-pulse uses [LiteLLM](https://docs.litellm.ai/) under the hood, so it works with 100+ LLM providers out of the box. Set the appropriate environment variable for your provider:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# Anthropic (default model: claude-sonnet-4-20250514)
|
|
148
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
149
|
+
|
|
150
|
+
# OpenAI
|
|
151
|
+
export OPENAI_API_KEY=sk-...
|
|
152
|
+
git-pulse analyze . --model openai/gpt-4o
|
|
153
|
+
|
|
154
|
+
# AWS Bedrock
|
|
155
|
+
export AWS_PROFILE=my-profile
|
|
156
|
+
git-pulse analyze . --model bedrock/us.anthropic.claude-sonnet-4-20250514-v1:0
|
|
157
|
+
|
|
158
|
+
# Any LiteLLM-supported provider
|
|
159
|
+
git-pulse analyze . --model <provider>/<model-id>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Configuration
|
|
163
|
+
|
|
164
|
+
git-pulse looks for TOML config files in this order:
|
|
165
|
+
|
|
166
|
+
1. `--config` flag (explicit path)
|
|
167
|
+
2. `.gitpulse.toml` in the repo root
|
|
168
|
+
3. `~/.config/gitpulse/config.toml`
|
|
169
|
+
4. Built-in defaults
|
|
170
|
+
|
|
171
|
+
Example `.gitpulse.toml`:
|
|
172
|
+
|
|
173
|
+
```toml
|
|
174
|
+
[llm]
|
|
175
|
+
model = "anthropic/claude-sonnet-4-20250514"
|
|
176
|
+
|
|
177
|
+
[analysis]
|
|
178
|
+
default_days = 30
|
|
179
|
+
max_hotspots = 20
|
|
180
|
+
exclude = ["*.lock", "package-lock.json", "*.generated.*"]
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## CLI Options
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
git-pulse analyze [PATH] [OPTIONS]
|
|
187
|
+
|
|
188
|
+
Arguments:
|
|
189
|
+
PATH Path to a git repository [default: .]
|
|
190
|
+
|
|
191
|
+
Options:
|
|
192
|
+
--days INTEGER Analyze last N days of history
|
|
193
|
+
--commits INTEGER Analyze last N commits
|
|
194
|
+
--branch TEXT Branch to analyze (default: current)
|
|
195
|
+
--include TEXT Only analyze files matching glob (repeatable)
|
|
196
|
+
--exclude TEXT Skip files matching glob (repeatable)
|
|
197
|
+
--max-hotspots INT Max hotspots to send to LLM
|
|
198
|
+
--model TEXT LiteLLM model string
|
|
199
|
+
--json Output JSON instead of rich terminal
|
|
200
|
+
--output TEXT Write report to file
|
|
201
|
+
--verbose Show raw collector metrics
|
|
202
|
+
--config TEXT Path to config file
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## How It Works
|
|
206
|
+
|
|
207
|
+
git-pulse has a two-layer architecture:
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
Git History ──► Collector Layer ──► Structured Report ──► Analyst (LLM) ──► Insights
|
|
211
|
+
│ │
|
|
212
|
+
├─ GitHistoryCollector ├─ LiteLLM (any provider)
|
|
213
|
+
├─ HotspotDetector (spatiotemporal) └─ Categorized insights
|
|
214
|
+
└─ MetricsCalculator
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**Collector Layer** (deterministic, no LLM):
|
|
218
|
+
- Walks git history, extracts diffs, detects agent attribution
|
|
219
|
+
- Clusters modifications by file + spatial/temporal proximity into hotspots
|
|
220
|
+
- Computes metrics: file churn, change velocity, rework rate, session analysis
|
|
221
|
+
|
|
222
|
+
**Analyst Layer** (LLM-powered):
|
|
223
|
+
- Receives the structured collector report
|
|
224
|
+
- Produces categorized insights with evidence and recommendations
|
|
225
|
+
- Generates specific prompt guidance when agent attribution is detected
|
|
226
|
+
|
|
227
|
+
## Development
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
# Clone and install in dev mode
|
|
231
|
+
git clone https://github.com/srikanth1003/git-pulse.git
|
|
232
|
+
cd git-pulse
|
|
233
|
+
pip install -e ".[dev]"
|
|
234
|
+
|
|
235
|
+
# Run tests
|
|
236
|
+
pytest
|
|
237
|
+
|
|
238
|
+
# Run on any repo
|
|
239
|
+
git-pulse analyze /path/to/any/repo --days 14
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## License
|
|
243
|
+
|
|
244
|
+
MIT
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# git-pulse
|
|
2
|
+
|
|
3
|
+
**Analyze git repository history for development hotspots and get LLM-powered insights to optimize your workflow.**
|
|
4
|
+
|
|
5
|
+
git-pulse examines your commit history to find rework patterns, codebase health issues, and — when coding agents are detected — specific prompt engineering guidance to reduce wasted iterations. It works on any git repo, with any LLM provider.
|
|
6
|
+
|
|
7
|
+
## What It Does
|
|
8
|
+
|
|
9
|
+
git-pulse reads your git history and produces actionable insights across five categories:
|
|
10
|
+
|
|
11
|
+
| Category | What It Finds |
|
|
12
|
+
|----------|--------------|
|
|
13
|
+
| **Rework Reduction** | Files rewritten multiple times — what went wrong and how to get it right faster |
|
|
14
|
+
| **Codebase Health** | Chronic hotspots, architectural issues causing repeated churn |
|
|
15
|
+
| **Prompt Guidance** | Specific before/after prompt examples when coding agents are detected (Co-Authored-By, aider tags, etc.) |
|
|
16
|
+
| **Agent Effectiveness** | How well agents are being utilized — where they struggle or excel |
|
|
17
|
+
| **Workflow Optimization** | Session patterns, productivity signals, process improvements |
|
|
18
|
+
|
|
19
|
+
### Agent-Aware Analysis
|
|
20
|
+
|
|
21
|
+
git-pulse auto-detects coding agent attribution from commit metadata — `Co-Authored-By: Claude`, `[copilot]`, `aider:` tags, and more. When agent commits are found, it provides **prompt guidance** with realistic bad/better prompt examples showing exactly what to change in how you talk to your agent.
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install git-pulse-cli
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Requires Python 3.10+. The installed command is `git-pulse`.
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Analyze current repo (last 30 days)
|
|
35
|
+
git-pulse analyze .
|
|
36
|
+
|
|
37
|
+
# Analyze a specific repo, last 14 days
|
|
38
|
+
git-pulse analyze /path/to/repo --days 14
|
|
39
|
+
|
|
40
|
+
# Last 50 commits only
|
|
41
|
+
git-pulse analyze . --commits 50
|
|
42
|
+
|
|
43
|
+
# JSON output
|
|
44
|
+
git-pulse analyze . --json
|
|
45
|
+
|
|
46
|
+
# Save report to file
|
|
47
|
+
git-pulse analyze . --output report.json
|
|
48
|
+
|
|
49
|
+
# Use a specific model
|
|
50
|
+
git-pulse analyze . --model openai/gpt-4o
|
|
51
|
+
|
|
52
|
+
# Show raw collector metrics alongside LLM insights
|
|
53
|
+
git-pulse analyze . --verbose
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Example Output
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
────────────────────────────────────────────────────────────────────────────────
|
|
60
|
+
Git-Pulse Report — my-project (main)
|
|
61
|
+
19 days · 100 commits · 242 files changed
|
|
62
|
+
────────────────────────────────────────────────────────────────────────────────
|
|
63
|
+
|
|
64
|
+
╭────────────────────────────────── Summary ───────────────────────────────────╮
|
|
65
|
+
│ Repository shows intensive development with 100 commits across 242 files. │
|
|
66
|
+
│ High rework rate (40%) suggests agent prompts need improvement, with │
|
|
67
|
+
│ multiple iterations on workflow configuration and model updates. │
|
|
68
|
+
╰──────────────────────────────────────────────────────────────────────────────╯
|
|
69
|
+
|
|
70
|
+
Top Actions
|
|
71
|
+
1. Create design documents before implementing GitHub Actions workflows
|
|
72
|
+
2. Establish centralized model configuration to reduce scattered updates
|
|
73
|
+
3. Improve agent prompts with dependency analysis before changes
|
|
74
|
+
|
|
75
|
+
─────────────────────── Rework Reduction (2 insights) ────────────────────────
|
|
76
|
+
|
|
77
|
+
[HIGH] GitHub Workflows Churning Through Multiple Iterations
|
|
78
|
+
.github/workflows/deploy.yml modified 9 times in 2.4 hours
|
|
79
|
+
Same file tweaked for permissions, triggers, and comments repeatedly
|
|
80
|
+
→ Plan workflow requirements upfront. Create a design doc specifying trigger
|
|
81
|
+
events, permissions, and behavior before coding.
|
|
82
|
+
|
|
83
|
+
──────────────────────── Prompt Guidance (1 insight) ────────────────────────
|
|
84
|
+
|
|
85
|
+
[HIGH] Workflow Configuration Requires Context and Constraints
|
|
86
|
+
PROBLEM: Developer asked agent to 'create GitHub workflow' without
|
|
87
|
+
specifying security constraints or existing patterns.
|
|
88
|
+
|
|
89
|
+
BAD PROMPT EXAMPLE:
|
|
90
|
+
╭──────────────────────────────────────────────────────────────────────────╮
|
|
91
|
+
│ Create a GitHub workflow that runs tests automatically. │
|
|
92
|
+
╰──────────────────────────────────────────────────────────────────────────╯
|
|
93
|
+
|
|
94
|
+
BETTER PROMPT EXAMPLE:
|
|
95
|
+
╭──────────────────────────────────────────────────────────────────────────╮
|
|
96
|
+
│ Create a GitHub workflow for CI. Before you start, look at our │
|
|
97
|
+
│ existing .github/workflows/ to understand our patterns for │
|
|
98
|
+
│ permissions and triggers. Use contents:read permission. Follow the │
|
|
99
|
+
│ same job naming pattern as deploy.yml. If you're unsure about which │
|
|
100
|
+
│ events to use, ask me rather than guessing. │
|
|
101
|
+
╰──────────────────────────────────────────────────────────────────────────╯
|
|
102
|
+
|
|
103
|
+
WHY THIS WORKS: Points to existing workflows to learn patterns, sets
|
|
104
|
+
explicit security constraints, and prevents the agent from making
|
|
105
|
+
permission guesses that need rework.
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## LLM Provider Setup
|
|
109
|
+
|
|
110
|
+
git-pulse uses [LiteLLM](https://docs.litellm.ai/) under the hood, so it works with 100+ LLM providers out of the box. Set the appropriate environment variable for your provider:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Anthropic (default model: claude-sonnet-4-20250514)
|
|
114
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
115
|
+
|
|
116
|
+
# OpenAI
|
|
117
|
+
export OPENAI_API_KEY=sk-...
|
|
118
|
+
git-pulse analyze . --model openai/gpt-4o
|
|
119
|
+
|
|
120
|
+
# AWS Bedrock
|
|
121
|
+
export AWS_PROFILE=my-profile
|
|
122
|
+
git-pulse analyze . --model bedrock/us.anthropic.claude-sonnet-4-20250514-v1:0
|
|
123
|
+
|
|
124
|
+
# Any LiteLLM-supported provider
|
|
125
|
+
git-pulse analyze . --model <provider>/<model-id>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Configuration
|
|
129
|
+
|
|
130
|
+
git-pulse looks for TOML config files in this order:
|
|
131
|
+
|
|
132
|
+
1. `--config` flag (explicit path)
|
|
133
|
+
2. `.gitpulse.toml` in the repo root
|
|
134
|
+
3. `~/.config/gitpulse/config.toml`
|
|
135
|
+
4. Built-in defaults
|
|
136
|
+
|
|
137
|
+
Example `.gitpulse.toml`:
|
|
138
|
+
|
|
139
|
+
```toml
|
|
140
|
+
[llm]
|
|
141
|
+
model = "anthropic/claude-sonnet-4-20250514"
|
|
142
|
+
|
|
143
|
+
[analysis]
|
|
144
|
+
default_days = 30
|
|
145
|
+
max_hotspots = 20
|
|
146
|
+
exclude = ["*.lock", "package-lock.json", "*.generated.*"]
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## CLI Options
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
git-pulse analyze [PATH] [OPTIONS]
|
|
153
|
+
|
|
154
|
+
Arguments:
|
|
155
|
+
PATH Path to a git repository [default: .]
|
|
156
|
+
|
|
157
|
+
Options:
|
|
158
|
+
--days INTEGER Analyze last N days of history
|
|
159
|
+
--commits INTEGER Analyze last N commits
|
|
160
|
+
--branch TEXT Branch to analyze (default: current)
|
|
161
|
+
--include TEXT Only analyze files matching glob (repeatable)
|
|
162
|
+
--exclude TEXT Skip files matching glob (repeatable)
|
|
163
|
+
--max-hotspots INT Max hotspots to send to LLM
|
|
164
|
+
--model TEXT LiteLLM model string
|
|
165
|
+
--json Output JSON instead of rich terminal
|
|
166
|
+
--output TEXT Write report to file
|
|
167
|
+
--verbose Show raw collector metrics
|
|
168
|
+
--config TEXT Path to config file
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## How It Works
|
|
172
|
+
|
|
173
|
+
git-pulse has a two-layer architecture:
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
Git History ──► Collector Layer ──► Structured Report ──► Analyst (LLM) ──► Insights
|
|
177
|
+
│ │
|
|
178
|
+
├─ GitHistoryCollector ├─ LiteLLM (any provider)
|
|
179
|
+
├─ HotspotDetector (spatiotemporal) └─ Categorized insights
|
|
180
|
+
└─ MetricsCalculator
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
**Collector Layer** (deterministic, no LLM):
|
|
184
|
+
- Walks git history, extracts diffs, detects agent attribution
|
|
185
|
+
- Clusters modifications by file + spatial/temporal proximity into hotspots
|
|
186
|
+
- Computes metrics: file churn, change velocity, rework rate, session analysis
|
|
187
|
+
|
|
188
|
+
**Analyst Layer** (LLM-powered):
|
|
189
|
+
- Receives the structured collector report
|
|
190
|
+
- Produces categorized insights with evidence and recommendations
|
|
191
|
+
- Generates specific prompt guidance when agent attribution is detected
|
|
192
|
+
|
|
193
|
+
## Development
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
# Clone and install in dev mode
|
|
197
|
+
git clone https://github.com/srikanth1003/git-pulse.git
|
|
198
|
+
cd git-pulse
|
|
199
|
+
pip install -e ".[dev]"
|
|
200
|
+
|
|
201
|
+
# Run tests
|
|
202
|
+
pytest
|
|
203
|
+
|
|
204
|
+
# Run on any repo
|
|
205
|
+
git-pulse analyze /path/to/any/repo --days 14
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## License
|
|
209
|
+
|
|
210
|
+
MIT
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "gitpulse-ai"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Analyze git repo history for development hotspots with LLM-powered insights"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
requires-python = ">=3.10"
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "srikanth1003" },
|
|
15
|
+
]
|
|
16
|
+
keywords = [
|
|
17
|
+
"git",
|
|
18
|
+
"git-history",
|
|
19
|
+
"code-analysis",
|
|
20
|
+
"code-quality",
|
|
21
|
+
"hotspots",
|
|
22
|
+
"technical-debt",
|
|
23
|
+
"developer-productivity",
|
|
24
|
+
"llm",
|
|
25
|
+
"ai",
|
|
26
|
+
"coding-agents",
|
|
27
|
+
]
|
|
28
|
+
classifiers = [
|
|
29
|
+
"Development Status :: 3 - Alpha",
|
|
30
|
+
"Environment :: Console",
|
|
31
|
+
"Intended Audience :: Developers",
|
|
32
|
+
"Operating System :: OS Independent",
|
|
33
|
+
"Programming Language :: Python :: 3",
|
|
34
|
+
"Programming Language :: Python :: 3.10",
|
|
35
|
+
"Programming Language :: Python :: 3.11",
|
|
36
|
+
"Programming Language :: Python :: 3.12",
|
|
37
|
+
"Programming Language :: Python :: 3.13",
|
|
38
|
+
"Topic :: Software Development :: Quality Assurance",
|
|
39
|
+
"Topic :: Software Development :: Version Control :: Git",
|
|
40
|
+
"Topic :: Utilities",
|
|
41
|
+
]
|
|
42
|
+
dependencies = [
|
|
43
|
+
"typer>=0.9.0",
|
|
44
|
+
"gitpython>=3.1.0",
|
|
45
|
+
"litellm>=1.0.0",
|
|
46
|
+
"rich>=13.0.0",
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
[project.optional-dependencies]
|
|
50
|
+
dev = [
|
|
51
|
+
"pytest>=7.0.0",
|
|
52
|
+
"pytest-cov>=4.0.0",
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
[project.urls]
|
|
56
|
+
Homepage = "https://github.com/srikanth1003/git-pulse"
|
|
57
|
+
Repository = "https://github.com/srikanth1003/git-pulse"
|
|
58
|
+
Issues = "https://github.com/srikanth1003/git-pulse/issues"
|
|
59
|
+
Changelog = "https://github.com/srikanth1003/git-pulse/blob/main/CHANGELOG.md"
|
|
60
|
+
|
|
61
|
+
[project.scripts]
|
|
62
|
+
git-pulse = "git_pulse.cli:app"
|
|
63
|
+
|
|
64
|
+
[tool.hatch.version]
|
|
65
|
+
path = "src/git_pulse/__init__.py"
|
|
66
|
+
|
|
67
|
+
[tool.hatch.build.targets.wheel]
|
|
68
|
+
packages = ["src/git_pulse"]
|
|
69
|
+
|
|
70
|
+
[tool.pytest.ini_options]
|
|
71
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|
|
File without changes
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
|
|
5
|
+
from litellm import completion
|
|
6
|
+
|
|
7
|
+
from git_pulse.analyst.models import AnalystReport
|
|
8
|
+
from git_pulse.analyst.prompts import build_system_prompt, build_user_prompt
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class AnalystEngine:
|
|
12
|
+
def __init__(self, model: str):
|
|
13
|
+
self.model = model
|
|
14
|
+
|
|
15
|
+
def analyze(self, report_dict: dict) -> AnalystReport:
|
|
16
|
+
"""Send collector report to LLM and parse the response into an AnalystReport."""
|
|
17
|
+
system_prompt = build_system_prompt()
|
|
18
|
+
user_prompt = build_user_prompt(report_dict)
|
|
19
|
+
|
|
20
|
+
messages = [
|
|
21
|
+
{"role": "system", "content": system_prompt},
|
|
22
|
+
{"role": "user", "content": user_prompt},
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
response = completion(model=self.model, messages=messages)
|
|
26
|
+
content = response.choices[0].message.content
|
|
27
|
+
|
|
28
|
+
try:
|
|
29
|
+
data = json.loads(content)
|
|
30
|
+
return AnalystReport.from_dict(data)
|
|
31
|
+
except (json.JSONDecodeError, KeyError):
|
|
32
|
+
return self._retry(messages, content)
|
|
33
|
+
|
|
34
|
+
def _retry(self, messages: list[dict], bad_content: str) -> AnalystReport:
|
|
35
|
+
"""Retry with a correction prompt after malformed JSON."""
|
|
36
|
+
messages = messages + [
|
|
37
|
+
{"role": "assistant", "content": bad_content},
|
|
38
|
+
{
|
|
39
|
+
"role": "user",
|
|
40
|
+
"content": "Your response was not valid JSON. Please respond with ONLY valid JSON matching the schema from the system prompt. No markdown, no explanation.",
|
|
41
|
+
},
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
response = completion(model=self.model, messages=messages)
|
|
45
|
+
content = response.choices[0].message.content
|
|
46
|
+
|
|
47
|
+
try:
|
|
48
|
+
data = json.loads(content)
|
|
49
|
+
return AnalystReport.from_dict(data)
|
|
50
|
+
except (json.JSONDecodeError, KeyError):
|
|
51
|
+
return AnalystReport(
|
|
52
|
+
summary="Failed to parse LLM response. Run with --verbose to see raw collector data.",
|
|
53
|
+
insights=[],
|
|
54
|
+
top_actions=[],
|
|
55
|
+
)
|