mneme-ai 3.131.0 → 3.132.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,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mneme brief` (v3.132.0) — the Context Capsule. Fuse this repo's git history into
|
|
3
|
+
* ONE git-native shared-context object every agent inherits: the team (commit
|
|
4
|
+
* personas), recent decisions, hot files, open TODOs, themes — deterministic, cited,
|
|
5
|
+
* local-first. The Path-A moat: not "memory", but shared CONTEXT for multi-agent teams.
|
|
6
|
+
*/
|
|
7
|
+
import type { Command } from "commander";
|
|
8
|
+
export declare function registerBriefCommands(program: Command): void;
|
|
9
|
+
//# sourceMappingURL=brief.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brief.d.ts","sourceRoot":"","sources":["../../src/commands/brief.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuBzC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAsB5D"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mneme brief` (v3.132.0) — the Context Capsule. Fuse this repo's git history into
|
|
3
|
+
* ONE git-native shared-context object every agent inherits: the team (commit
|
|
4
|
+
* personas), recent decisions, hot files, open TODOs, themes — deterministic, cited,
|
|
5
|
+
* local-first. The Path-A moat: not "memory", but shared CONTEXT for multi-agent teams.
|
|
6
|
+
*/
|
|
7
|
+
import { spawnSync } from "node:child_process";
|
|
8
|
+
import { repoBrief } from "@mneme-ai/core";
|
|
9
|
+
function out(s) { process.stdout.write(s + "\n"); }
|
|
10
|
+
function git(args) { const r = spawnSync("git", args, { encoding: "utf8", maxBuffer: 128 * 1024 * 1024 }); return r.status === 0 ? (r.stdout || "") : ""; }
|
|
11
|
+
function readBriefCommits(max = 5000) {
|
|
12
|
+
const US = "\x1f", RS = "\x1e";
|
|
13
|
+
const meta = git(["log", "--no-merges", "-n", String(max), `--format=${RS}%H${US}%an${US}%at${US}%s${US}%b`]);
|
|
14
|
+
const byHash = new Map();
|
|
15
|
+
for (const blk of meta.split(RS)) {
|
|
16
|
+
if (!blk.trim())
|
|
17
|
+
continue;
|
|
18
|
+
const [h, a, t, s, ...r] = blk.split(US);
|
|
19
|
+
if (!h)
|
|
20
|
+
continue;
|
|
21
|
+
byHash.set(h.trim(), { hash: h.trim(), author: (a || "").trim(), ts: parseInt(t || "0", 10) || 0, subject: (s || "").trim(), body: (r.join(US) || "").trim(), files: [], churn: 0 });
|
|
22
|
+
}
|
|
23
|
+
const ns = git(["log", "--no-merges", "-n", String(max), "--numstat", `--format=${RS}%H`]);
|
|
24
|
+
for (const blk of ns.split(RS)) {
|
|
25
|
+
const lines = blk.split("\n").map((l) => l.trim()).filter(Boolean);
|
|
26
|
+
if (!lines.length)
|
|
27
|
+
continue;
|
|
28
|
+
const rec = byHash.get(lines[0]);
|
|
29
|
+
if (!rec)
|
|
30
|
+
continue;
|
|
31
|
+
for (const l of lines.slice(1)) {
|
|
32
|
+
const m = l.split("\t");
|
|
33
|
+
if (m.length < 3)
|
|
34
|
+
continue;
|
|
35
|
+
rec.churn += (parseInt(m[0], 10) || 0) + (parseInt(m[1], 10) || 0);
|
|
36
|
+
rec.files.push(m[2]);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return [...byHash.values()];
|
|
40
|
+
}
|
|
41
|
+
function todosAtHead() {
|
|
42
|
+
const o = git(["grep", "-nI", "-E", "TODO|FIXME|HACK|XXX", "HEAD", "--", "*.ts", "*.tsx", "*.js", "*.py", "*.go", "*.rs"]);
|
|
43
|
+
const out2 = [];
|
|
44
|
+
for (const l of o.split("\n")) {
|
|
45
|
+
const m = l.match(/^[^:]+:([^:]+):(\d+):(.*)$/);
|
|
46
|
+
if (m)
|
|
47
|
+
out2.push({ file: m[1], line: parseInt(m[2], 10), text: m[3].trim().slice(0, 120) });
|
|
48
|
+
if (out2.length >= 20)
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
return out2;
|
|
52
|
+
}
|
|
53
|
+
export function registerBriefCommands(program) {
|
|
54
|
+
program
|
|
55
|
+
.command("brief")
|
|
56
|
+
.description("🧭 REPO BRIEF (the Context Capsule) — fuse this repo's git history into ONE git-native shared-context object every agent inherits: the team (commit personas) · recent decisions · hot files · open TODOs · themes. Deterministic, cited, tamper-evident, local-first. The Path-A moat: shared CONTEXT for multi-agent teams, not a 'memory product'.")
|
|
57
|
+
.option("--json", "JSON output (the full signed-able brief)")
|
|
58
|
+
.action((opts) => {
|
|
59
|
+
const commits = readBriefCommits();
|
|
60
|
+
if (!commits.length) {
|
|
61
|
+
out("no commits found (run inside a git repo)");
|
|
62
|
+
process.exitCode = 2;
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const repoCommits = parseInt(git(["rev-list", "--count", "HEAD"]).trim(), 10) || commits.length;
|
|
66
|
+
const repo = (git(["config", "--get", "remote.origin.url"]).trim() || "").replace(/^https?:\/\//, "").replace(/\.git$/, "") || "(local)";
|
|
67
|
+
const b = repoBrief.buildRepoBrief(commits, { repo, repoCommits, openTodos: todosAtHead() });
|
|
68
|
+
if (opts.json) {
|
|
69
|
+
out(JSON.stringify(b, null, 2));
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
out(`🧭 REPO BRIEF — ${b.repo}`);
|
|
73
|
+
out(` ${b.reconciled.repoCommits} commits in repo · ${b.reconciled.merges} merge(s) excluded · ${b.reconciled.authoredCommits} authored · ${b.reconciled.contributors} contributors`);
|
|
74
|
+
if (b.themes.length)
|
|
75
|
+
out(`\n 🎯 Focus: ${b.themes.join(" · ")}`);
|
|
76
|
+
if (b.team.length) {
|
|
77
|
+
out(`\n 👥 Team:`);
|
|
78
|
+
for (const t of b.team)
|
|
79
|
+
out(` ${t.tier.padEnd(9)} ${t.archetype.padEnd(16)} ${t.author} (${t.commits} commits)`);
|
|
80
|
+
}
|
|
81
|
+
if (b.decisions.length) {
|
|
82
|
+
out(`\n 💡 Recent decisions:`);
|
|
83
|
+
for (const d of b.decisions.slice(0, 6))
|
|
84
|
+
out(` ${d.hash} ${d.subject}`);
|
|
85
|
+
}
|
|
86
|
+
if (b.hotFiles.length) {
|
|
87
|
+
out(`\n 🔥 Hot files:`);
|
|
88
|
+
for (const h of b.hotFiles.slice(0, 6))
|
|
89
|
+
out(` ${String(h.touches).padStart(3)}× ${h.file}`);
|
|
90
|
+
}
|
|
91
|
+
if (b.openTodos.length) {
|
|
92
|
+
out(`\n 📌 Open TODOs: ${b.openTodos.length} (e.g. ${b.openTodos[0].file}:${b.openTodos[0].line})`);
|
|
93
|
+
}
|
|
94
|
+
out(`\n 🧷 ${b.citations.length} citations · briefId ${b.briefId.slice(0, 16)}…`);
|
|
95
|
+
out(` ${b.note}`);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=brief.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brief.js","sourceRoot":"","sources":["../../src/commands/brief.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,SAAS,GAAG,CAAC,CAAS,IAAU,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AACjE,SAAS,GAAG,CAAC,IAAc,IAAY,MAAM,CAAC,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,I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/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA4MA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA+mNvD"}
|
package/dist/index.js
CHANGED
|
@@ -134,6 +134,7 @@ import { registerHpeCommands } from "./commands/hpe.js";
|
|
|
134
134
|
import { registerVericertCommands } from "./commands/vericert.js";
|
|
135
135
|
import { registerPersonaCommands } from "./commands/persona.js";
|
|
136
136
|
import { registerSeanceCommands } from "./commands/seance.js";
|
|
137
|
+
import { registerBriefCommands } from "./commands/brief.js";
|
|
137
138
|
import { registerMoatCommands } from "./commands/moat.js";
|
|
138
139
|
import { attachRegretOracle } from "./commands/regret.js";
|
|
139
140
|
import { registerTrustCommands } from "./commands/trust.js";
|
|
@@ -4825,6 +4826,7 @@ export async function run(argv) {
|
|
|
4825
4826
|
registerVericertCommands(program);
|
|
4826
4827
|
registerPersonaCommands(program);
|
|
4827
4828
|
registerSeanceCommands(program);
|
|
4829
|
+
registerBriefCommands(program);
|
|
4828
4830
|
registerMoatCommands(program);
|
|
4829
4831
|
// ─── Trust calibrator (v1.31.0) -- per-subsystem precision/recall/band
|
|
4830
4832
|
registerTrustCommands(program);
|