gitfamiliar 0.5.0 → 0.8.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 +64 -73
- package/dist/bin/gitfamiliar.js +1027 -163
- package/dist/bin/gitfamiliar.js.map +1 -1
- package/dist/{chunk-LZ67KNHF.js → chunk-R5MGQGFI.js} +14 -285
- package/dist/chunk-R5MGQGFI.js.map +1 -0
- package/dist/index.d.ts +3 -12
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-LZ67KNHF.js.map +0 -1
package/README.md
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
<a href="https://www.npmjs.com/package/gitfamiliar"><img src="https://img.shields.io/npm/v/gitfamiliar.svg" alt="npm version"></a>
|
|
8
8
|
<a href="https://www.npmjs.com/package/gitfamiliar"><img src="https://img.shields.io/npm/dm/gitfamiliar.svg" alt="npm downloads"></a>
|
|
9
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
|
-
<a href="https://github.com/kuze/gitfamiliar/actions"><img src="https://github.com/kuze/gitfamiliar/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
11
10
|
</p>
|
|
12
11
|
</p>
|
|
13
12
|
|
|
@@ -35,7 +34,7 @@ Overall: 58/172 files (34%)
|
|
|
35
34
|
tests/ ░░░░░░░░░░ 0% (0/14 files)
|
|
36
35
|
config/ ██████░░░░ 60% (3/5 files)
|
|
37
36
|
|
|
38
|
-
Written: 42 files
|
|
37
|
+
Written: 42 files
|
|
39
38
|
```
|
|
40
39
|
|
|
41
40
|
Use `--html` to generate an interactive treemap in the browser:
|
|
@@ -45,7 +44,7 @@ $ npx gitfamiliar --html
|
|
|
45
44
|
```
|
|
46
45
|
|
|
47
46
|
> Area = lines of code, Color = familiarity (red -> green).
|
|
48
|
-
> Click folders to drill down.
|
|
47
|
+
> Click folders to drill down.
|
|
49
48
|
|
|
50
49
|
## Quick Start
|
|
51
50
|
|
|
@@ -68,31 +67,21 @@ npm install -g gitfamiliar
|
|
|
68
67
|
| What it measures | How much you **wrote** | How well you **understand** |
|
|
69
68
|
| Metric | Lines / commits (cumulative) | Familiarity score (multi-signal) |
|
|
70
69
|
| Use case | Contribution stats | Onboarding progress |
|
|
71
|
-
| Review awareness | No | Yes (PR reviews count) |
|
|
72
70
|
| Time decay | No | Yes (knowledge fades) |
|
|
71
|
+
| Team analysis | No | Yes (bus factor, multi-user comparison) |
|
|
73
72
|
|
|
74
73
|
## Scoring Modes
|
|
75
74
|
|
|
76
|
-
GitFamiliar provides 4 modes so you can choose the right lens for your situation.
|
|
77
|
-
|
|
78
75
|
### Binary (default)
|
|
79
76
|
|
|
80
|
-
Files are "
|
|
77
|
+
Files are "written" or "not written". A file counts as written if you have at least one commit touching it.
|
|
81
78
|
|
|
82
79
|
```
|
|
83
|
-
familiarity =
|
|
80
|
+
familiarity = written_files / total_files
|
|
84
81
|
```
|
|
85
82
|
|
|
86
|
-
| View | Shows |
|
|
87
|
-
|---|---|
|
|
88
|
-
| All (default) | Written + Reviewed files |
|
|
89
|
-
| Written only | Only files you committed to |
|
|
90
|
-
| Reviewed only | Only files you reviewed via PR |
|
|
91
|
-
|
|
92
83
|
```bash
|
|
93
|
-
gitfamiliar #
|
|
94
|
-
gitfamiliar --filter written # Written only
|
|
95
|
-
gitfamiliar --filter reviewed # Reviewed only
|
|
84
|
+
gitfamiliar # default
|
|
96
85
|
```
|
|
97
86
|
|
|
98
87
|
> Best for: **New team members** tracking onboarding progress.
|
|
@@ -112,41 +101,24 @@ gitfamiliar --mode authorship
|
|
|
112
101
|
```
|
|
113
102
|
|
|
114
103
|
> Best for: **Tech leads** assessing bus factor and code ownership.
|
|
115
|
-
> A file where one person owns 95% of the lines is a risk signal.
|
|
116
|
-
|
|
117
|
-
### Review Coverage
|
|
118
|
-
|
|
119
|
-
Files you reviewed through PR approvals or comments, excluding your own commits.
|
|
120
|
-
|
|
121
|
-
```
|
|
122
|
-
score = reviewed_files / total_files
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
gitfamiliar --mode review-coverage
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
> Best for: **Senior engineers** tracking how broadly they review.
|
|
130
|
-
> Requires a GitHub token (see [GitHub Integration](#github-integration)).
|
|
131
104
|
|
|
132
105
|
### Weighted
|
|
133
106
|
|
|
134
|
-
|
|
107
|
+
Combines two signals with configurable weights and time decay:
|
|
135
108
|
|
|
136
109
|
```
|
|
137
|
-
familiarity = w1 x blame_score + w2 x commit_score
|
|
110
|
+
familiarity = w1 x blame_score + w2 x commit_score
|
|
138
111
|
```
|
|
139
112
|
|
|
140
|
-
Default weights: `blame=0.5, commit=0.
|
|
113
|
+
Default weights: `blame=0.5, commit=0.5`
|
|
141
114
|
|
|
142
115
|
Key features:
|
|
143
116
|
- **Sigmoid normalization** prevents a single large commit from dominating
|
|
144
117
|
- **Recency decay** (half-life: 180 days) models knowledge fading over time
|
|
145
|
-
- **Scope factor** discounts reviews on huge PRs (attention dilution)
|
|
146
118
|
|
|
147
119
|
```bash
|
|
148
120
|
gitfamiliar --mode weighted
|
|
149
|
-
gitfamiliar --mode weighted --weights "0.6,0.
|
|
121
|
+
gitfamiliar --mode weighted --weights "0.6,0.4" # custom weights
|
|
150
122
|
```
|
|
151
123
|
|
|
152
124
|
<details>
|
|
@@ -162,31 +134,65 @@ commit_score:
|
|
|
162
134
|
commit 2 (45 days ago, +5/-2): sigmoid(6/200) x decay(45d) = 0.09 x 0.84
|
|
163
135
|
total: min(1, 0.39) = 0.39
|
|
164
136
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
familiarity = 0.5 x 0.15 + 0.35 x 0.39 + 0.15 x 0.28
|
|
169
|
-
= 0.075 + 0.137 + 0.042
|
|
170
|
-
= 0.254 -> 25%
|
|
137
|
+
familiarity = 0.5 x 0.15 + 0.5 x 0.39
|
|
138
|
+
= 0.075 + 0.195
|
|
139
|
+
= 0.27 -> 27%
|
|
171
140
|
```
|
|
172
141
|
|
|
173
142
|
</details>
|
|
174
143
|
|
|
175
144
|
> Best for: **Power users** who want the most accurate picture.
|
|
176
|
-
|
|
145
|
+
|
|
146
|
+
## Team Features
|
|
147
|
+
|
|
148
|
+
### Multi-User Comparison
|
|
149
|
+
|
|
150
|
+
Compare familiarity across multiple team members:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
gitfamiliar --user "Alice" --user "Bob" # specific users
|
|
154
|
+
gitfamiliar --team # all contributors
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Team Coverage Map
|
|
158
|
+
|
|
159
|
+
Visualize bus factor — how many people know each part of the codebase:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
gitfamiliar --team-coverage
|
|
163
|
+
gitfamiliar --team-coverage --html
|
|
164
|
+
```
|
|
165
|
+
|
|
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
|
|
170
|
+
|
|
171
|
+
### Hotspot Analysis
|
|
172
|
+
|
|
173
|
+
Find files that are frequently changed but poorly understood:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
gitfamiliar --hotspot # personal hotspots
|
|
177
|
+
gitfamiliar --hotspot team # team hotspots
|
|
178
|
+
gitfamiliar --hotspot --window 30 # last 30 days only
|
|
179
|
+
gitfamiliar --hotspot --html # scatter plot visualization
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Risk = high change frequency x low familiarity.
|
|
177
183
|
|
|
178
184
|
## Expiration Policies
|
|
179
185
|
|
|
180
|
-
By default, "
|
|
186
|
+
By default, "written" status never expires. But real knowledge fades. Configure expiration to keep scores honest:
|
|
181
187
|
|
|
182
188
|
| Policy | Flag | What happens |
|
|
183
189
|
|---|---|---|
|
|
184
|
-
| Never | `--expiration never` | Once
|
|
190
|
+
| Never | `--expiration never` | Once written, always counted (default) |
|
|
185
191
|
| Time-based | `--expiration time:180d` | Expires 180 days after your last touch |
|
|
186
192
|
| Change-based | `--expiration change:50%` | Expires if 50%+ of the file changed since you last touched it |
|
|
187
193
|
| Combined | `--expiration combined:365d:50%` | Expires if **either** condition is met |
|
|
188
194
|
|
|
189
|
-
The change-based policy is the smartest: it detects when the code you
|
|
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.
|
|
190
196
|
|
|
191
197
|
## File Filtering
|
|
192
198
|
|
|
@@ -210,20 +216,6 @@ third_party/
|
|
|
210
216
|
**/migrations/
|
|
211
217
|
```
|
|
212
218
|
|
|
213
|
-
## GitHub Integration
|
|
214
|
-
|
|
215
|
-
For review-related features (Review Coverage mode, reviewed files in Binary mode), GitFamiliar needs a GitHub token:
|
|
216
|
-
|
|
217
|
-
```bash
|
|
218
|
-
# Option 1: environment variable
|
|
219
|
-
export GITHUB_TOKEN=ghp_xxxxxxxxxxxxx
|
|
220
|
-
|
|
221
|
-
# Option 2: GitHub CLI (auto-detected if installed)
|
|
222
|
-
gh auth login
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
Without a token, GitFamiliar works perfectly for all non-review features. Review features degrade gracefully with a helpful message.
|
|
226
|
-
|
|
227
219
|
## CLI Reference
|
|
228
220
|
|
|
229
221
|
```
|
|
@@ -231,15 +223,18 @@ Usage: gitfamiliar [options]
|
|
|
231
223
|
|
|
232
224
|
Options:
|
|
233
225
|
-m, --mode <mode> Scoring mode (default: "binary")
|
|
234
|
-
Choices: binary, authorship,
|
|
235
|
-
-u, --user <user> Git user name or email (
|
|
236
|
-
|
|
237
|
-
Choices: all, written, reviewed
|
|
226
|
+
Choices: binary, authorship, weighted
|
|
227
|
+
-u, --user <user> Git user name or email (repeatable for comparison)
|
|
228
|
+
Default: git config user.name
|
|
238
229
|
-e, --expiration <policy> Expiration policy (default: "never")
|
|
239
230
|
Examples: time:180d, change:50%, combined:365d:50%
|
|
240
231
|
--html Generate interactive HTML treemap report
|
|
241
|
-
-w, --weights <weights> Weights for weighted mode: blame,commit
|
|
242
|
-
Example: "0.
|
|
232
|
+
-w, --weights <weights> Weights for weighted mode: blame,commit
|
|
233
|
+
Example: "0.6,0.4" (must sum to 1.0)
|
|
234
|
+
--team Compare all contributors
|
|
235
|
+
--team-coverage Show team coverage map (bus factor analysis)
|
|
236
|
+
--hotspot [mode] Hotspot analysis: personal (default) or team
|
|
237
|
+
--window <days> Time window for hotspot analysis (default: 90)
|
|
243
238
|
-V, --version Output version number
|
|
244
239
|
-h, --help Display help
|
|
245
240
|
```
|
|
@@ -253,9 +248,8 @@ import { computeFamiliarity } from 'gitfamiliar';
|
|
|
253
248
|
|
|
254
249
|
const result = await computeFamiliarity({
|
|
255
250
|
mode: 'binary',
|
|
256
|
-
filter: 'all',
|
|
257
251
|
expiration: { policy: 'never' },
|
|
258
|
-
weights: { blame: 0.5, commit: 0.
|
|
252
|
+
weights: { blame: 0.5, commit: 0.5 },
|
|
259
253
|
html: false,
|
|
260
254
|
repoPath: '/path/to/repo',
|
|
261
255
|
});
|
|
@@ -267,7 +261,6 @@ console.log(`Score: ${Math.round(result.tree.score * 100)}%`);
|
|
|
267
261
|
|
|
268
262
|
- **Node.js** >= 18
|
|
269
263
|
- **Git** (available in PATH)
|
|
270
|
-
- **GitHub token** (optional, for review features)
|
|
271
264
|
|
|
272
265
|
## Contributing
|
|
273
266
|
|
|
@@ -284,8 +277,6 @@ npm test
|
|
|
284
277
|
## Roadmap
|
|
285
278
|
|
|
286
279
|
- [ ] **Dependency Awareness** - Factor in understanding of imported files
|
|
287
|
-
- [ ] **Churn Risk Alert** - Highlight files with high change frequency + low familiarity
|
|
288
|
-
- [ ] **GitHub Action** - Post familiarity reports as PR comments
|
|
289
280
|
- [ ] **VS Code Extension** - See familiarity scores inline in the editor
|
|
290
281
|
- [ ] **README Badge** - Codecov-style badge for your project README
|
|
291
282
|
|