commit-analyzer 1.1.4 → 1.1.5

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.
package/README.md CHANGED
@@ -1,43 +1,29 @@
1
1
  # Git Commit Analyzer
2
2
 
3
- A TypeScript/Node.js program that analyzes git commits and generates categorized summaries using Claude CLI.
3
+ A TypeScript/Node.js program that analyzes git commits and generates categorized
4
+ summaries using Claude CLI.
4
5
 
5
6
  ## Features
6
7
 
7
8
  - Extract commit details (message, date, diff) from git repositories
8
- - Categorize commits using LLM analysis into: `tweak`, `feature`, or `process`
9
- - Generate CSV reports with year, category, summary, and description
10
- - Generate condensed markdown reports from CSV data for stakeholder communication
11
- - Support for multiple LLM models (Claude, Gemini, Codex) with automatic detection
9
+ - Categorize commits using LLM analysis into:
10
+ `tweak`, `feature`, or `process`
11
+ - Generate CSV reports with timestamp, category, summary, and description
12
+ - Generate condensed markdown reports from CSV data for stakeholder
13
+ communication
14
+ - Support for multiple LLM models (Claude, Gemini, OpenAI) with automatic
15
+ detection
12
16
  - Support for batch processing multiple commits
13
17
  - Automatically filters out merge commits for cleaner analysis
14
18
  - Robust error handling and validation
15
19
 
16
- ## Prerequisites
17
-
18
- This tool requires Bun runtime. Install it globally:
19
-
20
- ```bash
21
- # Install bun globally
22
- curl -fsSL https://bun.sh/install | bash
23
- # or
24
- npm install -g bun
25
- ```
26
-
27
- ## Installation
28
-
29
- ```bash
30
- npm install
31
- bun link
32
- ```
33
-
34
- After linking, you can use `commit-analyzer` command globally.
35
20
 
36
21
  ## Usage
37
22
 
38
23
  ### Default Behavior
39
24
 
40
- When run without arguments, the program analyzes all commits authored by the current user:
25
+ When run without arguments, the program analyzes all commits authored by the
26
+ current user:
41
27
 
42
28
  ```bash
43
29
  # Analyze all your commits in the current repository
@@ -56,9 +42,6 @@ npx commit-analyzer --author user@example.com
56
42
  # Analyze specific commits
57
43
  npx commit-analyzer abc123 def456 ghi789
58
44
 
59
- # Read commits from file
60
- npx commit-analyzer --file commits.txt
61
-
62
45
  # Specify output file with default behavior
63
46
  npx commit-analyzer --output analysis.csv --limit 20
64
47
 
@@ -69,32 +52,46 @@ npx commit-analyzer --report --input-csv analysis.csv
69
52
  npx commit-analyzer --report --limit 50
70
53
 
71
54
  # Use specific LLM model
72
- npx commit-analyzer --model claude --limit 10
55
+ npx commit-analyzer --llm claude --limit 10
73
56
  ```
74
57
 
75
58
  ### Options
76
59
 
