@vibgrate/cli 2026.817.1 → 2026.818.1
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 +61 -0
- package/README.md +1 -0
- package/dist/activity-MF2GNYAI.js +5 -0
- package/dist/activity-MF2GNYAI.js.map +1 -0
- package/dist/agent-CUK24AWF.js +30 -0
- package/dist/{agent-CUYQKC6S.js.map → agent-CUK24AWF.js.map} +1 -1
- package/dist/{approvals-IPMUDEDV.js → approvals-YFOU6GVB.js} +6 -5
- package/dist/{approvals-IPMUDEDV.js.map → approvals-YFOU6GVB.js.map} +1 -1
- package/dist/attach-6S3XS7VO.js +9 -0
- package/dist/attach-6S3XS7VO.js.map +1 -0
- package/dist/baseline-OBZJRCCP.js +9 -0
- package/dist/{baseline-NZFGLMER.js.map → baseline-OBZJRCCP.js.map} +1 -1
- package/dist/{chunk-RJCRWQNS.js → chunk-43ESHUM5.js} +179 -463
- package/dist/chunk-43ESHUM5.js.map +1 -0
- package/dist/{chunk-YL4OIUA5.js → chunk-4QAMUBAC.js} +13 -12
- package/dist/chunk-4QAMUBAC.js.map +1 -0
- package/dist/{chunk-2BURPMYA.js → chunk-6ABMV74F.js} +72 -976
- package/dist/chunk-6ABMV74F.js.map +1 -0
- package/dist/chunk-6BEBJCK4.js +467 -0
- package/dist/chunk-6BEBJCK4.js.map +1 -0
- package/dist/{chunk-NKRWKCME.js → chunk-6LY3JH6S.js} +4 -4
- package/dist/{chunk-NKRWKCME.js.map → chunk-6LY3JH6S.js.map} +1 -1
- package/dist/chunk-6WRG7VDO.js +118 -0
- package/dist/chunk-6WRG7VDO.js.map +1 -0
- package/dist/chunk-DBX3DL27.js +26 -0
- package/dist/chunk-DBX3DL27.js.map +1 -0
- package/dist/{chunk-ZSECAGSU.js → chunk-DH6EDSQP.js} +3 -3
- package/dist/{chunk-ZSECAGSU.js.map → chunk-DH6EDSQP.js.map} +1 -1
- package/dist/{chunk-3GZSDY35.js → chunk-DM6MJ7IF.js} +4 -4
- package/dist/{chunk-3GZSDY35.js.map → chunk-DM6MJ7IF.js.map} +1 -1
- package/dist/{chunk-2TJ5EY4I.js → chunk-DUCEKH7Q.js} +12 -6
- package/dist/chunk-DUCEKH7Q.js.map +1 -0
- package/dist/{chunk-45AKSS4A.js → chunk-E7RVA2ZI.js} +4 -4
- package/dist/{chunk-45AKSS4A.js.map → chunk-E7RVA2ZI.js.map} +1 -1
- package/dist/{chunk-NHB53JTV.js → chunk-FFYO7G3T.js} +4 -4
- package/dist/{chunk-NHB53JTV.js.map → chunk-FFYO7G3T.js.map} +1 -1
- package/dist/chunk-G7ZFSH5J.js +132 -0
- package/dist/chunk-G7ZFSH5J.js.map +1 -0
- package/dist/{chunk-A7EKFLAN.js → chunk-GKZU6MII.js} +166 -31
- package/dist/chunk-GKZU6MII.js.map +1 -0
- package/dist/chunk-H5Q4JUY4.js +47 -0
- package/dist/chunk-H5Q4JUY4.js.map +1 -0
- package/dist/{chunk-JHLCKMKF.js → chunk-H6RV2OAX.js} +32 -10
- package/dist/chunk-H6RV2OAX.js.map +1 -0
- package/dist/{chunk-4W5SYK2M.js → chunk-I3PKYYRP.js} +5 -4
- package/dist/chunk-I3PKYYRP.js.map +1 -0
- package/dist/{chunk-6NOGNOE4.js → chunk-J3A3O4IA.js} +142 -127
- package/dist/chunk-J3A3O4IA.js.map +1 -0
- package/dist/{chunk-K267DHCF.js → chunk-J7CVFTLG.js} +6 -6
- package/dist/{chunk-K267DHCF.js.map → chunk-J7CVFTLG.js.map} +1 -1
- package/dist/{chunk-UBEVY5UT.js → chunk-LHQYYBCH.js} +5 -5
- package/dist/{chunk-UBEVY5UT.js.map → chunk-LHQYYBCH.js.map} +1 -1
- package/dist/{chunk-OWSXI3PJ.js → chunk-MHJBIGWV.js} +752 -51
- package/dist/chunk-MHJBIGWV.js.map +1 -0
- package/dist/{chunk-QPXVTQ7O.js → chunk-MVPRPSXU.js} +7 -4
- package/dist/chunk-MVPRPSXU.js.map +1 -0
- package/dist/chunk-NDNNOAS6.js +16 -0
- package/dist/chunk-NDNNOAS6.js.map +1 -0
- package/dist/{chunk-DT4KIVRI.js → chunk-NG4KIJW6.js} +34 -2
- package/dist/chunk-NG4KIJW6.js.map +1 -0
- package/dist/{chunk-RBIRXQR6.js → chunk-NO4BMW7M.js} +4 -14
- package/dist/chunk-NO4BMW7M.js.map +1 -0
- package/dist/chunk-O3LABX6I.js +43 -0
- package/dist/chunk-O3LABX6I.js.map +1 -0
- package/dist/{chunk-FD2HPGX2.js → chunk-OS4YFOFJ.js} +31 -10
- package/dist/chunk-OS4YFOFJ.js.map +1 -0
- package/dist/{chunk-NQUWC2IA.js → chunk-OVUZWR67.js} +108 -543
- package/dist/chunk-OVUZWR67.js.map +1 -0
- package/dist/chunk-POOL355F.js +237 -0
- package/dist/chunk-POOL355F.js.map +1 -0
- package/dist/{chunk-ENFSSUNK.js → chunk-Q7TWHJJ6.js} +5 -43
- package/dist/chunk-Q7TWHJJ6.js.map +1 -0
- package/dist/{chunk-MIYXVY57.js → chunk-SBHK4ECM.js} +4 -4
- package/dist/{chunk-MIYXVY57.js.map → chunk-SBHK4ECM.js.map} +1 -1
- package/dist/chunk-SUD54UGN.js +6 -0
- package/dist/{chunk-PV76EO4G.js.map → chunk-SUD54UGN.js.map} +1 -1
- package/dist/chunk-T7RSQ5WD.js +227 -0
- package/dist/chunk-T7RSQ5WD.js.map +1 -0
- package/dist/{chunk-ANYL7SUI.js → chunk-V2UGRUTL.js} +4761 -976
- package/dist/chunk-V2UGRUTL.js.map +1 -0
- package/dist/{chunk-2GSMCOIC.js → chunk-WVTGF2MP.js} +39 -20
- package/dist/chunk-WVTGF2MP.js.map +1 -0
- package/dist/{chunk-RQAKBRAV.js → chunk-X4DECFUG.js} +4 -4
- package/dist/{chunk-RQAKBRAV.js.map → chunk-X4DECFUG.js.map} +1 -1
- package/dist/{chunk-OZ3IFXRD.js → chunk-YENM3HT7.js} +5 -4
- package/dist/chunk-YENM3HT7.js.map +1 -0
- package/dist/{chunk-FMS6G67U.js → chunk-ZWFMJUXC.js} +151 -42
- package/dist/chunk-ZWFMJUXC.js.map +1 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +1895 -872
- package/dist/cli.js.map +1 -1
- package/dist/daemon-4Q5QBBAF.js +31 -0
- package/dist/{daemon-J2HX4GY3.js.map → daemon-4Q5QBBAF.js.map} +1 -1
- package/dist/embed-worker-main.js +5 -4
- package/dist/embed-worker-main.js.map +1 -1
- package/dist/ensure-map-B2PS5ALS.js +40 -0
- package/dist/{ensure-map-5C6KG66X.js.map → ensure-map-B2PS5ALS.js.map} +1 -1
- package/dist/{fs-NTQUFCXV.js → fs-TLPOWC2D.js} +3 -3
- package/dist/fs-TLPOWC2D.js.map +1 -0
- package/dist/graph-backend-EEXMD6XY.js +16 -0
- package/dist/{graph-backend-HH5IIQ55.js.map → graph-backend-EEXMD6XY.js.map} +1 -1
- package/dist/index.d.ts +627 -6
- package/dist/index.js +28 -20
- package/dist/index.js.map +1 -1
- package/dist/{interactive-FXPAZAUJ.js → interactive-KEPGE5HD.js} +44 -36
- package/dist/interactive-KEPGE5HD.js.map +1 -0
- package/dist/load-H5HAME25.js +11 -0
- package/dist/{load-OR2XVGAV.js.map → load-H5HAME25.js.map} +1 -1
- package/dist/parse-worker.d.ts +1 -1
- package/dist/parse-worker.js +6 -2
- package/dist/parse-worker.js.map +1 -1
- package/dist/{run-outcome-M4546HLJ.js → run-outcome-V3L4GAN4.js} +7 -6
- package/dist/run-outcome-V3L4GAN4.js.map +1 -0
- package/dist/runtime-session-M2FRGTDS.js +27 -0
- package/dist/{runtime-session-6KKMFS6Q.js.map → runtime-session-M2FRGTDS.js.map} +1 -1
- package/dist/session-77YXFUC7.js +17 -0
- package/dist/{session-HCFJUSKN.js.map → session-77YXFUC7.js.map} +1 -1
- package/dist/slot-subscription-25GOARW5.js +95 -0
- package/dist/slot-subscription-25GOARW5.js.map +1 -0
- package/dist/{stream-json-4DL65D6U.js → stream-json-S6E3W2US.js} +21 -17
- package/dist/stream-json-S6E3W2US.js.map +1 -0
- package/dist/{types-8SYlXhzm.d.ts → types-DHqH0XIE.d.ts} +11 -0
- package/dist/version-VRZT5G4T.js +4 -0
- package/dist/{version-UPIC3F4P.js.map → version-VRZT5G4T.js.map} +1 -1
- package/dist/{vg-mcp-bridge-FZGX6DYO.js → vg-mcp-bridge-HCPJWJKJ.js} +16 -14
- package/dist/vg-mcp-bridge-HCPJWJKJ.js.map +1 -0
- package/dist/{vgd-QR26FAZD.js → vgd-R2PNIDEP.js} +17 -11
- package/dist/vgd-R2PNIDEP.js.map +1 -0
- package/package.json +7 -7
- package/dist/agent-CUYQKC6S.js +0 -26
- package/dist/baseline-NZFGLMER.js +0 -9
- package/dist/chunk-2BURPMYA.js.map +0 -1
- package/dist/chunk-2GSMCOIC.js.map +0 -1
- package/dist/chunk-2TJ5EY4I.js.map +0 -1
- package/dist/chunk-4W5SYK2M.js.map +0 -1
- package/dist/chunk-6NOGNOE4.js.map +0 -1
- package/dist/chunk-A7EKFLAN.js.map +0 -1
- package/dist/chunk-ANYL7SUI.js.map +0 -1
- package/dist/chunk-DT4KIVRI.js.map +0 -1
- package/dist/chunk-ENFSSUNK.js.map +0 -1
- package/dist/chunk-FD2HPGX2.js.map +0 -1
- package/dist/chunk-FMS6G67U.js.map +0 -1
- package/dist/chunk-JHLCKMKF.js.map +0 -1
- package/dist/chunk-NQUWC2IA.js.map +0 -1
- package/dist/chunk-OWSXI3PJ.js.map +0 -1
- package/dist/chunk-OZ3IFXRD.js.map +0 -1
- package/dist/chunk-PV76EO4G.js +0 -6
- package/dist/chunk-QPXVTQ7O.js.map +0 -1
- package/dist/chunk-RBIRXQR6.js.map +0 -1
- package/dist/chunk-RJCRWQNS.js.map +0 -1
- package/dist/chunk-RXP66R2E.js +0 -39
- package/dist/chunk-RXP66R2E.js.map +0 -1
- package/dist/chunk-YL4OIUA5.js.map +0 -1
- package/dist/daemon-J2HX4GY3.js +0 -25
- package/dist/ensure-map-5C6KG66X.js +0 -32
- package/dist/fs-NTQUFCXV.js.map +0 -1
- package/dist/graph-backend-HH5IIQ55.js +0 -14
- package/dist/interactive-FXPAZAUJ.js.map +0 -1
- package/dist/load-OR2XVGAV.js +0 -10
- package/dist/run-outcome-M4546HLJ.js.map +0 -1
- package/dist/runtime-session-6KKMFS6Q.js +0 -21
- package/dist/session-HCFJUSKN.js +0 -16
- package/dist/stream-json-4DL65D6U.js.map +0 -1
- package/dist/version-UPIC3F4P.js +0 -4
- package/dist/vg-mcp-bridge-FZGX6DYO.js.map +0 -1
- package/dist/vgd-QR26FAZD.js.map +0 -1
|
@@ -1,261 +1,33 @@
|
|
|
1
|
-
import { FREE_PACK, navigationToolsetConfig, deferredToolNames, HOT_TOOLS } from './chunk-
|
|
2
|
-
import { CliError, ExitCode } from './chunk-MS6V5XKB.js';
|
|
1
|
+
import { FREE_PACK, navigationToolsetConfig, deferredToolNames, HOT_TOOLS } from './chunk-OS4YFOFJ.js';
|
|
3
2
|
import { edgeId, buildModuleResolver, resolve, applyStaticTestLinkage, nodeId } from './chunk-VIWZ4QT7.js';
|
|
4
|
-
import {
|
|
5
|
-
import { writeGraphIndex, SCHEMA_VERSION, loadGraph } from './chunk-MIYXVY57.js';
|
|
3
|
+
import { CliError, ExitCode } from './chunk-MS6V5XKB.js';
|
|
6
4
|
import { init_cli_invocation, whichOnPath, isInstalledOwnBinary } from './chunk-EZ7UC5Y5.js';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
5
|
+
import { discover, isSkippedDirName, SKIP_FILES } from './chunk-POOL355F.js';
|
|
6
|
+
import { indexFor } from './chunk-DUCEKH7Q.js';
|
|
7
|
+
import { writeGraphIndex, SCHEMA_VERSION, loadGraph } from './chunk-SBHK4ECM.js';
|
|
8
|
+
import { grammarSetVersion, toolchainGrammarSetVersion, fileRolesFromParses, setGrammarsOverride, parseSource, toolchainParser } from './chunk-J3A3O4IA.js';
|
|
9
|
+
import { redactSecrets } from './chunk-T7RSQ5WD.js';
|
|
10
|
+
import { ensureVibgrateGitignore } from './chunk-Q7TWHJJ6.js';
|
|
11
|
+
import { loadCache, cacheDir } from './chunk-MVPRPSXU.js';
|
|
12
|
+
import { serializeGraph, stableStringify } from './chunk-O3LABX6I.js';
|
|
13
|
+
import { VERSION } from './chunk-SUD54UGN.js';
|
|
12
14
|
import { shortId, canonicalize, hashString, hashBytes } from './chunk-JFGYT6BI.js';
|
|
13
|
-
import * as fs13 from 'fs';
|
|
14
|
-
import * as path12 from 'path';
|
|
15
|
-
import ignore from 'ignore';
|
|
16
15
|
import * as v8 from 'v8';
|
|
17
16
|
import Graph from 'graphology';
|
|
18
17
|
import pagerank from 'graphology-metrics/centrality/pagerank.js';
|
|
19
18
|
import betweenness from 'graphology-metrics/centrality/betweenness.js';
|
|
20
19
|
import eigenvector from 'graphology-metrics/centrality/eigenvector.js';
|
|
21
20
|
import louvain from 'graphology-communities-louvain';
|
|
21
|
+
import * as fs11 from 'fs';
|
|
22
|
+
import * as path10 from 'path';
|
|
22
23
|
import * as os from 'os';
|
|
23
24
|
import { fileURLToPath } from 'url';
|
|
24
25
|
import ts from 'typescript';
|
|
25
26
|
import * as crypto from 'crypto';
|
|
27
|
+
import ignore from 'ignore';
|
|
26
28
|
import YAML from 'yaml';
|
|
27
|
-
import
|
|
28
|
-
import { Parser, Language } from 'web-tree-sitter';
|
|
29
|
-
import * as fs10 from 'fs/promises';
|
|
29
|
+
import * as fs8 from 'fs/promises';
|
|
30
30
|
|
|
31
|
-
var SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
32
|
-
// Version control, IDE & tool metadata
|
|
33
|
-
".git",
|
|
34
|
-
".svn",
|
|
35
|
-
".hg",
|
|
36
|
-
".idea",
|
|
37
|
-
".vscode",
|
|
38
|
-
".vs",
|
|
39
|
-
// Claude Code agent state / worktrees (full monorepo copies under .claude/worktrees/)
|
|
40
|
-
".claude",
|
|
41
|
-
".vibgrate",
|
|
42
|
-
".wrangler",
|
|
43
|
-
".turbo",
|
|
44
|
-
".cache",
|
|
45
|
-
// Migration / tool backup trees (NativeScript, codemods, agent worktrees)
|
|
46
|
-
".migration_backup",
|
|
47
|
-
".update_backup",
|
|
48
|
-
".backup",
|
|
49
|
-
".bak",
|
|
50
|
-
".history",
|
|
51
|
-
".snapshots",
|
|
52
|
-
".snapshots_bak",
|
|
53
|
-
// JavaScript / Node — installed dependency trees
|
|
54
|
-
"node_modules",
|
|
55
|
-
"bower_components",
|
|
56
|
-
"jspm_packages",
|
|
57
|
-
"web_modules",
|
|
58
|
-
".pnpm-store",
|
|
59
|
-
".yarn",
|
|
60
|
-
// JS/TS meta-framework & bundler build output
|
|
61
|
-
".next",
|
|
62
|
-
".nuxt",
|
|
63
|
-
".output",
|
|
64
|
-
".svelte-kit",
|
|
65
|
-
".astro",
|
|
66
|
-
".vercel",
|
|
67
|
-
".netlify",
|
|
68
|
-
".angular",
|
|
69
|
-
".parcel-cache",
|
|
70
|
-
".docusaurus",
|
|
71
|
-
"storybook-static",
|
|
72
|
-
// Generic build / dist / coverage output
|
|
73
|
-
"dist",
|
|
74
|
-
"build",
|
|
75
|
-
"out",
|
|
76
|
-
"coverage",
|
|
77
|
-
// Native mobile platform build trees (NativeScript / Cordova / Capacitor)
|
|
78
|
-
"platforms",
|
|
79
|
-
"App_Resources",
|
|
80
|
-
// Vendored third-party source trees
|
|
81
|
-
"vendor",
|
|
82
|
-
"Pods",
|
|
83
|
-
"Carthage",
|
|
84
|
-
// Python — virtualenvs & tool caches
|
|
85
|
-
".venv",
|
|
86
|
-
"venv",
|
|
87
|
-
"virtualenv",
|
|
88
|
-
".tox",
|
|
89
|
-
".nox",
|
|
90
|
-
"__pycache__",
|
|
91
|
-
".mypy_cache",
|
|
92
|
-
".pytest_cache",
|
|
93
|
-
".ruff_cache",
|
|
94
|
-
".eggs",
|
|
95
|
-
".ipynb_checkpoints",
|
|
96
|
-
// Ruby
|
|
97
|
-
".bundle",
|
|
98
|
-
// Rust / Maven / sbt / Clojure — all build into target/
|
|
99
|
-
"target",
|
|
100
|
-
// JVM (Gradle / Maven) & .NET build output
|
|
101
|
-
".gradle",
|
|
102
|
-
"bin",
|
|
103
|
-
"obj",
|
|
104
|
-
"TestResults",
|
|
105
|
-
// Swift / Xcode
|
|
106
|
-
".build",
|
|
107
|
-
".swiftpm",
|
|
108
|
-
"DerivedData",
|
|
109
|
-
// Dart / Flutter
|
|
110
|
-
".dart_tool",
|
|
111
|
-
// Elixir / Erlang
|
|
112
|
-
"_build",
|
|
113
|
-
"deps",
|
|
114
|
-
// Haskell (Cabal / Stack)
|
|
115
|
-
"dist-newstyle",
|
|
116
|
-
".stack-work",
|
|
117
|
-
// Infrastructure-as-code build/state
|
|
118
|
-
".terraform",
|
|
119
|
-
".serverless",
|
|
120
|
-
"cdk.out",
|
|
121
|
-
".aws-sam"
|
|
122
|
-
]);
|
|
123
|
-
function isSkippedDirName(name) {
|
|
124
|
-
if (!name) return false;
|
|
125
|
-
if (SKIP_DIRS.has(name)) return true;
|
|
126
|
-
if (name.startsWith(".venv") || name.startsWith("venv-")) return true;
|
|
127
|
-
if (name === "site-packages") return true;
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
var SKIP_FILES = /* @__PURE__ */ new Set([
|
|
131
|
-
// JavaScript / Node
|
|
132
|
-
"package-lock.json",
|
|
133
|
-
"npm-shrinkwrap.json",
|
|
134
|
-
"yarn.lock",
|
|
135
|
-
"pnpm-lock.yaml",
|
|
136
|
-
"bun.lockb",
|
|
137
|
-
"bun.lock",
|
|
138
|
-
"deno.lock",
|
|
139
|
-
".pnp.cjs",
|
|
140
|
-
".pnp.data.json",
|
|
141
|
-
".pnp.loader.mjs",
|
|
142
|
-
// Python
|
|
143
|
-
"poetry.lock",
|
|
144
|
-
"pipfile.lock",
|
|
145
|
-
"pdm.lock",
|
|
146
|
-
"uv.lock",
|
|
147
|
-
"pylock.toml",
|
|
148
|
-
"conda-lock.yml",
|
|
149
|
-
// Ruby
|
|
150
|
-
"gemfile.lock",
|
|
151
|
-
// PHP
|
|
152
|
-
"composer.lock",
|
|
153
|
-
// Rust
|
|
154
|
-
"cargo.lock",
|
|
155
|
-
// Go
|
|
156
|
-
"go.sum",
|
|
157
|
-
"go.work.sum",
|
|
158
|
-
"gopkg.lock",
|
|
159
|
-
"glide.lock",
|
|
160
|
-
// .NET
|
|
161
|
-
"packages.lock.json",
|
|
162
|
-
// Java / JVM (Gradle)
|
|
163
|
-
"gradle.lockfile",
|
|
164
|
-
// Swift / Xcode
|
|
165
|
-
"package.resolved",
|
|
166
|
-
// Dart / Flutter
|
|
167
|
-
"pubspec.lock",
|
|
168
|
-
// Elixir
|
|
169
|
-
"mix.lock",
|
|
170
|
-
// Haskell (Cabal / Stack)
|
|
171
|
-
"cabal.project.freeze",
|
|
172
|
-
"stack.yaml.lock",
|
|
173
|
-
// Julia
|
|
174
|
-
"manifest.toml",
|
|
175
|
-
// R
|
|
176
|
-
"renv.lock",
|
|
177
|
-
// Perl (Carton)
|
|
178
|
-
"cpanfile.snapshot",
|
|
179
|
-
// CocoaPods / Carthage
|
|
180
|
-
"podfile.lock",
|
|
181
|
-
"cartfile.resolved",
|
|
182
|
-
// Terraform / IaC
|
|
183
|
-
".terraform.lock.hcl",
|
|
184
|
-
// Helm
|
|
185
|
-
"chart.lock",
|
|
186
|
-
// C / C++ (Conan)
|
|
187
|
-
"conan.lock",
|
|
188
|
-
// Bazel
|
|
189
|
-
"module.bazel.lock",
|
|
190
|
-
// Nix
|
|
191
|
-
"flake.lock"
|
|
192
|
-
]);
|
|
193
|
-
function toPosix(p) {
|
|
194
|
-
return p.split(path12.sep).join("/");
|
|
195
|
-
}
|
|
196
|
-
function buildRootIgnore(root, exclude) {
|
|
197
|
-
const ig = ignore();
|
|
198
|
-
const gitignorePath = path12.join(root, ".gitignore");
|
|
199
|
-
if (fs13.existsSync(gitignorePath)) {
|
|
200
|
-
ig.add(fs13.readFileSync(gitignorePath, "utf8"));
|
|
201
|
-
}
|
|
202
|
-
if (exclude.length) ig.add(exclude);
|
|
203
|
-
return ig;
|
|
204
|
-
}
|
|
205
|
-
function discover(options) {
|
|
206
|
-
const root = path12.resolve(options.root);
|
|
207
|
-
const onlyLangs = (options.only ?? []).filter(Boolean);
|
|
208
|
-
const allowLang = (lang) => onlyLangs.length === 0 || onlyLangs.includes(lang.id);
|
|
209
|
-
for (const id of onlyLangs) {
|
|
210
|
-
if (!langById(id)) {
|
|
211
|
-
throw new UsageError(`unknown language "${id}" for --only`);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
const rootIg = buildRootIgnore(root, options.exclude ?? []);
|
|
215
|
-
const scopeAbs = (options.paths && options.paths.length ? options.paths.map((p) => path12.resolve(root, p)) : [root]).filter((p) => fs13.existsSync(p));
|
|
216
|
-
const found = /* @__PURE__ */ new Map();
|
|
217
|
-
const considerFile = (abs) => {
|
|
218
|
-
const rel2 = toPosix(path12.relative(root, abs));
|
|
219
|
-
if (rel2.startsWith("..")) return;
|
|
220
|
-
if (rel2 === "" || rootIg.ignores(rel2)) return;
|
|
221
|
-
if (SKIP_FILES.has(path12.basename(abs).toLowerCase())) return;
|
|
222
|
-
const lang = langForExtension(path12.extname(abs));
|
|
223
|
-
if (!lang || !allowLang(lang)) return;
|
|
224
|
-
found.set(rel2, { rel: rel2, abs, lang });
|
|
225
|
-
};
|
|
226
|
-
const walk = (dir) => {
|
|
227
|
-
let entries;
|
|
228
|
-
try {
|
|
229
|
-
entries = fs13.readdirSync(dir, { withFileTypes: true });
|
|
230
|
-
} catch {
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
for (const entry of entries) {
|
|
234
|
-
const abs = path12.join(dir, entry.name);
|
|
235
|
-
const rel2 = toPosix(path12.relative(root, abs));
|
|
236
|
-
if (entry.isDirectory()) {
|
|
237
|
-
if (isSkippedDirName(entry.name)) continue;
|
|
238
|
-
if (rel2 && rootIg.ignores(`${rel2}/`)) continue;
|
|
239
|
-
walk(abs);
|
|
240
|
-
} else if (entry.isFile()) {
|
|
241
|
-
considerFile(abs);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
};
|
|
245
|
-
for (const scope of scopeAbs) {
|
|
246
|
-
const stat = fs13.statSync(scope);
|
|
247
|
-
if (stat.isDirectory()) walk(scope);
|
|
248
|
-
else if (stat.isFile()) considerFile(scope);
|
|
249
|
-
}
|
|
250
|
-
return [...found.values()].sort((a, b) => a.rel < b.rel ? -1 : a.rel > b.rel ? 1 : 0);
|
|
251
|
-
}
|
|
252
|
-
var UsageError = class extends Error {
|
|
253
|
-
isUsageError = true;
|
|
254
|
-
constructor(message) {
|
|
255
|
-
super(message);
|
|
256
|
-
this.name = "UsageError";
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
31
|
var MIB = 1024 * 1024;
|
|
260
32
|
var DEFAULT_MAX_FILE_BYTES = 2 * MIB;
|
|
261
33
|
var DEFAULT_MAX_FILES = 1e5;
|
|
@@ -725,14 +497,14 @@ var DEFAULT_PATHS = [
|
|
|
725
497
|
];
|
|
726
498
|
function loadCoverage(root, explicit) {
|
|
727
499
|
const candidates = (explicit && explicit.length ? explicit : DEFAULT_PATHS).map(
|
|
728
|
-
(p) =>
|
|
500
|
+
(p) => path10.resolve(root, p)
|
|
729
501
|
);
|
|
730
|
-
const found = candidates.filter((p) =>
|
|
502
|
+
const found = candidates.filter((p) => fs11.existsSync(p));
|
|
731
503
|
if (found.length === 0) return null;
|
|
732
504
|
const map = /* @__PURE__ */ new Map();
|
|
733
505
|
for (const file of found) {
|
|
734
506
|
try {
|
|
735
|
-
const text =
|
|
507
|
+
const text = fs11.readFileSync(file, "utf8");
|
|
736
508
|
if (file.endsWith(".json")) mergeIstanbul(map, text, root);
|
|
737
509
|
else mergeLcov(map, text, root);
|
|
738
510
|
} catch {
|
|
@@ -741,8 +513,8 @@ function loadCoverage(root, explicit) {
|
|
|
741
513
|
return map.size ? map : null;
|
|
742
514
|
}
|
|
743
515
|
function rel(root, p) {
|
|
744
|
-
const abs =
|
|
745
|
-
return
|
|
516
|
+
const abs = path10.isAbsolute(p) ? p : path10.resolve(root, p);
|
|
517
|
+
return path10.relative(root, abs).split(path10.sep).join("/");
|
|
746
518
|
}
|
|
747
519
|
function bump(map, file, line, hits) {
|
|
748
520
|
let lh = map.get(file);
|
|
@@ -953,7 +725,7 @@ async function parseInline(files, options) {
|
|
|
953
725
|
onProgress?.(0, files.length);
|
|
954
726
|
for (const file of files) {
|
|
955
727
|
try {
|
|
956
|
-
const source =
|
|
728
|
+
const source = fs11.readFileSync(file.abs, "utf8");
|
|
957
729
|
out.push(await parseSource(file.rel, file.lang.id, source));
|
|
958
730
|
} catch (err) {
|
|
959
731
|
out.push(emptyParse(file, `parse failed: ${err.message}`));
|
|
@@ -1008,9 +780,9 @@ function isWorkerOom(err) {
|
|
|
1008
780
|
return e?.code === "ERR_WORKER_OUT_OF_MEMORY" || /out of memory/i.test(e?.message ?? "");
|
|
1009
781
|
}
|
|
1010
782
|
function resolveWorkerFile() {
|
|
1011
|
-
const here =
|
|
1012
|
-
const candidate =
|
|
1013
|
-
return
|
|
783
|
+
const here = path10.dirname(fileURLToPath(import.meta.url));
|
|
784
|
+
const candidate = path10.join(here, "parse-worker.js");
|
|
785
|
+
return fs11.existsSync(candidate) ? candidate : null;
|
|
1014
786
|
}
|
|
1015
787
|
function chunk(items, buckets) {
|
|
1016
788
|
const out = Array.from({ length: Math.min(buckets, items.length || 1) }, () => []);
|
|
@@ -1289,12 +1061,12 @@ function enclosing3(nodes, line) {
|
|
|
1289
1061
|
return best;
|
|
1290
1062
|
}
|
|
1291
1063
|
function normalize2(p) {
|
|
1292
|
-
return
|
|
1064
|
+
return path10.resolve(p).split(path10.sep).join("/");
|
|
1293
1065
|
}
|
|
1294
1066
|
var TSC_CACHE_VERSION = "vg-tsc-cache/1";
|
|
1295
1067
|
var AMBIENT_RE = /\bdeclare\s+(global|module)\b/;
|
|
1296
1068
|
function tscCachePath(root) {
|
|
1297
|
-
return
|
|
1069
|
+
return path10.join(cacheDir(root), "tsc-cache.json");
|
|
1298
1070
|
}
|
|
1299
1071
|
function loadTscCache(root, opts) {
|
|
1300
1072
|
const file = tscCachePath(root);
|
|
@@ -1304,9 +1076,9 @@ function loadTscCache(root, opts) {
|
|
|
1304
1076
|
ts: ts.version,
|
|
1305
1077
|
entries: {}
|
|
1306
1078
|
};
|
|
1307
|
-
if (!opts.disabled &&
|
|
1079
|
+
if (!opts.disabled && fs11.existsSync(file)) {
|
|
1308
1080
|
try {
|
|
1309
|
-
const loaded = JSON.parse(
|
|
1081
|
+
const loaded = JSON.parse(fs11.readFileSync(file, "utf8"));
|
|
1310
1082
|
if (loaded.version === TSC_CACHE_VERSION && loaded.toolVersion === opts.toolVersion && loaded.ts === ts.version && loaded.entries) {
|
|
1311
1083
|
data = loaded;
|
|
1312
1084
|
}
|
|
@@ -1337,18 +1109,18 @@ function loadTscCache(root, opts) {
|
|
|
1337
1109
|
},
|
|
1338
1110
|
save() {
|
|
1339
1111
|
if (opts.disabled) return;
|
|
1340
|
-
|
|
1341
|
-
|
|
1112
|
+
fs11.mkdirSync(cacheDir(root), { recursive: true });
|
|
1113
|
+
fs11.writeFileSync(file, stableStringify(data, 0));
|
|
1342
1114
|
}
|
|
1343
1115
|
};
|
|
1344
1116
|
}
|
|
1345
1117
|
function abs$(root, rel2) {
|
|
1346
|
-
return
|
|
1118
|
+
return path10.join(root, rel2);
|
|
1347
1119
|
}
|
|
1348
1120
|
function detectAmbient(rel2, abs) {
|
|
1349
1121
|
if (rel2.endsWith(".d.ts")) return true;
|
|
1350
1122
|
try {
|
|
1351
|
-
return AMBIENT_RE.test(
|
|
1123
|
+
return AMBIENT_RE.test(fs11.readFileSync(abs, "utf8"));
|
|
1352
1124
|
} catch {
|
|
1353
1125
|
return true;
|
|
1354
1126
|
}
|
|
@@ -1641,15 +1413,15 @@ var IMPORTANCE = {
|
|
|
1641
1413
|
infra: 0.12,
|
|
1642
1414
|
"other-config": 0.08
|
|
1643
1415
|
};
|
|
1644
|
-
function
|
|
1645
|
-
return p.split(
|
|
1416
|
+
function toPosix(p) {
|
|
1417
|
+
return p.split(path10.sep).join("/");
|
|
1646
1418
|
}
|
|
1647
|
-
function
|
|
1419
|
+
function buildRootIgnore(root, exclude) {
|
|
1648
1420
|
const ig = ignore();
|
|
1649
|
-
const gitignorePath =
|
|
1650
|
-
if (
|
|
1421
|
+
const gitignorePath = path10.join(root, ".gitignore");
|
|
1422
|
+
if (fs11.existsSync(gitignorePath)) {
|
|
1651
1423
|
try {
|
|
1652
|
-
ig.add(
|
|
1424
|
+
ig.add(fs11.readFileSync(gitignorePath, "utf8"));
|
|
1653
1425
|
} catch {
|
|
1654
1426
|
}
|
|
1655
1427
|
}
|
|
@@ -1658,7 +1430,7 @@ function buildRootIgnore2(root, exclude) {
|
|
|
1658
1430
|
}
|
|
1659
1431
|
function classifyProjectContext(relOrName) {
|
|
1660
1432
|
const rel2 = relOrName.replace(/\\/g, "/");
|
|
1661
|
-
const base =
|
|
1433
|
+
const base = path10.basename(rel2);
|
|
1662
1434
|
const baseLower = base.toLowerCase();
|
|
1663
1435
|
if (/^\.env($|\.)/i.test(base) && !isEnvExampleName(baseLower)) return null;
|
|
1664
1436
|
if (SKIP_FILES.has(baseLower)) return null;
|
|
@@ -1671,7 +1443,7 @@ function classifyProjectContext(relOrName) {
|
|
|
1671
1443
|
for (const { re, category } of PATH_PATTERNS) {
|
|
1672
1444
|
if (re.test(rel2)) return category;
|
|
1673
1445
|
}
|
|
1674
|
-
const ext =
|
|
1446
|
+
const ext = path10.extname(baseLower);
|
|
1675
1447
|
if (DOC_EXTENSIONS.has(ext)) return ext === ".txt" ? "text" : "markdown";
|
|
1676
1448
|
if (API_EXTENSIONS.has(ext)) return "api-contract";
|
|
1677
1449
|
if ((ext === ".yaml" || ext === ".yml" || ext === ".json") && /openapi|swagger|asyncapi/i.test(base)) {
|
|
@@ -1689,24 +1461,24 @@ function isEnvExampleName(baseLower) {
|
|
|
1689
1461
|
return false;
|
|
1690
1462
|
}
|
|
1691
1463
|
function discoverDocs(options) {
|
|
1692
|
-
const root =
|
|
1464
|
+
const root = path10.resolve(options.root);
|
|
1693
1465
|
const maxFiles = options.maxFiles ?? DOC_MAX_FILES;
|
|
1694
|
-
const rootIg =
|
|
1695
|
-
const scopeAbs = (options.paths?.length ? options.paths.map((p) =>
|
|
1696
|
-
(p) =>
|
|
1466
|
+
const rootIg = buildRootIgnore(root, options.exclude ?? []);
|
|
1467
|
+
const scopeAbs = (options.paths?.length ? options.paths.map((p) => path10.resolve(root, p)) : [root]).filter(
|
|
1468
|
+
(p) => fs11.existsSync(p)
|
|
1697
1469
|
);
|
|
1698
1470
|
const found = /* @__PURE__ */ new Map();
|
|
1699
1471
|
const consider = (abs) => {
|
|
1700
1472
|
if (found.size >= maxFiles) return;
|
|
1701
|
-
const rel2 =
|
|
1473
|
+
const rel2 = toPosix(path10.relative(root, abs));
|
|
1702
1474
|
if (!rel2 || rel2.startsWith("..")) return;
|
|
1703
1475
|
if (rootIg.ignores(rel2)) return;
|
|
1704
|
-
const base =
|
|
1476
|
+
const base = path10.basename(abs);
|
|
1705
1477
|
if (SKIP_FILES.has(base.toLowerCase())) return;
|
|
1706
1478
|
const category = classifyProjectContext(rel2);
|
|
1707
1479
|
if (!category) return;
|
|
1708
1480
|
try {
|
|
1709
|
-
const st =
|
|
1481
|
+
const st = fs11.statSync(abs);
|
|
1710
1482
|
if (!st.isFile() || st.size > DOC_FILE_MAX_BYTES) return;
|
|
1711
1483
|
if (st.size === 0) return;
|
|
1712
1484
|
} catch {
|
|
@@ -1718,14 +1490,14 @@ function discoverDocs(options) {
|
|
|
1718
1490
|
if (found.size >= maxFiles || depth > 12) return;
|
|
1719
1491
|
let entries;
|
|
1720
1492
|
try {
|
|
1721
|
-
entries =
|
|
1493
|
+
entries = fs11.readdirSync(dir, { withFileTypes: true });
|
|
1722
1494
|
} catch {
|
|
1723
1495
|
return;
|
|
1724
1496
|
}
|
|
1725
1497
|
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
1726
1498
|
if (found.size >= maxFiles) return;
|
|
1727
|
-
const abs =
|
|
1728
|
-
const rel2 =
|
|
1499
|
+
const abs = path10.join(dir, entry.name);
|
|
1500
|
+
const rel2 = toPosix(path10.relative(root, abs));
|
|
1729
1501
|
if (entry.isDirectory()) {
|
|
1730
1502
|
if (isSkippedDirName(entry.name)) continue;
|
|
1731
1503
|
if (rel2 && rootIg.ignores(`${rel2}/`) && !rel2.startsWith(".github")) continue;
|
|
@@ -1737,7 +1509,7 @@ function discoverDocs(options) {
|
|
|
1737
1509
|
};
|
|
1738
1510
|
for (const scope of scopeAbs) {
|
|
1739
1511
|
try {
|
|
1740
|
-
const st =
|
|
1512
|
+
const st = fs11.statSync(scope);
|
|
1741
1513
|
if (st.isDirectory()) walk(scope, 0);
|
|
1742
1514
|
else if (st.isFile()) consider(scope);
|
|
1743
1515
|
} catch {
|
|
@@ -1748,7 +1520,7 @@ function discoverDocs(options) {
|
|
|
1748
1520
|
function prepareDocBody(rel2, raw, category) {
|
|
1749
1521
|
const scrubbed = redactSecrets(raw);
|
|
1750
1522
|
if (scrubbed.length <= DOC_BODY_MAX_CHARS) return scrubbed;
|
|
1751
|
-
if (category === "manifest" &&
|
|
1523
|
+
if (category === "manifest" && path10.basename(rel2).toLowerCase() === "package.json") {
|
|
1752
1524
|
return summarizePackageJson(scrubbed);
|
|
1753
1525
|
}
|
|
1754
1526
|
if (category === "api-contract" && /\.(ya?ml|json)$/i.test(rel2)) {
|
|
@@ -1794,14 +1566,14 @@ function documentNodesFromDocs(docs) {
|
|
|
1794
1566
|
for (const d of docs) {
|
|
1795
1567
|
let raw = "";
|
|
1796
1568
|
try {
|
|
1797
|
-
raw =
|
|
1569
|
+
raw = fs11.readFileSync(d.abs, "utf8");
|
|
1798
1570
|
} catch {
|
|
1799
1571
|
continue;
|
|
1800
1572
|
}
|
|
1801
1573
|
const category = d.category ?? d.kind;
|
|
1802
1574
|
const scrubbed = prepareDocBody(d.rel, raw, category);
|
|
1803
1575
|
if (!scrubbed.trim()) continue;
|
|
1804
|
-
const name =
|
|
1576
|
+
const name = path10.basename(d.rel);
|
|
1805
1577
|
const qualifiedName = d.rel.replace(/\\/g, "/");
|
|
1806
1578
|
const id = nodeId({
|
|
1807
1579
|
kind: "document",
|
|
@@ -1898,12 +1670,12 @@ function imageIdentity(ref) {
|
|
|
1898
1670
|
if (ref.digest) return `${ref.repository}@${ref.digest}`;
|
|
1899
1671
|
return ref.tag ? `${ref.repository}:${ref.tag}` : ref.repository;
|
|
1900
1672
|
}
|
|
1901
|
-
function
|
|
1673
|
+
function toPosix2(rel2) {
|
|
1902
1674
|
return rel2.replace(/\\/g, "/");
|
|
1903
1675
|
}
|
|
1904
1676
|
function resolveRelative(fromFileRel, target) {
|
|
1905
|
-
const base =
|
|
1906
|
-
const parts =
|
|
1677
|
+
const base = toPosix2(fromFileRel).split("/").slice(0, -1);
|
|
1678
|
+
const parts = toPosix2(target).split("/");
|
|
1907
1679
|
const out = [...base];
|
|
1908
1680
|
for (const part of parts) {
|
|
1909
1681
|
if (!part || part === ".") continue;
|
|
@@ -1949,15 +1721,15 @@ function parseYamlStream(rel2, source) {
|
|
|
1949
1721
|
});
|
|
1950
1722
|
return { docs, warnings };
|
|
1951
1723
|
}
|
|
1952
|
-
function spanAt(doc, lines,
|
|
1953
|
-
const node =
|
|
1724
|
+
function spanAt(doc, lines, path11) {
|
|
1725
|
+
const node = path11.length ? safeGetIn(doc.ast, path11) : doc.ast.contents;
|
|
1954
1726
|
const range = nodeRange(node) ?? nodeRange(doc.ast.contents);
|
|
1955
1727
|
if (!range) return { start: 1, end: 1 };
|
|
1956
1728
|
return lines.span(range[0], range[2] ?? range[1]);
|
|
1957
1729
|
}
|
|
1958
|
-
function safeGetIn(ast,
|
|
1730
|
+
function safeGetIn(ast, path11) {
|
|
1959
1731
|
try {
|
|
1960
|
-
return ast.getIn(
|
|
1732
|
+
return ast.getIn(path11, true);
|
|
1961
1733
|
} catch {
|
|
1962
1734
|
return void 0;
|
|
1963
1735
|
}
|
|
@@ -1966,26 +1738,26 @@ function nodeRange(node) {
|
|
|
1966
1738
|
const range = node?.range;
|
|
1967
1739
|
return Array.isArray(range) ? range : null;
|
|
1968
1740
|
}
|
|
1969
|
-
function getPath(value,
|
|
1741
|
+
function getPath(value, path11) {
|
|
1970
1742
|
let current = value;
|
|
1971
|
-
for (const key of
|
|
1743
|
+
for (const key of path11) {
|
|
1972
1744
|
if (current === null || typeof current !== "object") return void 0;
|
|
1973
1745
|
current = current[key];
|
|
1974
1746
|
}
|
|
1975
1747
|
return current;
|
|
1976
1748
|
}
|
|
1977
|
-
function getString(value,
|
|
1978
|
-
const found = getPath(value,
|
|
1749
|
+
function getString(value, path11) {
|
|
1750
|
+
const found = getPath(value, path11);
|
|
1979
1751
|
if (typeof found === "string") return found;
|
|
1980
1752
|
if (typeof found === "number" || typeof found === "boolean") return String(found);
|
|
1981
1753
|
return void 0;
|
|
1982
1754
|
}
|
|
1983
|
-
function getArray(value,
|
|
1984
|
-
const found = getPath(value,
|
|
1755
|
+
function getArray(value, path11) {
|
|
1756
|
+
const found = getPath(value, path11);
|
|
1985
1757
|
return Array.isArray(found) ? found : [];
|
|
1986
1758
|
}
|
|
1987
|
-
function getRecordEntries(value,
|
|
1988
|
-
const found = getPath(value,
|
|
1759
|
+
function getRecordEntries(value, path11) {
|
|
1760
|
+
const found = getPath(value, path11);
|
|
1989
1761
|
if (!found || typeof found !== "object" || Array.isArray(found)) return [];
|
|
1990
1762
|
return Object.entries(found).sort(([a], [b]) => a.localeCompare(b, "en"));
|
|
1991
1763
|
}
|
|
@@ -2195,7 +1967,7 @@ var dockerfileExtractor = {
|
|
|
2195
1967
|
format: "dockerfile",
|
|
2196
1968
|
matches(rel2, category) {
|
|
2197
1969
|
if (category === "docker") return true;
|
|
2198
|
-
const base =
|
|
1970
|
+
const base = toPosix2(rel2).split("/").pop()?.toLowerCase() ?? "";
|
|
2199
1971
|
return base === "dockerfile" || base === "containerfile" || base.startsWith("dockerfile.");
|
|
2200
1972
|
},
|
|
2201
1973
|
extract(rel2, source) {
|
|
@@ -2203,7 +1975,7 @@ var dockerfileExtractor = {
|
|
|
2203
1975
|
const nodes = [];
|
|
2204
1976
|
const edges = [];
|
|
2205
1977
|
const warnings = [];
|
|
2206
|
-
const posixRel =
|
|
1978
|
+
const posixRel = toPosix2(rel2);
|
|
2207
1979
|
const fileAddress = `dockerfile:${posixRel}`;
|
|
2208
1980
|
nodes.push({
|
|
2209
1981
|
kind: "image",
|
|
@@ -2288,7 +2060,7 @@ var dockerfileExtractor = {
|
|
|
2288
2060
|
for (const source2 of copySourcePaths(line.args)) {
|
|
2289
2061
|
const relativeToDockerfile = resolveRelative(posixRel, source2);
|
|
2290
2062
|
if (relativeToDockerfile) forStage.add(relativeToDockerfile);
|
|
2291
|
-
forStage.add(
|
|
2063
|
+
forStage.add(toPosix2(source2).replace(/^\.\//, ""));
|
|
2292
2064
|
}
|
|
2293
2065
|
if (forStage.size) copySources.set(currentStage, forStage);
|
|
2294
2066
|
break;
|
|
@@ -2342,7 +2114,7 @@ function collectValuesImages(value, prefix, out) {
|
|
|
2342
2114
|
var helmExtractor = {
|
|
2343
2115
|
format: "helm",
|
|
2344
2116
|
matches(rel2) {
|
|
2345
|
-
const base =
|
|
2117
|
+
const base = toPosix2(rel2).split("/").pop()?.toLowerCase() ?? "";
|
|
2346
2118
|
if (base === "chart.yaml" || base === "chart.yml") return true;
|
|
2347
2119
|
return /(^|\/)values([.-][\w.-]+)?\.ya?ml$/i.test(rel2) && /(^|\/)charts?\//i.test(rel2);
|
|
2348
2120
|
},
|
|
@@ -2353,7 +2125,7 @@ var helmExtractor = {
|
|
|
2353
2125
|
const edges = [];
|
|
2354
2126
|
const doc = docs[0];
|
|
2355
2127
|
if (!doc) return { nodes, edges, warnings };
|
|
2356
|
-
const base =
|
|
2128
|
+
const base = toPosix2(rel2).split("/").pop()?.toLowerCase() ?? "";
|
|
2357
2129
|
const isChartFile = base === "chart.yaml" || base === "chart.yml";
|
|
2358
2130
|
if (isChartFile) {
|
|
2359
2131
|
const name = getString(doc.value, ["name"]);
|
|
@@ -2553,9 +2325,9 @@ function referencedConfig(value, podPath) {
|
|
|
2553
2325
|
}
|
|
2554
2326
|
return [...out].sort();
|
|
2555
2327
|
}
|
|
2556
|
-
function readLabels(value,
|
|
2328
|
+
function readLabels(value, path11) {
|
|
2557
2329
|
const out = {};
|
|
2558
|
-
for (const [key, raw] of getRecordEntries(value,
|
|
2330
|
+
for (const [key, raw] of getRecordEntries(value, path11)) {
|
|
2559
2331
|
if (typeof raw === "string") out[key] = raw;
|
|
2560
2332
|
else if (typeof raw === "number" || typeof raw === "boolean") out[key] = String(raw);
|
|
2561
2333
|
}
|
|
@@ -2586,63 +2358,6 @@ function describeObject(value, kind) {
|
|
|
2586
2358
|
}
|
|
2587
2359
|
return parts.join(", ");
|
|
2588
2360
|
}
|
|
2589
|
-
var require2 = createRequire(import.meta.url);
|
|
2590
|
-
var TOOLCHAIN_GRAMMARS = {
|
|
2591
|
-
hcl: { wasm: "tree-sitter-hcl", pkg: "@tree-sitter-grammars/tree-sitter-hcl" }
|
|
2592
|
-
};
|
|
2593
|
-
var languageCache = /* @__PURE__ */ new Map();
|
|
2594
|
-
function toolchainGrammarDirs(pkg) {
|
|
2595
|
-
const dirs = [...grammarDirs()];
|
|
2596
|
-
try {
|
|
2597
|
-
dirs.push(path12.dirname(require2.resolve(`${pkg}/package.json`)));
|
|
2598
|
-
} catch {
|
|
2599
|
-
}
|
|
2600
|
-
return dirs;
|
|
2601
|
-
}
|
|
2602
|
-
function resolveToolchainGrammar(id) {
|
|
2603
|
-
const spec = TOOLCHAIN_GRAMMARS[id];
|
|
2604
|
-
if (!spec) return null;
|
|
2605
|
-
for (const dir of toolchainGrammarDirs(spec.pkg)) {
|
|
2606
|
-
const candidate = path12.join(dir, `${spec.wasm}.wasm`);
|
|
2607
|
-
if (fs13.existsSync(candidate)) return candidate;
|
|
2608
|
-
}
|
|
2609
|
-
return null;
|
|
2610
|
-
}
|
|
2611
|
-
async function loadToolchainLanguage(id) {
|
|
2612
|
-
const cached = languageCache.get(id);
|
|
2613
|
-
if (cached) return cached;
|
|
2614
|
-
const wasmPath = resolveToolchainGrammar(id);
|
|
2615
|
-
if (!wasmPath) return null;
|
|
2616
|
-
try {
|
|
2617
|
-
await ensureParserInit();
|
|
2618
|
-
const language = await Language.load(fs13.readFileSync(wasmPath));
|
|
2619
|
-
languageCache.set(id, language);
|
|
2620
|
-
return language;
|
|
2621
|
-
} catch {
|
|
2622
|
-
return null;
|
|
2623
|
-
}
|
|
2624
|
-
}
|
|
2625
|
-
async function toolchainParser(id) {
|
|
2626
|
-
const language = await loadToolchainLanguage(id);
|
|
2627
|
-
if (!language) return null;
|
|
2628
|
-
const parser = new Parser();
|
|
2629
|
-
parser.setLanguage(language);
|
|
2630
|
-
return parser;
|
|
2631
|
-
}
|
|
2632
|
-
function toolchainGrammarSetVersion() {
|
|
2633
|
-
const parts = [];
|
|
2634
|
-
for (const id of Object.keys(TOOLCHAIN_GRAMMARS).sort()) {
|
|
2635
|
-
const { pkg } = TOOLCHAIN_GRAMMARS[id];
|
|
2636
|
-
let version = "bundled";
|
|
2637
|
-
try {
|
|
2638
|
-
const json = require2.resolve(`${pkg}/package.json`);
|
|
2639
|
-
version = JSON.parse(fs13.readFileSync(json, "utf8")).version;
|
|
2640
|
-
} catch {
|
|
2641
|
-
}
|
|
2642
|
-
parts.push(`${pkg}@${version}`);
|
|
2643
|
-
}
|
|
2644
|
-
return parts.join(",");
|
|
2645
|
-
}
|
|
2646
2361
|
|
|
2647
2362
|
// src/engine/toolchain/terraform.ts
|
|
2648
2363
|
var BUILTIN_REF_PREFIXES = /* @__PURE__ */ new Set([
|
|
@@ -2966,10 +2681,10 @@ var GITLAB_RESERVED = /* @__PURE__ */ new Set([
|
|
|
2966
2681
|
"pages"
|
|
2967
2682
|
]);
|
|
2968
2683
|
function isGitHubWorkflowPath(rel2) {
|
|
2969
|
-
return /(^|\/)\.github\/workflows\/[^/]+\.ya?ml$/i.test(
|
|
2684
|
+
return /(^|\/)\.github\/workflows\/[^/]+\.ya?ml$/i.test(toPosix2(rel2));
|
|
2970
2685
|
}
|
|
2971
2686
|
function isGitLabCiPath(rel2) {
|
|
2972
|
-
const base =
|
|
2687
|
+
const base = toPosix2(rel2).split("/").pop()?.toLowerCase() ?? "";
|
|
2973
2688
|
return base === ".gitlab-ci.yml" || base === ".gitlab-ci.yaml";
|
|
2974
2689
|
}
|
|
2975
2690
|
function imagesBuiltBy(script) {
|
|
@@ -3019,8 +2734,8 @@ var githubActionsExtractor = {
|
|
|
3019
2734
|
const edges = [];
|
|
3020
2735
|
const doc = docs[0];
|
|
3021
2736
|
if (!doc) return { nodes, edges, warnings };
|
|
3022
|
-
const workflowName = getString(doc.value, ["name"]) ??
|
|
3023
|
-
const workflowAddress = `workflow:${
|
|
2737
|
+
const workflowName = getString(doc.value, ["name"]) ?? toPosix2(rel2).split("/").pop() ?? rel2;
|
|
2738
|
+
const workflowAddress = `workflow:${toPosix2(rel2)}`;
|
|
3024
2739
|
nodes.push({
|
|
3025
2740
|
kind: "job",
|
|
3026
2741
|
name: workflowName,
|
|
@@ -3141,7 +2856,7 @@ var gitlabCiExtractor = {
|
|
|
3141
2856
|
const edges = [];
|
|
3142
2857
|
const doc = docs[0];
|
|
3143
2858
|
if (!doc) return { nodes, edges, warnings };
|
|
3144
|
-
const pipelineAddress = `workflow:${
|
|
2859
|
+
const pipelineAddress = `workflow:${toPosix2(rel2)}`;
|
|
3145
2860
|
nodes.push({
|
|
3146
2861
|
kind: "job",
|
|
3147
2862
|
name: "GitLab CI",
|
|
@@ -3217,7 +2932,7 @@ function emitScriptEffects(rel2, script, workingDirectory, jobAddress, span, nod
|
|
|
3217
2932
|
}
|
|
3218
2933
|
function normaliseWorkspacePath(dir) {
|
|
3219
2934
|
const out = [];
|
|
3220
|
-
for (const part of
|
|
2935
|
+
for (const part of toPosix2(dir).split("/")) {
|
|
3221
2936
|
if (!part || part === ".") continue;
|
|
3222
2937
|
if (part === "..") {
|
|
3223
2938
|
out.pop();
|
|
@@ -3262,7 +2977,7 @@ function linkToolchain(input) {
|
|
|
3262
2977
|
const { nodes, edges, fileNodes, stageCopySources } = input;
|
|
3263
2978
|
const out = /* @__PURE__ */ new Map();
|
|
3264
2979
|
const counts = {};
|
|
3265
|
-
const add3 = (kind, src, dst, confidence,
|
|
2980
|
+
const add3 = (kind, src, dst, confidence, join9) => {
|
|
3266
2981
|
if (src === dst) return;
|
|
3267
2982
|
const id = edgeId(kind, src, dst);
|
|
3268
2983
|
if (out.has(id)) return;
|
|
@@ -3275,7 +2990,7 @@ function linkToolchain(input) {
|
|
|
3275
2990
|
confidence,
|
|
3276
2991
|
epistemic: "name-matched"
|
|
3277
2992
|
});
|
|
3278
|
-
counts[
|
|
2993
|
+
counts[join9] = (counts[join9] ?? 0) + 1;
|
|
3279
2994
|
};
|
|
3280
2995
|
const declared = new Set(edges.map((e) => `${e.kind} ${e.src} ${e.dst}`));
|
|
3281
2996
|
const dockerfileByPath = /* @__PURE__ */ new Map();
|
|
@@ -3292,7 +3007,7 @@ function linkToolchain(input) {
|
|
|
3292
3007
|
push(stagesByDockerfile, target.split("#")[0], node);
|
|
3293
3008
|
continue;
|
|
3294
3009
|
}
|
|
3295
|
-
if (
|
|
3010
|
+
if (toPosix2(node.file) === target) dockerfileByPath.set(target, node);
|
|
3296
3011
|
else dockerfileRefs.push(node);
|
|
3297
3012
|
continue;
|
|
3298
3013
|
}
|
|
@@ -3305,7 +3020,7 @@ function linkToolchain(input) {
|
|
|
3305
3020
|
terraformDirMarkers.push(node);
|
|
3306
3021
|
continue;
|
|
3307
3022
|
}
|
|
3308
|
-
if (node.lang === "terraform") push(terraformNodesByDir, dirOf(
|
|
3023
|
+
if (node.lang === "terraform") push(terraformNodesByDir, dirOf(toPosix2(node.file)), node);
|
|
3309
3024
|
}
|
|
3310
3025
|
for (const ref of dockerfileRefs) {
|
|
3311
3026
|
const target = dockerfileByPath.get(ref.qualifiedName.slice("dockerfile:".length));
|
|
@@ -3358,8 +3073,8 @@ function linkToolchain(input) {
|
|
|
3358
3073
|
for (const stage of stages) {
|
|
3359
3074
|
const copied = stageCopySources.get(stage.qualifiedName);
|
|
3360
3075
|
if (!copied?.length) continue;
|
|
3361
|
-
for (const
|
|
3362
|
-
const fileNodeId = fileNodes.get(
|
|
3076
|
+
for (const path11 of copied) {
|
|
3077
|
+
const fileNodeId = fileNodes.get(toPosix2(path11));
|
|
3363
3078
|
if (!fileNodeId) continue;
|
|
3364
3079
|
add3("depends_on", stage.id, fileNodeId, LINK_CONFIDENCE.dockerfileCopy, "dockerfile\u2192source");
|
|
3365
3080
|
}
|
|
@@ -3403,7 +3118,7 @@ var EMPTY_RESULT = {
|
|
|
3403
3118
|
function extractorFor(doc, head) {
|
|
3404
3119
|
for (const extractor of EXTRACTORS) {
|
|
3405
3120
|
try {
|
|
3406
|
-
if (extractor.matches(
|
|
3121
|
+
if (extractor.matches(toPosix2(doc.rel), doc.category ?? doc.kind, head)) return extractor;
|
|
3407
3122
|
} catch {
|
|
3408
3123
|
}
|
|
3409
3124
|
}
|
|
@@ -3416,21 +3131,21 @@ async function extractToolchain(docs, options = {}) {
|
|
|
3416
3131
|
const warnings = [];
|
|
3417
3132
|
const counts = {};
|
|
3418
3133
|
const stageCopySources = /* @__PURE__ */ new Map();
|
|
3419
|
-
const ordered = [...docs].sort((a, b) =>
|
|
3134
|
+
const ordered = [...docs].sort((a, b) => toPosix2(a.rel).localeCompare(toPosix2(b.rel), "en"));
|
|
3420
3135
|
for (const doc of ordered) {
|
|
3421
3136
|
let source;
|
|
3422
3137
|
let head;
|
|
3423
3138
|
try {
|
|
3424
|
-
const stat =
|
|
3139
|
+
const stat = fs11.statSync(doc.abs);
|
|
3425
3140
|
if (stat.size > TOOLCHAIN_FILE_MAX_BYTES) continue;
|
|
3426
|
-
source =
|
|
3141
|
+
source = fs11.readFileSync(doc.abs, "utf8");
|
|
3427
3142
|
head = source.slice(0, HEAD_BYTES);
|
|
3428
3143
|
} catch {
|
|
3429
3144
|
continue;
|
|
3430
3145
|
}
|
|
3431
3146
|
const extractor = extractorFor(doc, head);
|
|
3432
3147
|
if (!extractor) continue;
|
|
3433
|
-
const rel2 =
|
|
3148
|
+
const rel2 = toPosix2(doc.rel);
|
|
3434
3149
|
let extraction;
|
|
3435
3150
|
try {
|
|
3436
3151
|
extraction = await extractor.extract(rel2, source);
|
|
@@ -3526,7 +3241,7 @@ function shardTsProjects(root, files) {
|
|
|
3526
3241
|
const cache = /* @__PURE__ */ new Map();
|
|
3527
3242
|
const byKey = /* @__PURE__ */ new Map();
|
|
3528
3243
|
for (const f of files) {
|
|
3529
|
-
const dir =
|
|
3244
|
+
const dir = path10.dirname(f.abs);
|
|
3530
3245
|
const key = nearestProjectKey(root, dir, cache);
|
|
3531
3246
|
const list = byKey.get(key);
|
|
3532
3247
|
if (list) list.push(f);
|
|
@@ -3541,22 +3256,22 @@ function nearestProjectKey(root, startDir, cache) {
|
|
|
3541
3256
|
const hit = cache.get(startDir);
|
|
3542
3257
|
if (hit !== void 0) return hit;
|
|
3543
3258
|
let dir = startDir;
|
|
3544
|
-
const rootAbs =
|
|
3259
|
+
const rootAbs = path10.resolve(root);
|
|
3545
3260
|
while (true) {
|
|
3546
|
-
if (
|
|
3547
|
-
const key =
|
|
3261
|
+
if (fs11.existsSync(path10.join(dir, "tsconfig.json")) || fs11.existsSync(path10.join(dir, "tsconfig.base.json")) || fs11.existsSync(path10.join(dir, "package.json"))) {
|
|
3262
|
+
const key = toPosix3(path10.relative(rootAbs, dir)) || ".";
|
|
3548
3263
|
cache.set(startDir, key);
|
|
3549
3264
|
return key;
|
|
3550
3265
|
}
|
|
3551
|
-
if (dir === rootAbs ||
|
|
3266
|
+
if (dir === rootAbs || path10.dirname(dir) === dir) {
|
|
3552
3267
|
cache.set(startDir, ".");
|
|
3553
3268
|
return ".";
|
|
3554
3269
|
}
|
|
3555
|
-
dir =
|
|
3270
|
+
dir = path10.dirname(dir);
|
|
3556
3271
|
}
|
|
3557
3272
|
}
|
|
3558
|
-
function
|
|
3559
|
-
return p.split(
|
|
3273
|
+
function toPosix3(p) {
|
|
3274
|
+
return p.split(path10.sep).join("/");
|
|
3560
3275
|
}
|
|
3561
3276
|
|
|
3562
3277
|
// src/engine/timing.ts
|
|
@@ -3648,9 +3363,9 @@ var emptyNode = (partial) => ({
|
|
|
3648
3363
|
tested: null
|
|
3649
3364
|
});
|
|
3650
3365
|
function extractManifests(root, opts = {}) {
|
|
3651
|
-
const absRoot =
|
|
3652
|
-
const ig =
|
|
3653
|
-
const scopes = (opts.paths?.length ? opts.paths : ["."]).map((p) =>
|
|
3366
|
+
const absRoot = path10.resolve(root);
|
|
3367
|
+
const ig = buildRootIgnore2(absRoot, opts.exclude ?? []);
|
|
3368
|
+
const scopes = (opts.paths?.length ? opts.paths : ["."]).map((p) => path10.resolve(absRoot, p)).filter((p) => fs11.existsSync(p));
|
|
3654
3369
|
const found = /* @__PURE__ */ new Map();
|
|
3655
3370
|
for (const scope of scopes) {
|
|
3656
3371
|
walkManifests(absRoot, scope, ig, found);
|
|
@@ -3660,7 +3375,7 @@ function extractManifests(root, opts = {}) {
|
|
|
3660
3375
|
let deps = 0;
|
|
3661
3376
|
for (const rel2 of [...found.keys()].sort()) {
|
|
3662
3377
|
const abs = found.get(rel2);
|
|
3663
|
-
const base =
|
|
3378
|
+
const base = path10.posix.basename(rel2);
|
|
3664
3379
|
try {
|
|
3665
3380
|
if (base === "package.json") {
|
|
3666
3381
|
deps += ingestPackageJson(rel2, abs, nodes, edges);
|
|
@@ -3680,8 +3395,8 @@ function extractManifests(root, opts = {}) {
|
|
|
3680
3395
|
};
|
|
3681
3396
|
}
|
|
3682
3397
|
function ingestPackageJson(rel2, abs, nodes, edges) {
|
|
3683
|
-
const raw = JSON.parse(
|
|
3684
|
-
const pkgName = raw.name && String(raw.name).trim() ||
|
|
3398
|
+
const raw = JSON.parse(fs11.readFileSync(abs, "utf8"));
|
|
3399
|
+
const pkgName = raw.name && String(raw.name).trim() || path10.posix.dirname(rel2) || ".";
|
|
3685
3400
|
const localId = nodeId({ kind: "package", qualifiedName: pkgName, file: rel2 });
|
|
3686
3401
|
nodes.set(
|
|
3687
3402
|
localId,
|
|
@@ -3700,7 +3415,7 @@ function ingestPackageJson(rel2, abs, nodes, edges) {
|
|
|
3700
3415
|
emptyNode({
|
|
3701
3416
|
id: fileId,
|
|
3702
3417
|
kind: "file",
|
|
3703
|
-
name:
|
|
3418
|
+
name: path10.posix.basename(rel2),
|
|
3704
3419
|
qualifiedName: rel2,
|
|
3705
3420
|
file: rel2,
|
|
3706
3421
|
lang: "json"
|
|
@@ -3724,8 +3439,8 @@ function ingestPackageJson(rel2, abs, nodes, edges) {
|
|
|
3724
3439
|
return n;
|
|
3725
3440
|
}
|
|
3726
3441
|
function ingestGoMod(rel2, abs, nodes, edges) {
|
|
3727
|
-
const text =
|
|
3728
|
-
let moduleName =
|
|
3442
|
+
const text = fs11.readFileSync(abs, "utf8");
|
|
3443
|
+
let moduleName = path10.posix.dirname(rel2) || ".";
|
|
3729
3444
|
const moduleMatch = /^\s*module\s+(\S+)/m.exec(text);
|
|
3730
3445
|
if (moduleMatch) moduleName = moduleMatch[1];
|
|
3731
3446
|
const localId = nodeId({ kind: "package", qualifiedName: moduleName, file: rel2 });
|
|
@@ -3746,7 +3461,7 @@ function ingestGoMod(rel2, abs, nodes, edges) {
|
|
|
3746
3461
|
emptyNode({
|
|
3747
3462
|
id: fileId,
|
|
3748
3463
|
kind: "file",
|
|
3749
|
-
name:
|
|
3464
|
+
name: path10.posix.basename(rel2),
|
|
3750
3465
|
qualifiedName: rel2,
|
|
3751
3466
|
file: rel2,
|
|
3752
3467
|
lang: "go"
|
|
@@ -3805,12 +3520,12 @@ function addEdge(edges, kind, src, dst, confidence) {
|
|
|
3805
3520
|
count: 1
|
|
3806
3521
|
});
|
|
3807
3522
|
}
|
|
3808
|
-
function
|
|
3523
|
+
function buildRootIgnore2(root, exclude) {
|
|
3809
3524
|
const ig = ignore();
|
|
3810
|
-
const gitignorePath =
|
|
3811
|
-
if (
|
|
3525
|
+
const gitignorePath = path10.join(root, ".gitignore");
|
|
3526
|
+
if (fs11.existsSync(gitignorePath)) {
|
|
3812
3527
|
try {
|
|
3813
|
-
ig.add(
|
|
3528
|
+
ig.add(fs11.readFileSync(gitignorePath, "utf8"));
|
|
3814
3529
|
} catch {
|
|
3815
3530
|
}
|
|
3816
3531
|
}
|
|
@@ -3820,13 +3535,13 @@ function buildRootIgnore3(root, exclude) {
|
|
|
3820
3535
|
function walkManifests(root, dir, ig, found) {
|
|
3821
3536
|
let entries;
|
|
3822
3537
|
try {
|
|
3823
|
-
entries =
|
|
3538
|
+
entries = fs11.readdirSync(dir, { withFileTypes: true });
|
|
3824
3539
|
} catch {
|
|
3825
3540
|
return;
|
|
3826
3541
|
}
|
|
3827
3542
|
for (const entry of entries) {
|
|
3828
|
-
const abs =
|
|
3829
|
-
const rel2 =
|
|
3543
|
+
const abs = path10.join(dir, entry.name);
|
|
3544
|
+
const rel2 = path10.relative(root, abs).split(path10.sep).join("/");
|
|
3830
3545
|
if (entry.isDirectory()) {
|
|
3831
3546
|
if (isSkippedDirName(entry.name)) continue;
|
|
3832
3547
|
if (rel2 && ig.ignores(`${rel2}/`)) continue;
|
|
@@ -3853,7 +3568,7 @@ async function hashFilesParallel(jobs, concurrency) {
|
|
|
3853
3568
|
if (i >= jobs.length) return;
|
|
3854
3569
|
const job = jobs[i];
|
|
3855
3570
|
try {
|
|
3856
|
-
const buf = await
|
|
3571
|
+
const buf = await fs8.readFile(job.abs);
|
|
3857
3572
|
out[i] = { rel: job.rel, hash: hashBytes(buf), ok: true };
|
|
3858
3573
|
} catch {
|
|
3859
3574
|
out[i] = { rel: job.rel, hash: "", ok: false };
|
|
@@ -3868,7 +3583,7 @@ async function hashFilesParallel(jobs, concurrency) {
|
|
|
3868
3583
|
async function buildGraph(options) {
|
|
3869
3584
|
const timer = new StageTimer();
|
|
3870
3585
|
timer.start("total");
|
|
3871
|
-
const root =
|
|
3586
|
+
const root = path10.resolve(options.root);
|
|
3872
3587
|
timer.start("discover");
|
|
3873
3588
|
const files = discover({
|
|
3874
3589
|
root,
|
|
@@ -3901,7 +3616,7 @@ async function buildGraph(options) {
|
|
|
3901
3616
|
for (const file of files) {
|
|
3902
3617
|
let stat;
|
|
3903
3618
|
try {
|
|
3904
|
-
stat =
|
|
3619
|
+
stat = fs11.statSync(file.abs);
|
|
3905
3620
|
} catch {
|
|
3906
3621
|
continue;
|
|
3907
3622
|
}
|
|
@@ -4107,8 +3822,8 @@ async function buildGraph(options) {
|
|
|
4107
3822
|
});
|
|
4108
3823
|
for (const d of docs) {
|
|
4109
3824
|
try {
|
|
4110
|
-
const st =
|
|
4111
|
-
const hash = hashBytes(
|
|
3825
|
+
const st = fs11.statSync(d.abs);
|
|
3826
|
+
const hash = hashBytes(fs11.readFileSync(d.abs));
|
|
4112
3827
|
hashes.set(d.rel, hash);
|
|
4113
3828
|
fileStats.push({ rel: d.rel, size: st.size, mtimeMs: st.mtimeMs, hash });
|
|
4114
3829
|
} catch {
|
|
@@ -4164,7 +3879,7 @@ async function buildGraph(options) {
|
|
|
4164
3879
|
toolchain
|
|
4165
3880
|
},
|
|
4166
3881
|
meta: {
|
|
4167
|
-
root:
|
|
3882
|
+
root: path10.basename(root) === "" ? "." : ".",
|
|
4168
3883
|
languages,
|
|
4169
3884
|
analysisTier: analysis.tier,
|
|
4170
3885
|
counts: {
|
|
@@ -4214,7 +3929,8 @@ async function buildGraph(options) {
|
|
|
4214
3929
|
tsc: tscStats,
|
|
4215
3930
|
scip: scipStats,
|
|
4216
3931
|
index: indexResult,
|
|
4217
|
-
warnings
|
|
3932
|
+
warnings,
|
|
3933
|
+
fileRoles: fileRolesFromParses(parses)
|
|
4218
3934
|
};
|
|
4219
3935
|
}
|
|
4220
3936
|
function toRepoRel(p) {
|
|
@@ -4223,14 +3939,14 @@ function toRepoRel(p) {
|
|
|
4223
3939
|
function loadScipIndex(root, explicit) {
|
|
4224
3940
|
const candidates = [
|
|
4225
3941
|
explicit,
|
|
4226
|
-
|
|
4227
|
-
|
|
3942
|
+
path10.join(root, "index.scip"),
|
|
3943
|
+
path10.join(root, ".vibgrate", "index.scip")
|
|
4228
3944
|
].filter((p) => Boolean(p));
|
|
4229
3945
|
for (const file of candidates) {
|
|
4230
|
-
const abs =
|
|
4231
|
-
if (!
|
|
3946
|
+
const abs = path10.isAbsolute(file) ? file : path10.resolve(root, file);
|
|
3947
|
+
if (!fs11.existsSync(abs)) continue;
|
|
4232
3948
|
try {
|
|
4233
|
-
const index = decodeScipIndex(new Uint8Array(
|
|
3949
|
+
const index = decodeScipIndex(new Uint8Array(fs11.readFileSync(abs)));
|
|
4234
3950
|
if (index.documents.length) {
|
|
4235
3951
|
return { index, tool: index.toolVersion ? `${index.toolName} ${index.toolVersion}` : index.toolName };
|
|
4236
3952
|
}
|
|
@@ -4324,21 +4040,21 @@ function diffHint(x, y) {
|
|
|
4324
4040
|
}
|
|
4325
4041
|
var SNAPSHOT_VERSION = "vg-freshness/1";
|
|
4326
4042
|
function snapshotPath(root) {
|
|
4327
|
-
return
|
|
4043
|
+
return path10.join(cacheDir(root), "freshness.json");
|
|
4328
4044
|
}
|
|
4329
4045
|
function writeSnapshot(root, corpusHash, fileStats, scope = {}) {
|
|
4330
4046
|
const files = {};
|
|
4331
4047
|
for (const f of fileStats) files[f.rel] = { size: f.size, mtimeMs: f.mtimeMs, hash: f.hash };
|
|
4332
4048
|
const snapshot = { version: SNAPSHOT_VERSION, corpusHash, scope: pruneScope(scope), files };
|
|
4333
4049
|
try {
|
|
4334
|
-
|
|
4335
|
-
|
|
4050
|
+
fs11.mkdirSync(cacheDir(root), { recursive: true });
|
|
4051
|
+
fs11.writeFileSync(snapshotPath(root), stableStringify(snapshot, 0));
|
|
4336
4052
|
} catch {
|
|
4337
4053
|
}
|
|
4338
4054
|
}
|
|
4339
4055
|
function loadSnapshot(root) {
|
|
4340
4056
|
try {
|
|
4341
|
-
const loaded = JSON.parse(
|
|
4057
|
+
const loaded = JSON.parse(fs11.readFileSync(snapshotPath(root), "utf8"));
|
|
4342
4058
|
if (loaded.version === SNAPSHOT_VERSION && loaded.files && typeof loaded.corpusHash === "string") {
|
|
4343
4059
|
return { ...loaded, scope: loaded.scope ?? {} };
|
|
4344
4060
|
}
|
|
@@ -4381,7 +4097,7 @@ function probeFreshness(root) {
|
|
|
4381
4097
|
}
|
|
4382
4098
|
let stat;
|
|
4383
4099
|
try {
|
|
4384
|
-
stat =
|
|
4100
|
+
stat = fs11.statSync(file.abs);
|
|
4385
4101
|
} catch {
|
|
4386
4102
|
drift.removed.push(file.rel);
|
|
4387
4103
|
continue;
|
|
@@ -4399,7 +4115,7 @@ function probeFreshness(root) {
|
|
|
4399
4115
|
}
|
|
4400
4116
|
let hash = "";
|
|
4401
4117
|
try {
|
|
4402
|
-
hash = hashBytes(
|
|
4118
|
+
hash = hashBytes(fs11.readFileSync(file.abs));
|
|
4403
4119
|
} catch {
|
|
4404
4120
|
drift.removed.push(file.rel);
|
|
4405
4121
|
continue;
|
|
@@ -4416,7 +4132,7 @@ function probeFreshness(root) {
|
|
|
4416
4132
|
}
|
|
4417
4133
|
if (absorbed && !hasDrift(drift)) {
|
|
4418
4134
|
try {
|
|
4419
|
-
|
|
4135
|
+
fs11.writeFileSync(snapshotPath(root), stableStringify(snapshot, 0));
|
|
4420
4136
|
} catch {
|
|
4421
4137
|
}
|
|
4422
4138
|
}
|
|
@@ -4661,12 +4377,12 @@ function detectAssistants(root, opts = {}) {
|
|
|
4661
4377
|
const which = opts.which ?? whichOnPath;
|
|
4662
4378
|
const found = [];
|
|
4663
4379
|
for (const assistant of ASSISTANTS) {
|
|
4664
|
-
const repoHit = (assistant.markers ?? []).find((m) =>
|
|
4380
|
+
const repoHit = (assistant.markers ?? []).find((m) => fs11.existsSync(path10.join(root, m)));
|
|
4665
4381
|
if (repoHit) {
|
|
4666
4382
|
found.push({ assistant, via: "repo", marker: repoHit });
|
|
4667
4383
|
continue;
|
|
4668
4384
|
}
|
|
4669
|
-
const homeHit = (assistant.homeMarkers ?? []).find((m) =>
|
|
4385
|
+
const homeHit = (assistant.homeMarkers ?? []).find((m) => fs11.existsSync(path10.join(home, m)));
|
|
4670
4386
|
if (homeHit) {
|
|
4671
4387
|
found.push({ assistant, via: "home", marker: homeHit });
|
|
4672
4388
|
continue;
|
|
@@ -4698,19 +4414,19 @@ function installAssistant(a, opts) {
|
|
|
4698
4414
|
const skipped = [];
|
|
4699
4415
|
let note;
|
|
4700
4416
|
if (a.skill) {
|
|
4701
|
-
writeFileEnsured(
|
|
4417
|
+
writeFileEnsured(path10.join(opts.root, a.skill), skillMarkdown(a.id));
|
|
4702
4418
|
wrote.push(a.skill);
|
|
4703
4419
|
}
|
|
4704
4420
|
if (a.mcp) {
|
|
4705
4421
|
const launch = opts.launch ?? detectServeLaunch();
|
|
4706
|
-
upsertMcp(
|
|
4422
|
+
upsertMcp(path10.join(opts.root, a.mcp.file), a.mcp, launch);
|
|
4707
4423
|
wrote.push(a.mcp.file);
|
|
4708
4424
|
note = launch.note;
|
|
4709
4425
|
} else {
|
|
4710
4426
|
skipped.push("mcp (host-specific setup)");
|
|
4711
4427
|
}
|
|
4712
4428
|
if (a.nudge && opts.hook !== false) {
|
|
4713
|
-
writeNudge(
|
|
4429
|
+
writeNudge(path10.join(opts.root, a.nudge.file), a.nudge, opts.smallRepo, a.id);
|
|
4714
4430
|
wrote.push(a.nudge.file);
|
|
4715
4431
|
} else if (a.nudge) {
|
|
4716
4432
|
skipped.push("nudge (--no-hook)");
|
|
@@ -4720,34 +4436,34 @@ function installAssistant(a, opts) {
|
|
|
4720
4436
|
function uninstallAssistant(a, root, purge) {
|
|
4721
4437
|
const removed = [];
|
|
4722
4438
|
if (a.mcp) {
|
|
4723
|
-
const file =
|
|
4439
|
+
const file = path10.join(root, a.mcp.file);
|
|
4724
4440
|
if (removeMcp(file, a.mcp)) removed.push(a.mcp.file);
|
|
4725
4441
|
}
|
|
4726
4442
|
if (a.nudge) {
|
|
4727
|
-
const file =
|
|
4443
|
+
const file = path10.join(root, a.nudge.file);
|
|
4728
4444
|
if (a.nudge.kind === "block") {
|
|
4729
4445
|
if (removeBlock(file)) removed.push(a.nudge.file);
|
|
4730
|
-
} else if (
|
|
4731
|
-
|
|
4446
|
+
} else if (fs11.existsSync(file)) {
|
|
4447
|
+
fs11.rmSync(file);
|
|
4732
4448
|
removed.push(a.nudge.file);
|
|
4733
4449
|
}
|
|
4734
4450
|
}
|
|
4735
4451
|
if (purge && a.skill) {
|
|
4736
|
-
const file =
|
|
4737
|
-
if (
|
|
4738
|
-
|
|
4452
|
+
const file = path10.join(root, a.skill);
|
|
4453
|
+
if (fs11.existsSync(file)) {
|
|
4454
|
+
fs11.rmSync(file);
|
|
4739
4455
|
removed.push(a.skill);
|
|
4740
4456
|
}
|
|
4741
4457
|
}
|
|
4742
4458
|
return removed;
|
|
4743
4459
|
}
|
|
4744
4460
|
function isAssistantInstalled(a, root) {
|
|
4745
|
-
if (a.skill &&
|
|
4461
|
+
if (a.skill && fs11.existsSync(path10.join(root, a.skill))) return true;
|
|
4746
4462
|
if (a.mcp) {
|
|
4747
|
-
const file =
|
|
4463
|
+
const file = path10.join(root, a.mcp.file);
|
|
4748
4464
|
if (a.mcp.format === "toml") {
|
|
4749
4465
|
if (hasTomlMcp(file, a.mcp)) return true;
|
|
4750
|
-
} else if (
|
|
4466
|
+
} else if (fs11.existsSync(file)) {
|
|
4751
4467
|
try {
|
|
4752
4468
|
const config = readJson(file);
|
|
4753
4469
|
const bag = config[a.mcp.key];
|
|
@@ -4757,8 +4473,8 @@ function isAssistantInstalled(a, root) {
|
|
|
4757
4473
|
}
|
|
4758
4474
|
}
|
|
4759
4475
|
if (a.nudge) {
|
|
4760
|
-
const file =
|
|
4761
|
-
if (!
|
|
4476
|
+
const file = path10.join(root, a.nudge.file);
|
|
4477
|
+
if (!fs11.existsSync(file)) return false;
|
|
4762
4478
|
const text = readTextSafe(file);
|
|
4763
4479
|
if (!text) return false;
|
|
4764
4480
|
if (a.nudge.kind === "block") return text.includes(NUDGE_BEGIN);
|
|
@@ -4767,19 +4483,19 @@ function isAssistantInstalled(a, root) {
|
|
|
4767
4483
|
return false;
|
|
4768
4484
|
}
|
|
4769
4485
|
function writeFileEnsured(file, content) {
|
|
4770
|
-
|
|
4771
|
-
|
|
4486
|
+
fs11.mkdirSync(path10.dirname(file), { recursive: true });
|
|
4487
|
+
fs11.writeFileSync(file, content);
|
|
4772
4488
|
}
|
|
4773
4489
|
function writeNavigationConfig(root) {
|
|
4774
4490
|
ensureVibgrateGitignore(root);
|
|
4775
|
-
const rel2 =
|
|
4491
|
+
const rel2 = path10.join(".vibgrate", "mcp-navigation.json");
|
|
4776
4492
|
const doc = {
|
|
4777
4493
|
_readme: "Deferred-loading config for agents embedding `vg serve` via the Claude API (defer_loading + tool-search). The hot navigation core stays in context; the rest load on demand \u2014 ~350-450 schema tokens/step vs ~1,881 for the full set. Hosts without defer_loading ignore this and serve the whole (already optimized) tool set. See docs/graph/VG-NAVIGATION-PROFILE.md.",
|
|
4778
4494
|
hot_core: [...HOT_TOOLS],
|
|
4779
4495
|
deferred: deferredToolNames(),
|
|
4780
4496
|
toolset: navigationToolsetConfig()
|
|
4781
4497
|
};
|
|
4782
|
-
writeFileEnsured(
|
|
4498
|
+
writeFileEnsured(path10.join(root, rel2), `${JSON.stringify(doc, null, 2)}
|
|
4783
4499
|
`);
|
|
4784
4500
|
return rel2;
|
|
4785
4501
|
}
|
|
@@ -4809,7 +4525,7 @@ function upsertTomlMcp(file, target, launch) {
|
|
|
4809
4525
|
command = ${tomlString(entry.command)}
|
|
4810
4526
|
args = [${entry.args.map(tomlString).join(", ")}]
|
|
4811
4527
|
`;
|
|
4812
|
-
const existing =
|
|
4528
|
+
const existing = fs11.existsSync(file) ? fs11.readFileSync(file, "utf8") : "";
|
|
4813
4529
|
const re = tomlTableRe(target.key);
|
|
4814
4530
|
const next = re.test(existing) ? existing.replace(re, (m) => m.startsWith("\n") ? `
|
|
4815
4531
|
${table}` : table) : existing.length ? `${existing.replace(/\s*$/, "")}
|
|
@@ -4818,7 +4534,7 @@ ${table}` : table;
|
|
|
4818
4534
|
writeFileEnsured(file, next);
|
|
4819
4535
|
}
|
|
4820
4536
|
function removeTomlMcp(file, target) {
|
|
4821
|
-
if (!
|
|
4537
|
+
if (!fs11.existsSync(file)) return false;
|
|
4822
4538
|
const existing = readTextSafe(file);
|
|
4823
4539
|
if (existing === null) return false;
|
|
4824
4540
|
const re = tomlTableRe(target.key);
|
|
@@ -4828,13 +4544,13 @@ function removeTomlMcp(file, target) {
|
|
|
4828
4544
|
return true;
|
|
4829
4545
|
}
|
|
4830
4546
|
function hasTomlMcp(file, target) {
|
|
4831
|
-
if (!
|
|
4547
|
+
if (!fs11.existsSync(file)) return false;
|
|
4832
4548
|
const text = readTextSafe(file);
|
|
4833
4549
|
return text !== null && tomlTableRe(target.key).test(text);
|
|
4834
4550
|
}
|
|
4835
4551
|
function removeMcp(file, target) {
|
|
4836
4552
|
if (target.format === "toml") return removeTomlMcp(file, target);
|
|
4837
|
-
if (!
|
|
4553
|
+
if (!fs11.existsSync(file)) return false;
|
|
4838
4554
|
const config = readJson(file);
|
|
4839
4555
|
const bag = config[target.key];
|
|
4840
4556
|
if (!bag || !(bag.vg !== void 0)) return false;
|
|
@@ -4853,8 +4569,8 @@ function refreshInstalledInstructions(root, smallRepo) {
|
|
|
4853
4569
|
};
|
|
4854
4570
|
for (const a of ASSISTANTS) {
|
|
4855
4571
|
if (a.skill) {
|
|
4856
|
-
const file =
|
|
4857
|
-
if (
|
|
4572
|
+
const file = path10.join(root, a.skill);
|
|
4573
|
+
if (fs11.existsSync(file)) {
|
|
4858
4574
|
const text = readTextSafe(file);
|
|
4859
4575
|
const from = text === null ? null : staleVersion(text, "# vg \u2014 the code map");
|
|
4860
4576
|
if (from !== null) {
|
|
@@ -4864,8 +4580,8 @@ function refreshInstalledInstructions(root, smallRepo) {
|
|
|
4864
4580
|
}
|
|
4865
4581
|
}
|
|
4866
4582
|
if (a.nudge) {
|
|
4867
|
-
const file =
|
|
4868
|
-
if (!
|
|
4583
|
+
const file = path10.join(root, a.nudge.file);
|
|
4584
|
+
if (!fs11.existsSync(file)) continue;
|
|
4869
4585
|
const text = readTextSafe(file);
|
|
4870
4586
|
if (text === null) continue;
|
|
4871
4587
|
if (a.nudge.kind === "block") {
|
|
@@ -4889,7 +4605,7 @@ function refreshInstalledInstructions(root, smallRepo) {
|
|
|
4889
4605
|
}
|
|
4890
4606
|
function readTextSafe(file) {
|
|
4891
4607
|
try {
|
|
4892
|
-
return
|
|
4608
|
+
return fs11.readFileSync(file, "utf8");
|
|
4893
4609
|
} catch {
|
|
4894
4610
|
return null;
|
|
4895
4611
|
}
|
|
@@ -4908,8 +4624,8 @@ ${stripMarkers(nudgeMarkdown(smallRepo, client))}` : stripMarkers(nudgeMarkdown(
|
|
|
4908
4624
|
upsertBlock(file, nudgeMarkdown(smallRepo, client));
|
|
4909
4625
|
}
|
|
4910
4626
|
function upsertBlock(file, block) {
|
|
4911
|
-
|
|
4912
|
-
let existing =
|
|
4627
|
+
fs11.mkdirSync(path10.dirname(file), { recursive: true });
|
|
4628
|
+
let existing = fs11.existsSync(file) ? fs11.readFileSync(file, "utf8") : "";
|
|
4913
4629
|
const re = new RegExp(`${escapeRe(NUDGE_BEGIN)}[\\s\\S]*?${escapeRe(NUDGE_END)}`);
|
|
4914
4630
|
if (re.test(existing)) existing = existing.replace(re, block);
|
|
4915
4631
|
else existing = existing.length ? `${existing.replace(/\s*$/, "")}
|
|
@@ -4917,20 +4633,20 @@ function upsertBlock(file, block) {
|
|
|
4917
4633
|
${block}
|
|
4918
4634
|
` : `${block}
|
|
4919
4635
|
`;
|
|
4920
|
-
|
|
4636
|
+
fs11.writeFileSync(file, existing);
|
|
4921
4637
|
}
|
|
4922
4638
|
function removeBlock(file) {
|
|
4923
|
-
if (!
|
|
4924
|
-
const existing =
|
|
4639
|
+
if (!fs11.existsSync(file)) return false;
|
|
4640
|
+
const existing = fs11.readFileSync(file, "utf8");
|
|
4925
4641
|
const re = new RegExp(`\\n*${escapeRe(NUDGE_BEGIN)}[\\s\\S]*?${escapeRe(NUDGE_END)}\\n*`);
|
|
4926
4642
|
if (!re.test(existing)) return false;
|
|
4927
|
-
|
|
4643
|
+
fs11.writeFileSync(file, existing.replace(re, "\n"));
|
|
4928
4644
|
return true;
|
|
4929
4645
|
}
|
|
4930
4646
|
function readJson(file) {
|
|
4931
|
-
if (!
|
|
4647
|
+
if (!fs11.existsSync(file)) return {};
|
|
4932
4648
|
try {
|
|
4933
|
-
const parsed = JSON.parse(
|
|
4649
|
+
const parsed = JSON.parse(fs11.readFileSync(file, "utf8"));
|
|
4934
4650
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
4935
4651
|
return parsed;
|
|
4936
4652
|
}
|
|
@@ -4949,6 +4665,6 @@ function escapeRe(s) {
|
|
|
4949
4665
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4950
4666
|
}
|
|
4951
4667
|
|
|
4952
|
-
export { ASSISTANTS, ResourceLimitError,
|
|
4953
|
-
//# sourceMappingURL=chunk-
|
|
4954
|
-
//# sourceMappingURL=chunk-
|
|
4668
|
+
export { ASSISTANTS, ResourceLimitError, SMALL_REPO_FILES, analyze, applyCoverage, assistantById, buildFacts, buildGraph, decodeScipIndex, detectAssistants, detectServeLaunch, driftCount, epistemicBreakdown, groundGraph, hasDrift, installAssistant, isAssistantInstalled, loadCoverage, loadSnapshot, probeFreshness, refreshInstalledInstructions, resolveLimits, scipEdges, uninstallAssistant, verifyDeterminism, versionMarker, writeNavigationConfig, writeSnapshot };
|
|
4669
|
+
//# sourceMappingURL=chunk-43ESHUM5.js.map
|
|
4670
|
+
//# sourceMappingURL=chunk-43ESHUM5.js.map
|