commit-insights 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 hinedy
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.
package/README.md ADDED
@@ -0,0 +1,106 @@
1
+ # commit-insights
2
+
3
+ Generate a local git contribution dashboard (static HTML) from your repo's commit history. Optional AI-written narrative summaries via BYOK/BYOM providers.
4
+
5
+ ```
6
+ npm install -g commit-insights
7
+ commit-insights generate .
8
+ open dashboard.html
9
+ ```
10
+
11
+ ## Features
12
+
13
+ - **Self-contained dashboard** — single `dashboard.html`, dark theme, Chart.js charts, works offline
14
+ - **Zero network by default** — no data ever leaves your machine unless you explicitly opt in
15
+ - **Optional AI narratives** — aggregated stats sent to Anthropic, OpenAI, or local Ollama (`--narrative`)
16
+ - **Incremental** — SQLite cache reuses historical data, only extracts new commits
17
+ - **Git-native** — respects `.gitignore`, lives inside `.git/` for cache, uses `git log -z` under the hood
18
+
19
+ ## Privacy
20
+
21
+ `commit-insights` makes zero external network calls unless you pass `--narrative`. The core dashboard (statistics, charts, tables) is generated entirely from your local git history. No data is collected, no telemetry, no analytics.
22
+
23
+ When AI narratives are enabled (`--narrative`), only **aggregated statistics** (commit counts, type breakdowns, top tickets) are sent to the configured provider — never raw commit messages, diffs, or code.
24
+
25
+ ## Usage
26
+
27
+ ```
28
+ commit-insights generate [path] generate contribution dashboard
29
+ commit-insights cache status|clear [path] inspect or clear cache
30
+ commit-insights config [--json] [--explain] show effective config
31
+
32
+ Options:
33
+ --author <pattern> filter commits by author
34
+ --all bypass cache, full reconciliation
35
+ --out <file> output path (default: dashboard.html)
36
+ --narrative include AI-written narrative summary
37
+ --narrative-audience <type> manager | retro | resume | self
38
+ --narrative-length <len> short | normal
39
+ --strict exit non-zero if AI narrative fails
40
+ --no-cache skip cache, re-extract everything
41
+ --cdn-charts load Chart.js from CDN (requires internet)
42
+ ```
43
+
44
+ ## Configuration (precedence)
45
+
46
+ Lowest → Highest:
47
+
48
+ 1. **Built-in defaults**
49
+ 2. **Repo config** (`.commit-insights.json` — team-shared: AI provider/baseUrl/model, areas, ticket patterns)
50
+ 3. **User config** (`~/.config/commit-insights/config.json` — personal: AI provider/model)
51
+ 4. **Environment variables** (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GOOGLE_API_KEY`, `AI_MODEL`, `AI_BASE_URL`, `OLLAMA_HOST`)
52
+ 5. **CLI flags**
53
+
54
+ > User config beats repo config — your AI provider preference shouldn't be forced by a team config file.
55
+
56
+ API keys are read from a `.env` file in the current working directory (gitignored via `.gitignore`). Never commit API keys to your repo config.
57
+
58
+ ```json
59
+ {
60
+ "ai": {
61
+ "provider": "ollama",
62
+ "model": "llama3.2"
63
+ },
64
+ "areas": {
65
+ "src/components/": "UI",
66
+ "src/api/": "Backend"
67
+ },
68
+ "ticketPattern": "PROJ-\\d+"
69
+ }
70
+ ```
71
+
72
+ ## AI providers
73
+
74
+ | Provider | Default model | Key required |
75
+ |----------|--------------|--------------|
76
+ | Anthropic | `claude-sonnet-4-20250514` | `ANTHROPIC_API_KEY` |
77
+ | OpenAI | `gpt-4o` | `OPENAI_API_KEY` |
78
+ | Gemini | `gemini-2.0-flash` | `GOOGLE_API_KEY` |
79
+ | Ollama | `llama3.2` | No key (local) |
80
+
81
+ Default models can be overridden via config (`model`) or `AI_MODEL` environment variable.
82
+
83
+ ## Development
84
+
85
+ ```bash
86
+ git clone https://github.com/hinedy/commit-insights
87
+ cd commit-insights
88
+ npm install
89
+
90
+ # Run from source
91
+ npm run dev -- generate .
92
+
93
+ # Build
94
+ npm run build
95
+
96
+ # Test
97
+ npm test
98
+ ```
99
+
100
+ ## Why not `git-insights`?
101
+
102
+ The tool is named for **commits**, not git — it works on any repo's commit history regardless of VCS, and the name avoids implying it covers all git operations (blame, reflog, etc.). The scope is contribution insight, not git insight.
103
+
104
+ ---
105
+
106
+ MIT © 2026 hinedy
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ buildProgram
4
+ } from "../chunk-5FNMOOYM.js";
5
+ import "../chunk-JSBRDJBE.js";
6
+
7
+ // src/bin/commit-insights.ts
8
+ import "dotenv/config";
9
+ buildProgram().parseAsync(process.argv);