mneme-ai 3.121.0 → 3.123.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.
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mneme persona` (v3.123.0) — COMMIT PERSONA: turn this repo's real git history
|
|
3
|
+
* into a measured "commit persona" per contributor + a distinct cartoon avatar.
|
|
4
|
+
* HONEST: it scores commit HYGIENE (messages / size / tests / fixups), not skill.
|
|
5
|
+
*
|
|
6
|
+
* mneme persona # personas for the local repo
|
|
7
|
+
* mneme persona --svg ./avatars # also write each avatar as an SVG
|
|
8
|
+
* mneme persona --json
|
|
9
|
+
*/
|
|
10
|
+
import type { Command } from "commander";
|
|
11
|
+
export declare function registerPersonaCommands(program: Command): void;
|
|
12
|
+
//# sourceMappingURL=persona.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persona.d.ts","sourceRoot":"","sources":["../../src/commands/persona.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA+BzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAsB9D"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mneme persona` (v3.123.0) — COMMIT PERSONA: turn this repo's real git history
|
|
3
|
+
* into a measured "commit persona" per contributor + a distinct cartoon avatar.
|
|
4
|
+
* HONEST: it scores commit HYGIENE (messages / size / tests / fixups), not skill.
|
|
5
|
+
*
|
|
6
|
+
* mneme persona # personas for the local repo
|
|
7
|
+
* mneme persona --svg ./avatars # also write each avatar as an SVG
|
|
8
|
+
* mneme persona --json
|
|
9
|
+
*/
|
|
10
|
+
import { spawnSync } from "node:child_process";
|
|
11
|
+
import { writeFileSync, mkdirSync } from "node:fs";
|
|
12
|
+
import { join } from "node:path";
|
|
13
|
+
import { commitPersona } from "@mneme-ai/core";
|
|
14
|
+
function out(s) { process.stdout.write(s + "\n"); }
|
|
15
|
+
function readLocalCommits(max = 500) {
|
|
16
|
+
const US = "\x1f", RS = "\x1e";
|
|
17
|
+
const meta = spawnSync("git", ["log", "--no-merges", "-n", String(max), `--format=${RS}%H${US}%an${US}%at${US}%s${US}%b`], { encoding: "utf8", maxBuffer: 64 * 1024 * 1024 });
|
|
18
|
+
if (meta.status !== 0 || !meta.stdout)
|
|
19
|
+
return [];
|
|
20
|
+
const byHash = new Map();
|
|
21
|
+
for (const blk of meta.stdout.split(RS)) {
|
|
22
|
+
if (!blk.trim())
|
|
23
|
+
continue;
|
|
24
|
+
const [hash, author, at, subject, ...rest] = blk.split(US);
|
|
25
|
+
if (!hash)
|
|
26
|
+
continue;
|
|
27
|
+
byHash.set(hash.trim(), { author: (author || "unknown").trim(), ts: parseInt(at || "0", 10) || 0, subject: (subject || "").trim(), body: (rest.join(US) || "").trim(), files: [], insertions: 0, deletions: 0 });
|
|
28
|
+
}
|
|
29
|
+
const ns = spawnSync("git", ["log", "--no-merges", "-n", String(max), "--numstat", `--format=${RS}%H`], { encoding: "utf8", maxBuffer: 128 * 1024 * 1024 });
|
|
30
|
+
if (ns.status === 0 && ns.stdout) {
|
|
31
|
+
for (const blk of ns.stdout.split(RS)) {
|
|
32
|
+
const lines = blk.split("\n").map((l) => l.trim()).filter(Boolean);
|
|
33
|
+
if (!lines.length)
|
|
34
|
+
continue;
|
|
35
|
+
const rec = byHash.get(lines[0]);
|
|
36
|
+
if (!rec)
|
|
37
|
+
continue;
|
|
38
|
+
for (const l of lines.slice(1)) {
|
|
39
|
+
const m = l.split("\t");
|
|
40
|
+
if (m.length < 3)
|
|
41
|
+
continue;
|
|
42
|
+
rec.insertions += parseInt(m[0], 10) || 0;
|
|
43
|
+
rec.deletions += parseInt(m[1], 10) || 0;
|
|
44
|
+
rec.files.push(m[2]);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return [...byHash.values()];
|
|
49
|
+
}
|
|
50
|
+
export function registerPersonaCommands(program) {
|
|
51
|
+
program
|
|
52
|
+
.command("persona")
|
|
53
|
+
.description("🎭 COMMIT PERSONA — render each contributor's git style as a measured persona + a distinct cartoon (The Surgeon / Bulldozer / Firefighter / Storyteller…). Deterministic, from real git signals. HONEST: scores commit HYGIENE, not skill. Web: xray.mneme-ai.space/persona")
|
|
54
|
+
.option("--json", "JSON output")
|
|
55
|
+
.option("--svg <dir>", "also write each contributor's avatar as <author>.svg into <dir>")
|
|
56
|
+
.option("--top <n>", "max contributors", "12")
|
|
57
|
+
.action((opts) => {
|
|
58
|
+
const commits = readLocalCommits();
|
|
59
|
+
if (!commits.length) {
|
|
60
|
+
out("no commits found (run inside a git repo)");
|
|
61
|
+
process.exitCode = 2;
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const personas = commitPersona.analyzeCommitPersonas(commits, { top: parseInt(opts.top || "12", 10), minCommits: 2 });
|
|
65
|
+
if (opts.svg) {
|
|
66
|
+
try {
|
|
67
|
+
mkdirSync(opts.svg, { recursive: true });
|
|
68
|
+
for (const p of personas)
|
|
69
|
+
writeFileSync(join(opts.svg, p.author.replace(/[^A-Za-z0-9._-]/g, "_") + ".svg"), commitPersona.personaAvatarSvg(p));
|
|
70
|
+
out(`🎭 ${personas.length} avatar(s) → ${opts.svg}`);
|
|
71
|
+
}
|
|
72
|
+
catch { /* */ }
|
|
73
|
+
}
|
|
74
|
+
if (opts.json) {
|
|
75
|
+
out(JSON.stringify(personas.map((p) => ({ ...p, avatarSvg: commitPersona.personaAvatarSvg(p) })), null, 2));
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
out(`🎭 Commit Personas — ${personas.length} contributor(s), from real git history (hygiene, not skill)`);
|
|
79
|
+
for (const p of personas) {
|
|
80
|
+
const m = p.metrics;
|
|
81
|
+
out(`\n ${p.archetype} · ${p.author}`);
|
|
82
|
+
out(` 🧼 ${p.band} ${p.hygiene} · 📦 ${m.commits} commits · 📏 ~${Math.round(m.avgChurn)} lines/commit · 🧪 ${Math.round(m.testTouchRate * 100)}% w/ tests · 📝 ${Math.round(m.conventionalRate * 100)}% conventional${m.fixRate > 0.1 ? ` · 🚒 ${Math.round(m.fixRate * 100)}% firefighting` : ""}`);
|
|
83
|
+
out(` ${p.blurb}`);
|
|
84
|
+
}
|
|
85
|
+
out(`\n honest: commit hygiene measured from messages/size/tests/fixups — NOT a judgment of the person.`);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=persona.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persona.js","sourceRoot":"","sources":["../../src/commands/persona.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,SAAS,GAAG,CAAC,CAAS,IAAU,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AAEjE,SAAS,gBAAgB,CAAC,GAAG,GAAG,GAAG;IACjC,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC;IAC/B,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC,CAAC;IAC9K,IAAI,IAAI,CAAC,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gB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAAC,OAAO;QAAC,CAAC;QACvI,GAAG,CAAC,wBAAwB,QAAQ,CAAC,MAAM,6DAA6D,CAAC,CAAC;QAC1G,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;YACzB,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;YACpB,GAAG,CAAC,OAAO,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;YAC1C,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,OAAO,WAAW,CAAC,CAAC,OAAO,oBAAoB,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,wBAAwB,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,GAAG,GAAG,CAAC,qBAAqB,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,gBAAgB,GAAG,GAAG,CAAC,iBAAiB,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,WAAW,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACnT,GAAG,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;QACxB,CAAC;QACD,GAAG,CAAC,qGAAqG,CAAC,CAAC;IAC7G,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA0MA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA6mNvD"}
|
package/dist/index.js
CHANGED
|
@@ -132,6 +132,7 @@ import { registerSdcCommands } from "./commands/sdc.js";
|
|
|
132
132
|
import { registerStatguardCommands } from "./commands/statguard.js";
|
|
133
133
|
import { registerHpeCommands } from "./commands/hpe.js";
|
|
134
134
|
import { registerVericertCommands } from "./commands/vericert.js";
|
|
135
|
+
import { registerPersonaCommands } from "./commands/persona.js";
|
|
135
136
|
import { registerMoatCommands } from "./commands/moat.js";
|
|
136
137
|
import { attachRegretOracle } from "./commands/regret.js";
|
|
137
138
|
import { registerTrustCommands } from "./commands/trust.js";
|
|
@@ -4821,6 +4822,7 @@ export async function run(argv) {
|
|
|
4821
4822
|
registerStatguardCommands(program);
|
|
4822
4823
|
registerHpeCommands(program);
|
|
4823
4824
|
registerVericertCommands(program);
|
|
4825
|
+
registerPersonaCommands(program);
|
|
4824
4826
|
registerMoatCommands(program);
|
|
4825
4827
|
// ─── Trust calibrator (v1.31.0) -- per-subsystem precision/recall/band
|
|
4826
4828
|
registerTrustCommands(program);
|