77
- - `-o, --output <file>`: Output file (default: `output.csv` for analysis, `summary-report.md` for reports)
78
- - `-f, --file <file>`: Read commit hashes from file (one per line)
79
- - `-a, --author <email>`: Filter commits by author email (defaults to current user)
80
- - `-l, --limit <number>`: Limit number of commits to analyze
81
- - `-m, --model <model>`: LLM model to use (claude, gemini, codex)
82
- - `-r, --resume`: Resume from last checkpoint if available
83
- - `-c, --clear`: Clear any existing progress checkpoint
84
- - `--report`: Generate condensed markdown report from existing CSV
85
- - `--input-csv <file>`: Input CSV file to read for report generation
86
- - `-h, --help`: Display help
87
- - `-V, --version`: Display version
88
-
89
- ### Input File Format
90
-
91
- When using `--file`, create a text file with one commit hash per line:
92
-
93
- ```
94
- abc123def456
95
- def456ghi789
96
- ghi789jkl012
97
- ```
60
+ - `-o, --output <file>`:
61
+ Output file (default:
62
+ `results/commits.csv` for analysis, `results/report.md` for reports)
63
+ - `--output-dir <dir>`:
64
+ Output directory for CSV and report files (default:
65
+ current directory)
66
+ - `-a, --author <email>`:
67
+ Filter commits by author email (defaults to current user)
68
+ - `-l, --limit <number>`:
69
+ Limit number of commits to analyze
70
+ - `--llm <model>`:
71
+ LLM model to use (claude, gemini, openai)
72
+ - `-r, --resume`:
73
+ Resume from last checkpoint if available
74
+ - `-c, --clear`:
75
+ Clear any existing progress checkpoint
76
+ - `--report`:
77
+ Generate condensed markdown report from existing CSV
78
+ - `--input-csv <file>`:
79
+ Input CSV file to read for report generation
80
+ - `-v, --verbose`:
81
+ Enable verbose logging (shows detailed error information)
82
+ - `--since <date>`:
83
+ Only analyze commits since this date (YYYY-MM-DD, '1 week ago', '2024-01-01')
84
+ - `--until <date>`:
85
+ Only analyze commits until this date (YYYY-MM-DD, '1 day ago', '2024-12-31')
86
+ - `--no-cache`:
87
+ Disable caching of analysis results
88
+ - `--batch-size <number>`:
89
+ Number of commits to process per batch (default:
90
+ 1 for sequential processing)
91
+ - `-h, --help`:
92
+ Display help
93
+ - `-V, --version`:
94
+ Display version
98
95
 
99
96
  ## Output Formats
100
97
 
@@ -102,36 +99,46 @@ ghi789jkl012
102
99
 
103
100
  The program generates a CSV file with the following columns:
104
101
 
105
- - `year`: Year of the commit
106
- - `category`: One of `tweak`, `feature`, or `process`
107
- - `summary`: One-line description (max 80 characters)
108
- - `description`: Detailed explanation (2-3 sentences)
102
+ - `timestamp`:
103
+ ISO 8601 timestamp of the commit (e.g., `2025-08-28T11:14:40.000Z`)
104
+ - `category`:
105
+ One of `tweak`, `feature`, or `process`
106
+ - `summary`:
107
+ One-line description (max 80 characters)
108
+ - `description`:
109
+ Detailed explanation (2-3 sentences)
109
110
 
110
111
  ### Markdown Report Output
111
112
 
112
- When using the `--report` option, the program generates a condensed markdown report that:
113
+ When using the `--report` option, the program generates a condensed markdown
114
+ report that:
113
115
 
114
116
  - Groups commits by year (most recent first)
115
- - Organizes by categories: Features, Processes, Tweaks & Bug Fixes
117
+ - Organizes by categories:
118
+ Features, Processes, Tweaks & Bug Fixes
116
119
  - Consolidates similar items for stakeholder readability
117
120
  - Includes commit count statistics
118
- - Uses professional language suitable for both technical and non-technical audiences
121
+ - Uses professional language suitable for both technical and non-technical
122
+ audiences
119
123
 
120
124
  ## Requirements
121
125
 
122
- - Node.js 18+ with TypeScript support
126
+ - Node.js 18+ with TypeScript support (Bun runtime recommended)
123
127
  - Git repository (must be run within a git repository)
124
128
  - At least one supported LLM CLI tool:
125
129
  - Claude CLI (`claude`) - recommended, defaults to Sonnet model
126
130
  - Gemini CLI (`gemini`)
127
- - Codex CLI (`codex`)
131
+ - OpenAI CLI (`codex`)
128
132
  - Valid git commit hashes (when specifying commits manually)
129
133
 
130
134
  ## Categories
131
135
 
132
- - **tweak**: Minor adjustments, bug fixes, small improvements
133
- - **feature**: New functionality, major additions
134
- - **process**: Build system, CI/CD, tooling, configuration changes
136
+ - **tweak**:
137
+ Minor adjustments, bug fixes, small improvements
138
+ - **feature**:
139
+ New functionality, major additions
140
+ - **process**:
141
+ Build system, CI/CD, tooling, configuration changes
135
142
 
136
143
  ## Error Handling
137
144
 
@@ -151,7 +158,8 @@ The tool automatically:
151
158
  - **Stops processing after a commit fails all retry attempts**
152
159
  - Exports partial results to the CSV file before exiting
153
160
 
