@vibgrate/cli 2026.727.1 → 2026.727.2
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/DOCS.md +0 -17
- package/README.md +0 -1
- package/dist/baseline-TG4ATZGZ.js +8 -0
- package/dist/{baseline-K7YBFKZI.js.map → baseline-TG4ATZGZ.js.map} +1 -1
- package/dist/{chunk-JZYGEZTU.js → chunk-2MBL43EJ.js} +3 -3
- package/dist/{chunk-JZYGEZTU.js.map → chunk-2MBL43EJ.js.map} +1 -1
- package/dist/{chunk-HABUT7HW.js → chunk-2XQDMLKB.js} +240 -8
- package/dist/chunk-2XQDMLKB.js.map +1 -0
- package/dist/{chunk-VXGV6NTD.js → chunk-3V24O47U.js} +11 -9
- package/dist/chunk-3V24O47U.js.map +1 -0
- package/dist/{chunk-6IOQJGFT.js → chunk-6ABXHZRN.js} +34 -77
- package/dist/chunk-6ABXHZRN.js.map +1 -0
- package/dist/{chunk-4CQ3MGNN.js → chunk-6AYDFFP5.js} +3 -3
- package/dist/{chunk-4CQ3MGNN.js.map → chunk-6AYDFFP5.js.map} +1 -1
- package/dist/chunk-6UQMXIAG.js +122 -0
- package/dist/chunk-6UQMXIAG.js.map +1 -0
- package/dist/{chunk-KHJO4D5N.js → chunk-7N4Y3E47.js} +2 -2
- package/dist/{chunk-KHJO4D5N.js.map → chunk-7N4Y3E47.js.map} +1 -1
- package/dist/{chunk-OXQNQW5J.js → chunk-CY4WKXB2.js} +4 -4
- package/dist/{chunk-OXQNQW5J.js.map → chunk-CY4WKXB2.js.map} +1 -1
- package/dist/chunk-DGUM43GV.js +10 -0
- package/dist/chunk-DGUM43GV.js.map +1 -0
- package/dist/{chunk-HYZVHJ3Q.js → chunk-EX4PQT6W.js} +3 -3
- package/dist/{chunk-HYZVHJ3Q.js.map → chunk-EX4PQT6W.js.map} +1 -1
- package/dist/{chunk-3BVSDMHV.js → chunk-J4RFRKZH.js} +7 -7
- package/dist/{chunk-3BVSDMHV.js.map → chunk-J4RFRKZH.js.map} +1 -1
- package/dist/chunk-K3MZIVZW.js +88 -0
- package/dist/chunk-K3MZIVZW.js.map +1 -0
- package/dist/{chunk-65MEOA4E.js → chunk-KCKYKDMS.js} +9 -8
- package/dist/chunk-KCKYKDMS.js.map +1 -0
- package/dist/{chunk-S6CYDZEW.js → chunk-KNELIQJO.js} +364 -179
- package/dist/chunk-KNELIQJO.js.map +1 -0
- package/dist/{chunk-EDAAG7BL.js → chunk-KSBHGWRV.js} +4 -3
- package/dist/chunk-KSBHGWRV.js.map +1 -0
- package/dist/{chunk-C4CKTAZP.js → chunk-LKVMI67M.js} +4 -4
- package/dist/chunk-LKVMI67M.js.map +1 -0
- package/dist/{chunk-7JHPQ6WF.js → chunk-OFUC6RYN.js} +3 -3
- package/dist/{chunk-7JHPQ6WF.js.map → chunk-OFUC6RYN.js.map} +1 -1
- package/dist/{chunk-YDAT7LD2.js → chunk-RNP3SMTV.js} +17 -9
- package/dist/chunk-RNP3SMTV.js.map +1 -0
- package/dist/{chunk-SZLF66FJ.js → chunk-TCDAZZNP.js} +5 -5
- package/dist/{chunk-SZLF66FJ.js.map → chunk-TCDAZZNP.js.map} +1 -1
- package/dist/{chunk-WLETRGAC.js → chunk-WGUL45AV.js} +11 -11
- package/dist/{chunk-WLETRGAC.js.map → chunk-WGUL45AV.js.map} +1 -1
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +97 -240
- package/dist/cli.js.map +1 -1
- package/dist/{execution-env-3BN7Z737.js → execution-env-ZU45JZ4G.js} +3 -2
- package/dist/{execution-env-3BN7Z737.js.map → execution-env-ZU45JZ4G.js.map} +1 -1
- package/dist/{federation-EPZDUWCK.js → federation-SZWZIFZ7.js} +3 -2
- package/dist/{federation-EPZDUWCK.js.map → federation-SZWZIFZ7.js.map} +1 -1
- package/dist/{fs-IPY4FJKH.js → fs-B5HZ2MIU.js} +3 -2
- package/dist/fs-B5HZ2MIU.js.map +1 -0
- package/dist/{fs-KCABDURV.js → fs-O5IQYXHO.js} +3 -2
- package/dist/fs-O5IQYXHO.js.map +1 -0
- package/dist/{git-ref-HPRLUFFW.js → git-ref-XDXB6JP5.js} +3 -2
- package/dist/{git-ref-HPRLUFFW.js.map → git-ref-XDXB6JP5.js.map} +1 -1
- package/dist/graph-backend-73URGTFY.js +11 -0
- package/dist/{graph-backend-ZMSYOZMW.js.map → graph-backend-73URGTFY.js.map} +1 -1
- package/dist/index.d.ts +44 -15
- package/dist/index.js +9 -8
- package/dist/index.js.map +1 -1
- package/dist/{interactive-ICL7D7LO.js → interactive-372NLI5C.js} +19 -18
- package/dist/interactive-372NLI5C.js.map +1 -0
- package/dist/{llm-host-2RAYQSDQ.js → llm-host-7GWDO6IX.js} +3 -2
- package/dist/{llm-host-2RAYQSDQ.js.map → llm-host-7GWDO6IX.js.map} +1 -1
- package/dist/load-I333TGNI.js +8 -0
- package/dist/{load-OHVKDX4R.js.map → load-I333TGNI.js.map} +1 -1
- package/dist/local-runtime-5O2NN3GA.js +5 -0
- package/dist/{local-runtime-OJFLX2HI.js.map → local-runtime-5O2NN3GA.js.map} +1 -1
- package/dist/mcp-tools-I7JK3S2M.js +4 -0
- package/dist/{mcp-tools-I6PME3AV.js.map → mcp-tools-I7JK3S2M.js.map} +1 -1
- package/dist/{model-execution-profile-MQ2QCP24.js → model-execution-profile-TFBKCNJG.js} +3 -2
- package/dist/{model-execution-profile-MQ2QCP24.js.map → model-execution-profile-TFBKCNJG.js.map} +1 -1
- package/dist/{model-orchestrator-FFTZI3U2.js → model-orchestrator-TVONAUPS.js} +5 -4
- package/dist/{model-orchestrator-FFTZI3U2.js.map → model-orchestrator-TVONAUPS.js.map} +1 -1
- package/dist/parse-worker.d.ts +1 -1
- package/dist/parse-worker.js +1 -0
- package/dist/parse-worker.js.map +1 -1
- package/dist/{paths-MCH75O3G.js → paths-2RAH3GME.js} +3 -2
- package/dist/{paths-MCH75O3G.js.map → paths-2RAH3GME.js.map} +1 -1
- package/dist/{resolve-gguf-4UPIGPEE.js → resolve-gguf-VPL4YQ6J.js} +3 -2
- package/dist/{resolve-gguf-4UPIGPEE.js.map → resolve-gguf-VPL4YQ6J.js.map} +1 -1
- package/dist/runtime-session-JRKCQUHY.js +18 -0
- package/dist/{runtime-session-IDU5BDUJ.js.map → runtime-session-JRKCQUHY.js.map} +1 -1
- package/dist/session-ITPYQ5XI.js +11 -0
- package/dist/{session-L2OSDRPI.js.map → session-ITPYQ5XI.js.map} +1 -1
- package/dist/session-store-WFBX7HXL.js +4 -0
- package/dist/{session-store-W5RZZHA3.js.map → session-store-WFBX7HXL.js.map} +1 -1
- package/dist/{stream-json-F74W5FCK.js → stream-json-SLMDKLXP.js} +10 -9
- package/dist/stream-json-SLMDKLXP.js.map +1 -0
- package/dist/{types-ZMg1mSuu.d.ts → types-7AHBUbFm.d.ts} +5 -1
- package/dist/ui-Q6DJ3GCU.js +5 -0
- package/dist/ui-Q6DJ3GCU.js.map +1 -0
- package/dist/{vgd-EGBQD7BW.js → vgd-7JV5KCNJ.js} +7 -6
- package/dist/vgd-7JV5KCNJ.js.map +1 -0
- package/package.json +1 -1
- package/dist/baseline-K7YBFKZI.js +0 -7
- package/dist/chunk-5Q54GEHM.js +0 -29
- package/dist/chunk-5Q54GEHM.js.map +0 -1
- package/dist/chunk-65MEOA4E.js.map +0 -1
- package/dist/chunk-6IOQJGFT.js.map +0 -1
- package/dist/chunk-C4CKTAZP.js.map +0 -1
- package/dist/chunk-EDAAG7BL.js.map +0 -1
- package/dist/chunk-EDBV33B7.js +0 -57
- package/dist/chunk-EDBV33B7.js.map +0 -1
- package/dist/chunk-HABUT7HW.js.map +0 -1
- package/dist/chunk-S6CYDZEW.js.map +0 -1
- package/dist/chunk-VXGV6NTD.js.map +0 -1
- package/dist/chunk-YDAT7LD2.js.map +0 -1
- package/dist/fs-IPY4FJKH.js.map +0 -1
- package/dist/fs-KCABDURV.js.map +0 -1
- package/dist/graph-backend-ZMSYOZMW.js +0 -10
- package/dist/interactive-ICL7D7LO.js.map +0 -1
- package/dist/load-OHVKDX4R.js +0 -7
- package/dist/local-runtime-OJFLX2HI.js +0 -4
- package/dist/mcp-tools-I6PME3AV.js +0 -3
- package/dist/runtime-session-IDU5BDUJ.js +0 -17
- package/dist/session-L2OSDRPI.js +0 -10
- package/dist/session-store-W5RZZHA3.js +0 -3
- package/dist/stream-json-F74W5FCK.js.map +0 -1
- package/dist/ui-HOVOPWMX.js +0 -4
- package/dist/ui-HOVOPWMX.js.map +0 -1
- package/dist/vgd-EGBQD7BW.js.map +0 -1
package/DOCS.md
CHANGED
|
@@ -30,7 +30,6 @@ For a quick overview, see the [README](./README.md). This document covers everyt
|
|
|
30
30
|
- [vg push](#vg-push)
|
|
31
31
|
- [Code Graph Commands](#code-graph-commands)
|
|
32
32
|
- [vg ask](#vg-ask)
|
|
33
|
-
- [vg benchmark](#vg-benchmark)
|
|
34
33
|
- [vg build](#vg-build)
|
|
35
34
|
- [vg bundle](#vg-bundle)
|
|
36
35
|
- [vg code](#vg-code)
|
|
@@ -649,22 +648,6 @@ Before answering, `ask` checks whether files changed since the map was last buil
|
|
|
649
648
|
|
|
650
649
|
---
|
|
651
650
|
|
|
652
|
-
### vg benchmark
|
|
653
|
-
|
|
654
|
-
A reproducible build + memory + token-reduction benchmark for this repository — honest, self-measured estimates you can re-run.
|
|
655
|
-
|
|
656
|
-
```bash
|
|
657
|
-
vg benchmark
|
|
658
|
-
```
|
|
659
|
-
|
|
660
|
-
| Flag | Default | Description |
|
|
661
|
-
|------|---------|-------------|
|
|
662
|
-
| `--budget <n>` | `2000` | Approx token budget used when estimating context savings |
|
|
663
|
-
|
|
664
|
-
Add `--json` for machine-readable output.
|
|
665
|
-
|
|
666
|
-
---
|
|
667
|
-
|
|
668
651
|
### vg build
|
|
669
652
|
|
|
670
653
|
Build or update the code map incrementally.
|
package/README.md
CHANGED
|
@@ -302,7 +302,6 @@ Under each set, commands are listed A–Z. A short **typical path** (usual order
|
|
|
302
302
|
| Command | Description |
|
|
303
303
|
| --- | --- |
|
|
304
304
|
| `vg ask "<question>"` | Query the map in natural language |
|
|
305
|
-
| `vg benchmark` | Reproducible build + memory + token-reduction benchmark (honest estimates) |
|
|
306
305
|
| `vg build [path]` | Build / update the code map (incremental, deterministic) |
|
|
307
306
|
| `vg bundle` | Build an air-gapped bundle (grammars + graph + library catalog) |
|
|
308
307
|
| `vg code "<instruction>"` | Propose a graph-grounded code edit (dry-run by default; `--apply --yes` to write) |
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { baselineCommand, runBaseline } from './chunk-EX4PQT6W.js';
|
|
2
|
+
import './chunk-WGUL45AV.js';
|
|
3
|
+
import './chunk-RXP66R2E.js';
|
|
4
|
+
import './chunk-GI6W53LM.js';
|
|
5
|
+
import './chunk-CRAMOEBE.js';
|
|
6
|
+
import './chunk-DGUM43GV.js';
|
|
7
|
+
//# sourceMappingURL=baseline-TG4ATZGZ.js.map
|
|
8
|
+
//# sourceMappingURL=baseline-TG4ATZGZ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"baseline-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"baseline-TG4ATZGZ.js"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { startVgdServer } from './chunk-
|
|
1
|
+
import { startVgdServer } from './chunk-TCDAZZNP.js';
|
|
2
2
|
import { vgdIsRunning, vgdRequest } from './chunk-PMYWZRRS.js';
|
|
3
3
|
|
|
4
4
|
// src/code/runtime-session.ts
|
|
@@ -78,5 +78,5 @@ function noneSession() {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
export { startCodeRuntimeSession };
|
|
81
|
-
//# sourceMappingURL=chunk-
|
|
82
|
-
//# sourceMappingURL=chunk-
|
|
81
|
+
//# sourceMappingURL=chunk-2MBL43EJ.js.map
|
|
82
|
+
//# sourceMappingURL=chunk-2MBL43EJ.js.map
|
|
@@ -1 +1 @@
|
|
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C6B;AAC7B,EAAA,MAAM,MAAA,GAAS,MAAM,WAAA,CAAY,EAAE,YAAY,CAAA;AAC/C,EAAA,MAAM,UAAA,GAAa,EAAE,UAAA,EAAY,MAAA,CAAO,UAAA,EAAW;AACnD,EAAA,IAAI,SAAA;AACJ,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,GAAM,MAAM,OAAA,CAAQ,EAAE,IAAI,UAAA,EAAY,IAAA,IAAQ,UAAU,CAAA;AAC9D,IAAA,IAAI,GAAA,CAAI,EAAA,IAAM,WAAA,IAAe,GAAA,cAAiB,GAAA,CAAI,SAAA;AAAA,EACpD,CAAA,CAAA,MAAQ;AAAA,EAER;AACA,EAAA,IAAI,QAAA,GAAW,KAAA;AACf,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,OAAA;AAAA,IACN,KAAK,OAAA,CAAQ,GAAA;AAAA,IACb,SAAA;AAAA,IACA,YAAY,MAAA,CAAO,UAAA;AAAA,IACnB,KAAA,EAAO,CAAA,aAAA,CAAA;AAAA,IACP,MAAM,OAAA,GAAU;AACd,MAAA,IAAI,QAAA,EAAU;AACd,MAAA,QAAA,GAAW,IAAA;AACX,MAAA,IAAI;AACF,QAAA,MAAM,OAAO,KAAA,EAAM;AAAA,MACrB,CAAA,CAAA,MAAQ;AAAA,MAER;AAAA,IACF;AAAA,GACF;AACF;AAEA,SAAS,WAAA,GAAkC;AACzC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,MAAA;AAAA,IACN,GAAA,EAAK,MAAA;AAAA,IACL,SAAA,EAAW,MAAA;AAAA,IACX,UAAA,EAAY,MAAA;AAAA,IACZ,KAAA,EAAO,EAAA;AAAA,IACP,MAAM,OAAA,GAAU;AAAA,IAEhB;AAAA,GACF;AACF","file":"chunk-2MBL43EJ.js","sourcesContent":["/**\n * Session boundary between VG Code and the Fusion Runtime daemon (`vgd`).\n *\n * Replaces the old {@link GraphProcess} (`vg serve` child) for the interactive\n * coding REPL. Behaviour:\n *\n * 1. If a local vgd is already running — register this workspace and leave the\n * daemon running when the session ends (unregister only).\n * 2. Otherwise — start an **in-process** vgd for the life of the session and\n * tear it down on dispose. No second OS process, no `vg serve` spawn.\n *\n * Never throws: a failure to attach degrades to “no runtime session” and the\n * agent continues with the in-process graph only (same safety as GraphProcess).\n */\n\nimport { startVgdServer, vgdIsRunning, vgdRequest, type VgdServer } from '../runtime/vgd/index.js';\nimport type { WorkspaceRecord } from '../runtime/vgd/protocol.js';\n\nexport type RuntimeSessionKind = 'attached' | 'owned' | 'none';\n\nexport interface RuntimeSessionOptions {\n root: string;\n /** Override socket path (tests). */\n socketPath?: string;\n /** Injectable connect/start hooks (tests). */\n isRunning?: (socketPath?: string) => Promise<boolean>;\n request?: typeof vgdRequest;\n startServer?: (opts: { socketPath?: string }) => Promise<VgdServer>;\n}\n\nexport interface CodeRuntimeSession {\n readonly kind: RuntimeSessionKind;\n /** Daemon pid when known (attached status or owned process). */\n readonly pid: number | undefined;\n readonly workspace: WorkspaceRecord | undefined;\n readonly socketPath: string | undefined;\n /** Human label for the REPL intro line. */\n readonly label: string;\n dispose(): Promise<void>;\n}\n\n/**\n * Attach VG Code to vgd for one coding session. Always resolves (never throws).\n */\nexport async function startCodeRuntimeSession(options: RuntimeSessionOptions): Promise<CodeRuntimeSession> {\n const socketPath = options.socketPath;\n const isRunning = options.isRunning ?? ((sp?: string) => vgdIsRunning({ socketPath: sp }));\n const request = options.request ?? vgdRequest;\n const startServer = options.startServer ?? ((opts: { socketPath?: string }) => startVgdServer(opts));\n\n try {\n if (await isRunning(socketPath)) {\n return await attachExisting(options.root, socketPath, request);\n }\n return await startOwned(options.root, socketPath, startServer, request);\n } catch {\n return noneSession();\n }\n}\n\nasync function attachExisting(\n root: string,\n socketPath: string | undefined,\n request: typeof vgdRequest,\n): Promise<CodeRuntimeSession> {\n const clientOpts = { socketPath };\n const reg = await request({ op: 'register', root }, clientOpts);\n if (!reg.ok || !('workspace' in reg)) return noneSession();\n const status = await request({ op: 'status' }, clientOpts).catch(() => null);\n const pid = status && status.ok && 'pid' in status ? status.pid : undefined;\n let disposed = false;\n return {\n kind: 'attached',\n pid,\n workspace: reg.workspace,\n socketPath: status && status.ok && 'socketPath' in status ? status.socketPath : socketPath,\n label: pid != null ? `vgd ${pid}` : 'vgd',\n async dispose() {\n if (disposed) return;\n disposed = true;\n try {\n await request({ op: 'unregister', root }, clientOpts);\n } catch {\n /* best-effort */\n }\n },\n };\n}\n\nasync function startOwned(\n root: string,\n socketPath: string | undefined,\n startServer: (opts: { socketPath?: string }) => Promise<VgdServer>,\n request: typeof vgdRequest,\n): Promise<CodeRuntimeSession> {\n const server = await startServer({ socketPath });\n const clientOpts = { socketPath: server.socketPath };\n let workspace: WorkspaceRecord | undefined;\n try {\n const reg = await request({ op: 'register', root }, clientOpts);\n if (reg.ok && 'workspace' in reg) workspace = reg.workspace;\n } catch {\n /* registry optional for an empty session */\n }\n let disposed = false;\n return {\n kind: 'owned',\n pid: process.pid,\n workspace,\n socketPath: server.socketPath,\n label: `vgd (session)`,\n async dispose() {\n if (disposed) return;\n disposed = true;\n try {\n await server.close();\n } catch {\n /* best-effort */\n }\n },\n };\n}\n\nfunction noneSession(): CodeRuntimeSession {\n return {\n kind: 'none',\n pid: undefined,\n workspace: undefined,\n socketPath: undefined,\n label: '',\n async dispose() {\n /* no-op */\n },\n };\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { stableStringify, serializeGraph, parseGraph } from './chunk-
|
|
1
|
+
import { stableStringify, serializeGraph, parseGraph, cacheDir } from './chunk-K3MZIVZW.js';
|
|
2
2
|
import { globalGraphPathForRef, globalGraphPath, repositoryStoreDir } from './chunk-BWPBB45M.js';
|
|
3
3
|
import { detectGitRef } from './chunk-BPF3YX2U.js';
|
|
4
|
+
import { __require } from './chunk-DGUM43GV.js';
|
|
4
5
|
import * as fs from 'fs';
|
|
5
6
|
import * as path from 'path';
|
|
6
7
|
|
|
@@ -70,12 +71,42 @@ function renderReport(graph) {
|
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
// src/engine/html.ts
|
|
74
|
+
var EMBED_NODE_LIMIT = 5e3;
|
|
73
75
|
function renderHtml(graph) {
|
|
74
76
|
const top = graph.nodes.filter((n) => n.kind !== "file" && n.kind !== "external").sort((a, b) => b.importance - a.importance || a.qualifiedName.localeCompare(b.qualifiedName)).slice(0, 50);
|
|
77
|
+
const areas = [...graph.areas].sort((a, b) => b.size - a.size || a.id - b.id).slice(0, 40);
|
|
75
78
|
const rows = top.map(
|
|
76
79
|
(n) => `<tr><td><code>${esc(n.qualifiedName)}</code></td><td>${esc(n.kind)}</td><td><code>${esc(n.file)}</code>:${n.span.start}</td><td>${n.importance.toFixed(3)}</td></tr>`
|
|
77
80
|
).join("\n");
|
|
78
|
-
const
|
|
81
|
+
const areaRows = areas.map(
|
|
82
|
+
(a) => `<tr><td>${a.id}</td><td><code>${esc(a.label)}</code></td><td>${a.size}</td><td>${a.cohesion.toFixed(3)}</td><td>${a.externalEdges}</td></tr>`
|
|
83
|
+
).join("\n");
|
|
84
|
+
const large = graph.meta.counts.nodes > EMBED_NODE_LIMIT;
|
|
85
|
+
const embedPayload = large ? {
|
|
86
|
+
schemaVersion: graph.schemaVersion,
|
|
87
|
+
generatedAt: graph.generatedAt,
|
|
88
|
+
provenance: graph.provenance,
|
|
89
|
+
meta: graph.meta,
|
|
90
|
+
hubs: top.map((n) => ({
|
|
91
|
+
id: n.id,
|
|
92
|
+
name: n.qualifiedName,
|
|
93
|
+
kind: n.kind,
|
|
94
|
+
file: n.file,
|
|
95
|
+
line: n.span.start,
|
|
96
|
+
importance: n.importance,
|
|
97
|
+
area: n.area
|
|
98
|
+
})),
|
|
99
|
+
areas: areas.map((a) => ({
|
|
100
|
+
id: a.id,
|
|
101
|
+
label: a.label,
|
|
102
|
+
size: a.size,
|
|
103
|
+
cohesion: a.cohesion,
|
|
104
|
+
externalEdges: a.externalEdges
|
|
105
|
+
})),
|
|
106
|
+
note: `Full graph omitted (${graph.meta.counts.nodes} nodes > ${EMBED_NODE_LIMIT}). Use graph.json or .vibgrate/cache/graph.db.`
|
|
107
|
+
} : graph;
|
|
108
|
+
const embedded = stableStringify(embedPayload, 0);
|
|
109
|
+
const tier = graph.meta.analysisTier ?? "full";
|
|
79
110
|
return `<!doctype html>
|
|
80
111
|
<html lang="en">
|
|
81
112
|
<head>
|
|
@@ -90,21 +121,31 @@ function renderHtml(graph) {
|
|
|
90
121
|
th, td { text-align: left; padding: 4px 8px; border-bottom: 1px solid #8884; }
|
|
91
122
|
td:last-child, th:last-child { text-align: right; }
|
|
92
123
|
.meta { color: #888; } code { font-size: 0.9em; }
|
|
124
|
+
.banner { background: #8882; padding: 0.6rem 0.8rem; border-radius: 6px; margin: 1rem 0; }
|
|
93
125
|
</style>
|
|
94
126
|
</head>
|
|
95
127
|
<body>
|
|
96
128
|
<h1>vg \xB7 code graph</h1>
|
|
97
129
|
<p class="meta">${graph.meta.counts.nodes} nodes \xB7 ${graph.meta.counts.edges} edges \xB7
|
|
98
130
|
${graph.meta.counts.areas} areas \xB7 ${esc(graph.meta.languages.join(", ") || "\u2014")} \xB7
|
|
99
|
-
clustering: ${esc(graph.meta.cluster)} \xB7 vg ${esc(graph.provenance.version)}</p>
|
|
100
|
-
|
|
131
|
+
clustering: ${esc(graph.meta.cluster)} \xB7 tier: ${esc(tier)} \xB7 vg ${esc(graph.provenance.version)}</p>
|
|
132
|
+
${large ? `<p class="banner">Large map (${graph.meta.counts.nodes} nodes): HTML shows hubs + areas only.
|
|
133
|
+
Full graph remains in <code>graph.json</code> / <code>.vibgrate/cache/graph.db</code> (query via <code>vg serve</code>).</p>` : ""}
|
|
134
|
+
<h2>Areas (subsystems)</h2>
|
|
135
|
+
<table>
|
|
136
|
+
<thead><tr><th>Id</th><th>Label</th><th>Size</th><th>Cohesion</th><th>External</th></tr></thead>
|
|
137
|
+
<tbody>
|
|
138
|
+
${areaRows || '<tr><td colspan="5" class="meta">no areas</td></tr>'}
|
|
139
|
+
</tbody>
|
|
140
|
+
</table>
|
|
141
|
+
<h2>Most-connected definitions (hubs)</h2>
|
|
101
142
|
<table>
|
|
102
143
|
<thead><tr><th>Symbol</th><th>Kind</th><th>Location</th><th>Importance</th></tr></thead>
|
|
103
144
|
<tbody>
|
|
104
145
|
${rows}
|
|
105
146
|
</tbody>
|
|
106
147
|
</table>
|
|
107
|
-
<p class="meta"
|
|
148
|
+
<p class="meta">${large ? "Summary payload" : "Full graph"} embedded below for tooling.</p>
|
|
108
149
|
<script type="application/json" id="vg-graph">
|
|
109
150
|
${embedded}
|
|
110
151
|
</script>
|
|
@@ -221,13 +262,204 @@ function isPathInside(child, parent) {
|
|
|
221
262
|
return rel === "" || !rel.startsWith("..") && !path.isAbsolute(rel);
|
|
222
263
|
}
|
|
223
264
|
|
|
265
|
+
// src/schema.ts
|
|
266
|
+
var SCHEMA_VERSION = "vg-graph/1.0";
|
|
267
|
+
|
|
268
|
+
// src/engine/index-db.ts
|
|
269
|
+
function indexDbPath(root) {
|
|
270
|
+
return path.join(cacheDir(root), "graph.db");
|
|
271
|
+
}
|
|
272
|
+
function writeGraphIndex(root, graph) {
|
|
273
|
+
const file = indexDbPath(root);
|
|
274
|
+
try {
|
|
275
|
+
const { DatabaseSync } = __require("sqlite");
|
|
276
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
277
|
+
const tmp = `${file}.${process.pid}.tmp`;
|
|
278
|
+
try {
|
|
279
|
+
if (fs.existsSync(tmp)) fs.unlinkSync(tmp);
|
|
280
|
+
} catch {
|
|
281
|
+
}
|
|
282
|
+
const db = new DatabaseSync(tmp);
|
|
283
|
+
db.exec(`
|
|
284
|
+
PRAGMA journal_mode = OFF;
|
|
285
|
+
PRAGMA synchronous = OFF;
|
|
286
|
+
CREATE TABLE meta (
|
|
287
|
+
key TEXT PRIMARY KEY,
|
|
288
|
+
value TEXT NOT NULL
|
|
289
|
+
);
|
|
290
|
+
CREATE TABLE nodes (
|
|
291
|
+
id TEXT PRIMARY KEY,
|
|
292
|
+
name TEXT NOT NULL,
|
|
293
|
+
qualified_name TEXT NOT NULL,
|
|
294
|
+
kind TEXT NOT NULL,
|
|
295
|
+
file TEXT NOT NULL,
|
|
296
|
+
line INTEGER NOT NULL,
|
|
297
|
+
importance REAL NOT NULL,
|
|
298
|
+
area INTEGER NOT NULL,
|
|
299
|
+
is_hub INTEGER NOT NULL,
|
|
300
|
+
lang TEXT NOT NULL,
|
|
301
|
+
json TEXT NOT NULL
|
|
302
|
+
);
|
|
303
|
+
CREATE TABLE edges (
|
|
304
|
+
id TEXT PRIMARY KEY,
|
|
305
|
+
kind TEXT NOT NULL,
|
|
306
|
+
src TEXT NOT NULL,
|
|
307
|
+
dst TEXT NOT NULL,
|
|
308
|
+
resolution TEXT NOT NULL,
|
|
309
|
+
confidence REAL NOT NULL,
|
|
310
|
+
epistemic TEXT NOT NULL,
|
|
311
|
+
json TEXT NOT NULL
|
|
312
|
+
);
|
|
313
|
+
CREATE TABLE areas (
|
|
314
|
+
id INTEGER PRIMARY KEY,
|
|
315
|
+
json TEXT NOT NULL
|
|
316
|
+
);
|
|
317
|
+
CREATE INDEX idx_nodes_name ON nodes(name);
|
|
318
|
+
CREATE INDEX idx_nodes_qn ON nodes(qualified_name);
|
|
319
|
+
CREATE INDEX idx_nodes_file ON nodes(file);
|
|
320
|
+
CREATE INDEX idx_edges_src ON edges(src);
|
|
321
|
+
CREATE INDEX idx_edges_dst ON edges(dst);
|
|
322
|
+
CREATE INDEX idx_edges_kind ON edges(kind);
|
|
323
|
+
`);
|
|
324
|
+
const insMeta = db.prepare("INSERT INTO meta(key, value) VALUES (?, ?)");
|
|
325
|
+
insMeta.run("corpusHash", graph.provenance.corpusHash);
|
|
326
|
+
insMeta.run("schemaVersion", graph.schemaVersion);
|
|
327
|
+
insMeta.run("generatedAt", graph.generatedAt);
|
|
328
|
+
insMeta.run("nodeCount", String(graph.nodes.length));
|
|
329
|
+
insMeta.run("edgeCount", String(graph.edges.length));
|
|
330
|
+
insMeta.run("analysisTier", graph.meta.analysisTier ?? "full");
|
|
331
|
+
insMeta.run("indexVersion", "vg-graph-index/2");
|
|
332
|
+
insMeta.run("graphMeta", JSON.stringify(graph.meta));
|
|
333
|
+
insMeta.run("graphProvenance", JSON.stringify(graph.provenance));
|
|
334
|
+
if (graph.facts) insMeta.run("factsJson", JSON.stringify(graph.facts));
|
|
335
|
+
if (graph.grounding) insMeta.run("groundingJson", JSON.stringify(graph.grounding));
|
|
336
|
+
const insNode = db.prepare(
|
|
337
|
+
`INSERT INTO nodes(id, name, qualified_name, kind, file, line, importance, area, is_hub, lang, json)
|
|
338
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
|
|
339
|
+
);
|
|
340
|
+
for (const n of graph.nodes) {
|
|
341
|
+
insNode.run(
|
|
342
|
+
n.id,
|
|
343
|
+
n.name,
|
|
344
|
+
n.qualifiedName,
|
|
345
|
+
n.kind,
|
|
346
|
+
n.file,
|
|
347
|
+
n.span.start,
|
|
348
|
+
n.importance,
|
|
349
|
+
n.area,
|
|
350
|
+
n.isHub ? 1 : 0,
|
|
351
|
+
n.lang,
|
|
352
|
+
JSON.stringify(n)
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
const insEdge = db.prepare(
|
|
356
|
+
`INSERT INTO edges(id, kind, src, dst, resolution, confidence, epistemic, json)
|
|
357
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`
|
|
358
|
+
);
|
|
359
|
+
for (const e of graph.edges) {
|
|
360
|
+
insEdge.run(
|
|
361
|
+
e.id,
|
|
362
|
+
e.kind,
|
|
363
|
+
e.src,
|
|
364
|
+
e.dst,
|
|
365
|
+
e.resolution,
|
|
366
|
+
e.confidence,
|
|
367
|
+
e.epistemic ?? "observed",
|
|
368
|
+
JSON.stringify(e)
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
const insArea = db.prepare("INSERT INTO areas(id, json) VALUES (?, ?)");
|
|
372
|
+
for (const a of graph.areas) {
|
|
373
|
+
insArea.run(a.id, JSON.stringify(a));
|
|
374
|
+
}
|
|
375
|
+
db.close();
|
|
376
|
+
fs.renameSync(tmp, file);
|
|
377
|
+
return { path: file, nodes: graph.nodes.length, edges: graph.edges.length, ok: true };
|
|
378
|
+
} catch (err) {
|
|
379
|
+
return {
|
|
380
|
+
path: file,
|
|
381
|
+
nodes: 0,
|
|
382
|
+
edges: 0,
|
|
383
|
+
ok: false,
|
|
384
|
+
reason: err.message
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
function loadGraphFromIndex(root) {
|
|
389
|
+
const file = indexDbPath(root);
|
|
390
|
+
if (!fs.existsSync(file)) return null;
|
|
391
|
+
try {
|
|
392
|
+
const { DatabaseSync } = __require("sqlite");
|
|
393
|
+
const db = new DatabaseSync(file, { readOnly: true });
|
|
394
|
+
const metaRows = db.prepare("SELECT key, value FROM meta").all();
|
|
395
|
+
const meta = {};
|
|
396
|
+
for (const r of metaRows) meta[r.key] = r.value;
|
|
397
|
+
if (meta.indexVersion !== "vg-graph-index/2" || !meta.graphMeta || !meta.graphProvenance) {
|
|
398
|
+
db.close();
|
|
399
|
+
return null;
|
|
400
|
+
}
|
|
401
|
+
const nodeRows = db.prepare("SELECT json FROM nodes ORDER BY id").all();
|
|
402
|
+
const edgeRows = db.prepare("SELECT json FROM edges ORDER BY id").all();
|
|
403
|
+
const areaRows = db.prepare("SELECT json FROM areas ORDER BY id").all();
|
|
404
|
+
db.close();
|
|
405
|
+
const nodes = nodeRows.map((r) => JSON.parse(r.json));
|
|
406
|
+
const edges = edgeRows.map((r) => JSON.parse(r.json));
|
|
407
|
+
const areas = areaRows.map((r) => JSON.parse(r.json));
|
|
408
|
+
nodes.sort((a, b) => a.id.localeCompare(b.id));
|
|
409
|
+
edges.sort(
|
|
410
|
+
(a, b) => a.kind.localeCompare(b.kind) || a.src.localeCompare(b.src) || a.dst.localeCompare(b.dst)
|
|
411
|
+
);
|
|
412
|
+
areas.sort((a, b) => a.id - b.id);
|
|
413
|
+
const graph = {
|
|
414
|
+
schemaVersion: meta.schemaVersion || SCHEMA_VERSION,
|
|
415
|
+
generatedAt: meta.generatedAt ?? (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
416
|
+
provenance: JSON.parse(meta.graphProvenance),
|
|
417
|
+
meta: JSON.parse(meta.graphMeta),
|
|
418
|
+
nodes,
|
|
419
|
+
edges,
|
|
420
|
+
areas
|
|
421
|
+
};
|
|
422
|
+
if (meta.factsJson) graph.facts = JSON.parse(meta.factsJson);
|
|
423
|
+
if (meta.groundingJson) graph.grounding = JSON.parse(meta.groundingJson);
|
|
424
|
+
for (const e of edges) {
|
|
425
|
+
if (!e.resolution) e.resolution = "heuristic";
|
|
426
|
+
if (!e.epistemic) e.epistemic = "observed";
|
|
427
|
+
}
|
|
428
|
+
return graph;
|
|
429
|
+
} catch {
|
|
430
|
+
return null;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
function loadGraphPreferIndex(root, graphJsonPath) {
|
|
434
|
+
let jsonGraph = null;
|
|
435
|
+
if (fs.existsSync(graphJsonPath)) {
|
|
436
|
+
try {
|
|
437
|
+
jsonGraph = JSON.parse(fs.readFileSync(graphJsonPath, "utf8"));
|
|
438
|
+
} catch {
|
|
439
|
+
jsonGraph = null;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
const fromIndex = loadGraphFromIndex(root);
|
|
443
|
+
if (fromIndex) {
|
|
444
|
+
if (!jsonGraph || fromIndex.provenance.corpusHash === jsonGraph.provenance.corpusHash) {
|
|
445
|
+
return { graph: fromIndex, source: "index" };
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
if (jsonGraph) return { graph: jsonGraph, source: "json" };
|
|
449
|
+
return null;
|
|
450
|
+
}
|
|
451
|
+
|
|
224
452
|
// src/engine/load.ts
|
|
225
453
|
function loadGraph(root, graphPath) {
|
|
226
454
|
const file = resolveGraphPath(root, graphPath);
|
|
455
|
+
if (!graphPath) {
|
|
456
|
+
const preferred = loadGraphPreferIndex(root, file);
|
|
457
|
+
if (preferred) return preferred.graph;
|
|
458
|
+
}
|
|
227
459
|
if (!fs.existsSync(file)) return null;
|
|
228
460
|
return parseGraph(fs.readFileSync(file, "utf8"));
|
|
229
461
|
}
|
|
230
462
|
|
|
231
|
-
export { defaultGraphPath, ensureVibgrateGitignore, legacyGraphPath, loadGraph, preferInRepoGraph, renderHtml, renderReport, resolveGraphPath, vibgrateDir, writeArtifacts };
|
|
232
|
-
//# sourceMappingURL=chunk-
|
|
233
|
-
//# sourceMappingURL=chunk-
|
|
463
|
+
export { SCHEMA_VERSION, defaultGraphPath, ensureVibgrateGitignore, legacyGraphPath, loadGraph, loadGraphPreferIndex, preferInRepoGraph, renderHtml, renderReport, resolveGraphPath, vibgrateDir, writeArtifacts, writeGraphIndex };
|
|
464
|
+
//# sourceMappingURL=chunk-2XQDMLKB.js.map
|
|
465
|
+
//# sourceMappingURL=chunk-2XQDMLKB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/engine/report.ts","../src/engine/html.ts","../src/engine/artifacts.ts","../src/schema.ts","../src/engine/index-db.ts","../src/engine/load.ts"],"names":["legacy","path2","fs2","fs3"],"mappings":";;;;;;;;AAOO,SAAS,aAAa,KAAA,EAAwB;AACnD,EAAA,MAAM,EAAE,IAAA,EAAM,UAAA,EAAY,KAAA,EAAO,OAAM,GAAI,KAAA;AAC3C,EAAA,MAAM,QAAkB,EAAC;AAEzB,EAAA,KAAA,CAAM,KAAK,qBAAqB,CAAA;AAChC,EAAA,KAAA,CAAM,KAAK,EAAE,CAAA;AACb,EAAA,KAAA,CAAM,KAAK,CAAA,oBAAA,EAAuB,UAAA,CAAW,OAAO,CAAA,eAAA,EAAe,KAAA,CAAM,aAAa,CAAA,EAAA,CAAI,CAAA;AAC1F,EAAA,KAAA,CAAM,KAAK,EAAE,CAAA;AACb,EAAA,KAAA,CAAM,KAAK,YAAY,C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D","file":"chunk-2XQDMLKB.js","sourcesContent":["import type { VgGraph } from '../schema.js';\n\n/**\n * Deterministic Markdown summary (`GRAPH_REPORT.md`). Given a pinned\n * `generatedAt`, the report is byte-stable. Numbers are derived purely from the\n * graph, so the report can be regenerated from a committed `graph.json`.\n */\nexport function renderReport(graph: VgGraph): string {\n const { meta, provenance, nodes, edges } = graph;\n const lines: string[] = [];\n\n lines.push('# Code Graph Report');\n lines.push('');\n lines.push(`Generated by \\`vg\\` ${provenance.version} · schema \\`${graph.schemaVersion}\\``);\n lines.push('');\n lines.push('## Summary');\n lines.push('');\n lines.push(`- **Nodes:** ${meta.counts.nodes.toLocaleString('en-US')}`);\n lines.push(`- **Edges:** ${meta.counts.edges.toLocaleString('en-US')}`);\n lines.push(`- **Areas:** ${meta.counts.areas.toLocaleString('en-US')}`);\n lines.push(`- **Languages:** ${meta.languages.join(', ') || '—'}`);\n lines.push(`- **Clustering:** ${meta.cluster}`);\n lines.push(`- **Resolvers:** ${provenance.resolver.join(', ')}`);\n lines.push(`- **Edge kinds:** ${meta.edgeKinds.join(', ') || '—'}`);\n lines.push('');\n\n // Files by definition count.\n const fileNodes = nodes.filter((n) => n.kind === 'file');\n const defsByFile = new Map<string, number>();\n for (const n of nodes) {\n if (n.kind === 'file' || n.kind === 'external') continue;\n defsByFile.set(n.file, (defsByFile.get(n.file) ?? 0) + 1);\n }\n const topFiles = [...defsByFile.entries()]\n .sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))\n .slice(0, 15);\n if (topFiles.length) {\n lines.push('## Largest files (by definitions)');\n lines.push('');\n lines.push('| File | Definitions |');\n lines.push('| --- | ---: |');\n for (const [file, count] of topFiles) lines.push(`| \\`${file}\\` | ${count} |`);\n lines.push('');\n }\n\n // Most-connected nodes (Phase 0 importance = normalised degree).\n const topNodes = nodes\n .filter((n) => n.kind !== 'file' && n.kind !== 'external')\n .sort((a, b) => b.importance - a.importance || a.qualifiedName.localeCompare(b.qualifiedName))\n .slice(0, 15);\n if (topNodes.length) {\n lines.push('## Most-connected definitions');\n lines.push('');\n lines.push('| Symbol | Kind | File | Importance |');\n lines.push('| --- | --- | --- | ---: |');\n for (const n of topNodes) {\n lines.push(\n `| \\`${n.qualifiedName}\\` | ${n.kind} | \\`${n.file}\\`:${n.span.start} | ${n.importance.toFixed(3)} |`,\n );\n }\n lines.push('');\n }\n\n // Edge-kind breakdown.\n const byKind = new Map<string, number>();\n for (const e of edges) byKind.set(e.kind, (byKind.get(e.kind) ?? 0) + 1);\n if (byKind.size) {\n lines.push('## Edges by kind');\n lines.push('');\n lines.push('| Kind | Count |');\n lines.push('| --- | ---: |');\n for (const [kind, count] of [...byKind.entries()].sort((a, b) => a[0].localeCompare(b[0]))) {\n lines.push(`| ${kind} | ${count} |`);\n }\n lines.push('');\n }\n\n lines.push('---');\n lines.push('');\n lines.push(`_Files: ${fileNodes.length} · Corpus: \\`${provenance.corpusHash.slice(0, 16)}…\\`_`);\n lines.push('');\n\n return lines.join('\\n');\n}\n","import { stableStringify } from './serialize.js';\nimport type { VgGraph } from '../schema.js';\n\n/**\n * `graph.html`: self-contained, dependency-free, deterministic overview.\n *\n * For small/medium maps we embed the full graph JSON for tooling.\n * For large maps (default: >5k nodes) we embed only a\n * **hub + area summary** so the HTML stays openable; full data stays in\n * graph.json / graph.db. Interactive WebGL (sigma.js) remains a follow-up.\n */\n\nconst EMBED_NODE_LIMIT = 5_000;\n\nexport function renderHtml(graph: VgGraph): string {\n const top = graph.nodes\n .filter((n) => n.kind !== 'file' && n.kind !== 'external')\n .sort((a, b) => b.importance - a.importance || a.qualifiedName.localeCompare(b.qualifiedName))\n .slice(0, 50);\n\n const areas = [...graph.areas]\n .sort((a, b) => b.size - a.size || a.id - b.id)\n .slice(0, 40);\n\n const rows = top\n .map(\n (n) =>\n `<tr><td><code>${esc(n.qualifiedName)}</code></td><td>${esc(n.kind)}</td>` +\n `<td><code>${esc(n.file)}</code>:${n.span.start}</td><td>${n.importance.toFixed(3)}</td></tr>`,\n )\n .join('\\n');\n\n const areaRows = areas\n .map(\n (a) =>\n `<tr><td>${a.id}</td><td><code>${esc(a.label)}</code></td>` +\n `<td>${a.size}</td><td>${a.cohesion.toFixed(3)}</td><td>${a.externalEdges}</td></tr>`,\n )\n .join('\\n');\n\n const large = graph.meta.counts.nodes > EMBED_NODE_LIMIT;\n const embedPayload = large\n ? {\n schemaVersion: graph.schemaVersion,\n generatedAt: graph.generatedAt,\n provenance: graph.provenance,\n meta: graph.meta,\n hubs: top.map((n) => ({\n id: n.id,\n name: n.qualifiedName,\n kind: n.kind,\n file: n.file,\n line: n.span.start,\n importance: n.importance,\n area: n.area,\n })),\n areas: areas.map((a) => ({\n id: a.id,\n label: a.label,\n size: a.size,\n cohesion: a.cohesion,\n externalEdges: a.externalEdges,\n })),\n note: `Full graph omitted (${graph.meta.counts.nodes} nodes > ${EMBED_NODE_LIMIT}). Use graph.json or .vibgrate/cache/graph.db.`,\n }\n : graph;\n\n const embedded = stableStringify(embedPayload, 0);\n const tier = graph.meta.analysisTier ?? 'full';\n\n return `<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>vg · code graph</title>\n<style>\n :root { color-scheme: light dark; }\n body { font: 14px/1.5 system-ui, sans-serif; margin: 2rem auto; max-width: 60rem; padding: 0 1rem; }\n h1 { font-size: 1.4rem; } h2 { font-size: 1.1rem; margin-top: 2rem; }\n table { border-collapse: collapse; width: 100%; }\n th, td { text-align: left; padding: 4px 8px; border-bottom: 1px solid #8884; }\n td:last-child, th:last-child { text-align: right; }\n .meta { color: #888; } code { font-size: 0.9em; }\n .banner { background: #8882; padding: 0.6rem 0.8rem; border-radius: 6px; margin: 1rem 0; }\n</style>\n</head>\n<body>\n<h1>vg · code graph</h1>\n<p class=\"meta\">${graph.meta.counts.nodes} nodes · ${graph.meta.counts.edges} edges ·\n${graph.meta.counts.areas} areas · ${esc(graph.meta.languages.join(', ') || '—')} ·\nclustering: ${esc(graph.meta.cluster)} · tier: ${esc(tier)} · vg ${esc(graph.provenance.version)}</p>\n${\n large\n ? `<p class=\"banner\">Large map (${graph.meta.counts.nodes} nodes): HTML shows hubs + areas only.\nFull graph remains in <code>graph.json</code> / <code>.vibgrate/cache/graph.db</code> (query via <code>vg serve</code>).</p>`\n : ''\n}\n<h2>Areas (subsystems)</h2>\n<table>\n<thead><tr><th>Id</th><th>Label</th><th>Size</th><th>Cohesion</th><th>External</th></tr></thead>\n<tbody>\n${areaRows || '<tr><td colspan=\"5\" class=\"meta\">no areas</td></tr>'}\n</tbody>\n</table>\n<h2>Most-connected definitions (hubs)</h2>\n<table>\n<thead><tr><th>Symbol</th><th>Kind</th><th>Location</th><th>Importance</th></tr></thead>\n<tbody>\n${rows}\n</tbody>\n</table>\n<p class=\"meta\">${large ? 'Summary payload' : 'Full graph'} embedded below for tooling.</p>\n<script type=\"application/json\" id=\"vg-graph\">\n${embedded}\n</script>\n</body>\n</html>\n`;\n}\n\nfunction esc(s: string): string {\n return s\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"');\n}\n","import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { serializeGraph } from './serialize.js';\nimport { renderReport } from './report.js';\nimport { renderHtml } from './html.js';\nimport { globalGraphPath, globalGraphPathForRef, repositoryStoreDir } from '../runtime/paths.js';\nimport { detectGitRef } from '../runtime/git-ref.js';\nimport type { VgGraph } from '../schema.js';\n\n/**\n * Graph artifact layout (Fusion Runtime Phase 1).\n *\n * By default the code map lives in the **global** application store\n * (XDG / Application Support), keyed by repository id — not inside the repo.\n * That keeps `vg` / `vg serve` / auto-refresh from dirtying the working tree.\n *\n * Legacy in-repo path `.vibgrate/graph.json` is still **read** when present\n * (migration), and is still the write target when:\n * - `VIBGRATE_GRAPH_IN_REPO=1` (or true/yes), or\n * - callers pass an explicit `graphPath` / `--graph`.\n *\n * `vg share` continues to opt into a committed in-repo map by writing under\n * `.vibgrate/` (and rewriting its gitignore).\n */\n\nexport interface WriteOptions {\n root: string;\n html?: boolean; // default true\n report?: boolean; // default true\n graphPath?: string; // override graph.json path\n}\n\nexport interface WrittenArtifacts {\n graphPath: string;\n reportPath?: string;\n htmlPath?: string;\n factsPath?: string;\n}\n\nexport function vibgrateDir(root: string): string {\n return path.join(root, '.vibgrate');\n}\n\n/** Historical in-repo map path (still read as a fallback). */\nexport function legacyGraphPath(root: string): string {\n return path.join(vibgrateDir(root), 'graph.json');\n}\n\n/**\n * When true, default writes go to `.vibgrate/graph.json` (pre–Phase-1 layout).\n * Useful for CI that asserts in-repo artifacts, and for `vg share` workflows.\n */\nexport function preferInRepoGraph(env: NodeJS.ProcessEnv = process.env): boolean {\n const v = env.VIBGRATE_GRAPH_IN_REPO?.trim().toLowerCase();\n return v === '1' || v === 'true' || v === 'yes';\n}\n\n/**\n * Default **write** path for the map. Global store unless the operator opts\n * into the legacy in-repo layout. When git is available, prefer a\n * branch-keyed snapshot (Fusion §4.1.1) so switching branches does not\n * overwrite another ref's on-disk map.\n */\nexport function defaultGraphPath(root: string, env: NodeJS.ProcessEnv = process.env): string {\n if (preferInRepoGraph(env)) return legacyGraphPath(root);\n const { ref, kind } = detectGitRef(root);\n if (kind !== 'none' && ref) return globalGraphPathForRef(root, ref, env);\n return globalGraphPath(root, 'current', env);\n}\n\n/**\n * Resolve where to **read** the map from.\n * Order: explicit override → legacy in-repo when `VIBGRATE_GRAPH_IN_REPO` is set\n * → branch-keyed global (if on a git ref) → `current` global snapshot →\n * legacy in-repo → default write path.\n *\n * The in-repo env short-circuit matters for CI and the release benchmark: they\n * force portable `.vibgrate/graph.json` artifacts and must not pay a synchronous\n * `git rev-parse` (or prefer a leftover global snapshot) on every resolve.\n */\nexport function resolveGraphPath(root: string, override?: string, env: NodeJS.ProcessEnv = process.env): string {\n if (override?.trim()) return path.resolve(override.trim());\n if (preferInRepoGraph(env)) {\n const legacy = legacyGraphPath(root);\n if (fs.existsSync(legacy)) return legacy;\n return legacy;\n }\n const { ref, kind } = detectGitRef(root);\n if (kind !== 'none' && ref) {\n const branchPath = globalGraphPathForRef(root, ref, env);\n if (fs.existsSync(branchPath)) return branchPath;\n }\n const globalPath = globalGraphPath(root, 'current', env);\n if (fs.existsSync(globalPath)) return globalPath;\n const legacy = legacyGraphPath(root);\n if (fs.existsSync(legacy)) return legacy;\n return defaultGraphPath(root, env);\n}\n\n/**\n * By default the graph artifacts are *local*: builds and auto-refreshes rewrite\n * them constantly, and without an ignore file every `vg ask`/`vg serve` leaves\n * the branch dirty (untracked or modified `.vibgrate/` files) — irritating for\n * humans and a source of junk commits from AI agents. So the first time vg\n * writes into `.vibgrate/` it also drops a `.gitignore` covering the graph\n * artifacts, the cache, and itself.\n *\n * Deliberately create-once: an existing `.vibgrate/.gitignore` is NEVER\n * touched, whatever its content — `vg share` owns it after opt-in (rewritten to\n * commit `graph.json`), and a user-managed file (even an empty one) is theirs.\n * Scanner artifacts meant for git (`baseline.json`, `standards.json`,\n * `attestation.intoto.jsonl`) are intentionally not listed.\n *\n * With the global store default, this gitignore is only created when something\n * is still written under `.vibgrate/` (in-repo mode or other in-repo writers).\n */\nconst DEFAULT_GITIGNORE = [\n '# Created once by vg — local graph artifacts stay out of git by default.',\n '# Run `vg share` to commit the map for your team (it rewrites this file).',\n '# vg never touches an existing .vibgrate/.gitignore: edit it (or leave it',\n '# empty) to manage these ignores yourself.',\n '.gitignore',\n 'cache/',\n 'graph.json',\n 'graph.html',\n 'GRAPH_REPORT.md',\n 'facts.jsonl',\n 'mcp-navigation.json',\n];\n\nexport function ensureVibgrateGitignore(root: string): void {\n const file = path.join(vibgrateDir(root), '.gitignore');\n if (fs.existsSync(file)) return;\n fs.mkdirSync(vibgrateDir(root), { recursive: true });\n fs.writeFileSync(file, `${DEFAULT_GITIGNORE.join('\\n')}\\n`);\n}\n\n/**\n * Directory for companion artifacts (report, html, facts) next to the map.\n * Global maps → repository store root; in-repo maps → `.vibgrate/`.\n */\nexport function companionArtifactDir(root: string, graphPath: string, env: NodeJS.ProcessEnv = process.env): string {\n const resolved = path.resolve(graphPath);\n const legacy = path.resolve(legacyGraphPath(root));\n if (resolved === legacy) return vibgrateDir(root);\n const globalDefault = path.resolve(globalGraphPath(root, 'current', env));\n if (resolved === globalDefault) return repositoryStoreDir(root, env);\n // Custom --graph: keep companions next to the map file.\n return path.dirname(resolved);\n}\n\nexport function writeArtifacts(graph: VgGraph, options: WriteOptions): WrittenArtifacts {\n const graphPath = options.graphPath ?? defaultGraphPath(options.root);\n const companions = companionArtifactDir(options.root, graphPath);\n const inRepo = isPathInside(companions, options.root) || isPathInside(graphPath, options.root);\n\n fs.mkdirSync(path.dirname(graphPath), { recursive: true });\n fs.mkdirSync(companions, { recursive: true });\n\n // Only drop `.vibgrate/.gitignore` when we still touch the in-repo layout.\n if (inRepo && isPathInside(companions, vibgrateDir(options.root))) {\n ensureVibgrateGitignore(options.root);\n } else if (path.resolve(graphPath) === path.resolve(legacyGraphPath(options.root))) {\n ensureVibgrateGitignore(options.root);\n }\n\n // Atomic write (temp + rename): `vg serve` hot-reloads graph.json on mtime\n // change, so a rebuild — including its own in-process auto-refresh — must\n // never expose a half-written file to a concurrent reader.\n const tmp = `${graphPath}.${process.pid}.tmp`;\n try {\n fs.writeFileSync(tmp, serializeGraph(graph));\n fs.renameSync(tmp, graphPath);\n } catch (err) {\n fs.rmSync(tmp, { force: true });\n throw err;\n }\n\n const written: WrittenArtifacts = { graphPath };\n\n if (options.report !== false) {\n const reportPath = path.join(companions, 'GRAPH_REPORT.md');\n fs.writeFileSync(reportPath, renderReport(graph));\n written.reportPath = reportPath;\n }\n\n if (options.html !== false) {\n const htmlPath = path.join(companions, 'graph.html');\n fs.writeFileSync(htmlPath, renderHtml(graph));\n written.htmlPath = htmlPath;\n }\n\n // facts.jsonl (deterministic NDJSON) when facts were derived (--deep).\n if (graph.facts && graph.facts.length) {\n const factsPath = path.join(companions, 'facts.jsonl');\n fs.writeFileSync(factsPath, graph.facts.map((f) => JSON.stringify(f)).join('\\n') + '\\n');\n written.factsPath = factsPath;\n }\n\n return written;\n}\n\nfunction isPathInside(child: string, parent: string): boolean {\n const rel = path.relative(path.resolve(parent), path.resolve(child));\n return rel === '' || (!rel.startsWith('..') && !path.isAbsolute(rel));\n}\n","/**\n * The `vg-graph/1.0` on-disk schema.\n *\n * This is vg's own open schema (VG-PACKAGE-AND-SCHEMA.md §4) — informed by good\n * ideas (content-hashed ids, epistemic typing of facts) but standalone and\n * self-contained. Every collection is deterministically serialized\n * (sorted keys, stable element order). These TypeScript shapes are normative.\n */\n\nexport const SCHEMA_VERSION = 'vg-graph/1.0' as const;\n\nexport type ResolverKind = 'scip' | 'stackgraph' | 'tsc' | 'heuristic';\n\n/** Coarse, honest resolution tier for an edge (see engine/epistemic.ts). */\nexport type EpistemicTier = 'observed' | 'name-matched' | 'declared';\n\n/**\n * The toolchain that produced this graph — the reproducibility fingerprint.\n * Everything here deterministically affects graph *content* (parse trees change\n * between grammar releases; resolvers change which edges resolve), so a CI run\n * and a laptop run that disagree can be caught by comparing `fingerprint`.\n * Deliberately excludes the Node/OS version so the graph stays byte-stable\n * across host runtimes; `fingerprint` pins the parse/resolve toolchain only.\n */\nexport interface Toolchain {\n schema: string; // SCHEMA_VERSION\n tool: string; // vg calendar version\n grammars: string; // tree-sitter grammar set version string\n resolvers: ResolverKind[]; // resolver kinds available, sorted\n fingerprint: string; // shortId over the fields above — the value `vg attest` signs\n}\n\nexport interface Provenance {\n tool: 'vg';\n version: string; // calendar version\n grammars: Record<string, string>; // lang → grammar version (determinism input)\n resolver: ResolverKind[];\n deep: boolean; // did the heavier open passes run\n semanticModel?: string; // embedding model id+version if --deep semantic links\n corpusHash: string; // blake3 over the included file set + hashes\n toolchain?: Toolchain; // reproducibility fingerprint (checked by `vg verify`)\n}\n\n/** Analysis cost tier — auto-selected by node count (or forced). Reported honestly. */\nexport type AnalysisTier = 'full' | 'large' | 'xl';\n\nexport interface GraphMeta {\n root: string; // relative; portable across machines\n languages: string[];\n counts: {\n nodes: number;\n edges: number;\n areas: number;\n tests: number;\n untested: number;\n };\n cluster: 'leiden' | 'louvain' | 'none';\n /** Auto-selected (or forced) analysis tier for large maps. */\n analysisTier?: AnalysisTier;\n edgeKinds: EdgeKind[];\n}\n\nexport type NodeKind =\n | 'file'\n | 'module'\n | 'package'\n | 'class'\n | 'interface'\n | 'function'\n | 'method'\n | 'property'\n | 'test'\n | 'route'\n | 'component'\n /** Documentation / config text ingested for semantic ask (markdown, txt, env examples). */\n | 'document'\n | 'external';\n\nexport interface Span {\n start: number; // 1-based start line\n end: number; // 1-based end line\n}\n\nexport interface Centrality {\n degree: number;\n pagerank: number;\n betweenness: number;\n eigenvector: number;\n}\n\nexport interface GraphNode {\n id: string; // blake3(canonical(kind, qualifiedName, file, signature))\n kind: NodeKind;\n name: string; // short name\n qualifiedName: string;\n file: string; // relative path\n span: Span; // line range (excluded from id hash)\n lang: string;\n visibility?: 'public' | 'private' | 'protected' | 'internal';\n signature?: string;\n doc?: string; // short leading doc-comment / docstring summary (deterministic; not a full body)\n importance: number; // 0..1 blended centrality\n centrality: Centrality;\n area: number; // area id (the node's community); -1 = unassigned (cluster \"none\")\n isHub: boolean; // centrality outlier — surfaced by `vg hubs`\n tested: boolean | null; // null = not analyzable (e.g. external)\n coverage?: number; // 0..1 line coverage if a coverage report was ingested\n changeCoupling?: string[]; // node ids that historically change together\n}\n\nexport type EdgeKind =\n | 'call'\n | 'import'\n | 'contains'\n | 'extends'\n | 'implements'\n | 'references'\n | 'test'\n | 'coverage';\n\nexport interface GraphEdge {\n id: string; // blake3(canonical(kind, src, dst))\n kind: EdgeKind;\n src: string; // node id\n dst: string; // node id\n resolution: ResolverKind; // how the edge was resolved\n confidence: number; // 0..1 (1.0 for scip/declared; lower for heuristic/dynamic)\n epistemic?: EpistemicTier; // coarse honesty tier derived from resolution+kind\n surprise?: number; // 0..1 improbability under the area model (`vg oddities`)\n count?: number; // call-site multiplicity\n}\n\nexport interface Area {\n id: number; // stable across runs (remapped to previous committed map)\n label: string; // most-central member's name (editable via `vg label`)\n size: number;\n members: string[]; // node ids, sorted\n cohesion: number; // 0..1\n externalEdges: number; // cross-area edge count\n}\n\nexport type FactKind = 'contract' | 'invariant' | 'characterization';\nexport type DerivedBy = 'declared' | 'static';\nexport type FactConfidence = 'Observed' | 'Derived';\n\nexport interface Fact {\n id: string; // blake3(canonical(kind, subjectIds, predicate))\n kind: FactKind;\n subjectIds: string[]; // node ids this fact constrains\n predicate: unknown; // the constraint\n derivedBy: DerivedBy;\n confidence: FactConfidence;\n evidence: { file: string; span: Span }[];\n}\n\n/**\n * A reference the graph could not resolve — surfaced by `vg unknowns`. Reporting\n * what it *cannot* connect (ranked by blast radius) is the honest inverse of a\n * scanner that hides its unknowns. Only unknowns the precise rungs (tsc/scip)\n * did not supersede are recorded, so a compiler-resolved file never shows here.\n */\nexport interface Unknown {\n from: string; // node id where the unresolved reference occurs\n name: string; // the callee/type name that could not be resolved\n kind: 'call' | 'extends' | 'implements';\n count: number; // occurrences at this site\n}\n\nexport type GroundingKind = 'should_follow' | 'smells_like' | 'relevant_to';\n\nexport interface GroundingEdge {\n src: string; // node id\n packEntryId: string;\n kind: GroundingKind;\n confidence: number; // 0..1\n rationale: 'recommended' | 'conjectured';\n citation: { title: string; url: string };\n}\n\nexport interface VgGraph {\n schemaVersion: typeof SCHEMA_VERSION;\n generatedAt: string; // ISO; the ONLY nondeterministic field (pinned by --generated-at)\n provenance: Provenance;\n meta: GraphMeta;\n nodes: GraphNode[]; // sorted by id\n edges: GraphEdge[]; // sorted by (kind, src, dst)\n areas: Area[]; // sorted by id\n facts?: Fact[]; // present with --deep; sorted by id\n grounding?: GroundingEdge[]; // free-pack grounding (default on; omit with --no-ground)\n unknowns?: Unknown[]; // heuristic references left unresolved; sorted by (from, kind, name)\n}\n","/**\n * SQLite serve index for large maps (scale past flat-JSON-only serve).\n *\n * The canonical artifact remains `graph.json` (determinism / git). The index\n * at `.vibgrate/cache/graph.db` is a derived, gitignored structure built after\n * every successful build:\n * - denormalized name/edge columns for O(log n) lookup\n * - full node/edge/area JSON for reconstructing a `VgGraph` without parsing\n * the pretty-printed graph.json (faster cold serve on XL maps)\n *\n * Uses Node's built-in `node:sqlite` (Node ≥22) — no native npm dependency.\n */\n\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { cacheDir } from './cache.js';\nimport type {\n Area,\n EpistemicTier,\n GraphEdge,\n GraphNode,\n ResolverKind,\n VgGraph,\n} from '../schema.js';\nimport { SCHEMA_VERSION } from '../schema.js';\n\nexport interface IndexWriteResult {\n path: string;\n nodes: number;\n edges: number;\n /** False when node:sqlite is unavailable — callers should not fail the build. */\n ok: boolean;\n reason?: string;\n}\n\nexport function indexDbPath(root: string): string {\n return path.join(cacheDir(root), 'graph.db');\n}\n\n/** Write (replace) the SQLite index from a built graph. Never throws to callers. */\nexport function writeGraphIndex(root: string, graph: VgGraph): IndexWriteResult {\n const file = indexDbPath(root);\n try {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const { DatabaseSync } = require('node:sqlite') as typeof import('node:sqlite');\n fs.mkdirSync(path.dirname(file), { recursive: true });\n const tmp = `${file}.${process.pid}.tmp`;\n try {\n if (fs.existsSync(tmp)) fs.unlinkSync(tmp);\n } catch {\n /* ignore */\n }\n\n const db = new DatabaseSync(tmp);\n db.exec(`\n PRAGMA journal_mode = OFF;\n PRAGMA synchronous = OFF;\n CREATE TABLE meta (\n key TEXT PRIMARY KEY,\n value TEXT NOT NULL\n );\n CREATE TABLE nodes (\n id TEXT PRIMARY KEY,\n name TEXT NOT NULL,\n qualified_name TEXT NOT NULL,\n kind TEXT NOT NULL,\n file TEXT NOT NULL,\n line INTEGER NOT NULL,\n importance REAL NOT NULL,\n area INTEGER NOT NULL,\n is_hub INTEGER NOT NULL,\n lang TEXT NOT NULL,\n json TEXT NOT NULL\n );\n CREATE TABLE edges (\n id TEXT PRIMARY KEY,\n kind TEXT NOT NULL,\n src TEXT NOT NULL,\n dst TEXT NOT NULL,\n resolution TEXT NOT NULL,\n confidence REAL NOT NULL,\n epistemic TEXT NOT NULL,\n json TEXT NOT NULL\n );\n CREATE TABLE areas (\n id INTEGER PRIMARY KEY,\n json TEXT NOT NULL\n );\n CREATE INDEX idx_nodes_name ON nodes(name);\n CREATE INDEX idx_nodes_qn ON nodes(qualified_name);\n CREATE INDEX idx_nodes_file ON nodes(file);\n CREATE INDEX idx_edges_src ON edges(src);\n CREATE INDEX idx_edges_dst ON edges(dst);\n CREATE INDEX idx_edges_kind ON edges(kind);\n `);\n\n const insMeta = db.prepare('INSERT INTO meta(key, value) VALUES (?, ?)');\n insMeta.run('corpusHash', graph.provenance.corpusHash);\n insMeta.run('schemaVersion', graph.schemaVersion);\n insMeta.run('generatedAt', graph.generatedAt);\n insMeta.run('nodeCount', String(graph.nodes.length));\n insMeta.run('edgeCount', String(graph.edges.length));\n insMeta.run('analysisTier', graph.meta.analysisTier ?? 'full');\n insMeta.run('indexVersion', 'vg-graph-index/2');\n // Full meta + provenance for reconstruct without graph.json parse.\n insMeta.run('graphMeta', JSON.stringify(graph.meta));\n insMeta.run('graphProvenance', JSON.stringify(graph.provenance));\n if (graph.facts) insMeta.run('factsJson', JSON.stringify(graph.facts));\n if (graph.grounding) insMeta.run('groundingJson', JSON.stringify(graph.grounding));\n\n const insNode = db.prepare(\n `INSERT INTO nodes(id, name, qualified_name, kind, file, line, importance, area, is_hub, lang, json)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,\n );\n for (const n of graph.nodes) {\n insNode.run(\n n.id,\n n.name,\n n.qualifiedName,\n n.kind,\n n.file,\n n.span.start,\n n.importance,\n n.area,\n n.isHub ? 1 : 0,\n n.lang,\n JSON.stringify(n),\n );\n }\n\n const insEdge = db.prepare(\n `INSERT INTO edges(id, kind, src, dst, resolution, confidence, epistemic, json)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,\n );\n for (const e of graph.edges) {\n insEdge.run(\n e.id,\n e.kind,\n e.src,\n e.dst,\n e.resolution,\n e.confidence,\n e.epistemic ?? 'observed',\n JSON.stringify(e),\n );\n }\n\n const insArea = db.prepare('INSERT INTO areas(id, json) VALUES (?, ?)');\n for (const a of graph.areas) {\n insArea.run(a.id, JSON.stringify(a));\n }\n\n db.close();\n fs.renameSync(tmp, file);\n return { path: file, nodes: graph.nodes.length, edges: graph.edges.length, ok: true };\n } catch (err) {\n return {\n path: file,\n nodes: 0,\n edges: 0,\n ok: false,\n reason: (err as Error).message,\n };\n }\n}\n\nexport interface NameHit {\n id: string;\n name: string;\n qualifiedName: string;\n kind: string;\n file: string;\n line: number;\n importance: number;\n}\n\n/** Fast name / prefix lookup against the index. Empty if index missing. */\nexport function lookupNameIndex(root: string, query: string, limit = 20): NameHit[] {\n const file = indexDbPath(root);\n if (!fs.existsSync(file) || !query.trim()) return [];\n try {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const { DatabaseSync } = require('node:sqlite') as typeof import('node:sqlite');\n const db = new DatabaseSync(file, { readOnly: true });\n const q = query.trim();\n const rows = db\n .prepare(\n `SELECT id, name, qualified_name, kind, file, line, importance\n FROM nodes\n WHERE name = ? OR qualified_name = ? OR name LIKE ? OR qualified_name LIKE ?\n ORDER BY\n CASE WHEN name = ? OR qualified_name = ? THEN 0\n WHEN name LIKE ? THEN 1\n ELSE 2 END,\n importance DESC\n LIMIT ?`,\n )\n .all(q, q, `${q}%`, `%${q}%`, q, q, `${q}%`, limit) as Record<string, unknown>[];\n db.close();\n return rows.map((r) => ({\n id: String(r.id),\n name: String(r.name),\n qualifiedName: String(r.qualified_name),\n kind: String(r.kind),\n file: String(r.file),\n line: Number(r.line),\n importance: Number(r.importance),\n }));\n } catch {\n return [];\n }\n}\n\n/** Neighbor edges for a node id (src or dst). Empty if index missing. */\nexport function lookupNeighbors(\n root: string,\n nodeId: string,\n direction: 'out' | 'in' | 'both' = 'both',\n limit = 50,\n): GraphEdge[] {\n const file = indexDbPath(root);\n if (!fs.existsSync(file) || !nodeId) return [];\n try {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const { DatabaseSync } = require('node:sqlite') as typeof import('node:sqlite');\n const db = new DatabaseSync(file, { readOnly: true });\n let rows: Record<string, unknown>[] = [];\n if (direction === 'out' || direction === 'both') {\n rows = rows.concat(\n db\n .prepare(`SELECT json FROM edges WHERE src = ? LIMIT ?`)\n .all(nodeId, limit) as Record<string, unknown>[],\n );\n }\n if (direction === 'in' || direction === 'both') {\n rows = rows.concat(\n db\n .prepare(`SELECT json FROM edges WHERE dst = ? LIMIT ?`)\n .all(nodeId, limit) as Record<string, unknown>[],\n );\n }\n db.close();\n const byId = new Map<string, GraphEdge>();\n for (const r of rows) {\n try {\n const e = JSON.parse(String(r.json)) as GraphEdge;\n byId.set(e.id, e);\n } catch {\n /* skip bad row */\n }\n }\n return [...byId.values()];\n } catch {\n return [];\n }\n}\n\n/** Read index meta (corpusHash etc.) or null if missing. */\nexport function readIndexMeta(root: string): Record<string, string> | null {\n const file = indexDbPath(root);\n if (!fs.existsSync(file)) return null;\n try {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const { DatabaseSync } = require('node:sqlite') as typeof import('node:sqlite');\n const db = new DatabaseSync(file, { readOnly: true });\n const rows = db.prepare('SELECT key, value FROM meta').all() as { key: string; value: string }[];\n db.close();\n const out: Record<string, string> = {};\n for (const r of rows) out[r.key] = r.value;\n return out;\n } catch {\n return null;\n }\n}\n\n/**\n * Reconstruct a full `VgGraph` from the SQLite index (indexVersion ≥ 2).\n * Returns null if the index is missing, stale schema, or incomplete.\n * Prefer this over JSON.parse of pretty graph.json for cold serve on large maps.\n */\nexport function loadGraphFromIndex(root: string): VgGraph | null {\n const file = indexDbPath(root);\n if (!fs.existsSync(file)) return null;\n try {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const { DatabaseSync } = require('node:sqlite') as typeof import('node:sqlite');\n const db = new DatabaseSync(file, { readOnly: true });\n const metaRows = db.prepare('SELECT key, value FROM meta').all() as {\n key: string;\n value: string;\n }[];\n const meta: Record<string, string> = {};\n for (const r of metaRows) meta[r.key] = r.value;\n\n if (meta.indexVersion !== 'vg-graph-index/2' || !meta.graphMeta || !meta.graphProvenance) {\n db.close();\n return null;\n }\n\n const nodeRows = db.prepare('SELECT json FROM nodes ORDER BY id').all() as {\n json: string;\n }[];\n const edgeRows = db.prepare('SELECT json FROM edges ORDER BY id').all() as {\n json: string;\n }[];\n const areaRows = db.prepare('SELECT json FROM areas ORDER BY id').all() as {\n json: string;\n }[];\n db.close();\n\n const nodes = nodeRows.map((r) => JSON.parse(r.json) as GraphNode);\n const edges = edgeRows.map((r) => JSON.parse(r.json) as GraphEdge);\n const areas = areaRows.map((r) => JSON.parse(r.json) as Area);\n\n // Stable sorts match serialize contract (ids already ordered by SQL, re-sort for safety).\n nodes.sort((a, b) => a.id.localeCompare(b.id));\n edges.sort(\n (a, b) =>\n a.kind.localeCompare(b.kind) || a.src.localeCompare(b.src) || a.dst.localeCompare(b.dst),\n );\n areas.sort((a, b) => a.id - b.id);\n\n const graph: VgGraph = {\n schemaVersion: (meta.schemaVersion as typeof SCHEMA_VERSION) || SCHEMA_VERSION,\n generatedAt: meta.generatedAt ?? new Date(0).toISOString(),\n provenance: JSON.parse(meta.graphProvenance),\n meta: JSON.parse(meta.graphMeta),\n nodes,\n edges,\n areas,\n };\n if (meta.factsJson) graph.facts = JSON.parse(meta.factsJson);\n if (meta.groundingJson) graph.grounding = JSON.parse(meta.groundingJson);\n\n // Lightweight integrity: edge resolution types stay valid.\n for (const e of edges) {\n if (!e.resolution) e.resolution = 'heuristic' as ResolverKind;\n if (!e.epistemic) e.epistemic = 'observed' as EpistemicTier;\n }\n return graph;\n } catch {\n return null;\n }\n}\n\n/**\n * Load the graph preferring the SQLite index when its corpusHash matches the\n * committed graph.json provenance (or when only the index exists). Falls back\n * to graph.json. Returns null if neither is usable.\n */\nexport function loadGraphPreferIndex(\n root: string,\n graphJsonPath: string,\n): { graph: VgGraph; source: 'index' | 'json' } | null {\n let jsonGraph: VgGraph | null = null;\n if (fs.existsSync(graphJsonPath)) {\n try {\n jsonGraph = JSON.parse(fs.readFileSync(graphJsonPath, 'utf8')) as VgGraph;\n } catch {\n jsonGraph = null;\n }\n }\n\n const fromIndex = loadGraphFromIndex(root);\n if (fromIndex) {\n if (!jsonGraph || fromIndex.provenance.corpusHash === jsonGraph.provenance.corpusHash) {\n return { graph: fromIndex, source: 'index' };\n }\n // Index stale vs graph.json — prefer canonical JSON and let next build refresh.\n }\n if (jsonGraph) return { graph: jsonGraph, source: 'json' };\n return null;\n}\n","import * as fs from 'node:fs';\nimport { resolveGraphPath } from './artifacts.js';\nimport { parseGraph } from './serialize.js';\nimport { loadGraphPreferIndex } from './index-db.js';\nimport type { VgGraph } from '../schema.js';\n\n/**\n * Load the code map for a repository.\n *\n * When `graphPath` is omitted, prefers an existing global-store snapshot, then\n * the legacy `.vibgrate/graph.json`, matching {@link resolveGraphPath}.\n * Prefers the SQLite index when its corpusHash matches the committed map\n * (faster cold serve on large repos). Returns null if none exists.\n */\nexport function loadGraph(root: string, graphPath?: string): VgGraph | null {\n const file = resolveGraphPath(root, graphPath);\n // Index is always rooted at the project root; only use it when loading the\n // default map for that root (not an arbitrary --graph path).\n if (!graphPath) {\n const preferred = loadGraphPreferIndex(root, file);\n if (preferred) return preferred.graph;\n }\n if (!fs.existsSync(file)) return null;\n return parseGraph(fs.readFileSync(file, 'utf8'));\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { estimateModelBytes } from './chunk-
|
|
1
|
+
import { estimateModelBytes } from './chunk-7N4Y3E47.js';
|
|
2
2
|
import { MODEL_EXECUTION_PROFILE_SCHEMA_VERSION } from './chunk-IZDH67DX.js';
|
|
3
3
|
import { vibgrateDataDir } from './chunk-BWPBB45M.js';
|
|
4
4
|
import * as fs from 'fs';
|
|
@@ -144,6 +144,7 @@ var DEFAULT_RESERVES = {
|
|
|
144
144
|
testsBytes: 0.25 * GiB,
|
|
145
145
|
safetyMarginBytes: 1 * GiB
|
|
146
146
|
};
|
|
147
|
+
var IDE_OS_GROWTH_FRACTION = 0.25;
|
|
147
148
|
function packForMode(mode, packs = QUALIFIED_PACKS) {
|
|
148
149
|
return packs.find((p) => p.mode === mode) ?? null;
|
|
149
150
|
}
|
|
@@ -168,8 +169,8 @@ function fitPack(input) {
|
|
|
168
169
|
const freePool = freeNow + loadedBytes;
|
|
169
170
|
const graphBump = (input.repo?.graphNodeCount ?? 0) > 5e4 ? 0.5 * GiB : (input.repo?.fileCount ?? 0) > 5e3 ? 0.25 * GiB : 0;
|
|
170
171
|
const graphBytes = r.graphBytes + graphBump;
|
|
171
|
-
const reserved = r.
|
|
172
|
-
const freeAfterReserves =
|
|
172
|
+
const reserved = useVram ? r.safetyMarginBytes : graphBytes + r.testsBytes + r.safetyMarginBytes + IDE_OS_GROWTH_FRACTION * (r.ideBytes + r.osBytes);
|
|
173
|
+
const freeAfterReserves = Math.max(0, freePool - reserved);
|
|
173
174
|
const availableBytes = freeAfterReserves;
|
|
174
175
|
const reasons = [];
|
|
175
176
|
const headroom = availableBytes - needBytes;
|
|
@@ -211,10 +212,11 @@ function fitPack(input) {
|
|
|
211
212
|
breakdown: {
|
|
212
213
|
modelBytes,
|
|
213
214
|
kvBytes,
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
215
|
+
// Report the charged growth headroom (not the full static IDE/OS footprint).
|
|
216
|
+
ideBytes: useVram ? 0 : IDE_OS_GROWTH_FRACTION * r.ideBytes,
|
|
217
|
+
osBytes: useVram ? 0 : IDE_OS_GROWTH_FRACTION * r.osBytes,
|
|
218
|
+
graphBytes: useVram ? 0 : graphBytes,
|
|
219
|
+
testsBytes: useVram ? 0 : r.testsBytes,
|
|
218
220
|
freeAfterReservesBytes: freeAfterReserves
|
|
219
221
|
},
|
|
220
222
|
reducedCapsuleBudgetTokens,
|
|
@@ -472,5 +474,5 @@ function parseMode(raw) {
|
|
|
472
474
|
}
|
|
473
475
|
|
|
474
476
|
export { MODEL_ORCHESTRATOR_SCHEMA_VERSION, QUALIFIED_PACKS, activePin, buildOrchestratorStatus, fitPack, listModes, orchestratorStatePath, packById, packForMode, parseMode, pinPack, providerForBackend, readOrchestratorState, recommendMode, resolveMode, setDefaultMode, unpinPack, writeOrchestratorState };
|
|
475
|
-
//# sourceMappingURL=chunk-
|
|
476
|
-
//# sourceMappingURL=chunk-
|
|
477
|
+
//# sourceMappingURL=chunk-3V24O47U.js.map
|
|
478
|
+
//# sourceMappingURL=chunk-3V24O47U.js.map
|