@mneme-ai/core 0.9.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/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/insights/bus-factor.d.ts +58 -0
- package/dist/insights/bus-factor.d.ts.map +1 -0
- package/dist/insights/bus-factor.js +117 -0
- package/dist/insights/bus-factor.js.map +1 -0
- package/dist/insights/bus-factor.test.d.ts +2 -0
- package/dist/insights/bus-factor.test.d.ts.map +1 -0
- package/dist/insights/bus-factor.test.js +149 -0
- package/dist/insights/bus-factor.test.js.map +1 -0
- package/dist/insights/commit-coach.d.ts +80 -0
- package/dist/insights/commit-coach.d.ts.map +1 -0
- package/dist/insights/commit-coach.js +230 -0
- package/dist/insights/commit-coach.js.map +1 -0
- package/dist/insights/commit-coach.test.d.ts +2 -0
- package/dist/insights/commit-coach.test.d.ts.map +1 -0
- package/dist/insights/commit-coach.test.js +163 -0
- package/dist/insights/commit-coach.test.js.map +1 -0
- package/dist/insights/crystal-ball.d.ts +76 -0
- package/dist/insights/crystal-ball.d.ts.map +1 -0
- package/dist/insights/crystal-ball.js +219 -0
- package/dist/insights/crystal-ball.js.map +1 -0
- package/dist/insights/crystal-ball.test.d.ts +2 -0
- package/dist/insights/crystal-ball.test.d.ts.map +1 -0
- package/dist/insights/crystal-ball.test.js +157 -0
- package/dist/insights/crystal-ball.test.js.map +1 -0
- package/dist/insights/index.d.ts +5 -0
- package/dist/insights/index.d.ts.map +1 -1
- package/dist/insights/index.js +5 -0
- package/dist/insights/index.js.map +1 -1
- package/dist/insights/paradox.d.ts +36 -0
- package/dist/insights/paradox.d.ts.map +1 -0
- package/dist/insights/paradox.js +201 -0
- package/dist/insights/paradox.js.map +1 -0
- package/dist/insights/paradox.test.d.ts +2 -0
- package/dist/insights/paradox.test.d.ts.map +1 -0
- package/dist/insights/paradox.test.js +88 -0
- package/dist/insights/paradox.test.js.map +1 -0
- package/dist/insights/regret.d.ts +57 -0
- package/dist/insights/regret.d.ts.map +1 -0
- package/dist/insights/regret.js +137 -0
- package/dist/insights/regret.js.map +1 -0
- package/dist/insights/regret.test.d.ts +2 -0
- package/dist/insights/regret.test.d.ts.map +1 -0
- package/dist/insights/regret.test.js +153 -0
- package/dist/insights/regret.test.js.map +1 -0
- package/dist/insights/who-knows.d.ts +18 -0
- package/dist/insights/who-knows.d.ts.map +1 -1
- package/dist/insights/who-knows.js +29 -0
- package/dist/insights/who-knows.js.map +1 -1
- package/dist/insights/who-knows.test.js +63 -1
- package/dist/insights/who-knows.test.js.map +1 -1
- package/dist/quant/alpha.d.ts +87 -0
- package/dist/quant/alpha.d.ts.map +1 -0
- package/dist/quant/alpha.js +103 -0
- package/dist/quant/alpha.js.map +1 -0
- package/dist/quant/alpha.test.d.ts +2 -0
- package/dist/quant/alpha.test.d.ts.map +1 -0
- package/dist/quant/alpha.test.js +147 -0
- package/dist/quant/alpha.test.js.map +1 -0
- package/dist/quant/backtest.d.ts +57 -0
- package/dist/quant/backtest.d.ts.map +1 -0
- package/dist/quant/backtest.js +90 -0
- package/dist/quant/backtest.js.map +1 -0
- package/dist/quant/backtest.test.d.ts +2 -0
- package/dist/quant/backtest.test.d.ts.map +1 -0
- package/dist/quant/backtest.test.js +133 -0
- package/dist/quant/backtest.test.js.map +1 -0
- package/dist/quant/black-swan.d.ts +45 -0
- package/dist/quant/black-swan.d.ts.map +1 -0
- package/dist/quant/black-swan.js +112 -0
- package/dist/quant/black-swan.js.map +1 -0
- package/dist/quant/black-swan.test.d.ts +2 -0
- package/dist/quant/black-swan.test.d.ts.map +1 -0
- package/dist/quant/black-swan.test.js +131 -0
- package/dist/quant/black-swan.test.js.map +1 -0
- package/dist/quant/correlation-matrix.d.ts +54 -0
- package/dist/quant/correlation-matrix.d.ts.map +1 -0
- package/dist/quant/correlation-matrix.js +103 -0
- package/dist/quant/correlation-matrix.js.map +1 -0
- package/dist/quant/correlation-matrix.test.d.ts +2 -0
- package/dist/quant/correlation-matrix.test.d.ts.map +1 -0
- package/dist/quant/correlation-matrix.test.js +118 -0
- package/dist/quant/correlation-matrix.test.js.map +1 -0
- package/dist/quant/drawdown.d.ts +51 -0
- package/dist/quant/drawdown.d.ts.map +1 -0
- package/dist/quant/drawdown.js +96 -0
- package/dist/quant/drawdown.js.map +1 -0
- package/dist/quant/drawdown.test.d.ts +2 -0
- package/dist/quant/drawdown.test.d.ts.map +1 -0
- package/dist/quant/drawdown.test.js +166 -0
- package/dist/quant/drawdown.test.js.map +1 -0
- package/dist/quant/greek.d.ts +55 -0
- package/dist/quant/greek.d.ts.map +1 -0
- package/dist/quant/greek.js +157 -0
- package/dist/quant/greek.js.map +1 -0
- package/dist/quant/greek.test.d.ts +2 -0
- package/dist/quant/greek.test.d.ts.map +1 -0
- package/dist/quant/greek.test.js +138 -0
- package/dist/quant/greek.test.js.map +1 -0
- package/dist/quant/implied-volatility.d.ts +65 -0
- package/dist/quant/implied-volatility.d.ts.map +1 -0
- package/dist/quant/implied-volatility.js +149 -0
- package/dist/quant/implied-volatility.js.map +1 -0
- package/dist/quant/implied-volatility.test.d.ts +2 -0
- package/dist/quant/implied-volatility.test.d.ts.map +1 -0
- package/dist/quant/implied-volatility.test.js +127 -0
- package/dist/quant/implied-volatility.test.js.map +1 -0
- package/dist/quant/index.d.ts +28 -0
- package/dist/quant/index.d.ts.map +1 -0
- package/dist/quant/index.js +28 -0
- package/dist/quant/index.js.map +1 -0
- package/dist/quant/insider-trading.d.ts +56 -0
- package/dist/quant/insider-trading.d.ts.map +1 -0
- package/dist/quant/insider-trading.js +129 -0
- package/dist/quant/insider-trading.js.map +1 -0
- package/dist/quant/insider-trading.test.d.ts +2 -0
- package/dist/quant/insider-trading.test.d.ts.map +1 -0
- package/dist/quant/insider-trading.test.js +130 -0
- package/dist/quant/insider-trading.test.js.map +1 -0
- package/dist/quant/moneyball.d.ts +48 -0
- package/dist/quant/moneyball.d.ts.map +1 -0
- package/dist/quant/moneyball.js +110 -0
- package/dist/quant/moneyball.js.map +1 -0
- package/dist/quant/moneyball.test.d.ts +2 -0
- package/dist/quant/moneyball.test.d.ts.map +1 -0
- package/dist/quant/moneyball.test.js +137 -0
- package/dist/quant/moneyball.test.js.map +1 -0
- package/dist/quant/tax-loss-harvest.d.ts +59 -0
- package/dist/quant/tax-loss-harvest.d.ts.map +1 -0
- package/dist/quant/tax-loss-harvest.js +126 -0
- package/dist/quant/tax-loss-harvest.js.map +1 -0
- package/dist/quant/tax-loss-harvest.test.d.ts +2 -0
- package/dist/quant/tax-loss-harvest.test.d.ts.map +1 -0
- package/dist/quant/tax-loss-harvest.test.js +126 -0
- package/dist/quant/tax-loss-harvest.test.js.map +1 -0
- package/dist/retrieve/synthesize.d.ts.map +1 -1
- package/dist/retrieve/synthesize.js +56 -25
- package/dist/retrieve/synthesize.js.map +1 -1
- package/dist/retrieve/synthesize.test.js +26 -15
- package/dist/retrieve/synthesize.test.js.map +1 -1
- package/dist/store/schema.d.ts +2 -2
- package/dist/store/schema.d.ts.map +1 -1
- package/dist/store/schema.js +6 -2
- package/dist/store/schema.js.map +1 -1
- package/dist/store/sqlite.d.ts +2 -0
- package/dist/store/sqlite.d.ts.map +1 -1
- package/dist/store/sqlite.js +24 -0
- package/dist/store/sqlite.js.map +1 -1
- package/dist/store/sqlite.test.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mneme implied-volatility` — predict project chaos from commit message TONE.
|
|
3
|
+
*
|
|
4
|
+
* Wall Street's "implied volatility" measures market expectation of future
|
|
5
|
+
* turbulence FROM option prices, before realized volatility shows up in
|
|
6
|
+
* actual price moves. We do the same with commit messages: signals that
|
|
7
|
+
* predict bug-rate spikes BEFORE the bugs actually land.
|
|
8
|
+
*
|
|
9
|
+
* Tone signals (per commit):
|
|
10
|
+
* • exclamation density: !!! → urgency
|
|
11
|
+
* • all-caps words: BROKEN, ARGH → frustration
|
|
12
|
+
* • emoji density: 🔥💀⚠️ → emotional load
|
|
13
|
+
* • profanity (mild): wtf, ugh → friction
|
|
14
|
+
* • hedging language: "kinda", "should work?", "maybe" → uncertainty
|
|
15
|
+
*
|
|
16
|
+
* Aggregate per week → IV index (0-100). Backtests against subsequent
|
|
17
|
+
* fix-commit rate to validate.
|
|
18
|
+
*/
|
|
19
|
+
const FRICTION_WORDS = new Set([
|
|
20
|
+
"wtf", "ugh", "argh", "ffs", "damn", "shit", "fuck", "fucking",
|
|
21
|
+
"wth", "omg", "yikes", "oof", "ouch",
|
|
22
|
+
"broken", "borked", "fucked", "cursed",
|
|
23
|
+
]);
|
|
24
|
+
const HEDGE_WORDS = new Set([
|
|
25
|
+
"maybe", "probably", "kinda", "sorta", "perhaps",
|
|
26
|
+
"should", "might", "could", "hopefully", "fingers",
|
|
27
|
+
"untested", "experimental", "tentative", "wip",
|
|
28
|
+
]);
|
|
29
|
+
const ALL_CAPS_WORD_RE = /\b[A-Z]{3,}\b/g;
|
|
30
|
+
const EXCLAMATION_RE = /!+/g;
|
|
31
|
+
// Heuristic emoji match: any code point ≥ U+2600 not in regular Latin block
|
|
32
|
+
const EMOJI_RE = /[\u{1F300}-\u{1FAFF}\u{2600}-\u{27BF}]/gu;
|
|
33
|
+
/**
|
|
34
|
+
* Score the tone of a single commit subject + body. Pure function.
|
|
35
|
+
*/
|
|
36
|
+
export function scoreTone(c) {
|
|
37
|
+
const text = `${c.subject} ${c.body || ""}`;
|
|
38
|
+
// Exclamation density: count sequences of '!' (any count of !!!! is one event).
|
|
39
|
+
let exMatches = 0;
|
|
40
|
+
for (const m of text.matchAll(EXCLAMATION_RE)) {
|
|
41
|
+
exMatches += m[0].length; // double-count !!!!
|
|
42
|
+
}
|
|
43
|
+
// All-caps words.
|
|
44
|
+
const capMatches = text.match(ALL_CAPS_WORD_RE) ?? [];
|
|
45
|
+
const allCapsScore = capMatches.length;
|
|
46
|
+
// Emoji.
|
|
47
|
+
const emoji = text.match(EMOJI_RE) ?? [];
|
|
48
|
+
// Friction words.
|
|
49
|
+
const lower = text.toLowerCase();
|
|
50
|
+
let frictionScore = 0;
|
|
51
|
+
for (const w of FRICTION_WORDS) {
|
|
52
|
+
const re = new RegExp(`\\b${w}\\b`, "g");
|
|
53
|
+
const m = lower.match(re);
|
|
54
|
+
if (m)
|
|
55
|
+
frictionScore += m.length;
|
|
56
|
+
}
|
|
57
|
+
// Hedge words.
|
|
58
|
+
let hedgeScore = 0;
|
|
59
|
+
for (const w of HEDGE_WORDS) {
|
|
60
|
+
const re = new RegExp(`\\b${w}\\b`, "g");
|
|
61
|
+
const m = lower.match(re);
|
|
62
|
+
if (m)
|
|
63
|
+
hedgeScore += m.length;
|
|
64
|
+
}
|
|
65
|
+
// Calibrated tone score (0..1).
|
|
66
|
+
const raw = 0.25 * Math.min(exMatches, 5) / 5 +
|
|
67
|
+
0.20 * Math.min(allCapsScore, 5) / 5 +
|
|
68
|
+
0.15 * Math.min(emoji.length, 5) / 5 +
|
|
69
|
+
0.25 * Math.min(frictionScore, 3) / 3 +
|
|
70
|
+
0.15 * Math.min(hedgeScore, 3) / 3;
|
|
71
|
+
return {
|
|
72
|
+
hash: c.hash,
|
|
73
|
+
date: c.authorDate.slice(0, 10),
|
|
74
|
+
exclamationScore: exMatches,
|
|
75
|
+
allCapsScore,
|
|
76
|
+
emojiScore: emoji.length,
|
|
77
|
+
frictionScore,
|
|
78
|
+
hedgeScore,
|
|
79
|
+
toneScore: Math.min(1, raw),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Aggregate tones into weekly volatility windows.
|
|
84
|
+
*/
|
|
85
|
+
export function impliedVolatility(commits) {
|
|
86
|
+
if (commits.length === 0)
|
|
87
|
+
return [];
|
|
88
|
+
const tones = commits.map(scoreTone);
|
|
89
|
+
const buckets = new Map();
|
|
90
|
+
for (const t of tones) {
|
|
91
|
+
const week = isoWeek(new Date(t.date));
|
|
92
|
+
if (!buckets.has(week))
|
|
93
|
+
buckets.set(week, { sum: 0, count: 0 });
|
|
94
|
+
const b = buckets.get(week);
|
|
95
|
+
b.sum += t.toneScore;
|
|
96
|
+
b.count += 1;
|
|
97
|
+
}
|
|
98
|
+
const windows = [];
|
|
99
|
+
for (const [week, b] of buckets) {
|
|
100
|
+
const avgTone = b.sum / b.count;
|
|
101
|
+
windows.push({
|
|
102
|
+
week,
|
|
103
|
+
avgTone: Math.round(avgTone * 1000) / 1000,
|
|
104
|
+
commitCount: b.count,
|
|
105
|
+
iv: Math.round(avgTone * 100),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
windows.sort((a, b) => a.week.localeCompare(b.week));
|
|
109
|
+
return windows;
|
|
110
|
+
}
|
|
111
|
+
function isoWeek(d) {
|
|
112
|
+
const target = new Date(d.valueOf());
|
|
113
|
+
const dayNr = (d.getUTCDay() + 6) % 7;
|
|
114
|
+
target.setUTCDate(target.getUTCDate() - dayNr + 3);
|
|
115
|
+
const firstThursday = target.valueOf();
|
|
116
|
+
target.setUTCMonth(0, 1);
|
|
117
|
+
if (target.getUTCDay() !== 4) {
|
|
118
|
+
target.setUTCMonth(0, 1 + ((4 - target.getUTCDay() + 7) % 7));
|
|
119
|
+
}
|
|
120
|
+
const weekNumber = 1 + Math.ceil((firstThursday - target.valueOf()) / (7 * 86_400_000));
|
|
121
|
+
return `${d.getUTCFullYear()}-W${String(weekNumber).padStart(2, "0")}`;
|
|
122
|
+
}
|
|
123
|
+
export function summarizeVolatility(commits) {
|
|
124
|
+
const windows = impliedVolatility(commits);
|
|
125
|
+
if (windows.length === 0) {
|
|
126
|
+
return { windows: [], latestIV: 0, trend: "insufficient-data", interpretation: "No commits indexed." };
|
|
127
|
+
}
|
|
128
|
+
const latest = windows[windows.length - 1].iv;
|
|
129
|
+
let trend = "insufficient-data";
|
|
130
|
+
if (windows.length >= 4) {
|
|
131
|
+
const recent = windows.slice(-4).map((w) => w.iv);
|
|
132
|
+
const first = recent[0];
|
|
133
|
+
const last = recent[recent.length - 1];
|
|
134
|
+
const delta = last - first;
|
|
135
|
+
trend = delta > 5 ? "rising" : delta < -5 ? "falling" : "flat";
|
|
136
|
+
}
|
|
137
|
+
return { windows, latestIV: latest, trend, interpretation: buildVolInterpretation(latest, trend) };
|
|
138
|
+
}
|
|
139
|
+
function buildVolInterpretation(iv, trend) {
|
|
140
|
+
if (trend === "rising" && iv >= 30) {
|
|
141
|
+
return `IV is ${iv} (rising) — commit message tone is signaling stress. Expect more bug fixes in the next 1-2 weeks.`;
|
|
142
|
+
}
|
|
143
|
+
if (iv >= 50)
|
|
144
|
+
return `IV is ${iv} (very high). Team is in firefighting mode.`;
|
|
145
|
+
if (iv <= 10 && trend === "flat")
|
|
146
|
+
return `IV is ${iv} (low + flat). Calm waters; commits are unemotional.`;
|
|
147
|
+
return `IV is ${iv} (${trend}). Watch for rising trends as a leading indicator of bugs.`;
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=implied-volatility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"implied-volatility.js","sourceRoot":"","sources":["../../src/quant/implied-volatility.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAiCH,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS;IAC9D,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM;IACpC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ;CACvC,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS;IAChD,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS;IAClD,UAAU,EAAE,cAA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CAAC,EAAE,CAAC;QACxB,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAClD,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAE,CAAC;QACzB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC;QACxC,MAAM,KAAK,GAAG,IAAI,GAAG,KAAK,CAAC;QAC3B,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;IACjE,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,sBAAsB,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC;AACrG,CAAC;AAED,SAAS,sBAAsB,CAAC,EAAU,EAAE,KAAiC;IAC3E,IAAI,KAAK,KAAK,QAAQ,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;QACnC,OAAO,SAAS,EAAE,mGAAmG,CAAC;IACxH,CAAC;IACD,IAAI,EAAE,IAAI,EAAE;QAAE,OAAO,SAAS,EAAE,6CAA6C,CAAC;IAC9E,IAAI,EAAE,IAAI,EAAE,IAAI,KAAK,KAAK,MAAM;QAAE,OAAO,SAAS,EAAE,sDAAsD,CAAC;IAC3G,OAAO,SAAS,EAAE,KAAK,KAAK,4DAA4D,CAAC;AAC3F,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"implied-volatility.test.d.ts","sourceRoot":"","sources":["../../src/quant/implied-volatility.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { scoreTone, impliedVolatility, summarizeVolatility } from "./implied-volatility.js";
|
|
3
|
+
const cmt = (hash, date, subject, body = "") => ({
|
|
4
|
+
hash,
|
|
5
|
+
shortHash: hash.slice(0, 7),
|
|
6
|
+
authorName: "alice",
|
|
7
|
+
authorEmail: "a@x",
|
|
8
|
+
authorDate: `${date}T00:00:00Z`,
|
|
9
|
+
committerDate: `${date}T00:00:00Z`,
|
|
10
|
+
subject,
|
|
11
|
+
body,
|
|
12
|
+
parents: [],
|
|
13
|
+
files: [],
|
|
14
|
+
});
|
|
15
|
+
describe("scoreTone — calm vs frustrated commits", () => {
|
|
16
|
+
it("calm commit scores low tone", () => {
|
|
17
|
+
const t = scoreTone(cmt("a1", "2024-01-01", "feat: add new endpoint"));
|
|
18
|
+
expect(t.exclamationScore).toBe(0);
|
|
19
|
+
expect(t.allCapsScore).toBe(0);
|
|
20
|
+
expect(t.emojiScore).toBe(0);
|
|
21
|
+
expect(t.frictionScore).toBe(0);
|
|
22
|
+
expect(t.toneScore).toBeLessThan(0.1);
|
|
23
|
+
});
|
|
24
|
+
it("frustrated commit scores high tone", () => {
|
|
25
|
+
const t = scoreTone(cmt("a1", "2024-01-01", "OMG WTF this is BROKEN!!!", "kinda hopefully fixed??"));
|
|
26
|
+
expect(t.exclamationScore).toBeGreaterThan(0);
|
|
27
|
+
expect(t.allCapsScore).toBeGreaterThan(0);
|
|
28
|
+
expect(t.frictionScore).toBeGreaterThan(0);
|
|
29
|
+
expect(t.hedgeScore).toBeGreaterThan(0);
|
|
30
|
+
expect(t.toneScore).toBeGreaterThan(0.3);
|
|
31
|
+
});
|
|
32
|
+
it("emoji-laden commit raises emoji score", () => {
|
|
33
|
+
const t = scoreTone(cmt("a1", "2024-01-01", "fix prod 🔥💀⚠️"));
|
|
34
|
+
expect(t.emojiScore).toBeGreaterThan(0);
|
|
35
|
+
});
|
|
36
|
+
it("hedge words detected", () => {
|
|
37
|
+
const t = scoreTone(cmt("a1", "2024-01-01", "maybe fix race", "should work probably"));
|
|
38
|
+
expect(t.hedgeScore).toBeGreaterThanOrEqual(2);
|
|
39
|
+
});
|
|
40
|
+
it("toneScore is bounded [0, 1]", () => {
|
|
41
|
+
const samples = [
|
|
42
|
+
"feat: add",
|
|
43
|
+
"OMG WTF BROKEN!!!! 🔥💀 wtf wtf wtf maybe maybe maybe",
|
|
44
|
+
"",
|
|
45
|
+
"AAAAAAAA",
|
|
46
|
+
];
|
|
47
|
+
for (const subj of samples) {
|
|
48
|
+
const t = scoreTone(cmt("x", "2024-01-01", subj));
|
|
49
|
+
expect(t.toneScore).toBeGreaterThanOrEqual(0);
|
|
50
|
+
expect(t.toneScore).toBeLessThanOrEqual(1);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
describe("impliedVolatility — weekly aggregation", () => {
|
|
55
|
+
it("returns empty for empty input", () => {
|
|
56
|
+
expect(impliedVolatility([])).toEqual([]);
|
|
57
|
+
});
|
|
58
|
+
it("buckets by ISO week + computes IV in 0-100 range", () => {
|
|
59
|
+
const commits = [
|
|
60
|
+
cmt("a1", "2024-01-01", "feat: A"),
|
|
61
|
+
cmt("a2", "2024-01-02", "feat: B"),
|
|
62
|
+
cmt("a3", "2024-01-08", "OMG BROKEN!!!"),
|
|
63
|
+
cmt("a4", "2024-01-09", "wtf this is hopeless"),
|
|
64
|
+
];
|
|
65
|
+
const windows = impliedVolatility(commits);
|
|
66
|
+
expect(windows.length).toBeGreaterThanOrEqual(2);
|
|
67
|
+
for (const w of windows) {
|
|
68
|
+
expect(w.iv).toBeGreaterThanOrEqual(0);
|
|
69
|
+
expect(w.iv).toBeLessThanOrEqual(100);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
it("higher tone week shows higher IV", () => {
|
|
73
|
+
const commits = [
|
|
74
|
+
cmt("a1", "2024-01-01", "feat: A"),
|
|
75
|
+
cmt("a2", "2024-01-02", "feat: B"),
|
|
76
|
+
cmt("a3", "2024-01-08", "OMG WTF BROKEN!!!"),
|
|
77
|
+
cmt("a4", "2024-01-09", "ARGH crashed!!! ugh"),
|
|
78
|
+
cmt("a5", "2024-01-10", "fucking 🔥🔥🔥"),
|
|
79
|
+
];
|
|
80
|
+
const windows = impliedVolatility(commits);
|
|
81
|
+
expect(windows.length).toBe(2);
|
|
82
|
+
expect(windows[1].iv).toBeGreaterThan(windows[0].iv);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
describe("summarizeVolatility — trend detection", () => {
|
|
86
|
+
it("returns 'insufficient-data' for fewer than 4 weeks", () => {
|
|
87
|
+
const commits = [cmt("a", "2024-01-01", "feat: x")];
|
|
88
|
+
expect(summarizeVolatility(commits).trend).toBe("insufficient-data");
|
|
89
|
+
});
|
|
90
|
+
it("'rising' when last 4 weeks ascend", () => {
|
|
91
|
+
const commits = [
|
|
92
|
+
// Week 1: calm
|
|
93
|
+
cmt("a1", "2024-01-01", "feat: A"),
|
|
94
|
+
// Week 2: warming up
|
|
95
|
+
cmt("a2", "2024-01-08", "fix bug !!"),
|
|
96
|
+
// Week 3: hot
|
|
97
|
+
cmt("a3", "2024-01-15", "WTF BROKEN!!!"),
|
|
98
|
+
// Week 4: very hot
|
|
99
|
+
cmt("a4", "2024-01-22", "OMG WTF FUCKED 🔥💀 maybe hopefully fix?"),
|
|
100
|
+
];
|
|
101
|
+
expect(summarizeVolatility(commits).trend).toBe("rising");
|
|
102
|
+
});
|
|
103
|
+
it("'falling' when last 4 weeks descend", () => {
|
|
104
|
+
const commits = [
|
|
105
|
+
cmt("a1", "2024-01-01", "OMG WTF FUCKED 🔥💀!!!!!"),
|
|
106
|
+
cmt("a2", "2024-01-08", "WTF still BROKEN!!!"),
|
|
107
|
+
cmt("a3", "2024-01-15", "kinda fix maybe"),
|
|
108
|
+
cmt("a4", "2024-01-22", "feat: stable release"),
|
|
109
|
+
];
|
|
110
|
+
expect(summarizeVolatility(commits).trend).toBe("falling");
|
|
111
|
+
});
|
|
112
|
+
it("'flat' when 4 weeks are similar", () => {
|
|
113
|
+
const commits = [
|
|
114
|
+
cmt("a1", "2024-01-01", "feat: stable"),
|
|
115
|
+
cmt("a2", "2024-01-08", "feat: stable"),
|
|
116
|
+
cmt("a3", "2024-01-15", "feat: stable"),
|
|
117
|
+
cmt("a4", "2024-01-22", "feat: stable"),
|
|
118
|
+
];
|
|
119
|
+
expect(summarizeVolatility(commits).trend).toBe("flat");
|
|
120
|
+
});
|
|
121
|
+
it("interpretation includes IV number + trend label", () => {
|
|
122
|
+
const commits = Array.from({ length: 4 }, (_, i) => cmt(`a${i}`, `2024-01-${String(i * 7 + 1).padStart(2, "0")}`, "feat: x"));
|
|
123
|
+
const r = summarizeVolatility(commits);
|
|
124
|
+
expect(r.interpretation).toMatch(/IV is/);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
//# sourceMappingURL=implied-volatility.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"implied-volatility.test.js","sourceRoot":"","sources":["../../src/quant/implied-volatility.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAG5F,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,IAAY,EAAE,OAAe,EAAE,IAAI,GAAG,EAAE,EAAU,EAAE,CAAC,CAAC;IAC/E,IAAI;IACJ,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;IAC3B,UAAU,EAAE,OAAO;IACnB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,GAAG,IAAI,YAAY;IAC/B,aAAa,EAAE,GAAG,IAAI,YAAY;IAClC,OAAO;IACP,IAAI;IACJ,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,EAAE;CACV,CAAC,CAAC;AAEH,QAAQ,CAAC,wCAA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,CAAC;IAEH,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;QACzC,MAAM,OAAO,GAAG;YACd,GAAG,CAAC,IAAI,EAAE,YAAY,EAAE,cAAc,CAAC;YACvC,GAAG,CAAC,IAAI,EAAE,YAAY,EAAE,cAAc,CAAC;YACvC,GAAG,CAAC,IAAI,EAAE,YAAY,EAAE,cAAc,CAAC;YACvC,GAAG,CAAC,IAAI,EAAE,YAAY,EAAE,cAAc,CAAC;SACxC,CAAC;QACF,MAAM,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACzD,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACjD,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,WAAW,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,SAAS,CAAC,CACzE,CAAC;QACF,MAAM,CAAC,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;QACvC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sprint 5 — Wall Street meets Git.
|
|
3
|
+
*
|
|
4
|
+
* Quantitative analysis of codebase as if it were a market:
|
|
5
|
+
* • drawdown — worst losing streaks (firefighting periods)
|
|
6
|
+
* • alpha — Kelly criterion for technical-debt allocation
|
|
7
|
+
* • backtest — validate any predictor against actual outcomes
|
|
8
|
+
* • black-swan — rare-but-catastrophic file patterns
|
|
9
|
+
* • insider-trading — authors who fix bugs they introduced
|
|
10
|
+
* • moneyball — undervalued contributors (high impact, low LOC)
|
|
11
|
+
* • greek — sensitivity analysis (Δ Γ Θ)
|
|
12
|
+
* • correlation-matrix— hidden behavioral coupling between files
|
|
13
|
+
* • implied-volatility— project chaos predicted from commit message tone
|
|
14
|
+
* • tax-loss-harvest — dead code candidates that "offset" technical debt
|
|
15
|
+
*
|
|
16
|
+
* All pure analysis. No LLM. Each module is fully unit-tested.
|
|
17
|
+
*/
|
|
18
|
+
export * from "./drawdown.js";
|
|
19
|
+
export * from "./alpha.js";
|
|
20
|
+
export * from "./backtest.js";
|
|
21
|
+
export * from "./black-swan.js";
|
|
22
|
+
export * from "./insider-trading.js";
|
|
23
|
+
export * from "./moneyball.js";
|
|
24
|
+
export * from "./greek.js";
|
|
25
|
+
export * from "./correlation-matrix.js";
|
|
26
|
+
export * from "./implied-volatility.js";
|
|
27
|
+
export * from "./tax-loss-harvest.js";
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/quant/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sprint 5 — Wall Street meets Git.
|
|
3
|
+
*
|
|
4
|
+
* Quantitative analysis of codebase as if it were a market:
|
|
5
|
+
* • drawdown — worst losing streaks (firefighting periods)
|
|
6
|
+
* • alpha — Kelly criterion for technical-debt allocation
|
|
7
|
+
* • backtest — validate any predictor against actual outcomes
|
|
8
|
+
* • black-swan — rare-but-catastrophic file patterns
|
|
9
|
+
* • insider-trading — authors who fix bugs they introduced
|
|
10
|
+
* • moneyball — undervalued contributors (high impact, low LOC)
|
|
11
|
+
* • greek — sensitivity analysis (Δ Γ Θ)
|
|
12
|
+
* • correlation-matrix— hidden behavioral coupling between files
|
|
13
|
+
* • implied-volatility— project chaos predicted from commit message tone
|
|
14
|
+
* • tax-loss-harvest — dead code candidates that "offset" technical debt
|
|
15
|
+
*
|
|
16
|
+
* All pure analysis. No LLM. Each module is fully unit-tested.
|
|
17
|
+
*/
|
|
18
|
+
export * from "./drawdown.js";
|
|
19
|
+
export * from "./alpha.js";
|
|
20
|
+
export * from "./backtest.js";
|
|
21
|
+
export * from "./black-swan.js";
|
|
22
|
+
export * from "./insider-trading.js";
|
|
23
|
+
export * from "./moneyball.js";
|
|
24
|
+
export * from "./greek.js";
|
|
25
|
+
export * from "./correlation-matrix.js";
|
|
26
|
+
export * from "./implied-volatility.js";
|
|
27
|
+
export * from "./tax-loss-harvest.js";
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/quant/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mneme insider-trading` — find authors who repeatedly fix bugs they
|
|
3
|
+
* themselves introduced.
|
|
4
|
+
*
|
|
5
|
+
* The pattern tells you two things at once:
|
|
6
|
+
* 1. This person has the deepest domain knowledge (only they understand
|
|
7
|
+
* this code well enough to BOTH ship and break it).
|
|
8
|
+
* 2. They have an execution gap — knowing more isn't translating to
|
|
9
|
+
* better quality.
|
|
10
|
+
*
|
|
11
|
+
* Concrete coaching opportunity: pair them with someone who has zero
|
|
12
|
+
* defects on the same files.
|
|
13
|
+
*
|
|
14
|
+
* Pure data. Detects pairs of (commit, follow-up commit) by SAME author
|
|
15
|
+
* touching the SAME files where the follow-up is a fix.
|
|
16
|
+
*/
|
|
17
|
+
import type { Commit } from "../types.js";
|
|
18
|
+
export interface InsiderPattern {
|
|
19
|
+
/** Original commit that introduced the bug. */
|
|
20
|
+
shipped: Commit;
|
|
21
|
+
/** Same-author commit that fixed it. */
|
|
22
|
+
fixed: Commit;
|
|
23
|
+
/** Days between ship and fix. */
|
|
24
|
+
daysToFix: number;
|
|
25
|
+
/** The shared file path that triggered the match. */
|
|
26
|
+
sharedFile: string;
|
|
27
|
+
}
|
|
28
|
+
export interface InsiderProfile {
|
|
29
|
+
authorName: string;
|
|
30
|
+
authorEmail: string;
|
|
31
|
+
/** Number of self-introduced + self-fixed bug pairs. */
|
|
32
|
+
patternCount: number;
|
|
33
|
+
/** Files where the pattern repeats. */
|
|
34
|
+
affectedFiles: string[];
|
|
35
|
+
/** Sample patterns (up to 3) for display. */
|
|
36
|
+
samples: InsiderPattern[];
|
|
37
|
+
/** Risk tier — used for output labeling. */
|
|
38
|
+
tier: "high-pattern" | "elevated" | "watch" | "low";
|
|
39
|
+
/** Suggested pairing partner from another author (if any). */
|
|
40
|
+
pairSuggestion?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface InsiderTradingOptions {
|
|
43
|
+
/** Maximum days between ship and fix to count as a pattern. */
|
|
44
|
+
windowDays?: number;
|
|
45
|
+
/** Minimum patterns for an author to be flagged. */
|
|
46
|
+
minPatterns?: number;
|
|
47
|
+
/** Top-N profiles to return. */
|
|
48
|
+
topN?: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Detect insider patterns across commits + suggest a pairing partner per
|
|
52
|
+
* flagged author. Pure analysis — caller must pre-load commits.
|
|
53
|
+
*/
|
|
54
|
+
export declare function detectInsiderTrading(commits: Commit[], opts?: InsiderTradingOptions): InsiderProfile[];
|
|
55
|
+
export declare function classifyInsiderTier(count: number): InsiderProfile["tier"];
|
|
56
|
+
//# sourceMappingURL=insider-trading.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insider-trading.d.ts","sourceRoot":"","sources":["../../src/quant/insider-trading.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAI1C,MAAM,WAAW,cAAc;IAC7B,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;IACrB,uCAAuC;IACvC,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,6CAA6C;IAC7C,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,4CAA4C;IAC5C,IAAI,EAAE,cAAc,GAAG,UAAU,GAAG,OAAO,GAAG,KAAK,CAAC;IACpD,8DAA8D;IAC9D,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,qBAAqB;IACpC,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gCAAgC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EAAE,EACjB,IAAI,GAAE,qBAA0B,GAC/B,cAAc,EAAE,CAkFlB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,CAKzE"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mneme insider-trading` — find authors who repeatedly fix bugs they
|
|
3
|
+
* themselves introduced.
|
|
4
|
+
*
|
|
5
|
+
* The pattern tells you two things at once:
|
|
6
|
+
* 1. This person has the deepest domain knowledge (only they understand
|
|
7
|
+
* this code well enough to BOTH ship and break it).
|
|
8
|
+
* 2. They have an execution gap — knowing more isn't translating to
|
|
9
|
+
* better quality.
|
|
10
|
+
*
|
|
11
|
+
* Concrete coaching opportunity: pair them with someone who has zero
|
|
12
|
+
* defects on the same files.
|
|
13
|
+
*
|
|
14
|
+
* Pure data. Detects pairs of (commit, follow-up commit) by SAME author
|
|
15
|
+
* touching the SAME files where the follow-up is a fix.
|
|
16
|
+
*/
|
|
17
|
+
const FIX_RE = /\b(fix(?:es|ed)?|hotfix|bug|crashed?|broken|regression)\b/i;
|
|
18
|
+
/**
|
|
19
|
+
* Detect insider patterns across commits + suggest a pairing partner per
|
|
20
|
+
* flagged author. Pure analysis — caller must pre-load commits.
|
|
21
|
+
*/
|
|
22
|
+
export function detectInsiderTrading(commits, opts = {}) {
|
|
23
|
+
const windowDays = opts.windowDays ?? 14;
|
|
24
|
+
const minPatterns = opts.minPatterns ?? 2;
|
|
25
|
+
const topN = opts.topN ?? 10;
|
|
26
|
+
const windowMs = windowDays * 86_400_000;
|
|
27
|
+
const sorted = [...commits].sort((a, b) => a.authorDate.localeCompare(b.authorDate));
|
|
28
|
+
// Step 1: collect all patterns across ALL authors.
|
|
29
|
+
const allPatterns = [];
|
|
30
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
31
|
+
const shipped = sorted[i];
|
|
32
|
+
if (FIX_RE.test(shipped.subject))
|
|
33
|
+
continue; // skip if shipped IS itself a fix
|
|
34
|
+
const shippedTime = new Date(shipped.authorDate).getTime();
|
|
35
|
+
const shippedAuthor = `${shipped.authorName}|${shipped.authorEmail}`;
|
|
36
|
+
const shippedFiles = new Set(shipped.files ?? []);
|
|
37
|
+
if (shippedFiles.size === 0)
|
|
38
|
+
continue;
|
|
39
|
+
for (let j = i + 1; j < sorted.length; j++) {
|
|
40
|
+
const fixed = sorted[j];
|
|
41
|
+
const dt = new Date(fixed.authorDate).getTime() - shippedTime;
|
|
42
|
+
if (dt > windowMs)
|
|
43
|
+
break;
|
|
44
|
+
// Same author requirement — that's the "insider" part.
|
|
45
|
+
if (`${fixed.authorName}|${fixed.authorEmail}` !== shippedAuthor)
|
|
46
|
+
continue;
|
|
47
|
+
// Must look like a fix.
|
|
48
|
+
if (!FIX_RE.test(fixed.subject))
|
|
49
|
+
continue;
|
|
50
|
+
// Must touch a shared file.
|
|
51
|
+
const shared = (fixed.files ?? []).find((f) => shippedFiles.has(f));
|
|
52
|
+
if (!shared)
|
|
53
|
+
continue;
|
|
54
|
+
allPatterns.push({
|
|
55
|
+
shipped,
|
|
56
|
+
fixed,
|
|
57
|
+
daysToFix: Number((dt / 86_400_000).toFixed(1)),
|
|
58
|
+
sharedFile: shared,
|
|
59
|
+
});
|
|
60
|
+
break; // one pattern per shipped commit
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const byAuthor = new Map();
|
|
64
|
+
for (const p of allPatterns) {
|
|
65
|
+
const key = `${p.shipped.authorName}|${p.shipped.authorEmail}`;
|
|
66
|
+
if (!byAuthor.has(key)) {
|
|
67
|
+
byAuthor.set(key, {
|
|
68
|
+
authorName: p.shipped.authorName,
|
|
69
|
+
authorEmail: p.shipped.authorEmail,
|
|
70
|
+
patterns: [],
|
|
71
|
+
files: new Set(),
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const b = byAuthor.get(key);
|
|
75
|
+
b.patterns.push(p);
|
|
76
|
+
b.files.add(p.sharedFile);
|
|
77
|
+
}
|
|
78
|
+
// Step 3: build per-author profiles + pairing suggestions.
|
|
79
|
+
const profiles = [];
|
|
80
|
+
for (const b of byAuthor.values()) {
|
|
81
|
+
if (b.patterns.length < minPatterns)
|
|
82
|
+
continue;
|
|
83
|
+
const tier = classifyInsiderTier(b.patterns.length);
|
|
84
|
+
const pairSuggestion = findPairPartner(commits, b.authorName, [...b.files]);
|
|
85
|
+
profiles.push({
|
|
86
|
+
authorName: b.authorName,
|
|
87
|
+
authorEmail: b.authorEmail,
|
|
88
|
+
patternCount: b.patterns.length,
|
|
89
|
+
affectedFiles: [...b.files],
|
|
90
|
+
samples: b.patterns.slice(0, 3),
|
|
91
|
+
tier,
|
|
92
|
+
pairSuggestion,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
profiles.sort((a, b) => b.patternCount - a.patternCount);
|
|
96
|
+
return profiles.slice(0, topN);
|
|
97
|
+
}
|
|
98
|
+
export function classifyInsiderTier(count) {
|
|
99
|
+
if (count >= 5)
|
|
100
|
+
return "high-pattern";
|
|
101
|
+
if (count >= 3)
|
|
102
|
+
return "elevated";
|
|
103
|
+
if (count >= 2)
|
|
104
|
+
return "watch";
|
|
105
|
+
return "low";
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Find a pairing partner — the author who has touched the same files
|
|
109
|
+
* with ZERO insider patterns themselves. Returns the first match.
|
|
110
|
+
*/
|
|
111
|
+
function findPairPartner(commits, avoidAuthor, files) {
|
|
112
|
+
if (files.length === 0)
|
|
113
|
+
return undefined;
|
|
114
|
+
const fileSet = new Set(files);
|
|
115
|
+
// Count touches per author on the affected files.
|
|
116
|
+
const otherAuthors = new Map();
|
|
117
|
+
for (const c of commits) {
|
|
118
|
+
if (c.authorName === avoidAuthor)
|
|
119
|
+
continue;
|
|
120
|
+
if (!c.files?.some((f) => fileSet.has(f)))
|
|
121
|
+
continue;
|
|
122
|
+
otherAuthors.set(c.authorName, (otherAuthors.get(c.authorName) ?? 0) + 1);
|
|
123
|
+
}
|
|
124
|
+
if (otherAuthors.size === 0)
|
|
125
|
+
return undefined;
|
|
126
|
+
// Pick the most active OTHER author.
|
|
127
|
+
return [...otherAuthors.entries()].sort((a, b) => b[1] - a[1])[0][0];
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=insider-trading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insider-trading.js","sourceRoot":"","sources":["../../src/quant/insider-trading.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,MAAM,MAAM,GAAG,4DAA4D,CAAC;AAqC5E;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAiB,EACjB,OAA8B,EAAE;IAEhC,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC;IACzC,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,CAAC,CAAC;IAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;IAC7B,MAAM,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC;IAEzC,MAAM,MAAM,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;IAErF,mDAAmD;IACnD,MAAM,WAAW,GAAqB,EAAE,CAAC;IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAE,CAAC;QAC3B,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;YAAE,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