154
- If the process stops (e.g., after 139 commits due to API failure), you can resume from where it left off:
161
+ If the process stops (e.g., after 139 commits due to API failure), you can
162
+ resume from where it left off:
155
163
 
156
164
  ```bash
157
165
  # Resume from last checkpoint
@@ -165,13 +173,12 @@ npx commit-analyzer --resume
165
173
  ```
166
174
 
167
175
  The checkpoint file (`.commit-analyzer/progress.json`) contains:
176
+
168
177
  - List of all commits to process
169
178
  - Successfully processed commits (including failed ones to skip on resume)
170
179
  - Analyzed commit data (only successful ones)
171
180
  - Output file location
172
181
 
173
- **Important**: When a commit fails after all retries (default 3), the process stops immediately to prevent wasting API calls. The successfully analyzed commits up to that point are saved to the CSV file.
174
-
175
182
  ### Application Data Directory
176
183
 
177
184
  The tool creates a `.commit-analyzer/` directory to store internal files:
@@ -185,23 +192,80 @@ The tool creates a `.commit-analyzer/` directory to store internal files:
185
192
  └── ...
186
193
  ```
187
194
 
188
- - **Progress checkpoint**: Enables resuming interrupted analysis sessions
189
- - **Analysis cache**: Stores LLM analysis results to avoid re-processing the same commits (TTL: 30 days)
195
+ - **Progress checkpoint**:
196
+ Enables resuming interrupted analysis sessions
197
+ - **Analysis cache**:
198
+ Stores LLM analysis results to avoid re-processing the same commits (TTL:
199
+ 30 days)
190
200
 
191
201
  Use `--no-cache` to disable caching if needed.
202
+ Use `--clear` to clear the cache and progress checkpoint.
203
+
204
+ ### Date Filtering
205
+
206
+ The tool supports flexible date filtering using natural language or specific
207
+ dates:
208
+
209
+ ```bash
210
+ # Analyze commits from the last week
211
+ npx commit-analyzer --since "1 week ago"
212
+
213
+ # Analyze commits from a specific date range
214
+ npx commit-analyzer --since "2024-01-01" --until "2024-12-31"
215
+
216
+ # Analyze commits from the beginning of the year
217
+ npx commit-analyzer --since "2024-01-01"
218
+
219
+ # Analyze commits up to a specific date
220
+ npx commit-analyzer --until "2024-06-30"
221
+ ```
222
+
223
+ Date formats supported:
224
+ - Relative dates:
225
+ `"1 week ago"`, `"2 months ago"`, `"3 days ago"`
226
+ - ISO dates:
227
+ `"2024-01-01"`, `"2024-12-31"`
228
+ - Git-style dates:
229
+ Any format accepted by `git log --since` and `git log --until`
230
+
231
+ ### Batch Processing
232
+
233
+ Control processing speed and resource usage with batch size options:
234
+
235
+ ```bash
236
+ # Process commits one at a time (default, safest for rate limits)
237
+ npx commit-analyzer --batch-size 1
238
+
239
+ # Process multiple commits in parallel (faster but may hit rate limits)
240
+ npx commit-analyzer --batch-size 5 --limit 100
241
+
242
+ # Sequential processing for large datasets
243
+ npx commit-analyzer --batch-size 1 --limit 500
244
+ ```
192
245
 
193
246
  ### Retry Logic
194
247
 
195
- The tool includes automatic retry logic with exponential backoff for handling API failures when processing many commits. This is especially useful when analyzing large numbers of commits that might trigger rate limits.
248
+ The tool includes automatic retry logic with exponential backoff for handling
249
+ API failures when processing many commits.
250
+ This is especially useful when analyzing large numbers of commits that might
251
+ trigger rate limits.
196
252
 
197
253
  #### Configuration
198
254
 
199
255
  You can configure the retry behavior using environment variables:
200
256
 
201
- - `LLM_MAX_RETRIES`: Maximum number of retry attempts (default: 3)
202
- - `LLM_INITIAL_RETRY_DELAY`: Initial delay between retries in milliseconds (default: 5000)
203
- - `LLM_MAX_RETRY_DELAY`: Maximum delay between retries in milliseconds (default: 30000)
204
- - `LLM_RETRY_MULTIPLIER`: Multiplier for exponential backoff (default: 2)
257
+ - `LLM_MAX_RETRIES`:
258
+ Maximum number of retry attempts (default:
259
+ 3)
260
+ - `LLM_INITIAL_RETRY_DELAY`:
261
+ Initial delay between retries in milliseconds (default:
262
+ 5000)
263
+ - `LLM_MAX_RETRY_DELAY`:
264
+ Maximum delay between retries in milliseconds (default:
265
+ 30000)
266
+ - `LLM_RETRY_MULTIPLIER`:
267
+ Multiplier for exponential backoff (default:
268
+ 2)
205
269
 
206
270
  #### Examples
207
271
 
@@ -226,19 +290,19 @@ The retry mechanism automatically:
226
290
 
227
291
  ```bash
