@vibgrate/cli 2026.817.2 → 2026.818.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/dist/activity-MF2GNYAI.js +5 -0
- package/dist/activity-MF2GNYAI.js.map +1 -0
- package/dist/agent-X6VYCE63.js +30 -0
- package/dist/{agent-UQC7QN77.js.map → agent-X6VYCE63.js.map} +1 -1
- package/dist/{approvals-ASPJQUZK.js → approvals-TPQFQSWG.js} +5 -5
- package/dist/{approvals-ASPJQUZK.js.map → approvals-TPQFQSWG.js.map} +1 -1
- package/dist/attach-G5JUIWIT.js +10 -0
- package/dist/attach-G5JUIWIT.js.map +1 -0
- package/dist/baseline-DXI64VLW.js +9 -0
- package/dist/{baseline-FIV6PR2M.js.map → baseline-DXI64VLW.js.map} +1 -1
- package/dist/{chunk-AXZZ5CCG.js → chunk-2C33WR5O.js} +38 -19
- package/dist/chunk-2C33WR5O.js.map +1 -0
- package/dist/chunk-4NTNMT6T.js +6 -0
- package/dist/{chunk-PRG2ULPK.js.map → chunk-4NTNMT6T.js.map} +1 -1
- package/dist/chunk-5IQBIXHS.js +23 -0
- package/dist/chunk-5IQBIXHS.js.map +1 -0
- package/dist/{chunk-6K3XK7C5.js → chunk-6ABMV74F.js} +6 -3
- 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-E2FAQREZ.js → chunk-6PFHDHOL.js} +174 -401
- package/dist/chunk-6PFHDHOL.js.map +1 -0
- package/dist/chunk-6WRG7VDO.js +118 -0
- package/dist/chunk-6WRG7VDO.js.map +1 -0
- package/dist/{chunk-3NJUOIZQ.js → chunk-AEJYA6HZ.js} +5 -5
- package/dist/{chunk-3NJUOIZQ.js.map → chunk-AEJYA6HZ.js.map} +1 -1
- package/dist/{chunk-O2DL2Q55.js → chunk-B4EXD5LK.js} +5 -5
- package/dist/{chunk-O2DL2Q55.js.map → chunk-B4EXD5LK.js.map} +1 -1
- package/dist/{chunk-EXV4QSAD.js → chunk-BMOFJIMG.js} +3 -3
- package/dist/{chunk-EXV4QSAD.js.map → chunk-BMOFJIMG.js.map} +1 -1
- package/dist/chunk-DBX3DL27.js +26 -0
- package/dist/chunk-DBX3DL27.js.map +1 -0
- package/dist/{chunk-KNGAZDGF.js → chunk-E3O5UKNA.js} +151 -42
- package/dist/chunk-E3O5UKNA.js.map +1 -0
- package/dist/{chunk-RBIRXQR6.js → chunk-E53WBVUQ.js} +7 -14
- package/dist/chunk-E53WBVUQ.js.map +1 -0
- package/dist/{chunk-C3LMWZKF.js → chunk-FFXGWFAE.js} +4 -4
- package/dist/{chunk-C3LMWZKF.js.map → chunk-FFXGWFAE.js.map} +1 -1
- package/dist/chunk-H5Q4JUY4.js +47 -0
- package/dist/chunk-H5Q4JUY4.js.map +1 -0
- package/dist/{chunk-LHKQGVRF.js → chunk-HF6R73UC.js} +100 -11
- package/dist/chunk-HF6R73UC.js.map +1 -0
- package/dist/{chunk-K6DXETMC.js → chunk-JGA63RGF.js} +13 -12
- package/dist/chunk-JGA63RGF.js.map +1 -0
- package/dist/{chunk-3FMRFECC.js → chunk-KU7FI5EV.js} +3 -3
- package/dist/{chunk-3FMRFECC.js.map → chunk-KU7FI5EV.js.map} +1 -1
- package/dist/{chunk-5OL2TSHK.js → chunk-L2OS4WHT.js} +4 -4
- package/dist/{chunk-5OL2TSHK.js.map → chunk-L2OS4WHT.js.map} +1 -1
- package/dist/chunk-LJSJX6U4.js +38 -0
- package/dist/chunk-LJSJX6U4.js.map +1 -0
- package/dist/{chunk-Q4G2BWE3.js → chunk-MRZHNUN7.js} +12 -6
- package/dist/chunk-MRZHNUN7.js.map +1 -0
- package/dist/chunk-NDNNOAS6.js +16 -0
- package/dist/chunk-NDNNOAS6.js.map +1 -0
- package/dist/chunk-NJQZRM55.js +100 -0
- package/dist/chunk-NJQZRM55.js.map +1 -0
- package/dist/{chunk-DVW3SVCW.js → chunk-NKLYDSB7.js} +29 -9
- package/dist/chunk-NKLYDSB7.js.map +1 -0
- package/dist/{chunk-TVDMNIUT.js → chunk-O5IJDMTB.js} +4 -4
- package/dist/{chunk-TVDMNIUT.js.map → chunk-O5IJDMTB.js.map} +1 -1
- package/dist/chunk-POOL355F.js +237 -0
- package/dist/chunk-POOL355F.js.map +1 -0
- package/dist/{chunk-XLXJC7H3.js → chunk-PRHH4DVO.js} +5 -118
- package/dist/chunk-PRHH4DVO.js.map +1 -0
- package/dist/{chunk-3H3SVJUY.js → chunk-RHKOUPWT.js} +107 -542
- package/dist/chunk-RHKOUPWT.js.map +1 -0
- package/dist/{chunk-WAKP7SK7.js → chunk-V2UGRUTL.js} +225 -48
- package/dist/chunk-V2UGRUTL.js.map +1 -0
- package/dist/{chunk-2FEB5KJS.js → chunk-V6WONSIK.js} +5 -4
- package/dist/chunk-V6WONSIK.js.map +1 -0
- package/dist/{chunk-WVMOGIPC.js → chunk-VMAIDM4K.js} +3 -3
- package/dist/{chunk-WVMOGIPC.js.map → chunk-VMAIDM4K.js.map} +1 -1
- package/dist/{chunk-GOGMS3ST.js → chunk-VQ5KMHW6.js} +860 -65
- package/dist/chunk-VQ5KMHW6.js.map +1 -0
- package/dist/{chunk-M7IO3DXH.js → chunk-X2MQ7UFL.js} +250 -30
- package/dist/chunk-X2MQ7UFL.js.map +1 -0
- package/dist/{chunk-OZ3IFXRD.js → chunk-YENM3HT7.js} +5 -4
- package/dist/chunk-YENM3HT7.js.map +1 -0
- package/dist/{chunk-KJT2R6WW.js → chunk-YF54UMOU.js} +3 -3
- package/dist/{chunk-KJT2R6WW.js.map → chunk-YF54UMOU.js.map} +1 -1
- package/dist/{chunk-Q3M6K3HY.js → chunk-ZUOBPKVK.js} +3 -3
- package/dist/{chunk-Q3M6K3HY.js.map → chunk-ZUOBPKVK.js.map} +1 -1
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +711 -463
- package/dist/cli.js.map +1 -1
- package/dist/client-UQIELEEZ.js +8 -0
- package/dist/client-UQIELEEZ.js.map +1 -0
- package/dist/daemon-GUMWMKCA.js +31 -0
- package/dist/{daemon-FPTRHO5N.js.map → daemon-GUMWMKCA.js.map} +1 -1
- package/dist/embed-worker-main.js +3 -3
- package/dist/ensure-map-FHDJTO7Y.js +41 -0
- package/dist/{ensure-map-342G2IV3.js.map → ensure-map-FHDJTO7Y.js.map} +1 -1
- package/dist/graph-backend-W2D3HRRD.js +16 -0
- package/dist/{graph-backend-RNWQBT3P.js.map → graph-backend-W2D3HRRD.js.map} +1 -1
- package/dist/index.d.ts +633 -4
- package/dist/index.js +26 -17
- package/dist/index.js.map +1 -1
- package/dist/{interactive-SR7TMF6M.js → interactive-2MK4TLRD.js} +42 -34
- package/dist/interactive-2MK4TLRD.js.map +1 -0
- package/dist/load-4R4HYMBB.js +11 -0
- package/dist/{load-AYFECIQB.js.map → load-4R4HYMBB.js.map} +1 -1
- package/dist/parse-worker.js +3 -2
- package/dist/parse-worker.js.map +1 -1
- package/dist/publish-7YHRTBRA.js +9 -0
- package/dist/publish-7YHRTBRA.js.map +1 -0
- package/dist/{run-outcome-YQQJG3LW.js → run-outcome-H5GVDDZJ.js} +5 -5
- package/dist/{run-outcome-YQQJG3LW.js.map → run-outcome-H5GVDDZJ.js.map} +1 -1
- package/dist/runtime-session-JBIHHH5N.js +27 -0
- package/dist/{runtime-session-CNJ4DAV5.js.map → runtime-session-JBIHHH5N.js.map} +1 -1
- package/dist/semantic-status-2JFLIQQJ.js +4 -0
- package/dist/semantic-status-2JFLIQQJ.js.map +1 -0
- package/dist/{session-H34HUV2Y.js → session-N5IU4K5Q.js} +8 -8
- package/dist/{session-H34HUV2Y.js.map → session-N5IU4K5Q.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-55YDNAFX.js → stream-json-4WLSUF6I.js} +18 -15
- package/dist/stream-json-4WLSUF6I.js.map +1 -0
- package/dist/version-DTEU3SQD.js +4 -0
- package/dist/{version-WSE3QOPK.js.map → version-DTEU3SQD.js.map} +1 -1
- package/dist/{vg-mcp-bridge-2CNLHNEL.js → vg-mcp-bridge-KDVYIMFX.js} +12 -11
- package/dist/vg-mcp-bridge-KDVYIMFX.js.map +1 -0
- package/dist/{vgd-URUZQORN.js → vgd-M7UOPWLB.js} +15 -10
- package/dist/vgd-M7UOPWLB.js.map +1 -0
- package/package.json +1 -1
- package/dist/agent-UQC7QN77.js +0 -27
- package/dist/baseline-FIV6PR2M.js +0 -9
- package/dist/chunk-2FEB5KJS.js.map +0 -1
- package/dist/chunk-3H3SVJUY.js.map +0 -1
- package/dist/chunk-6K3XK7C5.js.map +0 -1
- package/dist/chunk-AXZZ5CCG.js.map +0 -1
- package/dist/chunk-DVW3SVCW.js.map +0 -1
- package/dist/chunk-E2FAQREZ.js.map +0 -1
- package/dist/chunk-GOGMS3ST.js.map +0 -1
- package/dist/chunk-K6DXETMC.js.map +0 -1
- package/dist/chunk-KNGAZDGF.js.map +0 -1
- package/dist/chunk-LHKQGVRF.js.map +0 -1
- package/dist/chunk-M7IO3DXH.js.map +0 -1
- package/dist/chunk-OZ3IFXRD.js.map +0 -1
- package/dist/chunk-PRG2ULPK.js +0 -6
- package/dist/chunk-Q4G2BWE3.js.map +0 -1
- package/dist/chunk-RBIRXQR6.js.map +0 -1
- package/dist/chunk-WAKP7SK7.js.map +0 -1
- package/dist/chunk-XLXJC7H3.js.map +0 -1
- package/dist/daemon-FPTRHO5N.js +0 -26
- package/dist/ensure-map-342G2IV3.js +0 -33
- package/dist/graph-backend-RNWQBT3P.js +0 -15
- package/dist/interactive-SR7TMF6M.js.map +0 -1
- package/dist/load-AYFECIQB.js +0 -11
- package/dist/runtime-session-CNJ4DAV5.js +0 -22
- package/dist/stream-json-55YDNAFX.js.map +0 -1
- package/dist/version-WSE3QOPK.js +0 -4
- package/dist/vg-mcp-bridge-2CNLHNEL.js.map +0 -1
- package/dist/vgd-URUZQORN.js.map +0 -1
|
@@ -1,260 +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-NKLYDSB7.js';
|
|
3
2
|
import { edgeId, buildModuleResolver, resolve, applyStaticTestLinkage, nodeId } from './chunk-VIWZ4QT7.js';
|
|
4
|
-
import {
|
|
5
|
-
import { writeGraphIndex, SCHEMA_VERSION, loadGraph } from './chunk-3FMRFECC.js';
|
|
3
|
+
import { CliError, ExitCode } from './chunk-MS6V5XKB.js';
|
|
6
4
|
import { init_cli_invocation, whichOnPath, isInstalledOwnBinary } from './chunk-EZ7UC5Y5.js';
|
|
7
|
-
import {
|
|
5
|
+
import { discover, isSkippedDirName, SKIP_FILES } from './chunk-POOL355F.js';
|
|
6
|
+
import { indexFor } from './chunk-MRZHNUN7.js';
|
|
7
|
+
import { writeGraphIndex, SCHEMA_VERSION, loadGraph } from './chunk-KU7FI5EV.js';
|
|
8
|
+
import { grammarSetVersion, toolchainGrammarSetVersion, fileRolesFromParses, setGrammarsOverride, parseSource, toolchainParser } from './chunk-PRHH4DVO.js';
|
|
8
9
|
import { redactSecrets } from './chunk-T7RSQ5WD.js';
|
|
9
|
-
import { ensureVibgrateGitignore } from './chunk-
|
|
10
|
+
import { ensureVibgrateGitignore } from './chunk-VMAIDM4K.js';
|
|
10
11
|
import { loadCache, cacheDir } from './chunk-MVPRPSXU.js';
|
|
11
12
|
import { serializeGraph, stableStringify } from './chunk-O3LABX6I.js';
|
|
12
|
-
import { VERSION } from './chunk-
|
|
13
|
+
import { VERSION } from './chunk-4NTNMT6T.js';
|
|
13
14
|
import { shortId, canonicalize, hashString, hashBytes } from './chunk-JFGYT6BI.js';
|
|
14
|
-
import * as fs12 from 'fs';
|
|
15
|
-
import * as path11 from 'path';
|
|
16
|
-
import ignore from 'ignore';
|
|
17
15
|
import * as v8 from 'v8';
|
|
18
16
|
import Graph from 'graphology';
|
|
19
17
|
import pagerank from 'graphology-metrics/centrality/pagerank.js';
|
|
20
18
|
import betweenness from 'graphology-metrics/centrality/betweenness.js';
|
|
21
19
|
import eigenvector from 'graphology-metrics/centrality/eigenvector.js';
|
|
22
20
|
import louvain from 'graphology-communities-louvain';
|
|
21
|
+
import * as fs11 from 'fs';
|
|
22
|
+
import * as path10 from 'path';
|
|
23
23
|
import * as os from 'os';
|
|
24
24
|
import { fileURLToPath } from 'url';
|
|
25
25
|
import ts from 'typescript';
|
|
26
26
|
import * as crypto from 'crypto';
|
|
27
|
+
import ignore from 'ignore';
|
|
27
28
|
import YAML from 'yaml';
|
|
28
|
-
import * as
|
|
29
|
+
import * as fs8 from 'fs/promises';
|
|
29
30
|
|
|
30
|
-
var SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
31
|
-
// Version control, IDE & tool metadata
|
|
32
|
-
".git",
|
|
33
|
-
".svn",
|
|
34
|
-
".hg",
|
|
35
|
-
".idea",
|
|
36
|
-
".vscode",
|
|
37
|
-
".vs",
|
|
38
|
-
// Claude Code agent state / worktrees (full monorepo copies under .claude/worktrees/)
|
|
39
|
-
".claude",
|
|
40
|
-
".vibgrate",
|
|
41
|
-
".wrangler",
|
|
42
|
-
".turbo",
|
|
43
|
-
".cache",
|
|
44
|
-
// Migration / tool backup trees (NativeScript, codemods, agent worktrees)
|
|
45
|
-
".migration_backup",
|
|
46
|
-
".update_backup",
|
|
47
|
-
".backup",
|
|
48
|
-
".bak",
|
|
49
|
-
".history",
|
|
50
|
-
".snapshots",
|
|
51
|
-
".snapshots_bak",
|
|
52
|
-
// JavaScript / Node — installed dependency trees
|
|
53
|
-
"node_modules",
|
|
54
|
-
"bower_components",
|
|
55
|
-
"jspm_packages",
|
|
56
|
-
"web_modules",
|
|
57
|
-
".pnpm-store",
|
|
58
|
-
".yarn",
|
|
59
|
-
// JS/TS meta-framework & bundler build output
|
|
60
|
-
".next",
|
|
61
|
-
".nuxt",
|
|
62
|
-
".output",
|
|
63
|
-
".svelte-kit",
|
|
64
|
-
".astro",
|
|
65
|
-
".vercel",
|
|
66
|
-
".netlify",
|
|
67
|
-
".angular",
|
|
68
|
-
".parcel-cache",
|
|
69
|
-
".docusaurus",
|
|
70
|
-
"storybook-static",
|
|
71
|
-
// Generic build / dist / coverage output
|
|
72
|
-
"dist",
|
|
73
|
-
"build",
|
|
74
|
-
"out",
|
|
75
|
-
"coverage",
|
|
76
|
-
// Native mobile platform build trees (NativeScript / Cordova / Capacitor)
|
|
77
|
-
"platforms",
|
|
78
|
-
"App_Resources",
|
|
79
|
-
// Vendored third-party source trees
|
|
80
|
-
"vendor",
|
|
81
|
-
"Pods",
|
|
82
|
-
"Carthage",
|
|
83
|
-
// Python — virtualenvs & tool caches
|
|
84
|
-
".venv",
|
|
85
|
-
"venv",
|
|
86
|
-
"virtualenv",
|
|
87
|
-
".tox",
|
|
88
|
-
".nox",
|
|
89
|
-
"__pycache__",
|
|
90
|
-
".mypy_cache",
|
|
91
|
-
".pytest_cache",
|
|
92
|
-
".ruff_cache",
|
|
93
|
-
".eggs",
|
|
94
|
-
".ipynb_checkpoints",
|
|
95
|
-
// Ruby
|
|
96
|
-
".bundle",
|
|
97
|
-
// Rust / Maven / sbt / Clojure — all build into target/
|
|
98
|
-
"target",
|
|
99
|
-
// JVM (Gradle / Maven) & .NET build output
|
|
100
|
-
".gradle",
|
|
101
|
-
"bin",
|
|
102
|
-
"obj",
|
|
103
|
-
"TestResults",
|
|
104
|
-
// Swift / Xcode
|
|
105
|
-
".build",
|
|
106
|
-
".swiftpm",
|
|
107
|
-
"DerivedData",
|
|
108
|
-
// Dart / Flutter
|
|
109
|
-
".dart_tool",
|
|
110
|
-
// Elixir / Erlang
|
|
111
|
-
"_build",
|
|
112
|
-
"deps",
|
|
113
|
-
// Haskell (Cabal / Stack)
|
|
114
|
-
"dist-newstyle",
|
|
115
|
-
".stack-work",
|
|
116
|
-
// Infrastructure-as-code build/state
|
|
117
|
-
".terraform",
|
|
118
|
-
".serverless",
|
|
119
|
-
"cdk.out",
|
|
120
|
-
".aws-sam"
|
|
121
|
-
]);
|
|
122
|
-
function isSkippedDirName(name) {
|
|
123
|
-
if (!name) return false;
|
|
124
|
-
if (SKIP_DIRS.has(name)) return true;
|
|
125
|
-
if (name.startsWith(".venv") || name.startsWith("venv-")) return true;
|
|
126
|
-
if (name === "site-packages") return true;
|
|
127
|
-
return false;
|
|
128
|
-
}
|
|
129
|
-
var SKIP_FILES = /* @__PURE__ */ new Set([
|
|
130
|
-
// JavaScript / Node
|
|
131
|
-
"package-lock.json",
|
|
132
|
-
"npm-shrinkwrap.json",
|
|
133
|
-
"yarn.lock",
|
|
134
|
-
"pnpm-lock.yaml",
|
|
135
|
-
"bun.lockb",
|
|
136
|
-
"bun.lock",
|
|
137
|
-
"deno.lock",
|
|
138
|
-
".pnp.cjs",
|
|
139
|
-
".pnp.data.json",
|
|
140
|
-
".pnp.loader.mjs",
|
|
141
|
-
// Python
|
|
142
|
-
"poetry.lock",
|
|
143
|
-
"pipfile.lock",
|
|
144
|
-
"pdm.lock",
|
|
145
|
-
"uv.lock",
|
|
146
|
-
"pylock.toml",
|
|
147
|
-
"conda-lock.yml",
|
|
148
|
-
// Ruby
|
|
149
|
-
"gemfile.lock",
|
|
150
|
-
// PHP
|
|
151
|
-
"composer.lock",
|
|
152
|
-
// Rust
|
|
153
|
-
"cargo.lock",
|
|
154
|
-
// Go
|
|
155
|
-
"go.sum",
|
|
156
|
-
"go.work.sum",
|
|
157
|
-
"gopkg.lock",
|
|
158
|
-
"glide.lock",
|
|
159
|
-
// .NET
|
|
160
|
-
"packages.lock.json",
|
|
161
|
-
// Java / JVM (Gradle)
|
|
162
|
-
"gradle.lockfile",
|
|
163
|
-
// Swift / Xcode
|
|
164
|
-
"package.resolved",
|
|
165
|
-
// Dart / Flutter
|
|
166
|
-
"pubspec.lock",
|
|
167
|
-
// Elixir
|
|
168
|
-
"mix.lock",
|
|
169
|
-
// Haskell (Cabal / Stack)
|
|
170
|
-
"cabal.project.freeze",
|
|
171
|
-
"stack.yaml.lock",
|
|
172
|
-
// Julia
|
|
173
|
-
"manifest.toml",
|
|
174
|
-
// R
|
|
175
|
-
"renv.lock",
|
|
176
|
-
// Perl (Carton)
|
|
177
|
-
"cpanfile.snapshot",
|
|
178
|
-
// CocoaPods / Carthage
|
|
179
|
-
"podfile.lock",
|
|
180
|
-
"cartfile.resolved",
|
|
181
|
-
// Terraform / IaC
|
|
182
|
-
".terraform.lock.hcl",
|
|
183
|
-
// Helm
|
|
184
|
-
"chart.lock",
|
|
185
|
-
// C / C++ (Conan)
|
|
186
|
-
"conan.lock",
|
|
187
|
-
// Bazel
|
|
188
|
-
"module.bazel.lock",
|
|
189
|
-
// Nix
|
|
190
|
-
"flake.lock"
|
|
191
|
-
]);
|
|
192
|
-
function toPosix(p) {
|
|
193
|
-
return p.split(path11.sep).join("/");
|
|
194
|
-
}
|
|
195
|
-
function buildRootIgnore(root, exclude) {
|
|
196
|
-
const ig = ignore();
|
|
197
|
-
const gitignorePath = path11.join(root, ".gitignore");
|
|
198
|
-
if (fs12.existsSync(gitignorePath)) {
|
|
199
|
-
ig.add(fs12.readFileSync(gitignorePath, "utf8"));
|
|
200
|
-
}
|
|
201
|
-
if (exclude.length) ig.add(exclude);
|
|
202
|
-
return ig;
|
|
203
|
-
}
|
|
204
|
-
function discover(options) {
|
|
205
|
-
const root = path11.resolve(options.root);
|
|
206
|
-
const onlyLangs = (options.only ?? []).filter(Boolean);
|
|
207
|
-
const allowLang = (lang) => onlyLangs.length === 0 || onlyLangs.includes(lang.id);
|
|
208
|
-
for (const id of onlyLangs) {
|
|
209
|
-
if (!langById(id)) {
|
|
210
|
-
throw new UsageError(`unknown language "${id}" for --only`);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
const rootIg = buildRootIgnore(root, options.exclude ?? []);
|
|
214
|
-
const scopeAbs = (options.paths && options.paths.length ? options.paths.map((p) => path11.resolve(root, p)) : [root]).filter((p) => fs12.existsSync(p));
|
|
215
|
-
const found = /* @__PURE__ */ new Map();
|
|
216
|
-
const considerFile = (abs) => {
|
|
217
|
-
const rel2 = toPosix(path11.relative(root, abs));
|
|
218
|
-
if (rel2.startsWith("..")) return;
|
|
219
|
-
if (rel2 === "" || rootIg.ignores(rel2)) return;
|
|
220
|
-
if (SKIP_FILES.has(path11.basename(abs).toLowerCase())) return;
|
|
221
|
-
const lang = langForExtension(path11.extname(abs));
|
|
222
|
-
if (!lang || !allowLang(lang)) return;
|
|
223
|
-
found.set(rel2, { rel: rel2, abs, lang });
|
|
224
|
-
};
|
|
225
|
-
const walk = (dir) => {
|
|
226
|
-
let entries;
|
|
227
|
-
try {
|
|
228
|
-
entries = fs12.readdirSync(dir, { withFileTypes: true });
|
|
229
|
-
} catch {
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
for (const entry of entries) {
|
|
233
|
-
const abs = path11.join(dir, entry.name);
|
|
234
|
-
const rel2 = toPosix(path11.relative(root, abs));
|
|
235
|
-
if (entry.isDirectory()) {
|
|
236
|
-
if (isSkippedDirName(entry.name)) continue;
|
|
237
|
-
if (rel2 && rootIg.ignores(`${rel2}/`)) continue;
|
|
238
|
-
walk(abs);
|
|
239
|
-
} else if (entry.isFile()) {
|
|
240
|
-
considerFile(abs);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
for (const scope of scopeAbs) {
|
|
245
|
-
const stat = fs12.statSync(scope);
|
|
246
|
-
if (stat.isDirectory()) walk(scope);
|
|
247
|
-
else if (stat.isFile()) considerFile(scope);
|
|
248
|
-
}
|
|
249
|
-
return [...found.values()].sort((a, b) => a.rel < b.rel ? -1 : a.rel > b.rel ? 1 : 0);
|
|
250
|
-
}
|
|
251
|
-
var UsageError = class extends Error {
|
|
252
|
-
isUsageError = true;
|
|
253
|
-
constructor(message) {
|
|
254
|
-
super(message);
|
|
255
|
-
this.name = "UsageError";
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
31
|
var MIB = 1024 * 1024;
|
|
259
32
|
var DEFAULT_MAX_FILE_BYTES = 2 * MIB;
|
|
260
33
|
var DEFAULT_MAX_FILES = 1e5;
|
|
@@ -724,14 +497,14 @@ var DEFAULT_PATHS = [
|
|
|
724
497
|
];
|
|
725
498
|
function loadCoverage(root, explicit) {
|
|
726
499
|
const candidates = (explicit && explicit.length ? explicit : DEFAULT_PATHS).map(
|
|
727
|
-
(p) =>
|
|
500
|
+
(p) => path10.resolve(root, p)
|
|
728
501
|
);
|
|
729
|
-
const found = candidates.filter((p) =>
|
|
502
|
+
const found = candidates.filter((p) => fs11.existsSync(p));
|
|
730
503
|
if (found.length === 0) return null;
|
|
731
504
|
const map = /* @__PURE__ */ new Map();
|
|
732
505
|
for (const file of found) {
|
|
733
506
|
try {
|
|
734
|
-
const text =
|
|
507
|
+
const text = fs11.readFileSync(file, "utf8");
|
|
735
508
|
if (file.endsWith(".json")) mergeIstanbul(map, text, root);
|
|
736
509
|
else mergeLcov(map, text, root);
|
|
737
510
|
} catch {
|
|
@@ -740,8 +513,8 @@ function loadCoverage(root, explicit) {
|
|
|
740
513
|
return map.size ? map : null;
|
|
741
514
|
}
|
|
742
515
|
function rel(root, p) {
|
|
743
|
-
const abs =
|
|
744
|
-
return
|
|
516
|
+
const abs = path10.isAbsolute(p) ? p : path10.resolve(root, p);
|
|
517
|
+
return path10.relative(root, abs).split(path10.sep).join("/");
|
|
745
518
|
}
|
|
746
519
|
function bump(map, file, line, hits) {
|
|
747
520
|
let lh = map.get(file);
|
|
@@ -952,7 +725,7 @@ async function parseInline(files, options) {
|
|
|
952
725
|
onProgress?.(0, files.length);
|
|
953
726
|
for (const file of files) {
|
|
954
727
|
try {
|
|
955
|
-
const source =
|
|
728
|
+
const source = fs11.readFileSync(file.abs, "utf8");
|
|
956
729
|
out.push(await parseSource(file.rel, file.lang.id, source));
|
|
957
730
|
} catch (err) {
|
|
958
731
|
out.push(emptyParse(file, `parse failed: ${err.message}`));
|
|
@@ -1007,9 +780,9 @@ function isWorkerOom(err) {
|
|
|
1007
780
|
return e?.code === "ERR_WORKER_OUT_OF_MEMORY" || /out of memory/i.test(e?.message ?? "");
|
|
1008
781
|
}
|
|
1009
782
|
function resolveWorkerFile() {
|
|
1010
|
-
const here =
|
|
1011
|
-
const candidate =
|
|
1012
|
-
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;
|
|
1013
786
|
}
|
|
1014
787
|
function chunk(items, buckets) {
|
|
1015
788
|
const out = Array.from({ length: Math.min(buckets, items.length || 1) }, () => []);
|
|
@@ -1288,12 +1061,12 @@ function enclosing3(nodes, line) {
|
|
|
1288
1061
|
return best;
|
|
1289
1062
|
}
|
|
1290
1063
|
function normalize2(p) {
|
|
1291
|
-
return
|
|
1064
|
+
return path10.resolve(p).split(path10.sep).join("/");
|
|
1292
1065
|
}
|
|
1293
1066
|
var TSC_CACHE_VERSION = "vg-tsc-cache/1";
|
|
1294
1067
|
var AMBIENT_RE = /\bdeclare\s+(global|module)\b/;
|
|
1295
1068
|
function tscCachePath(root) {
|
|
1296
|
-
return
|
|
1069
|
+
return path10.join(cacheDir(root), "tsc-cache.json");
|
|
1297
1070
|
}
|
|
1298
1071
|
function loadTscCache(root, opts) {
|
|
1299
1072
|
const file = tscCachePath(root);
|
|
@@ -1303,9 +1076,9 @@ function loadTscCache(root, opts) {
|
|
|
1303
1076
|
ts: ts.version,
|
|
1304
1077
|
entries: {}
|
|
1305
1078
|
};
|
|
1306
|
-
if (!opts.disabled &&
|
|
1079
|
+
if (!opts.disabled && fs11.existsSync(file)) {
|
|
1307
1080
|
try {
|
|
1308
|
-
const loaded = JSON.parse(
|
|
1081
|
+
const loaded = JSON.parse(fs11.readFileSync(file, "utf8"));
|
|
1309
1082
|
if (loaded.version === TSC_CACHE_VERSION && loaded.toolVersion === opts.toolVersion && loaded.ts === ts.version && loaded.entries) {
|
|
1310
1083
|
data = loaded;
|
|
1311
1084
|
}
|
|
@@ -1336,18 +1109,18 @@ function loadTscCache(root, opts) {
|
|
|
1336
1109
|
},
|
|
1337
1110
|
save() {
|
|
1338
1111
|
if (opts.disabled) return;
|
|
1339
|
-
|
|
1340
|
-
|
|
1112
|
+
fs11.mkdirSync(cacheDir(root), { recursive: true });
|
|
1113
|
+
fs11.writeFileSync(file, stableStringify(data, 0));
|
|
1341
1114
|
}
|
|
1342
1115
|
};
|
|
1343
1116
|
}
|
|
1344
1117
|
function abs$(root, rel2) {
|
|
1345
|
-
return
|
|
1118
|
+
return path10.join(root, rel2);
|
|
1346
1119
|
}
|
|
1347
1120
|
function detectAmbient(rel2, abs) {
|
|
1348
1121
|
if (rel2.endsWith(".d.ts")) return true;
|
|
1349
1122
|
try {
|
|
1350
|
-
return AMBIENT_RE.test(
|
|
1123
|
+
return AMBIENT_RE.test(fs11.readFileSync(abs, "utf8"));
|
|
1351
1124
|
} catch {
|
|
1352
1125
|
return true;
|
|
1353
1126
|
}
|
|
@@ -1640,15 +1413,15 @@ var IMPORTANCE = {
|
|
|
1640
1413
|
infra: 0.12,
|
|
1641
1414
|
"other-config": 0.08
|
|
1642
1415
|
};
|
|
1643
|
-
function
|
|
1644
|
-
return p.split(
|
|
1416
|
+
function toPosix(p) {
|
|
1417
|
+
return p.split(path10.sep).join("/");
|
|
1645
1418
|
}
|
|
1646
|
-
function
|
|
1419
|
+
function buildRootIgnore(root, exclude) {
|
|
1647
1420
|
const ig = ignore();
|
|
1648
|
-
const gitignorePath =
|
|
1649
|
-
if (
|
|
1421
|
+
const gitignorePath = path10.join(root, ".gitignore");
|
|
1422
|
+
if (fs11.existsSync(gitignorePath)) {
|
|
1650
1423
|
try {
|
|
1651
|
-
ig.add(
|
|
1424
|
+
ig.add(fs11.readFileSync(gitignorePath, "utf8"));
|
|
1652
1425
|
} catch {
|
|
1653
1426
|
}
|
|
1654
1427
|
}
|
|
@@ -1657,7 +1430,7 @@ function buildRootIgnore2(root, exclude) {
|
|
|
1657
1430
|
}
|
|
1658
1431
|
function classifyProjectContext(relOrName) {
|
|
1659
1432
|
const rel2 = relOrName.replace(/\\/g, "/");
|
|
1660
|
-
const base =
|
|
1433
|
+
const base = path10.basename(rel2);
|
|
1661
1434
|
const baseLower = base.toLowerCase();
|
|
1662
1435
|
if (/^\.env($|\.)/i.test(base) && !isEnvExampleName(baseLower)) return null;
|
|
1663
1436
|
if (SKIP_FILES.has(baseLower)) return null;
|
|
@@ -1670,7 +1443,7 @@ function classifyProjectContext(relOrName) {
|
|
|
1670
1443
|
for (const { re, category } of PATH_PATTERNS) {
|
|
1671
1444
|
if (re.test(rel2)) return category;
|
|
1672
1445
|
}
|
|
1673
|
-
const ext =
|
|
1446
|
+
const ext = path10.extname(baseLower);
|
|
1674
1447
|
if (DOC_EXTENSIONS.has(ext)) return ext === ".txt" ? "text" : "markdown";
|
|
1675
1448
|
if (API_EXTENSIONS.has(ext)) return "api-contract";
|
|
1676
1449
|
if ((ext === ".yaml" || ext === ".yml" || ext === ".json") && /openapi|swagger|asyncapi/i.test(base)) {
|
|
@@ -1688,24 +1461,24 @@ function isEnvExampleName(baseLower) {
|
|
|
1688
1461
|
return false;
|
|
1689
1462
|
}
|
|
1690
1463
|
function discoverDocs(options) {
|
|
1691
|
-
const root =
|
|
1464
|
+
const root = path10.resolve(options.root);
|
|
1692
1465
|
const maxFiles = options.maxFiles ?? DOC_MAX_FILES;
|
|
1693
|
-
const rootIg =
|
|
1694
|
-
const scopeAbs = (options.paths?.length ? options.paths.map((p) =>
|
|
1695
|
-
(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)
|
|
1696
1469
|
);
|
|
1697
1470
|
const found = /* @__PURE__ */ new Map();
|
|
1698
1471
|
const consider = (abs) => {
|
|
1699
1472
|
if (found.size >= maxFiles) return;
|
|
1700
|
-
const rel2 =
|
|
1473
|
+
const rel2 = toPosix(path10.relative(root, abs));
|
|
1701
1474
|
if (!rel2 || rel2.startsWith("..")) return;
|
|
1702
1475
|
if (rootIg.ignores(rel2)) return;
|
|
1703
|
-
const base =
|
|
1476
|
+
const base = path10.basename(abs);
|
|
1704
1477
|
if (SKIP_FILES.has(base.toLowerCase())) return;
|
|
1705
1478
|
const category = classifyProjectContext(rel2);
|
|
1706
1479
|
if (!category) return;
|
|
1707
1480
|
try {
|
|
1708
|
-
const st =
|
|
1481
|
+
const st = fs11.statSync(abs);
|
|
1709
1482
|
if (!st.isFile() || st.size > DOC_FILE_MAX_BYTES) return;
|
|
1710
1483
|
if (st.size === 0) return;
|
|
1711
1484
|
} catch {
|
|
@@ -1717,14 +1490,14 @@ function discoverDocs(options) {
|
|
|
1717
1490
|
if (found.size >= maxFiles || depth > 12) return;
|
|
1718
1491
|
let entries;
|
|
1719
1492
|
try {
|
|
1720
|
-
entries =
|
|
1493
|
+
entries = fs11.readdirSync(dir, { withFileTypes: true });
|
|
1721
1494
|
} catch {
|
|
1722
1495
|
return;
|
|
1723
1496
|
}
|
|
1724
1497
|
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
1725
1498
|
if (found.size >= maxFiles) return;
|
|
1726
|
-
const abs =
|
|
1727
|
-
const rel2 =
|
|
1499
|
+
const abs = path10.join(dir, entry.name);
|
|
1500
|
+
const rel2 = toPosix(path10.relative(root, abs));
|
|
1728
1501
|
if (entry.isDirectory()) {
|
|
1729
1502
|
if (isSkippedDirName(entry.name)) continue;
|
|
1730
1503
|
if (rel2 && rootIg.ignores(`${rel2}/`) && !rel2.startsWith(".github")) continue;
|
|
@@ -1736,7 +1509,7 @@ function discoverDocs(options) {
|
|
|
1736
1509
|
};
|
|
1737
1510
|
for (const scope of scopeAbs) {
|
|
1738
1511
|
try {
|
|
1739
|
-
const st =
|
|
1512
|
+
const st = fs11.statSync(scope);
|
|
1740
1513
|
if (st.isDirectory()) walk(scope, 0);
|
|
1741
1514
|
else if (st.isFile()) consider(scope);
|
|
1742
1515
|
} catch {
|
|
@@ -1747,7 +1520,7 @@ function discoverDocs(options) {
|
|
|
1747
1520
|
function prepareDocBody(rel2, raw, category) {
|
|
1748
1521
|
const scrubbed = redactSecrets(raw);
|
|
1749
1522
|
if (scrubbed.length <= DOC_BODY_MAX_CHARS) return scrubbed;
|
|
1750
|
-
if (category === "manifest" &&
|
|
1523
|
+
if (category === "manifest" && path10.basename(rel2).toLowerCase() === "package.json") {
|
|
1751
1524
|
return summarizePackageJson(scrubbed);
|
|
1752
1525
|
}
|
|
1753
1526
|
if (category === "api-contract" && /\.(ya?ml|json)$/i.test(rel2)) {
|
|
@@ -1793,14 +1566,14 @@ function documentNodesFromDocs(docs) {
|
|
|
1793
1566
|
for (const d of docs) {
|
|
1794
1567
|
let raw = "";
|
|
1795
1568
|
try {
|
|
1796
|
-
raw =
|
|
1569
|
+
raw = fs11.readFileSync(d.abs, "utf8");
|
|
1797
1570
|
} catch {
|
|
1798
1571
|
continue;
|
|
1799
1572
|
}
|
|
1800
1573
|
const category = d.category ?? d.kind;
|
|
1801
1574
|
const scrubbed = prepareDocBody(d.rel, raw, category);
|
|
1802
1575
|
if (!scrubbed.trim()) continue;
|
|
1803
|
-
const name =
|
|
1576
|
+
const name = path10.basename(d.rel);
|
|
1804
1577
|
const qualifiedName = d.rel.replace(/\\/g, "/");
|
|
1805
1578
|
const id = nodeId({
|
|
1806
1579
|
kind: "document",
|
|
@@ -1897,12 +1670,12 @@ function imageIdentity(ref) {
|
|
|
1897
1670
|
if (ref.digest) return `${ref.repository}@${ref.digest}`;
|
|
1898
1671
|
return ref.tag ? `${ref.repository}:${ref.tag}` : ref.repository;
|
|
1899
1672
|
}
|
|
1900
|
-
function
|
|
1673
|
+
function toPosix2(rel2) {
|
|
1901
1674
|
return rel2.replace(/\\/g, "/");
|
|
1902
1675
|
}
|
|
1903
1676
|
function resolveRelative(fromFileRel, target) {
|
|
1904
|
-
const base =
|
|
1905
|
-
const parts =
|
|
1677
|
+
const base = toPosix2(fromFileRel).split("/").slice(0, -1);
|
|
1678
|
+
const parts = toPosix2(target).split("/");
|
|
1906
1679
|
const out = [...base];
|
|
1907
1680
|
for (const part of parts) {
|
|
1908
1681
|
if (!part || part === ".") continue;
|
|
@@ -1948,15 +1721,15 @@ function parseYamlStream(rel2, source) {
|
|
|
1948
1721
|
});
|
|
1949
1722
|
return { docs, warnings };
|
|
1950
1723
|
}
|
|
1951
|
-
function spanAt(doc, lines,
|
|
1952
|
-
const node =
|
|
1724
|
+
function spanAt(doc, lines, path11) {
|
|
1725
|
+
const node = path11.length ? safeGetIn(doc.ast, path11) : doc.ast.contents;
|
|
1953
1726
|
const range = nodeRange(node) ?? nodeRange(doc.ast.contents);
|
|
1954
1727
|
if (!range) return { start: 1, end: 1 };
|
|
1955
1728
|
return lines.span(range[0], range[2] ?? range[1]);
|
|
1956
1729
|
}
|
|
1957
|
-
function safeGetIn(ast,
|
|
1730
|
+
function safeGetIn(ast, path11) {
|
|
1958
1731
|
try {
|
|
1959
|
-
return ast.getIn(
|
|
1732
|
+
return ast.getIn(path11, true);
|
|
1960
1733
|
} catch {
|
|
1961
1734
|
return void 0;
|
|
1962
1735
|
}
|
|
@@ -1965,26 +1738,26 @@ function nodeRange(node) {
|
|
|
1965
1738
|
const range = node?.range;
|
|
1966
1739
|
return Array.isArray(range) ? range : null;
|
|
1967
1740
|
}
|
|
1968
|
-
function getPath(value,
|
|
1741
|
+
function getPath(value, path11) {
|
|
1969
1742
|
let current = value;
|
|
1970
|
-
for (const key of
|
|
1743
|
+
for (const key of path11) {
|
|
1971
1744
|
if (current === null || typeof current !== "object") return void 0;
|
|
1972
1745
|
current = current[key];
|
|
1973
1746
|
}
|
|
1974
1747
|
return current;
|
|
1975
1748
|
}
|
|
1976
|
-
function getString(value,
|
|
1977
|
-
const found = getPath(value,
|
|
1749
|
+
function getString(value, path11) {
|
|
1750
|
+
const found = getPath(value, path11);
|
|
1978
1751
|
if (typeof found === "string") return found;
|
|
1979
1752
|
if (typeof found === "number" || typeof found === "boolean") return String(found);
|
|
1980
1753
|
return void 0;
|
|
1981
1754
|
}
|
|
1982
|
-
function getArray(value,
|
|
1983
|
-
const found = getPath(value,
|
|
1755
|
+
function getArray(value, path11) {
|
|
1756
|
+
const found = getPath(value, path11);
|
|
1984
1757
|
return Array.isArray(found) ? found : [];
|
|
1985
1758
|
}
|
|
1986
|
-
function getRecordEntries(value,
|
|
1987
|
-
const found = getPath(value,
|
|
1759
|
+
function getRecordEntries(value, path11) {
|
|
1760
|
+
const found = getPath(value, path11);
|
|
1988
1761
|
if (!found || typeof found !== "object" || Array.isArray(found)) return [];
|
|
1989
1762
|
return Object.entries(found).sort(([a], [b]) => a.localeCompare(b, "en"));
|
|
1990
1763
|
}
|
|
@@ -2194,7 +1967,7 @@ var dockerfileExtractor = {
|
|
|
2194
1967
|
format: "dockerfile",
|
|
2195
1968
|
matches(rel2, category) {
|
|
2196
1969
|
if (category === "docker") return true;
|
|
2197
|
-
const base =
|
|
1970
|
+
const base = toPosix2(rel2).split("/").pop()?.toLowerCase() ?? "";
|
|
2198
1971
|
return base === "dockerfile" || base === "containerfile" || base.startsWith("dockerfile.");
|
|
2199
1972
|
},
|
|
2200
1973
|
extract(rel2, source) {
|
|
@@ -2202,7 +1975,7 @@ var dockerfileExtractor = {
|
|
|
2202
1975
|
const nodes = [];
|
|
2203
1976
|
const edges = [];
|
|
2204
1977
|
const warnings = [];
|
|
2205
|
-
const posixRel =
|
|
1978
|
+
const posixRel = toPosix2(rel2);
|
|
2206
1979
|
const fileAddress = `dockerfile:${posixRel}`;
|
|
2207
1980
|
nodes.push({
|
|
2208
1981
|
kind: "image",
|
|
@@ -2287,7 +2060,7 @@ var dockerfileExtractor = {
|
|
|
2287
2060
|
for (const source2 of copySourcePaths(line.args)) {
|
|
2288
2061
|
const relativeToDockerfile = resolveRelative(posixRel, source2);
|
|
2289
2062
|
if (relativeToDockerfile) forStage.add(relativeToDockerfile);
|
|
2290
|
-
forStage.add(
|
|
2063
|
+
forStage.add(toPosix2(source2).replace(/^\.\//, ""));
|
|
2291
2064
|
}
|
|
2292
2065
|
if (forStage.size) copySources.set(currentStage, forStage);
|
|
2293
2066
|
break;
|
|
@@ -2341,7 +2114,7 @@ function collectValuesImages(value, prefix, out) {
|
|
|
2341
2114
|
var helmExtractor = {
|
|
2342
2115
|
format: "helm",
|
|
2343
2116
|
matches(rel2) {
|
|
2344
|
-
const base =
|
|
2117
|
+
const base = toPosix2(rel2).split("/").pop()?.toLowerCase() ?? "";
|
|
2345
2118
|
if (base === "chart.yaml" || base === "chart.yml") return true;
|
|
2346
2119
|
return /(^|\/)values([.-][\w.-]+)?\.ya?ml$/i.test(rel2) && /(^|\/)charts?\//i.test(rel2);
|
|
2347
2120
|
},
|
|
@@ -2352,7 +2125,7 @@ var helmExtractor = {
|
|
|
2352
2125
|
const edges = [];
|
|
2353
2126
|
const doc = docs[0];
|
|
2354
2127
|
if (!doc) return { nodes, edges, warnings };
|
|
2355
|
-
const base =
|
|
2128
|
+
const base = toPosix2(rel2).split("/").pop()?.toLowerCase() ?? "";
|
|
2356
2129
|
const isChartFile = base === "chart.yaml" || base === "chart.yml";
|
|
2357
2130
|
if (isChartFile) {
|
|
2358
2131
|
const name = getString(doc.value, ["name"]);
|
|
@@ -2552,9 +2325,9 @@ function referencedConfig(value, podPath) {
|
|
|
2552
2325
|
}
|
|
2553
2326
|
return [...out].sort();
|
|
2554
2327
|
}
|
|
2555
|
-
function readLabels(value,
|
|
2328
|
+
function readLabels(value, path11) {
|
|
2556
2329
|
const out = {};
|
|
2557
|
-
for (const [key, raw] of getRecordEntries(value,
|
|
2330
|
+
for (const [key, raw] of getRecordEntries(value, path11)) {
|
|
2558
2331
|
if (typeof raw === "string") out[key] = raw;
|
|
2559
2332
|
else if (typeof raw === "number" || typeof raw === "boolean") out[key] = String(raw);
|
|
2560
2333
|
}
|
|
@@ -2908,10 +2681,10 @@ var GITLAB_RESERVED = /* @__PURE__ */ new Set([
|
|
|
2908
2681
|
"pages"
|
|
2909
2682
|
]);
|
|
2910
2683
|
function isGitHubWorkflowPath(rel2) {
|
|
2911
|
-
return /(^|\/)\.github\/workflows\/[^/]+\.ya?ml$/i.test(
|
|
2684
|
+
return /(^|\/)\.github\/workflows\/[^/]+\.ya?ml$/i.test(toPosix2(rel2));
|
|
2912
2685
|
}
|
|
2913
2686
|
function isGitLabCiPath(rel2) {
|
|
2914
|
-
const base =
|
|
2687
|
+
const base = toPosix2(rel2).split("/").pop()?.toLowerCase() ?? "";
|
|
2915
2688
|
return base === ".gitlab-ci.yml" || base === ".gitlab-ci.yaml";
|
|
2916
2689
|
}
|
|
2917
2690
|
function imagesBuiltBy(script) {
|
|
@@ -2961,8 +2734,8 @@ var githubActionsExtractor = {
|
|
|
2961
2734
|
const edges = [];
|
|
2962
2735
|
const doc = docs[0];
|
|
2963
2736
|
if (!doc) return { nodes, edges, warnings };
|
|
2964
|
-
const workflowName = getString(doc.value, ["name"]) ??
|
|
2965
|
-
const workflowAddress = `workflow:${
|
|
2737
|
+
const workflowName = getString(doc.value, ["name"]) ?? toPosix2(rel2).split("/").pop() ?? rel2;
|
|
2738
|
+
const workflowAddress = `workflow:${toPosix2(rel2)}`;
|
|
2966
2739
|
nodes.push({
|
|
2967
2740
|
kind: "job",
|
|
2968
2741
|
name: workflowName,
|
|
@@ -3083,7 +2856,7 @@ var gitlabCiExtractor = {
|
|
|
3083
2856
|
const edges = [];
|
|
3084
2857
|
const doc = docs[0];
|
|
3085
2858
|
if (!doc) return { nodes, edges, warnings };
|
|
3086
|
-
const pipelineAddress = `workflow:${
|
|
2859
|
+
const pipelineAddress = `workflow:${toPosix2(rel2)}`;
|
|
3087
2860
|
nodes.push({
|
|
3088
2861
|
kind: "job",
|
|
3089
2862
|
name: "GitLab CI",
|
|
@@ -3159,7 +2932,7 @@ function emitScriptEffects(rel2, script, workingDirectory, jobAddress, span, nod
|
|
|
3159
2932
|
}
|
|
3160
2933
|
function normaliseWorkspacePath(dir) {
|
|
3161
2934
|
const out = [];
|
|
3162
|
-
for (const part of
|
|
2935
|
+
for (const part of toPosix2(dir).split("/")) {
|
|
3163
2936
|
if (!part || part === ".") continue;
|
|
3164
2937
|
if (part === "..") {
|
|
3165
2938
|
out.pop();
|
|
@@ -3204,7 +2977,7 @@ function linkToolchain(input) {
|
|
|
3204
2977
|
const { nodes, edges, fileNodes, stageCopySources } = input;
|
|
3205
2978
|
const out = /* @__PURE__ */ new Map();
|
|
3206
2979
|
const counts = {};
|
|
3207
|
-
const add3 = (kind, src, dst, confidence,
|
|
2980
|
+
const add3 = (kind, src, dst, confidence, join9) => {
|
|
3208
2981
|
if (src === dst) return;
|
|
3209
2982
|
const id = edgeId(kind, src, dst);
|
|
3210
2983
|
if (out.has(id)) return;
|
|
@@ -3217,7 +2990,7 @@ function linkToolchain(input) {
|
|
|
3217
2990
|
confidence,
|
|
3218
2991
|
epistemic: "name-matched"
|
|
3219
2992
|
});
|
|
3220
|
-
counts[
|
|
2993
|
+
counts[join9] = (counts[join9] ?? 0) + 1;
|
|
3221
2994
|
};
|
|
3222
2995
|
const declared = new Set(edges.map((e) => `${e.kind} ${e.src} ${e.dst}`));
|
|
3223
2996
|
const dockerfileByPath = /* @__PURE__ */ new Map();
|
|
@@ -3234,7 +3007,7 @@ function linkToolchain(input) {
|
|
|
3234
3007
|
push(stagesByDockerfile, target.split("#")[0], node);
|
|
3235
3008
|
continue;
|
|
3236
3009
|
}
|
|
3237
|
-
if (
|
|
3010
|
+
if (toPosix2(node.file) === target) dockerfileByPath.set(target, node);
|
|
3238
3011
|
else dockerfileRefs.push(node);
|
|
3239
3012
|
continue;
|
|
3240
3013
|
}
|
|
@@ -3247,7 +3020,7 @@ function linkToolchain(input) {
|
|
|
3247
3020
|
terraformDirMarkers.push(node);
|
|
3248
3021
|
continue;
|
|
3249
3022
|
}
|
|
3250
|
-
if (node.lang === "terraform") push(terraformNodesByDir, dirOf(
|
|
3023
|
+
if (node.lang === "terraform") push(terraformNodesByDir, dirOf(toPosix2(node.file)), node);
|
|
3251
3024
|
}
|
|
3252
3025
|
for (const ref of dockerfileRefs) {
|
|
3253
3026
|
const target = dockerfileByPath.get(ref.qualifiedName.slice("dockerfile:".length));
|
|
@@ -3300,8 +3073,8 @@ function linkToolchain(input) {
|
|
|
3300
3073
|
for (const stage of stages) {
|
|
3301
3074
|
const copied = stageCopySources.get(stage.qualifiedName);
|
|
3302
3075
|
if (!copied?.length) continue;
|
|
3303
|
-
for (const
|
|
3304
|
-
const fileNodeId = fileNodes.get(
|
|
3076
|
+
for (const path11 of copied) {
|
|
3077
|
+
const fileNodeId = fileNodes.get(toPosix2(path11));
|
|
3305
3078
|
if (!fileNodeId) continue;
|
|
3306
3079
|
add3("depends_on", stage.id, fileNodeId, LINK_CONFIDENCE.dockerfileCopy, "dockerfile\u2192source");
|
|
3307
3080
|
}
|
|
@@ -3345,7 +3118,7 @@ var EMPTY_RESULT = {
|
|
|
3345
3118
|
function extractorFor(doc, head) {
|
|
3346
3119
|
for (const extractor of EXTRACTORS) {
|
|
3347
3120
|
try {
|
|
3348
|
-
if (extractor.matches(
|
|
3121
|
+
if (extractor.matches(toPosix2(doc.rel), doc.category ?? doc.kind, head)) return extractor;
|
|
3349
3122
|
} catch {
|
|
3350
3123
|
}
|
|
3351
3124
|
}
|
|
@@ -3358,21 +3131,21 @@ async function extractToolchain(docs, options = {}) {
|
|
|
3358
3131
|
const warnings = [];
|
|
3359
3132
|
const counts = {};
|
|
3360
3133
|
const stageCopySources = /* @__PURE__ */ new Map();
|
|
3361
|
-
const ordered = [...docs].sort((a, b) =>
|
|
3134
|
+
const ordered = [...docs].sort((a, b) => toPosix2(a.rel).localeCompare(toPosix2(b.rel), "en"));
|
|
3362
3135
|
for (const doc of ordered) {
|
|
3363
3136
|
let source;
|
|
3364
3137
|
let head;
|
|
3365
3138
|
try {
|
|
3366
|
-
const stat =
|
|
3139
|
+
const stat = fs11.statSync(doc.abs);
|
|
3367
3140
|
if (stat.size > TOOLCHAIN_FILE_MAX_BYTES) continue;
|
|
3368
|
-
source =
|
|
3141
|
+
source = fs11.readFileSync(doc.abs, "utf8");
|
|
3369
3142
|
head = source.slice(0, HEAD_BYTES);
|
|
3370
3143
|
} catch {
|
|
3371
3144
|
continue;
|
|
3372
3145
|
}
|
|
3373
3146
|
const extractor = extractorFor(doc, head);
|
|
3374
3147
|
if (!extractor) continue;
|
|
3375
|
-
const rel2 =
|
|
3148
|
+
const rel2 = toPosix2(doc.rel);
|
|
3376
3149
|
let extraction;
|
|
3377
3150
|
try {
|
|
3378
3151
|
extraction = await extractor.extract(rel2, source);
|
|
@@ -3468,7 +3241,7 @@ function shardTsProjects(root, files) {
|
|
|
3468
3241
|
const cache = /* @__PURE__ */ new Map();
|
|
3469
3242
|
const byKey = /* @__PURE__ */ new Map();
|
|
3470
3243
|
for (const f of files) {
|
|
3471
|
-
const dir =
|
|
3244
|
+
const dir = path10.dirname(f.abs);
|
|
3472
3245
|
const key = nearestProjectKey(root, dir, cache);
|
|
3473
3246
|
const list = byKey.get(key);
|
|
3474
3247
|
if (list) list.push(f);
|
|
@@ -3483,22 +3256,22 @@ function nearestProjectKey(root, startDir, cache) {
|
|
|
3483
3256
|
const hit = cache.get(startDir);
|
|
3484
3257
|
if (hit !== void 0) return hit;
|
|
3485
3258
|
let dir = startDir;
|
|
3486
|
-
const rootAbs =
|
|
3259
|
+
const rootAbs = path10.resolve(root);
|
|
3487
3260
|
while (true) {
|
|
3488
|
-
if (
|
|
3489
|
-
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)) || ".";
|
|
3490
3263
|
cache.set(startDir, key);
|
|
3491
3264
|
return key;
|
|
3492
3265
|
}
|
|
3493
|
-
if (dir === rootAbs ||
|
|
3266
|
+
if (dir === rootAbs || path10.dirname(dir) === dir) {
|
|
3494
3267
|
cache.set(startDir, ".");
|
|
3495
3268
|
return ".";
|
|
3496
3269
|
}
|
|
3497
|
-
dir =
|
|
3270
|
+
dir = path10.dirname(dir);
|
|
3498
3271
|
}
|
|
3499
3272
|
}
|
|
3500
|
-
function
|
|
3501
|
-
return p.split(
|
|
3273
|
+
function toPosix3(p) {
|
|
3274
|
+
return p.split(path10.sep).join("/");
|
|
3502
3275
|
}
|
|
3503
3276
|
|
|
3504
3277
|
// src/engine/timing.ts
|
|
@@ -3590,9 +3363,9 @@ var emptyNode = (partial) => ({
|
|
|
3590
3363
|
tested: null
|
|
3591
3364
|
});
|
|
3592
3365
|
function extractManifests(root, opts = {}) {
|
|
3593
|
-
const absRoot =
|
|
3594
|
-
const ig =
|
|
3595
|
-
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));
|
|
3596
3369
|
const found = /* @__PURE__ */ new Map();
|
|
3597
3370
|
for (const scope of scopes) {
|
|
3598
3371
|
walkManifests(absRoot, scope, ig, found);
|
|
@@ -3602,7 +3375,7 @@ function extractManifests(root, opts = {}) {
|
|
|
3602
3375
|
let deps = 0;
|
|
3603
3376
|
for (const rel2 of [...found.keys()].sort()) {
|
|
3604
3377
|
const abs = found.get(rel2);
|
|
3605
|
-
const base =
|
|
3378
|
+
const base = path10.posix.basename(rel2);
|
|
3606
3379
|
try {
|
|
3607
3380
|
if (base === "package.json") {
|
|
3608
3381
|
deps += ingestPackageJson(rel2, abs, nodes, edges);
|
|
@@ -3622,8 +3395,8 @@ function extractManifests(root, opts = {}) {
|
|
|
3622
3395
|
};
|
|
3623
3396
|
}
|
|
3624
3397
|
function ingestPackageJson(rel2, abs, nodes, edges) {
|
|
3625
|
-
const raw = JSON.parse(
|
|
3626
|
-
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) || ".";
|
|
3627
3400
|
const localId = nodeId({ kind: "package", qualifiedName: pkgName, file: rel2 });
|
|
3628
3401
|
nodes.set(
|
|
3629
3402
|
localId,
|
|
@@ -3642,7 +3415,7 @@ function ingestPackageJson(rel2, abs, nodes, edges) {
|
|
|
3642
3415
|
emptyNode({
|
|
3643
3416
|
id: fileId,
|
|
3644
3417
|
kind: "file",
|
|
3645
|
-
name:
|
|
3418
|
+
name: path10.posix.basename(rel2),
|
|
3646
3419
|
qualifiedName: rel2,
|
|
3647
3420
|
file: rel2,
|
|
3648
3421
|
lang: "json"
|
|
@@ -3666,8 +3439,8 @@ function ingestPackageJson(rel2, abs, nodes, edges) {
|
|
|
3666
3439
|
return n;
|
|
3667
3440
|
}
|
|
3668
3441
|
function ingestGoMod(rel2, abs, nodes, edges) {
|
|
3669
|
-
const text =
|
|
3670
|
-
let moduleName =
|
|
3442
|
+
const text = fs11.readFileSync(abs, "utf8");
|
|
3443
|
+
let moduleName = path10.posix.dirname(rel2) || ".";
|
|
3671
3444
|
const moduleMatch = /^\s*module\s+(\S+)/m.exec(text);
|
|
3672
3445
|
if (moduleMatch) moduleName = moduleMatch[1];
|
|
3673
3446
|
const localId = nodeId({ kind: "package", qualifiedName: moduleName, file: rel2 });
|
|
@@ -3688,7 +3461,7 @@ function ingestGoMod(rel2, abs, nodes, edges) {
|
|
|
3688
3461
|
emptyNode({
|
|
3689
3462
|
id: fileId,
|
|
3690
3463
|
kind: "file",
|
|
3691
|
-
name:
|
|
3464
|
+
name: path10.posix.basename(rel2),
|
|
3692
3465
|
qualifiedName: rel2,
|
|
3693
3466
|
file: rel2,
|
|
3694
3467
|
lang: "go"
|
|
@@ -3747,12 +3520,12 @@ function addEdge(edges, kind, src, dst, confidence) {
|
|
|
3747
3520
|
count: 1
|
|
3748
3521
|
});
|
|
3749
3522
|
}
|
|
3750
|
-
function
|
|
3523
|
+
function buildRootIgnore2(root, exclude) {
|
|
3751
3524
|
const ig = ignore();
|
|
3752
|
-
const gitignorePath =
|
|
3753
|
-
if (
|
|
3525
|
+
const gitignorePath = path10.join(root, ".gitignore");
|
|
3526
|
+
if (fs11.existsSync(gitignorePath)) {
|
|
3754
3527
|
try {
|
|
3755
|
-
ig.add(
|
|
3528
|
+
ig.add(fs11.readFileSync(gitignorePath, "utf8"));
|
|
3756
3529
|
} catch {
|
|
3757
3530
|
}
|
|
3758
3531
|
}
|
|
@@ -3762,13 +3535,13 @@ function buildRootIgnore3(root, exclude) {
|
|
|
3762
3535
|
function walkManifests(root, dir, ig, found) {
|
|
3763
3536
|
let entries;
|
|
3764
3537
|
try {
|
|
3765
|
-
entries =
|
|
3538
|
+
entries = fs11.readdirSync(dir, { withFileTypes: true });
|
|
3766
3539
|
} catch {
|
|
3767
3540
|
return;
|
|
3768
3541
|
}
|
|
3769
3542
|
for (const entry of entries) {
|
|
3770
|
-
const abs =
|
|
3771
|
-
const rel2 =
|
|
3543
|
+
const abs = path10.join(dir, entry.name);
|
|
3544
|
+
const rel2 = path10.relative(root, abs).split(path10.sep).join("/");
|
|
3772
3545
|
if (entry.isDirectory()) {
|
|
3773
3546
|
if (isSkippedDirName(entry.name)) continue;
|
|
3774
3547
|
if (rel2 && ig.ignores(`${rel2}/`)) continue;
|
|
@@ -3795,7 +3568,7 @@ async function hashFilesParallel(jobs, concurrency) {
|
|
|
3795
3568
|
if (i >= jobs.length) return;
|
|
3796
3569
|
const job = jobs[i];
|
|
3797
3570
|
try {
|
|
3798
|
-
const buf = await
|
|
3571
|
+
const buf = await fs8.readFile(job.abs);
|
|
3799
3572
|
out[i] = { rel: job.rel, hash: hashBytes(buf), ok: true };
|
|
3800
3573
|
} catch {
|
|
3801
3574
|
out[i] = { rel: job.rel, hash: "", ok: false };
|
|
@@ -3810,7 +3583,7 @@ async function hashFilesParallel(jobs, concurrency) {
|
|
|
3810
3583
|
async function buildGraph(options) {
|
|
3811
3584
|
const timer = new StageTimer();
|
|
3812
3585
|
timer.start("total");
|
|
3813
|
-
const root =
|
|
3586
|
+
const root = path10.resolve(options.root);
|
|
3814
3587
|
timer.start("discover");
|
|
3815
3588
|
const files = discover({
|
|
3816
3589
|
root,
|
|
@@ -3843,7 +3616,7 @@ async function buildGraph(options) {
|
|
|
3843
3616
|
for (const file of files) {
|
|
3844
3617
|
let stat;
|
|
3845
3618
|
try {
|
|
3846
|
-
stat =
|
|
3619
|
+
stat = fs11.statSync(file.abs);
|
|
3847
3620
|
} catch {
|
|
3848
3621
|
continue;
|
|
3849
3622
|
}
|
|
@@ -4049,8 +3822,8 @@ async function buildGraph(options) {
|
|
|
4049
3822
|
});
|
|
4050
3823
|
for (const d of docs) {
|
|
4051
3824
|
try {
|
|
4052
|
-
const st =
|
|
4053
|
-
const hash = hashBytes(
|
|
3825
|
+
const st = fs11.statSync(d.abs);
|
|
3826
|
+
const hash = hashBytes(fs11.readFileSync(d.abs));
|
|
4054
3827
|
hashes.set(d.rel, hash);
|
|
4055
3828
|
fileStats.push({ rel: d.rel, size: st.size, mtimeMs: st.mtimeMs, hash });
|
|
4056
3829
|
} catch {
|
|
@@ -4106,7 +3879,7 @@ async function buildGraph(options) {
|
|
|
4106
3879
|
toolchain
|
|
4107
3880
|
},
|
|
4108
3881
|
meta: {
|
|
4109
|
-
root:
|
|
3882
|
+
root: path10.basename(root) === "" ? "." : ".",
|
|
4110
3883
|
languages,
|
|
4111
3884
|
analysisTier: analysis.tier,
|
|
4112
3885
|
counts: {
|
|
@@ -4166,14 +3939,14 @@ function toRepoRel(p) {
|
|
|
4166
3939
|
function loadScipIndex(root, explicit) {
|
|
4167
3940
|
const candidates = [
|
|
4168
3941
|
explicit,
|
|
4169
|
-
|
|
4170
|
-
|
|
3942
|
+
path10.join(root, "index.scip"),
|
|
3943
|
+
path10.join(root, ".vibgrate", "index.scip")
|
|
4171
3944
|
].filter((p) => Boolean(p));
|
|
4172
3945
|
for (const file of candidates) {
|
|
4173
|
-
const abs =
|
|
4174
|
-
if (!
|
|
3946
|
+
const abs = path10.isAbsolute(file) ? file : path10.resolve(root, file);
|
|
3947
|
+
if (!fs11.existsSync(abs)) continue;
|
|
4175
3948
|
try {
|
|
4176
|
-
const index = decodeScipIndex(new Uint8Array(
|
|
3949
|
+
const index = decodeScipIndex(new Uint8Array(fs11.readFileSync(abs)));
|
|
4177
3950
|
if (index.documents.length) {
|
|
4178
3951
|
return { index, tool: index.toolVersion ? `${index.toolName} ${index.toolVersion}` : index.toolName };
|
|
4179
3952
|
}
|
|
@@ -4267,21 +4040,21 @@ function diffHint(x, y) {
|
|
|
4267
4040
|
}
|
|
4268
4041
|
var SNAPSHOT_VERSION = "vg-freshness/1";
|
|
4269
4042
|
function snapshotPath(root) {
|
|
4270
|
-
return
|
|
4043
|
+
return path10.join(cacheDir(root), "freshness.json");
|
|
4271
4044
|
}
|
|
4272
4045
|
function writeSnapshot(root, corpusHash, fileStats, scope = {}) {
|
|
4273
4046
|
const files = {};
|
|
4274
4047
|
for (const f of fileStats) files[f.rel] = { size: f.size, mtimeMs: f.mtimeMs, hash: f.hash };
|
|
4275
4048
|
const snapshot = { version: SNAPSHOT_VERSION, corpusHash, scope: pruneScope(scope), files };
|
|
4276
4049
|
try {
|
|
4277
|
-
|
|
4278
|
-
|
|
4050
|
+
fs11.mkdirSync(cacheDir(root), { recursive: true });
|
|
4051
|
+
fs11.writeFileSync(snapshotPath(root), stableStringify(snapshot, 0));
|
|
4279
4052
|
} catch {
|
|
4280
4053
|
}
|
|
4281
4054
|
}
|
|
4282
4055
|
function loadSnapshot(root) {
|
|
4283
4056
|
try {
|
|
4284
|
-
const loaded = JSON.parse(
|
|
4057
|
+
const loaded = JSON.parse(fs11.readFileSync(snapshotPath(root), "utf8"));
|
|
4285
4058
|
if (loaded.version === SNAPSHOT_VERSION && loaded.files && typeof loaded.corpusHash === "string") {
|
|
4286
4059
|
return { ...loaded, scope: loaded.scope ?? {} };
|
|
4287
4060
|
}
|
|
@@ -4324,7 +4097,7 @@ function probeFreshness(root) {
|
|
|
4324
4097
|
}
|
|
4325
4098
|
let stat;
|
|
4326
4099
|
try {
|
|
4327
|
-
stat =
|
|
4100
|
+
stat = fs11.statSync(file.abs);
|
|
4328
4101
|
} catch {
|
|
4329
4102
|
drift.removed.push(file.rel);
|
|
4330
4103
|
continue;
|
|
@@ -4342,7 +4115,7 @@ function probeFreshness(root) {
|
|
|
4342
4115
|
}
|
|
4343
4116
|
let hash = "";
|
|
4344
4117
|
try {
|
|
4345
|
-
hash = hashBytes(
|
|
4118
|
+
hash = hashBytes(fs11.readFileSync(file.abs));
|
|
4346
4119
|
} catch {
|
|
4347
4120
|
drift.removed.push(file.rel);
|
|
4348
4121
|
continue;
|
|
@@ -4359,7 +4132,7 @@ function probeFreshness(root) {
|
|
|
4359
4132
|
}
|
|
4360
4133
|
if (absorbed && !hasDrift(drift)) {
|
|
4361
4134
|
try {
|
|
4362
|
-
|
|
4135
|
+
fs11.writeFileSync(snapshotPath(root), stableStringify(snapshot, 0));
|
|
4363
4136
|
} catch {
|
|
4364
4137
|
}
|
|
4365
4138
|
}
|
|
@@ -4604,12 +4377,12 @@ function detectAssistants(root, opts = {}) {
|
|
|
4604
4377
|
const which = opts.which ?? whichOnPath;
|
|
4605
4378
|
const found = [];
|
|
4606
4379
|
for (const assistant of ASSISTANTS) {
|
|
4607
|
-
const repoHit = (assistant.markers ?? []).find((m) =>
|
|
4380
|
+
const repoHit = (assistant.markers ?? []).find((m) => fs11.existsSync(path10.join(root, m)));
|
|
4608
4381
|
if (repoHit) {
|
|
4609
4382
|
found.push({ assistant, via: "repo", marker: repoHit });
|
|
4610
4383
|
continue;
|
|
4611
4384
|
}
|
|
4612
|
-
const homeHit = (assistant.homeMarkers ?? []).find((m) =>
|
|
4385
|
+
const homeHit = (assistant.homeMarkers ?? []).find((m) => fs11.existsSync(path10.join(home, m)));
|
|
4613
4386
|
if (homeHit) {
|
|
4614
4387
|
found.push({ assistant, via: "home", marker: homeHit });
|
|
4615
4388
|
continue;
|
|
@@ -4641,19 +4414,19 @@ function installAssistant(a, opts) {
|
|
|
4641
4414
|
const skipped = [];
|
|
4642
4415
|
let note;
|
|
4643
4416
|
if (a.skill) {
|
|
4644
|
-
writeFileEnsured(
|
|
4417
|
+
writeFileEnsured(path10.join(opts.root, a.skill), skillMarkdown(a.id));
|
|
4645
4418
|
wrote.push(a.skill);
|
|
4646
4419
|
}
|
|
4647
4420
|
if (a.mcp) {
|
|
4648
4421
|
const launch = opts.launch ?? detectServeLaunch();
|
|
4649
|
-
upsertMcp(
|
|
4422
|
+
upsertMcp(path10.join(opts.root, a.mcp.file), a.mcp, launch);
|
|
4650
4423
|
wrote.push(a.mcp.file);
|
|
4651
4424
|
note = launch.note;
|
|
4652
4425
|
} else {
|
|
4653
4426
|
skipped.push("mcp (host-specific setup)");
|
|
4654
4427
|
}
|
|
4655
4428
|
if (a.nudge && opts.hook !== false) {
|
|
4656
|
-
writeNudge(
|
|
4429
|
+
writeNudge(path10.join(opts.root, a.nudge.file), a.nudge, opts.smallRepo, a.id);
|
|
4657
4430
|
wrote.push(a.nudge.file);
|
|
4658
4431
|
} else if (a.nudge) {
|
|
4659
4432
|
skipped.push("nudge (--no-hook)");
|
|
@@ -4663,34 +4436,34 @@ function installAssistant(a, opts) {
|
|
|
4663
4436
|
function uninstallAssistant(a, root, purge) {
|
|
4664
4437
|
const removed = [];
|
|
4665
4438
|
if (a.mcp) {
|
|
4666
|
-
const file =
|
|
4439
|
+
const file = path10.join(root, a.mcp.file);
|
|
4667
4440
|
if (removeMcp(file, a.mcp)) removed.push(a.mcp.file);
|
|
4668
4441
|
}
|
|
4669
4442
|
if (a.nudge) {
|
|
4670
|
-
const file =
|
|
4443
|
+
const file = path10.join(root, a.nudge.file);
|
|
4671
4444
|
if (a.nudge.kind === "block") {
|
|
4672
4445
|
if (removeBlock(file)) removed.push(a.nudge.file);
|
|
4673
|
-
} else if (
|
|
4674
|
-
|
|
4446
|
+
} else if (fs11.existsSync(file)) {
|
|
4447
|
+
fs11.rmSync(file);
|
|
4675
4448
|
removed.push(a.nudge.file);
|
|
4676
4449
|
}
|
|
4677
4450
|
}
|
|
4678
4451
|
if (purge && a.skill) {
|
|
4679
|
-
const file =
|
|
4680
|
-
if (
|
|
4681
|
-
|
|
4452
|
+
const file = path10.join(root, a.skill);
|
|
4453
|
+
if (fs11.existsSync(file)) {
|
|
4454
|
+
fs11.rmSync(file);
|
|
4682
4455
|
removed.push(a.skill);
|
|
4683
4456
|
}
|
|
4684
4457
|
}
|
|
4685
4458
|
return removed;
|
|
4686
4459
|
}
|
|
4687
4460
|
function isAssistantInstalled(a, root) {
|
|
4688
|
-
if (a.skill &&
|
|
4461
|
+
if (a.skill && fs11.existsSync(path10.join(root, a.skill))) return true;
|
|
4689
4462
|
if (a.mcp) {
|
|
4690
|
-
const file =
|
|
4463
|
+
const file = path10.join(root, a.mcp.file);
|
|
4691
4464
|
if (a.mcp.format === "toml") {
|
|
4692
4465
|
if (hasTomlMcp(file, a.mcp)) return true;
|
|
4693
|
-
} else if (
|
|
4466
|
+
} else if (fs11.existsSync(file)) {
|
|
4694
4467
|
try {
|
|
4695
4468
|
const config = readJson(file);
|
|
4696
4469
|
const bag = config[a.mcp.key];
|
|
@@ -4700,8 +4473,8 @@ function isAssistantInstalled(a, root) {
|
|
|
4700
4473
|
}
|
|
4701
4474
|
}
|
|
4702
4475
|
if (a.nudge) {
|
|
4703
|
-
const file =
|
|
4704
|
-
if (!
|
|
4476
|
+
const file = path10.join(root, a.nudge.file);
|
|
4477
|
+
if (!fs11.existsSync(file)) return false;
|
|
4705
4478
|
const text = readTextSafe(file);
|
|
4706
4479
|
if (!text) return false;
|
|
4707
4480
|
if (a.nudge.kind === "block") return text.includes(NUDGE_BEGIN);
|
|
@@ -4710,19 +4483,19 @@ function isAssistantInstalled(a, root) {
|
|
|
4710
4483
|
return false;
|
|
4711
4484
|
}
|
|
4712
4485
|
function writeFileEnsured(file, content) {
|
|
4713
|
-
|
|
4714
|
-
|
|
4486
|
+
fs11.mkdirSync(path10.dirname(file), { recursive: true });
|
|
4487
|
+
fs11.writeFileSync(file, content);
|
|
4715
4488
|
}
|
|
4716
4489
|
function writeNavigationConfig(root) {
|
|
4717
4490
|
ensureVibgrateGitignore(root);
|
|
4718
|
-
const rel2 =
|
|
4491
|
+
const rel2 = path10.join(".vibgrate", "mcp-navigation.json");
|
|
4719
4492
|
const doc = {
|
|
4720
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.",
|
|
4721
4494
|
hot_core: [...HOT_TOOLS],
|
|
4722
4495
|
deferred: deferredToolNames(),
|
|
4723
4496
|
toolset: navigationToolsetConfig()
|
|
4724
4497
|
};
|
|
4725
|
-
writeFileEnsured(
|
|
4498
|
+
writeFileEnsured(path10.join(root, rel2), `${JSON.stringify(doc, null, 2)}
|
|
4726
4499
|
`);
|
|
4727
4500
|
return rel2;
|
|
4728
4501
|
}
|
|
@@ -4752,7 +4525,7 @@ function upsertTomlMcp(file, target, launch) {
|
|
|
4752
4525
|
command = ${tomlString(entry.command)}
|
|
4753
4526
|
args = [${entry.args.map(tomlString).join(", ")}]
|
|
4754
4527
|
`;
|
|
4755
|
-
const existing =
|
|
4528
|
+
const existing = fs11.existsSync(file) ? fs11.readFileSync(file, "utf8") : "";
|
|
4756
4529
|
const re = tomlTableRe(target.key);
|
|
4757
4530
|
const next = re.test(existing) ? existing.replace(re, (m) => m.startsWith("\n") ? `
|
|
4758
4531
|
${table}` : table) : existing.length ? `${existing.replace(/\s*$/, "")}
|
|
@@ -4761,7 +4534,7 @@ ${table}` : table;
|
|
|
4761
4534
|
writeFileEnsured(file, next);
|
|
4762
4535
|
}
|
|
4763
4536
|
function removeTomlMcp(file, target) {
|
|
4764
|
-
if (!
|
|
4537
|
+
if (!fs11.existsSync(file)) return false;
|
|
4765
4538
|
const existing = readTextSafe(file);
|
|
4766
4539
|
if (existing === null) return false;
|
|
4767
4540
|
const re = tomlTableRe(target.key);
|
|
@@ -4771,13 +4544,13 @@ function removeTomlMcp(file, target) {
|
|
|
4771
4544
|
return true;
|
|
4772
4545
|
}
|
|
4773
4546
|
function hasTomlMcp(file, target) {
|
|
4774
|
-
if (!
|
|
4547
|
+
if (!fs11.existsSync(file)) return false;
|
|
4775
4548
|
const text = readTextSafe(file);
|
|
4776
4549
|
return text !== null && tomlTableRe(target.key).test(text);
|
|
4777
4550
|
}
|
|
4778
4551
|
function removeMcp(file, target) {
|
|
4779
4552
|
if (target.format === "toml") return removeTomlMcp(file, target);
|
|
4780
|
-
if (!
|
|
4553
|
+
if (!fs11.existsSync(file)) return false;
|
|
4781
4554
|
const config = readJson(file);
|
|
4782
4555
|
const bag = config[target.key];
|
|
4783
4556
|
if (!bag || !(bag.vg !== void 0)) return false;
|
|
@@ -4796,8 +4569,8 @@ function refreshInstalledInstructions(root, smallRepo) {
|
|
|
4796
4569
|
};
|
|
4797
4570
|
for (const a of ASSISTANTS) {
|
|
4798
4571
|
if (a.skill) {
|
|
4799
|
-
const file =
|
|
4800
|
-
if (
|
|
4572
|
+
const file = path10.join(root, a.skill);
|
|
4573
|
+
if (fs11.existsSync(file)) {
|
|
4801
4574
|
const text = readTextSafe(file);
|
|
4802
4575
|
const from = text === null ? null : staleVersion(text, "# vg \u2014 the code map");
|
|
4803
4576
|
if (from !== null) {
|
|
@@ -4807,8 +4580,8 @@ function refreshInstalledInstructions(root, smallRepo) {
|
|
|
4807
4580
|
}
|
|
4808
4581
|
}
|
|
4809
4582
|
if (a.nudge) {
|
|
4810
|
-
const file =
|
|
4811
|
-
if (!
|
|
4583
|
+
const file = path10.join(root, a.nudge.file);
|
|
4584
|
+
if (!fs11.existsSync(file)) continue;
|
|
4812
4585
|
const text = readTextSafe(file);
|
|
4813
4586
|
if (text === null) continue;
|
|
4814
4587
|
if (a.nudge.kind === "block") {
|
|
@@ -4832,7 +4605,7 @@ function refreshInstalledInstructions(root, smallRepo) {
|
|
|
4832
4605
|
}
|
|
4833
4606
|
function readTextSafe(file) {
|
|
4834
4607
|
try {
|
|
4835
|
-
return
|
|
4608
|
+
return fs11.readFileSync(file, "utf8");
|
|
4836
4609
|
} catch {
|
|
4837
4610
|
return null;
|
|
4838
4611
|
}
|
|
@@ -4851,8 +4624,8 @@ ${stripMarkers(nudgeMarkdown(smallRepo, client))}` : stripMarkers(nudgeMarkdown(
|
|
|
4851
4624
|
upsertBlock(file, nudgeMarkdown(smallRepo, client));
|
|
4852
4625
|
}
|
|
4853
4626
|
function upsertBlock(file, block) {
|
|
4854
|
-
|
|
4855
|
-
let existing =
|
|
4627
|
+
fs11.mkdirSync(path10.dirname(file), { recursive: true });
|
|
4628
|
+
let existing = fs11.existsSync(file) ? fs11.readFileSync(file, "utf8") : "";
|
|
4856
4629
|
const re = new RegExp(`${escapeRe(NUDGE_BEGIN)}[\\s\\S]*?${escapeRe(NUDGE_END)}`);
|
|
4857
4630
|
if (re.test(existing)) existing = existing.replace(re, block);
|
|
4858
4631
|
else existing = existing.length ? `${existing.replace(/\s*$/, "")}
|
|
@@ -4860,20 +4633,20 @@ function upsertBlock(file, block) {
|
|
|
4860
4633
|
${block}
|
|
4861
4634
|
` : `${block}
|
|
4862
4635
|
`;
|
|
4863
|
-
|
|
4636
|
+
fs11.writeFileSync(file, existing);
|
|
4864
4637
|
}
|
|
4865
4638
|
function removeBlock(file) {
|
|
4866
|
-
if (!
|
|
4867
|
-
const existing =
|
|
4639
|
+
if (!fs11.existsSync(file)) return false;
|
|
4640
|
+
const existing = fs11.readFileSync(file, "utf8");
|
|
4868
4641
|
const re = new RegExp(`\\n*${escapeRe(NUDGE_BEGIN)}[\\s\\S]*?${escapeRe(NUDGE_END)}\\n*`);
|
|
4869
4642
|
if (!re.test(existing)) return false;
|
|
4870
|
-
|
|
4643
|
+
fs11.writeFileSync(file, existing.replace(re, "\n"));
|
|
4871
4644
|
return true;
|
|
4872
4645
|
}
|
|
4873
4646
|
function readJson(file) {
|
|
4874
|
-
if (!
|
|
4647
|
+
if (!fs11.existsSync(file)) return {};
|
|
4875
4648
|
try {
|
|
4876
|
-
const parsed = JSON.parse(
|
|
4649
|
+
const parsed = JSON.parse(fs11.readFileSync(file, "utf8"));
|
|
4877
4650
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
4878
4651
|
return parsed;
|
|
4879
4652
|
}
|
|
@@ -4892,6 +4665,6 @@ function escapeRe(s) {
|
|
|
4892
4665
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4893
4666
|
}
|
|
4894
4667
|
|
|
4895
|
-
export { ASSISTANTS, ResourceLimitError,
|
|
4896
|
-
//# sourceMappingURL=chunk-
|
|
4897
|
-
//# 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-6PFHDHOL.js.map
|
|
4670
|
+
//# sourceMappingURL=chunk-6PFHDHOL.js.map
|