gitfamiliar 0.8.0 → 0.10.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/README.md CHANGED
@@ -1,14 +1,18 @@
1
- <p align="center">
2
- <h1 align="center">GitFamiliar</h1>
3
- <p align="center">
4
- <strong>Visualize your code familiarity from Git history.</strong>
5
- </p>
6
- <p align="center">
7
- <a href="https://www.npmjs.com/package/gitfamiliar"><img src="https://img.shields.io/npm/v/gitfamiliar.svg" alt="npm version"></a>
8
- <a href="https://www.npmjs.com/package/gitfamiliar"><img src="https://img.shields.io/npm/dm/gitfamiliar.svg" alt="npm downloads"></a>
9
- <a href="https://github.com/kuze/gitfamiliar/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/gitfamiliar.svg" alt="license"></a>
10
- </p>
11
- </p>
1
+ <div align="center">
2
+
3
+ # GitFamiliar
4
+
5
+ ### Know your code. Not just your commits.
6
+
7
+ [![npm version](https://img.shields.io/npm/v/gitfamiliar.svg?style=flat-square&color=e94560)](https://www.npmjs.com/package/gitfamiliar)
8
+ [![npm downloads](https://img.shields.io/npm/dm/gitfamiliar.svg?style=flat-square&color=5eadf7)](https://www.npmjs.com/package/gitfamiliar)
9
+ [![license](https://img.shields.io/npm/l/gitfamiliar.svg?style=flat-square&color=27ae60)](https://github.com/kuze/gitfamiliar/blob/main/LICENSE)
10
+
11
+ **Measure how well you *understand* the codebase — not just how much you wrote.**
12
+
13
+ [Quick Start](#-quick-start) · [Scoring Modes](#-scoring-modes) · [Team Features](#-team-features) · [HTML Dashboard](#-html-dashboard) · [CLI Reference](#-cli-reference)
14
+
15
+ </div>
12
16
 
13
17
  ---
14
18
 
@@ -37,14 +41,29 @@ Overall: 58/172 files (34%)
37
41
  Written: 42 files
38
42
  ```
39
43
 
40
- Use `--html` to generate an interactive treemap in the browser:
44
+ Use `--html` to generate an **interactive unified dashboard** in the browser:
41
45
 
42
- ```
43
- $ npx gitfamiliar --html
46
+ ```bash
47
+ npx gitfamiliar --html
44
48
  ```
45
49
 
46
- > Area = lines of code, Color = familiarity (red -> green).
47
- > Click folders to drill down.
50
+ > **4 tabs** Scoring / Coverage / Multi-User / Hotspots
51
+ > **Area** = lines of code, **Color** = familiarity (red → green)
52
+ > Click folders to drill down. Weighted mode sliders recalculate in real-time.
53
+
54
+ ---
55
+
56
+ ## Why GitFamiliar?
57
+
58
+ | | git-fame / GitHub | **GitFamiliar** |
59
+ |:---|:---|:---|
60
+ | What it measures | How much you **wrote** | How well you **understand** |
61
+ | Metric | Lines / commits (cumulative) | Familiarity score (multi-signal) |
62
+ | Use case | Contribution stats | Onboarding progress |
63
+ | Time decay | No | Yes (knowledge fades) |
64
+ | Team analysis | No | Yes (bus factor, coverage, hotspots) |
65
+
66
+ ---
48
67
 
49
68
  ## Quick Start
50
69
 
@@ -60,19 +79,13 @@ Or install globally:
60
79
  npm install -g gitfamiliar
61
80
  ```
62
81
 
63
- ## Why GitFamiliar?
64
-
65
- | | git-fame / GitHub | GitFamiliar |
66
- |---|---|---|
67
- | What it measures | How much you **wrote** | How well you **understand** |
68
- | Metric | Lines / commits (cumulative) | Familiarity score (multi-signal) |
69
- | Use case | Contribution stats | Onboarding progress |
70
- | Time decay | No | Yes (knowledge fades) |
71
- | Team analysis | No | Yes (bus factor, multi-user comparison) |
82
+ ---
72
83
 
73
84
  ## Scoring Modes
74
85
 
75
- ### Binary (default)
86
+ ### `binary` default
87
+
88
+ > Best for: **New team members** tracking onboarding progress.
76
89
 
77
90
  Files are "written" or "not written". A file counts as written if you have at least one commit touching it.
78
91
 
@@ -80,14 +93,9 @@ Files are "written" or "not written". A file counts as written if you have at le
80
93
  familiarity = written_files / total_files
81
94
  ```
82
95
 
83
- ```bash
84
- gitfamiliar # default
85
- ```
86
-
87
- > Best for: **New team members** tracking onboarding progress.
88
- > Scores only go up (by default), giving a sense of achievement.
96
+ ### `authorship`
89
97
 
90
- ### Authorship
98
+ > Best for: **Tech leads** assessing code ownership and bus factor.
91
99
 
92
100
  Your share of the current codebase, based on `git blame -w`.
93
101
 
@@ -100,25 +108,22 @@ score(project) = sum(your_lines) / sum(all_lines)
100
108
  gitfamiliar --mode authorship
101
109
  ```
102
110
 
103
- > Best for: **Tech leads** assessing bus factor and code ownership.
111
+ ### `weighted`
104
112
 
105
- ### Weighted
113
+ > Best for: **Power users** who want the most accurate picture.
106
114
 
107
115
  Combines two signals with configurable weights and time decay:
108
116
 
109
117
  ```
110
- familiarity = w1 x blame_score + w2 x commit_score
118
+ familiarity = w1 × blame_score + w2 × commit_score
111
119
  ```
112
120
 
113
- Default weights: `blame=0.5, commit=0.5`
114
-
115
- Key features:
116
121
  - **Sigmoid normalization** prevents a single large commit from dominating
117
122
  - **Recency decay** (half-life: 180 days) models knowledge fading over time
118
123
 
119
124
  ```bash
120
125
  gitfamiliar --mode weighted
121
- gitfamiliar --mode weighted --weights "0.6,0.4" # custom weights
126
+ gitfamiliar --mode weighted --weights "0.6,0.4"
122
127
  ```
123
128
 
124
129
  <details>
@@ -130,18 +135,18 @@ File: `src/auth/login.ts` (200 lines)
130
135
  blame_score = 30 lines / 200 lines = 0.15
131
136
 
132
137
  commit_score:
133
- commit 1 (10 days ago, +30/-0): sigmoid(30/200) x decay(10d) = 0.33 x 0.96
134
- commit 2 (45 days ago, +5/-2): sigmoid(6/200) x decay(45d) = 0.09 x 0.84
138
+ commit 1 (10 days ago, +30/-0): sigmoid(30/200) × decay(10d) = 0.33 × 0.96
139
+ commit 2 (45 days ago, +5/-2): sigmoid(6/200) × decay(45d) = 0.09 × 0.84
135
140
  total: min(1, 0.39) = 0.39
136
141
 
137
- familiarity = 0.5 x 0.15 + 0.5 x 0.39
142
+ familiarity = 0.5 × 0.15 + 0.5 × 0.39
138
143
  = 0.075 + 0.195
139
- = 0.27 -> 27%
144
+ = 0.27 27%
140
145
  ```
141
146
 
142
147
  </details>
143
148
 
144
- > Best for: **Power users** who want the most accurate picture.
149
+ ---
145
150
 
146
151
  ## Team Features
147
152
 
@@ -163,10 +168,11 @@ gitfamiliar --team-coverage
163
168
  gitfamiliar --team-coverage --html
164
169
  ```
165
170
 
166
- Shows risk levels per folder:
167
- - **RISK** (0-1 contributors) — single point of failure
168
- - **MODERATE** (2-3 contributors) some coverage
169
- - **SAFE** (4+ contributors) well-distributed knowledge
171
+ | Risk Level | Contributors | Meaning |
172
+ |:---|:---|:---|
173
+ | **RISK** | 0–1 | Single point of failure |
174
+ | **MODERATE** | 2–3 | Some coverage |
175
+ | **SAFE** | 4+ | Well-distributed knowledge |
170
176
 
171
177
  ### Hotspot Analysis
172
178
 
@@ -179,69 +185,92 @@ gitfamiliar --hotspot --window 30 # last 30 days only
179
185
  gitfamiliar --hotspot --html # scatter plot visualization
180
186
  ```
181
187
 
182
- Risk = high change frequency x low familiarity.
188
+ > **Risk = high change frequency × low familiarity**
189
+
190
+ ---
191
+
192
+ ## HTML Dashboard
193
+
194
+ ### Unified Dashboard (default)
195
+
196
+ Running `--html` without other feature flags generates a single-page dashboard with all features:
197
+
198
+ ```bash
199
+ gitfamiliar --html # unified dashboard (4 tabs)
200
+ gitfamiliar --html --mode weighted # unified, weighted as default scoring tab
201
+ ```
202
+
203
+ | Tab | Visualization | Description |
204
+ |:---|:---|:---|
205
+ | **Scoring** | D3 treemap + sub-tabs | Binary, Authorship, Weighted modes with real-time weight sliders |
206
+ | **Coverage** | D3 treemap + risk sidebar | Team bus factor — how many people know each area |
207
+ | **Multi-User** | D3 treemap + user dropdown | Compare familiarity across all contributors |
208
+ | **Hotspots** | D3 scatter plot + sidebar | High change frequency × low familiarity = risk |
209
+
210
+ ### Individual HTML Reports
211
+
212
+ ```bash
213
+ gitfamiliar --html --hotspot # hotspot scatter plot only
214
+ gitfamiliar --html --team-coverage # coverage treemap only
215
+ gitfamiliar --html --team # multi-user treemap only
216
+ gitfamiliar --html --user "Alice" --user "Bob" # specific users comparison
217
+ ```
218
+
219
+ ---
183
220
 
184
221
  ## Expiration Policies
185
222
 
186
- By default, "written" status never expires. But real knowledge fades. Configure expiration to keep scores honest:
223
+ Real knowledge fades. Configure expiration to keep scores honest:
187
224
 
188
225
  | Policy | Flag | What happens |
189
- |---|---|---|
226
+ |:---|:---|:---|
190
227
  | Never | `--expiration never` | Once written, always counted (default) |
191
228
  | Time-based | `--expiration time:180d` | Expires 180 days after your last touch |
192
- | Change-based | `--expiration change:50%` | Expires if 50%+ of the file changed since you last touched it |
229
+ | Change-based | `--expiration change:50%` | Expires if 50%+ of the file changed since |
193
230
  | Combined | `--expiration combined:365d:50%` | Expires if **either** condition is met |
194
231
 
195
- The change-based policy is the smartest: it detects when the code you wrote has been substantially rewritten, meaning your understanding is likely outdated.
232
+ > The change-based policy is the smartest: it detects when the code you wrote has been substantially rewritten, meaning your understanding is likely outdated.
196
233
 
197
- ## File Filtering
234
+ ---
198
235
 
199
- GitFamiliar automatically ignores noise. It only considers git-tracked files, minus:
236
+ ## File Filtering
200
237
 
201
- - Lock files (`package-lock.json`, `yarn.lock`, etc.)
202
- - Generated/minified files (`*.min.js`, `*.map`, `*.generated.*`)
203
- - Build outputs (`dist/`, `build/`, `.next/`)
204
- - Config files that rarely need understanding (`tsconfig.json`, `.eslintrc*`)
238
+ GitFamiliar automatically ignores noise lock files, generated/minified files, build outputs, and config files.
205
239
 
206
240
  ### Custom filtering
207
241
 
208
242
  Create a `.gitfamiliarignore` in your repo root (same syntax as `.gitignore`):
209
243
 
210
244
  ```gitignore
211
- # Also ignore vendor code
212
245
  vendor/
213
246
  third_party/
214
-
215
- # Ignore migration files
216
247
  **/migrations/
217
248
  ```
218
249
 
250
+ ---
251
+
219
252
  ## CLI Reference
220
253
 
221
254
  ```
222
255
  Usage: gitfamiliar [options]
223
256
 
224
257
  Options:
225
- -m, --mode <mode> Scoring mode (default: "binary")
226
- Choices: binary, authorship, weighted
227
- -u, --user <user> Git user name or email (repeatable for comparison)
228
- Default: git config user.name
229
- -e, --expiration <policy> Expiration policy (default: "never")
230
- Examples: time:180d, change:50%, combined:365d:50%
231
- --html Generate interactive HTML treemap report
232
- -w, --weights <weights> Weights for weighted mode: blame,commit
233
- Example: "0.6,0.4" (must sum to 1.0)
258
+ -m, --mode <mode> Scoring mode: binary | authorship | weighted (default: "binary")
259
+ -u, --user <user> Git user name/email (repeatable for comparison)
260
+ -e, --expiration <policy> Expiration: never | time:Nd | change:N% | combined:Nd:N%
261
+ --html Generate HTML report (alone = unified dashboard)
262
+ -w, --weights <w1,w2> Weights for weighted mode (must sum to 1.0)
234
263
  --team Compare all contributors
235
- --team-coverage Show team coverage map (bus factor analysis)
264
+ --team-coverage Show team coverage map (bus factor analysis)
236
265
  --hotspot [mode] Hotspot analysis: personal (default) or team
237
266
  --window <days> Time window for hotspot analysis (default: 90)
238
267
  -V, --version Output version number
239
268
  -h, --help Display help
240
269
  ```
241
270
 
242
- ## Programmatic API
271
+ ---
243
272
 
244
- GitFamiliar can also be used as a library:
273
+ ## Programmatic API
245
274
 
246
275
  ```typescript
247
276
  import { computeFamiliarity } from 'gitfamiliar';
@@ -257,6 +286,8 @@ const result = await computeFamiliarity({
257
286
  console.log(`Score: ${Math.round(result.tree.score * 100)}%`);
258
287
  ```
259
288
 
289
+ ---
290
+
260
291
  ## Requirements
261
292
 
262
293
  - **Node.js** >= 18
@@ -276,9 +307,9 @@ npm test
276
307
 
277
308
  ## Roadmap
278
309
 
279
- - [ ] **Dependency Awareness** - Factor in understanding of imported files
280
- - [ ] **VS Code Extension** - See familiarity scores inline in the editor
281
- - [ ] **README Badge** - Codecov-style badge for your project README
310
+ - [ ] Dependency Awareness factor in understanding of imported files
311
+ - [ ] VS Code Extension see familiarity scores inline in the editor
312
+ - [ ] README Badge Codecov-style badge for your project README
282
313
 
283
314
  ## License
284
315