mneme-ai 2.175.0 → 2.187.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,17 @@
1
+ /**
2
+ * `mneme xray` (v2.187.0) — the Repo X-Ray, from the CLI. Runs the deterministic,
3
+ * signed, raw-free audit (deps · secrets · bus-factor · age · complexity · hotspots
4
+ * · coupling · security) on a local repo or a public git URL, and prints the grade +
5
+ * the team-intelligence gems (Keystone risk · Action plan · Momentum · Onboarding).
6
+ *
7
+ * mneme xray # analyse the current repo
8
+ * mneme xray ./path/to/repo # analyse a local path
9
+ * mneme xray https://github.com/owner/repo [--branch main]
10
+ * mneme xray --json # the full signed report
11
+ *
12
+ * The xray engine lives in @mneme-ai/xray (bundled with the CLI). Lazy-imported +
13
+ * fail-open so the core CLI still runs if the optional analysis package is absent.
14
+ */
15
+ import type { Command } from "commander";
16
+ export declare function registerXrayCommands(program: Command): void;
17
+ //# sourceMappingURL=xray.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xray.d.ts","sourceRoot":"","sources":["../../src/commands/xray.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0BzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAuD3D"}
@@ -0,0 +1,83 @@
1
+ import { existsSync } from "node:fs";
2
+ function out(s) { process.stdout.write(s + "\n"); }
3
+ async function load() {
4
+ try {
5
+ return (await import("@mneme-ai/xray"));
6
+ }
7
+ catch {
8
+ out("🩻 the X-Ray engine needs @mneme-ai/xray — install it: npm i @mneme-ai/xray");
9
+ return null;
10
+ }
11
+ }
12
+ const base = (f) => { const p = String(f).split("/"); return p[p.length - 1] || f; };
13
+ export function registerXrayCommands(program) {
14
+ program
15
+ .command("xray [target]")
16
+ .description("🩻 REPO X-RAY — a signed, deterministic audit of any repo (deps · secrets · bus-factor · age · complexity · coupling · security) + the team-intelligence gems (Keystone risk · Action plan · Momentum · Onboarding). No LLM guesses any number; the report is offline-verifiable. Pass a local path (default: current repo) or a public git URL.")
17
+ .option("--branch <name>", "branch to analyse (git-URL target)")
18
+ .option("--max-files <n>", "cap files scanned (perf bound)")
19
+ .option("--json", "print the full signed report as JSON")
20
+ .action(async (target, opts) => {
21
+ const api = await load();
22
+ if (!api) {
23
+ process.exitCode = 2;
24
+ return;
25
+ }
26
+ const isUrl = !!target && /^(https?:\/\/|git@)/.test(target);
27
+ const repoPath = isUrl ? undefined : (target || process.cwd());
28
+ if (repoPath && !existsSync(repoPath)) {
29
+ out(`path not found: ${repoPath}`);
30
+ process.exitCode = 2;
31
+ return;
32
+ }
33
+ const maxFiles = opts.maxFiles ? parseInt(opts.maxFiles, 10) : undefined;
34
+ let report;
35
+ try {
36
+ report = await api.buildXRay(isUrl ? { gitUrl: target, branch: opts.branch, maxFiles } : { repoPath, maxFiles });
37
+ }
38
+ catch (e) {
39
+ out(`🩻 X-Ray failed: ${e.message}`);
40
+ process.exitCode = 2;
41
+ return;
42
+ }
43
+ if (opts.json) {
44
+ try {
45
+ const signed = api.sealXRay(repoPath || process.cwd(), report);
46
+ out(JSON.stringify(signed, null, 2));
47
+ }
48
+ catch {
49
+ out(JSON.stringify(report, null, 2));
50
+ }
51
+ return;
52
+ }
53
+ const s = report.summary;
54
+ out("");
55
+ out(`🩻 X-RAY · ${report.subject.repoName}${report.subject.branch ? ` @ ${report.subject.branch}` : ""} [ ${s.grade} ]`);
56
+ out(` ${s.headline} · ${s.signalsRun} deterministic signals · @ ${String(report.subject.commitHash).slice(0, 10)}`);
57
+ for (const b of s.bullets.slice(0, 6))
58
+ out(` • ${b}`);
59
+ const mo = api.buildMomentum(report);
60
+ if (mo.verdict !== "unknown")
61
+ out(`\n📈 Momentum: ${mo.verdict} — ${mo.note}`);
62
+ const ks = api.buildKeystones(report, 3).keystones;
63
+ if (ks.length) {
64
+ out(`\n🔑 Keystone risk (single point of catastrophe):`);
65
+ for (const k of ks)
66
+ out(` ${base(k.file)} — ripples to ${k.partners} file(s), ${Math.round(k.ownerPct * 100)}% one author${k.expert ? ` · ask ${k.expert}` : ""}`);
67
+ }
68
+ const plan = api.buildActionPlan(report, 8).items;
69
+ if (plan.length) {
70
+ out(`\n✅ Action plan (ranked, each traceable):`);
71
+ for (const it of plan)
72
+ out(` [${it.sev.toUpperCase()}] ${it.icon} ${it.title} (${it.source})`);
73
+ }
74
+ const onb = api.buildOnboarding(report, 6).steps;
75
+ if (onb.length) {
76
+ out(`\n📖 Onboarding — read in this order:`);
77
+ onb.forEach((st, i) => out(` ${i + 1}. ${base(st.file)} — ${st.why}`));
78
+ }
79
+ out(`\n🔒 deterministic · Ed25519-signable · fingerprint ${String(report.fingerprint).slice(0, 16)}…`);
80
+ out(` full signed report: mneme xray${target ? ` ${target}` : ""} --json`);
81
+ });
82
+ }
83
+ //# sourceMappingURL=xray.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xray.js","sourceRoot":"","sources":["../../src/commands/xray.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,SAAS,GAAG,CAAC,CAAS,IAAU,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AAgBjE,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC;QAAC,OAAO,CAAC,MAAM,MAAM,CAAC,gBAA0B,CAAC,CAAuB,CAAC;IAAC,CAAC;IAChF,MAAM,CAAC;QAAC,GAAG,CAAC,6EAA6E,CAAC,CAAC;QAAC,OAAO,IAAI,CAAC;IAAC,CAAC;AAC5G,CAAC;AAED,MAAM,IAAI,GAAG,CAAC,CAAS,EAAU,EAAE,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC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,CAAC,KAAK,CAAC;QACjD,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;YACf,GAAG,CAAC,uCAAuC,CAAC,CAAC;YAC7C,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAC3E,CAAC;QAED,GAAG,CAAC,uDAAuD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;QACvG,GAAG,CAAC,oCAAoC,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiLA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAilNvD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAkLA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAklNvD"}
package/dist/index.js CHANGED
@@ -95,6 +95,7 @@ import { registerSteleCommands } from "./commands/stele.js";
95
95
  import { registerMembraneCommands } from "./commands/membrane.js";
96
96
  import { registerTrustlessCommands } from "./commands/trustless.js";
97
97
  import { registerMatrixCommands } from "./commands/matrix.js";
98
+ import { registerXrayCommands } from "./commands/xray.js";
98
99
  import { registerAdamasCommands } from "./commands/adamas.js";
99
100
  import { registerPrismCommands } from "./commands/prism.js";
100
101
  import { registerGoldilocksCommands } from "./commands/goldilocks.js";
@@ -4757,6 +4758,7 @@ export async function run(argv) {
4757
4758
  registerMembraneCommands(program);
4758
4759
  registerTrustlessCommands(program);
4759
4760
  registerMatrixCommands(program);
4761
+ registerXrayCommands(program);
4760
4762
  registerAdamasCommands(program);
4761
4763
  registerPrismCommands(program);
4762
4764
  registerGoldilocksCommands(program);