@m2015agg/git-skill 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/dist/commands/approve.d.ts +2 -0
- package/dist/commands/approve.js +56 -0
- package/dist/commands/approve.js.map +1 -0
- package/dist/commands/blame.d.ts +2 -0
- package/dist/commands/blame.js +139 -0
- package/dist/commands/blame.js.map +1 -0
- package/dist/commands/capture.d.ts +2 -0
- package/dist/commands/capture.js +68 -0
- package/dist/commands/capture.js.map +1 -0
- package/dist/commands/coupling.d.ts +2 -0
- package/dist/commands/coupling.js +48 -0
- package/dist/commands/coupling.js.map +1 -0
- package/dist/commands/cron.d.ts +2 -0
- package/dist/commands/cron.js +70 -0
- package/dist/commands/cron.js.map +1 -0
- package/dist/commands/decisions.d.ts +2 -0
- package/dist/commands/decisions.js +62 -0
- package/dist/commands/decisions.js.map +1 -0
- package/dist/commands/diff-summary.d.ts +2 -0
- package/dist/commands/diff-summary.js +151 -0
- package/dist/commands/diff-summary.js.map +1 -0
- package/dist/commands/docs.d.ts +3 -0
- package/dist/commands/docs.js +38 -0
- package/dist/commands/docs.js.map +1 -0
- package/dist/commands/doctor.d.ts +2 -0
- package/dist/commands/doctor.js +60 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/embed.d.ts +2 -0
- package/dist/commands/embed.js +81 -0
- package/dist/commands/embed.js.map +1 -0
- package/dist/commands/enrich.d.ts +2 -0
- package/dist/commands/enrich.js +148 -0
- package/dist/commands/enrich.js.map +1 -0
- package/dist/commands/experts.d.ts +2 -0
- package/dist/commands/experts.js +55 -0
- package/dist/commands/experts.js.map +1 -0
- package/dist/commands/hotspots.d.ts +2 -0
- package/dist/commands/hotspots.js +46 -0
- package/dist/commands/hotspots.js.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.js +91 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/install.d.ts +2 -0
- package/dist/commands/install.js +59 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/metric.d.ts +2 -0
- package/dist/commands/metric.js +26 -0
- package/dist/commands/metric.js.map +1 -0
- package/dist/commands/regression.d.ts +2 -0
- package/dist/commands/regression.js +166 -0
- package/dist/commands/regression.js.map +1 -0
- package/dist/commands/release-notes.d.ts +2 -0
- package/dist/commands/release-notes.js +244 -0
- package/dist/commands/release-notes.js.map +1 -0
- package/dist/commands/search.d.ts +2 -0
- package/dist/commands/search.js +93 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/commands/snapshot.d.ts +6 -0
- package/dist/commands/snapshot.js +154 -0
- package/dist/commands/snapshot.js.map +1 -0
- package/dist/commands/timeline.d.ts +2 -0
- package/dist/commands/timeline.js +78 -0
- package/dist/commands/timeline.js.map +1 -0
- package/dist/commands/trends.d.ts +2 -0
- package/dist/commands/trends.js +92 -0
- package/dist/commands/trends.js.map +1 -0
- package/dist/commands/uninstall.d.ts +2 -0
- package/dist/commands/uninstall.js +79 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/commands/update.d.ts +2 -0
- package/dist/commands/update.js +59 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/why.d.ts +2 -0
- package/dist/commands/why.js +111 -0
- package/dist/commands/why.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +65 -0
- package/dist/index.js.map +1 -0
- package/dist/templates/walkthrough.d.ts +1 -0
- package/dist/templates/walkthrough.js +13 -0
- package/dist/templates/walkthrough.js.map +1 -0
- package/dist/util/analytics.d.ts +32 -0
- package/dist/util/analytics.js +308 -0
- package/dist/util/analytics.js.map +1 -0
- package/dist/util/claude-md.d.ts +2 -0
- package/dist/util/claude-md.js +41 -0
- package/dist/util/claude-md.js.map +1 -0
- package/dist/util/config.d.ts +21 -0
- package/dist/util/config.js +26 -0
- package/dist/util/config.js.map +1 -0
- package/dist/util/db.d.ts +3 -0
- package/dist/util/db.js +183 -0
- package/dist/util/db.js.map +1 -0
- package/dist/util/detect.d.ts +2 -0
- package/dist/util/detect.js +14 -0
- package/dist/util/detect.js.map +1 -0
- package/dist/util/embedding.d.ts +6 -0
- package/dist/util/embedding.js +48 -0
- package/dist/util/embedding.js.map +1 -0
- package/dist/util/git.d.ts +45 -0
- package/dist/util/git.js +191 -0
- package/dist/util/git.js.map +1 -0
- package/dist/util/hooks.d.ts +3 -0
- package/dist/util/hooks.js +43 -0
- package/dist/util/hooks.js.map +1 -0
- package/dist/util/metrics.d.ts +2 -0
- package/dist/util/metrics.js +42 -0
- package/dist/util/metrics.js.map +1 -0
- package/dist/util/search-hybrid.d.ts +10 -0
- package/dist/util/search-hybrid.js +33 -0
- package/dist/util/search-hybrid.js.map +1 -0
- package/package.json +35 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { openDb } from "../util/db.js";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
export function trendsCommand() {
|
|
5
|
+
return new Command("trends")
|
|
6
|
+
.description("Metric trends dashboard")
|
|
7
|
+
.option("--period <period>", "Filter by period")
|
|
8
|
+
.option("--metric <name>", "Filter by metric name")
|
|
9
|
+
.option("--json", "Output as JSON")
|
|
10
|
+
.action((opts) => {
|
|
11
|
+
const historyDir = join(process.cwd(), ".git-history");
|
|
12
|
+
const db = openDb(historyDir);
|
|
13
|
+
try {
|
|
14
|
+
const whereClauses = [];
|
|
15
|
+
const params = [];
|
|
16
|
+
if (opts.period) {
|
|
17
|
+
whereClauses.push("period = ?");
|
|
18
|
+
params.push(opts.period);
|
|
19
|
+
}
|
|
20
|
+
if (opts.metric) {
|
|
21
|
+
whereClauses.push("metric_name = ?");
|
|
22
|
+
params.push(opts.metric);
|
|
23
|
+
}
|
|
24
|
+
const whereStr = whereClauses.length > 0 ? `WHERE ${whereClauses.join(" AND ")}` : "";
|
|
25
|
+
// Get all rows ordered by metric + period
|
|
26
|
+
const allRows = db
|
|
27
|
+
.prepare(`SELECT metric_name, period, value, delta, direction
|
|
28
|
+
FROM trends
|
|
29
|
+
${whereStr}
|
|
30
|
+
ORDER BY metric_name ASC, period DESC`)
|
|
31
|
+
.all(...params);
|
|
32
|
+
if (opts.json) {
|
|
33
|
+
process.stdout.write(JSON.stringify(allRows, null, 2) + "\n");
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (allRows.length === 0) {
|
|
37
|
+
process.stdout.write("No trend data found. Run `git-skill snapshot` first.\n");
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
// Build display: latest period vs previous per metric
|
|
41
|
+
const metricMap = new Map();
|
|
42
|
+
for (const row of allRows) {
|
|
43
|
+
if (!metricMap.has(row.metric_name))
|
|
44
|
+
metricMap.set(row.metric_name, []);
|
|
45
|
+
metricMap.get(row.metric_name).push(row);
|
|
46
|
+
}
|
|
47
|
+
const display = [];
|
|
48
|
+
for (const [metric, rows] of metricMap) {
|
|
49
|
+
// rows are already sorted DESC by period
|
|
50
|
+
const latest = rows[0];
|
|
51
|
+
const prev = rows[1] ?? null;
|
|
52
|
+
let dir = latest.direction ?? "→";
|
|
53
|
+
if (!latest.direction) {
|
|
54
|
+
if (prev) {
|
|
55
|
+
if (latest.value > prev.value)
|
|
56
|
+
dir = "↑";
|
|
57
|
+
else if (latest.value < prev.value)
|
|
58
|
+
dir = "↓";
|
|
59
|
+
else
|
|
60
|
+
dir = "→";
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
dir = "→";
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
display.push({
|
|
67
|
+
metric,
|
|
68
|
+
this_period: latest.period,
|
|
69
|
+
this_value: latest.value,
|
|
70
|
+
last_period: prev?.period ?? null,
|
|
71
|
+
last_value: prev?.value ?? null,
|
|
72
|
+
direction: dir,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
// Table header
|
|
76
|
+
const metricWidth = Math.max(...display.map((d) => d.metric.length), 12);
|
|
77
|
+
const periodWidth = Math.max(...display.map((d) => d.this_period.length), 10);
|
|
78
|
+
process.stdout.write(`${"Metric".padEnd(metricWidth)} ${"This Period".padStart(periodWidth)} ${"Value".padStart(10)} ${"Last Period".padStart(periodWidth)} ${"Last Value".padStart(10)} Dir\n`);
|
|
79
|
+
process.stdout.write(`${"─".repeat(metricWidth + periodWidth * 2 + 36)}\n`);
|
|
80
|
+
for (const row of display) {
|
|
81
|
+
const thisVal = row.this_value.toFixed(3);
|
|
82
|
+
const lastVal = row.last_value !== null ? row.last_value.toFixed(3) : "—";
|
|
83
|
+
const lastPeriod = row.last_period ?? "—";
|
|
84
|
+
process.stdout.write(`${row.metric.padEnd(metricWidth)} ${row.this_period.padStart(periodWidth)} ${thisVal.padStart(10)} ${lastPeriod.padStart(periodWidth)} ${lastVal.padStart(10)} ${row.direction}\n`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
finally {
|
|
88
|
+
db.close();
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=trends.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trends.js","sourceRoot":"","sources":["../../src/commands/trends.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAmB5B,MAAM,UAAU,aAAa;IAC3B,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC;SACzB,WAAW,CAAC,yBAAyB,CAAC;SACtC,MAAM,CAAC,mBAAmB,EAAE,kBAAkB,CAAC;SAC/C,MAAM,CAAC,iBAAiB,EAAE,uBAAuB,CAAC;SAClD,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,CAAC,IAA0D,EAAE,EAAE;QACrE,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC;Q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EAAE,CAAC,KAAK,UAAU,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,GAAG,CAAC,SAAS,IAAI,CACzL,CAAC;YACJ,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,EAAE,CAAC,KAAK,EAAE,CAAC;QACb,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { join } from "path";
|
|
3
|
+
import { existsSync, rmSync } from "fs";
|
|
4
|
+
import { homedir } from "os";
|
|
5
|
+
import { isGitRepo } from "../util/git.js";
|
|
6
|
+
import { removeHook } from "../util/hooks.js";
|
|
7
|
+
import { removeSection } from "../util/claude-md.js";
|
|
8
|
+
import { execSync, spawnSync } from "child_process";
|
|
9
|
+
function write(msg) { process.stdout.write(msg); }
|
|
10
|
+
const CRON_MARKER = "# git-skill";
|
|
11
|
+
function removeCronEntries() {
|
|
12
|
+
try {
|
|
13
|
+
const crontab = execSync("crontab -l", { encoding: "utf-8", stdio: ["pipe", "pipe", "ignore"] });
|
|
14
|
+
if (!crontab.includes(CRON_MARKER))
|
|
15
|
+
return "not_found";
|
|
16
|
+
const filtered = crontab.split("\n").filter(l => !l.includes(CRON_MARKER)).join("\n");
|
|
17
|
+
spawnSync("crontab", ["-"], { input: filtered, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
|
|
18
|
+
return "removed";
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return "not_found";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export function uninstallCommand() {
|
|
25
|
+
return new Command("uninstall")
|
|
26
|
+
.description("Remove git-skill from current repository and clean up system entries")
|
|
27
|
+
.option("--global", "Also remove global ~/.claude/CLAUDE.md section and config")
|
|
28
|
+
.action((opts) => {
|
|
29
|
+
const cwd = process.cwd();
|
|
30
|
+
write("Uninstalling git-skill...\n\n");
|
|
31
|
+
// 1. Remove hook
|
|
32
|
+
write("1. Removing post-commit hook...\n");
|
|
33
|
+
if (isGitRepo(cwd)) {
|
|
34
|
+
const hookResult = removeHook(join(cwd, ".git"));
|
|
35
|
+
write(` Hook: ${hookResult}\n`);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
write(" Not a git repo — skipping hook removal.\n");
|
|
39
|
+
}
|
|
40
|
+
// 2. Remove .git-history/
|
|
41
|
+
write("2. Removing .git-history/ directory...\n");
|
|
42
|
+
const historyDir = join(cwd, ".git-history");
|
|
43
|
+
if (existsSync(historyDir)) {
|
|
44
|
+
rmSync(historyDir, { recursive: true, force: true });
|
|
45
|
+
write(" Removed .git-history/\n");
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
write(" .git-history/ not found — skipping.\n");
|
|
49
|
+
}
|
|
50
|
+
// 3. Remove local CLAUDE.md section
|
|
51
|
+
write("3. Removing local .claude/CLAUDE.md section...\n");
|
|
52
|
+
const localClaudeMd = join(cwd, ".claude", "CLAUDE.md");
|
|
53
|
+
const localResult = removeSection(localClaudeMd);
|
|
54
|
+
write(` Local CLAUDE.md: ${localResult}\n`);
|
|
55
|
+
// 4. Remove cron entry
|
|
56
|
+
write("4. Removing cron entry...\n");
|
|
57
|
+
const cronResult = removeCronEntries();
|
|
58
|
+
write(` Cron: ${cronResult}\n`);
|
|
59
|
+
// 5. Global cleanup (opt-in)
|
|
60
|
+
if (opts.global) {
|
|
61
|
+
write("5. Removing global ~/.claude/CLAUDE.md section...\n");
|
|
62
|
+
const globalClaudeMd = join(homedir(), ".claude", "CLAUDE.md");
|
|
63
|
+
const globalResult = removeSection(globalClaudeMd);
|
|
64
|
+
write(` Global CLAUDE.md: ${globalResult}\n`);
|
|
65
|
+
write("6. Removing global config ~/.config/git-skill/...\n");
|
|
66
|
+
const configDir = join(homedir(), ".config", "git-skill");
|
|
67
|
+
if (existsSync(configDir)) {
|
|
68
|
+
rmSync(configDir, { recursive: true, force: true });
|
|
69
|
+
write(" Removed ~/.config/git-skill/\n");
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
write(" Config dir not found — skipping.\n");
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
write("\ngit-skill uninstalled.\n");
|
|
76
|
+
write("To remove the CLI itself: npm uninstall -g @m2015agg/git-skill\n");
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=uninstall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../src/commands/uninstall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEpD,SAAS,KAAK,CAAC,GAAW,IAAU,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAEhE,MAAM,WAAW,GAAG,aAAa,CAAC;AAElC,SAAS,iBAAiB;IACxB,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,QAAQ,CAAC,YAAY,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;QACjG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;YAAE,OAAO,WAAW,CAAC;QACv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,uCAAuC,CAAC,CAAC;YACjD,CAAC;QACH,CAAC;QAED,KAAK,CAAC,4BAA4B,CAAC,CAAC;QACpC,KAAK,CAAC,kEAAkE,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { execSync } from "child_process";
|
|
3
|
+
import { createRequire } from "module";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
import { dirname, join } from "path";
|
|
6
|
+
function write(msg) { process.stdout.write(msg); }
|
|
7
|
+
const PACKAGE_NAME = "@m2015agg/git-skill";
|
|
8
|
+
function getCurrentVersion() {
|
|
9
|
+
try {
|
|
10
|
+
const require = createRequire(import.meta.url);
|
|
11
|
+
const pkgPath = join(dirname(fileURLToPath(import.meta.url)), "../../package.json");
|
|
12
|
+
const pkg = require(pkgPath);
|
|
13
|
+
return pkg.version ?? "unknown";
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return "unknown";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function getLatestVersion() {
|
|
20
|
+
try {
|
|
21
|
+
return execSync(`npm view ${PACKAGE_NAME} version`, { encoding: "utf-8" }).trim();
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return "unknown";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export function updateCommand() {
|
|
28
|
+
return new Command("update")
|
|
29
|
+
.description("Self-update git-skill to the latest version")
|
|
30
|
+
.option("--check", "Show current vs latest version without updating")
|
|
31
|
+
.action((opts) => {
|
|
32
|
+
const current = getCurrentVersion();
|
|
33
|
+
if (opts.check) {
|
|
34
|
+
write(`Current version: ${current}\n`);
|
|
35
|
+
write("Checking latest...\n");
|
|
36
|
+
const latest = getLatestVersion();
|
|
37
|
+
write(`Latest version: ${latest}\n`);
|
|
38
|
+
if (latest !== "unknown" && latest !== current) {
|
|
39
|
+
write(`\nUpdate available! Run: git-skill update\n`);
|
|
40
|
+
}
|
|
41
|
+
else if (latest === current) {
|
|
42
|
+
write("\nAlready up to date.\n");
|
|
43
|
+
}
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
write(`Current version: ${current}\n`);
|
|
47
|
+
write(`Updating ${PACKAGE_NAME} to latest...\n`);
|
|
48
|
+
try {
|
|
49
|
+
execSync(`npm install -g ${PACKAGE_NAME}@latest`, { stdio: "inherit" });
|
|
50
|
+
write("\nUpdate complete.\n");
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
write("\nError: Update failed. Try running manually:\n");
|
|
54
|
+
write(` npm install -g ${PACKAGE_NAME}@latest\n`);
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAErC,SAAS,KAAK,CAAC,GAAW,IAAU,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAEhE,MAAM,YAAY,GAAG,qBAAqB,CAAC;AAE3C,SAAS,iBAAiB;IACxB,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,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AI,CAAC;YACH,QAAQ,CAAC,kBAAkB,YAAY,SAAS,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;YACxE,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAChC,CAAC;QAAC,MAAM,CAAC;YACP,KAAK,CAAC,iDAAiD,CAAC,CAAC;YACzD,KAAK,CAAC,oBAAoB,YAAY,WAAW,CAAC,CAAC;YACnD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { join } from "path";
|
|
3
|
+
import { execSync } from "child_process";
|
|
4
|
+
import { openDb, hasDb } from "../util/db.js";
|
|
5
|
+
export function whyCommand() {
|
|
6
|
+
return new Command("why")
|
|
7
|
+
.description("Show intent/reasoning for a commit")
|
|
8
|
+
.argument("<hash>", "Commit hash (full or short)")
|
|
9
|
+
.option("--json", "Output as JSON")
|
|
10
|
+
.action((hash, opts) => {
|
|
11
|
+
const historyDir = join(process.cwd(), ".git-history");
|
|
12
|
+
if (!hasDb(historyDir)) {
|
|
13
|
+
process.stdout.write("No .git-history/ database found. Run `git-skill snapshot` first.\n");
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
// Resolve refs like HEAD, HEAD~1, branch names to actual hashes
|
|
17
|
+
let resolvedHash = hash;
|
|
18
|
+
if (!/^[a-f0-9]+$/.test(hash)) {
|
|
19
|
+
try {
|
|
20
|
+
resolvedHash = execSync(`git rev-parse ${hash}`, { cwd: process.cwd(), encoding: "utf-8" }).trim();
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
// Leave as-is, will fail lookup below
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const db = openDb(historyDir);
|
|
27
|
+
try {
|
|
28
|
+
// Support short hash lookup via LIKE
|
|
29
|
+
let commit;
|
|
30
|
+
if (resolvedHash.length === 40) {
|
|
31
|
+
commit = db
|
|
32
|
+
.prepare("SELECT * FROM commits WHERE hash = ?")
|
|
33
|
+
.get(resolvedHash);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
commit = db
|
|
37
|
+
.prepare("SELECT * FROM commits WHERE hash LIKE ?")
|
|
38
|
+
.get(`${resolvedHash}%`);
|
|
39
|
+
}
|
|
40
|
+
if (!commit) {
|
|
41
|
+
process.stdout.write(`No commit found for hash: ${hash}\n`);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
const enrichment = db
|
|
45
|
+
.prepare("SELECT * FROM enrichments WHERE commit_hash = ?")
|
|
46
|
+
.get(commit.hash);
|
|
47
|
+
const files = db
|
|
48
|
+
.prepare("SELECT file_path, status, insertions, deletions FROM commit_files WHERE commit_hash = ? LIMIT 20")
|
|
49
|
+
.all(commit.hash);
|
|
50
|
+
if (opts.json) {
|
|
51
|
+
process.stdout.write(JSON.stringify({
|
|
52
|
+
hash: commit.hash,
|
|
53
|
+
short_hash: commit.hash.slice(0, 7),
|
|
54
|
+
message: commit.message,
|
|
55
|
+
author: commit.author,
|
|
56
|
+
email: commit.email,
|
|
57
|
+
timestamp: commit.timestamp,
|
|
58
|
+
insertions: commit.insertions,
|
|
59
|
+
deletions: commit.deletions,
|
|
60
|
+
files_changed: commit.files_changed,
|
|
61
|
+
enrichment: enrichment ?? null,
|
|
62
|
+
files,
|
|
63
|
+
}, null, 2) + "\n");
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const shortHash = commit.hash.slice(0, 7);
|
|
67
|
+
const date = commit.timestamp.slice(0, 10);
|
|
68
|
+
process.stdout.write(`Commit ${shortHash}\n`);
|
|
69
|
+
process.stdout.write(`${"─".repeat(60)}\n`);
|
|
70
|
+
process.stdout.write(`Author: ${commit.author} <${commit.email}>\n`);
|
|
71
|
+
process.stdout.write(`Date: ${date}\n`);
|
|
72
|
+
process.stdout.write(`Message: ${commit.message}\n`);
|
|
73
|
+
process.stdout.write(`Changes: +${commit.insertions} -${commit.deletions} (${commit.files_changed} files)\n`);
|
|
74
|
+
if (enrichment) {
|
|
75
|
+
process.stdout.write(`\nEnrichment\n`);
|
|
76
|
+
process.stdout.write(`${"─".repeat(60)}\n`);
|
|
77
|
+
if (enrichment.category)
|
|
78
|
+
process.stdout.write(`Category: ${enrichment.category}\n`);
|
|
79
|
+
if (enrichment.intent)
|
|
80
|
+
process.stdout.write(`Intent: ${enrichment.intent}\n`);
|
|
81
|
+
if (enrichment.reasoning)
|
|
82
|
+
process.stdout.write(`Reasoning: ${enrichment.reasoning}\n`);
|
|
83
|
+
if (enrichment.alternatives_considered) {
|
|
84
|
+
process.stdout.write(`Alts: ${enrichment.alternatives_considered}\n`);
|
|
85
|
+
}
|
|
86
|
+
if (enrichment.session_context) {
|
|
87
|
+
process.stdout.write(`Context: ${enrichment.session_context}\n`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
process.stdout.write(`\nNo enrichment data. Run \`git-skill enrich\` to add LLM analysis.\n`);
|
|
92
|
+
}
|
|
93
|
+
if (files.length > 0) {
|
|
94
|
+
process.stdout.write(`\nFiles Changed\n`);
|
|
95
|
+
process.stdout.write(`${"─".repeat(60)}\n`);
|
|
96
|
+
for (const f of files) {
|
|
97
|
+
const stats = `+${f.insertions} -${f.deletions}`;
|
|
98
|
+
process.stdout.write(` [${f.status}] ${f.file_path} (${stats})\n`);
|
|
99
|
+
}
|
|
100
|
+
if (commit.files_changed > files.length) {
|
|
101
|
+
process.stdout.write(` ... and ${commit.files_changed - files.length} more files\n`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
process.stdout.write("\n");
|
|
105
|
+
}
|
|
106
|
+
finally {
|
|
107
|
+
db.close();
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=why.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,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C;gBACxF,CAAC;YACH,CAAC;YAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7B,CAAC;gBAAS,CAAC;YACT,EAAE,CAAC,KAAK,EAAE,CAAC;QACb,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { captureCommand } from "./commands/capture.js";
|
|
4
|
+
import { snapshotCommand } from "./commands/snapshot.js";
|
|
5
|
+
import { initCommand } from "./commands/init.js";
|
|
6
|
+
import { doctorCommand } from "./commands/doctor.js";
|
|
7
|
+
import { searchCommand } from "./commands/search.js";
|
|
8
|
+
import { timelineCommand } from "./commands/timeline.js";
|
|
9
|
+
import { hotspotsCommand } from "./commands/hotspots.js";
|
|
10
|
+
import { couplingCommand } from "./commands/coupling.js";
|
|
11
|
+
import { decisionsCommand } from "./commands/decisions.js";
|
|
12
|
+
import { expertsCommand } from "./commands/experts.js";
|
|
13
|
+
import { blameCommand } from "./commands/blame.js";
|
|
14
|
+
import { diffSummaryCommand } from "./commands/diff-summary.js";
|
|
15
|
+
import { trendsCommand } from "./commands/trends.js";
|
|
16
|
+
import { regressionCommand } from "./commands/regression.js";
|
|
17
|
+
import { metricCommand } from "./commands/metric.js";
|
|
18
|
+
import { embedCommand } from "./commands/embed.js";
|
|
19
|
+
import { enrichCommand } from "./commands/enrich.js";
|
|
20
|
+
import { whyCommand } from "./commands/why.js";
|
|
21
|
+
import { releaseNotesCommand } from "./commands/release-notes.js";
|
|
22
|
+
import { approveCommand } from "./commands/approve.js";
|
|
23
|
+
import { docsCommand } from "./commands/docs.js";
|
|
24
|
+
import { installCommand } from "./commands/install.js";
|
|
25
|
+
import { cronCommand } from "./commands/cron.js";
|
|
26
|
+
import { updateCommand } from "./commands/update.js";
|
|
27
|
+
import { uninstallCommand } from "./commands/uninstall.js";
|
|
28
|
+
const program = new Command();
|
|
29
|
+
program
|
|
30
|
+
.name("git-skill")
|
|
31
|
+
.description("Git history intelligence for LLMs")
|
|
32
|
+
.version("0.1.0");
|
|
33
|
+
program.addCommand(captureCommand());
|
|
34
|
+
program.addCommand(initCommand());
|
|
35
|
+
program.addCommand(doctorCommand());
|
|
36
|
+
program.addCommand(searchCommand());
|
|
37
|
+
program.addCommand(timelineCommand());
|
|
38
|
+
program.addCommand(hotspotsCommand());
|
|
39
|
+
program.addCommand(couplingCommand());
|
|
40
|
+
program.addCommand(decisionsCommand());
|
|
41
|
+
program.addCommand(expertsCommand());
|
|
42
|
+
program.addCommand(blameCommand());
|
|
43
|
+
program.addCommand(diffSummaryCommand());
|
|
44
|
+
program.addCommand(trendsCommand());
|
|
45
|
+
program.addCommand(regressionCommand());
|
|
46
|
+
program.addCommand(metricCommand());
|
|
47
|
+
program.addCommand(embedCommand());
|
|
48
|
+
program.addCommand(enrichCommand());
|
|
49
|
+
program.addCommand(whyCommand());
|
|
50
|
+
program.addCommand(releaseNotesCommand());
|
|
51
|
+
program.addCommand(approveCommand());
|
|
52
|
+
program.addCommand(docsCommand());
|
|
53
|
+
program.addCommand(installCommand());
|
|
54
|
+
program.addCommand(cronCommand());
|
|
55
|
+
program.addCommand(updateCommand());
|
|
56
|
+
program.addCommand(uninstallCommand());
|
|
57
|
+
program
|
|
58
|
+
.command("snapshot")
|
|
59
|
+
.description("Backfill all git history into SQLite")
|
|
60
|
+
.option("--force", "Clear all data before backfilling")
|
|
61
|
+
.action(async (opts) => {
|
|
62
|
+
await snapshotCommand({ force: opts.force });
|
|
63
|
+
});
|
|
64
|
+
program.parse();
|
|
65
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO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CAAC;AACrC,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,CAAC;AACrC,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC,CAAC;AACpC,OAAO,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC,CAAC;AAEvC,OAAO;KACJ,OAAO,CAAC,UAAU,CAAC;KACnB,WAAW,CAAC,sCAAsC,CAAC;KACnD,MAAM,CAAC,SAAS,EAAE,mCAAmC,CAAC;KACtD,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IACrB,MAAM,eAAe,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const WALKTHROUGH = "# Git History Walkthrough\n\nUse git-skill to explore this repository's history.\n\n## Quick Start\n```\ngit-skill doctor # Check setup health\ngit-skill hotspots # Find churning files\ngit-skill trends # View metric trends\ngit-skill search \"auth\" # Search history\n```\n";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const WALKTHROUGH = `# Git History Walkthrough
|
|
2
|
+
|
|
3
|
+
Use git-skill to explore this repository's history.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
\`\`\`
|
|
7
|
+
git-skill doctor # Check setup health
|
|
8
|
+
git-skill hotspots # Find churning files
|
|
9
|
+
git-skill trends # View metric trends
|
|
10
|
+
git-skill search "auth" # Search history
|
|
11
|
+
\`\`\`
|
|
12
|
+
`;
|
|
13
|
+
//# sourceMappingURL=walkthrough.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walkthrough.js","sourceRoot":"","sources":["../../src/templates/walkthrough.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;CAW1B,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type Database from "better-sqlite3";
|
|
2
|
+
/**
|
|
3
|
+
* Populates file_evolution table: file_path, first_seen, last_modified, total_commits, total_churn
|
|
4
|
+
*/
|
|
5
|
+
export declare function computeFileEvolution(db: Database.Database): void;
|
|
6
|
+
/**
|
|
7
|
+
* Populates churn_hotspots: file_path, period (strftime week), commits, insertions, deletions, unique_authors
|
|
8
|
+
*/
|
|
9
|
+
export declare function computeChurnHotspots(db: Database.Database): void;
|
|
10
|
+
/**
|
|
11
|
+
* Populates coupling: file_a, file_b, co_commit_count, coupling_score
|
|
12
|
+
* Uses Jaccard-style scoring: co_commit_count / max(total_commits_a, total_commits_b)
|
|
13
|
+
*/
|
|
14
|
+
export declare function computeCoupling(db: Database.Database): void;
|
|
15
|
+
/**
|
|
16
|
+
* Populates decision_points: commit_hash, type, impact_score, files_affected
|
|
17
|
+
*/
|
|
18
|
+
export declare function computeDecisionPoints(db: Database.Database): void;
|
|
19
|
+
/**
|
|
20
|
+
* Populates author_expertise: author, file_pattern (directory), commit_count, last_touched, expertise_score
|
|
21
|
+
* Groups by author and first 2 path segments.
|
|
22
|
+
*/
|
|
23
|
+
export declare function computeAuthorExpertise(db: Database.Database): void;
|
|
24
|
+
/**
|
|
25
|
+
* Populates trends: metric_name, period, value, delta, direction
|
|
26
|
+
* Computes weekly stats and compares to previous period.
|
|
27
|
+
*/
|
|
28
|
+
export declare function computeTrends(db: Database.Database): void;
|
|
29
|
+
/**
|
|
30
|
+
* Runs all analytics computations in order.
|
|
31
|
+
*/
|
|
32
|
+
export declare function runAllAnalytics(db: Database.Database): void;
|