veoflow 0.1.2 → 0.1.3

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/veo.mjs CHANGED
@@ -154,6 +154,10 @@ function classify(path) {
154
154
  return "typescript";
155
155
  case "tsx":
156
156
  return "tsx";
157
+ case "vue":
158
+ return "vue";
159
+ case "svelte":
160
+ return "svelte";
157
161
  case "py":
158
162
  return "python";
159
163
  case "go":
@@ -164,6 +168,12 @@ function classify(path) {
164
168
  return null;
165
169
  }
166
170
  }
171
+ function unsupportedLanguage(path) {
172
+ const name = path.slice(path.lastIndexOf("/") + 1).toLowerCase();
173
+ if (name.endsWith(".component.html")) return "Angular template";
174
+ const dot = name.lastIndexOf(".");
175
+ return dot > 0 ? UNSUPPORTED[name.slice(dot + 1)] ?? null : null;
176
+ }
167
177
  function languageSkip(path, language) {
168
178
  if (/\.d\.[mc]?ts$/i.test(path)) return "declaration-file";
169
179
  return ANALYZED_LANGUAGES.has(language) ? null : "language-not-analyzed";
@@ -180,11 +190,52 @@ function decodeUtf8(bytes) {
180
190
  return null;
181
191
  }
182
192
  }
183
- var ANALYZED_LANGUAGES, utf8;
193
+ var ANALYZED_LANGUAGES, UNSUPPORTED, utf8;
184
194
  var init_classify = __esm({
185
195
  "packages/planner/src/classify.ts"() {
186
196
  "use strict";
187
- ANALYZED_LANGUAGES = /* @__PURE__ */ new Set(["javascript", "jsx", "typescript", "tsx"]);
197
+ ANALYZED_LANGUAGES = /* @__PURE__ */ new Set([
198
+ "javascript",
199
+ "jsx",
200
+ "typescript",
201
+ "tsx",
202
+ "vue",
203
+ "svelte",
204
+ "angular-template"
205
+ ]);
206
+ UNSUPPORTED = {
207
+ java: "Java",
208
+ kt: "Kotlin",
209
+ kts: "Kotlin",
210
+ scala: "Scala",
211
+ groovy: "Groovy",
212
+ cs: "C#",
213
+ vb: "Visual Basic",
214
+ php: "PHP",
215
+ rb: "Ruby",
216
+ swift: "Swift",
217
+ m: "Objective-C or MATLAB",
218
+ mm: "Objective-C++",
219
+ c: "C",
220
+ h: "C/C++ header",
221
+ cc: "C++",
222
+ cpp: "C++",
223
+ cxx: "C++",
224
+ hpp: "C/C++ header",
225
+ hh: "C/C++ header",
226
+ hxx: "C/C++ header",
227
+ dart: "Dart",
228
+ ex: "Elixir",
229
+ exs: "Elixir",
230
+ erl: "Erlang",
231
+ clj: "Clojure",
232
+ cljs: "ClojureScript",
233
+ cljc: "Clojure",
234
+ hs: "Haskell",
235
+ lua: "Lua",
236
+ pl: "Perl",
237
+ astro: "Astro"
238
+ };
188
239
  utf8 = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
189
240
  }
190
241
  });
@@ -476,8 +527,55 @@ function planSource(source, options = {}) {
476
527
  }
477
528
  if (!plan.files.some((f) => ANALYZED_LANGUAGES.has(f.language)))
478
529
  plan.notices.push("No JavaScript or TypeScript files were found.");
530
+ const unsupported = unsupportedNotice(plan.unsupported);
531
+ if (unsupported) plan.notices.push(unsupported);
479
532
  return plan;
480
533
  }
