@m2015agg/git-skill 0.1.2 → 0.1.3
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 +120 -0
- package/dist/commands/embed.js +10 -17
- package/dist/commands/embed.js.map +1 -1
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# @m2015agg/git-skill
|
|
2
|
+
|
|
3
|
+
Git history intelligence for LLMs. Gives AI agents institutional memory over a codebase's evolution, decisions, and health trends.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @m2015agg/git-skill
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
If `git-skill` is not found after install, run `hash -r` to refresh your shell's command cache.
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
cd your-project
|
|
17
|
+
git-skill init # Install hook, index history, set up CLAUDE.md
|
|
18
|
+
git-skill doctor # Verify setup
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Embeddings (Optional)
|
|
22
|
+
|
|
23
|
+
For semantic search, configure an embedding provider. Works with any OpenAI-compatible endpoint (OpenAI, Ollama, LMStudio).
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
git-skill install # Configure embedding provider
|
|
27
|
+
git-skill embed # Generate embeddings for all commits
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Or manually edit `~/.config/git-skill/config.json`:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"embedding": {
|
|
35
|
+
"enabled": true,
|
|
36
|
+
"provider": "ollama",
|
|
37
|
+
"model": "mxbai-embed-large",
|
|
38
|
+
"url": "http://localhost:11434/api/embed",
|
|
39
|
+
"apiKey": "",
|
|
40
|
+
"dimensions": 1024
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Commands
|
|
46
|
+
|
|
47
|
+
### Query (read-only, pre-approved for Claude Code)
|
|
48
|
+
|
|
49
|
+
| Command | Description |
|
|
50
|
+
|---------|-------------|
|
|
51
|
+
| `git-skill search <query>` | Search commit history (BM25 + vector) |
|
|
52
|
+
| `git-skill timeline <path>` | File/directory evolution |
|
|
53
|
+
| `git-skill blame <path>` | Enhanced blame with enrichments |
|
|
54
|
+
| `git-skill trends` | Metric trends dashboard |
|
|
55
|
+
| `git-skill hotspots` | Files with most churn |
|
|
56
|
+
| `git-skill coupling <path>` | Co-changed file analysis |
|
|
57
|
+
| `git-skill decisions` | Major decision points (reverts, refactors) |
|
|
58
|
+
| `git-skill experts <path>` | Who has most context |
|
|
59
|
+
| `git-skill diff-summary <range>` | Range summary (e.g., `v1.0..v1.1`) |
|
|
60
|
+
| `git-skill why <hash>` | Commit intent/reasoning |
|
|
61
|
+
| `git-skill regression` | Change-point detection |
|
|
62
|
+
| `git-skill doctor` | Health check |
|
|
63
|
+
|
|
64
|
+
### Write (require confirmation)
|
|
65
|
+
|
|
66
|
+
| Command | Description |
|
|
67
|
+
|---------|-------------|
|
|
68
|
+
| `git-skill snapshot` | Full re-index of git history |
|
|
69
|
+
| `git-skill embed` | Generate/refresh embeddings |
|
|
70
|
+
| `git-skill enrich [range]` | Backfill LLM enrichments |
|
|
71
|
+
| `git-skill release-notes <range>` | Generate release notes |
|
|
72
|
+
| `git-skill metric record <name> <value>` | Record a custom metric |
|
|
73
|
+
|
|
74
|
+
### Setup
|
|
75
|
+
|
|
76
|
+
| Command | Description |
|
|
77
|
+
|---------|-------------|
|
|
78
|
+
| `git-skill install` | Global setup (embedding config, CLAUDE.md) |
|
|
79
|
+
| `git-skill init` | Per-project setup (hook, snapshot, permissions) |
|
|
80
|
+
| `git-skill approve` | Pre-approve read commands in Claude Code |
|
|
81
|
+
| `git-skill docs` | Output CLAUDE.md snippet |
|
|
82
|
+
| `git-skill cron` | Nightly snapshot automation |
|
|
83
|
+
| `git-skill update` | Self-update |
|
|
84
|
+
| `git-skill uninstall` | Clean removal |
|
|
85
|
+
|
|
86
|
+
### Global Flags
|
|
87
|
+
|
|
88
|
+
- `--json` — Structured output for agents
|
|
89
|
+
- `--limit N` — Cap results
|
|
90
|
+
- `--since <date>` / `--until <date>` — Time filter
|
|
91
|
+
|
|
92
|
+
## How It Works
|
|
93
|
+
|
|
94
|
+
Three-layer SQLite cache at `.git-history/history.db`:
|
|
95
|
+
|
|
96
|
+
1. **Raw git data** — commits, files, branches, tags (captured by post-commit hook + snapshot)
|
|
97
|
+
2. **Derived analytics** — file evolution, churn hotspots, coupling, decision points, author expertise, trends
|
|
98
|
+
3. **LLM enrichments** — intent, reasoning, category per commit (optional, via `enrich`)
|
|
99
|
+
|
|
100
|
+
Search uses BM25 (FTS5) by default. Optional vector search via any OpenAI-compatible embedding endpoint.
|
|
101
|
+
|
|
102
|
+
## Built-in Metrics
|
|
103
|
+
|
|
104
|
+
Automatically tracked per commit:
|
|
105
|
+
|
|
106
|
+
- **Revert rate** — how often commits get reverted
|
|
107
|
+
- **Fix-on-fix rate** — commits fixing previous commit's bug
|
|
108
|
+
- **Scope creep** — files per commit trending up
|
|
109
|
+
- **Time-to-commit** — time between commits
|
|
110
|
+
- **Same-file churn** — same file 3+ times in recent commits (thrashing)
|
|
111
|
+
|
|
112
|
+
## Part of the CLI Skills Ecosystem
|
|
113
|
+
|
|
114
|
+
- [`@m2015agg/supabase-skill`](https://github.com/m2015agg/supabase-skill) — Database schema intelligence
|
|
115
|
+
- [`@m2015agg/context7-skill`](https://github.com/m2015agg/context7-skill) — Library docs cache
|
|
116
|
+
- `@m2015agg/git-skill` — Git history intelligence
|
|
117
|
+
|
|
118
|
+
## License
|
|
119
|
+
|
|
120
|
+
MIT
|
package/dist/commands/embed.js
CHANGED
|
@@ -6,7 +6,7 @@ import { generateEmbedding } from "../util/embedding.js";
|
|
|
6
6
|
export function embedCommand() {
|
|
7
7
|
return new Command("embed")
|
|
8
8
|
.description("Generate/refresh embeddings for commit messages")
|
|
9
|
-
.option("--limit <n>", "Max commits to embed
|
|
9
|
+
.option("--limit <n>", "Max commits to embed (default: all)")
|
|
10
10
|
.option("--force", "Re-embed commits that already have embeddings")
|
|
11
11
|
.action(async (opts) => {
|
|
12
12
|
const config = readConfig();
|
|
@@ -21,26 +21,19 @@ export function embedCommand() {
|
|
|
21
21
|
}
|
|
22
22
|
const db = openDb(historyDir);
|
|
23
23
|
try {
|
|
24
|
-
const limit = parseInt(opts.limit, 10)
|
|
25
|
-
let
|
|
24
|
+
const limit = opts.limit ? parseInt(opts.limit, 10) : 0;
|
|
25
|
+
let query;
|
|
26
26
|
if (opts.force) {
|
|
27
|
-
|
|
28
|
-
.prepare("SELECT hash, message FROM commits ORDER BY timestamp DESC LIMIT ?")
|
|
29
|
-
.all(limit);
|
|
27
|
+
query = "SELECT hash, message FROM commits ORDER BY timestamp DESC";
|
|
30
28
|
}
|
|
31
29
|
else {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
SELECT c.hash, c.message
|
|
36
|
-
FROM commits c
|
|
37
|
-
LEFT JOIN embeddings e ON c.hash = e.commit_hash
|
|
38
|
-
WHERE e.commit_hash IS NULL
|
|
39
|
-
ORDER BY c.timestamp DESC
|
|
40
|
-
LIMIT ?
|
|
41
|
-
`)
|
|
42
|
-
.all(limit);
|
|
30
|
+
query = `SELECT c.hash, c.message FROM commits c
|
|
31
|
+
LEFT JOIN embeddings e ON c.hash = e.commit_hash
|
|
32
|
+
WHERE e.commit_hash IS NULL ORDER BY c.timestamp DESC`;
|
|
43
33
|
}
|
|
34
|
+
if (limit > 0)
|
|
35
|
+
query += ` LIMIT ${limit}`;
|
|
36
|
+
const commits = db.prepare(query).all();
|
|
44
37
|
if (commits.length === 0) {
|
|
45
38
|
process.stdout.write("No commits to embed.\n");
|
|
46
39
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed.js","sourceRoot":"","sources":["../../src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