repo-dive 0.4.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.md ADDED
@@ -0,0 +1,28 @@
1
+ # BSD 3-Clause License
2
+
3
+ Copyright © 2026-present Alexander Kachkaev
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ - Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ - Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ - Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,101 @@
1
+ # repo-dive
2
+
3
+ Dive into a git repository's history: per-commit snapshots, an indexed metrics catalog and an interactive dashboard.
4
+
5
+ > **Still 0.x.** The pipeline works end to end and has been run against repositories with tens of thousands of commits, but interfaces, the catalog format and the collector roster still move between minor versions — pin the version if you script against it. Renamed from `repo-insighter` in 0.4.0.
6
+
7
+ ## What it does
8
+
9
+ Point it at any git repository and get an explorable catalog of insights derived from its history:
10
+
11
+ ```sh
12
+ cd /path/to/your/repo
13
+ npx repo-dive
14
+ ```
15
+
16
+ One command runs the whole pipeline — scan, index, dashboard — and opens the results in your browser.
17
+
18
+ - **Map**: walk the repo's commits (all or sampled) and let pluggable collectors capture raw snapshots per commit — language/LOC breakdowns, author stats, lint diagnostics and more.
19
+ - **Reduce**: index those snapshots into a local metrics store shaped like a data cube — numbers at intersections of open-ended categories (author, language, date, lint rule, …).
20
+ - **Explore**: query the cube to draw charts, build presentations and ask AI questions about how the codebase evolved.
21
+
22
+ Everything is local-first, incremental and resumable: results live in a catalog folder inside the repo being analyzed and are refined over multiple runs.
23
+
24
+ See [docs/specs](docs/specs/README.md) for the architecture and [docs/research/prior-art.md](docs/research/prior-art.md) for a survey of existing tools and why none of them fills this niche.
25
+
26
+ ## Usage
27
+
28
+ Run from inside the repository you want to analyze (or pass `--repo /path/to/repo`):
29
+
30
+ ```sh
31
+ cd /path/to/your/repo
32
+ npx repo-dive # the whole pipeline: scan + index + dashboard
33
+ npx repo-dive scan # collect snapshots into .repo-dive/
34
+ npx repo-dive index # roll up into the metrics cube + dashboard data
35
+ npx repo-dive dashboard # serve the interactive dashboard
36
+ npx repo-dive status # show catalog coverage
37
+ npx repo-dive collectors # list available collectors
38
+ npx repo-dive report # export one shareable self-contained HTML file
39
+ npx repo-dive query "SELECT metric, sum(value) FROM facts GROUP BY metric"
40
+ npx repo-dive mcp # serve the cube to AI agents (Model Context Protocol)
41
+ npx repo-dive gc # clean up the catalog interactively
42
+ ```
43
+
44
+ `scan` walks the repository's history and runs collectors against every commit (or a sample, per collector), writing raw snapshots into a `.repo-dive/` catalog inside the analyzed repo. It is resumable: re-running skips everything already collected, and bumping a collector's version invalidates only that collector's outputs. Checkout-based collectors use temporary detached worktrees — the analyzed repo's working tree is never touched. Collectors so far:
45
+
46
+ - **commit-meta** — identities, dates, parents, subject and trailers (incl. AI co-authors)
47
+ - **churn** — lines added/deleted per commit, by file extension
48
+ - **file-types** — file count and bytes per extension at each commit's tree
49
+ - **directives** — eslint-disable comments by rule (block disables tracked as gray areas) and `@ts-ignore`/`@ts-expect-error`/`@ts-nocheck`
50
+ - **dependencies** — total resolved packages and direct/dev dependencies from package-manager lockfiles, per package manager (pnpm so far; version-aware and monorepo-aware)
51
+ - **todo-comments** — TODO/FIXME/HACK/XXX counts
52
+ - **languages** — tokei language/LOC breakdown (sampled monthly; markdown counted whole)
53
+ - **survival** — `git blame` line survival by extension, author and age cohort (sampled monthly)
54
+
55
+ `index` normalizes raw snapshots into `.repo-dive/index/metrics.sqlite` (a facts-by-categories cube, rebuildable at any time) plus `dashboard.json`, and `dashboard` serves a local React app with interactive charts: languages over time, monthly commits with AI-assisted share, churn, lint-suppression trends, dependency counts over time, code survival by cohort and author, and more.
56
+
57
+ ## Configuration
58
+
59
+ Everything works with zero config. To refine it, drop a `repo-dive.config.ts` at the root of the repository you analyze (`.mjs`/`.js` also work):
60
+
61
+ ```ts
62
+ import { defineConfig } from "repo-dive/config";
63
+
64
+ export default defineConfig({
65
+ contributors: {
66
+ aliases: [
67
+ // Shorthand: emails only, the first is canonical.
68
+ ["alice@work.example", "alice@personal.example"],
69
+ // Rich form: a display name, a profile link and an explicit kind.
70
+ {
71
+ emails: ["bob@work.example", "12345+bob@users.noreply.github.com"],
72
+ displayName: "Bob",
73
+ url: "https://github.com/bob",
74
+ },
75
+ ],
76
+ // How many contributors charts keep before folding the rest into "Other" (default 10).
77
+ maxInCharts: 10,
78
+ },
79
+ });
80
+ ```
81
+
82
+ `contributors.aliases` merges the multiple identities one person commits under (work + personal email, GitHub noreply, name variants) so attribution, the contributors table and code-survival-by-contributor count them once; a group can also carry a `displayName`, a profile `url` and a `kind` (`human`/`bot`/`ai`, otherwise auto-derived — the dashboard badges bots and AI agents and lists them apart from humans). The config is read by `index`. See [docs/specs/07-config.md](docs/specs/07-config.md) for details.
83
+
84
+ ## Development
85
+
86
+ The project is written in TypeScript with [Effect](https://effect.website) v4 (beta) and its built-in CLI toolkit (`effect/unstable/cli`).
87
+
88
+ ```sh
89
+ pnpm install
90
+ pnpm test
91
+ pnpm lint
92
+ pnpm fix
93
+ ```
94
+
95
+ ## Acknowledgements
96
+
97
+ Thanks to [@WillJack20](https://github.com/WillJack20) for suggesting the name **repo-dive**.
98
+
99
+ ## License
100
+
101
+ [BSD 3-Clause](LICENSE.md)