@vibgrate/cli 2026.818.2 → 2026.819.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DOCS.md +3 -3
- package/dist/agent-ZJRWCMR6.js +30 -0
- package/dist/{agent-X6VYCE63.js.map → agent-ZJRWCMR6.js.map} +1 -1
- package/dist/{approvals-TPQFQSWG.js → approvals-YTUXBZWQ.js} +7 -7
- package/dist/{approvals-TPQFQSWG.js.map → approvals-YTUXBZWQ.js.map} +1 -1
- package/dist/attach-WOA25VNH.js +10 -0
- package/dist/{attach-G5JUIWIT.js.map → attach-WOA25VNH.js.map} +1 -1
- package/dist/baseline-TVRRUZGA.js +9 -0
- package/dist/{baseline-DXI64VLW.js.map → baseline-TVRRUZGA.js.map} +1 -1
- package/dist/{chunk-V6WONSIK.js → chunk-24HKTTFV.js} +5 -5
- package/dist/{chunk-V6WONSIK.js.map → chunk-24HKTTFV.js.map} +1 -1
- package/dist/{chunk-VMAIDM4K.js → chunk-2C4QT5D7.js} +5 -5
- package/dist/{chunk-VMAIDM4K.js.map → chunk-2C4QT5D7.js.map} +1 -1
- package/dist/{chunk-JGA63RGF.js → chunk-2ZBLZ2S3.js} +13 -13
- package/dist/{chunk-JGA63RGF.js.map → chunk-2ZBLZ2S3.js.map} +1 -1
- package/dist/{chunk-OV4KGXPD.js → chunk-57ZRSCHY.js} +3 -3
- package/dist/{chunk-OV4KGXPD.js.map → chunk-57ZRSCHY.js.map} +1 -1
- package/dist/{chunk-NDNNOAS6.js → chunk-6H2QV5DR.js} +3 -3
- package/dist/{chunk-NDNNOAS6.js.map → chunk-6H2QV5DR.js.map} +1 -1
- package/dist/{chunk-2C33WR5O.js → chunk-7BSUPHX6.js} +3 -3
- package/dist/{chunk-2C33WR5O.js.map → chunk-7BSUPHX6.js.map} +1 -1
- package/dist/{chunk-LJSJX6U4.js → chunk-A3WWRW7U.js} +3 -3
- package/dist/{chunk-LJSJX6U4.js.map → chunk-A3WWRW7U.js.map} +1 -1
- package/dist/{chunk-X2MQ7UFL.js → chunk-AP3JN33O.js} +12 -12
- package/dist/{chunk-X2MQ7UFL.js.map → chunk-AP3JN33O.js.map} +1 -1
- package/dist/{chunk-O5IJDMTB.js → chunk-AQZYDFEK.js} +4 -4
- package/dist/{chunk-O5IJDMTB.js.map → chunk-AQZYDFEK.js.map} +1 -1
- package/dist/{chunk-VQ5KMHW6.js → chunk-BQ6NTRRK.js} +44 -15
- package/dist/chunk-BQ6NTRRK.js.map +1 -0
- package/dist/{chunk-HF6R73UC.js → chunk-C2EZIAA3.js} +27 -13
- package/dist/chunk-C2EZIAA3.js.map +1 -0
- package/dist/{chunk-MRZHNUN7.js → chunk-CA4YQBA7.js} +4 -4
- package/dist/{chunk-MRZHNUN7.js.map → chunk-CA4YQBA7.js.map} +1 -1
- package/dist/{chunk-YF54UMOU.js → chunk-CBL3VY7J.js} +3 -3
- package/dist/{chunk-YF54UMOU.js.map → chunk-CBL3VY7J.js.map} +1 -1
- package/dist/{chunk-PRHH4DVO.js → chunk-FCMWHSQ6.js} +3 -3
- package/dist/{chunk-PRHH4DVO.js.map → chunk-FCMWHSQ6.js.map} +1 -1
- package/dist/{chunk-V2UGRUTL.js → chunk-GBXOAO5V.js} +176 -37
- package/dist/chunk-GBXOAO5V.js.map +1 -0
- package/dist/{chunk-JFE7XCAE.js → chunk-IASO2HCI.js} +3 -3
- package/dist/{chunk-JFE7XCAE.js.map → chunk-IASO2HCI.js.map} +1 -1
- package/dist/{chunk-ZUOBPKVK.js → chunk-IMI2VHHZ.js} +3 -3
- package/dist/{chunk-ZUOBPKVK.js.map → chunk-IMI2VHHZ.js.map} +1 -1
- package/dist/{chunk-NKLYDSB7.js → chunk-JPOYXG7Z.js} +10 -10
- package/dist/{chunk-NKLYDSB7.js.map → chunk-JPOYXG7Z.js.map} +1 -1
- package/dist/{chunk-L2OS4WHT.js → chunk-MMJFHEZ4.js} +4 -4
- package/dist/{chunk-L2OS4WHT.js.map → chunk-MMJFHEZ4.js.map} +1 -1
- package/dist/{chunk-E3O5UKNA.js → chunk-NKKOGJ63.js} +35 -17
- package/dist/chunk-NKKOGJ63.js.map +1 -0
- package/dist/{chunk-7AVYKZEM.js → chunk-NV7XNBX4.js} +4 -4
- package/dist/{chunk-7AVYKZEM.js.map → chunk-NV7XNBX4.js.map} +1 -1
- package/dist/{chunk-NJQZRM55.js → chunk-OGFOJG4H.js} +6 -6
- package/dist/{chunk-NJQZRM55.js.map → chunk-OGFOJG4H.js.map} +1 -1
- package/dist/{chunk-NZELMYT4.js → chunk-OLIMW4PQ.js} +8 -56
- package/dist/chunk-OLIMW4PQ.js.map +1 -0
- package/dist/{chunk-B4EXD5LK.js → chunk-PJRPSYFQ.js} +9 -7
- package/dist/chunk-PJRPSYFQ.js.map +1 -0
- package/dist/{chunk-NG4KIJW6.js → chunk-PVNALGTG.js} +10 -6
- package/dist/chunk-PVNALGTG.js.map +1 -0
- package/dist/{chunk-BMOFJIMG.js → chunk-QE6F62FR.js} +3 -3
- package/dist/{chunk-BMOFJIMG.js.map → chunk-QE6F62FR.js.map} +1 -1
- package/dist/{chunk-6ABMV74F.js → chunk-R5TQBIR6.js} +4 -4
- package/dist/{chunk-6ABMV74F.js.map → chunk-R5TQBIR6.js.map} +1 -1
- package/dist/{chunk-5I4VSBWQ.js → chunk-RTURQXQL.js} +372 -113
- package/dist/chunk-RTURQXQL.js.map +1 -0
- package/dist/{chunk-74UBGF4P.js → chunk-SHD5TCZ5.js} +3 -3
- package/dist/{chunk-74UBGF4P.js.map → chunk-SHD5TCZ5.js.map} +1 -1
- package/dist/{chunk-KU7FI5EV.js → chunk-USPMMVNH.js} +3 -3
- package/dist/{chunk-KU7FI5EV.js.map → chunk-USPMMVNH.js.map} +1 -1
- package/dist/{chunk-E53WBVUQ.js → chunk-VHRSG6CF.js} +3 -3
- package/dist/{chunk-E53WBVUQ.js.map → chunk-VHRSG6CF.js.map} +1 -1
- package/dist/{chunk-I5LP55B6.js → chunk-W44THEXF.js} +3 -3
- package/dist/{chunk-I5LP55B6.js.map → chunk-W44THEXF.js.map} +1 -1
- package/dist/{chunk-AEJYA6HZ.js → chunk-W6ASIMG5.js} +7 -7
- package/dist/{chunk-AEJYA6HZ.js.map → chunk-W6ASIMG5.js.map} +1 -1
- package/dist/{chunk-CQDUBAQY.js → chunk-WNKGRXUA.js} +3 -3
- package/dist/{chunk-CQDUBAQY.js.map → chunk-WNKGRXUA.js.map} +1 -1
- package/dist/{chunk-RHKOUPWT.js → chunk-WPLOEFZU.js} +7 -5
- package/dist/chunk-WPLOEFZU.js.map +1 -0
- package/dist/{chunk-FJG5AXKZ.js → chunk-WUFIXAEJ.js} +22 -6
- package/dist/chunk-WUFIXAEJ.js.map +1 -0
- package/dist/{chunk-6PFHDHOL.js → chunk-XLQ4YHS3.js} +16 -14
- package/dist/chunk-XLQ4YHS3.js.map +1 -0
- package/dist/{chunk-BWPBB45M.js → chunk-XP6UUCZZ.js} +3 -3
- package/dist/{chunk-BWPBB45M.js.map → chunk-XP6UUCZZ.js.map} +1 -1
- package/dist/{chunk-BPF3YX2U.js → chunk-XQNKCA2J.js} +6 -3
- package/dist/chunk-XQNKCA2J.js.map +1 -0
- package/dist/{chunk-FFXGWFAE.js → chunk-XW2XQM3C.js} +7 -7
- package/dist/{chunk-FFXGWFAE.js.map → chunk-XW2XQM3C.js.map} +1 -1
- package/dist/{chunk-7N4Y3E47.js → chunk-YJYEPYB2.js} +13 -18
- package/dist/chunk-YJYEPYB2.js.map +1 -0
- package/dist/chunk-ZUZHYAJK.js +6 -0
- package/dist/{chunk-4NTNMT6T.js.map → chunk-ZUZHYAJK.js.map} +1 -1
- package/dist/cli.js +112 -108
- package/dist/cli.js.map +1 -1
- package/dist/client-P5XSRFV4.js +8 -0
- package/dist/{client-UQIELEEZ.js.map → client-P5XSRFV4.js.map} +1 -1
- package/dist/daemon-YKOEP3XA.js +30 -0
- package/dist/{daemon-GUMWMKCA.js.map → daemon-YKOEP3XA.js.map} +1 -1
- package/dist/embed-worker-main.js +5 -5
- package/dist/ensure-map-BLRJDO2Y.js +40 -0
- package/dist/{ensure-map-FHDJTO7Y.js.map → ensure-map-BLRJDO2Y.js.map} +1 -1
- package/dist/federation-M4ZNXOPX.js +8 -0
- package/dist/{federation-MDQPO3PW.js.map → federation-M4ZNXOPX.js.map} +1 -1
- package/dist/fs-FO3NQHPT.js +4 -0
- package/dist/fs-FO3NQHPT.js.map +1 -0
- package/dist/git-ref-LMT3EXYY.js +4 -0
- package/dist/{git-ref-RSRAN4OH.js.map → git-ref-LMT3EXYY.js.map} +1 -1
- package/dist/graph-backend-NTYONTWW.js +16 -0
- package/dist/{graph-backend-W2D3HRRD.js.map → graph-backend-NTYONTWW.js.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +24 -25
- package/dist/index.js.map +1 -1
- package/dist/{interactive-2MK4TLRD.js → interactive-B3WTC7LB.js} +41 -42
- package/dist/interactive-B3WTC7LB.js.map +1 -0
- package/dist/{llm-host-XFYFOAAX.js → llm-host-QVTJJVER.js} +5 -5
- package/dist/{llm-host-XFYFOAAX.js.map → llm-host-QVTJJVER.js.map} +1 -1
- package/dist/load-AJROS77R.js +11 -0
- package/dist/{load-4R4HYMBB.js.map → load-AJROS77R.js.map} +1 -1
- package/dist/local-runtime-GA43KYS5.js +6 -0
- package/dist/{local-runtime-6SNWKSA7.js.map → local-runtime-GA43KYS5.js.map} +1 -1
- package/dist/model-manager-6H3TMZKK.js +10 -0
- package/dist/{model-manager-SXHZ5VD4.js.map → model-manager-6H3TMZKK.js.map} +1 -1
- package/dist/{model-orchestrator-LHYPJBFH.js → model-orchestrator-X3NE3Y2G.js} +6 -6
- package/dist/{model-orchestrator-LHYPJBFH.js.map → model-orchestrator-X3NE3Y2G.js.map} +1 -1
- package/dist/parse-worker.js +2 -2
- package/dist/{paths-62AKTFSR.js → paths-RVK6FKRN.js} +4 -4
- package/dist/{paths-62AKTFSR.js.map → paths-RVK6FKRN.js.map} +1 -1
- package/dist/publish-27S66NOW.js +9 -0
- package/dist/{publish-7YHRTBRA.js.map → publish-27S66NOW.js.map} +1 -1
- package/dist/resolve-gguf-WVKVDN45.js +9 -0
- package/dist/{resolve-gguf-SDIYGGI6.js.map → resolve-gguf-WVKVDN45.js.map} +1 -1
- package/dist/{run-outcome-H5GVDDZJ.js → run-outcome-SBBSTSH3.js} +7 -7
- package/dist/{run-outcome-H5GVDDZJ.js.map → run-outcome-SBBSTSH3.js.map} +1 -1
- package/dist/runtime-session-JYYKQVDX.js +26 -0
- package/dist/{runtime-session-JBIHHH5N.js.map → runtime-session-JYYKQVDX.js.map} +1 -1
- package/dist/session-2ZMHZ2O6.js +17 -0
- package/dist/{session-N5IU4K5Q.js.map → session-2ZMHZ2O6.js.map} +1 -1
- package/dist/{slot-subscription-25GOARW5.js → slot-subscription-C2ZUJED6.js} +5 -5
- package/dist/{slot-subscription-25GOARW5.js.map → slot-subscription-C2ZUJED6.js.map} +1 -1
- package/dist/{stream-json-4WLSUF6I.js → stream-json-ZWGB4C47.js} +17 -17
- package/dist/{stream-json-4WLSUF6I.js.map → stream-json-ZWGB4C47.js.map} +1 -1
- package/dist/version-5QIEUXU6.js +4 -0
- package/dist/{version-DTEU3SQD.js.map → version-5QIEUXU6.js.map} +1 -1
- package/dist/{vg-mcp-bridge-KDVYIMFX.js → vg-mcp-bridge-4FETMJ6M.js} +16 -15
- package/dist/vg-mcp-bridge-4FETMJ6M.js.map +1 -0
- package/dist/{vgd-M7UOPWLB.js → vgd-R524P5BJ.js} +13 -14
- package/dist/vgd-R524P5BJ.js.map +1 -0
- package/package.json +1 -1
- package/dist/agent-X6VYCE63.js +0 -30
- package/dist/attach-G5JUIWIT.js +0 -10
- package/dist/baseline-DXI64VLW.js +0 -9
- package/dist/chunk-4NTNMT6T.js +0 -6
- package/dist/chunk-5I4VSBWQ.js.map +0 -1
- package/dist/chunk-6PFHDHOL.js.map +0 -1
- package/dist/chunk-7N4Y3E47.js.map +0 -1
- package/dist/chunk-B4EXD5LK.js.map +0 -1
- package/dist/chunk-BPF3YX2U.js.map +0 -1
- package/dist/chunk-E3O5UKNA.js.map +0 -1
- package/dist/chunk-FJG5AXKZ.js.map +0 -1
- package/dist/chunk-HF6R73UC.js.map +0 -1
- package/dist/chunk-NG4KIJW6.js.map +0 -1
- package/dist/chunk-NZELMYT4.js.map +0 -1
- package/dist/chunk-POOL355F.js +0 -237
- package/dist/chunk-POOL355F.js.map +0 -1
- package/dist/chunk-RHKOUPWT.js.map +0 -1
- package/dist/chunk-V2UGRUTL.js.map +0 -1
- package/dist/chunk-VQ5KMHW6.js.map +0 -1
- package/dist/client-UQIELEEZ.js +0 -8
- package/dist/daemon-GUMWMKCA.js +0 -31
- package/dist/ensure-map-FHDJTO7Y.js +0 -41
- package/dist/federation-MDQPO3PW.js +0 -7
- package/dist/fs-TLPOWC2D.js +0 -4
- package/dist/fs-TLPOWC2D.js.map +0 -1
- package/dist/git-ref-RSRAN4OH.js +0 -4
- package/dist/graph-backend-W2D3HRRD.js +0 -16
- package/dist/interactive-2MK4TLRD.js.map +0 -1
- package/dist/load-4R4HYMBB.js +0 -11
- package/dist/local-runtime-6SNWKSA7.js +0 -6
- package/dist/model-manager-SXHZ5VD4.js +0 -10
- package/dist/publish-7YHRTBRA.js +0 -9
- package/dist/resolve-gguf-SDIYGGI6.js +0 -9
- package/dist/runtime-session-JBIHHH5N.js +0 -27
- package/dist/session-N5IU4K5Q.js +0 -17
- package/dist/version-DTEU3SQD.js +0 -4
- package/dist/vg-mcp-bridge-KDVYIMFX.js.map +0 -1
- package/dist/vgd-M7UOPWLB.js.map +0 -1
|
@@ -1,22 +1,274 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import * as
|
|
1
|
+
import { langById, langForExtension } from './chunk-6WRG7VDO.js';
|
|
2
|
+
import { repositoryIdFromRoot, globalGraphPathForRef, globalGraphPath } from './chunk-XP6UUCZZ.js';
|
|
3
|
+
import { detectGitRef } from './chunk-XQNKCA2J.js';
|
|
4
|
+
import * as fs2 from 'fs';
|
|
5
|
+
import * as path6 from 'path';
|
|
6
|
+
import ignore from 'ignore';
|
|
5
7
|
|
|
8
|
+
var SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
9
|
+
// Version control, IDE & tool metadata
|
|
10
|
+
".git",
|
|
11
|
+
".svn",
|
|
12
|
+
".hg",
|
|
13
|
+
".idea",
|
|
14
|
+
".vscode",
|
|
15
|
+
".vs",
|
|
16
|
+
// Claude Code agent state / worktrees (full monorepo copies under .claude/worktrees/)
|
|
17
|
+
".claude",
|
|
18
|
+
".vibgrate",
|
|
19
|
+
".wrangler",
|
|
20
|
+
".turbo",
|
|
21
|
+
".cache",
|
|
22
|
+
// Migration / tool backup trees (NativeScript, codemods, agent worktrees)
|
|
23
|
+
".migration_backup",
|
|
24
|
+
".update_backup",
|
|
25
|
+
".backup",
|
|
26
|
+
".bak",
|
|
27
|
+
".history",
|
|
28
|
+
".snapshots",
|
|
29
|
+
".snapshots_bak",
|
|
30
|
+
// JavaScript / Node — installed dependency trees
|
|
31
|
+
"node_modules",
|
|
32
|
+
"bower_components",
|
|
33
|
+
"jspm_packages",
|
|
34
|
+
"web_modules",
|
|
35
|
+
".pnpm-store",
|
|
36
|
+
".yarn",
|
|
37
|
+
// JS/TS meta-framework & bundler build output
|
|
38
|
+
".next",
|
|
39
|
+
".nuxt",
|
|
40
|
+
".output",
|
|
41
|
+
".svelte-kit",
|
|
42
|
+
".astro",
|
|
43
|
+
".vercel",
|
|
44
|
+
".netlify",
|
|
45
|
+
".angular",
|
|
46
|
+
".parcel-cache",
|
|
47
|
+
".docusaurus",
|
|
48
|
+
"storybook-static",
|
|
49
|
+
// Generic build / dist / coverage output
|
|
50
|
+
"dist",
|
|
51
|
+
"build",
|
|
52
|
+
"out",
|
|
53
|
+
"coverage",
|
|
54
|
+
// Native mobile platform build trees (NativeScript / Cordova / Capacitor)
|
|
55
|
+
"platforms",
|
|
56
|
+
"App_Resources",
|
|
57
|
+
// Vendored third-party source trees
|
|
58
|
+
"vendor",
|
|
59
|
+
"Pods",
|
|
60
|
+
"Carthage",
|
|
61
|
+
// Python — virtualenvs & tool caches
|
|
62
|
+
".venv",
|
|
63
|
+
"venv",
|
|
64
|
+
"virtualenv",
|
|
65
|
+
".tox",
|
|
66
|
+
".nox",
|
|
67
|
+
"__pycache__",
|
|
68
|
+
".mypy_cache",
|
|
69
|
+
".pytest_cache",
|
|
70
|
+
".ruff_cache",
|
|
71
|
+
".eggs",
|
|
72
|
+
".ipynb_checkpoints",
|
|
73
|
+
// Ruby
|
|
74
|
+
".bundle",
|
|
75
|
+
// Rust / Maven / sbt / Clojure — all build into target/
|
|
76
|
+
"target",
|
|
77
|
+
// JVM (Gradle / Maven) & .NET build output
|
|
78
|
+
".gradle",
|
|
79
|
+
"bin",
|
|
80
|
+
"obj",
|
|
81
|
+
"TestResults",
|
|
82
|
+
// Swift / Xcode
|
|
83
|
+
".build",
|
|
84
|
+
".swiftpm",
|
|
85
|
+
"DerivedData",
|
|
86
|
+
// Dart / Flutter
|
|
87
|
+
".dart_tool",
|
|
88
|
+
// Elixir / Erlang
|
|
89
|
+
"_build",
|
|
90
|
+
"deps",
|
|
91
|
+
// Haskell (Cabal / Stack)
|
|
92
|
+
"dist-newstyle",
|
|
93
|
+
".stack-work",
|
|
94
|
+
// Infrastructure-as-code build/state
|
|
95
|
+
".terraform",
|
|
96
|
+
".serverless",
|
|
97
|
+
"cdk.out",
|
|
98
|
+
".aws-sam"
|
|
99
|
+
]);
|
|
100
|
+
var SCANNED_HIDDEN_DIRS = /* @__PURE__ */ new Set([".github", ".circleci"]);
|
|
101
|
+
function isSkippedDirName(name) {
|
|
102
|
+
if (!name || name === "." || name === "..") return false;
|
|
103
|
+
if (name.startsWith(".")) return !SCANNED_HIDDEN_DIRS.has(name);
|
|
104
|
+
if (SKIP_DIRS.has(name)) return true;
|
|
105
|
+
if (name.startsWith("venv-")) return true;
|
|
106
|
+
if (name === "site-packages") return true;
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
var SKIP_FILES = /* @__PURE__ */ new Set([
|
|
110
|
+
// JavaScript / Node
|
|
111
|
+
"package-lock.json",
|
|
112
|
+
"npm-shrinkwrap.json",
|
|
113
|
+
"yarn.lock",
|
|
114
|
+
"pnpm-lock.yaml",
|
|
115
|
+
"bun.lockb",
|
|
116
|
+
"bun.lock",
|
|
117
|
+
"deno.lock",
|
|
118
|
+
".pnp.cjs",
|
|
119
|
+
".pnp.data.json",
|
|
120
|
+
".pnp.loader.mjs",
|
|
121
|
+
// Python
|
|
122
|
+
"poetry.lock",
|
|
123
|
+
"pipfile.lock",
|
|
124
|
+
"pdm.lock",
|
|
125
|
+
"uv.lock",
|
|
126
|
+
"pylock.toml",
|
|
127
|
+
"conda-lock.yml",
|
|
128
|
+
// Ruby
|
|
129
|
+
"gemfile.lock",
|
|
130
|
+
// PHP
|
|
131
|
+
"composer.lock",
|
|
132
|
+
// Rust
|
|
133
|
+
"cargo.lock",
|
|
134
|
+
// Go
|
|
135
|
+
"go.sum",
|
|
136
|
+
"go.work.sum",
|
|
137
|
+
"gopkg.lock",
|
|
138
|
+
"glide.lock",
|
|
139
|
+
// .NET
|
|
140
|
+
"packages.lock.json",
|
|
141
|
+
// Java / JVM (Gradle)
|
|
142
|
+
"gradle.lockfile",
|
|
143
|
+
// Swift / Xcode
|
|
144
|
+
"package.resolved",
|
|
145
|
+
// Dart / Flutter
|
|
146
|
+
"pubspec.lock",
|
|
147
|
+
// Elixir
|
|
148
|
+
"mix.lock",
|
|
149
|
+
// Haskell (Cabal / Stack)
|
|
150
|
+
"cabal.project.freeze",
|
|
151
|
+
"stack.yaml.lock",
|
|
152
|
+
// Julia
|
|
153
|
+
"manifest.toml",
|
|
154
|
+
// R
|
|
155
|
+
"renv.lock",
|
|
156
|
+
// Perl (Carton)
|
|
157
|
+
"cpanfile.snapshot",
|
|
158
|
+
// CocoaPods / Carthage
|
|
159
|
+
"podfile.lock",
|
|
160
|
+
"cartfile.resolved",
|
|
161
|
+
// Terraform / IaC
|
|
162
|
+
".terraform.lock.hcl",
|
|
163
|
+
// Helm
|
|
164
|
+
"chart.lock",
|
|
165
|
+
// C / C++ (Conan)
|
|
166
|
+
"conan.lock",
|
|
167
|
+
// Bazel
|
|
168
|
+
"module.bazel.lock",
|
|
169
|
+
// Nix
|
|
170
|
+
"flake.lock"
|
|
171
|
+
]);
|
|
172
|
+
function toPosix(p) {
|
|
173
|
+
return p.split(path6.sep).join("/");
|
|
174
|
+
}
|
|
175
|
+
function readConfigExcludes(root) {
|
|
176
|
+
const configPath = path6.join(root, "vibgrate.config.json");
|
|
177
|
+
try {
|
|
178
|
+
const parsed = JSON.parse(fs2.readFileSync(configPath, "utf8"));
|
|
179
|
+
if (!Array.isArray(parsed.exclude)) return [];
|
|
180
|
+
return parsed.exclude.filter((x) => typeof x === "string" && x.trim() !== "");
|
|
181
|
+
} catch {
|
|
182
|
+
return [];
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function mergeExcludes(root, extra) {
|
|
186
|
+
const seen = /* @__PURE__ */ new Set();
|
|
187
|
+
const out = [];
|
|
188
|
+
for (const pattern of [...readConfigExcludes(root), ...extra ?? []]) {
|
|
189
|
+
if (seen.has(pattern)) continue;
|
|
190
|
+
seen.add(pattern);
|
|
191
|
+
out.push(pattern);
|
|
192
|
+
}
|
|
193
|
+
return out;
|
|
194
|
+
}
|
|
195
|
+
function buildRootIgnore(root, exclude) {
|
|
196
|
+
const ig = ignore();
|
|
197
|
+
const gitignorePath = path6.join(root, ".gitignore");
|
|
198
|
+
if (fs2.existsSync(gitignorePath)) {
|
|
199
|
+
ig.add(fs2.readFileSync(gitignorePath, "utf8"));
|
|
200
|
+
}
|
|
201
|
+
if (exclude.length) ig.add(exclude);
|
|
202
|
+
return ig;
|
|
203
|
+
}
|
|
204
|
+
function discover(options) {
|
|
205
|
+
const root = path6.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) => path6.resolve(root, p)) : [root]).filter((p) => fs2.existsSync(p));
|
|
215
|
+
const found = /* @__PURE__ */ new Map();
|
|
216
|
+
const considerFile = (abs) => {
|
|
217
|
+
const rel = toPosix(path6.relative(root, abs));
|
|
218
|
+
if (rel.startsWith("..")) return;
|
|
219
|
+
if (rel === "" || rootIg.ignores(rel)) return;
|
|
220
|
+
if (SKIP_FILES.has(path6.basename(abs).toLowerCase())) return;
|
|
221
|
+
const lang = langForExtension(path6.extname(abs));
|
|
222
|
+
if (!lang || !allowLang(lang)) return;
|
|
223
|
+
found.set(rel, { rel, abs, lang });
|
|
224
|
+
};
|
|
225
|
+
const walk = (dir) => {
|
|
226
|
+
let entries;
|
|
227
|
+
try {
|
|
228
|
+
entries = fs2.readdirSync(dir, { withFileTypes: true });
|
|
229
|
+
} catch {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
for (const entry of entries) {
|
|
233
|
+
const abs = path6.join(dir, entry.name);
|
|
234
|
+
const rel = toPosix(path6.relative(root, abs));
|
|
235
|
+
if (entry.isDirectory()) {
|
|
236
|
+
if (isSkippedDirName(entry.name)) continue;
|
|
237
|
+
if (rel && rootIg.ignores(`${rel}/`)) continue;
|
|
238
|
+
walk(abs);
|
|
239
|
+
} else if (entry.isFile()) {
|
|
240
|
+
considerFile(abs);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
for (const scope of scopeAbs) {
|
|
245
|
+
const stat = fs2.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
|
+
};
|
|
6
258
|
function normalizeWorkspaceRoots(roots, base = process.cwd()) {
|
|
7
259
|
const seen = /* @__PURE__ */ new Set();
|
|
8
260
|
const out = [];
|
|
9
|
-
const baseAbs =
|
|
261
|
+
const baseAbs = path6.resolve(base);
|
|
10
262
|
for (const r of roots) {
|
|
11
263
|
if (typeof r !== "string" || !r.trim()) continue;
|
|
12
|
-
const abs =
|
|
264
|
+
const abs = path6.resolve(baseAbs, r.trim());
|
|
13
265
|
const id = repositoryIdFromRoot(abs);
|
|
14
266
|
if (seen.has(id)) continue;
|
|
15
267
|
seen.add(id);
|
|
16
268
|
out.push({
|
|
17
269
|
root: abs,
|
|
18
270
|
id,
|
|
19
|
-
label:
|
|
271
|
+
label: path6.basename(abs) || abs
|
|
20
272
|
});
|
|
21
273
|
}
|
|
22
274
|
return out.sort((a, b) => a.root.localeCompare(b.root));
|
|
@@ -26,7 +278,7 @@ function discoverBridgeEdges(members, readPackageJson, options = {}) {
|
|
|
26
278
|
const min = options.minConfidence ?? 0;
|
|
27
279
|
const packages = /* @__PURE__ */ new Map();
|
|
28
280
|
for (const m of members) {
|
|
29
|
-
const root =
|
|
281
|
+
const root = path6.resolve(m.root);
|
|
30
282
|
const pkg = readPackageJson(root);
|
|
31
283
|
const name = typeof pkg?.name === "string" ? pkg.name.trim() : "";
|
|
32
284
|
if (!name) continue;
|
|
@@ -36,7 +288,7 @@ function discoverBridgeEdges(members, readPackageJson, options = {}) {
|
|
|
36
288
|
const edges = [];
|
|
37
289
|
const seen = /* @__PURE__ */ new Set();
|
|
38
290
|
for (const m of members) {
|
|
39
|
-
const fromRoot =
|
|
291
|
+
const fromRoot = path6.resolve(m.root);
|
|
40
292
|
const fromId = m.repositoryId ?? repositoryIdFromRoot(fromRoot);
|
|
41
293
|
const pkg = readPackageJson(fromRoot);
|
|
42
294
|
if (!pkg) continue;
|
|
@@ -58,7 +310,7 @@ function discoverBridgeEdges(members, readPackageJson, options = {}) {
|
|
|
58
310
|
toRoot: target.root,
|
|
59
311
|
kind,
|
|
60
312
|
confidence,
|
|
61
|
-
evidence: `${
|
|
313
|
+
evidence: `${path6.basename(fromRoot)} depends on ${depName} (${range})`,
|
|
62
314
|
packageName: depName
|
|
63
315
|
});
|
|
64
316
|
}
|
|
@@ -89,8 +341,8 @@ function classifyDependency(range, fromRoot, toRoot) {
|
|
|
89
341
|
if (r.startsWith("file:")) {
|
|
90
342
|
const rel = r.slice("file:".length).trim();
|
|
91
343
|
try {
|
|
92
|
-
const resolved =
|
|
93
|
-
if (
|
|
344
|
+
const resolved = path6.resolve(fromRoot, rel);
|
|
345
|
+
if (path6.resolve(resolved) === path6.resolve(toRoot)) {
|
|
94
346
|
return { kind: "path-dependency", confidence: 0.9 };
|
|
95
347
|
}
|
|
96
348
|
} catch {
|
|
@@ -108,11 +360,11 @@ function parsePackageManifest(raw) {
|
|
|
108
360
|
return null;
|
|
109
361
|
}
|
|
110
362
|
}
|
|
111
|
-
function discoverInterfaceBridges(members,
|
|
363
|
+
function discoverInterfaceBridges(members, fs3, options = {}) {
|
|
112
364
|
const min = options.minConfidence ?? 0;
|
|
113
365
|
const maxFiles = options.maxFilesPerMember ?? 40;
|
|
114
366
|
const resolved = members.map((m) => ({
|
|
115
|
-
root:
|
|
367
|
+
root: path6.resolve(m.root),
|
|
116
368
|
repositoryId: m.repositoryId ?? repositoryIdFromRoot(m.root)
|
|
117
369
|
}));
|
|
118
370
|
const edges = [];
|
|
@@ -126,10 +378,10 @@ function discoverInterfaceBridges(members, fs2, options = {}) {
|
|
|
126
378
|
edges.push(edge);
|
|
127
379
|
};
|
|
128
380
|
for (const from of resolved) {
|
|
129
|
-
const files = listCandidateFiles(from.root,
|
|
381
|
+
const files = listCandidateFiles(from.root, fs3, maxFiles);
|
|
130
382
|
for (const file of files) {
|
|
131
|
-
const rel =
|
|
132
|
-
const raw =
|
|
383
|
+
const rel = path6.relative(from.root, file).replace(/\\/g, "/");
|
|
384
|
+
const raw = fs3.readFile(file);
|
|
133
385
|
if (!raw) continue;
|
|
134
386
|
if (isOpenApiCandidate(rel, raw)) {
|
|
135
387
|
for (const refPath of extractOpenApiRefs(raw)) {
|
|
@@ -165,7 +417,7 @@ function discoverInterfaceBridges(members, fs2, options = {}) {
|
|
|
165
417
|
}
|
|
166
418
|
if (isProtoCandidate(rel)) {
|
|
167
419
|
for (const imp of extractProtoImports(raw)) {
|
|
168
|
-
const target = resolveProtoImportToMember(from.root, imp, resolved,
|
|
420
|
+
const target = resolveProtoImportToMember(from.root, imp, resolved, fs3);
|
|
169
421
|
if (!target || target.root === from.root) continue;
|
|
170
422
|
push({
|
|
171
423
|
schemaVersion: BRIDGE_EDGE_SCHEMA_VERSION,
|
|
@@ -201,13 +453,13 @@ function discoverInterfaceBridges(members, fs2, options = {}) {
|
|
|
201
453
|
(a, b) => a.fromRoot.localeCompare(b.fromRoot) || a.toRoot.localeCompare(b.toRoot) || a.kind.localeCompare(b.kind) || a.evidence.localeCompare(b.evidence)
|
|
202
454
|
);
|
|
203
455
|
}
|
|
204
|
-
function listCandidateFiles(root,
|
|
456
|
+
function listCandidateFiles(root, fs3, maxFiles) {
|
|
205
457
|
const out = [];
|
|
206
458
|
const walk = (dir, depth) => {
|
|
207
459
|
if (out.length >= maxFiles || depth > 4) return;
|
|
208
460
|
let names;
|
|
209
461
|
try {
|
|
210
|
-
names =
|
|
462
|
+
names = fs3.readdir(dir);
|
|
211
463
|
} catch {
|
|
212
464
|
return;
|
|
213
465
|
}
|
|
@@ -216,8 +468,8 @@ function listCandidateFiles(root, fs2, maxFiles) {
|
|
|
216
468
|
if (name === "node_modules" || name === ".git" || name === "dist" || name === "build" || name === "coverage" || name === ".next") {
|
|
217
469
|
continue;
|
|
218
470
|
}
|
|
219
|
-
const abs =
|
|
220
|
-
if (
|
|
471
|
+
const abs = path6.join(dir, name);
|
|
472
|
+
if (fs3.isDirectory(abs)) {
|
|
221
473
|
walk(abs, depth + 1);
|
|
222
474
|
continue;
|
|
223
475
|
}
|
|
@@ -251,7 +503,7 @@ function extractOpenApiRefs(raw) {
|
|
|
251
503
|
return [...out].sort((a, b) => a.localeCompare(b));
|
|
252
504
|
}
|
|
253
505
|
function isComposeCandidate(rel) {
|
|
254
|
-
const base =
|
|
506
|
+
const base = path6.basename(rel).toLowerCase();
|
|
255
507
|
return base === "docker-compose.yml" || base === "docker-compose.yaml" || base === "compose.yml" || base === "compose.yaml" || base.includes("docker-compose");
|
|
256
508
|
}
|
|
257
509
|
function extractComposeBuildContexts(raw) {
|
|
@@ -310,72 +562,72 @@ function extractProtoImports(raw) {
|
|
|
310
562
|
function resolvePathToMember(fromRoot, relOrAbs, members) {
|
|
311
563
|
let abs;
|
|
312
564
|
try {
|
|
313
|
-
abs =
|
|
565
|
+
abs = path6.isAbsolute(relOrAbs) ? path6.resolve(relOrAbs) : path6.resolve(fromRoot, relOrAbs);
|
|
314
566
|
} catch {
|
|
315
567
|
return null;
|
|
316
568
|
}
|
|
317
569
|
let best = null;
|
|
318
570
|
for (const m of members) {
|
|
319
|
-
if (abs === m.root || abs.startsWith(m.root +
|
|
571
|
+
if (abs === m.root || abs.startsWith(m.root + path6.sep)) {
|
|
320
572
|
if (!best || m.root.length > best.root.length) best = m;
|
|
321
573
|
}
|
|
322
574
|
}
|
|
323
575
|
return best;
|
|
324
576
|
}
|
|
325
|
-
function resolveProtoImportToMember(fromRoot, importPath, members,
|
|
577
|
+
function resolveProtoImportToMember(fromRoot, importPath, members, fs3) {
|
|
326
578
|
const candidates = [
|
|
327
|
-
|
|
328
|
-
...members.map((m) =>
|
|
579
|
+
path6.resolve(fromRoot, importPath),
|
|
580
|
+
...members.map((m) => path6.resolve(m.root, importPath))
|
|
329
581
|
];
|
|
330
582
|
for (const abs of candidates) {
|
|
331
583
|
const hit = resolvePathToMember(fromRoot, abs, members);
|
|
332
584
|
if (!hit) continue;
|
|
333
|
-
if (
|
|
334
|
-
if (hit.root !==
|
|
585
|
+
if (fs3.readFile(abs) !== null || pathIsUnder(abs, hit.root)) {
|
|
586
|
+
if (hit.root !== path6.resolve(fromRoot)) return hit;
|
|
335
587
|
}
|
|
336
588
|
}
|
|
337
589
|
const parts = importPath.replace(/\\/g, "/").split("/");
|
|
338
590
|
if (parts.length >= 2) {
|
|
339
591
|
const prefix = parts[0];
|
|
340
592
|
for (const m of members) {
|
|
341
|
-
if (
|
|
593
|
+
if (path6.basename(m.root) === prefix && m.root !== path6.resolve(fromRoot)) return m;
|
|
342
594
|
}
|
|
343
595
|
}
|
|
344
596
|
return null;
|
|
345
597
|
}
|
|
346
598
|
function pathIsUnder(child, parent) {
|
|
347
|
-
const rel =
|
|
348
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
599
|
+
const rel = path6.relative(path6.resolve(parent), path6.resolve(child));
|
|
600
|
+
return rel === "" || !rel.startsWith("..") && !path6.isAbsolute(rel);
|
|
349
601
|
}
|
|
350
602
|
var DISCOVER_WORKSPACES_VERSION = "discover-workspaces/0";
|
|
351
|
-
function discoverWorkspaceRoots(primaryRoot,
|
|
352
|
-
const primary =
|
|
603
|
+
function discoverWorkspaceRoots(primaryRoot, fs3, options = {}) {
|
|
604
|
+
const primary = path6.resolve(primaryRoot);
|
|
353
605
|
const maxDepth = options.maxDepth ?? 4;
|
|
354
606
|
const maxRoots = options.maxRoots ?? 64;
|
|
355
607
|
const byRoot = /* @__PURE__ */ new Map();
|
|
356
608
|
const add = (abs, source, label) => {
|
|
357
|
-
const root =
|
|
609
|
+
const root = path6.resolve(abs);
|
|
358
610
|
if (byRoot.has(root)) {
|
|
359
611
|
return;
|
|
360
612
|
}
|
|
361
613
|
if (byRoot.size >= maxRoots) return;
|
|
362
614
|
byRoot.set(root, {
|
|
363
615
|
root,
|
|
364
|
-
label: label ?? (
|
|
616
|
+
label: label ?? (path6.basename(root) || root),
|
|
365
617
|
source
|
|
366
618
|
});
|
|
367
619
|
};
|
|
368
|
-
add(primary, "explicit",
|
|
369
|
-
for (const dir of expandPackageWorkspaces(primary,
|
|
620
|
+
add(primary, "explicit", path6.basename(primary) || primary);
|
|
621
|
+
for (const dir of expandPackageWorkspaces(primary, fs3, maxDepth)) {
|
|
370
622
|
add(dir, "package-workspaces");
|
|
371
623
|
}
|
|
372
|
-
for (const dir of expandPnpmWorkspace(primary,
|
|
624
|
+
for (const dir of expandPnpmWorkspace(primary, fs3, maxDepth)) {
|
|
373
625
|
add(dir, "pnpm-workspace");
|
|
374
626
|
}
|
|
375
|
-
for (const dir of expandGitSubmodules(primary,
|
|
627
|
+
for (const dir of expandGitSubmodules(primary, fs3)) {
|
|
376
628
|
add(dir, "git-submodule");
|
|
377
629
|
}
|
|
378
|
-
for (const dir of expandCodeWorkspace(primary,
|
|
630
|
+
for (const dir of expandCodeWorkspace(primary, fs3)) {
|
|
379
631
|
add(dir, "code-workspace");
|
|
380
632
|
}
|
|
381
633
|
const roots = [...byRoot.values()].sort((a, b) => a.root.localeCompare(b.root));
|
|
@@ -385,9 +637,9 @@ function discoverWorkspaceRoots(primaryRoot, fs2, options = {}) {
|
|
|
385
637
|
roots
|
|
386
638
|
};
|
|
387
639
|
}
|
|
388
|
-
function expandPackageWorkspaces(primary,
|
|
389
|
-
const pkgPath =
|
|
390
|
-
const raw =
|
|
640
|
+
function expandPackageWorkspaces(primary, fs3, maxDepth) {
|
|
641
|
+
const pkgPath = path6.join(primary, "package.json");
|
|
642
|
+
const raw = fs3.readFile(pkgPath);
|
|
391
643
|
if (!raw) return [];
|
|
392
644
|
let pkg;
|
|
393
645
|
try {
|
|
@@ -396,7 +648,7 @@ function expandPackageWorkspaces(primary, fs2, maxDepth) {
|
|
|
396
648
|
return [];
|
|
397
649
|
}
|
|
398
650
|
const patterns = workspacePatterns(pkg.workspaces);
|
|
399
|
-
return expandGlobPatterns(primary, patterns,
|
|
651
|
+
return expandGlobPatterns(primary, patterns, fs3, maxDepth);
|
|
400
652
|
}
|
|
401
653
|
function workspacePatterns(workspaces) {
|
|
402
654
|
if (Array.isArray(workspaces)) {
|
|
@@ -409,8 +661,8 @@ function workspacePatterns(workspaces) {
|
|
|
409
661
|
}
|
|
410
662
|
return [];
|
|
411
663
|
}
|
|
412
|
-
function expandPnpmWorkspace(primary,
|
|
413
|
-
const raw =
|
|
664
|
+
function expandPnpmWorkspace(primary, fs3, maxDepth) {
|
|
665
|
+
const raw = fs3.readFile(path6.join(primary, "pnpm-workspace.yaml"));
|
|
414
666
|
if (!raw) return [];
|
|
415
667
|
const patterns = [];
|
|
416
668
|
let inPackages = false;
|
|
@@ -425,27 +677,27 @@ function expandPnpmWorkspace(primary, fs2, maxDepth) {
|
|
|
425
677
|
if (m?.[1]) patterns.push(m[1].trim());
|
|
426
678
|
}
|
|
427
679
|
}
|
|
428
|
-
return expandGlobPatterns(primary, patterns,
|
|
680
|
+
return expandGlobPatterns(primary, patterns, fs3, maxDepth);
|
|
429
681
|
}
|
|
430
|
-
function expandGitSubmodules(primary,
|
|
431
|
-
const raw =
|
|
682
|
+
function expandGitSubmodules(primary, fs3) {
|
|
683
|
+
const raw = fs3.readFile(path6.join(primary, ".gitmodules"));
|
|
432
684
|
if (!raw) return [];
|
|
433
685
|
const out = [];
|
|
434
686
|
for (const line of raw.split(/\r?\n/)) {
|
|
435
687
|
const m = line.match(/^\s*path\s*=\s*(.+)\s*$/);
|
|
436
688
|
if (!m?.[1]) continue;
|
|
437
|
-
const abs =
|
|
438
|
-
if (
|
|
689
|
+
const abs = path6.resolve(primary, m[1].trim());
|
|
690
|
+
if (fs3.exists(abs) && fs3.isDirectory(abs)) out.push(abs);
|
|
439
691
|
}
|
|
440
692
|
return out.sort((a, b) => a.localeCompare(b));
|
|
441
693
|
}
|
|
442
|
-
function expandCodeWorkspace(primary,
|
|
694
|
+
function expandCodeWorkspace(primary, fs3) {
|
|
443
695
|
const out = [];
|
|
444
696
|
const candidates = [
|
|
445
|
-
...
|
|
697
|
+
...fs3.readdir(primary).filter((n) => n.endsWith(".code-workspace")).map((n) => path6.join(primary, n))
|
|
446
698
|
];
|
|
447
699
|
for (const file of candidates) {
|
|
448
|
-
const raw =
|
|
700
|
+
const raw = fs3.readFile(file);
|
|
449
701
|
if (!raw) continue;
|
|
450
702
|
let doc;
|
|
451
703
|
try {
|
|
@@ -453,32 +705,32 @@ function expandCodeWorkspace(primary, fs2) {
|
|
|
453
705
|
} catch {
|
|
454
706
|
continue;
|
|
455
707
|
}
|
|
456
|
-
const base =
|
|
708
|
+
const base = path6.dirname(file);
|
|
457
709
|
for (const folder of doc.folders ?? []) {
|
|
458
710
|
if (typeof folder.path !== "string" || !folder.path.trim()) continue;
|
|
459
|
-
const abs =
|
|
460
|
-
if (
|
|
711
|
+
const abs = path6.resolve(base, folder.path.trim());
|
|
712
|
+
if (fs3.exists(abs) && fs3.isDirectory(abs)) out.push(abs);
|
|
461
713
|
}
|
|
462
714
|
}
|
|
463
715
|
return out.sort((a, b) => a.localeCompare(b));
|
|
464
716
|
}
|
|
465
|
-
function expandGlobPatterns(primary, patterns,
|
|
717
|
+
function expandGlobPatterns(primary, patterns, fs3, maxDepth) {
|
|
466
718
|
const out = /* @__PURE__ */ new Set();
|
|
467
719
|
for (const pattern of patterns) {
|
|
468
720
|
const p = pattern.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
469
721
|
if (!p || p.startsWith("..")) continue;
|
|
470
722
|
if (p.includes("*")) {
|
|
471
|
-
for (const hit of expandSimpleGlob(primary, p,
|
|
472
|
-
if (looksLikePackageRoot(hit,
|
|
723
|
+
for (const hit of expandSimpleGlob(primary, p, fs3, maxDepth)) {
|
|
724
|
+
if (looksLikePackageRoot(hit, fs3)) out.add(hit);
|
|
473
725
|
}
|
|
474
726
|
} else {
|
|
475
|
-
const abs =
|
|
476
|
-
if (
|
|
727
|
+
const abs = path6.resolve(primary, p);
|
|
728
|
+
if (fs3.exists(abs) && fs3.isDirectory(abs) && looksLikePackageRoot(abs, fs3)) out.add(abs);
|
|
477
729
|
}
|
|
478
730
|
}
|
|
479
731
|
return [...out].sort((a, b) => a.localeCompare(b));
|
|
480
732
|
}
|
|
481
|
-
function expandSimpleGlob(primary, pattern,
|
|
733
|
+
function expandSimpleGlob(primary, pattern, fs3, maxDepth) {
|
|
482
734
|
const parts = pattern.split("/").filter(Boolean);
|
|
483
735
|
let currents = [primary];
|
|
484
736
|
for (let i = 0; i < parts.length; i++) {
|
|
@@ -487,67 +739,68 @@ function expandSimpleGlob(primary, pattern, fs2, maxDepth) {
|
|
|
487
739
|
const isLast = i === parts.length - 1;
|
|
488
740
|
for (const cur of currents) {
|
|
489
741
|
if (part === "**") {
|
|
490
|
-
for (const d of walkDirs(cur,
|
|
742
|
+
for (const d of walkDirs(cur, fs3, Math.min(maxDepth, 3))) next.push(d);
|
|
491
743
|
continue;
|
|
492
744
|
}
|
|
493
745
|
if (part === "*") {
|
|
494
|
-
for (const name of
|
|
495
|
-
|
|
496
|
-
|
|
746
|
+
for (const name of fs3.readdir(cur)) {
|
|
747
|
+
if (name.startsWith(".")) continue;
|
|
748
|
+
const abs2 = path6.join(cur, name);
|
|
749
|
+
if (fs3.isDirectory(abs2)) next.push(abs2);
|
|
497
750
|
}
|
|
498
751
|
continue;
|
|
499
752
|
}
|
|
500
|
-
const abs =
|
|
501
|
-
if (
|
|
753
|
+
const abs = path6.join(cur, part);
|
|
754
|
+
if (fs3.exists(abs) && (isLast ? fs3.isDirectory(abs) || fs3.exists(abs) : fs3.isDirectory(abs))) {
|
|
502
755
|
next.push(abs);
|
|
503
756
|
}
|
|
504
757
|
}
|
|
505
758
|
currents = next;
|
|
506
759
|
if (!currents.length) break;
|
|
507
760
|
}
|
|
508
|
-
return currents.filter((d) =>
|
|
761
|
+
return currents.filter((d) => fs3.isDirectory(d));
|
|
509
762
|
}
|
|
510
|
-
function walkDirs(root,
|
|
763
|
+
function walkDirs(root, fs3, depth) {
|
|
511
764
|
if (depth <= 0) return [];
|
|
512
765
|
const out = [];
|
|
513
|
-
for (const name of
|
|
514
|
-
if (name
|
|
515
|
-
const abs =
|
|
516
|
-
if (!
|
|
766
|
+
for (const name of fs3.readdir(root)) {
|
|
767
|
+
if (name.startsWith(".") || name === "node_modules" || name === "dist" || name === "build") continue;
|
|
768
|
+
const abs = path6.join(root, name);
|
|
769
|
+
if (!fs3.isDirectory(abs)) continue;
|
|
517
770
|
out.push(abs);
|
|
518
|
-
out.push(...walkDirs(abs,
|
|
771
|
+
out.push(...walkDirs(abs, fs3, depth - 1));
|
|
519
772
|
}
|
|
520
773
|
return out;
|
|
521
774
|
}
|
|
522
|
-
function looksLikePackageRoot(dir,
|
|
523
|
-
return
|
|
775
|
+
function looksLikePackageRoot(dir, fs3) {
|
|
776
|
+
return fs3.exists(path6.join(dir, "package.json"));
|
|
524
777
|
}
|
|
525
778
|
function nodeDiscoverFs() {
|
|
526
779
|
return {
|
|
527
780
|
readFile(absPath) {
|
|
528
781
|
try {
|
|
529
|
-
return
|
|
782
|
+
return fs2.readFileSync(absPath, "utf8");
|
|
530
783
|
} catch {
|
|
531
784
|
return null;
|
|
532
785
|
}
|
|
533
786
|
},
|
|
534
787
|
readdir(absPath) {
|
|
535
788
|
try {
|
|
536
|
-
return
|
|
789
|
+
return fs2.readdirSync(absPath).sort((a, b) => a.localeCompare(b));
|
|
537
790
|
} catch {
|
|
538
791
|
return [];
|
|
539
792
|
}
|
|
540
793
|
},
|
|
541
794
|
isDirectory(absPath) {
|
|
542
795
|
try {
|
|
543
|
-
return
|
|
796
|
+
return fs2.statSync(absPath).isDirectory();
|
|
544
797
|
} catch {
|
|
545
798
|
return false;
|
|
546
799
|
}
|
|
547
800
|
},
|
|
548
801
|
exists(absPath) {
|
|
549
802
|
try {
|
|
550
|
-
return
|
|
803
|
+
return fs2.existsSync(absPath);
|
|
551
804
|
} catch {
|
|
552
805
|
return false;
|
|
553
806
|
}
|
|
@@ -558,22 +811,22 @@ function nodeDiscoverFs() {
|
|
|
558
811
|
// src/runtime/federation.ts
|
|
559
812
|
var FEDERATION_SCHEMA_VERSION = "federation/0";
|
|
560
813
|
function loadFederation(primaryRoot, options = {}) {
|
|
561
|
-
const primary =
|
|
814
|
+
const primary = path6.resolve(primaryRoot);
|
|
562
815
|
const file = federationPath(primary);
|
|
563
|
-
if (!
|
|
816
|
+
if (!fs2.existsSync(file)) {
|
|
564
817
|
if (options.requireFile) return null;
|
|
565
818
|
return singleMemberFederation(primary);
|
|
566
819
|
}
|
|
567
820
|
let raw;
|
|
568
821
|
try {
|
|
569
|
-
raw = JSON.parse(
|
|
822
|
+
raw = JSON.parse(fs2.readFileSync(file, "utf8"));
|
|
570
823
|
} catch {
|
|
571
824
|
return null;
|
|
572
825
|
}
|
|
573
826
|
return parseFederationFile(primary, raw);
|
|
574
827
|
}
|
|
575
828
|
function loadOrDiscoverFederation(primaryRoot, options = {}) {
|
|
576
|
-
const primary =
|
|
829
|
+
const primary = path6.resolve(primaryRoot);
|
|
577
830
|
const existing = loadFederation(primary, { requireFile: true });
|
|
578
831
|
if (existing) {
|
|
579
832
|
if (!existing.bridges?.length) {
|
|
@@ -594,7 +847,7 @@ function bridgesForMembers(members, minConfidence = 0.5) {
|
|
|
594
847
|
memberRefs,
|
|
595
848
|
(root) => {
|
|
596
849
|
try {
|
|
597
|
-
const raw =
|
|
850
|
+
const raw = fs2.readFileSync(path6.join(root, "package.json"), "utf8");
|
|
598
851
|
return parsePackageManifest(raw);
|
|
599
852
|
} catch {
|
|
600
853
|
return null;
|
|
@@ -607,21 +860,21 @@ function bridgesForMembers(members, minConfidence = 0.5) {
|
|
|
607
860
|
{
|
|
608
861
|
readFile(absPath) {
|
|
609
862
|
try {
|
|
610
|
-
return
|
|
863
|
+
return fs2.readFileSync(absPath, "utf8");
|
|
611
864
|
} catch {
|
|
612
865
|
return null;
|
|
613
866
|
}
|
|
614
867
|
},
|
|
615
868
|
readdir(absPath) {
|
|
616
869
|
try {
|
|
617
|
-
return
|
|
870
|
+
return fs2.readdirSync(absPath).sort((a, b) => a.localeCompare(b));
|
|
618
871
|
} catch {
|
|
619
872
|
return [];
|
|
620
873
|
}
|
|
621
874
|
},
|
|
622
875
|
isDirectory(absPath) {
|
|
623
876
|
try {
|
|
624
|
-
return
|
|
877
|
+
return fs2.statSync(absPath).isDirectory();
|
|
625
878
|
} catch {
|
|
626
879
|
return false;
|
|
627
880
|
}
|
|
@@ -642,21 +895,21 @@ function bridgesForMembers(members, minConfidence = 0.5) {
|
|
|
642
895
|
return out;
|
|
643
896
|
}
|
|
644
897
|
function federationPath(primaryRoot) {
|
|
645
|
-
return
|
|
898
|
+
return path6.join(path6.resolve(primaryRoot), ".vibgrate", "federation.json");
|
|
646
899
|
}
|
|
647
900
|
function singleMemberFederation(primaryRoot) {
|
|
648
|
-
const primary =
|
|
901
|
+
const primary = path6.resolve(primaryRoot);
|
|
649
902
|
const [ws] = normalizeWorkspaceRoots([primary], primary);
|
|
650
903
|
return {
|
|
651
904
|
schemaVersion: FEDERATION_SCHEMA_VERSION,
|
|
652
905
|
primaryRoot: primary,
|
|
653
906
|
members: [
|
|
654
|
-
memberFromRoot(ws?.root ?? primary, "primary", ws?.label ?? (
|
|
907
|
+
memberFromRoot(ws?.root ?? primary, "primary", ws?.label ?? (path6.basename(primary) || primary))
|
|
655
908
|
]
|
|
656
909
|
};
|
|
657
910
|
}
|
|
658
911
|
function parseFederationFile(primaryRoot, raw) {
|
|
659
|
-
const primary =
|
|
912
|
+
const primary = path6.resolve(primaryRoot);
|
|
660
913
|
if (!raw || typeof raw !== "object") return null;
|
|
661
914
|
const list = Array.isArray(raw.members) ? raw.members : [];
|
|
662
915
|
if (!list.length) return singleMemberFederation(primary);
|
|
@@ -665,19 +918,20 @@ function parseFederationFile(primaryRoot, raw) {
|
|
|
665
918
|
let hasPrimary = false;
|
|
666
919
|
for (const entry of list) {
|
|
667
920
|
if (!entry || typeof entry.root !== "string" || !entry.root.trim()) continue;
|
|
668
|
-
const abs =
|
|
921
|
+
const abs = path6.resolve(primary, entry.root.trim());
|
|
922
|
+
if (isNestedAgentWorktree(abs, primary)) continue;
|
|
669
923
|
const id = repositoryIdFromRoot(abs);
|
|
670
924
|
if (seen.has(id)) continue;
|
|
671
925
|
seen.add(id);
|
|
672
926
|
const role = entry.role === "primary" || abs === primary ? "primary" : "member";
|
|
673
927
|
if (role === "primary") hasPrimary = true;
|
|
674
|
-
members.push(memberFromRoot(abs, role, typeof entry.label === "string" && entry.label.trim() ? entry.label.trim() :
|
|
928
|
+
members.push(memberFromRoot(abs, role, typeof entry.label === "string" && entry.label.trim() ? entry.label.trim() : path6.basename(abs) || abs));
|
|
675
929
|
}
|
|
676
930
|
if (!members.length) return singleMemberFederation(primary);
|
|
677
931
|
if (!hasPrimary) {
|
|
678
932
|
const id = repositoryIdFromRoot(primary);
|
|
679
933
|
if (!seen.has(id)) {
|
|
680
|
-
members.unshift(memberFromRoot(primary, "primary",
|
|
934
|
+
members.unshift(memberFromRoot(primary, "primary", path6.basename(primary) || primary));
|
|
681
935
|
} else {
|
|
682
936
|
const existing = members.find((m) => m.repositoryId === id);
|
|
683
937
|
if (existing) existing.role = "primary";
|
|
@@ -695,12 +949,17 @@ function parseFederationFile(primaryRoot, raw) {
|
|
|
695
949
|
if (Array.isArray(raw.bridges) && raw.bridges.length) {
|
|
696
950
|
fed.bridges = raw.bridges.filter((b) => b && typeof b === "object" && typeof b.fromRoot === "string" && typeof b.toRoot === "string").map((b) => ({
|
|
697
951
|
...b,
|
|
698
|
-
fromRoot:
|
|
699
|
-
toRoot:
|
|
952
|
+
fromRoot: path6.resolve(primary, b.fromRoot),
|
|
953
|
+
toRoot: path6.resolve(primary, b.toRoot)
|
|
700
954
|
}));
|
|
701
955
|
}
|
|
702
956
|
return fed;
|
|
703
957
|
}
|
|
958
|
+
function isNestedAgentWorktree(abs, primaryRoot) {
|
|
959
|
+
const rel = path6.relative(path6.resolve(primaryRoot), path6.resolve(abs));
|
|
960
|
+
if (!rel || rel === ".") return false;
|
|
961
|
+
return rel.split(/[/\\]/).filter(Boolean).some((p) => isSkippedDirName(p));
|
|
962
|
+
}
|
|
704
963
|
function memberFromRoot(root, role, label) {
|
|
705
964
|
const git = detectGitRef(root);
|
|
706
965
|
const graphPath = git.kind !== "none" && git.ref ? globalGraphPathForRef(root, git.ref) : globalGraphPath(root);
|
|
@@ -715,13 +974,13 @@ function memberFromRoot(root, role, label) {
|
|
|
715
974
|
function federationFromWorkspaceRoots(roots, options = {}) {
|
|
716
975
|
const normalized = normalizeWorkspaceRoots(roots, options.preferredPrimary ?? roots[0] ?? process.cwd());
|
|
717
976
|
if (!normalized.length) {
|
|
718
|
-
const fallback =
|
|
977
|
+
const fallback = path6.resolve(options.preferredPrimary ?? process.cwd());
|
|
719
978
|
return singleMemberFederation(fallback);
|
|
720
979
|
}
|
|
721
|
-
const preferred = options.preferredPrimary?.trim() ?
|
|
980
|
+
const preferred = options.preferredPrimary?.trim() ? path6.resolve(options.preferredPrimary.trim()) : normalized[0].root;
|
|
722
981
|
const primaryHit = normalized.find((r) => r.root === preferred) ?? normalized.find((r) => r.id === repositoryIdFromRoot(preferred)) ?? normalized[0];
|
|
723
982
|
const primaryRoot = primaryHit.root;
|
|
724
|
-
const members = normalized.map(
|
|
983
|
+
const members = normalized.filter((ws) => !isNestedAgentWorktree(ws.root, primaryRoot)).map(
|
|
725
984
|
(ws) => memberFromRoot(ws.root, ws.root === primaryRoot ? "primary" : "member", ws.label)
|
|
726
985
|
);
|
|
727
986
|
members.sort((a, b) => {
|
|
@@ -735,14 +994,14 @@ function federationFromWorkspaceRoots(roots, options = {}) {
|
|
|
735
994
|
};
|
|
736
995
|
}
|
|
737
996
|
function writeFederationFile(primaryRoot, federation) {
|
|
738
|
-
const primary =
|
|
997
|
+
const primary = path6.resolve(primaryRoot);
|
|
739
998
|
const file = federationPath(primary);
|
|
740
|
-
|
|
999
|
+
fs2.mkdirSync(path6.dirname(file), { recursive: true });
|
|
741
1000
|
const body = {
|
|
742
1001
|
schemaVersion: FEDERATION_SCHEMA_VERSION,
|
|
743
1002
|
members: federation.members.map((m) => ({
|
|
744
1003
|
// Prefer path relative to primary when possible so the file is portable.
|
|
745
|
-
root:
|
|
1004
|
+
root: path6.relative(primary, m.root) || ".",
|
|
746
1005
|
label: m.label,
|
|
747
1006
|
role: m.role
|
|
748
1007
|
}))
|
|
@@ -750,15 +1009,15 @@ function writeFederationFile(primaryRoot, federation) {
|
|
|
750
1009
|
if (federation.bridges?.length) {
|
|
751
1010
|
body.bridges = federation.bridges.map((b) => ({
|
|
752
1011
|
...b,
|
|
753
|
-
fromRoot:
|
|
754
|
-
toRoot:
|
|
1012
|
+
fromRoot: path6.relative(primary, b.fromRoot) || ".",
|
|
1013
|
+
toRoot: path6.relative(primary, b.toRoot) || "."
|
|
755
1014
|
}));
|
|
756
1015
|
}
|
|
757
|
-
|
|
1016
|
+
fs2.writeFileSync(file, `${JSON.stringify(body, null, 2)}
|
|
758
1017
|
`, "utf8");
|
|
759
1018
|
return file;
|
|
760
1019
|
}
|
|
761
1020
|
|
|
762
|
-
export { FEDERATION_SCHEMA_VERSION, federationFromWorkspaceRoots, federationPath, highConfidenceBridges, loadFederation, loadOrDiscoverFederation, parseFederationFile, singleMemberFederation, writeFederationFile };
|
|
763
|
-
//# sourceMappingURL=chunk-
|
|
764
|
-
//# sourceMappingURL=chunk-
|
|
1021
|
+
export { FEDERATION_SCHEMA_VERSION, SKIP_DIRS, SKIP_FILES, UsageError, discover, federationFromWorkspaceRoots, federationPath, highConfidenceBridges, isNestedAgentWorktree, isSkippedDirName, loadFederation, loadOrDiscoverFederation, mergeExcludes, parseFederationFile, singleMemberFederation, writeFederationFile };
|
|
1022
|
+
//# sourceMappingURL=chunk-RTURQXQL.js.map
|
|
1023
|
+
//# sourceMappingURL=chunk-RTURQXQL.js.map
|