@vibgrate/cli 2026.722.2 → 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 +418 -213
- package/README.md +34 -8
- package/dist/baseline-TG4ATZGZ.js +8 -0
- package/dist/{baseline-BD3A7EXD.js.map → baseline-TG4ATZGZ.js.map} +1 -1
- package/dist/chunk-2MBL43EJ.js +82 -0
- package/dist/chunk-2MBL43EJ.js.map +1 -0
- package/dist/chunk-2XQDMLKB.js +465 -0
- package/dist/chunk-2XQDMLKB.js.map +1 -0
- package/dist/{chunk-PY3DNX5H.js → chunk-3Q7QBWFW.js} +13 -2
- package/dist/chunk-3Q7QBWFW.js.map +1 -0
- package/dist/chunk-3V24O47U.js +478 -0
- package/dist/chunk-3V24O47U.js.map +1 -0
- package/dist/chunk-5I4VSBWQ.js +764 -0
- package/dist/chunk-5I4VSBWQ.js.map +1 -0
- package/dist/{chunk-WNIIKCNF.js → chunk-6ABXHZRN.js} +59 -311
- package/dist/chunk-6ABXHZRN.js.map +1 -0
- package/dist/chunk-6AYDFFP5.js +136 -0
- package/dist/chunk-6AYDFFP5.js.map +1 -0
- package/dist/chunk-6UQMXIAG.js +122 -0
- package/dist/chunk-6UQMXIAG.js.map +1 -0
- package/dist/chunk-7N4Y3E47.js +108 -0
- package/dist/chunk-7N4Y3E47.js.map +1 -0
- package/dist/chunk-BPF3YX2U.js +64 -0
- package/dist/chunk-BPF3YX2U.js.map +1 -0
- package/dist/chunk-BWPBB45M.js +88 -0
- package/dist/chunk-BWPBB45M.js.map +1 -0
- package/dist/{chunk-6CXTPC74.js → chunk-CY4WKXB2.js} +27 -6
- package/dist/chunk-CY4WKXB2.js.map +1 -0
- package/dist/chunk-DGUM43GV.js +10 -0
- package/dist/chunk-DGUM43GV.js.map +1 -0
- package/dist/{chunk-NONYJLOJ.js → chunk-EX4PQT6W.js} +3 -3
- package/dist/{chunk-NONYJLOJ.js.map → chunk-EX4PQT6W.js.map} +1 -1
- package/dist/chunk-IS7VTH2Q.js +627 -0
- package/dist/chunk-IS7VTH2Q.js.map +1 -0
- package/dist/chunk-IZDH67DX.js +289 -0
- package/dist/chunk-IZDH67DX.js.map +1 -0
- package/dist/chunk-J4RFRKZH.js +2496 -0
- package/dist/chunk-J4RFRKZH.js.map +1 -0
- package/dist/chunk-J7LKEB2R.js +51 -0
- package/dist/chunk-J7LKEB2R.js.map +1 -0
- package/dist/chunk-JIBOJTGS.js +313 -0
- package/dist/chunk-JIBOJTGS.js.map +1 -0
- package/dist/chunk-K3MZIVZW.js +88 -0
- package/dist/chunk-K3MZIVZW.js.map +1 -0
- package/dist/chunk-K7REHDQS.js +776 -0
- package/dist/chunk-K7REHDQS.js.map +1 -0
- package/dist/{chunk-2O5YZVZV.js → chunk-KCKYKDMS.js} +23 -19
- package/dist/chunk-KCKYKDMS.js.map +1 -0
- package/dist/{chunk-3MXNNBLI.js → chunk-KNELIQJO.js} +1647 -2042
- package/dist/chunk-KNELIQJO.js.map +1 -0
- package/dist/chunk-KSBHGWRV.js +613 -0
- package/dist/chunk-KSBHGWRV.js.map +1 -0
- package/dist/chunk-LKVMI67M.js +1695 -0
- package/dist/chunk-LKVMI67M.js.map +1 -0
- package/dist/chunk-NDMDSPFX.js +69 -0
- package/dist/chunk-NDMDSPFX.js.map +1 -0
- package/dist/{chunk-CS37OBE3.js → chunk-OFUC6RYN.js} +791 -783
- package/dist/chunk-OFUC6RYN.js.map +1 -0
- package/dist/chunk-OOIG3RUM.js +276 -0
- package/dist/chunk-OOIG3RUM.js.map +1 -0
- package/dist/chunk-PMYWZRRS.js +62 -0
- package/dist/chunk-PMYWZRRS.js.map +1 -0
- package/dist/chunk-PXHNTC6D.js +382 -0
- package/dist/chunk-PXHNTC6D.js.map +1 -0
- package/dist/{chunk-I7GY7MVN.js → chunk-RNP3SMTV.js} +60 -12
- package/dist/chunk-RNP3SMTV.js.map +1 -0
- package/dist/chunk-TCDAZZNP.js +843 -0
- package/dist/chunk-TCDAZZNP.js.map +1 -0
- package/dist/{chunk-5BDHQ7DD.js → chunk-WGUL45AV.js} +24 -17
- package/dist/chunk-WGUL45AV.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +3373 -617
- package/dist/cli.js.map +1 -1
- package/dist/execution-env-ZU45JZ4G.js +4 -0
- package/dist/execution-env-ZU45JZ4G.js.map +1 -0
- package/dist/federation-SZWZIFZ7.js +7 -0
- package/dist/federation-SZWZIFZ7.js.map +1 -0
- 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-XDXB6JP5.js +4 -0
- package/dist/git-ref-XDXB6JP5.js.map +1 -0
- package/dist/graph-backend-73URGTFY.js +11 -0
- package/dist/graph-backend-73URGTFY.js.map +1 -0
- package/dist/index.d.ts +472 -137
- package/dist/index.js +15 -7
- package/dist/index.js.map +1 -1
- package/dist/{interactive-A4DISSIW.js → interactive-372NLI5C.js} +186 -226
- package/dist/interactive-372NLI5C.js.map +1 -0
- package/dist/llm-host-7GWDO6IX.js +9 -0
- package/dist/llm-host-7GWDO6IX.js.map +1 -0
- package/dist/load-I333TGNI.js +8 -0
- package/dist/load-I333TGNI.js.map +1 -0
- package/dist/local-runtime-5O2NN3GA.js +5 -0
- package/dist/local-runtime-5O2NN3GA.js.map +1 -0
- 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-TFBKCNJG.js +4 -0
- package/dist/model-execution-profile-TFBKCNJG.js.map +1 -0
- package/dist/model-orchestrator-TVONAUPS.js +9 -0
- package/dist/model-orchestrator-TVONAUPS.js.map +1 -0
- package/dist/parse-worker.d.ts +1 -1
- package/dist/parse-worker.js +2 -1
- package/dist/parse-worker.js.map +1 -1
- package/dist/paths-2RAH3GME.js +6 -0
- package/dist/paths-2RAH3GME.js.map +1 -0
- package/dist/resolve-gguf-VPL4YQ6J.js +8 -0
- package/dist/resolve-gguf-VPL4YQ6J.js.map +1 -0
- package/dist/runtime-session-JRKCQUHY.js +18 -0
- package/dist/runtime-session-JRKCQUHY.js.map +1 -0
- package/dist/session-ITPYQ5XI.js +11 -0
- package/dist/{session-POJUDFPH.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-Q2JGWPHB.js → stream-json-SLMDKLXP.js} +17 -6
- package/dist/stream-json-SLMDKLXP.js.map +1 -0
- package/dist/{types-Jl6RJ175.d.ts → types-7AHBUbFm.d.ts} +8 -2
- package/dist/ui-Q6DJ3GCU.js +5 -0
- package/dist/ui-Q6DJ3GCU.js.map +1 -0
- package/dist/vgd-7JV5KCNJ.js +17 -0
- package/dist/vgd-7JV5KCNJ.js.map +1 -0
- package/package.json +9 -6
- package/dist/baseline-BD3A7EXD.js +0 -7
- package/dist/chunk-2O5YZVZV.js.map +0 -1
- package/dist/chunk-3MXNNBLI.js.map +0 -1
- package/dist/chunk-5BDHQ7DD.js.map +0 -1
- package/dist/chunk-6CXTPC74.js.map +0 -1
- package/dist/chunk-CS37OBE3.js.map +0 -1
- package/dist/chunk-GGJZA3Q6.js +0 -961
- package/dist/chunk-GGJZA3Q6.js.map +0 -1
- package/dist/chunk-I7GY7MVN.js.map +0 -1
- package/dist/chunk-JBXNQCGE.js +0 -484
- package/dist/chunk-JBXNQCGE.js.map +0 -1
- package/dist/chunk-PY3DNX5H.js.map +0 -1
- package/dist/chunk-WNIIKCNF.js.map +0 -1
- package/dist/fs-IPY4FJKH.js.map +0 -1
- package/dist/fs-KCABDURV.js.map +0 -1
- package/dist/interactive-A4DISSIW.js.map +0 -1
- package/dist/mcp-tools-I6PME3AV.js +0 -3
- package/dist/session-POJUDFPH.js +0 -6
- package/dist/session-store-W5RZZHA3.js +0 -3
- package/dist/stream-json-Q2JGWPHB.js.map +0 -1
- package/dist/ui-HOVOPWMX.js +0 -4
- package/dist/ui-HOVOPWMX.js.map +0 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import { spawnSync } from 'child_process';
|
|
3
|
+
|
|
4
|
+
// src/runtime/git-ref.ts
|
|
5
|
+
var refCache = /* @__PURE__ */ new Map();
|
|
6
|
+
function detectGitRef(root, run) {
|
|
7
|
+
const useCache = run === void 0;
|
|
8
|
+
const runner = run ?? defaultGitRun;
|
|
9
|
+
const key = useCache ? path.resolve(root) : "";
|
|
10
|
+
if (useCache) {
|
|
11
|
+
const hit = refCache.get(key);
|
|
12
|
+
if (hit) return hit;
|
|
13
|
+
}
|
|
14
|
+
let info;
|
|
15
|
+
try {
|
|
16
|
+
const branch = runner(["rev-parse", "--abbrev-ref", "HEAD"], root);
|
|
17
|
+
if (branch.status !== 0) {
|
|
18
|
+
info = { ref: "", kind: "none" };
|
|
19
|
+
} else {
|
|
20
|
+
const name = branch.stdout.trim();
|
|
21
|
+
if (!name || name === "HEAD") {
|
|
22
|
+
const sha = runner(["rev-parse", "HEAD"], root);
|
|
23
|
+
if (sha.status !== 0 || !sha.stdout.trim()) {
|
|
24
|
+
info = { ref: "", kind: "none" };
|
|
25
|
+
} else {
|
|
26
|
+
info = { ref: sha.stdout.trim(), kind: "detached" };
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
info = { ref: name, kind: "branch" };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
} catch {
|
|
33
|
+
info = { ref: "", kind: "none" };
|
|
34
|
+
}
|
|
35
|
+
if (useCache) refCache.set(key, info);
|
|
36
|
+
return info;
|
|
37
|
+
}
|
|
38
|
+
function clearDetectGitRefCache(root) {
|
|
39
|
+
if (root === void 0) refCache.clear();
|
|
40
|
+
else refCache.delete(path.resolve(root));
|
|
41
|
+
}
|
|
42
|
+
function branchGraphSnapshotId(gitRef) {
|
|
43
|
+
const ref = gitRef.trim();
|
|
44
|
+
if (!ref) return "current";
|
|
45
|
+
if (/^[0-9a-f]{40}$/i.test(ref)) return `sha-${ref.toLowerCase()}`;
|
|
46
|
+
const safe = ref.replace(/\\/g, "/").replace(/\/+/g, "__").replace(/[^A-Za-z0-9._@+-]+/g, "_").replace(/^_+|_+$/g, "").slice(0, 120);
|
|
47
|
+
return `branch-${safe || "unnamed"}`;
|
|
48
|
+
}
|
|
49
|
+
function activeGraphSlotKey(repositoryId, gitRef) {
|
|
50
|
+
return `${repositoryId}::${gitRef.trim() || "unknown"}`;
|
|
51
|
+
}
|
|
52
|
+
function defaultGitRun(args, cwd) {
|
|
53
|
+
const res = spawnSync("git", args, {
|
|
54
|
+
cwd,
|
|
55
|
+
encoding: "utf8",
|
|
56
|
+
timeout: 5e3,
|
|
57
|
+
maxBuffer: 1024 * 1024
|
|
58
|
+
});
|
|
59
|
+
return { stdout: res.stdout ?? "", status: res.status ?? 1 };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { activeGraphSlotKey, branchGraphSnapshotId, clearDetectGitRefCache, detectGitRef };
|
|
63
|
+
//# sourceMappingURL=chunk-BPF3YX2U.js.map
|
|
64
|
+
//# sourceMappingURL=chunk-BPF3YX2U.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/runtime/git-ref.ts"],"names":[],"mappings":";;;;AA2BA,IAAM,QAAA,uBAAe,GAAA,EAAwB;AAQtC,SAAS,YAAA,CAAa,MAAc,GAAA,EAA6B;AACtE,EAAA,MAAM,WAAW,GAAA,KAAQ,MAAA;AACzB,EAAA,MAAM,SAAS,GAAA,IAAO,aAAA;AACtB,EAAA,MAAM,GAAA,GAAM,QAAA,GAAgB,IAAA,CAAA,OAAA,CAAQ,IAAI,CAAA,GAAI,EAAA;AAC5C,E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D","file":"chunk-BPF3YX2U.js","sourcesContent":["/**\n * Detect the current git ref for a repository worktree (Fusion §4.1.1).\n *\n * Used to key ActiveGraph slots and on-disk snapshots: one graph per\n * (repositoryId, gitRef), not merely per clone path.\n *\n * Results are cached per absolute root for the process lifetime so a hot path\n * (path resolution, auto-refresh write) never re-spawns `git rev-parse` on\n * every call. The ref only changes when the user checks out another branch —\n * restart `vg serve` (or any long-lived process) after a checkout, same as\n * before this cache existed for slot identity.\n */\n\nimport * as path from 'node:path';\nimport { spawnSync } from 'node:child_process';\n\nexport type GitRefKind = 'branch' | 'detached' | 'none';\n\nexport interface GitRefInfo {\n /** Symbolic branch name, full SHA when detached, or empty when not a git repo. */\n ref: string;\n kind: GitRefKind;\n}\n\nexport type GitRunner = (args: string[], cwd: string) => { stdout: string; status: number };\n\n/** Process-lifetime cache: abs(root) → ref. Bypassed when a custom `run` is passed (tests). */\nconst refCache = new Map<string, GitRefInfo>();\n\n/**\n * Resolve the current branch name, or detached HEAD SHA.\n * Never throws — returns kind `none` when git is missing or the path is not a repo.\n * When `run` is omitted (production), the result is cached per absolute root for\n * the process lifetime. Tests that pass a custom `run` always re-invoke it.\n */\nexport function detectGitRef(root: string, run?: GitRunner): GitRefInfo {\n const useCache = run === undefined;\n const runner = run ?? defaultGitRun;\n const key = useCache ? path.resolve(root) : '';\n if (useCache) {\n const hit = refCache.get(key);\n if (hit) return hit;\n }\n let info: GitRefInfo;\n try {\n const branch = runner(['rev-parse', '--abbrev-ref', 'HEAD'], root);\n if (branch.status !== 0) {\n info = { ref: '', kind: 'none' };\n } else {\n const name = branch.stdout.trim();\n if (!name || name === 'HEAD') {\n const sha = runner(['rev-parse', 'HEAD'], root);\n if (sha.status !== 0 || !sha.stdout.trim()) {\n info = { ref: '', kind: 'none' };\n } else {\n info = { ref: sha.stdout.trim(), kind: 'detached' };\n }\n } else {\n info = { ref: name, kind: 'branch' };\n }\n }\n } catch {\n info = { ref: '', kind: 'none' };\n }\n if (useCache) refCache.set(key, info);\n return info;\n}\n\n/** Tests / rare branch-switch mid-process: drop the cached ref for one root or all. */\nexport function clearDetectGitRefCache(root?: string): void {\n if (root === undefined) refCache.clear();\n else refCache.delete(path.resolve(root));\n}\n\n/**\n * Filesystem-safe snapshot id for a git ref.\n * `main` → `branch-main`; `feature/x` → `branch-feature__x`; SHA → `sha-<40hex>`.\n */\nexport function branchGraphSnapshotId(gitRef: string): string {\n const ref = gitRef.trim();\n if (!ref) return 'current';\n if (/^[0-9a-f]{40}$/i.test(ref)) return `sha-${ref.toLowerCase()}`;\n // Branch names may contain /, spaces, etc. — collapse to a single path segment.\n const safe = ref\n .replace(/\\\\/g, '/')\n .replace(/\\/+/g, '__')\n .replace(/[^A-Za-z0-9._@+-]+/g, '_')\n .replace(/^_+|_+$/g, '')\n .slice(0, 120);\n return `branch-${safe || 'unnamed'}`;\n}\n\n/** Stable cache key for an ActiveGraph slot. */\nexport function activeGraphSlotKey(repositoryId: string, gitRef: string): string {\n return `${repositoryId}::${gitRef.trim() || 'unknown'}`;\n}\n\nfunction defaultGitRun(args: string[], cwd: string): { stdout: string; status: number } {\n const res = spawnSync('git', args, {\n cwd,\n encoding: 'utf8',\n timeout: 5_000,\n maxBuffer: 1024 * 1024,\n });\n return { stdout: res.stdout ?? '', status: res.status ?? 1 };\n}\n"]}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { shortId } from './chunk-JFGYT6BI.js';
|
|
2
|
+
import { branchGraphSnapshotId } from './chunk-BPF3YX2U.js';
|
|
3
|
+
import * as os from 'os';
|
|
4
|
+
import * as path from 'path';
|
|
5
|
+
|
|
6
|
+
var APP = "vibgrate";
|
|
7
|
+
var APP_MAC = "Vibgrate";
|
|
8
|
+
var APP_WIN = "Vibgrate";
|
|
9
|
+
function resolveVibgratePaths(env = process.env, platform = process.platform, home = os.homedir()) {
|
|
10
|
+
return {
|
|
11
|
+
data: overrideOr(env.VIBGRATE_DATA_DIR, () => defaultDataDir(env, platform, home)),
|
|
12
|
+
cache: overrideOr(env.VIBGRATE_CACHE_DIR, () => defaultCacheDir(env, platform, home)),
|
|
13
|
+
runtime: overrideOr(env.VIBGRATE_RUNTIME_DIR, () => defaultRuntimeDir(env, platform, home))
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function vibgrateDataDir(env, platform, home) {
|
|
17
|
+
return resolveVibgratePaths(env, platform, home).data;
|
|
18
|
+
}
|
|
19
|
+
function vibgrateCacheDir(env, platform, home) {
|
|
20
|
+
return resolveVibgratePaths(env, platform, home).cache;
|
|
21
|
+
}
|
|
22
|
+
function vibgrateRuntimeDir(env, platform, home) {
|
|
23
|
+
return resolveVibgratePaths(env, platform, home).runtime;
|
|
24
|
+
}
|
|
25
|
+
function repositoryIdFromRoot(root) {
|
|
26
|
+
const normalized = normalizeRoot(root);
|
|
27
|
+
return shortId(`repo:${normalized}`);
|
|
28
|
+
}
|
|
29
|
+
function repositoryStoreDir(root, env, platform, home) {
|
|
30
|
+
const id = repositoryIdFromRoot(root);
|
|
31
|
+
return path.join(vibgrateDataDir(env, platform, home), "repos", id);
|
|
32
|
+
}
|
|
33
|
+
function globalGraphPath(root, snapshotId = "current", env, platform, home) {
|
|
34
|
+
return path.join(repositoryStoreDir(root, env, platform, home), "graphs", `${snapshotId}.graph.json`);
|
|
35
|
+
}
|
|
36
|
+
function globalGraphPathForRef(root, gitRef, env, platform, home) {
|
|
37
|
+
return globalGraphPath(root, branchGraphSnapshotId(gitRef), env, platform, home);
|
|
38
|
+
}
|
|
39
|
+
function daemonDir(env, platform, home) {
|
|
40
|
+
return path.join(vibgrateRuntimeDir(env, platform, home), "daemon");
|
|
41
|
+
}
|
|
42
|
+
function overrideOr(value, fallback) {
|
|
43
|
+
const trimmed = value?.trim();
|
|
44
|
+
if (trimmed) return path.resolve(trimmed);
|
|
45
|
+
return fallback();
|
|
46
|
+
}
|
|
47
|
+
function defaultDataDir(env, platform, home) {
|
|
48
|
+
if (platform === "darwin") {
|
|
49
|
+
return path.join(home, "Library", "Application Support", APP_MAC);
|
|
50
|
+
}
|
|
51
|
+
if (platform === "win32") {
|
|
52
|
+
const base = env.LOCALAPPDATA?.trim() || path.join(home, "AppData", "Local");
|
|
53
|
+
return path.join(base, APP_WIN);
|
|
54
|
+
}
|
|
55
|
+
const xdg = env.XDG_DATA_HOME?.trim() || path.join(home, ".local", "share");
|
|
56
|
+
return path.join(xdg, APP);
|
|
57
|
+
}
|
|
58
|
+
function defaultCacheDir(env, platform, home) {
|
|
59
|
+
if (platform === "darwin") {
|
|
60
|
+
return path.join(home, "Library", "Caches", APP_MAC);
|
|
61
|
+
}
|
|
62
|
+
if (platform === "win32") {
|
|
63
|
+
const base = env.LOCALAPPDATA?.trim() || path.join(home, "AppData", "Local");
|
|
64
|
+
return path.join(base, APP_WIN, "Cache");
|
|
65
|
+
}
|
|
66
|
+
const xdg = env.XDG_CACHE_HOME?.trim() || path.join(home, ".cache");
|
|
67
|
+
return path.join(xdg, APP);
|
|
68
|
+
}
|
|
69
|
+
function defaultRuntimeDir(env, platform, home) {
|
|
70
|
+
if (platform === "darwin") {
|
|
71
|
+
return path.join(home, "Library", "Application Support", APP_MAC, "run");
|
|
72
|
+
}
|
|
73
|
+
if (platform === "win32") {
|
|
74
|
+
const base = env.LOCALAPPDATA?.trim() || path.join(home, "AppData", "Local");
|
|
75
|
+
return path.join(base, APP_WIN, "Run");
|
|
76
|
+
}
|
|
77
|
+
const xdg = env.XDG_RUNTIME_DIR?.trim();
|
|
78
|
+
if (xdg) return path.join(xdg, APP);
|
|
79
|
+
return path.join(home, ".local", "state", APP, "run");
|
|
80
|
+
}
|
|
81
|
+
function normalizeRoot(root) {
|
|
82
|
+
const resolved = path.resolve(root);
|
|
83
|
+
return process.platform === "win32" ? resolved.replace(/\\/g, "/").toLowerCase() : resolved;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export { daemonDir, globalGraphPath, globalGraphPathForRef, repositoryIdFromRoot, repositoryStoreDir, resolveVibgratePaths, vibgrateCache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AAEA,SAAS,iBAAA,CAAkB,GAAA,EAAwB,QAAA,EAA2B,IAAA,EAAsB;AAClG,EAAA,IAAI,aAAa,QAAA,EAAU;AAEzB,IAAA,OAAY,IAAA,CAAA,IAAA,CAAK,IAAA,EAAM,SAAA,EAAW,qBAAA,EAAuB,SAAS,KAAK,CAAA;AAAA,EACzE;AACA,EAAA,IAAI,aAAa,OAAA,EAAS;AACxB,IAAA,MAAM,IAAA,GAAO,IAAI,YAAA,EAAc,IAAA,MAAe,IAAA,CAAA,IAAA,CAAK,IAAA,EAAM,WAAW,OAAO,CAAA;AAC3E,IAAA,OAAY,IAAA,CAAA,IAAA,CAAK,IAAA,EAAM,OAAA,EAAS,KAAK,CAAA;AAAA,EACvC;AACA,EAAA,MAAM,GAAA,GAAM,GAAA,CAAI,eAAA,EAAiB,IAAA,EAAK;AACtC,EAAA,IAAI,GAAA,EAAK,OAAY,IAAA,CAAA,IAAA,CAAK,GAAA,EAAK,GAAG,CAAA;AAElC,EAAA,OAAY,IAAA,CAAA,IAAA,CAAK,IAAA,EAAM,QAAA,EAAU,OAAA,EAAS,KAAK,KAAK,CAAA;AACtD;AAEA,SAAS,cAAc,IAAA,EAAsB;AAC3C,EAAA,MAAM,QAAA,GAAgB,aAAQ,IAAI,CAAA;AAElC,EAAA,OAAO,OAAA,CAAQ,aAAa,OAAA,GAAU,QAAA,CAAS,QAAQ,KAAA,EAAO,GAAG,CAAA,CAAE,WAAA,EAAY,GAAI,QAAA;AACrF","file":"chunk-BWPBB45M.js","sourcesContent":["/**\n * Global application paths for the Fusion Runtime (Phase 1).\n *\n * Generated artefacts (graph snapshots, parser caches, session transcripts)\n * must not land inside repositories by default. This module resolves the\n * platform-correct data / cache / runtime roots and content-addressed\n * per-repository store directories.\n *\n * Layout (defaults):\n * Linux: $XDG_DATA_HOME/vibgrate | $XDG_CACHE_HOME/vibgrate | $XDG_RUNTIME_DIR/vibgrate\n * macOS: ~/Library/Application Support/Vibgrate | ~/Library/Caches/Vibgrate\n * Windows: %LOCALAPPDATA%\\Vibgrate\n *\n * Pure path construction — no mkdir side effects. Callers create directories\n * when they write. Override roots via VIBGRATE_DATA_DIR / VIBGRATE_CACHE_DIR /\n * VIBGRATE_RUNTIME_DIR for tests and locked-down installs.\n */\n\nimport * as os from 'node:os';\nimport * as path from 'node:path';\nimport { shortId } from '../engine/hash.js';\nimport { branchGraphSnapshotId } from './git-ref.js';\n\nconst APP = 'vibgrate';\nconst APP_MAC = 'Vibgrate';\nconst APP_WIN = 'Vibgrate';\n\nexport type VibgratePathKind = 'data' | 'cache' | 'runtime';\n\nexport interface VibgratePaths {\n data: string;\n cache: string;\n runtime: string;\n}\n\n/**\n * Resolve the three global roots. Deterministic given env + platform + homedir.\n * Does not create directories.\n */\nexport function resolveVibgratePaths(env: NodeJS.ProcessEnv = process.env, platform: NodeJS.Platform = process.platform, home: string = os.homedir()): VibgratePaths {\n return {\n data: overrideOr(env.VIBGRATE_DATA_DIR, () => defaultDataDir(env, platform, home)),\n cache: overrideOr(env.VIBGRATE_CACHE_DIR, () => defaultCacheDir(env, platform, home)),\n runtime: overrideOr(env.VIBGRATE_RUNTIME_DIR, () => defaultRuntimeDir(env, platform, home)),\n };\n}\n\nexport function vibgrateDataDir(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform, home?: string): string {\n return resolveVibgratePaths(env, platform, home).data;\n}\n\nexport function vibgrateCacheDir(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform, home?: string): string {\n return resolveVibgratePaths(env, platform, home).cache;\n}\n\nexport function vibgrateRuntimeDir(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform, home?: string): string {\n return resolveVibgratePaths(env, platform, home).runtime;\n}\n\n/**\n * Stable repository id from an absolute (or cwd-resolved) root path.\n * Used as the directory key under the global data store so two checkouts of\n * the same path share artefacts, while distinct paths stay isolated.\n */\nexport function repositoryIdFromRoot(root: string): string {\n const normalized = normalizeRoot(root);\n return shortId(`repo:${normalized}`);\n}\n\n/** Global store for a repository's generated artefacts (graphs, sessions, …). */\nexport function repositoryStoreDir(root: string, env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform, home?: string): string {\n const id = repositoryIdFromRoot(root);\n return path.join(vibgrateDataDir(env, platform, home), 'repos', id);\n}\n\n/** Default path for a content-addressed graph snapshot inside the global store. */\nexport function globalGraphPath(root: string, snapshotId = 'current', env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform, home?: string): string {\n return path.join(repositoryStoreDir(root, env, platform, home), 'graphs', `${snapshotId}.graph.json`);\n}\n\n/**\n * Path for a branch-keyed graph snapshot (Fusion §4.1.1).\n * Uses {@link branchGraphSnapshotId} so branch names become a single path segment.\n */\nexport function globalGraphPathForRef(\n root: string,\n gitRef: string,\n env?: NodeJS.ProcessEnv,\n platform?: NodeJS.Platform,\n home?: string,\n): string {\n return globalGraphPath(root, branchGraphSnapshotId(gitRef), env, platform, home);\n}\n\n/** Daemon / session IPC directory (sockets, pid files). */\nexport function daemonDir(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform, home?: string): string {\n return path.join(vibgrateRuntimeDir(env, platform, home), 'daemon');\n}\n\nfunction overrideOr(value: string | undefined, fallback: () => string): string {\n const trimmed = value?.trim();\n if (trimmed) return path.resolve(trimmed);\n return fallback();\n}\n\nfunction defaultDataDir(env: NodeJS.ProcessEnv, platform: NodeJS.Platform, home: string): string {\n if (platform === 'darwin') {\n return path.join(home, 'Library', 'Application Support', APP_MAC);\n }\n if (platform === 'win32') {\n const base = env.LOCALAPPDATA?.trim() || path.join(home, 'AppData', 'Local');\n return path.join(base, APP_WIN);\n }\n const xdg = env.XDG_DATA_HOME?.trim() || path.join(home, '.local', 'share');\n return path.join(xdg, APP);\n}\n\nfunction defaultCacheDir(env: NodeJS.ProcessEnv, platform: NodeJS.Platform, home: string): string {\n if (platform === 'darwin') {\n return path.join(home, 'Library', 'Caches', APP_MAC);\n }\n if (platform === 'win32') {\n const base = env.LOCALAPPDATA?.trim() || path.join(home, 'AppData', 'Local');\n return path.join(base, APP_WIN, 'Cache');\n }\n const xdg = env.XDG_CACHE_HOME?.trim() || path.join(home, '.cache');\n return path.join(xdg, APP);\n}\n\nfunction defaultRuntimeDir(env: NodeJS.ProcessEnv, platform: NodeJS.Platform, home: string): string {\n if (platform === 'darwin') {\n // macOS has no XDG_RUNTIME_DIR; keep sockets under Application Support.\n return path.join(home, 'Library', 'Application Support', APP_MAC, 'run');\n }\n if (platform === 'win32') {\n const base = env.LOCALAPPDATA?.trim() || path.join(home, 'AppData', 'Local');\n return path.join(base, APP_WIN, 'Run');\n }\n const xdg = env.XDG_RUNTIME_DIR?.trim();\n if (xdg) return path.join(xdg, APP);\n // Fallback when the session has no runtime dir (some CI / SSH setups).\n return path.join(home, '.local', 'state', APP, 'run');\n}\n\nfunction normalizeRoot(root: string): string {\n const resolved = path.resolve(root);\n // Windows: drive letters vary in case; normalize for stable ids.\n return process.platform === 'win32' ? resolved.replace(/\\\\/g, '/').toLowerCase() : resolved;\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { recordCliCall, CLI_TOOL_ALIASES } from './chunk-
|
|
1
|
+
import { buildMessages, parseEdits, applyEdits, unifiedDiff, redactSecrets } from './chunk-OFUC6RYN.js';
|
|
2
|
+
import { recordCliCall, CLI_TOOL_ALIASES, buildCodeContext, buildTaskCapsule, capsuleToCodeContext } from './chunk-KSBHGWRV.js';
|
|
3
|
+
import { repositoryIdFromRoot } from './chunk-BWPBB45M.js';
|
|
3
4
|
import * as fs from 'fs';
|
|
4
5
|
import * as path from 'path';
|
|
5
6
|
|
|
@@ -25,8 +26,14 @@ async function runCodeSession(options) {
|
|
|
25
26
|
phasesRun.push(p);
|
|
26
27
|
onPhase(p, detail);
|
|
27
28
|
};
|
|
28
|
-
phase("inspect", "building graph-grounded context");
|
|
29
|
-
const context =
|
|
29
|
+
phase("inspect", options.capsule ? "building source-bearing task capsule" : "building graph-grounded context");
|
|
30
|
+
const context = buildSessionContext(graph, instruction, {
|
|
31
|
+
budget,
|
|
32
|
+
files,
|
|
33
|
+
capsule: options.capsule,
|
|
34
|
+
root,
|
|
35
|
+
fsImpl
|
|
36
|
+
});
|
|
30
37
|
if (options.attribution?.client) {
|
|
31
38
|
const seedFiles = new Set(context.seeds.map((s) => s.node.file).filter(Boolean));
|
|
32
39
|
recordCliCall(
|
|
@@ -128,6 +135,20 @@ function undoChanges(changes, fsImpl) {
|
|
|
128
135
|
}
|
|
129
136
|
return restored;
|
|
130
137
|
}
|
|
138
|
+
function buildSessionContext(graph, instruction, opts) {
|
|
139
|
+
const budget = opts.budget;
|
|
140
|
+
const files = opts.files;
|
|
141
|
+
if (!opts.capsule) {
|
|
142
|
+
return buildCodeContext(graph, instruction, { budget, files });
|
|
143
|
+
}
|
|
144
|
+
const capsule = buildTaskCapsule(graph, instruction, {
|
|
145
|
+
budget,
|
|
146
|
+
files,
|
|
147
|
+
readFile: (rel) => opts.fsImpl.read(rel),
|
|
148
|
+
repositoryId: repositoryIdFromRoot(opts.root)
|
|
149
|
+
});
|
|
150
|
+
return capsuleToCodeContext(capsule);
|
|
151
|
+
}
|
|
131
152
|
async function complete(providers, messages, chatOptions, correlationId) {
|
|
132
153
|
if (providers.length === 0) throw new Error(`no model provider available (ref ${correlationId})`);
|
|
133
154
|
let lastErr;
|
|
@@ -230,5 +251,5 @@ function shortId() {
|
|
|
230
251
|
}
|
|
231
252
|
|
|
232
253
|
export { commitChanges, nodeCodeFs, runCodeSession, undoChanges };
|
|
233
|
-
//# sourceMappingURL=chunk-
|
|
234
|
-
//# sourceMappingURL=chunk-
|
|
254
|
+
//# sourceMappingURL=chunk-CY4WKXB2.js.map
|
|
255
|
+
//# sourceMappingURL=chunk-CY4WKXB2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/code/session.ts"],"names":["resolve"],"mappings":";;;;;;AAmFA,eAAsB,eAAe,OAAA,EAAwD;AAC3F,EAAA,MAAM;AAAA,IAC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session (VG-CLI-CODE §7).\n *\n * This is the load-bearing rule the whole platform is built on, applied to code\n * edits: a state-altering change goes **through** the lifecycle, never around it\n * (GUARDRAILS §5). One run walks inspect → assess → dry-run → approve → execute\n * → verify → log:\n *\n * inspect build the graph-grounded context for the instruction\n * assess ask the routed model for a terse edit; apply it deterministically\n * (in memory); compute the diff and the blast radius\n * dry-run the DEFAULT terminal state — propose the change, write nothing\n * approve writing requires explicit consent; without it we stop at dry-run\n * execute write the approved changes to disk\n * verify confirm the files on disk match what was approved (+ optional cmd)\n * log append an immutable, secret-free audit record with a correlation id\n *\n * Everything is deterministic except the single model call, which is isolated\n * behind the provider list (tried in order, falling back on transport failure).\n * The filesystem and clock are injectable so the whole session is testable\n * offline with no writes escaping a temp dir.\n */\n\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { buildCodeContext } from './context.js';\nimport { buildTaskCapsule, capsuleToCodeContext } from './capsule.js';\nimport { recordCliCall, CLI_TOOL_ALIASES } from '../engine/savings.js';\nimport { repositoryIdFromRoot } from '../runtime/paths.js';\nimport { parseEdits, applyEdits, type SymbolSpan } from './apply.js';\nimport { unifiedDiff } from './diff.js';\nimport { buildMessages } from './prompt.js';\nimport { redactSecrets } from './providers.js';\nimport type { ChatOptions, CodeContext, CodeSessionResult, FileChange, LifecyclePhase, Provider, ProviderResult } from './types.js';\nimport type { VgGraph } from '../schema.js';\n\n/** Minimal filesystem seam so the session is testable without touching real disk. */\nexport interface CodeFs {\n read(file: string): string | null;\n write(file: string, content: string): void;\n remove(file: string): void;\n appendAudit(line: string): void;\n}\n\nexport interface RunSessionOptions {\n graph: VgGraph;\n root: string;\n instruction: string;\n /** Providers to try in order (from the router); the first that answers wins. */\n providers: Provider[];\n /** Write to disk? Default false — dry-run is the safe default (GUARDRAILS §3.2). */\n apply?: boolean;\n /** Explicit consent for the write (`--yes`); without it, a requested apply stops at dry-run. */\n consent?: boolean;\n /** Restrict the edit surface to these files. */\n files?: string[];\n /** Context token budget. */\n budget?: number;\n chatOptions?: ChatOptions;\n /** Injectable filesystem (defaults to a real, root-scoped fs). */\n fsImpl?: CodeFs;\n /** Injectable clock (ms) for the audit timestamp. */\n now?: () => number;\n /** Injectable correlation id (defaults to a random short id). */\n correlationId?: string;\n /** Progress callback per phase. */\n onPhase?: (phase: LifecyclePhase, detail: string) => void;\n /** Skip appending to the audit log (used by tests/dry programmatic calls). */\n noAudit?: boolean;\n /**\n * Who is making the graph-backed call, for per-model savings auditing. When\n * `client` is set, the context-assembly step (a `query_graph`-equivalent) is\n * recorded to the local savings ledger tagged with the provider + model, so\n * `vg savings` can break usage down per model. VG Code always sets this.\n */\n attribution?: { client: string; provider?: string; model?: string };\n /**\n * Use a source-bearing Task Capsule for the inspect context (Fusion Runtime\n * Phase 0 A/B). Default false keeps the metadata-only path.\n */\n capsule?: boolean;\n}\n\nexport async function runCodeSession(options: RunSessionOptions): Promise<CodeSessionResult> {\n const {\n graph,\n root,\n instruction,\n providers,\n apply = false,\n consent = false,\n files,\n budget,\n chatOptions,\n now = () => 0,\n onPhase = () => {},\n } = options;\n const fsImpl = options.fsImpl ?? nodeCodeFs(root);\n const correlationId = options.correlationId ?? shortId();\n const phasesRun: LifecyclePhase[] = [];\n const phase = (p: LifecyclePhase, detail: string): void => {\n phasesRun.push(p);\n onPhase(p, detail);\n };\n\n // ── inspect ──────────────────────────────────────────────────────────────\n phase('inspect', options.capsule ? 'building source-bearing task capsule' : 'building graph-grounded context');\n const context = buildSessionContext(graph, instruction, {\n budget,\n files,\n capsule: options.capsule,\n root,\n fsImpl,\n });\n\n // Per-model savings: the context build is VG Code's `query_graph`-equivalent.\n // Record it (counts only — never code or the instruction) tagged with the\n // model, so `vg savings` audits usage per model. Local-only, best-effort.\n if (options.attribution?.client) {\n const seedFiles = new Set(context.seeds.map((s) => s.node.file).filter(Boolean));\n recordCliCall(\n root,\n {\n tool: CLI_TOOL_ALIASES.ask,\n client: options.attribution.client,\n provider: options.attribution.provider,\n model: options.attribution.model,\n outcome: context.seeds.length ? 'complete' : 'miss',\n vgTokens: context.tokensEstimate,\n baselineFiles: seedFiles.size,\n },\n now(),\n );\n }\n\n // ── assess ──────────────────────────────────────────────────────────────\n phase('assess', 'asking the routed model for a minimal edit');\n const messages = buildMessages(context);\n const { result, provider, fellBack } = await complete(providers, messages, chatOptions, correlationId);\n\n const edits = parseEdits(result.text);\n const spans = spanIndex(graph);\n const applied = applyEdits(\n edits,\n (file) => fsImpl.read(file),\n (file) => spans.get(normalize(file)) ?? [],\n );\n\n const changes: FileChange[] = [];\n for (const [file, entry] of [...applied.entries()].sort((a, b) => a[0].localeCompare(b[0]))) {\n changes.push({\n file,\n before: entry.before,\n after: entry.after,\n outcomes: entry.outcomes,\n diff: unifiedDiff(entry.before, entry.after, file),\n });\n }\n\n // ── dry-run (always produced) ─────────────────────────────────────────────\n phase('dry-run', `${changes.length} file(s) would change`);\n\n const anyApplicable = changes.some((c) => c.diff !== '' && c.outcomes.some((o) => o.status === 'applied'));\n const base: CodeSessionResult = {\n instruction,\n provider: { id: provider.id, model: provider.model, local: provider.local, fellBack },\n phasesRun,\n changes,\n applied: false,\n verification: { ran: false, ok: false, detail: 'dry-run — no changes written' },\n correlationId,\n };\n\n // ── approve ───────────────────────────────────────────────────────────────\n // Writing is opt-in AND consent-gated. A requested apply without consent is\n // not an error — it degrades to a dry-run so the caller can review, then\n // re-run with --yes. This is the \"never destructive-by-default\" guardrail.\n if (!apply) {\n if (!options.noAudit) writeAudit(fsImpl, base, now());\n return base;\n }\n if (!consent) {\n const stopped = { ...base, verification: { ran: false, ok: false, detail: 'apply requested without consent — re-run with --yes to write these changes' } };\n if (!options.noAudit) writeAudit(fsImpl, stopped, now());\n return stopped;\n }\n if (!anyApplicable) {\n const nothing = { ...base, verification: { ran: false, ok: false, detail: 'nothing to write — no edit applied cleanly' } };\n if (!options.noAudit) writeAudit(fsImpl, nothing, now());\n return nothing;\n }\n phase('approve', 'consent given (--yes)');\n\n // ── execute ───────────────────────────────────────────────────────────────\n phase('execute', 'writing approved changes');\n for (const change of changes) {\n if (change.diff === '') continue; // no-op file\n if (!change.outcomes.some((o) => o.status === 'applied')) continue; // nothing applied cleanly here\n if (change.after === null) fsImpl.remove(change.file);\n else fsImpl.write(change.file, change.after);\n }\n\n // ── verify ────────────────────────────────────────────────────────────────\n phase('verify', 'confirming on-disk content matches the approved change');\n const verification = verifyWrites(fsImpl, changes);\n\n // ── log ───────────────────────────────────────────────────────────────────\n phase('log', 'recording an audit entry');\n const final: CodeSessionResult = { ...base, applied: true, verification };\n if (!options.noAudit) writeAudit(fsImpl, final, now());\n return final;\n}\n\n/**\n * Commit an already-computed dry-run result: write the cleanly-applied changes,\n * verify them on disk, and append the audit record — the \"approve → execute →\n * verify → log\" tail of the lifecycle, run against a proposal the caller has\n * already shown and had approved (the interactive REPL uses this so it never\n * calls the model twice or writes something different from what was reviewed).\n */\nexport function commitChanges(result: CodeSessionResult, fsImpl: CodeFs, now: () => number = () => 0): CodeSessionResult {\n const anyApplicable = result.changes.some((c) => c.diff !== '' && c.outcomes.some((o) => o.status === 'applied'));\n if (!anyApplicable) {\n return { ...result, applied: false, verification: { ran: false, ok: false, detail: 'nothing to write — no edit applied cleanly' } };\n }\n for (const change of result.changes) {\n if (change.diff === '' || !change.outcomes.some((o) => o.status === 'applied')) continue;\n if (change.after === null) fsImpl.remove(change.file);\n else fsImpl.write(change.file, change.after);\n }\n const verification = verifyWrites(fsImpl, result.changes);\n const final: CodeSessionResult = { ...result, applied: true, verification, phasesRun: [...result.phasesRun, 'approve', 'execute', 'verify', 'log'] };\n writeAudit(fsImpl, final, now());\n return final;\n}\n\n/**\n * Undo a set of applied changes by restoring each file's prior content — the\n * `/undo` command. A created file (before === null) is removed; an edited or\n * deleted file is restored to its `before`. Only cleanly-applied changes are\n * reverted. Returns the files it restored.\n */\nexport function undoChanges(changes: FileChange[], fsImpl: CodeFs): string[] {\n const restored: string[] = [];\n for (const ch of changes) {\n if (!ch.outcomes.some((o) => o.status === 'applied')) continue;\n if (ch.before === null) fsImpl.remove(ch.file);\n else fsImpl.write(ch.file, ch.before);\n restored.push(ch.file);\n }\n return restored;\n}\n\nfunction buildSessionContext(\n graph: VgGraph,\n instruction: string,\n opts: { budget?: number; files?: string[]; capsule?: boolean; root: string; fsImpl: CodeFs },\n): CodeContext {\n const budget = opts.budget;\n const files = opts.files;\n if (!opts.capsule) {\n return buildCodeContext(graph, instruction, { budget, files });\n }\n const capsule = buildTaskCapsule(graph, instruction, {\n budget,\n files,\n readFile: (rel) => opts.fsImpl.read(rel),\n repositoryId: repositoryIdFromRoot(opts.root),\n });\n return capsuleToCodeContext(capsule);\n}\n\n/** Try each provider in order; fall back on transport failure. Throws the last actionable error. */\nasync function complete(\n providers: Provider[],\n messages: ReturnType<typeof buildMessages>,\n chatOptions: ChatOptions | undefined,\n correlationId: string,\n): Promise<{ result: ProviderResult; provider: Provider; fellBack: boolean }> {\n if (providers.length === 0) throw new Error(`no model provider available (ref ${correlationId})`);\n let lastErr: unknown;\n for (let i = 0; i < providers.length; i++) {\n const provider = providers[i];\n try {\n const result = await provider.chat(messages, { temperature: 0, ...chatOptions });\n return { result, provider, fellBack: i > 0 };\n } catch (e) {\n lastErr = e;\n }\n }\n const message = lastErr instanceof Error ? redactSecrets(lastErr.message) : String(lastErr);\n throw new Error(`${message} (ref ${correlationId})`);\n}\n\n/** Confirm each written file's on-disk content equals what we approved. */\nfunction verifyWrites(fsImpl: CodeFs, changes: FileChange[]): { ran: boolean; ok: boolean; detail: string } {\n let checked = 0;\n const mismatches: string[] = [];\n for (const change of changes) {\n if (change.diff === '' || !change.outcomes.some((o) => o.status === 'applied')) continue;\n checked++;\n const onDisk = fsImpl.read(change.file);\n if (onDisk !== change.after) mismatches.push(change.file);\n }\n if (mismatches.length) return { ran: true, ok: false, detail: `on-disk content differs for: ${mismatches.join(', ')}` };\n return { ran: true, ok: true, detail: `wrote and verified ${checked} file(s)` };\n}\n\n/** An append-only, secret-free audit record (GUARDRAILS §2.6 / §5). No file contents, no keys. */\nfunction writeAudit(fsImpl: CodeFs, r: CodeSessionResult, ts: number): void {\n const record = {\n ts,\n correlationId: r.correlationId,\n instruction: r.instruction.slice(0, 500),\n provider: r.provider.id,\n model: r.provider.model,\n local: r.provider.local,\n applied: r.applied,\n files: r.changes.map((c) => ({ file: c.file, statuses: c.outcomes.map((o) => o.status) })),\n verification: r.verification,\n phases: r.phasesRun,\n };\n try {\n fsImpl.appendAudit(JSON.stringify(record));\n } catch {\n /* audit is best-effort; never fail the run on a logging problem */\n }\n}\n\n/** Build a per-file map of symbol spans for graph-scoped edit disambiguation. */\nfunction spanIndex(graph: VgGraph): Map<string, SymbolSpan[]> {\n const map = new Map<string, SymbolSpan[]>();\n for (const n of graph.nodes) {\n if (n.kind === 'file' || n.kind === 'external') continue;\n const file = normalize(n.file);\n const list = map.get(file) ?? [];\n list.push({ qualifiedName: n.qualifiedName, file, start: n.span.start, end: n.span.end });\n map.set(file, list);\n }\n return map;\n}\n\nfunction normalize(file: string): string {\n return file.replace(/\\\\/g, '/').replace(/^\\.\\//, '');\n}\n\n/** Default filesystem impl, scoped to `root`. Refuses paths that escape the root. */\nexport function nodeCodeFs(root: string): CodeFs {\n const resolve = (file: string): string => {\n const abs = path.resolve(root, file);\n const rel = path.relative(root, abs);\n if (rel.startsWith('..') || path.isAbsolute(rel)) {\n throw new Error(`edit path escapes the project root: ${file} — refusing to touch files outside ${root}`);\n }\n return abs;\n };\n return {\n read(file) {\n try {\n return fs.readFileSync(resolve(file), 'utf8');\n } catch {\n return null;\n }\n },\n write(file, content) {\n const abs = resolve(file);\n fs.mkdirSync(path.dirname(abs), { recursive: true });\n fs.writeFileSync(abs, content);\n },\n remove(file) {\n try {\n fs.rmSync(resolve(file));\n } catch {\n /* already gone */\n }\n },\n appendAudit(line) {\n const dir = path.join(root, '.vibgrate');\n fs.mkdirSync(dir, { recursive: true });\n fs.appendFileSync(path.join(dir, 'code-audit.jsonl'), line + '\\n');\n },\n };\n}\n\n/** Short, URL-safe correlation id. Not a graph artifact, so runtime randomness is fine here. */\nfunction shortId(): string {\n let s = '';\n const alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789';\n for (let i = 0; i < 8; i++) s += alphabet[Math.floor(Math.random() * alphabet.length)];\n return s;\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export { __require };
|
|
9
|
+
//# sourceMappingURL=chunk-DGUM43GV.js.map
|
|
10
|
+
//# sourceMappingURL=chunk-DGUM43GV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-DGUM43GV.js"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { runCoreScan, compactUiPurpose } from './chunk-
|
|
1
|
+
import { runCoreScan, compactUiPurpose } from './chunk-WGUL45AV.js';
|
|
2
2
|
import { findPackageJsonFiles, readJsonFile, findFiles, readTextFile, pathExists } from './chunk-GI6W53LM.js';
|
|
3
3
|
import { writeJsonFile } from './chunk-CRAMOEBE.js';
|
|
4
4
|
import * as path3 from 'path';
|
|
@@ -4356,5 +4356,5 @@ var baselineCommand = new Command("baseline").description("Create a drift baseli
|
|
|
4356
4356
|
});
|
|
4357
4357
|
|
|
4358
4358
|
export { baselineCommand, loadAdvancedScanHook, runBaseline };
|
|
4359
|
-
//# sourceMappingURL=chunk-
|
|
4360
|
-
//# sourceMappingURL=chunk-
|
|
4359
|
+
//# sourceMappingURL=chunk-EX4PQT6W.js.map
|
|
4360
|
+
//# sourceMappingURL=chunk-EX4PQT6W.js.map
|