228
292
  # Install dependencies
229
- npm install
293
+ bun install
230
294
 
231
295
  # Run in development mode
232
- npm run dev
296
+ bun run dev
233
297
 
234
298
  # Build for production
235
- npm run build
299
+ bun run build
236
300
 
237
301
  # Run linting
238
- npm run lint
302
+ bun run lint
239
303
 
240
304
  # Type checking
241
- npm run typecheck
305
+ bun run typecheck
242
306
  ```
243
307
 
244
308
  ## Examples
@@ -253,10 +317,6 @@ npx commit-analyzer --limit 20 --output my_analysis.csv
253
317
  # Analyze commits by a specific team member
254
318
  npx commit-analyzer --author teammate@company.com --limit 50
255
319
 
256
- # Analyze specific commits
257
- git log --oneline -5 | cut -d' ' -f1 > recent_commits.txt
258
- npx commit-analyzer --file recent_commits.txt --output recent_analysis.csv
259
-
260
320
  # Quick analysis of your recent work
261
321
  npx commit-analyzer --limit 10
262
322
 
@@ -267,8 +327,30 @@ npx commit-analyzer --report --limit 100 --output yearly_analysis.csv
267
327
  npx commit-analyzer --report --input-csv existing_analysis.csv --output team_report.md
268
328
 
269
329
  # Use specific LLM model for analysis
270
- npx commit-analyzer --model gemini --limit 25
330
+ npx commit-analyzer --llm gemini --limit 25
271
331
 
272
332
  # Resume interrupted analysis with progress tracking
273
333
  npx commit-analyzer --resume
274
334
  ```
335
+
336
+ ## Development
337
+
338
+ This tool requires the Bun runtime.
339
+ Install it globally:
340
+
341
+ ```bash
342
+ # Install bun globally
343
+ curl -fsSL https://bun.sh/install | bash
344
+ # or
345
+ npm install -g bun
346
+ ```
347
+
348
+ ## Installation
349
+
350
+ ```bash
351
+ bun install
352
+ bun build
353
+ bun link
354
+ ```
355
+
356
+ After linking, you can use `commit-analyzer` command globally.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commit-analyzer",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "Analyze git commits and generate categories, summaries, and descriptions for each commit. Optionally generate a yearly breakdown report of your commit history.",
5
5
  "main": "dist/main.ts",
6
6
  "bin": {
package/prompt.md CHANGED
@@ -58,12 +58,12 @@
58
58
  ### Technical Implementation
59
59
 
60
60
  - Use Node.js with TypeScript
61
- - Extract year from git commit timestamp
61
+ - Extract timestamp from git commit
62
62
 
63
63
  Output Format:
64
64
 
65
65
  CSV with headers:
66
- year,category,summary,description
66
+ timestamp,category,summary,description
67
67
 
68
68
  The program should be robust, handle edge cases, and provide clear error
69
69
  messages for invalid commits or API failures.
@@ -24,7 +24,7 @@ export interface CLIOptions {
24
24
  }
25
25
 
26
26
  export class CLIApplication {
27
- private static readonly VERSION = "1.1.4"
27
+ private static readonly VERSION = "1.1.5"
28
28
  private static readonly DEFAULT_COMMITS_OUTPUT_FILE = "results/commits.csv"
29
29
  private static readonly DEFAULT_REPORT_OUTPUT_FILE = "results/report.md"
30
30