534
+ function manifestDir(rel) {
535
+ return rel.includes("/") ? rel.slice(0, rel.lastIndexOf("/")) : "";
536
+ }
537
+ function dependsOnAngular(text) {
538
+ try {
539
+ const json2 = JSON.parse(text.replace(/^\uFEFF/, ""));
540
+ return ["dependencies", "devDependencies", "peerDependencies"].some(
541
+ (k) => json2[k]?.["@angular/core"] !== void 0
542
+ );
543
+ } catch {
544
+ return false;
545
+ }
546
+ }
547
+ function angularTemplates(htmls, manifests) {
548
+ const angular = new Map([...manifests].map(([dir, text]) => [dir, dependsOnAngular(text)]));
549
+ const root = angular.get("") ?? false;
550
+ const out = /* @__PURE__ */ new Set();
551
+ for (const rel of htmls) {
552
+ let dir = manifestDir(rel);
553
+ let nearest = false;
554
+ for (; ; ) {
555
+ if (angular.has(dir)) {
556
+ nearest = angular.get(dir);
557
+ break;
558
+ }
559
+ if (dir === "") break;
560
+ dir = manifestDir(dir);
561
+ }
562
+ if (nearest || root) out.add(rel);
563
+ }
564
+ return out;
565
+ }
566
+ function unsupportedNotice(unsupported) {
567
+ if (!unsupported.length) return null;
568
+ const files = (n) => `${n.toLocaleString("en-US")} ${n === 1 ? "file" : "files"}`;
569
+ const parts = unsupported.slice(0, 3).map((u) => `${u.files.toLocaleString("en-US")} ${u.language} ${u.files === 1 ? "file" : "files"}`);
570
+ const rest = unsupported.slice(3);
571
+ if (rest.length)
572
+ parts.push(
573
+ `${files(rest.reduce((n, u) => n + u.files, 0))} in ${rest.length} other ${rest.length === 1 ? "language" : "languages"}`
574
+ );
575
+ const list = parts.length === 1 ? parts[0] : `${parts.slice(0, -1).join(", ")} and ${parts[parts.length - 1]}`;
576
+ const total = unsupported.reduce((n, u) => n + u.files, 0);
577
+ return `${list} ${total === 1 ? "is" : "are"} not analyzed: veoflow does not read ${unsupported.length === 1 ? "this language" : "these languages"} yet.`;
578
+ }
481
579
  function planGit(source, top, prefix, head, branch, filter, maxFileBytes) {
482
580
  const changes = workTreeChanges(top, prefix);
483
581
  const plan = {
@@ -490,9 +588,13 @@ function planGit(source, top, prefix, head, branch, filter, maxFileBytes) {
490
588
  files: [],
491
589
  unpinned: [],
492
590
  skipped: [],
591
+ unsupported: [],
493
592
  notices: []
494
593
  };
495
594
  const candidates = [];
595
+ const unsupported = new UnsupportedCounter();
596
+ const htmls = [];
597
+ const manifests = [];
496
598
  let entries = 0;
497
599
  const collect = (repoDir, commit, treePrefix, relBase, sub) => {
498
600
  for (const entry of lsTree(repoDir, commit, treePrefix)) {
@@ -509,17 +611,52 @@ function planGit(source, top, prefix, head, branch, filter, maxFileBytes) {
509
611
  collect(dir, entry.sha, "", rel, entry.sha);
510
612
  continue;
511
613
  }
614
+ if (entry.type === "blob" && entry.mode !== "120000" && (rel === "package.json" || rel.endsWith("/package.json")))
615
+ manifests.push({ rel, sha: entry.sha, repoDir });
512
616
  if (entry.type !== "blob" || !filter.matches(rel)) continue;
513
617
  const language = classify(rel);
514
618
  if (entry.mode === "120000") {
515
- if (language) plan.skipped.push({ path: rel, reason: "symlink" });
619
+ if (language || rel.toLowerCase().endsWith(".html"))
620
+ plan.skipped.push({ path: rel, reason: "symlink" });
516
621
  continue;
517
622
  }
518
623
  if (language)
519
624
  candidates.push({ rel, sha: entry.sha, language, repoDir, ...sub ? { commit: sub } : {} });
625
+ else if (rel.toLowerCase().endsWith(".html"))
626
+ htmls.push({
627
+ rel,
628
+ sha: entry.sha,
629
+ language: "angular-template",
630
+ repoDir,
631
+ ...sub ? { commit: sub } : {}
632
+ });
633
+ else unsupported.add(rel);
520
634
  }
521
635
  };
522
636
  collect(top, head, prefix, "");
637
+ if (htmls.length > 0) {
638
+ const texts = /* @__PURE__ */ new Map();
639
+ const byRepoDir = /* @__PURE__ */ new Map();
640
+ for (const m of manifests) byRepoDir.set(m.repoDir, [...byRepoDir.get(m.repoDir) ?? [], m]);
641
+ for (const [repoDir, list] of byRepoDir) {
642
+ const shas = list.map((m) => m.sha);
643
+ const sizes = new Map([...blobSizes(repoDir, shas)].filter(([, n]) => n <= maxFileBytes));
644
+ const blobs = readBlobs(repoDir, shas, sizes);
645
+ for (const m of list) {
646
+ const blob = blobs.get(m.sha);
647
+ if (blob) texts.set(manifestDir(m.rel), blob.toString("utf8"));
648
+ }
649
+ }
650
+ const angular = angularTemplates(
651
+ htmls.map((h) => h.rel),
652
+ texts
653
+ );
654
+ for (const h of htmls) {
655
+ if (angular.has(h.rel)) candidates.push(h);
656
+ else unsupported.add(h.rel);
657
+ }
658
+ }
659
+ plan.unsupported = unsupported.list();
523
660
  if (entries === 0 && prefix)
524
661
  plan.notices.push(
525
662
  `${prefix} is not in the last commit (it may be untracked or ignored), so there was nothing to analyze.`
@@ -600,12 +737,16 @@ function planPlain(source, filter, maxFileBytes) {
600
737
  files: [],
601
738
  unpinned: [],
602
739
  skipped: [],
740
+ unsupported: [],
603
741
  notices: []
604
742
  };
605
743
  const rootReal = realpathSync(source.root);
606
744
  const within = (real) => real === rootReal || real.startsWith(rootReal + sep);
607
745
  const toRel = (abs) => relative(source.root, abs).split(sep).join("/");
608
746
  const inputs = [];
747
+ const unsupported = new UnsupportedCounter();
748
+ const htmls = [];
749
+ const manifests = /* @__PURE__ */ new Map();
609
750
  const walk = (dir, dirReal) => {
610
751
  let names;
611
752
  try {
@@ -642,9 +783,20 @@ function planPlain(source, filter, maxFileBytes) {
642
783
  walk(abs, join2(dirReal, name));
643
784
  continue;
644
785
  }
786
+ if (st.isFile() && name === "package.json" && st.size <= maxFileBytes) {
787
+ try {
788
+ manifests.set(manifestDir(rel), readFileSync(abs, "utf8"));
789
+ } catch {
790
+ }
791
+ }
645
792
  if (!st.isFile() || !filter.matches(rel)) continue;
646
793
  const language = classify(rel);
794
+ if (!language && rel.toLowerCase().endsWith(".html")) {
795
+ htmls.push({ abs, rel, size: st.size });
796
+ continue;
797
+ }
647
798
  if (!language) {
799
+ unsupported.add(rel);
648
800
  if (RESOLVER_INPUT.test(rel) && st.size <= maxFileBytes) {
649
801
  try {
650
802
  inputs.push({ path: rel, hash: sha256(readFileSync(abs)) });
@@ -674,6 +826,43 @@ function planPlain(source, filter, maxFileBytes) {
674
826
  }
675
827
  };
676
828
  walk(source.root, rootReal);
829
+ const angular = angularTemplates(
830
+ htmls.map((h) => h.rel),
831
+ manifests
832
+ );
833
+ for (const h of htmls) {
834
+ if (!angular.has(h.rel)) {
835
+ unsupported.add(h.rel);
836
+ continue;
837
+ }
838
+ if (h.size > maxFileBytes) {
839
+ let hash2 = "";
840
+ try {
841
+ hash2 = sha256File(h.abs);
842
+ } catch {
843
+ }
844
+ plan.files.push({
845
+ path: h.rel,
846
+ language: "angular-template",
847
+ size: h.size,
848
+ contentHash: hash2,
849
+ skip: "too-large"
850
+ });
851
+ continue;
852
+ }
853
+ try {
854
+ plan.files.push(fileFromBytes(h.rel, "angular-template", readFileSync(h.abs), maxFileBytes));
855
+ } catch {
856
+ plan.files.push({
857
+ path: h.rel,
858
+ language: "angular-template",
859
+ size: h.size,
860
+ contentHash: "",
861
+ skip: "unreadable"
862
+ });
863
+ }
864
+ }
865
+ plan.unsupported = unsupported.list();
677
866
  plan.files.sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
678
867
  const lines = [
679
868
  ...plan.files.map((f) => `${f.path}\0${f.contentHash}
@@ -684,7 +873,7 @@ function planPlain(source, filter, maxFileBytes) {
684
873
  plan.revision = `sha256:${sha256(lines.join(""))}`;
685
874
  return plan;
686
875
  }
687
- var DEFAULT_MAX_FILE_BYTES, RESOLVER_INPUT;
876
+ var DEFAULT_MAX_FILE_BYTES, RESOLVER_INPUT, UnsupportedCounter;
688
877
  var init_plan = __esm({
689
878
  "packages/planner/src/plan.ts"() {
690
879
  "use strict";
@@ -694,6 +883,16 @@ var init_plan = __esm({
694
883
  init_glob();
695
884
  DEFAULT_MAX_FILE_BYTES = 10 * 1024 * 1024;
696
885
  RESOLVER_INPUT = /\.(json|jsonc|lock|ya?ml|toml|mod|sum)$|(^|\/)(\.npmrc|\.nvmrc|\.babelrc)$/i;
886
+ UnsupportedCounter = class {
887
+ counts = /* @__PURE__ */ new Map();
888
+ add(path) {
889
+ const language = unsupportedLanguage(path);
890
+ if (language) this.counts.set(language, (this.counts.get(language) ?? 0) + 1);
891
+ }
892
+ list() {
893
+ return [...this.counts].map(([language, files]) => ({ language, files })).sort((a, b) => b.files - a.files || (a.language < b.language ? -1 : 1));
894
+ }
895
+ };
697
896
  }
698
897
  });
699
898
 
@@ -757,7 +956,10 @@ function indexColumns(fact) {
757
956
  case "Function":
758
957
  return { file: fact.file, src: null, dst: null };
759
958
  case "CALLS":
959
+ case "CALLS_CROSS_FILE":
760
960
  return { file: fact.evidence.file, src: fact.from, dst: fact.to };
961
+ case "DeclaredTemplate":
962
+ return { file: fact.file, src: null, dst: null };
761
963
  case "UnresolvedCallSite":
762
964
  return { file: fact.file, src: fact.enclosingFn, dst: null };
763
965
  case "Finding":
@@ -775,7 +977,7 @@ function sourceOf(fileId) {
775
977
  }
776
978
  function factSource(fact) {
777
979
  if (fact.type === "File") return fact.source;
778
- if (fact.type === "CALLS") return sourceOf(fact.evidence.file);
980
+ if (fact.type === "CALLS" || fact.type === "CALLS_CROSS_FILE") return sourceOf(fact.evidence.file);
779
981
  return sourceOf(fact.evidence ? fact.evidence.file : fact.file);
780
982
  }
781
983
  function processAlive(pid) {
@@ -891,10 +1093,10 @@ CREATE TABLE IF NOT EXISTS lock (
891
1093
  return this.rows("file = :file", { file: file2 });
892
1094
  }
893
1095
  callsFrom(fnId) {
894
- return this.rows("type = 'CALLS' AND src = :id", { id: fnId });
1096
+ return this.rows("type IN ('CALLS', 'CALLS_CROSS_FILE') AND src = :id", { id: fnId });
895
1097
  }
896
1098
  callsTo(fnId) {
897
- return this.rows("type = 'CALLS' AND dst = :id", { id: fnId });
1099
+ return this.rows("type IN ('CALLS', 'CALLS_CROSS_FILE') AND dst = :id", { id: fnId });
898
1100
  }
899
1101
  /** How many facts of a type each file holds (functions or calls per file, for the file list). */
900
1102
  countByFile(type) {
@@ -911,7 +1113,7 @@ CREATE TABLE IF NOT EXISTS lock (
911
1113
  const other = end === "src" ? "dst" : "src";
912
1114
  const out = /* @__PURE__ */ new Map();
913
1115
  const query = (where, params) => this.db.prepare(
914
- `SELECT ${end} AS k, COUNT(*) AS calls, COUNT(DISTINCT ${other}) AS functions FROM facts WHERE ${VISIBLE} AND type = 'CALLS'${where} GROUP BY ${end}`
1116
+ `SELECT ${end} AS k, COUNT(*) AS calls, COUNT(DISTINCT ${other}) AS functions FROM facts WHERE ${VISIBLE} AND type IN ('CALLS', 'CALLS_CROSS_FILE')${where} GROUP BY ${end}`
915
1117
  ).all({ ...params, run: this.run });
916
1118
  if (!ids2) {
917
1119
  for (const r of query("", {})) out.set(r.k, { calls: r.calls, functions: r.functions });
@@ -1618,6 +1820,7 @@ function sourcesOf(plans) {
1618
1820
  kind: p.kind,
1619
1821
  ...p.kind === "git" ? { dirty: p.dirty } : {},
1620
1822
  ...p.unpinned.length ? { unpinned: p.unpinned } : {},
1823
+ ...p.unsupported.length ? { unsupported: p.unsupported } : {},
1621
1824
  ...p.notices.length ? { notices: p.notices } : {}
1622
1825
  }));
1623
1826
  }
@@ -1770,7 +1973,7 @@ var PROTOCOL_VERSION;
1770
1973
  var init_protocol = __esm({
1771
1974
  "protocol/index.ts"() {
1772
1975
  "use strict";
1773
- PROTOCOL_VERSION = "1.0.0";
1976
+ PROTOCOL_VERSION = "1.1.0";
1774
1977
  }
1775
1978
  });
1776
1979
 
@@ -1880,6 +2083,20 @@ function factsForFile(sourceId, file2, result2) {
1880
2083
  };
1881
2084
  facts.push(site);
1882
2085
  }
2086
+ for (const t of result2.templates) {
2087
+ facts.push({
2088
+ type: "DeclaredTemplate",
2089
+ id: `template|${fileId}|${t.component}`,
2090
+ file: fileId,
2091
+ component: t.component,
2092
+ specifier: t.specifier,
2093
+ methods: t.methods,
2094
+ signals: t.signals,
2095
+ fields: t.fields,
2096
+ inherits: t.inherits,
2097
+ evidence: evidence(t.span)
2098
+ });
2099
+ }
1883
2100
  for (const [d, ordinal] of withOrdinals(
1884
2101
  result2.diagnostics.filter((d2) => d2.severity !== "info"),
1885
2102
  (d2) => d2.code
@@ -1960,18 +2177,199 @@ var init_readback = __esm({
1960
2177
  }
1961
2178
  });
1962
2179
 
2180
+ // packages/stages/src/template-link.ts
2181
+ import { execFileSync as execFileSync2 } from "node:child_process";
2182
+ import { existsSync as existsSync5 } from "node:fs";
2183
+ import { join as join6, posix, relative as relative2, sep as sep3 } from "node:path";
2184
+ function runTemplateLink(ctx) {
2185
+ const view = ctx.view;
2186
+ const files = view.facts("File");
2187
+ const fileById = new Map(files.map((f) => [f.id, f]));
2188
+ const scopes = /* @__PURE__ */ new Set();
2189
+ const facts = [];
2190
+ const push = (scope, fact) => {
2191
+ scopes.add(scope);
2192
+ facts.push({ scope, fact });
2193
+ };
2194
+ for (const e of view.facts("CALLS_CROSS_FILE"))
2195
+ if (e.via === "template-link") scopes.add(scopeOf(`${e.evidence.file}|${e.component}`));
2196
+ for (const u of view.facts("UnresolvedCallSite"))
2197
+ if (u.component) scopes.add(scopeOf(`${u.file}|${u.component}`));
2198
+ for (const f of view.facts("Finding"))
2199
+ if (f.id.startsWith(`${TEMPLATE_LINK}|`)) scopes.add(scopeOf(f.component ?? f.file));
2200
+ const roots = ctx.plans.map((p) => ({
2201
+ source: p.sourceId,
2202
+ root: p.root,
2203
+ kind: p.kind,
2204
+ revision: p.revision
2205
+ }));
2206
+ const exists = (r, rel) => {
2207
+ if (r.kind !== "git") return existsSync5(join6(r.root, ...rel.split("/")));
2208
+ try {
2209
+ execFileSync2("git", ["-C", r.root, "cat-file", "-e", `${r.revision}:./${rel}`], { stdio: "ignore" });
2210
+ return true;
2211
+ } catch {
2212
+ return false;
2213
+ }
2214
+ };
2215
+ const resolveTarget = (d) => {
2216
+ if (d.specifier === null) return { kind: "computed" };
2217
+ const owner = fileById.get(d.file);
2218
+ if (!owner) return { kind: "not-found" };
2219
+ const ownerRoot = roots.find((r) => r.source === owner.source);
2220
+ const rel = d.specifier.startsWith("/") ? posix.normalize(d.specifier.slice(1)) : posix.normalize(posix.join(posix.dirname(owner.path), d.specifier));
2221
+ if (!rel.startsWith("../") && rel !== "..") {
2222
+ const file2 = fileById.get(ids.file(owner.source, rel));
2223
+ if (file2)
2224
+ return file2.language === "angular-template" ? { kind: "file", file: file2 } : { kind: "not-analyzed" };
2225
+ return { kind: ownerRoot && exists(ownerRoot, rel) ? "not-analyzed" : "not-found" };
2226
+ }
2227
+ if (ownerRoot) {
2228
+ const abs = join6(ownerRoot.root, ...owner.path.split("/").slice(0, -1), ...d.specifier.split("/"));
2229
+ for (const r of roots) {
2230
+ const inside = relative2(r.root, abs);
2231
+ if (inside && !inside.startsWith("..") && !inside.startsWith(sep3) && !/^[a-zA-Z]:/.test(inside)) {
2232
+ const inRel = inside.split(sep3).join("/");
2233
+ const file2 = fileById.get(ids.file(r.source, inRel));
2234
+ if (file2)
2235
+ return file2.language === "angular-template" ? { kind: "file", file: file2 } : { kind: "not-analyzed" };
2236
+ return { kind: exists(r, inRel) ? "not-analyzed" : "not-found" };
2237
+ }
2238
+ }
2239
+ }
2240
+ return { kind: "pending" };
2241
+ };
2242
+ const owners = /* @__PURE__ */ new Map();
2243
+ for (const d of view.facts("DeclaredTemplate")) {
2244
+ const key = componentKey(d);
2245
+ scopes.add(scopeOf(key));
2246
+ const target2 = resolveTarget(d);
2247
+ if (target2.kind === "file") {
2248
+ const list = owners.get(target2.file.id) ?? [];
2249
+ list.push(d);
2250
+ owners.set(target2.file.id, list);
2251
+ continue;
2252
+ }
2253
+ const kind = `template-${target2.kind === "computed" ? "url-computed" : target2.kind}`;
2254
+ const message2 = {
2255
+ computed: `${d.component}'s templateUrl is computed, so its template can't be linked`,
2256
+ "not-found": `${d.component} declares ${d.specifier}, which does not exist in the source`,
2257
+ pending: `${d.component} declares ${d.specifier}, which is outside every source of this project; it links when that source is added`,
2258
+ "not-analyzed": `${d.component} declares ${d.specifier}, which exists but was not analyzed as an Angular template`
2259
+ }[target2.kind];
2260
+ const finding = {
2261
+ type: "Finding",
2262
+ id: `${TEMPLATE_LINK}|${kind}|${key}`,
2263
+ kind,
2264
+ file: d.file,
2265
+ message: message2,
2266
+ evidence: d.evidence,
2267
+ severity: target2.kind === "pending" ? "info" : "warning",
2268
+ component: key
2269
+ };
2270
+ push(scopeOf(key), finding);
2271
+ }
2272
+ for (const template of files.filter((f) => f.language === "angular-template")) {
2273
+ const declaring = owners.get(template.id) ?? [];
2274
+ if (declaring.length === 0) {
2275
+ const finding = {
2276
+ type: "Finding",
2277
+ id: `${TEMPLATE_LINK}|template-owner-unknown|${template.id}`,
2278
+ kind: "template-owner-unknown",
2279
+ file: template.id,
2280
+ message: "No component declares this template, so its calls are not part of a component",
2281
+ evidence: null,
2282
+ severity: "info"
2283
+ };
2284
+ push(scopeOf(template.id), finding);
2285
+ continue;
2286
+ }
2287
+ const bindings = view.inFile(template.id).flatMap(
2288
+ (f) => f.type === "UnresolvedCallSite" && f.reason === "template-binding" && !f.component ? [f] : []
2289
+ ).sort((a, b) => a.evidence.span.start.offset - b.evidence.span.start.offset);
2290
+ const from = ids.fn(template.source, template.path, "<template>");
2291
+ const evidence = (u) => ({ ...u.evidence, commit: template.commit ?? "" });
2292
+ for (const d of declaring) {
2293
+ const key = componentKey(d);
2294
+ const scope = scopeOf(`${template.id}|${key}`);
2295
+ scopes.add(scope);
2296
+ const owner = fileById.get(d.file);
2297
+ const ordinals = /* @__PURE__ */ new Map();
2298
+ for (const u of bindings) {
2299
+ const [root, ...path] = u.expression.replace(/[\s()!]/g, "").replace(/\?\./g, ".").replace(/^this\./, "").split(".");
2300
+ const method = path.length === 0 ? d.methods.find((m) => m.name === root) : void 0;
2301
+ if (method) {
2302
+ const to = ids.fn(owner.source, owner.path, method.qualifiedName);
2303
+ const n = ordinals.get(to) ?? 0;
2304
+ ordinals.set(to, n + 1);
2305
+ const edge = {
2306
+ type: "CALLS_CROSS_FILE",
2307
+ id: `${ids.edge("CALLS_CROSS_FILE", from, to, n)}|${key}`,
2308
+ from,
2309
+ to,
2310
+ form: "plain",
2311
+ resolution: "static-exact",
2312
+ confidence: 1,
2313
+ evidence: evidence(u),
2314
+ via: "template-link",
2315
+ component: key
2316
+ };
2317
+ push(scope, edge);
2318
+ continue;
2319
+ }
2320
+ const known = [...d.methods.map((m) => m.name), ...d.signals, ...d.fields].includes(root);
2321
+ const [reason, status] = path.length === 0 && d.signals.includes(root) ? ["runtime-global", "external"] : known ? ["dynamic-dispatch", "open"] : d.inherits ? ["template-reference", "awaiting-link"] : ["dynamic-dispatch", "open"];
2322
+ const record2 = {
2323
+ ...u,
2324
+ id: `${u.id}|${key}`,
2325
+ reason,
2326
+ status,
2327
+ importSpecifier: null,
2328
+ importedName: null,
2329
+ component: key,
2330
+ evidence: evidence(u)
2331
+ };
2332
+ push(scope, record2);
2333
+ }
2334
+ }
2335
+ }
2336
+ return { scopes: [...scopes], facts };
2337
+ }
2338
+ var TEMPLATE_LINK, scopeOf, componentKey, templateLink;
2339
+ var init_template_link = __esm({
2340
+ "packages/stages/src/template-link.ts"() {
2341
+ "use strict";
2342
+ init_src();
2343
+ TEMPLATE_LINK = "template-link";
2344
+ scopeOf = (key) => `${TEMPLATE_LINK}:${key}`;
2345
+ componentKey = (d) => `${d.file}#${d.component}`;
2346
+ templateLink = { name: TEMPLATE_LINK, run: runTemplateLink };
2347
+ }
2348
+ });
2349
+
1963
2350
  // packages/stages/src/index.ts
1964
2351
  var init_src5 = __esm({
1965
2352
  "packages/stages/src/index.ts"() {
1966
2353
  "use strict";
1967
2354
  init_stage1();
1968
2355
  init_readback();
2356
+ init_template_link();
1969
2357
  }
1970
2358
  });
1971
2359
 
1972
2360
  // packages/query/src/engine.ts
1973
2361
  import { EventEmitter } from "node:events";
1974
2362
  import { basename as basename2, resolve as resolve2 } from "node:path";
2363
+ function visibleSites(facts, reader) {
2364
+ const sites = facts.flatMap((f) => f.type === "UnresolvedCallSite" ? [f] : []);
2365
+ const linked = /* @__PURE__ */ new Set();
2366
+ for (const f of facts) {
2367
+ if (f.type === "UnresolvedCallSite" && f.component) linked.add(f.file);
2368
+ if (f.type === "CALLS_CROSS_FILE") linked.add(f.evidence.file);
2369
+ }
2370
+ if (reader) for (const e of reader.facts("CALLS_CROSS_FILE")) linked.add(e.evidence.file);
2371
+ return sites.filter((s) => !(s.reason === "template-binding" && !s.component && linked.has(s.file)));
2372
+ }
1975
2373
  function checkLimit(limit, fallback, max) {
1976
2374
  if (limit === void 0) return fallback;
1977
2375
  if (!Number.isInteger(limit) || limit < 1)
@@ -2122,7 +2520,7 @@ var init_engine = __esm({
2122
2520
  store,
2123
2521
  evidence,
2124
2522
  sources,
2125
- stages: [stage1],
2523
+ stages: [stage1, templateLink],
2126
2524
  onEvent: (e) => {
2127
2525
  if (e.type === "run.started") onStarted?.(e.runId);
2128
2526
  this.events.emit("event", e);
@@ -2180,6 +2578,8 @@ var init_engine = __esm({
2180
2578
  const reader = this.reader(project2);
2181
2579
  const functions = reader.countByFile("Function");
2182
2580
  const calls = reader.countByFile("CALLS");
2581
+ for (const [file2, n] of reader.countByFile("CALLS_CROSS_FILE"))
2582
+ calls.set(file2, (calls.get(file2) ?? 0) + n);
2183
2583
  const counts = {};
2184
2584
  for (const f of reader.facts("File"))
2185
2585
  counts[f.id] = { functions: functions.get(f.id) ?? 0, calls: calls.get(f.id) ?? 0 };
@@ -2195,14 +2595,25 @@ var init_engine = __esm({
2195
2595
  const facts = reader.inFile(file2.id);
2196
2596
  const fns = facts.flatMap((f) => f.type === "Function" ? [f] : []);
2197
2597
  const byId = new Map(fns.map((f) => [f.id, f]));
2598
+ const pathOf = (fileId) => reader.fact(fileId)?.path ?? "";
2599
+ const across = (e, otherId) => {
2600
+ const other = reader.fact(otherId);
2601
+ return this.callView(e, other, other ? pathOf(other.file) : "", otherId);
2602
+ };
2603
+ const incoming = fns.flatMap(
2604
+ (fn) => reader.callsTo(fn.id).filter((e) => e.type === "CALLS_CROSS_FILE" && e.evidence.file !== file2.id)
2605
+ );
2198
2606
  return {
2199
2607
  ...this.meta(project2, reader),
2200
2608
  file: file2,
2201
2609
  functions: fns.map((f) => this.functionView(f, file2.path)),
2202
- calls: facts.flatMap(
2203
- (f) => f.type === "CALLS" ? [this.callView(f, byId.get(f.to), file2.path, f.to)] : []
2204
- ),
2205
- unresolved: facts.flatMap((f) => f.type === "UnresolvedCallSite" ? [f] : []),
2610
+ calls: [
2611
+ ...facts.flatMap(
2612
+ (f) => f.type === "CALLS" ? [this.callView(f, byId.get(f.to), file2.path, f.to)] : f.type === "CALLS_CROSS_FILE" ? [across(f, f.to)] : []
2613
+ ),
2614
+ ...incoming.map((e) => across(e, e.from))
2615
+ ],
2616
+ unresolved: visibleSites(facts),
2206
2617
  findings: facts.filter((f) => f.type === "Finding")
2207
2618
  };
2208
2619
  }
@@ -2235,7 +2646,8 @@ var init_engine = __esm({
2235
2646
  },
2236
2647
  form: edge.form,
2237
2648
  resolution: edge.resolution,
2238
- evidence: edge.evidence
2649
+ evidence: edge.evidence,
2650
+ ...edge.type === "CALLS_CROSS_FILE" ? { crossFile: true } : {}
2239
2651
  };
2240
2652
  }
2241
2653
  /** One function, by id or by qualified name (optionally within a file path). */
@@ -2430,7 +2842,7 @@ var init_engine = __esm({
2430
2842
  }
2431
2843
  if (args.groupBy === "file") named = (key) => pathOf.get(key);
2432
2844
  } else if (args.label === "UnresolvedCallSite") {
2433
- for (const site of reader.facts("UnresolvedCallSite")) {
2845
+ for (const site of visibleSites(reader.facts("UnresolvedCallSite"), reader)) {
2434
2846
  if (!inPath(site.file)) continue;
2435
2847
  if (open2 && !isOpenQuestion(site)) continue;
2436
2848
  add(String({ reason: site.reason, status: site.status, file: site.file }[args.groupBy]));
@@ -2442,7 +2854,7 @@ var init_engine = __esm({
2442
2854
  named = fnName;
2443
2855
  } else {
2444
2856
  const fileOf = new Map(reader.facts("Function").map((f) => [f.id, f.file]));
2445
- for (const call of reader.facts("CALLS")) {
2857
+ for (const call of [...reader.facts("CALLS"), ...reader.facts("CALLS_CROSS_FILE")]) {
2446
2858
  const owner = fileOf.get(call.from);
2447
2859
  if (prefix && (!owner || !inPath(owner))) continue;
2448
2860
  add(
@@ -2488,7 +2900,7 @@ var init_engine = __esm({
2488
2900
  const ids2 = shown.map((f) => f.id);
2489
2901
  const incoming = reader.callCounts("dst", ids2);
2490
2902
  const outgoing = reader.callCounts("src", ids2);
2491
- const sites = facts.flatMap((f) => f.type === "UnresolvedCallSite" ? [f] : []);
2903
+ const sites = visibleSites(facts);
2492
2904
  const unresolvedIn = /* @__PURE__ */ new Map();
2493
2905
  for (const s of sites) unresolvedIn.set(s.enclosingFn, (unresolvedIn.get(s.enclosingFn) ?? 0) + 1);
2494
2906
  return {
@@ -2504,7 +2916,7 @@ var init_engine = __esm({
2504
2916
  })),
2505
2917
  total: fns.length,
2506
2918
  truncated: fns.length > OUTLINE_MAX,
2507
- calls: facts.filter((f) => f.type === "CALLS").length,
2919
+ calls: facts.filter((f) => f.type === "CALLS" || f.type === "CALLS_CROSS_FILE").length,
2508
2920
  unresolved: sites.length,
2509
2921
  open: sites.filter(isOpenQuestion).length
2510
2922
  };
@@ -2515,7 +2927,7 @@ var init_engine = __esm({
2515
2927
  const reader = this.reader(project2);
2516
2928
  if (args.file && reader.fact(args.file)?.type !== "File")
2517
2929
  throw new VeoError("not-found", `no file ${args.file}`, { kind: "file", id: args.file });
2518
- const all2 = args.file ? reader.inFile(args.file).flatMap((f) => f.type === "UnresolvedCallSite" ? [f] : []) : reader.facts("UnresolvedCallSite");
2930
+ const all2 = args.file ? visibleSites(reader.inFile(args.file)) : visibleSites(reader.facts("UnresolvedCallSite"), reader);
2519
2931
  return { ...this.meta(project2, reader), sites: args.includeAll ? all2 : all2.filter(isOpenQuestion) };
2520
2932
  }
2521
2933
  /** The analyzed text around an evidence span (exactly what was analyzed). */
@@ -16182,11 +16594,11 @@ var init_nl = __esm({
16182
16594
  case "too_small": {
16183
16595
  const adj = issue2.inclusive ? ">=" : ">";
16184
16596
  const sizing = getSizing(issue2.origin);
16185
- const shortName = issue2.origin === "date" ? "vroeg" : issue2.origin === "string" ? "kort" : "klein";
16597
+ const shortName2 = issue2.origin === "date" ? "vroeg" : issue2.origin === "string" ? "kort" : "klein";
16186
16598
  if (sizing) {
16187
- return `Te ${shortName}: verwacht dat ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit} ${sizing.verb}`;
16599
+ return `Te ${shortName2}: verwacht dat ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit} ${sizing.verb}`;
16188
16600
  }
16189
- return `Te ${shortName}: verwacht dat ${issue2.origin} ${adj}${issue2.minimum.toString()} is`;
16601
+ return `Te ${shortName2}: verwacht dat ${issue2.origin} ${adj}${issue2.minimum.toString()} is`;
16190
16602
  }
16191
16603
  case "invalid_format": {
16192
16604
  const _issue = issue2;
@@ -35223,49 +35635,49 @@ var require_fast_uri = __commonJS({
35223
35635
  schemelessOptions.skipEscape = true;
35224
35636
  return serialize(resolved, schemelessOptions);
35225
35637
  }
35226
- function resolveComponent(base, relative2, options, skipNormalization) {
35638
+ function resolveComponent(base, relative3, options, skipNormalization) {
35227
35639
  const target2 = {};
35228
35640
  if (!skipNormalization) {
35229
35641
  base = parse4(serialize(base, options), options);
35230
- relative2 = parse4(serialize(relative2, options), options);
35642
+ relative3 = parse4(serialize(relative3, options), options);
35231
35643
  }
35232
35644
  options = options || {};
35233
- if (!options.tolerant && relative2.scheme) {
35234
- target2.scheme = relative2.scheme;
35235
- target2.userinfo = relative2.userinfo;
35236
- target2.host = relative2.host;
35237
- target2.port = relative2.port;
35238
- target2.path = removeDotSegments(relative2.path || "");
35239
- target2.query = relative2.query;
35645
+ if (!options.tolerant && relative3.scheme) {
35646
+ target2.scheme = relative3.scheme;
35647
+ target2.userinfo = relative3.userinfo;
35648
+ target2.host = relative3.host;
35649
+ target2.port = relative3.port;
35650
+ target2.path = removeDotSegments(relative3.path || "");
35651
+ target2.query = relative3.query;
35240
35652
  } else {
35241
- if (relative2.userinfo !== void 0 || relative2.host !== void 0 || relative2.port !== void 0) {
35242
- target2.userinfo = relative2.userinfo;
35243
- target2.host = relative2.host;
35244
- target2.port = relative2.port;
35245
- target2.path = removeDotSegments(relative2.path || "");
35246
- target2.query = relative2.query;
35653
+ if (relative3.userinfo !== void 0 || relative3.host !== void 0 || relative3.port !== void 0) {
35654
+ target2.userinfo = relative3.userinfo;
35655
+ target2.host = relative3.host;
35656
+ target2.port = relative3.port;
35657
+ target2.path = removeDotSegments(relative3.path || "");
35658
+ target2.query = relative3.query;
35247
35659
  } else {
35248
- if (!relative2.path) {
35660
+ if (!relative3.path) {
35249
35661
  target2.path = base.path;
35250
- if (relative2.query !== void 0) {
35251
- target2.query = relative2.query;
35662
+ if (relative3.query !== void 0) {
35663
+ target2.query = relative3.query;
35252
35664
  } else {
35253
35665
  target2.query = base.query;
35254
35666
  }
35255
35667
  } else {
35256
- if (relative2.path[0] === "/") {
35257
- target2.path = removeDotSegments(relative2.path);
35668
+ if (relative3.path[0] === "/") {
35669
+ target2.path = removeDotSegments(relative3.path);
35258
35670
  } else {
35259
35671
  if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
35260
- target2.path = "/" + relative2.path;
35672
+ target2.path = "/" + relative3.path;
35261
35673
  } else if (!base.path) {
35262
- target2.path = relative2.path;
35674
+ target2.path = relative3.path;
35263
35675
  } else {
35264
- target2.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative2.path;
35676
+ target2.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative3.path;
35265
35677
  }
35266
35678
  target2.path = removeDotSegments(target2.path);
35267
35679
  }
35268
- target2.query = relative2.query;
35680
+ target2.query = relative3.query;
35269
35681
  }
35270
35682
  target2.userinfo = base.userinfo;
35271
35683
  target2.host = base.host;
@@ -35273,7 +35685,7 @@ var require_fast_uri = __commonJS({
35273
35685
  }
35274
35686
  target2.scheme = base.scheme;
35275
35687
  }
35276
- target2.fragment = relative2.fragment;
35688
+ target2.fragment = relative3.fragment;
35277
35689
  return target2;
35278
35690
  }
35279
35691
  function equal(uriA, uriB, options) {
@@ -44455,7 +44867,7 @@ var require_parseTokenList = __commonJS({
44455
44867
  // node_modules/.pnpm/depd@2.0.0/node_modules/depd/index.js
44456
44868
  var require_depd = __commonJS({
44457
44869
  "node_modules/.pnpm/depd@2.0.0/node_modules/depd/index.js"(exports, module) {
44458
- var relative2 = __require("path").relative;
44870
+ var relative3 = __require("path").relative;
44459
44871
  module.exports = depd;
44460
44872
  var basePath = process.cwd();
44461
44873
  function containsNamespace(str3, namespace) {
@@ -44647,7 +45059,7 @@ var require_depd = __commonJS({
44647
45059
  return formatted;
44648
45060
  }
44649
45061
  function formatLocation(callSite) {
44650
- return relative2(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
45062
+ return relative3(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
44651
45063
  }
44652
45064
  function getStack() {
44653
45065
  var limit = Error.stackTraceLimit;
@@ -45180,10 +45592,10 @@ var require_send = __commonJS({
45180
45592
  var { parseTokenList } = require_parseTokenList();
45181
45593
  var { createHttpError } = require_createHttpError();
45182
45594
  var extname = path.extname;
45183
- var join9 = path.join;
45595
+ var join10 = path.join;
45184
45596
  var normalize2 = path.normalize;
45185
45597
  var resolve5 = path.resolve;
45186
- var sep3 = path.sep;
45598
+ var sep4 = path.sep;
45187
45599
  var Readable = stream.Readable;
45188
45600
  var BYTES_RANGE_REGEXP = /^ *bytes=/;
45189
45601
  var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
@@ -45260,20 +45672,20 @@ var require_send = __commonJS({
45260
45672
  let parts;
45261
45673
  if (root !== null) {
45262
45674
  if (path2) {
45263
- path2 = normalize2("." + sep3 + path2);
45675
+ path2 = normalize2("." + sep4 + path2);
45264
45676
  }
45265
45677
  if (UP_PATH_REGEXP.test(path2)) {
45266
45678
  debug('malicious path "%s"', path2);
45267
45679
  return { statusCode: 403 };
45268
45680
  }
45269
- parts = path2.split(sep3);
45270
- path2 = normalize2(join9(root, path2));
45681
+ parts = path2.split(sep4);
45682
+ path2 = normalize2(join10(root, path2));
45271
45683
  } else {
45272
45684
  if (UP_PATH_REGEXP.test(path2)) {
45273
45685
  debug('malicious path "%s"', path2);
45274
45686
  return { statusCode: 403 };
45275
45687
  }
45276
- parts = normalize2(path2).split(sep3);
45688
+ parts = normalize2(path2).split(sep4);
45277
45689
  path2 = resolve5(path2);
45278
45690
  }
45279
45691
  return { path: path2, parts };
@@ -45550,7 +45962,7 @@ var require_send = __commonJS({
45550
45962
  let err;
45551
45963
  for (let i = 0; i < options.index.length; i++) {
45552
45964
  const index = options.index[i];
45553
- const p = join9(path2, index);
45965
+ const p = join10(path2, index);
45554
45966
  const { error: error62, stat } = await tryStat(p);
45555
45967
  if (error62) {
45556
45968
  err = error62;
@@ -45566,7 +45978,7 @@ var require_send = __commonJS({
45566
45978
  }
45567
45979
  async function sendFile(request, path2, options) {
45568
45980
  const { error: error62, stat } = await tryStat(path2);
45569
- if (error62 && error62.code === "ENOENT" && !extname(path2) && path2[path2.length - 1] !== sep3) {
45981
+ if (error62 && error62.code === "ENOENT" && !extname(path2) && path2[path2.length - 1] !== sep4) {
45570
45982
  let err = error62;
45571
45983
  for (let i = 0; i < options.extensions.length; i++) {
45572
45984
  const extension = options.extensions[i];
@@ -51252,7 +51664,7 @@ var require_buffer_list = __commonJS({
51252
51664
  }
51253
51665
  }, {
51254
51666
  key: "join",
51255
- value: function join9(s) {
51667
+ value: function join10(s) {
51256
51668
  if (this.length === 0) return "";
51257
51669
  var p = this.head;
51258
51670
  var ret = "" + p.data;
@@ -61935,7 +62347,7 @@ var require_thread_stream = __commonJS({
61935
62347
  var { version: version3 } = require_package();
61936
62348
  var { EventEmitter: EventEmitter2 } = __require("events");
61937
62349
  var { Worker } = __require("worker_threads");
61938
- var { join: join9 } = __require("path");
62350
+ var { join: join10 } = __require("path");
61939
62351
  var { pathToFileURL } = __require("url");
61940
62352
  var { wait } = require_wait();
61941
62353
  var {
@@ -61986,7 +62398,7 @@ var require_thread_stream = __commonJS({
61986
62398
  function createWorker(stream, opts) {
61987
62399
  const { filename, workerData } = opts;
61988
62400
  const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
61989
- const toExecute = bundlerOverrides["thread-stream-worker"] || join9(__dirname, "lib", "worker.js");
62401
+ const toExecute = bundlerOverrides["thread-stream-worker"] || join10(__dirname, "lib", "worker.js");
61990
62402
  const worker = new Worker(toExecute, {
61991
62403
  ...opts.workerOpts,
61992
62404
  name: opts.workerOpts?.name || "thread-stream",
@@ -62452,9 +62864,9 @@ var require_transport = __commonJS({
62452
62864
  "node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/transport.js"(exports, module) {
62453
62865
  "use strict";
62454
62866
  var { createRequire: createRequire3 } = __require("module");
62455
- var { existsSync: existsSync8 } = __require("node:fs");
62867
+ var { existsSync: existsSync9 } = __require("node:fs");
62456
62868
  var getCallers = require_caller();
62457
- var { join: join9, isAbsolute: isAbsolute2, sep: sep3 } = __require("node:path");
62869
+ var { join: join10, isAbsolute: isAbsolute2, sep: sep4 } = __require("node:path");
62458
62870
  var { fileURLToPath: fileURLToPath3 } = __require("node:url");
62459
62871
  var sleep3 = require_atomic_sleep();
62460
62872
  var onExit = require_on_exit_leak_free();
@@ -62526,7 +62938,7 @@ var require_transport = __commonJS({
62526
62938
  return false;
62527
62939
  }
62528
62940
  }
62529
- return isAbsolute2(path) && !existsSync8(path);
62941
+ return isAbsolute2(path) && !existsSync9(path);
62530
62942
  }
62531
62943
  function stripQuotes(value) {
62532
62944
  const first = value[0];
@@ -62607,7 +63019,7 @@ var require_transport = __commonJS({
62607
63019
  throw new Error("only one of target or targets can be specified");
62608
63020
  }
62609
63021
  if (targets) {
62610
- target2 = bundlerOverrides["pino-worker"] || join9(__dirname, "worker.js");
63022
+ target2 = bundlerOverrides["pino-worker"] || join10(__dirname, "worker.js");
62611
63023
  options.targets = targets.filter((dest) => dest.target).map((dest) => {
62612
63024
  return {
62613
63025
  ...dest,
@@ -62625,7 +63037,7 @@ var require_transport = __commonJS({
62625
63037
  });
62626
63038
  });
62627
63039
  } else if (pipeline) {
62628
- target2 = bundlerOverrides["pino-worker"] || join9(__dirname, "worker.js");
63040
+ target2 = bundlerOverrides["pino-worker"] || join10(__dirname, "worker.js");
62629
63041
  options.pipelines = [pipeline.map((dest) => {
62630
63042
  return {
62631
63043
  ...dest,
@@ -62648,12 +63060,12 @@ var require_transport = __commonJS({
62648
63060
  return origin;
62649
63061
  }
62650
63062
  if (origin === "pino/file") {
62651
- return join9(__dirname, "..", "file.js");
63063
+ return join10(__dirname, "..", "file.js");
62652
63064
  }
62653
63065
  let fixTarget2;
62654
63066
  for (const filePath of callers2) {
62655
63067
  try {
62656
- const context = filePath === "node:repl" ? process.cwd() + sep3 : filePath;
63068
+ const context = filePath === "node:repl" ? process.cwd() + sep4 : filePath;
62657
63069
  fixTarget2 = createRequire3(context).resolve(origin);
62658
63070
  break;
62659
63071
  } catch (err) {
@@ -63628,7 +64040,7 @@ var require_safe_stable_stringify = __commonJS({
63628
64040
  return circularValue;
63629
64041
  }
63630
64042
  let res = "";
63631
- let join9 = ",";
64043
+ let join10 = ",";
63632
64044
  const originalIndentation = indentation;
63633
64045
  if (Array.isArray(value)) {
63634
64046
  if (value.length === 0) {
@@ -63642,7 +64054,7 @@ var require_safe_stable_stringify = __commonJS({
63642
64054
  indentation += spacer;
63643
64055
  res += `
63644
64056
  ${indentation}`;
63645
- join9 = `,
64057
+ join10 = `,
63646
64058
  ${indentation}`;
63647
64059
  }
63648
64060
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -63650,13 +64062,13 @@ ${indentation}`;
63650
64062
  for (; i < maximumValuesToStringify - 1; i++) {
63651
64063
  const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
63652
64064
  res += tmp2 !== void 0 ? tmp2 : "null";
63653
- res += join9;
64065
+ res += join10;
63654
64066
  }
63655
64067
  const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
63656
64068
  res += tmp !== void 0 ? tmp : "null";
63657
64069
  if (value.length - 1 > maximumBreadth) {
63658
64070
  const removedKeys = value.length - maximumBreadth - 1;
63659
- res += `${join9}"... ${getItemCount(removedKeys)} not stringified"`;
64071
+ res += `${join10}"... ${getItemCount(removedKeys)} not stringified"`;
63660
64072
  }
63661
64073
  if (spacer !== "") {
63662
64074
  res += `
@@ -63677,7 +64089,7 @@ ${originalIndentation}`;
63677
64089
  let separator = "";
63678
64090
  if (spacer !== "") {
63679
64091
  indentation += spacer;
63680
- join9 = `,
64092
+ join10 = `,
63681
64093
  ${indentation}`;
63682
64094
  whitespace = " ";
63683
64095
  }
@@ -63691,13 +64103,13 @@ ${indentation}`;
63691
64103
  const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
63692
64104
  if (tmp !== void 0) {
63693
64105
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
63694
- separator = join9;
64106
+ separator = join10;
63695
64107
  }
63696
64108
  }
63697
64109
  if (keyLength > maximumBreadth) {
63698
64110
  const removedKeys = keyLength - maximumBreadth;
63699
64111
  res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
63700
- separator = join9;
64112
+ separator = join10;
63701
64113
  }
63702
64114
  if (spacer !== "" && separator.length > 1) {
63703
64115
  res = `
@@ -63738,7 +64150,7 @@ ${originalIndentation}`;
63738
64150
  }
63739
64151
  const originalIndentation = indentation;
63740
64152
  let res = "";
63741
- let join9 = ",";
64153
+ let join10 = ",";
63742
64154
  if (Array.isArray(value)) {
63743
64155
  if (value.length === 0) {
63744
64156
  return "[]";
@@ -63751,7 +64163,7 @@ ${originalIndentation}`;
63751
64163
  indentation += spacer;
63752
64164
  res += `
63753
64165
  ${indentation}`;
63754
- join9 = `,
64166
+ join10 = `,
63755
64167
  ${indentation}`;
63756
64168
  }
63757
64169
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -63759,13 +64171,13 @@ ${indentation}`;
63759
64171
  for (; i < maximumValuesToStringify - 1; i++) {
63760
64172
  const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
63761
64173
  res += tmp2 !== void 0 ? tmp2 : "null";
63762
- res += join9;
64174
+ res += join10;
63763
64175
  }
63764
64176
  const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
63765
64177
  res += tmp !== void 0 ? tmp : "null";
63766
64178
  if (value.length - 1 > maximumBreadth) {
63767
64179
  const removedKeys = value.length - maximumBreadth - 1;
63768
- res += `${join9}"... ${getItemCount(removedKeys)} not stringified"`;
64180
+ res += `${join10}"... ${getItemCount(removedKeys)} not stringified"`;
63769
64181
  }
63770
64182
  if (spacer !== "") {
63771
64183
  res += `
@@ -63778,7 +64190,7 @@ ${originalIndentation}`;
63778
64190
  let whitespace = "";
63779
64191
  if (spacer !== "") {
63780
64192
  indentation += spacer;
63781
- join9 = `,
64193
+ join10 = `,
63782
64194
  ${indentation}`;
63783
64195
  whitespace = " ";
63784
64196
  }
@@ -63787,7 +64199,7 @@ ${indentation}`;
63787
64199
  const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
63788
64200
  if (tmp !== void 0) {
63789
64201
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
63790
- separator = join9;
64202
+ separator = join10;
63791
64203
  }
63792
64204
  }
63793
64205
  if (spacer !== "" && separator.length > 1) {
@@ -63845,20 +64257,20 @@ ${originalIndentation}`;
63845
64257
  indentation += spacer;
63846
64258
  let res2 = `
63847
64259
  ${indentation}`;
63848
- const join10 = `,
64260
+ const join11 = `,
63849
64261
  ${indentation}`;
63850
64262
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
63851
64263
  let i = 0;
63852
64264
  for (; i < maximumValuesToStringify - 1; i++) {
63853
64265
  const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
63854
64266
  res2 += tmp2 !== void 0 ? tmp2 : "null";
63855
- res2 += join10;
64267
+ res2 += join11;
63856
64268
  }
63857
64269
  const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
63858
64270
  res2 += tmp !== void 0 ? tmp : "null";
63859
64271
  if (value.length - 1 > maximumBreadth) {
63860
64272
  const removedKeys = value.length - maximumBreadth - 1;
63861
- res2 += `${join10}"... ${getItemCount(removedKeys)} not stringified"`;
64273
+ res2 += `${join11}"... ${getItemCount(removedKeys)} not stringified"`;
63862
64274
  }
63863
64275
  res2 += `
63864
64276
  ${originalIndentation}`;
@@ -63874,16 +64286,16 @@ ${originalIndentation}`;
63874
64286
  return '"[Object]"';
63875
64287
  }
63876
64288
  indentation += spacer;
63877
- const join9 = `,
64289
+ const join10 = `,
63878
64290
  ${indentation}`;
63879
64291
  let res = "";
63880
64292
  let separator = "";
63881
64293
  let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
63882
64294
  if (isTypedArrayWithEntries(value)) {
63883
- res += stringifyTypedArray(value, join9, maximumBreadth);
64295
+ res += stringifyTypedArray(value, join10, maximumBreadth);
63884
64296
  keys = keys.slice(value.length);
63885
64297
  maximumPropertiesToStringify -= value.length;
63886
- separator = join9;
64298
+ separator = join10;
63887
64299
  }
63888
64300
  if (deterministic) {
63889
64301
  keys = sort(keys, comparator);
@@ -63894,13 +64306,13 @@ ${indentation}`;
63894
64306
  const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
63895
64307
  if (tmp !== void 0) {
63896
64308
  res += `${separator}${strEscape(key2)}: ${tmp}`;
63897
- separator = join9;
64309
+ separator = join10;
63898
64310
  }
63899
64311
  }
63900
64312
  if (keyLength > maximumBreadth) {
63901
64313
  const removedKeys = keyLength - maximumBreadth;
63902
64314
  res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
63903
- separator = join9;
64315
+ separator = join10;
63904
64316
  }
63905
64317
  if (separator !== "") {
63906
64318
  res = `
@@ -70790,49 +71202,49 @@ var require_fast_uri2 = __commonJS({
70790
71202
  target2.ipv6Zone = source.ipv6Zone;
70791
71203
  }
70792
71204
  }
70793
- function resolveComponent(base, relative2, options, skipNormalization) {
71205
+ function resolveComponent(base, relative3, options, skipNormalization) {
70794
71206
  const target2 = {};
70795
71207
  if (!skipNormalization) {
70796
71208
  base = parse4(serialize(base, options), options);
70797
- relative2 = parse4(serialize(relative2, options), options);
71209
+ relative3 = parse4(serialize(relative3, options), options);
70798
71210
  }
70799
71211
  options = options || {};
70800
- if (!options.tolerant && relative2.scheme) {
70801
- target2.scheme = relative2.scheme;
70802
- target2.userinfo = relative2.userinfo;
70803
- copyHost(target2, relative2);
70804
- target2.port = relative2.port;
70805
- target2.path = removeDotSegments(relative2.path || "");
70806
- target2.query = relative2.query;
71212
+ if (!options.tolerant && relative3.scheme) {
71213
+ target2.scheme = relative3.scheme;
71214
+ target2.userinfo = relative3.userinfo;
71215
+ copyHost(target2, relative3);
71216
+ target2.port = relative3.port;
71217
+ target2.path = removeDotSegments(relative3.path || "");
71218
+ target2.query = relative3.query;
70807
71219
  } else {
70808
- if (relative2.userinfo !== void 0 || relative2.host !== void 0 || relative2.port !== void 0) {
70809
- target2.userinfo = relative2.userinfo;
70810
- copyHost(target2, relative2);
70811
- target2.port = relative2.port;
70812
- target2.path = removeDotSegments(relative2.path || "");
70813
- target2.query = relative2.query;
71220
+ if (relative3.userinfo !== void 0 || relative3.host !== void 0 || relative3.port !== void 0) {
71221
+ target2.userinfo = relative3.userinfo;
71222
+ copyHost(target2, relative3);
71223
+ target2.port = relative3.port;
71224
+ target2.path = removeDotSegments(relative3.path || "");
71225
+ target2.query = relative3.query;
70814
71226
  } else {
70815
- if (!relative2.path) {
71227
+ if (!relative3.path) {
70816
71228
  target2.path = base.path;
70817
- if (relative2.query !== void 0) {
70818
- target2.query = relative2.query;
71229
+ if (relative3.query !== void 0) {
71230
+ target2.query = relative3.query;
70819
71231
  } else {
70820
71232
  target2.query = base.query;
70821
71233
  }
70822
71234
  } else {
70823
- if (relative2.path[0] === "/") {
70824
- target2.path = removeDotSegments(relative2.path);
71235
+ if (relative3.path[0] === "/") {
71236
+ target2.path = removeDotSegments(relative3.path);
70825
71237
  } else {
70826
71238
  if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
70827
- target2.path = "/" + relative2.path;
71239
+ target2.path = "/" + relative3.path;
70828
71240
  } else if (!base.path) {
70829
- target2.path = relative2.path;
71241
+ target2.path = relative3.path;
70830
71242
  } else {
70831
- target2.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative2.path;
71243
+ target2.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative3.path;
70832
71244
  }
70833
71245
  target2.path = removeDotSegments(target2.path);
70834
71246
  }
70835
- target2.query = relative2.query;
71247
+ target2.query = relative3.query;
70836
71248
  }
70837
71249
  target2.userinfo = base.userinfo;
70838
71250
  copyHost(target2, base);
@@ -70840,7 +71252,7 @@ var require_fast_uri2 = __commonJS({
70840
71252
  }
70841
71253
  target2.scheme = base.scheme;
70842
71254
  }
70843
- target2.fragment = relative2.fragment;
71255
+ target2.fragment = relative3.fragment;
70844
71256
  return target2;
70845
71257
  }
70846
71258
  function equal(uriA, uriB, options) {
@@ -83276,11 +83688,11 @@ var init_types3 = __esm({
83276
83688
  });
83277
83689
 
83278
83690
  // packages/agents/src/config.ts
83279
- import { chmodSync, existsSync as existsSync5, mkdirSync as mkdirSync4, readFileSync as readFileSync3, renameSync as renameSync3, rmSync as rmSync2, writeFileSync as writeFileSync2 } from "node:fs";
83280
- import { dirname as dirname4, join as join6 } from "node:path";
83691
+ import { chmodSync, existsSync as existsSync6, mkdirSync as mkdirSync4, readFileSync as readFileSync3, renameSync as renameSync3, rmSync as rmSync2, writeFileSync as writeFileSync2 } from "node:fs";
83692
+ import { dirname as dirname4, join as join7 } from "node:path";
83281
83693
  function read(home) {
83282
83694
  const path = configPath(home);
83283
- if (!existsSync5(path)) return {};
83695
+ if (!existsSync6(path)) return {};
83284
83696
  try {
83285
83697
  return JSON.parse(readFileSync3(path, "utf8"));
83286
83698
  } catch {
@@ -83348,7 +83760,7 @@ var init_config = __esm({
83348
83760
  init_src();
83349
83761
  DEFAULT_BASE_URL = "https://openrouter.ai/api/v1";
83350
83762
  DEFAULT_MODEL = "anthropic/claude-sonnet-5.5";
83351
- configPath = (home) => join6(home, "config.json");
83763
+ configPath = (home) => join7(home, "config.json");
83352
83764
  }
83353
83765
  });
83354
83766
 
@@ -83952,7 +84364,8 @@ function systemPrompt(project2) {
83952
84364
  "You answer questions about a codebase using veoflow's knowledge graph of it.",
83953
84365
  `The project is "${project2}". What the graph holds today: files; functions (with qualified names such as Cart.addItem); calls between functions resolved within each file; and unresolved call sites (dynamic dispatch, imported symbols waiting for cross-file linking, runtime globals).`,
83954
84366
  "Calls across files are not linked yet, so a function can have callers in other files that the graph does not show; say so when it matters.",
83955
- "Look things up with the tools; never guess or rely on memory. Start with search_nodes to find functions or files by name, then use list_calls, file_outline, get_function, list_unresolved_sites or aggregate.",
84367
+ "Always look things up with the tools before answering, even when the question seems general; never guess or rely on memory. Start with search_nodes to find functions or files by name, then use list_calls, file_outline, get_function, list_unresolved_sites or aggregate.",
84368
+ 'Some names are generated for anonymous functions, such as authRoutes.<callback:post>#5. In your answer describe them in words with their location ("the post callback in authRoutes at src/routes/auth.ts:519") rather than repeating the generated name.',
83956
84369
  "Cite locations exactly as path:line from tool results (for example src/cart.ts:42).",
83957
84370
  "Answer briefly: one or two sentences, then a short list if it helps. If the graph cannot answer the question, say what is missing."
83958
84371
  ].join("\n");
@@ -84002,23 +84415,24 @@ function harvest(tool2, result2, items, locations) {
84002
84415
  if (items.size < MAX_ITEMS && !items.has(`${item.kind}:${item.id}`))
84003
84416
  items.set(`${item.kind}:${item.id}`, item);
84004
84417
  };
84005
- const prove = (path, span) => {
84418
+ const prove = (path, span, item) => {
84006
84419
  if (!path || !span) return;
84007
84420
  const list = locations.get(path) ?? [];
84008
- list.push([span.start.line, span.end.line]);
84421
+ list.push({ a: span.start.line, b: span.end.line, ...item ? { item } : {} });
84009
84422
  locations.set(path, list);
84010
84423
  };
84011
84424
  const fileOf = (id) => id.slice(0, id.lastIndexOf(":"));
84012
84425
  const fn = (f) => {
84013
- prove(f.path, f.evidence?.span);
84014
- add({
84426
+ const item = {
84015
84427
  kind: "function",
84016
84428
  id: f.id,
84017
84429
  label: f.qualifiedName ?? f.name ?? f.id,
84018
84430
  file: fileOf(f.id),
84019
84431
  path: f.path,
84020
84432
  ...f.evidence ? { line: f.evidence.span.start.line, detail: `${f.path}:${f.evidence.span.start.line}` } : {}
84021
- });
84433
+ };
84434
+ prove(f.path, f.evidence?.span, item);
84435
+ add(item);
84022
84436
  };
84023
84437
  if (tool2 === "search_nodes")
84024
84438
  for (const h of r.results ?? []) {
@@ -84033,22 +84447,22 @@ function harvest(tool2, result2, items, locations) {
84033
84447
  } else if (tool2 === "list_calls")
84034
84448
  for (const c of r.calls ?? []) {
84035
84449
  const path = c.evidence.file.slice(c.evidence.file.indexOf(":") + 1);
84036
- prove(path, c.evidence.span);
84037
- add({
84450
+ const item = {
84038
84451
  kind: "call",
84039
84452
  id: c.id,
84040
- label: `${r.direction === "in" ? `${c.function.qualifiedName} \u2192` : `\u2192 ${c.function.qualifiedName}`}`,
84041
- detail: `${path}:${c.evidence.span.start.line}`,
84453
+ label: c.function.qualifiedName,
84454
+ detail: `${r.direction === "in" ? "calls it" : "called"} \xB7 ${path}:${c.evidence.span.start.line}`,
84042
84455
  file: c.evidence.file,
84043
84456
  path,
84044
84457
  line: c.evidence.span.start.line
84045
- });
84458
+ };
84459
+ prove(path, c.evidence.span, item);
84460
+ add(item);
84046
84461
  }
84047
84462
  else if (tool2 === "list_unresolved_sites")
84048
84463
  for (const s of r.sites ?? []) {
84049
84464
  const path = s.file.slice(s.file.indexOf(":") + 1);
84050
- prove(path, s.evidence.span);
84051
- add({
84465
+ const item = {
84052
84466
  kind: "site",
84053
84467
  id: s.id,
84054
84468
  label: `? ${s.expression}`,
@@ -84056,7 +84470,9 @@ function harvest(tool2, result2, items, locations) {
84056
84470
  file: s.file,
84057
84471
  path,
84058
84472
  line: s.evidence.span.start.line
84059
- });
84473
+ };
84474
+ prove(path, s.evidence.span, item);
84475
+ add(item);
84060
84476
  }
84061
84477
  }
84062
84478
  function checkCitations(prose, locations) {
@@ -84066,15 +84482,49 @@ function checkCitations(prose, locations) {
84066
84482
  const [text, path, line] = [m[0], m[1], Number(m[2])];
84067
84483
  if (seen.has(text)) continue;
84068
84484
  seen.add(text);
84069
- let verified = false;
84485
+ let best = null;
84070
84486
  for (const [known, spans] of locations)
84071
84487
  if (known === path || known.endsWith(`/${path}`)) {
84072
- if (spans.some(([a, b]) => line >= a && line <= b)) verified = true;
84488
+ for (const s of spans)
84489
+ if (line >= s.a && line <= s.b) {
84490
+ const better = !best || s.item && !best.item || Boolean(s.item) === Boolean(best.item) && s.b - s.a < best.b - best.a;
84491
+ if (better) best = s;
84492
+ }
84073
84493
  }
84074
- out.push({ text, path, line, verified });
84494
+ out.push({ text, path, line, verified: best !== null, ...best?.item ? { target: best.item } : {} });
84075
84495
  }
84076
84496
  return out;
84077
84497
  }
84498
+ function shortName(item) {
84499
+ const label = item.label.replace(/^\? /, "");
84500
+ if (item.kind === "file") return label.slice(label.lastIndexOf("/") + 1);
84501
+ const last = label.split(".").pop() ?? "";
84502
+ return /^[A-Za-z_$][\w$]{3,}$/.test(last) ? last : null;
84503
+ }
84504
+ function splitMentioned(prose, citations, items) {
84505
+ const at = /* @__PURE__ */ new Map();
84506
+ for (const c of citations)
84507
+ if (c.target) {
84508
+ const key = `${c.target.kind}:${c.target.id}`;
84509
+ const i = prose.indexOf(c.text);
84510
+ if (!at.has(key) || i < at.get(key)) at.set(key, i);
84511
+ }
84512
+ const token = (name) => new RegExp(`(?<![\\w$.])${name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(?![\\w$]|\\.[\\w$])`);
84513
+ for (const item of items) {
84514
+ const key = `${item.kind}:${item.id}`;
84515
+ const label = item.label.replace(/^\? /, "");
84516
+ for (const name of [label.includes("<") ? null : label, shortName(item)]) {
84517
+ if (!name) continue;
84518
+ const m = token(name).exec(prose);
84519
+ if (m && (!at.has(key) || m.index < at.get(key))) at.set(key, m.index);
84520
+ }
84521
+ }
84522
+ const byKey = new Map(items.map((i) => [`${i.kind}:${i.id}`, i]));
84523
+ for (const c of citations) if (c.target) byKey.set(`${c.target.kind}:${c.target.id}`, c.target);
84524
+ const mentioned = [...at].sort(([, a], [, b]) => a - b).map(([key]) => byKey.get(key)).filter(Boolean);
84525
+ const keys = new Set(mentioned.map((i) => `${i.kind}:${i.id}`));
84526
+ return { mentioned, lookups: items.filter((i) => !keys.has(`${i.kind}:${i.id}`)) };
84527
+ }
84078
84528
  async function answerWithModel(engine, project2, question, settings, fetchImpl = fetch) {
84079
84529
  const calls = [];
84080
84530
  const items = /* @__PURE__ */ new Map();
@@ -84173,10 +84623,15 @@ async function answerWithModel(engine, project2, question, settings, fetchImpl =
84173
84623
  }
84174
84624
  const citations = checkCitations(prose, locations);
84175
84625
  const unverified = citations.filter((c) => !c.verified).length;
84626
+ const { mentioned, lookups } = splitMentioned(prose, citations, [...items.values()]);
84176
84627
  return {
84177
84628
  ...base,
84178
- summary: `Answered by ${settings.model} using ${calls.length} tool ${calls.length === 1 ? "call" : "calls"}${unverified ? `; ${unverified} cited ${unverified === 1 ? "location was" : "locations were"} not returned by any tool` : ""}.`,
84179
- results: [...items.values()],
84629
+ summary: calls.length === 0 ? `Answered by ${settings.model} without looking anything up in the graph, so this is general knowledge, not your code. Rephrase the question around a function or file name to get an answer from the graph.` : `Answered by ${settings.model} using ${calls.length} tool ${calls.length === 1 ? "call" : "calls"}${unverified ? `; ${unverified} cited ${unverified === 1 ? "location was" : "locations were"} not returned by any tool` : ""}.`,
84630
+ // Flag, never fabricate: an answer no tool backed is marked as such.
84631
+ ...calls.length === 0 ? { ungrounded: true } : {},
84632
+ // What the answer is about first; the rest of the lookups apart.
84633
+ results: mentioned,
84634
+ lookups,
84180
84635
  prose,
84181
84636
  citations,
84182
84637
  ...truncated ? { truncated } : {},
@@ -84351,6 +84806,7 @@ __export(src_exports2, {
84351
84806
  publicSettings: () => publicSettings,
84352
84807
  saveSettings: () => saveSettings,
84353
84808
  say: () => say,
84809
+ splitMentioned: () => splitMentioned,
84354
84810
  suggest: () => suggest,
84355
84811
  systemPrompt: () => systemPrompt,
84356
84812
  testConnection: () => testConnection,
@@ -84370,8 +84826,8 @@ var init_src8 = __esm({
84370
84826
  });
84371
84827
 
84372
84828
  // packages/server/src/server.ts
84373
- import { existsSync as existsSync6, statSync as statSync3 } from "node:fs";
84374
- import { dirname as dirname5, isAbsolute, join as join7, resolve as resolve3 } from "node:path";
84829
+ import { existsSync as existsSync7, statSync as statSync3 } from "node:fs";
84830
+ import { dirname as dirname5, isAbsolute, join as join8, resolve as resolve3 } from "node:path";
84375
84831
  import { fileURLToPath } from "node:url";
84376
84832
  function hostName(host) {
84377
84833
  return host.startsWith("[") ? host.slice(0, host.indexOf("]") + 1) : host.replace(/:\d+$/, "");
@@ -84715,7 +85171,7 @@ async function createServer(engine, options = {}) {
84715
85171
  async (req) => engine.snippet({ ...req.params, ...req.body })
84716
85172
  );
84717
85173
  const webRoot = options.webRoot === void 0 ? defaultWebRoot : options.webRoot;
84718
- const hasUi = webRoot !== null && existsSync6(join7(webRoot, "index.html"));
85174
+ const hasUi = webRoot !== null && existsSync7(join8(webRoot, "index.html"));
84719
85175
  if (hasUi) await app.register(import_static.default, { root: webRoot });
84720
85176
  app.setNotFoundHandler((req, reply) => {
84721
85177
  if (req.url.startsWith("/api/") || !hasUi)
@@ -84818,8 +85274,8 @@ var init_src9 = __esm({
84818
85274
  init_src();
84819
85275
  init_src6();
84820
85276
  import { spawn } from "node:child_process";
84821
- import { existsSync as existsSync7, readFileSync as readFileSync4, statSync as statSync4 } from "node:fs";
84822
- import { basename as basename3, dirname as dirname6, join as join8, resolve as resolve4 } from "node:path";
85277
+ import { existsSync as existsSync8, readFileSync as readFileSync4, statSync as statSync4 } from "node:fs";
85278
+ import { basename as basename3, dirname as dirname6, join as join9, resolve as resolve4 } from "node:path";
84823
85279
  import { fileURLToPath as fileURLToPath2 } from "node:url";
84824
85280
  import { parseArgs } from "node:util";
84825
85281
  var USAGE = `veoflow \u2014 a knowledge graph of your code (also runs as \`veo\`)
@@ -84844,7 +85300,7 @@ var UsageError = class extends Error {
84844
85300
  function version2() {
84845
85301
  if (process.env.VEO_VERSION) return process.env.VEO_VERSION;
84846
85302
  const pkg = JSON.parse(
84847
- readFileSync4(join8(dirname6(fileURLToPath2(import.meta.url)), "../package.json"), "utf8")
85303
+ readFileSync4(join9(dirname6(fileURLToPath2(import.meta.url)), "../package.json"), "utf8")
84848
85304
  );
84849
85305
  return pkg.version;
84850
85306
  }
@@ -84948,7 +85404,7 @@ async function main(argv, io) {
84948
85404
  });
84949
85405
  if (positionals.length !== 1) throw new UsageError("usage: veoflow add <dir> [--project <id>]");
84950
85406
  const root = resolve4(io.cwd, positionals[0]);
84951
- if (!existsSync7(root) || !statSync4(root).isDirectory())
85407
+ if (!existsSync8(root) || !statSync4(root).isDirectory())
84952
85408
  throw new VeoError("source-not-found", `${root} is not a directory`);
84953
85409
  let project2 = values.project ?? engine.catalog.resolveProjectForCwd(io.cwd)?.id;
84954
85410
  if (!project2) {