veoflow 0.1.3 → 0.1.4
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/bin/veoflow.mjs +1 -1
- package/dist/veo.mjs +934 -192
- package/native/veo-extract.darwin-arm64.node +0 -0
- package/native/veo-extract.darwin-x64.node +0 -0
- package/native/veo-extract.linux-arm64-gnu.node +0 -0
- package/native/veo-extract.linux-x64-gnu.node +0 -0
- package/native/veo-extract.win32-x64-msvc.node +0 -0
- package/package.json +1 -1
- package/web/assets/index-BDhfBjwe.js +331 -0
- package/web/assets/{index-wPb6VVKc.css → index-P-aSV80b.css} +1 -1
- package/web/index.html +2 -2
- package/web/assets/index-D3BlGtHO.js +0 -331
package/dist/veo.mjs
CHANGED
|
@@ -242,6 +242,10 @@ var init_classify = __esm({
|
|
|
242
242
|
|
|
243
243
|
// packages/planner/src/glob.ts
|
|
244
244
|
function globToRegExp(pattern) {
|
|
245
|
+
if (pattern.startsWith("/")) {
|
|
246
|
+
const literal2 = literalPath(pattern).replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
247
|
+
return new RegExp(`^${literal2}(?:/.*)?$`);
|
|
248
|
+
}
|
|
245
249
|
let p = pattern.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
246
250
|
if (!p.includes("/")) p = `**/${p}`;
|
|
247
251
|
if (p.endsWith("/")) p = `${p}**`;
|
|
@@ -269,14 +273,39 @@ function globToRegExp(pattern) {
|
|
|
269
273
|
}
|
|
270
274
|
return new RegExp(`^${re}$`);
|
|
271
275
|
}
|
|
272
|
-
|
|
276
|
+
function literalPath(rule) {
|
|
277
|
+
return rule.replace(/^\/+/, "").replace(/\/+$/, "");
|
|
278
|
+
}
|
|
279
|
+
function literalPrefix(pattern) {
|
|
280
|
+
const p = pattern.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
281
|
+
const i = p.search(/[*?{]/);
|
|
282
|
+
return i < 0 ? p : p.slice(0, i);
|
|
283
|
+
}
|
|
284
|
+
function defaultExcludedFile(path) {
|
|
285
|
+
return /\.timestamp-\d+(?:-[0-9a-f]+)?\.[cm]?[jt]s$/i.test(path) ? "generated" : null;
|
|
286
|
+
}
|
|
287
|
+
function defaultExcludedDir(path) {
|
|
288
|
+
const parts = path.split("/");
|
|
289
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
290
|
+
const name = parts[i];
|
|
291
|
+
if (DEFAULT_EXCLUDED_DIRS.has(name))
|
|
292
|
+
return {
|
|
293
|
+
dir: parts.slice(0, i + 1).join("/"),
|
|
294
|
+
origin: VCS_DIRS.has(name) ? "vcs" : LIBRARY_DIRS.has(name) ? "library" : TOOL_DIRS.has(name) ? "tool" : "generated"
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
return null;
|
|
298
|
+
}
|
|
299
|
+
var PathFilter, TOOL_DIRS, DEFAULT_EXCLUDED_DIRS, VCS_DIRS, LIBRARY_DIRS, OptIn;
|
|
273
300
|
var init_glob = __esm({
|
|
274
301
|
"packages/planner/src/glob.ts"() {
|
|
275
302
|
"use strict";
|
|
276
303
|
PathFilter = class {
|
|
277
304
|
include;
|
|
278
305
|
exclude;
|
|
306
|
+
includePatterns;
|
|
279
307
|
constructor(include, exclude) {
|
|
308
|
+
this.includePatterns = include;
|
|
280
309
|
this.include = include.map(globToRegExp);
|
|
281
310
|
this.exclude = exclude.map(globToRegExp);
|
|
282
311
|
}
|
|
@@ -291,11 +320,39 @@ var init_glob = __esm({
|
|
|
291
320
|
for (let i = 1; i < parts.length; i++) if (this.excludesDir(parts.slice(0, i).join("/"))) return false;
|
|
292
321
|
return this.include.length === 0 || this.include.some((re) => re.test(path));
|
|
293
322
|
}
|
|
323
|
+
/**
|
|
324
|
+
* Whether include rules leave out everything a folder could hold: no include
|
|
325
|
+
* pattern can match a path below it.
|
|
326
|
+
*/
|
|
327
|
+
includesNothingIn(dir) {
|
|
328
|
+
if (this.includePatterns.length === 0) return false;
|
|
329
|
+
return !this.includePatterns.some((p) => {
|
|
330
|
+
if (p.startsWith("/")) {
|
|
331
|
+
const path = literalPath(p);
|
|
332
|
+
return path === dir || path.startsWith(`${dir}/`) || dir.startsWith(`${path}/`);
|
|
333
|
+
}
|
|
334
|
+
if (!p.replace(/^\.\//, "").includes("/")) return true;
|
|
335
|
+
const prefix = literalPrefix(p);
|
|
336
|
+
return prefix.startsWith(`${dir}/`) || `${dir}/`.startsWith(prefix);
|
|
337
|
+
});
|
|
338
|
+
}
|
|
294
339
|
/** Whether a directory is excluded as a whole. */
|
|
295
340
|
excludesDir(dir) {
|
|
296
341
|
return this.exclude.some((re) => re.test(dir) || re.test(`${dir}/`));
|
|
297
342
|
}
|
|
298
343
|
};
|
|
344
|
+
TOOL_DIRS = /* @__PURE__ */ new Set([
|
|
345
|
+
".claude",
|
|
346
|
+
".claire",
|
|
347
|
+
".cursor",
|
|
348
|
+
".windsurf",
|
|
349
|
+
".gemini",
|
|
350
|
+
".codex",
|
|
351
|
+
".agents",
|
|
352
|
+
".idea",
|
|
353
|
+
".vscode",
|
|
354
|
+
".history"
|
|
355
|
+
]);
|
|
299
356
|
DEFAULT_EXCLUDED_DIRS = /* @__PURE__ */ new Set([
|
|
300
357
|
".git",
|
|
301
358
|
".hg",
|
|
@@ -313,8 +370,34 @@ var init_glob = __esm({
|
|
|
313
370
|
"target",
|
|
314
371
|
"__pycache__",
|
|
315
372
|
".venv",
|
|
316
|
-
"venv"
|
|
373
|
+
"venv",
|
|
374
|
+
// Tools' and agents' workspaces (D38): their files, and worktrees inside them, are not the project's code.
|
|
375
|
+
...TOOL_DIRS
|
|
317
376
|
]);
|
|
377
|
+
VCS_DIRS = /* @__PURE__ */ new Set([".git", ".hg", ".svn"]);
|
|
378
|
+
LIBRARY_DIRS = /* @__PURE__ */ new Set(["node_modules", "bower_components", ".venv", "venv"]);
|
|
379
|
+
OptIn = class {
|
|
380
|
+
paths;
|
|
381
|
+
anchored;
|
|
382
|
+
constructor(paths = [], exclude = []) {
|
|
383
|
+
const clean = (p) => p.replace(/^\/+/, "").replace(/\/+$/, "");
|
|
384
|
+
this.paths = paths.map(clean).filter((p) => p.length > 0);
|
|
385
|
+
this.anchored = exclude.filter((r) => r.startsWith("/")).map(literalPath).filter((p) => p.length > 0);
|
|
386
|
+
}
|
|
387
|
+
/** The path was chosen: it, or a folder it is in, is opted in more specifically than any anchored exclude. */
|
|
388
|
+
covers(path) {
|
|
389
|
+
const depth = (list) => list.reduce((d, o) => path === o || path.startsWith(`${o}/`) ? Math.max(d, o.length) : d, -1);
|
|
390
|
+
const chosen = depth(this.paths);
|
|
391
|
+
return chosen >= 0 && chosen > depth(this.anchored);
|
|
392
|
+
}
|
|
393
|
+
/** Something below this folder was chosen (so the folder must be walked). */
|
|
394
|
+
below(dir) {
|
|
395
|
+
return this.paths.some((o) => o.startsWith(`${dir}/`));
|
|
396
|
+
}
|
|
397
|
+
get size() {
|
|
398
|
+
return this.paths.length;
|
|
399
|
+
}
|
|
400
|
+
};
|
|
318
401
|
}
|
|
319
402
|
});
|
|
320
403
|
|
|
@@ -385,6 +468,24 @@ function lsTree(top, commit, prefix) {
|
|
|
385
468
|
}
|
|
386
469
|
return entries;
|
|
387
470
|
}
|
|
471
|
+
function lsTreeDir(top, commit, dir) {
|
|
472
|
+
const out = git(top, ["ls-tree", "-z", "-l", "--full-tree", dir ? `${commit}:${dir}` : commit]);
|
|
473
|
+
const entries = [];
|
|
474
|
+
for (const record2 of out.toString("utf8").split("\0")) {
|
|
475
|
+
if (!record2) continue;
|
|
476
|
+
const tab = record2.indexOf(" ");
|
|
477
|
+
const [mode, type, sha, size] = record2.slice(0, tab).split(/ +/);
|
|
478
|
+
const name = record2.slice(tab + 1);
|
|
479
|
+
entries.push({
|
|
480
|
+
mode,
|
|
481
|
+
type,
|
|
482
|
+
sha,
|
|
483
|
+
path: dir ? `${dir}/${name}` : name,
|
|
484
|
+
...type === "blob" ? { size: Number(size) } : {}
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
return entries;
|
|
488
|
+
}
|
|
388
489
|
function blobSizes(top, shas) {
|
|
389
490
|
const sizes = /* @__PURE__ */ new Map();
|
|
390
491
|
if (shas.length === 0) return sizes;
|
|
@@ -493,10 +594,6 @@ function sha256File(abs) {
|
|
|
493
594
|
}
|
|
494
595
|
return hash2.digest("hex");
|
|
495
596
|
}
|
|
496
|
-
function inExcludedDir(path) {
|
|
497
|
-
const parts = path.split("/");
|
|
498
|
-
return parts.slice(0, -1).some((p) => DEFAULT_EXCLUDED_DIRS.has(p));
|
|
499
|
-
}
|
|
500
597
|
function fileFromBytes(path, language, bytes, maxFileBytes) {
|
|
501
598
|
const file2 = { path, language, size: bytes.length, contentHash: sha256(bytes) };
|
|
502
599
|
const skip = languageSkip(path, language);
|
|
@@ -509,6 +606,7 @@ function fileFromBytes(path, language, bytes, maxFileBytes) {
|
|
|
509
606
|
}
|
|
510
607
|
function planSource(source, options = {}) {
|
|
511
608
|
const maxFileBytes = options.maxFileBytes ?? DEFAULT_MAX_FILE_BYTES;
|
|
609
|
+
const hardMax = Math.max(maxFileBytes, options.hardMaxFileBytes ?? HARD_MAX_FILE_BYTES);
|
|
512
610
|
if (!existsSync2(source.root) || !statSync(source.root).isDirectory())
|
|
513
611
|
throw new VeoError("source-not-found", `source ${source.id}: ${source.root} is not a directory`, {
|
|
514
612
|
source: source.id,
|
|
@@ -517,9 +615,10 @@ function planSource(source, options = {}) {
|
|
|
517
615
|
const filter = new PathFilter(source.include, source.exclude);
|
|
518
616
|
const repo = repoInfo(source.root);
|
|
519
617
|
let plan;
|
|
520
|
-
if (repo?.head)
|
|
618
|
+
if (repo?.head)
|
|
619
|
+
plan = planGit(source, repo.top, repo.prefix, repo.head, repo.branch, filter, maxFileBytes, hardMax);
|
|
521
620
|
else {
|
|
522
|
-
plan = planPlain(source, filter, maxFileBytes);
|
|
621
|
+
plan = planPlain(source, filter, maxFileBytes, hardMax);
|
|
523
622
|
if (repo)
|
|
524
623
|
plan.notices.push(
|
|
525
624
|
"The repository has no commits yet, so it was analyzed as a plain folder (latest only)."
|
|
@@ -531,6 +630,9 @@ function planSource(source, options = {}) {
|
|
|
531
630
|
if (unsupported) plan.notices.push(unsupported);
|
|
532
631
|
return plan;
|
|
533
632
|
}
|
|
633
|
+
function isSourcePath(rel) {
|
|
634
|
+
return classify(rel) !== null || rel.toLowerCase().endsWith(".html");
|
|
635
|
+
}
|
|
534
636
|
function manifestDir(rel) {
|
|
535
637
|
return rel.includes("/") ? rel.slice(0, rel.lastIndexOf("/")) : "";
|
|
536
638
|
}
|
|
@@ -576,8 +678,11 @@ function unsupportedNotice(unsupported) {
|
|
|
576
678
|
const total = unsupported.reduce((n, u) => n + u.files, 0);
|
|
577
679
|
return `${list} ${total === 1 ? "is" : "are"} not analyzed: veoflow does not read ${unsupported.length === 1 ? "this language" : "these languages"} yet.`;
|
|
578
680
|
}
|
|
579
|
-
function planGit(source, top, prefix, head, branch, filter, maxFileBytes) {
|
|
681
|
+
function planGit(source, top, prefix, head, branch, filter, maxFileBytes, hardMax) {
|
|
580
682
|
const changes = workTreeChanges(top, prefix);
|
|
683
|
+
const optIn = new OptIn(source.optIn, source.exclude);
|
|
684
|
+
const defaults = /* @__PURE__ */ new Map();
|
|
685
|
+
const ruled = new RuleExcludedCollector(filter);
|
|
581
686
|
const plan = {
|
|
582
687
|
sourceId: source.id,
|
|
583
688
|
root: source.root,
|
|
@@ -589,6 +694,9 @@ function planGit(source, top, prefix, head, branch, filter, maxFileBytes) {
|
|
|
589
694
|
unpinned: [],
|
|
590
695
|
skipped: [],
|
|
591
696
|
unsupported: [],
|
|
697
|
+
defaultExcluded: [],
|
|
698
|
+
ruleExcluded: [],
|
|
699
|
+
ruleExcludedMore: 0,
|
|
592
700
|
notices: []
|
|
593
701
|
};
|
|
594
702
|
const candidates = [];
|
|
@@ -601,7 +709,31 @@ function planGit(source, top, prefix, head, branch, filter, maxFileBytes) {
|
|
|
601
709
|
entries++;
|
|
602
710
|
const within = treePrefix ? entry.path.slice(treePrefix.length + 1) : entry.path;
|
|
603
711
|
const rel = relBase ? `${relBase}/${within}` : within;
|
|
604
|
-
|
|
712
|
+
const excluded = defaultExcludedDir(rel);
|
|
713
|
+
let origin;
|
|
714
|
+
if (excluded) {
|
|
715
|
+
if (excluded.origin === "vcs" || !optIn.covers(rel)) {
|
|
716
|
+
if (excluded.origin !== "vcs" && entry.type === "blob") {
|
|
717
|
+
const folder = defaults.get(excluded.dir) ?? {
|
|
718
|
+
path: excluded.dir,
|
|
719
|
+
origin: excluded.origin,
|
|
720
|
+
files: 0
|
|
721
|
+
};
|
|
722
|
+
folder.files = (folder.files ?? 0) + 1;
|
|
723
|
+
defaults.set(excluded.dir, folder);
|
|
724
|
+
}
|
|
725
|
+
continue;
|
|
726
|
+
}
|
|
727
|
+
origin = excluded.origin;
|
|
728
|
+
}
|
|
729
|
+
if (entry.type === "blob" && defaultExcludedFile(rel)) {
|
|
730
|
+
if (!optIn.covers(rel)) {
|
|
731
|
+
defaults.set(rel, { path: rel, origin: "generated", files: 1 });
|
|
732
|
+
continue;
|
|
733
|
+
}
|
|
734
|
+
origin ??= "generated";
|
|
735
|
+
}
|
|
736
|
+
const tag = origin ? { origin } : {};
|
|
605
737
|
if (entry.type === "commit") {
|
|
606
738
|
const dir = submoduleDir(repoDir, entry.path);
|
|
607
739
|
if (!dir || !hasCommit(dir, entry.sha)) {
|
|
@@ -613,7 +745,11 @@ function planGit(source, top, prefix, head, branch, filter, maxFileBytes) {
|
|
|
613
745
|
}
|
|
614
746
|
if (entry.type === "blob" && entry.mode !== "120000" && (rel === "package.json" || rel.endsWith("/package.json")))
|
|
615
747
|
manifests.push({ rel, sha: entry.sha, repoDir });
|
|
616
|
-
if (entry.type !== "blob"
|
|
748
|
+
if (entry.type !== "blob") continue;
|
|
749
|
+
if (!filter.matches(rel) && !optIn.covers(rel)) {
|
|
750
|
+
if (isSourcePath(rel)) ruled.file(rel);
|
|
751
|
+
continue;
|
|
752
|
+
}
|
|
617
753
|
const language = classify(rel);
|
|
618
754
|
if (entry.mode === "120000") {
|
|
619
755
|
if (language || rel.toLowerCase().endsWith(".html"))
|
|
@@ -621,14 +757,15 @@ function planGit(source, top, prefix, head, branch, filter, maxFileBytes) {
|
|
|
621
757
|
continue;
|
|
622
758
|
}
|
|
623
759
|
if (language)
|
|
624
|
-
candidates.push({ rel, sha: entry.sha, language, repoDir, ...sub ? { commit: sub } : {} });
|
|
760
|
+
candidates.push({ rel, sha: entry.sha, language, repoDir, ...sub ? { commit: sub } : {}, ...tag });
|
|
625
761
|
else if (rel.toLowerCase().endsWith(".html"))
|
|
626
762
|
htmls.push({
|
|
627
763
|
rel,
|
|
628
764
|
sha: entry.sha,
|
|
629
765
|
language: "angular-template",
|
|
630
766
|
repoDir,
|
|
631
|
-
...sub ? { commit: sub } : {}
|
|
767
|
+
...sub ? { commit: sub } : {},
|
|
768
|
+
...tag
|
|
632
769
|
});
|
|
633
770
|
else unsupported.add(rel);
|
|
634
771
|
}
|
|
@@ -657,6 +794,8 @@ function planGit(source, top, prefix, head, branch, filter, maxFileBytes) {
|
|
|
657
794
|
}
|
|
658
795
|
}
|
|
659
796
|
plan.unsupported = unsupported.list();
|
|
797
|
+
plan.defaultExcluded = [...defaults.values()].sort((a, b) => a.path < b.path ? -1 : 1);
|
|
798
|
+
ruled.apply(plan);
|
|
660
799
|
if (entries === 0 && prefix)
|
|
661
800
|
plan.notices.push(
|
|
662
801
|
`${prefix} is not in the last commit (it may be untracked or ignored), so there was nothing to analyze.`
|
|
@@ -672,7 +811,12 @@ function planGit(source, top, prefix, head, branch, filter, maxFileBytes) {
|
|
|
672
811
|
repoDir,
|
|
673
812
|
files.map((f) => f.sha)
|
|
674
813
|
);
|
|
675
|
-
const
|
|
814
|
+
const limit = (f) => optIn.covers(f.rel) ? hardMax : maxFileBytes;
|
|
815
|
+
const readable = /* @__PURE__ */ new Map();
|
|
816
|
+
for (const f of files) {
|
|
817
|
+
const size = sizes.get(f.sha);
|
|
818
|
+
if (size !== void 0 && size <= limit(f)) readable.set(f.sha, size);
|
|
819
|
+
}
|
|
676
820
|
const blobs = readBlobs(
|
|
677
821
|
repoDir,
|
|
678
822
|
files.map((f) => f.sha),
|
|
@@ -695,9 +839,10 @@ function planGit(source, top, prefix, head, branch, filter, maxFileBytes) {
|
|
|
695
839
|
});
|
|
696
840
|
continue;
|
|
697
841
|
} else {
|
|
698
|
-
planned = fileFromBytes(f.rel, f.language, bytes,
|
|
842
|
+
planned = fileFromBytes(f.rel, f.language, bytes, limit(f));
|
|
699
843
|
}
|
|
700
844
|
if (f.commit) planned.commit = f.commit;
|
|
845
|
+
if (f.origin) planned.origin = f.origin;
|
|
701
846
|
plan.files.push(planned);
|
|
702
847
|
}
|
|
703
848
|
}
|
|
@@ -726,7 +871,7 @@ function planGit(source, top, prefix, head, branch, filter, maxFileBytes) {
|
|
|
726
871
|
plan.unpinned.sort((a, b) => a.path < b.path ? -1 : 1);
|
|
727
872
|
return plan;
|
|
728
873
|
}
|
|
729
|
-
function planPlain(source, filter, maxFileBytes) {
|
|
874
|
+
function planPlain(source, filter, maxFileBytes, hardMax) {
|
|
730
875
|
const plan = {
|
|
731
876
|
sourceId: source.id,
|
|
732
877
|
root: source.root,
|
|
@@ -738,6 +883,9 @@ function planPlain(source, filter, maxFileBytes) {
|
|
|
738
883
|
unpinned: [],
|
|
739
884
|
skipped: [],
|
|
740
885
|
unsupported: [],
|
|
886
|
+
defaultExcluded: [],
|
|
887
|
+
ruleExcluded: [],
|
|
888
|
+
ruleExcludedMore: 0,
|
|
741
889
|
notices: []
|
|
742
890
|
};
|
|
743
891
|
const rootReal = realpathSync(source.root);
|
|
@@ -747,7 +895,12 @@ function planPlain(source, filter, maxFileBytes) {
|
|
|
747
895
|
const unsupported = new UnsupportedCounter();
|
|
748
896
|
const htmls = [];
|
|
749
897
|
const manifests = /* @__PURE__ */ new Map();
|
|
750
|
-
const
|
|
898
|
+
const optIn = new OptIn(source.optIn, source.exclude);
|
|
899
|
+
const defaults = /* @__PURE__ */ new Map();
|
|
900
|
+
const ruled = new RuleExcludedCollector(filter);
|
|
901
|
+
const limit = (rel) => optIn.covers(rel) ? hardMax : maxFileBytes;
|
|
902
|
+
const origins = /* @__PURE__ */ new Map();
|
|
903
|
+
const walk = (dir, dirReal, restricted) => {
|
|
751
904
|
let names;
|
|
752
905
|
try {
|
|
753
906
|
names = readdirSync(dir).sort();
|
|
@@ -758,6 +911,7 @@ function planPlain(source, filter, maxFileBytes) {
|
|
|
758
911
|
for (const name of names) {
|
|
759
912
|
const abs = join2(dir, name);
|
|
760
913
|
const rel = toRel(abs);
|
|
914
|
+
if (restricted && !optIn.covers(rel) && !optIn.below(rel)) continue;
|
|
761
915
|
let st;
|
|
762
916
|
try {
|
|
763
917
|
st = lstatSync(abs);
|
|
@@ -779,8 +933,22 @@ function planPlain(source, filter, maxFileBytes) {
|
|
|
779
933
|
continue;
|
|
780
934
|
}
|
|
781
935
|
if (st.isDirectory()) {
|
|
782
|
-
|
|
783
|
-
|
|
936
|
+
const whole = optIn.covers(rel);
|
|
937
|
+
const wanted = whole || optIn.below(rel);
|
|
938
|
+
const excluded = DEFAULT_EXCLUDED_DIRS.has(name) ? defaultExcludedDir(`${rel}/x`) : null;
|
|
939
|
+
let narrow = restricted;
|
|
940
|
+
if (excluded) {
|
|
941
|
+
if (excluded.origin === "vcs") continue;
|
|
942
|
+
if (!whole && excluded.dir === rel && !defaults.has(rel))
|
|
943
|
+
defaults.set(rel, { path: rel, origin: excluded.origin, files: null });
|
|
944
|
+
if (!wanted) continue;
|
|
945
|
+
if (!whole) narrow = true;
|
|
946
|
+
} else if (!whole && filter.excludesDir(rel)) {
|
|
947
|
+
ruled.dir(rel);
|
|
948
|
+
if (!wanted) continue;
|
|
949
|
+
narrow = true;
|
|
950
|
+
}
|
|
951
|
+
walk(abs, join2(dirReal, name), narrow);
|
|
784
952
|
continue;
|
|
785
953
|
}
|
|
786
954
|
if (st.isFile() && name === "package.json" && st.size <= maxFileBytes) {
|
|
@@ -789,7 +957,21 @@ function planPlain(source, filter, maxFileBytes) {
|
|
|
789
957
|
} catch {
|
|
790
958
|
}
|
|
791
959
|
}
|
|
792
|
-
|
|
960
|
+
const inDefault = defaultExcludedDir(rel);
|
|
961
|
+
if (inDefault && (inDefault.origin === "vcs" || !optIn.covers(rel))) continue;
|
|
962
|
+
if (inDefault && inDefault.origin !== "vcs") origins.set(rel, inDefault.origin);
|
|
963
|
+
if (!st.isFile()) continue;
|
|
964
|
+
if (defaultExcludedFile(rel)) {
|
|
965
|
+
if (!optIn.covers(rel)) {
|
|
966
|
+
defaults.set(rel, { path: rel, origin: "generated", files: 1 });
|
|
967
|
+
continue;
|
|
968
|
+
}
|
|
969
|
+
if (!origins.has(rel)) origins.set(rel, "generated");
|
|
970
|
+
}
|
|
971
|
+
if (!filter.matches(rel) && !optIn.covers(rel)) {
|
|
972
|
+
if (isSourcePath(rel)) ruled.file(rel);
|
|
973
|
+
continue;
|
|
974
|
+
}
|
|
793
975
|
const language = classify(rel);
|
|
794
976
|
if (!language && rel.toLowerCase().endsWith(".html")) {
|
|
795
977
|
htmls.push({ abs, rel, size: st.size });
|
|
@@ -805,7 +987,7 @@ function planPlain(source, filter, maxFileBytes) {
|
|
|
805
987
|
}
|
|
806
988
|
continue;
|
|
807
989
|
}
|
|
808
|
-
if (st.size >
|
|
990
|
+
if (st.size > limit(rel)) {
|
|
809
991
|
let hash2;
|
|
810
992
|
try {
|
|
811
993
|
hash2 = sha256File(abs);
|
|
@@ -822,10 +1004,10 @@ function planPlain(source, filter, maxFileBytes) {
|
|
|
822
1004
|
plan.files.push({ path: rel, language, size: st.size, contentHash: "", skip: "unreadable" });
|
|
823
1005
|
continue;
|
|
824
1006
|
}
|
|
825
|
-
plan.files.push(fileFromBytes(rel, language, bytes,
|
|
1007
|
+
plan.files.push(fileFromBytes(rel, language, bytes, limit(rel)));
|
|
826
1008
|
}
|
|
827
1009
|
};
|
|
828
|
-
walk(source.root, rootReal);
|
|
1010
|
+
walk(source.root, rootReal, false);
|
|
829
1011
|
const angular = angularTemplates(
|
|
830
1012
|
htmls.map((h) => h.rel),
|
|
831
1013
|
manifests
|
|
@@ -835,7 +1017,7 @@ function planPlain(source, filter, maxFileBytes) {
|
|
|
835
1017
|
unsupported.add(h.rel);
|
|
836
1018
|
continue;
|
|
837
1019
|
}
|
|
838
|
-
if (h.size >
|
|
1020
|
+
if (h.size > limit(h.rel)) {
|
|
839
1021
|
let hash2 = "";
|
|
840
1022
|
try {
|
|
841
1023
|
hash2 = sha256File(h.abs);
|
|
@@ -851,7 +1033,7 @@ function planPlain(source, filter, maxFileBytes) {
|
|
|
851
1033
|
continue;
|
|
852
1034
|
}
|
|
853
1035
|
try {
|
|
854
|
-
plan.files.push(fileFromBytes(h.rel, "angular-template", readFileSync(h.abs),
|
|
1036
|
+
plan.files.push(fileFromBytes(h.rel, "angular-template", readFileSync(h.abs), limit(h.rel)));
|
|
855
1037
|
} catch {
|
|
856
1038
|
plan.files.push({
|
|
857
1039
|
path: h.rel,
|
|
@@ -863,6 +1045,12 @@ function planPlain(source, filter, maxFileBytes) {
|
|
|
863
1045
|
}
|
|
864
1046
|
}
|
|
865
1047
|
plan.unsupported = unsupported.list();
|
|
1048
|
+
plan.defaultExcluded = [...defaults.values()].sort((a, b) => a.path < b.path ? -1 : 1);
|
|
1049
|
+
ruled.apply(plan);
|
|
1050
|
+
for (const f of plan.files) {
|
|
1051
|
+
const origin = origins.get(f.path);
|
|
1052
|
+
if (origin) f.origin = origin;
|
|
1053
|
+
}
|
|
866
1054
|
plan.files.sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
|
|
867
1055
|
const lines = [
|
|
868
1056
|
...plan.files.map((f) => `${f.path}\0${f.contentHash}
|
|
@@ -873,7 +1061,7 @@ function planPlain(source, filter, maxFileBytes) {
|
|
|
873
1061
|
plan.revision = `sha256:${sha256(lines.join(""))}`;
|
|
874
1062
|
return plan;
|
|
875
1063
|
}
|
|
876
|
-
var DEFAULT_MAX_FILE_BYTES, RESOLVER_INPUT, UnsupportedCounter;
|
|
1064
|
+
var RULE_EXCLUDED_LIMIT, RuleExcludedCollector, DEFAULT_MAX_FILE_BYTES, HARD_MAX_FILE_BYTES, RESOLVER_INPUT, UnsupportedCounter;
|
|
877
1065
|
var init_plan = __esm({
|
|
878
1066
|
"packages/planner/src/plan.ts"() {
|
|
879
1067
|
"use strict";
|
|
@@ -881,7 +1069,38 @@ var init_plan = __esm({
|
|
|
881
1069
|
init_classify();
|
|
882
1070
|
init_git();
|
|
883
1071
|
init_glob();
|
|
1072
|
+
RULE_EXCLUDED_LIMIT = 1e3;
|
|
1073
|
+
RuleExcludedCollector = class {
|
|
1074
|
+
constructor(filter) {
|
|
1075
|
+
this.filter = filter;
|
|
1076
|
+
}
|
|
1077
|
+
filter;
|
|
1078
|
+
paths = /* @__PURE__ */ new Map();
|
|
1079
|
+
file(rel) {
|
|
1080
|
+
const parts = rel.split("/");
|
|
1081
|
+
for (let i = 1; i < parts.length; i++) {
|
|
1082
|
+
const dir = parts.slice(0, i).join("/");
|
|
1083
|
+
if (this.filter.excludesDir(dir)) {
|
|
1084
|
+
const folder = this.paths.get(dir) ?? { path: dir, kind: "dir", files: 0 };
|
|
1085
|
+
if (folder.files !== null) folder.files = (folder.files ?? 0) + 1;
|
|
1086
|
+
this.paths.set(dir, folder);
|
|
1087
|
+
return;
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
this.paths.set(rel, { path: rel, kind: "file" });
|
|
1091
|
+
}
|
|
1092
|
+
/** A folder not walked (plain sources). */
|
|
1093
|
+
dir(rel) {
|
|
1094
|
+
this.paths.set(rel, { path: rel, kind: "dir", files: null });
|
|
1095
|
+
}
|
|
1096
|
+
apply(plan) {
|
|
1097
|
+
const all2 = [...this.paths.values()].sort((a, b) => a.path < b.path ? -1 : 1);
|
|
1098
|
+
plan.ruleExcluded = all2.slice(0, RULE_EXCLUDED_LIMIT);
|
|
1099
|
+
plan.ruleExcludedMore = all2.length - plan.ruleExcluded.length;
|
|
1100
|
+
}
|
|
1101
|
+
};
|
|
884
1102
|
DEFAULT_MAX_FILE_BYTES = 10 * 1024 * 1024;
|
|
1103
|
+
HARD_MAX_FILE_BYTES = 64 * 1024 * 1024;
|
|
885
1104
|
RESOLVER_INPUT = /\.(json|jsonc|lock|ya?ml|toml|mod|sum)$|(^|\/)(\.npmrc|\.nvmrc|\.babelrc)$/i;
|
|
886
1105
|
UnsupportedCounter = class {
|
|
887
1106
|
counts = /* @__PURE__ */ new Map();
|
|
@@ -896,6 +1115,178 @@ var init_plan = __esm({
|
|
|
896
1115
|
}
|
|
897
1116
|
});
|
|
898
1117
|
|
|
1118
|
+
// packages/planner/src/browse.ts
|
|
1119
|
+
import { lstatSync as lstatSync2, readdirSync as readdirSync2, realpathSync as realpathSync2 } from "node:fs";
|
|
1120
|
+
import { join as join3, sep as sep2 } from "node:path";
|
|
1121
|
+
function listDirectory(source, dir, options = {}) {
|
|
1122
|
+
const maxFileBytes = options.maxFileBytes ?? DEFAULT_MAX_FILE_BYTES;
|
|
1123
|
+
const hardMax = Math.max(maxFileBytes, options.hardMaxFileBytes ?? HARD_MAX_FILE_BYTES);
|
|
1124
|
+
dir = dir.replace(/^\/+|\/+$/g, "");
|
|
1125
|
+
if (dir.split("/").some((p) => p === ".." || p === "."))
|
|
1126
|
+
throw new VeoError("invalid-arguments", `bad folder ${dir}`, { fields: ["dir"] });
|
|
1127
|
+
const raw = rawEntries(source, dir);
|
|
1128
|
+
const filter = new PathFilter(source.include, source.exclude);
|
|
1129
|
+
const optIn = new OptIn(source.optIn, source.exclude);
|
|
1130
|
+
const entries = [];
|
|
1131
|
+
for (const e of raw) {
|
|
1132
|
+
const name = e.path.slice(e.path.lastIndexOf("/") + 1);
|
|
1133
|
+
if (VCS_DIRS.has(name) && e.kind === "dir") continue;
|
|
1134
|
+
const entry = { path: e.path, kind: e.kind };
|
|
1135
|
+
const chosen = optIn.covers(e.path);
|
|
1136
|
+
if (chosen) entry.optedIn = true;
|
|
1137
|
+
const inDefault = e.kind === "dir" && DEFAULT_EXCLUDED_DIRS.has(name) ? defaultExcludedDir(`${e.path}/x`) : defaultExcludedDir(e.path);
|
|
1138
|
+
if (e.kind === "file") {
|
|
1139
|
+
entry.size = e.size;
|
|
1140
|
+
entry.language = classify(e.path) ?? null;
|
|
1141
|
+
if (e.symlink) entry.notAnalyzable = "symlink";
|
|
1142
|
+
else if (/\.d\.[cm]?ts$/i.test(e.path)) entry.notAnalyzable = "declaration-file";
|
|
1143
|
+
else if ((e.size ?? 0) > hardMax) entry.notAnalyzable = "over-hard-cap";
|
|
1144
|
+
}
|
|
1145
|
+
const origin = inDefault && inDefault.origin !== "vcs" ? inDefault.origin : e.kind === "file" ? defaultExcludedFile(e.path) : null;
|
|
1146
|
+
if (origin) entry.origin = origin;
|
|
1147
|
+
if (!chosen) {
|
|
1148
|
+
if (inDefault && inDefault.origin !== "vcs") entry.excludedBy = inDefault.origin;
|
|
1149
|
+
else if (e.kind === "file" && defaultExcludedFile(e.path)) entry.excludedBy = "generated";
|
|
1150
|
+
else if (e.kind === "dir" ? filter.excludesDir(e.path) || filter.includesNothingIn(e.path) : !filter.matches(e.path))
|
|
1151
|
+
entry.excludedBy = "rule";
|
|
1152
|
+
else if (e.kind === "file" && (e.size ?? 0) > maxFileBytes) entry.excludedBy = "too-large";
|
|
1153
|
+
} else if (entry.notAnalyzable === "over-hard-cap") entry.excludedBy = "too-large";
|
|
1154
|
+
entries.push(entry);
|
|
1155
|
+
}
|
|
1156
|
+
return entries.sort((a, b) => a.kind === b.kind ? a.path < b.path ? -1 : 1 : a.kind === "dir" ? -1 : 1);
|
|
1157
|
+
}
|
|
1158
|
+
function rawEntries(source, dir) {
|
|
1159
|
+
const repo = repoInfo(source.root);
|
|
1160
|
+
if (repo?.head) {
|
|
1161
|
+
const at = ` at ${repo.head.slice(0, 12)}`;
|
|
1162
|
+
let repoDir = repo.top;
|
|
1163
|
+
let commit = repo.head;
|
|
1164
|
+
let inRepo = repo.prefix.replace(/\/$/, "");
|
|
1165
|
+
const list = () => {
|
|
1166
|
+
try {
|
|
1167
|
+
return lsTreeDir(repoDir, commit, inRepo);
|
|
1168
|
+
} catch {
|
|
1169
|
+
throw notFound(source, dir, at);
|
|
1170
|
+
}
|
|
1171
|
+
};
|
|
1172
|
+
for (const part of dir ? dir.split("/") : []) {
|
|
1173
|
+
const next = inRepo ? `${inRepo}/${part}` : part;
|
|
1174
|
+
const entry = list().find((e) => e.path === next);
|
|
1175
|
+
if (entry?.type === "tree") inRepo = next;
|
|
1176
|
+
else if (entry?.type === "commit") {
|
|
1177
|
+
const sub = submoduleDir(repoDir, next);
|
|
1178
|
+
if (!sub || !hasCommit(sub, entry.sha))
|
|
1179
|
+
throw notFound(source, dir, " (a submodule that isn't checked out)");
|
|
1180
|
+
repoDir = sub;
|
|
1181
|
+
commit = entry.sha;
|
|
1182
|
+
inRepo = "";
|
|
1183
|
+
} else throw notFound(source, dir, at);
|
|
1184
|
+
}
|
|
1185
|
+
return list().flatMap((e) => {
|
|
1186
|
+
const path = (dir ? `${dir}/` : "") + e.path.slice(e.path.lastIndexOf("/") + 1);
|
|
1187
|
+
if (e.type === "blob")
|
|
1188
|
+
return [{ path, kind: "file", size: e.size, ...e.mode === "120000" ? { symlink: true } : {} }];
|
|
1189
|
+
return [{ path, kind: "dir" }];
|
|
1190
|
+
});
|
|
1191
|
+
}
|
|
1192
|
+
const abs = join3(source.root, ...dir.split("/").filter(Boolean));
|
|
1193
|
+
let names;
|
|
1194
|
+
try {
|
|
1195
|
+
const root = realpathSync2(source.root);
|
|
1196
|
+
const real = realpathSync2(abs);
|
|
1197
|
+
if (real !== root && !real.startsWith(root + sep2)) throw new Error("outside");
|
|
1198
|
+
if (dir && real !== join3(root, ...dir.split("/"))) throw new Error("through a link");
|
|
1199
|
+
names = readdirSync2(abs);
|
|
1200
|
+
} catch {
|
|
1201
|
+
throw notFound(source, dir);
|
|
1202
|
+
}
|
|
1203
|
+
return names.flatMap((name) => {
|
|
1204
|
+
const path = dir ? `${dir}/${name}` : name;
|
|
1205
|
+
try {
|
|
1206
|
+
const st = lstatSync2(join3(abs, name));
|
|
1207
|
+
if (st.isDirectory()) return [{ path, kind: "dir" }];
|
|
1208
|
+
if (st.isFile()) return [{ path, kind: "file", size: st.size }];
|
|
1209
|
+
if (st.isSymbolicLink()) return [{ path, kind: "file", size: st.size, symlink: true }];
|
|
1210
|
+
} catch {
|
|
1211
|
+
}
|
|
1212
|
+
return [];
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1215
|
+
function applySelection(source, paths, selected, options = {}) {
|
|
1216
|
+
let rules = {
|
|
1217
|
+
include: [...source.include],
|
|
1218
|
+
exclude: [...source.exclude],
|
|
1219
|
+
optIn: [...source.optIn ?? []]
|
|
1220
|
+
};
|
|
1221
|
+
for (const raw of paths) {
|
|
1222
|
+
const path = raw.replace(/\\/g, "/").replace(/^\.?\/+|\/+$/g, "");
|
|
1223
|
+
if (!path)
|
|
1224
|
+
throw new VeoError(
|
|
1225
|
+
"invalid-arguments",
|
|
1226
|
+
"the source root can't be selected; choose files or folders in it",
|
|
1227
|
+
{ fields: ["paths"] }
|
|
1228
|
+
);
|
|
1229
|
+
const entry = () => find({ ...source, ...rules }, path, options);
|
|
1230
|
+
const first = entry();
|
|
1231
|
+
const kind = first.kind;
|
|
1232
|
+
if (selected && first.notAnalyzable)
|
|
1233
|
+
throw new VeoError(
|
|
1234
|
+
"invalid-arguments",
|
|
1235
|
+
`${path} can't be analyzed (${first.notAnalyzable === "over-hard-cap" ? "it is over the 64 MB cap" : first.notAnalyzable === "symlink" ? "it is a symbolic link" : "type declarations are not analyzed"})`,
|
|
1236
|
+
{ fields: ["paths"] }
|
|
1237
|
+
);
|
|
1238
|
+
const inside = (p) => p === path || p.startsWith(`${path}/`);
|
|
1239
|
+
const written = (rule) => {
|
|
1240
|
+
const r = rule.replace(/^\/+/, "").replace(/\/+$/, "");
|
|
1241
|
+
return rule.startsWith("/") && (kind === "dir" ? inside(r) : r === path);
|
|
1242
|
+
};
|
|
1243
|
+
if (selected) {
|
|
1244
|
+
rules = { ...rules, exclude: rules.exclude.filter((r) => !written(r)) };
|
|
1245
|
+
if (entry().excludedBy) rules = { ...rules, optIn: [...rules.optIn.filter((p) => !inside(p)), path] };
|
|
1246
|
+
for (const o of rules.optIn.filter((p) => p !== path && inside(p))) {
|
|
1247
|
+
const without = { ...rules, optIn: rules.optIn.filter((p) => p !== o) };
|
|
1248
|
+
let needed = false;
|
|
1249
|
+
try {
|
|
1250
|
+
needed = !!find({ ...source, ...without }, o, options).excludedBy;
|
|
1251
|
+
} catch {
|
|
1252
|
+
}
|
|
1253
|
+
if (!needed) rules = without;
|
|
1254
|
+
}
|
|
1255
|
+
} else {
|
|
1256
|
+
rules = { ...rules, optIn: rules.optIn.filter((p) => !inside(p)) };
|
|
1257
|
+
if (!entry().excludedBy)
|
|
1258
|
+
rules = { ...rules, exclude: [...rules.exclude, kind === "dir" ? `/${path}/` : `/${path}`] };
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
return rules;
|
|
1262
|
+
}
|
|
1263
|
+
function find(source, path, options) {
|
|
1264
|
+
const slash = path.lastIndexOf("/");
|
|
1265
|
+
const parent = slash < 0 ? "" : path.slice(0, slash);
|
|
1266
|
+
const entry = listDirectory(source, parent, options).find((e) => e.path === path);
|
|
1267
|
+
if (!entry)
|
|
1268
|
+
throw new VeoError("not-found", `no file or folder ${path} in source ${source.id}`, {
|
|
1269
|
+
kind: "path",
|
|
1270
|
+
id: path
|
|
1271
|
+
});
|
|
1272
|
+
return entry;
|
|
1273
|
+
}
|
|
1274
|
+
var notFound;
|
|
1275
|
+
var init_browse = __esm({
|
|
1276
|
+
"packages/planner/src/browse.ts"() {
|
|
1277
|
+
"use strict";
|
|
1278
|
+
init_src();
|
|
1279
|
+
init_classify();
|
|
1280
|
+
init_glob();
|
|
1281
|
+
init_git();
|
|
1282
|
+
init_plan();
|
|
1283
|
+
notFound = (source, dir, at = "") => new VeoError("not-found", `no folder ${dir || "."} in source ${source.id}${at}`, {
|
|
1284
|
+
kind: "folder",
|
|
1285
|
+
id: dir
|
|
1286
|
+
});
|
|
1287
|
+
}
|
|
1288
|
+
});
|
|
1289
|
+
|
|
899
1290
|
// packages/store/src/sqlite.ts
|
|
900
1291
|
import { createRequire } from "node:module";
|
|
901
1292
|
function openDatabase(path) {
|
|
@@ -1458,7 +1849,7 @@ ${payload}`);
|
|
|
1458
1849
|
// packages/store/src/evidence-store.ts
|
|
1459
1850
|
import { createHash as createHash3 } from "node:crypto";
|
|
1460
1851
|
import { existsSync as existsSync3, mkdirSync, readFileSync as readFileSync2, renameSync, writeFileSync } from "node:fs";
|
|
1461
|
-
import { dirname as dirname2, join as
|
|
1852
|
+
import { dirname as dirname2, join as join4 } from "node:path";
|
|
1462
1853
|
var EvidenceStore;
|
|
1463
1854
|
var init_evidence_store = __esm({
|
|
1464
1855
|
"packages/store/src/evidence-store.ts"() {
|
|
@@ -1474,7 +1865,7 @@ var init_evidence_store = __esm({
|
|
|
1474
1865
|
}
|
|
1475
1866
|
pathFor(hash2) {
|
|
1476
1867
|
if (!/^[0-9a-f]{64}$/.test(hash2)) throw new Error(`invalid content hash ${hash2}`);
|
|
1477
|
-
return
|
|
1868
|
+
return join4(this.dir, hash2.slice(0, 2), hash2);
|
|
1478
1869
|
}
|
|
1479
1870
|
/** Store content; returns its SHA-256. */
|
|
1480
1871
|
put(content) {
|
|
@@ -1503,8 +1894,8 @@ var init_evidence_store = __esm({
|
|
|
1503
1894
|
import {
|
|
1504
1895
|
existsSync as existsSync4,
|
|
1505
1896
|
mkdirSync as mkdirSync2,
|
|
1506
|
-
readdirSync as
|
|
1507
|
-
realpathSync as
|
|
1897
|
+
readdirSync as readdirSync3,
|
|
1898
|
+
realpathSync as realpathSync3,
|
|
1508
1899
|
renameSync as renameSync2,
|
|
1509
1900
|
rmdirSync,
|
|
1510
1901
|
rmSync,
|
|
@@ -1512,12 +1903,12 @@ import {
|
|
|
1512
1903
|
symlinkSync
|
|
1513
1904
|
} from "node:fs";
|
|
1514
1905
|
import { homedir } from "node:os";
|
|
1515
|
-
import { basename, dirname as dirname3, join as
|
|
1906
|
+
import { basename, dirname as dirname3, join as join5, resolve, sep as sep3 } from "node:path";
|
|
1516
1907
|
function defaultHome() {
|
|
1517
1908
|
const configured = process.env.VEOFLOW_HOME ?? process.env.VEO_HOME;
|
|
1518
1909
|
if (configured) return configured;
|
|
1519
|
-
const home =
|
|
1520
|
-
const legacy =
|
|
1910
|
+
const home = join5(homedir(), ".veoflow");
|
|
1911
|
+
const legacy = join5(homedir(), ".veo");
|
|
1521
1912
|
const outcome = migrateLegacyHome(legacy, home);
|
|
1522
1913
|
switch (outcome) {
|
|
1523
1914
|
case "moved":
|
|
@@ -1544,10 +1935,10 @@ function defaultHome() {
|
|
|
1544
1935
|
}
|
|
1545
1936
|
}
|
|
1546
1937
|
function inUse(dir) {
|
|
1547
|
-
const projects =
|
|
1938
|
+
const projects = join5(dir, "projects");
|
|
1548
1939
|
if (!existsSync4(projects)) return false;
|
|
1549
|
-
for (const id of
|
|
1550
|
-
const graph =
|
|
1940
|
+
for (const id of readdirSync3(projects)) {
|
|
1941
|
+
const graph = join5(projects, id, "graph.sqlite");
|
|
1551
1942
|
if (!existsSync4(graph)) continue;
|
|
1552
1943
|
try {
|
|
1553
1944
|
const db = openDatabase(graph);
|
|
@@ -1563,9 +1954,9 @@ function inUse(dir) {
|
|
|
1563
1954
|
return false;
|
|
1564
1955
|
}
|
|
1565
1956
|
function migrateLegacyHome(legacy, home) {
|
|
1566
|
-
if (!existsSync4(
|
|
1957
|
+
if (!existsSync4(join5(legacy, "catalog.sqlite"))) return "none";
|
|
1567
1958
|
if (existsSync4(home)) {
|
|
1568
|
-
if (existsSync4(
|
|
1959
|
+
if (existsSync4(join5(home, "catalog.sqlite"))) return "both";
|
|
1569
1960
|
try {
|
|
1570
1961
|
rmdirSync(home);
|
|
1571
1962
|
} catch {
|
|
@@ -1597,20 +1988,21 @@ function canonicalPath(path) {
|
|
|
1597
1988
|
rest.unshift(basename(p));
|
|
1598
1989
|
p = parent;
|
|
1599
1990
|
}
|
|
1600
|
-
return
|
|
1991
|
+
return join5(realpathSync3.native(p), ...rest);
|
|
1601
1992
|
}
|
|
1602
1993
|
function isWithin(child, parent) {
|
|
1603
1994
|
const c = resolve(child);
|
|
1604
1995
|
const p = resolve(parent);
|
|
1605
|
-
return c === p || c.startsWith(p.endsWith(
|
|
1996
|
+
return c === p || c.startsWith(p.endsWith(sep3) ? p : p + sep3);
|
|
1606
1997
|
}
|
|
1607
|
-
var SCHEMA2, Catalog;
|
|
1998
|
+
var DEFAULT_PROJECT_SETTINGS, SCHEMA2, Catalog;
|
|
1608
1999
|
var init_catalog = __esm({
|
|
1609
2000
|
"packages/store/src/catalog.ts"() {
|
|
1610
2001
|
"use strict";
|
|
1611
2002
|
init_src();
|
|
1612
2003
|
init_project_store();
|
|
1613
2004
|
init_sqlite();
|
|
2005
|
+
DEFAULT_PROJECT_SETTINGS = { maxFileMB: 10 };
|
|
1614
2006
|
SCHEMA2 = `
|
|
1615
2007
|
CREATE TABLE IF NOT EXISTS projects (id TEXT PRIMARY KEY, name TEXT NOT NULL, created_at TEXT NOT NULL);
|
|
1616
2008
|
CREATE TABLE IF NOT EXISTS sources (
|
|
@@ -1627,17 +2019,57 @@ CREATE TABLE IF NOT EXISTS sources (
|
|
|
1627
2019
|
Catalog = class {
|
|
1628
2020
|
constructor(home = defaultHome()) {
|
|
1629
2021
|
this.home = home;
|
|
1630
|
-
mkdirSync2(
|
|
1631
|
-
this.db = openDatabase(
|
|
2022
|
+
mkdirSync2(join5(home, "projects"), { recursive: true });
|
|
2023
|
+
this.db = openDatabase(join5(home, "catalog.sqlite"));
|
|
1632
2024
|
this.db.exec(SCHEMA2);
|
|
2025
|
+
const has = (table, column) => this.db.prepare(`PRAGMA table_info(${table})`).all().some(
|
|
2026
|
+
(c) => c.name === column
|
|
2027
|
+
);
|
|
2028
|
+
if (!has("sources", "opt_in"))
|
|
2029
|
+
this.db.exec("ALTER TABLE sources ADD COLUMN opt_in TEXT NOT NULL DEFAULT '[]'");
|
|
2030
|
+
if (!has("projects", "settings"))
|
|
2031
|
+
this.db.exec("ALTER TABLE projects ADD COLUMN settings TEXT NOT NULL DEFAULT '{}'");
|
|
1633
2032
|
}
|
|
1634
2033
|
home;
|
|
1635
2034
|
db;
|
|
2035
|
+
/** A project's analysis settings (defaults for anything not set). */
|
|
2036
|
+
projectSettings(projectId) {
|
|
2037
|
+
const row = this.db.prepare("SELECT settings FROM projects WHERE id = ?").get(projectId);
|
|
2038
|
+
if (!row) throw new VeoError("not-found", `no project ${projectId}`);
|
|
2039
|
+
return { ...DEFAULT_PROJECT_SETTINGS, ...JSON.parse(row.settings || "{}") };
|
|
2040
|
+
}
|
|
2041
|
+
setProjectSettings(projectId, settings) {
|
|
2042
|
+
const next = { ...this.projectSettings(projectId), ...settings };
|
|
2043
|
+
this.db.prepare("UPDATE projects SET settings = ? WHERE id = ?").run(JSON.stringify(next), projectId);
|
|
2044
|
+
return next;
|
|
2045
|
+
}
|
|
2046
|
+
/** Change a source's rules (plan D36): applied at the next run. */
|
|
2047
|
+
updateSource(projectId, sourceId, rules) {
|
|
2048
|
+
const source = this.listSources(projectId).find((s) => s.id === sourceId);
|
|
2049
|
+
if (!source)
|
|
2050
|
+
throw new VeoError("not-found", `no source ${sourceId} in ${projectId}`, {
|
|
2051
|
+
kind: "source",
|
|
2052
|
+
id: sourceId
|
|
2053
|
+
});
|
|
2054
|
+
const next = {
|
|
2055
|
+
include: rules.include ?? source.include,
|
|
2056
|
+
exclude: rules.exclude ?? source.exclude,
|
|
2057
|
+
optIn: rules.optIn ?? source.optIn ?? []
|
|
2058
|
+
};
|
|
2059
|
+
this.db.prepare("UPDATE sources SET include = ?, exclude = ?, opt_in = ? WHERE project_id = ? AND id = ?").run(
|
|
2060
|
+
JSON.stringify(next.include),
|
|
2061
|
+
JSON.stringify(next.exclude),
|
|
2062
|
+
JSON.stringify(next.optIn),
|
|
2063
|
+
projectId,
|
|
2064
|
+
sourceId
|
|
2065
|
+
);
|
|
2066
|
+
return { ...source, ...next };
|
|
2067
|
+
}
|
|
1636
2068
|
close() {
|
|
1637
2069
|
this.db.close();
|
|
1638
2070
|
}
|
|
1639
2071
|
projectDir(id) {
|
|
1640
|
-
return
|
|
2072
|
+
return join5(this.home, "projects", id);
|
|
1641
2073
|
}
|
|
1642
2074
|
createProject(name, id) {
|
|
1643
2075
|
const base = assertSourceId(id ?? slug(name));
|
|
@@ -1668,7 +2100,7 @@ CREATE TABLE IF NOT EXISTS sources (
|
|
|
1668
2100
|
/** Delete a project and its store directory. Refused while a run holds its lock. */
|
|
1669
2101
|
deleteProject(id) {
|
|
1670
2102
|
if (!this.getProject(id)) throw new VeoError("not-found", `no project ${id}`);
|
|
1671
|
-
const graph =
|
|
2103
|
+
const graph = join5(this.projectDir(id), "graph.sqlite");
|
|
1672
2104
|
if (existsSync4(graph)) {
|
|
1673
2105
|
const db = openDatabase(graph);
|
|
1674
2106
|
try {
|
|
@@ -1711,7 +2143,7 @@ CREATE TABLE IF NOT EXISTS sources (
|
|
|
1711
2143
|
);
|
|
1712
2144
|
const createdAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1713
2145
|
this.db.prepare(
|
|
1714
|
-
"INSERT INTO sources (project_id, id, kind, root, include, exclude, created_at) VALUES (?, ?, ?, ?, ?, ?, ?)"
|
|
2146
|
+
"INSERT INTO sources (project_id, id, kind, root, include, exclude, opt_in, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
|
|
1715
2147
|
).run(
|
|
1716
2148
|
projectId,
|
|
1717
2149
|
source.id,
|
|
@@ -1719,9 +2151,10 @@ CREATE TABLE IF NOT EXISTS sources (
|
|
|
1719
2151
|
root,
|
|
1720
2152
|
JSON.stringify(source.include),
|
|
1721
2153
|
JSON.stringify(source.exclude),
|
|
2154
|
+
JSON.stringify(source.optIn ?? []),
|
|
1722
2155
|
createdAt
|
|
1723
2156
|
);
|
|
1724
|
-
return { ...source, root, projectId, createdAt };
|
|
2157
|
+
return { ...source, optIn: source.optIn ?? [], root, projectId, createdAt };
|
|
1725
2158
|
}
|
|
1726
2159
|
removeSource(projectId, sourceId) {
|
|
1727
2160
|
this.db.prepare("DELETE FROM sources WHERE project_id = ? AND id = ?").run(projectId, sourceId);
|
|
@@ -1734,6 +2167,7 @@ CREATE TABLE IF NOT EXISTS sources (
|
|
|
1734
2167
|
root: r.root,
|
|
1735
2168
|
include: JSON.parse(r.include),
|
|
1736
2169
|
exclude: JSON.parse(r.exclude),
|
|
2170
|
+
optIn: JSON.parse(r.opt_in ?? "[]"),
|
|
1737
2171
|
createdAt: r.created_at
|
|
1738
2172
|
}));
|
|
1739
2173
|
}
|
|
@@ -1764,7 +2198,7 @@ CREATE TABLE IF NOT EXISTS sources (
|
|
|
1764
2198
|
|
|
1765
2199
|
// packages/store/src/index.ts
|
|
1766
2200
|
import { mkdirSync as mkdirSync3 } from "node:fs";
|
|
1767
|
-
import { join as
|
|
2201
|
+
import { join as join6 } from "node:path";
|
|
1768
2202
|
var GraphRepository;
|
|
1769
2203
|
var init_src2 = __esm({
|
|
1770
2204
|
"packages/store/src/index.ts"() {
|
|
@@ -1778,8 +2212,8 @@ var init_src2 = __esm({
|
|
|
1778
2212
|
GraphRepository = class {
|
|
1779
2213
|
openProject(projectId, dir, options = {}) {
|
|
1780
2214
|
mkdirSync3(dir, { recursive: true });
|
|
1781
|
-
const store = new ProjectStore(projectId,
|
|
1782
|
-
const evidence = new EvidenceStore(
|
|
2215
|
+
const store = new ProjectStore(projectId, join6(dir, "graph.sqlite"), options);
|
|
2216
|
+
const evidence = new EvidenceStore(join6(dir, "evidence"));
|
|
1783
2217
|
return { store, evidence, close: () => store.close() };
|
|
1784
2218
|
}
|
|
1785
2219
|
};
|
|
@@ -1812,7 +2246,9 @@ function executeRun(request) {
|
|
|
1812
2246
|
queue.tail = next.catch(() => void 0);
|
|
1813
2247
|
return next;
|
|
1814
2248
|
}
|
|
1815
|
-
function sourcesOf(plans) {
|
|
2249
|
+
function sourcesOf(plans, request) {
|
|
2250
|
+
const specs = request.sources;
|
|
2251
|
+
const maxFileBytes = request.planOptions?.maxFileBytes ?? DEFAULT_MAX_FILE_BYTES;
|
|
1816
2252
|
return plans.map((p) => ({
|
|
1817
2253
|
sourceId: p.sourceId,
|
|
1818
2254
|
revision: p.revision,
|
|
@@ -1821,9 +2257,20 @@ function sourcesOf(plans) {
|
|
|
1821
2257
|
...p.kind === "git" ? { dirty: p.dirty } : {},
|
|
1822
2258
|
...p.unpinned.length ? { unpinned: p.unpinned } : {},
|
|
1823
2259
|
...p.unsupported.length ? { unsupported: p.unsupported } : {},
|
|
2260
|
+
...filterOf(specs.find((s) => s.id === p.sourceId)),
|
|
2261
|
+
maxFileBytes,
|
|
2262
|
+
...p.defaultExcluded.length ? { defaultExcluded: p.defaultExcluded } : {},
|
|
2263
|
+
...p.ruleExcluded.length ? { ruleExcluded: p.ruleExcluded } : {},
|
|
2264
|
+
...p.ruleExcludedMore ? { ruleExcludedMore: p.ruleExcludedMore } : {},
|
|
1824
2265
|
...p.notices.length ? { notices: p.notices } : {}
|
|
1825
2266
|
}));
|
|
1826
2267
|
}
|
|
2268
|
+
function filterOf(spec) {
|
|
2269
|
+
if (!spec) return {};
|
|
2270
|
+
const optIn = spec.optIn ?? [];
|
|
2271
|
+
if (spec.include.length === 0 && spec.exclude.length === 0 && optIn.length === 0) return {};
|
|
2272
|
+
return { filter: { include: spec.include, exclude: spec.exclude, optIn } };
|
|
2273
|
+
}
|
|
1827
2274
|
async function runNow(request) {
|
|
1828
2275
|
const { projectId, store } = request;
|
|
1829
2276
|
const trigger = request.trigger ?? "manual";
|
|
@@ -1848,7 +2295,7 @@ async function runNow(request) {
|
|
|
1848
2295
|
planError = e;
|
|
1849
2296
|
}
|
|
1850
2297
|
try {
|
|
1851
|
-
run = store.beginRun({ trigger, sources: sourcesOf(plans) });
|
|
2298
|
+
run = store.beginRun({ trigger, sources: sourcesOf(plans, request) });
|
|
1852
2299
|
break;
|
|
1853
2300
|
} catch (e) {
|
|
1854
2301
|
if (!(e instanceof ProjectLockedError)) throw e;
|
|
@@ -1869,7 +2316,7 @@ async function runNow(request) {
|
|
|
1869
2316
|
}
|
|
1870
2317
|
let current = "plan";
|
|
1871
2318
|
try {
|
|
1872
|
-
emit({ type: "run.started", projectId, runId: run.runId, trigger, sources: sourcesOf(plans) });
|
|
2319
|
+
emit({ type: "run.started", projectId, runId: run.runId, trigger, sources: sourcesOf(plans, request) });
|
|
1873
2320
|
if (planError) throw planError;
|
|
1874
2321
|
for (const stage of request.stages) {
|
|
1875
2322
|
current = stage.name;
|
|
@@ -1932,6 +2379,7 @@ var init_run = __esm({
|
|
|
1932
2379
|
var init_src3 = __esm({
|
|
1933
2380
|
"packages/planner/src/index.ts"() {
|
|
1934
2381
|
"use strict";
|
|
2382
|
+
init_browse();
|
|
1935
2383
|
init_classify();
|
|
1936
2384
|
init_glob();
|
|
1937
2385
|
init_plan();
|
|
@@ -1973,7 +2421,7 @@ var PROTOCOL_VERSION;
|
|
|
1973
2421
|
var init_protocol = __esm({
|
|
1974
2422
|
"protocol/index.ts"() {
|
|
1975
2423
|
"use strict";
|
|
1976
|
-
PROTOCOL_VERSION = "1.
|
|
2424
|
+
PROTOCOL_VERSION = "1.2.0";
|
|
1977
2425
|
}
|
|
1978
2426
|
});
|
|
1979
2427
|
|
|
@@ -2002,7 +2450,9 @@ function factsForFile(sourceId, file2, result2) {
|
|
|
2002
2450
|
language: file2.language,
|
|
2003
2451
|
contentHash: file2.contentHash,
|
|
2004
2452
|
status: "not_analyzed",
|
|
2005
|
-
...file2.commit ? { commit: file2.commit } : {}
|
|
2453
|
+
...file2.commit ? { commit: file2.commit } : {},
|
|
2454
|
+
...file2.origin ? { origin: file2.origin } : {},
|
|
2455
|
+
...file2.skip === "too-large" ? { size: file2.size } : {}
|
|
2006
2456
|
};
|
|
2007
2457
|
if (!result2 && !file2.skip) {
|
|
2008
2458
|
node2.reason = "adapter-no-result";
|
|
@@ -2049,6 +2499,7 @@ function factsForFile(sourceId, file2, result2) {
|
|
|
2049
2499
|
isGenerator: d.isGenerator,
|
|
2050
2500
|
implicit: d.implicit,
|
|
2051
2501
|
overloads: d.overloads,
|
|
2502
|
+
...d.title ? { title: d.title } : {},
|
|
2052
2503
|
evidence: evidence(d.span)
|
|
2053
2504
|
};
|
|
2054
2505
|
facts.push(fn);
|
|
@@ -2180,7 +2631,7 @@ var init_readback = __esm({
|
|
|
2180
2631
|
// packages/stages/src/template-link.ts
|
|
2181
2632
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
2182
2633
|
import { existsSync as existsSync5 } from "node:fs";
|
|
2183
|
-
import { join as
|
|
2634
|
+
import { join as join7, posix, relative as relative2, sep as sep4 } from "node:path";
|
|
2184
2635
|
function runTemplateLink(ctx) {
|
|
2185
2636
|
const view = ctx.view;
|
|
2186
2637
|
const files = view.facts("File");
|
|
@@ -2204,7 +2655,7 @@ function runTemplateLink(ctx) {
|
|
|
2204
2655
|
revision: p.revision
|
|
2205
2656
|
}));
|
|
2206
2657
|
const exists = (r, rel) => {
|
|
2207
|
-
if (r.kind !== "git") return existsSync5(
|
|
2658
|
+
if (r.kind !== "git") return existsSync5(join7(r.root, ...rel.split("/")));
|
|
2208
2659
|
try {
|
|
2209
2660
|
execFileSync2("git", ["-C", r.root, "cat-file", "-e", `${r.revision}:./${rel}`], { stdio: "ignore" });
|
|
2210
2661
|
return true;
|
|
@@ -2225,11 +2676,11 @@ function runTemplateLink(ctx) {
|
|
|
2225
2676
|
return { kind: ownerRoot && exists(ownerRoot, rel) ? "not-analyzed" : "not-found" };
|
|
2226
2677
|
}
|
|
2227
2678
|
if (ownerRoot) {
|
|
2228
|
-
const abs =
|
|
2679
|
+
const abs = join7(ownerRoot.root, ...owner.path.split("/").slice(0, -1), ...d.specifier.split("/"));
|
|
2229
2680
|
for (const r of roots) {
|
|
2230
2681
|
const inside = relative2(r.root, abs);
|
|
2231
|
-
if (inside && !inside.startsWith("..") && !inside.startsWith(
|
|
2232
|
-
const inRel = inside.split(
|
|
2682
|
+
if (inside && !inside.startsWith("..") && !inside.startsWith(sep4) && !/^[a-zA-Z]:/.test(inside)) {
|
|
2683
|
+
const inRel = inside.split(sep4).join("/");
|
|
2233
2684
|
const file2 = fileById.get(ids.file(r.source, inRel));
|
|
2234
2685
|
if (file2)
|
|
2235
2686
|
return file2.language === "angular-template" ? { kind: "file", file: file2 } : { kind: "not-analyzed" };
|
|
@@ -2370,6 +2821,19 @@ function visibleSites(facts, reader) {
|
|
|
2370
2821
|
if (reader) for (const e of reader.facts("CALLS_CROSS_FILE")) linked.add(e.evidence.file);
|
|
2371
2822
|
return sites.filter((s) => !(s.reason === "template-binding" && !s.component && linked.has(s.file)));
|
|
2372
2823
|
}
|
|
2824
|
+
function byCodePoint(a, b) {
|
|
2825
|
+
const n = Math.min(a.length, b.length);
|
|
2826
|
+
for (let i = 0; i < n; i++) {
|
|
2827
|
+
const x = a.charCodeAt(i);
|
|
2828
|
+
const y = b.charCodeAt(i);
|
|
2829
|
+
if (x === y) continue;
|
|
2830
|
+
const sx = x >= 55296 && x <= 57343;
|
|
2831
|
+
const sy = y >= 55296 && y <= 57343;
|
|
2832
|
+
if (sx !== sy) return sx ? 1 : -1;
|
|
2833
|
+
return x < y ? -1 : 1;
|
|
2834
|
+
}
|
|
2835
|
+
return a.length === b.length ? 0 : a.length < b.length ? -1 : 1;
|
|
2836
|
+
}
|
|
2373
2837
|
function checkLimit(limit, fallback, max) {
|
|
2374
2838
|
if (limit === void 0) return fallback;
|
|
2375
2839
|
if (!Number.isInteger(limit) || limit < 1)
|
|
@@ -2378,7 +2842,7 @@ function checkLimit(limit, fallback, max) {
|
|
|
2378
2842
|
});
|
|
2379
2843
|
return Math.min(limit, max);
|
|
2380
2844
|
}
|
|
2381
|
-
var GROUP_BY, SEARCH_LIMIT, SEARCH_MAX, AGGREGATE_MAX, OUTLINE_MAX,
|
|
2845
|
+
var GROUP_BY, SEARCH_LIMIT, SEARCH_MAX, AGGREGATE_MAX, OUTLINE_MAX, sleep2, MB, MAX_FILE_MB_CAP, normalizePath2, slug2, Engine;
|
|
2382
2846
|
var init_engine = __esm({
|
|
2383
2847
|
"packages/query/src/engine.ts"() {
|
|
2384
2848
|
"use strict";
|
|
@@ -2396,8 +2860,10 @@ var init_engine = __esm({
|
|
|
2396
2860
|
SEARCH_MAX = 100;
|
|
2397
2861
|
AGGREGATE_MAX = 50;
|
|
2398
2862
|
OUTLINE_MAX = 500;
|
|
2399
|
-
byCodePoint = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
2400
2863
|
sleep2 = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
2864
|
+
MB = 1024 * 1024;
|
|
2865
|
+
MAX_FILE_MB_CAP = 64;
|
|
2866
|
+
normalizePath2 = (p) => p.replace(/\\/g, "/").replace(/^\.?\/+|\/+$/g, "");
|
|
2401
2867
|
slug2 = (s) => s.toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^[-.]+|-+$/g, "").slice(0, 48) || "source";
|
|
2402
2868
|
Engine = class {
|
|
2403
2869
|
catalog;
|
|
@@ -2507,6 +2973,86 @@ var init_engine = __esm({
|
|
|
2507
2973
|
const project2 = this.resolveProject(args, cwd);
|
|
2508
2974
|
return { sources: this.catalog.listSources(project2.id) };
|
|
2509
2975
|
}
|
|
2976
|
+
/**
|
|
2977
|
+
* Change which files a source analyzes (plan D36): its include and exclude
|
|
2978
|
+
* rules, and the paths chosen despite a rule, a default-excluded folder or
|
|
2979
|
+
* the size limit. Takes effect at the next run; each list given replaces
|
|
2980
|
+
* the old one.
|
|
2981
|
+
*/
|
|
2982
|
+
updateSource(args, cwd) {
|
|
2983
|
+
if (!args.source) throw new VeoError("invalid-arguments", "source is required", { fields: ["source"] });
|
|
2984
|
+
const bad = ["include", "exclude", "optIn"].filter(
|
|
2985
|
+
(k) => args[k] !== void 0 && !(Array.isArray(args[k]) && args[k].every((p) => typeof p === "string" && p !== ""))
|
|
2986
|
+
);
|
|
2987
|
+
if (bad.length)
|
|
2988
|
+
throw new VeoError("invalid-arguments", `${bad.join(", ")} must be lists of paths`, { fields: bad });
|
|
2989
|
+
const project2 = this.resolveProject(args, cwd);
|
|
2990
|
+
const rules = {
|
|
2991
|
+
...args.include ? { include: args.include } : {},
|
|
2992
|
+
...args.exclude ? { exclude: args.exclude } : {},
|
|
2993
|
+
...args.optIn ? { optIn: args.optIn.map(normalizePath2) } : {}
|
|
2994
|
+
};
|
|
2995
|
+
return { source: this.catalog.updateSource(project2.id, args.source, rules) };
|
|
2996
|
+
}
|
|
2997
|
+
/**
|
|
2998
|
+
* Check (`selected`) or uncheck files and folders, as the file picker and
|
|
2999
|
+
* `veoflow include`/`exclude` do (plan D36): the source's rules are changed
|
|
3000
|
+
* so the next run analyzes, or leaves out, exactly those paths.
|
|
3001
|
+
*/
|
|
3002
|
+
select(args, cwd) {
|
|
3003
|
+
if (!Array.isArray(args.paths) || args.paths.length === 0 || !args.paths.every((p) => typeof p === "string"))
|
|
3004
|
+
throw new VeoError("invalid-arguments", "paths must be a non-empty list", { fields: ["paths"] });
|
|
3005
|
+
if (typeof args.selected !== "boolean")
|
|
3006
|
+
throw new VeoError("invalid-arguments", "selected must be true or false", { fields: ["selected"] });
|
|
3007
|
+
const project2 = this.resolveProject(args, cwd);
|
|
3008
|
+
const source = this.catalog.listSources(project2.id).find((s) => s.id === args.source);
|
|
3009
|
+
if (!source)
|
|
3010
|
+
throw new VeoError("not-found", `no source ${args.source} in ${project2.id}`, {
|
|
3011
|
+
kind: "source",
|
|
3012
|
+
id: args.source
|
|
3013
|
+
});
|
|
3014
|
+
const maxFileBytes = this.catalog.projectSettings(project2.id).maxFileMB * MB;
|
|
3015
|
+
const rules = applySelection(source, args.paths, args.selected, { maxFileBytes });
|
|
3016
|
+
return { source: this.catalog.updateSource(project2.id, source.id, rules) };
|
|
3017
|
+
}
|
|
3018
|
+
/** The project's analysis settings (plan D37). */
|
|
3019
|
+
projectSettings(args, cwd) {
|
|
3020
|
+
const project2 = this.resolveProject(args, cwd);
|
|
3021
|
+
return { project: project2.id, settings: this.catalog.projectSettings(project2.id) };
|
|
3022
|
+
}
|
|
3023
|
+
setProjectSettings(args, cwd) {
|
|
3024
|
+
const mb = args.settings?.maxFileMB;
|
|
3025
|
+
if (mb !== void 0 && !(typeof mb === "number" && Number.isFinite(mb) && mb > 0 && mb <= MAX_FILE_MB_CAP))
|
|
3026
|
+
throw new VeoError("invalid-arguments", `maxFileMB must be a number between 0 and ${MAX_FILE_MB_CAP}`, {
|
|
3027
|
+
fields: ["maxFileMB"]
|
|
3028
|
+
});
|
|
3029
|
+
const project2 = this.resolveProject(args, cwd);
|
|
3030
|
+
return {
|
|
3031
|
+
project: project2.id,
|
|
3032
|
+
settings: this.catalog.setProjectSettings(project2.id, mb === void 0 ? {} : { maxFileMB: mb })
|
|
3033
|
+
};
|
|
3034
|
+
}
|
|
3035
|
+
/**
|
|
3036
|
+
* One folder of a source, with what the next run would do with each entry
|
|
3037
|
+
* (plan D36): how the UI browses folders the last run left out.
|
|
3038
|
+
*/
|
|
3039
|
+
browse(args, cwd) {
|
|
3040
|
+
const project2 = this.resolveProject(args, cwd);
|
|
3041
|
+
const source = this.catalog.listSources(project2.id).find((s) => s.id === args.source);
|
|
3042
|
+
if (!source)
|
|
3043
|
+
throw new VeoError("not-found", `no source ${args.source} in ${project2.id}`, {
|
|
3044
|
+
kind: "source",
|
|
3045
|
+
id: args.source
|
|
3046
|
+
});
|
|
3047
|
+
const dir = normalizePath2(args.dir ?? "");
|
|
3048
|
+
const maxFileBytes = this.catalog.projectSettings(project2.id).maxFileMB * MB;
|
|
3049
|
+
return {
|
|
3050
|
+
project: project2.id,
|
|
3051
|
+
source: source.id,
|
|
3052
|
+
dir,
|
|
3053
|
+
entries: listDirectory(source, dir, { maxFileBytes })
|
|
3054
|
+
};
|
|
3055
|
+
}
|
|
2510
3056
|
// -------------------------------------------------------------------------
|
|
2511
3057
|
// runs
|
|
2512
3058
|
runProject(project2, onStarted) {
|
|
@@ -2521,6 +3067,7 @@ var init_engine = __esm({
|
|
|
2521
3067
|
evidence,
|
|
2522
3068
|
sources,
|
|
2523
3069
|
stages: [stage1, templateLink],
|
|
3070
|
+
planOptions: { maxFileBytes: this.catalog.projectSettings(project2.id).maxFileMB * MB },
|
|
2524
3071
|
onEvent: (e) => {
|
|
2525
3072
|
if (e.type === "run.started") onStarted?.(e.runId);
|
|
2526
3073
|
this.events.emit("event", e);
|
|
@@ -2630,6 +3177,7 @@ var init_engine = __esm({
|
|
|
2630
3177
|
isGenerator: f.isGenerator,
|
|
2631
3178
|
implicit: f.implicit,
|
|
2632
3179
|
overloads: f.overloads,
|
|
3180
|
+
...f.title ? { title: f.title } : {},
|
|
2633
3181
|
evidence: f.evidence
|
|
2634
3182
|
};
|
|
2635
3183
|
}
|
|
@@ -2642,7 +3190,8 @@ var init_engine = __esm({
|
|
|
2642
3190
|
id: otherId,
|
|
2643
3191
|
qualifiedName: other?.qualifiedName ?? otherId,
|
|
2644
3192
|
path,
|
|
2645
|
-
...other ? { line: other.evidence.span.start.line } : {}
|
|
3193
|
+
...other ? { line: other.evidence.span.start.line } : {},
|
|
3194
|
+
...other?.title ? { title: other.title } : {}
|
|
2646
3195
|
},
|
|
2647
3196
|
form: edge.form,
|
|
2648
3197
|
resolution: edge.resolution,
|
|
@@ -2748,7 +3297,12 @@ var init_engine = __esm({
|
|
|
2748
3297
|
for (const fn of reader.facts("Function")) {
|
|
2749
3298
|
const path = pathOf.get(fn.file) ?? "";
|
|
2750
3299
|
if (prefix && !path.startsWith(prefix)) continue;
|
|
2751
|
-
|
|
3300
|
+
let score = rank(fn.qualifiedName, fn.name, path);
|
|
3301
|
+
if (fn.title && text) {
|
|
3302
|
+
const t = fn.title.toLowerCase();
|
|
3303
|
+
const byTitle = t === text ? 0 : t.startsWith(text) ? 1 : t.includes(text) ? 2 : -1;
|
|
3304
|
+
if (byTitle >= 0) score = score < 0 ? byTitle : Math.min(score, byTitle);
|
|
3305
|
+
}
|
|
2752
3306
|
if (score >= 0) scored.push({ score, path, id: fn.id });
|
|
2753
3307
|
}
|
|
2754
3308
|
}
|
|
@@ -2783,7 +3337,8 @@ var init_engine = __esm({
|
|
|
2783
3337
|
callees: outgoing.get(id)?.functions ?? 0,
|
|
2784
3338
|
callsIn: incoming.get(id)?.calls ?? 0,
|
|
2785
3339
|
callsOut: outgoing.get(id)?.calls ?? 0,
|
|
2786
|
-
evidence: fn.evidence
|
|
3340
|
+
evidence: fn.evidence,
|
|
3341
|
+
...fn.title ? { title: fn.title } : {}
|
|
2787
3342
|
};
|
|
2788
3343
|
});
|
|
2789
3344
|
}
|
|
@@ -2800,7 +3355,9 @@ var init_engine = __esm({
|
|
|
2800
3355
|
* Counts grouped by a property (generic graph tool `aggregate`, design §12
|
|
2801
3356
|
* A3, limited to R1's labels). Sorted by count, then key in code-point
|
|
2802
3357
|
* order; at most 50 groups. `filters.open` limits unresolved call sites to
|
|
2803
|
-
* open questions (design A6); `filters.path` to files under a path prefix
|
|
3358
|
+
* open questions (design A6); `filters.path` to files under a path prefix;
|
|
3359
|
+
* `filters.ownCode` leaves out library, generated and tool files the user chose to
|
|
3360
|
+
* analyze (`File.origin`, plan D36).
|
|
2804
3361
|
*/
|
|
2805
3362
|
aggregate(args, cwd) {
|
|
2806
3363
|
const project2 = this.resolveProject(args, cwd);
|
|
@@ -2823,14 +3380,15 @@ var init_engine = __esm({
|
|
|
2823
3380
|
const prefix = args.filters?.path;
|
|
2824
3381
|
const files = reader.facts("File");
|
|
2825
3382
|
const pathOf = new Map(files.map((f) => [f.id, f.path]));
|
|
2826
|
-
const
|
|
3383
|
+
const foreign = new Set(args.filters?.ownCode ? files.filter((f) => f.origin).map((f) => f.id) : []);
|
|
3384
|
+
const inPath = (fileId) => !foreign.has(fileId) && (!prefix || (pathOf.get(fileId) ?? "").startsWith(prefix));
|
|
2827
3385
|
const counts = /* @__PURE__ */ new Map();
|
|
2828
3386
|
const add = (key) => counts.set(key, (counts.get(key) ?? 0) + 1);
|
|
2829
3387
|
let named;
|
|
2830
3388
|
const fnName = (key) => reader.fact(key)?.qualifiedName;
|
|
2831
3389
|
if (args.label === "File") {
|
|
2832
3390
|
for (const f of files) {
|
|
2833
|
-
if (
|
|
3391
|
+
if (!inPath(f.id)) continue;
|
|
2834
3392
|
const folder = f.path.includes("/") ? f.path.slice(0, f.path.lastIndexOf("/")) : ".";
|
|
2835
3393
|
const value = { status: f.status, language: f.language ?? "none", source: f.source, folder }[args.groupBy];
|
|
2836
3394
|
add(String(value));
|
|
@@ -2848,7 +3406,7 @@ var init_engine = __esm({
|
|
|
2848
3406
|
add(String({ reason: site.reason, status: site.status, file: site.file }[args.groupBy]));
|
|
2849
3407
|
}
|
|
2850
3408
|
if (args.groupBy === "file") named = (key) => pathOf.get(key);
|
|
2851
|
-
} else if ((args.groupBy === "to" || args.groupBy === "from") && !prefix) {
|
|
3409
|
+
} else if ((args.groupBy === "to" || args.groupBy === "from") && !prefix && foreign.size === 0) {
|
|
2852
3410
|
for (const [key, c] of reader.callCounts(args.groupBy === "to" ? "dst" : "src"))
|
|
2853
3411
|
counts.set(key, c.calls);
|
|
2854
3412
|
named = fnName;
|
|
@@ -2856,7 +3414,8 @@ var init_engine = __esm({
|
|
|
2856
3414
|
const fileOf = new Map(reader.facts("Function").map((f) => [f.id, f.file]));
|
|
2857
3415
|
for (const call of [...reader.facts("CALLS"), ...reader.facts("CALLS_CROSS_FILE")]) {
|
|
2858
3416
|
const owner = fileOf.get(call.from);
|
|
2859
|
-
if (prefix && (!owner || !inPath(owner))) continue;
|
|
3417
|
+
if ((prefix || foreign.size) && (!owner || !inPath(owner))) continue;
|
|
3418
|
+
if (foreign.size && foreign.has(fileOf.get(call.to) ?? "")) continue;
|
|
2860
3419
|
add(
|
|
2861
3420
|
String(
|
|
2862
3421
|
{ to: call.to, from: call.from, form: call.form, resolution: call.resolution }[args.groupBy]
|
|
@@ -35635,49 +36194,49 @@ var require_fast_uri = __commonJS({
|
|
|
35635
36194
|
schemelessOptions.skipEscape = true;
|
|
35636
36195
|
return serialize(resolved, schemelessOptions);
|
|
35637
36196
|
}
|
|
35638
|
-
function resolveComponent(base,
|
|
36197
|
+
function resolveComponent(base, relative4, options, skipNormalization) {
|
|
35639
36198
|
const target2 = {};
|
|
35640
36199
|
if (!skipNormalization) {
|
|
35641
36200
|
base = parse4(serialize(base, options), options);
|
|
35642
|
-
|
|
36201
|
+
relative4 = parse4(serialize(relative4, options), options);
|
|
35643
36202
|
}
|
|
35644
36203
|
options = options || {};
|
|
35645
|
-
if (!options.tolerant &&
|
|
35646
|
-
target2.scheme =
|
|
35647
|
-
target2.userinfo =
|
|
35648
|
-
target2.host =
|
|
35649
|
-
target2.port =
|
|
35650
|
-
target2.path = removeDotSegments(
|
|
35651
|
-
target2.query =
|
|
36204
|
+
if (!options.tolerant && relative4.scheme) {
|
|
36205
|
+
target2.scheme = relative4.scheme;
|
|
36206
|
+
target2.userinfo = relative4.userinfo;
|
|
36207
|
+
target2.host = relative4.host;
|
|
36208
|
+
target2.port = relative4.port;
|
|
36209
|
+
target2.path = removeDotSegments(relative4.path || "");
|
|
36210
|
+
target2.query = relative4.query;
|
|
35652
36211
|
} else {
|
|
35653
|
-
if (
|
|
35654
|
-
target2.userinfo =
|
|
35655
|
-
target2.host =
|
|
35656
|
-
target2.port =
|
|
35657
|
-
target2.path = removeDotSegments(
|
|
35658
|
-
target2.query =
|
|
36212
|
+
if (relative4.userinfo !== void 0 || relative4.host !== void 0 || relative4.port !== void 0) {
|
|
36213
|
+
target2.userinfo = relative4.userinfo;
|
|
36214
|
+
target2.host = relative4.host;
|
|
36215
|
+
target2.port = relative4.port;
|
|
36216
|
+
target2.path = removeDotSegments(relative4.path || "");
|
|
36217
|
+
target2.query = relative4.query;
|
|
35659
36218
|
} else {
|
|
35660
|
-
if (!
|
|
36219
|
+
if (!relative4.path) {
|
|
35661
36220
|
target2.path = base.path;
|
|
35662
|
-
if (
|
|
35663
|
-
target2.query =
|
|
36221
|
+
if (relative4.query !== void 0) {
|
|
36222
|
+
target2.query = relative4.query;
|
|
35664
36223
|
} else {
|
|
35665
36224
|
target2.query = base.query;
|
|
35666
36225
|
}
|
|
35667
36226
|
} else {
|
|
35668
|
-
if (
|
|
35669
|
-
target2.path = removeDotSegments(
|
|
36227
|
+
if (relative4.path[0] === "/") {
|
|
36228
|
+
target2.path = removeDotSegments(relative4.path);
|
|
35670
36229
|
} else {
|
|
35671
36230
|
if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
|
|
35672
|
-
target2.path = "/" +
|
|
36231
|
+
target2.path = "/" + relative4.path;
|
|
35673
36232
|
} else if (!base.path) {
|
|
35674
|
-
target2.path =
|
|
36233
|
+
target2.path = relative4.path;
|
|
35675
36234
|
} else {
|
|
35676
|
-
target2.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) +
|
|
36235
|
+
target2.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative4.path;
|
|
35677
36236
|
}
|
|
35678
36237
|
target2.path = removeDotSegments(target2.path);
|
|
35679
36238
|
}
|
|
35680
|
-
target2.query =
|
|
36239
|
+
target2.query = relative4.query;
|
|
35681
36240
|
}
|
|
35682
36241
|
target2.userinfo = base.userinfo;
|
|
35683
36242
|
target2.host = base.host;
|
|
@@ -35685,7 +36244,7 @@ var require_fast_uri = __commonJS({
|
|
|
35685
36244
|
}
|
|
35686
36245
|
target2.scheme = base.scheme;
|
|
35687
36246
|
}
|
|
35688
|
-
target2.fragment =
|
|
36247
|
+
target2.fragment = relative4.fragment;
|
|
35689
36248
|
return target2;
|
|
35690
36249
|
}
|
|
35691
36250
|
function equal(uriA, uriB, options) {
|
|
@@ -40815,6 +41374,47 @@ var init_server3 = __esm({
|
|
|
40815
41374
|
input: { project },
|
|
40816
41375
|
call: (e, a, cwd) => e.listSources(a, cwd)
|
|
40817
41376
|
},
|
|
41377
|
+
update_source: {
|
|
41378
|
+
description: "Change which files a source analyzes; takes effect at the next run (analyze_files). Each list given replaces the source's old one. Patterns are globs relative to the source root; a rule with a leading '/' is one exact path from the root ('/src/legacy/' is that folder; '*', '{' and '[' are part of the name). optIn lists files or folders to analyze despite an exclude rule, a default-excluded folder (node_modules, dist, .claude, \u2026: library, generated or tool code) or the size limit.",
|
|
41379
|
+
input: {
|
|
41380
|
+
project,
|
|
41381
|
+
source: external_exports.string().describe("Source id, as returned by list_sources"),
|
|
41382
|
+
include: external_exports.array(external_exports.string()).optional().describe("Glob patterns to include (empty: everything)"),
|
|
41383
|
+
exclude: external_exports.array(external_exports.string()).optional().describe("Glob patterns to exclude"),
|
|
41384
|
+
optIn: external_exports.array(external_exports.string()).optional().describe("Paths (files or folders) to analyze anyway")
|
|
41385
|
+
},
|
|
41386
|
+
call: (e, a, cwd) => e.updateSource(a, cwd)
|
|
41387
|
+
},
|
|
41388
|
+
select_files: {
|
|
41389
|
+
description: "Check (selected: true) or uncheck files and folders of a source, as the UI's file picker and `veoflow include`/`exclude` do: the source's rules are changed so the next run analyzes, or leaves out, exactly those paths (the most specific choice wins). Checking a library, generated or tool folder (node_modules, dist, .claude, \u2026) or a file over the size limit includes it; its files are then marked with that origin. Paths are relative to the source root.",
|
|
41390
|
+
input: {
|
|
41391
|
+
project,
|
|
41392
|
+
source: external_exports.string().describe("Source id, as returned by list_sources"),
|
|
41393
|
+
paths: external_exports.array(external_exports.string()).describe("Files or folders, relative to the source root"),
|
|
41394
|
+
selected: external_exports.boolean().describe("true to analyze them, false to leave them out")
|
|
41395
|
+
},
|
|
41396
|
+
call: (e, a, cwd) => e.select(a, cwd)
|
|
41397
|
+
},
|
|
41398
|
+
browse_source: {
|
|
41399
|
+
description: "One folder of a source (git: the last commit) with what the next run would do with each entry: excludedBy (rule, library, generated, too-large) when it would be left out, optedIn when it was chosen anyway, notAnalyzable for files no choice makes analyzable.",
|
|
41400
|
+
input: {
|
|
41401
|
+
project,
|
|
41402
|
+
source: external_exports.string().describe("Source id, as returned by list_sources"),
|
|
41403
|
+
dir: external_exports.string().optional().describe("Folder relative to the source root (default: the root)")
|
|
41404
|
+
},
|
|
41405
|
+
call: (e, a, cwd) => e.browse(a, cwd)
|
|
41406
|
+
},
|
|
41407
|
+
project_settings: {
|
|
41408
|
+
description: "The project's analysis settings: maxFileMB, the per-file size limit (default 10; files over it are not analyzed unless chosen). Pass maxFileMB (up to 64) to change it; it applies at the next run.",
|
|
41409
|
+
input: { project, maxFileMB: external_exports.number().optional().describe("New size limit in MB") },
|
|
41410
|
+
call: (e, a, cwd) => a.maxFileMB === void 0 ? e.projectSettings(a, cwd) : e.setProjectSettings(
|
|
41411
|
+
{
|
|
41412
|
+
...a.project !== void 0 ? { project: a.project } : {},
|
|
41413
|
+
settings: { maxFileMB: a.maxFileMB }
|
|
41414
|
+
},
|
|
41415
|
+
cwd
|
|
41416
|
+
)
|
|
41417
|
+
},
|
|
40818
41418
|
run_status: {
|
|
40819
41419
|
description: "The project's last committed run, any run in progress, and the latest run's details.",
|
|
40820
41420
|
input: { project },
|
|
@@ -40867,7 +41467,7 @@ var init_server3 = __esm({
|
|
|
40867
41467
|
call: (e, a, cwd) => e.listUnresolvedSites(a, cwd)
|
|
40868
41468
|
},
|
|
40869
41469
|
search_nodes: {
|
|
40870
|
-
description:
|
|
41470
|
+
description: 'Find functions or files by name (generic graph tool). Ranked: exact name, then prefix, then anywhere in the qualified name or path; a test callback\'s title (it("adds an item", \u2026)) matches the same way, and the result carries it as `title`. Functions come with callers and callees (distinct functions) and callsIn/callsOut (calls). At most 100 results (default 20); `total` and `truncated` say how many matched.',
|
|
40871
41471
|
input: {
|
|
40872
41472
|
project,
|
|
40873
41473
|
label: external_exports.enum(["Function", "File"]),
|
|
@@ -40881,14 +41481,15 @@ var init_server3 = __esm({
|
|
|
40881
41481
|
call: (e, a, cwd) => e.searchNodes(a, cwd)
|
|
40882
41482
|
},
|
|
40883
41483
|
aggregate: {
|
|
40884
|
-
description: "Counts grouped by a property (generic graph tool): File by status|language|source|folder; Function by file|kind|exported; UnresolvedCallSite by reason|status|file (filters.open: true for open questions only); CALLS by to|from|form|resolution (CALLS by 'to' gives the most-called functions, Function by 'file' the largest files). Sorted by count; at most 50 groups (limit lowers it).",
|
|
41484
|
+
description: "Counts grouped by a property (generic graph tool): File by status|language|source|folder; Function by file|kind|exported; UnresolvedCallSite by reason|status|file (filters.open: true for open questions only); CALLS by to|from|form|resolution (CALLS by 'to' gives the most-called functions, Function by 'file' the largest files; add filters.ownCode: true to leave out library, generated and tool code). Sorted by count; at most 50 groups (limit lowers it).",
|
|
40885
41485
|
input: {
|
|
40886
41486
|
project,
|
|
40887
41487
|
label: external_exports.enum(["File", "Function", "UnresolvedCallSite", "CALLS"]),
|
|
40888
41488
|
groupBy: external_exports.string().min(1),
|
|
40889
41489
|
filters: external_exports.object({
|
|
40890
41490
|
path: external_exports.string().min(1).optional().describe("Only facts in files whose path starts with this prefix"),
|
|
40891
|
-
open: external_exports.boolean().optional().describe("UnresolvedCallSite only: open questions only")
|
|
41491
|
+
open: external_exports.boolean().optional().describe("UnresolvedCallSite only: open questions only"),
|
|
41492
|
+
ownCode: external_exports.boolean().optional().describe("Leave out library, generated and tool files the user chose to analyze (File.origin)")
|
|
40892
41493
|
}).optional(),
|
|
40893
41494
|
limit: external_exports.number().int().positive().optional()
|
|
40894
41495
|
},
|
|
@@ -44867,7 +45468,7 @@ var require_parseTokenList = __commonJS({
|
|
|
44867
45468
|
// node_modules/.pnpm/depd@2.0.0/node_modules/depd/index.js
|
|
44868
45469
|
var require_depd = __commonJS({
|
|
44869
45470
|
"node_modules/.pnpm/depd@2.0.0/node_modules/depd/index.js"(exports, module) {
|
|
44870
|
-
var
|
|
45471
|
+
var relative4 = __require("path").relative;
|
|
44871
45472
|
module.exports = depd;
|
|
44872
45473
|
var basePath = process.cwd();
|
|
44873
45474
|
function containsNamespace(str3, namespace) {
|
|
@@ -45059,7 +45660,7 @@ var require_depd = __commonJS({
|
|
|
45059
45660
|
return formatted;
|
|
45060
45661
|
}
|
|
45061
45662
|
function formatLocation(callSite) {
|
|
45062
|
-
return
|
|
45663
|
+
return relative4(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
|
|
45063
45664
|
}
|
|
45064
45665
|
function getStack() {
|
|
45065
45666
|
var limit = Error.stackTraceLimit;
|
|
@@ -45592,10 +46193,10 @@ var require_send = __commonJS({
|
|
|
45592
46193
|
var { parseTokenList } = require_parseTokenList();
|
|
45593
46194
|
var { createHttpError } = require_createHttpError();
|
|
45594
46195
|
var extname = path.extname;
|
|
45595
|
-
var
|
|
46196
|
+
var join11 = path.join;
|
|
45596
46197
|
var normalize2 = path.normalize;
|
|
45597
46198
|
var resolve5 = path.resolve;
|
|
45598
|
-
var
|
|
46199
|
+
var sep6 = path.sep;
|
|
45599
46200
|
var Readable = stream.Readable;
|
|
45600
46201
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
45601
46202
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
|
|
@@ -45661,7 +46262,7 @@ var require_send = __commonJS({
|
|
|
45661
46262
|
end: options.end
|
|
45662
46263
|
};
|
|
45663
46264
|
}
|
|
45664
|
-
function
|
|
46265
|
+
function normalizePath3(_path, root) {
|
|
45665
46266
|
let path2 = decode3(_path);
|
|
45666
46267
|
if (path2 == null) {
|
|
45667
46268
|
return { statusCode: 400 };
|
|
@@ -45672,20 +46273,20 @@ var require_send = __commonJS({
|
|
|
45672
46273
|
let parts;
|
|
45673
46274
|
if (root !== null) {
|
|
45674
46275
|
if (path2) {
|
|
45675
|
-
path2 = normalize2("." +
|
|
46276
|
+
path2 = normalize2("." + sep6 + path2);
|
|
45676
46277
|
}
|
|
45677
46278
|
if (UP_PATH_REGEXP.test(path2)) {
|
|
45678
46279
|
debug('malicious path "%s"', path2);
|
|
45679
46280
|
return { statusCode: 403 };
|
|
45680
46281
|
}
|
|
45681
|
-
parts = path2.split(
|
|
45682
|
-
path2 = normalize2(
|
|
46282
|
+
parts = path2.split(sep6);
|
|
46283
|
+
path2 = normalize2(join11(root, path2));
|
|
45683
46284
|
} else {
|
|
45684
46285
|
if (UP_PATH_REGEXP.test(path2)) {
|
|
45685
46286
|
debug('malicious path "%s"', path2);
|
|
45686
46287
|
return { statusCode: 403 };
|
|
45687
46288
|
}
|
|
45688
|
-
parts = normalize2(path2).split(
|
|
46289
|
+
parts = normalize2(path2).split(sep6);
|
|
45689
46290
|
path2 = resolve5(path2);
|
|
45690
46291
|
}
|
|
45691
46292
|
return { path: path2, parts };
|
|
@@ -45962,7 +46563,7 @@ var require_send = __commonJS({
|
|
|
45962
46563
|
let err;
|
|
45963
46564
|
for (let i = 0; i < options.index.length; i++) {
|
|
45964
46565
|
const index = options.index[i];
|
|
45965
|
-
const p =
|
|
46566
|
+
const p = join11(path2, index);
|
|
45966
46567
|
const { error: error62, stat } = await tryStat(p);
|
|
45967
46568
|
if (error62) {
|
|
45968
46569
|
err = error62;
|
|
@@ -45978,7 +46579,7 @@ var require_send = __commonJS({
|
|
|
45978
46579
|
}
|
|
45979
46580
|
async function sendFile(request, path2, options) {
|
|
45980
46581
|
const { error: error62, stat } = await tryStat(path2);
|
|
45981
|
-
if (error62 && error62.code === "ENOENT" && !extname(path2) && path2[path2.length - 1] !==
|
|
46582
|
+
if (error62 && error62.code === "ENOENT" && !extname(path2) && path2[path2.length - 1] !== sep6) {
|
|
45982
46583
|
let err = error62;
|
|
45983
46584
|
for (let i = 0; i < options.extensions.length; i++) {
|
|
45984
46585
|
const extension = options.extensions[i];
|
|
@@ -46006,7 +46607,7 @@ var require_send = __commonJS({
|
|
|
46006
46607
|
async function send(request, _path, options) {
|
|
46007
46608
|
const opts = normalizeOptions(options);
|
|
46008
46609
|
opts.path = _path;
|
|
46009
|
-
const parsed =
|
|
46610
|
+
const parsed = normalizePath3(_path, opts.root);
|
|
46010
46611
|
const { path: path2, parts } = parsed;
|
|
46011
46612
|
if (parsed.statusCode !== void 0) {
|
|
46012
46613
|
return sendError(parsed.statusCode);
|
|
@@ -51664,7 +52265,7 @@ var require_buffer_list = __commonJS({
|
|
|
51664
52265
|
}
|
|
51665
52266
|
}, {
|
|
51666
52267
|
key: "join",
|
|
51667
|
-
value: function
|
|
52268
|
+
value: function join11(s) {
|
|
51668
52269
|
if (this.length === 0) return "";
|
|
51669
52270
|
var p = this.head;
|
|
51670
52271
|
var ret = "" + p.data;
|
|
@@ -62347,7 +62948,7 @@ var require_thread_stream = __commonJS({
|
|
|
62347
62948
|
var { version: version3 } = require_package();
|
|
62348
62949
|
var { EventEmitter: EventEmitter2 } = __require("events");
|
|
62349
62950
|
var { Worker } = __require("worker_threads");
|
|
62350
|
-
var { join:
|
|
62951
|
+
var { join: join11 } = __require("path");
|
|
62351
62952
|
var { pathToFileURL } = __require("url");
|
|
62352
62953
|
var { wait } = require_wait();
|
|
62353
62954
|
var {
|
|
@@ -62398,7 +62999,7 @@ var require_thread_stream = __commonJS({
|
|
|
62398
62999
|
function createWorker(stream, opts) {
|
|
62399
63000
|
const { filename, workerData } = opts;
|
|
62400
63001
|
const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
|
|
62401
|
-
const toExecute = bundlerOverrides["thread-stream-worker"] ||
|
|
63002
|
+
const toExecute = bundlerOverrides["thread-stream-worker"] || join11(__dirname, "lib", "worker.js");
|
|
62402
63003
|
const worker = new Worker(toExecute, {
|
|
62403
63004
|
...opts.workerOpts,
|
|
62404
63005
|
name: opts.workerOpts?.name || "thread-stream",
|
|
@@ -62866,7 +63467,7 @@ var require_transport = __commonJS({
|
|
|
62866
63467
|
var { createRequire: createRequire3 } = __require("module");
|
|
62867
63468
|
var { existsSync: existsSync9 } = __require("node:fs");
|
|
62868
63469
|
var getCallers = require_caller();
|
|
62869
|
-
var { join:
|
|
63470
|
+
var { join: join11, isAbsolute: isAbsolute2, sep: sep6 } = __require("node:path");
|
|
62870
63471
|
var { fileURLToPath: fileURLToPath3 } = __require("node:url");
|
|
62871
63472
|
var sleep3 = require_atomic_sleep();
|
|
62872
63473
|
var onExit = require_on_exit_leak_free();
|
|
@@ -63019,7 +63620,7 @@ var require_transport = __commonJS({
|
|
|
63019
63620
|
throw new Error("only one of target or targets can be specified");
|
|
63020
63621
|
}
|
|
63021
63622
|
if (targets) {
|
|
63022
|
-
target2 = bundlerOverrides["pino-worker"] ||
|
|
63623
|
+
target2 = bundlerOverrides["pino-worker"] || join11(__dirname, "worker.js");
|
|
63023
63624
|
options.targets = targets.filter((dest) => dest.target).map((dest) => {
|
|
63024
63625
|
return {
|
|
63025
63626
|
...dest,
|
|
@@ -63037,7 +63638,7 @@ var require_transport = __commonJS({
|
|
|
63037
63638
|
});
|
|
63038
63639
|
});
|
|
63039
63640
|
} else if (pipeline) {
|
|
63040
|
-
target2 = bundlerOverrides["pino-worker"] ||
|
|
63641
|
+
target2 = bundlerOverrides["pino-worker"] || join11(__dirname, "worker.js");
|
|
63041
63642
|
options.pipelines = [pipeline.map((dest) => {
|
|
63042
63643
|
return {
|
|
63043
63644
|
...dest,
|
|
@@ -63060,12 +63661,12 @@ var require_transport = __commonJS({
|
|
|
63060
63661
|
return origin;
|
|
63061
63662
|
}
|
|
63062
63663
|
if (origin === "pino/file") {
|
|
63063
|
-
return
|
|
63664
|
+
return join11(__dirname, "..", "file.js");
|
|
63064
63665
|
}
|
|
63065
63666
|
let fixTarget2;
|
|
63066
63667
|
for (const filePath of callers2) {
|
|
63067
63668
|
try {
|
|
63068
|
-
const context = filePath === "node:repl" ? process.cwd() +
|
|
63669
|
+
const context = filePath === "node:repl" ? process.cwd() + sep6 : filePath;
|
|
63069
63670
|
fixTarget2 = createRequire3(context).resolve(origin);
|
|
63070
63671
|
break;
|
|
63071
63672
|
} catch (err) {
|
|
@@ -64040,7 +64641,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
64040
64641
|
return circularValue;
|
|
64041
64642
|
}
|
|
64042
64643
|
let res = "";
|
|
64043
|
-
let
|
|
64644
|
+
let join11 = ",";
|
|
64044
64645
|
const originalIndentation = indentation;
|
|
64045
64646
|
if (Array.isArray(value)) {
|
|
64046
64647
|
if (value.length === 0) {
|
|
@@ -64054,7 +64655,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
64054
64655
|
indentation += spacer;
|
|
64055
64656
|
res += `
|
|
64056
64657
|
${indentation}`;
|
|
64057
|
-
|
|
64658
|
+
join11 = `,
|
|
64058
64659
|
${indentation}`;
|
|
64059
64660
|
}
|
|
64060
64661
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -64062,13 +64663,13 @@ ${indentation}`;
|
|
|
64062
64663
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
64063
64664
|
const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
64064
64665
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
64065
|
-
res +=
|
|
64666
|
+
res += join11;
|
|
64066
64667
|
}
|
|
64067
64668
|
const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
64068
64669
|
res += tmp !== void 0 ? tmp : "null";
|
|
64069
64670
|
if (value.length - 1 > maximumBreadth) {
|
|
64070
64671
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
64071
|
-
res += `${
|
|
64672
|
+
res += `${join11}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
64072
64673
|
}
|
|
64073
64674
|
if (spacer !== "") {
|
|
64074
64675
|
res += `
|
|
@@ -64089,7 +64690,7 @@ ${originalIndentation}`;
|
|
|
64089
64690
|
let separator = "";
|
|
64090
64691
|
if (spacer !== "") {
|
|
64091
64692
|
indentation += spacer;
|
|
64092
|
-
|
|
64693
|
+
join11 = `,
|
|
64093
64694
|
${indentation}`;
|
|
64094
64695
|
whitespace = " ";
|
|
64095
64696
|
}
|
|
@@ -64103,13 +64704,13 @@ ${indentation}`;
|
|
|
64103
64704
|
const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
|
|
64104
64705
|
if (tmp !== void 0) {
|
|
64105
64706
|
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
|
64106
|
-
separator =
|
|
64707
|
+
separator = join11;
|
|
64107
64708
|
}
|
|
64108
64709
|
}
|
|
64109
64710
|
if (keyLength > maximumBreadth) {
|
|
64110
64711
|
const removedKeys = keyLength - maximumBreadth;
|
|
64111
64712
|
res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
|
|
64112
|
-
separator =
|
|
64713
|
+
separator = join11;
|
|
64113
64714
|
}
|
|
64114
64715
|
if (spacer !== "" && separator.length > 1) {
|
|
64115
64716
|
res = `
|
|
@@ -64150,7 +64751,7 @@ ${originalIndentation}`;
|
|
|
64150
64751
|
}
|
|
64151
64752
|
const originalIndentation = indentation;
|
|
64152
64753
|
let res = "";
|
|
64153
|
-
let
|
|
64754
|
+
let join11 = ",";
|
|
64154
64755
|
if (Array.isArray(value)) {
|
|
64155
64756
|
if (value.length === 0) {
|
|
64156
64757
|
return "[]";
|
|
@@ -64163,7 +64764,7 @@ ${originalIndentation}`;
|
|
|
64163
64764
|
indentation += spacer;
|
|
64164
64765
|
res += `
|
|
64165
64766
|
${indentation}`;
|
|
64166
|
-
|
|
64767
|
+
join11 = `,
|
|
64167
64768
|
${indentation}`;
|
|
64168
64769
|
}
|
|
64169
64770
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -64171,13 +64772,13 @@ ${indentation}`;
|
|
|
64171
64772
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
64172
64773
|
const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
64173
64774
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
64174
|
-
res +=
|
|
64775
|
+
res += join11;
|
|
64175
64776
|
}
|
|
64176
64777
|
const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
64177
64778
|
res += tmp !== void 0 ? tmp : "null";
|
|
64178
64779
|
if (value.length - 1 > maximumBreadth) {
|
|
64179
64780
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
64180
|
-
res += `${
|
|
64781
|
+
res += `${join11}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
64181
64782
|
}
|
|
64182
64783
|
if (spacer !== "") {
|
|
64183
64784
|
res += `
|
|
@@ -64190,7 +64791,7 @@ ${originalIndentation}`;
|
|
|
64190
64791
|
let whitespace = "";
|
|
64191
64792
|
if (spacer !== "") {
|
|
64192
64793
|
indentation += spacer;
|
|
64193
|
-
|
|
64794
|
+
join11 = `,
|
|
64194
64795
|
${indentation}`;
|
|
64195
64796
|
whitespace = " ";
|
|
64196
64797
|
}
|
|
@@ -64199,7 +64800,7 @@ ${indentation}`;
|
|
|
64199
64800
|
const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
|
|
64200
64801
|
if (tmp !== void 0) {
|
|
64201
64802
|
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
|
64202
|
-
separator =
|
|
64803
|
+
separator = join11;
|
|
64203
64804
|
}
|
|
64204
64805
|
}
|
|
64205
64806
|
if (spacer !== "" && separator.length > 1) {
|
|
@@ -64257,20 +64858,20 @@ ${originalIndentation}`;
|
|
|
64257
64858
|
indentation += spacer;
|
|
64258
64859
|
let res2 = `
|
|
64259
64860
|
${indentation}`;
|
|
64260
|
-
const
|
|
64861
|
+
const join12 = `,
|
|
64261
64862
|
${indentation}`;
|
|
64262
64863
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
64263
64864
|
let i = 0;
|
|
64264
64865
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
64265
64866
|
const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
64266
64867
|
res2 += tmp2 !== void 0 ? tmp2 : "null";
|
|
64267
|
-
res2 +=
|
|
64868
|
+
res2 += join12;
|
|
64268
64869
|
}
|
|
64269
64870
|
const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
64270
64871
|
res2 += tmp !== void 0 ? tmp : "null";
|
|
64271
64872
|
if (value.length - 1 > maximumBreadth) {
|
|
64272
64873
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
64273
|
-
res2 += `${
|
|
64874
|
+
res2 += `${join12}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
64274
64875
|
}
|
|
64275
64876
|
res2 += `
|
|
64276
64877
|
${originalIndentation}`;
|
|
@@ -64286,16 +64887,16 @@ ${originalIndentation}`;
|
|
|
64286
64887
|
return '"[Object]"';
|
|
64287
64888
|
}
|
|
64288
64889
|
indentation += spacer;
|
|
64289
|
-
const
|
|
64890
|
+
const join11 = `,
|
|
64290
64891
|
${indentation}`;
|
|
64291
64892
|
let res = "";
|
|
64292
64893
|
let separator = "";
|
|
64293
64894
|
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
64294
64895
|
if (isTypedArrayWithEntries(value)) {
|
|
64295
|
-
res += stringifyTypedArray(value,
|
|
64896
|
+
res += stringifyTypedArray(value, join11, maximumBreadth);
|
|
64296
64897
|
keys = keys.slice(value.length);
|
|
64297
64898
|
maximumPropertiesToStringify -= value.length;
|
|
64298
|
-
separator =
|
|
64899
|
+
separator = join11;
|
|
64299
64900
|
}
|
|
64300
64901
|
if (deterministic) {
|
|
64301
64902
|
keys = sort(keys, comparator);
|
|
@@ -64306,13 +64907,13 @@ ${indentation}`;
|
|
|
64306
64907
|
const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
|
|
64307
64908
|
if (tmp !== void 0) {
|
|
64308
64909
|
res += `${separator}${strEscape(key2)}: ${tmp}`;
|
|
64309
|
-
separator =
|
|
64910
|
+
separator = join11;
|
|
64310
64911
|
}
|
|
64311
64912
|
}
|
|
64312
64913
|
if (keyLength > maximumBreadth) {
|
|
64313
64914
|
const removedKeys = keyLength - maximumBreadth;
|
|
64314
64915
|
res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
|
|
64315
|
-
separator =
|
|
64916
|
+
separator = join11;
|
|
64316
64917
|
}
|
|
64317
64918
|
if (separator !== "") {
|
|
64318
64919
|
res = `
|
|
@@ -66050,7 +66651,7 @@ var require_reply = __commonJS({
|
|
|
66050
66651
|
return this.header("location", url2).code(code).send();
|
|
66051
66652
|
};
|
|
66052
66653
|
Reply.prototype.callNotFound = function() {
|
|
66053
|
-
|
|
66654
|
+
notFound2(this);
|
|
66054
66655
|
return this;
|
|
66055
66656
|
};
|
|
66056
66657
|
Reply.prototype.then = function(fulfilled, rejected) {
|
|
@@ -66489,7 +67090,7 @@ var require_reply = __commonJS({
|
|
|
66489
67090
|
_Reply.props = props;
|
|
66490
67091
|
return _Reply;
|
|
66491
67092
|
}
|
|
66492
|
-
function
|
|
67093
|
+
function notFound2(reply) {
|
|
66493
67094
|
if (reply[kRouteContext][kFourOhFourContext] === null) {
|
|
66494
67095
|
reply.log.warn("Trying to send a NotFound error inside a 404 handler. Sending basic 404 response.");
|
|
66495
67096
|
reply.code(404).send("404 Not Found");
|
|
@@ -71202,49 +71803,49 @@ var require_fast_uri2 = __commonJS({
|
|
|
71202
71803
|
target2.ipv6Zone = source.ipv6Zone;
|
|
71203
71804
|
}
|
|
71204
71805
|
}
|
|
71205
|
-
function resolveComponent(base,
|
|
71806
|
+
function resolveComponent(base, relative4, options, skipNormalization) {
|
|
71206
71807
|
const target2 = {};
|
|
71207
71808
|
if (!skipNormalization) {
|
|
71208
71809
|
base = parse4(serialize(base, options), options);
|
|
71209
|
-
|
|
71810
|
+
relative4 = parse4(serialize(relative4, options), options);
|
|
71210
71811
|
}
|
|
71211
71812
|
options = options || {};
|
|
71212
|
-
if (!options.tolerant &&
|
|
71213
|
-
target2.scheme =
|
|
71214
|
-
target2.userinfo =
|
|
71215
|
-
copyHost(target2,
|
|
71216
|
-
target2.port =
|
|
71217
|
-
target2.path = removeDotSegments(
|
|
71218
|
-
target2.query =
|
|
71813
|
+
if (!options.tolerant && relative4.scheme) {
|
|
71814
|
+
target2.scheme = relative4.scheme;
|
|
71815
|
+
target2.userinfo = relative4.userinfo;
|
|
71816
|
+
copyHost(target2, relative4);
|
|
71817
|
+
target2.port = relative4.port;
|
|
71818
|
+
target2.path = removeDotSegments(relative4.path || "");
|
|
71819
|
+
target2.query = relative4.query;
|
|
71219
71820
|
} else {
|
|
71220
|
-
if (
|
|
71221
|
-
target2.userinfo =
|
|
71222
|
-
copyHost(target2,
|
|
71223
|
-
target2.port =
|
|
71224
|
-
target2.path = removeDotSegments(
|
|
71225
|
-
target2.query =
|
|
71821
|
+
if (relative4.userinfo !== void 0 || relative4.host !== void 0 || relative4.port !== void 0) {
|
|
71822
|
+
target2.userinfo = relative4.userinfo;
|
|
71823
|
+
copyHost(target2, relative4);
|
|
71824
|
+
target2.port = relative4.port;
|
|
71825
|
+
target2.path = removeDotSegments(relative4.path || "");
|
|
71826
|
+
target2.query = relative4.query;
|
|
71226
71827
|
} else {
|
|
71227
|
-
if (!
|
|
71828
|
+
if (!relative4.path) {
|
|
71228
71829
|
target2.path = base.path;
|
|
71229
|
-
if (
|
|
71230
|
-
target2.query =
|
|
71830
|
+
if (relative4.query !== void 0) {
|
|
71831
|
+
target2.query = relative4.query;
|
|
71231
71832
|
} else {
|
|
71232
71833
|
target2.query = base.query;
|
|
71233
71834
|
}
|
|
71234
71835
|
} else {
|
|
71235
|
-
if (
|
|
71236
|
-
target2.path = removeDotSegments(
|
|
71836
|
+
if (relative4.path[0] === "/") {
|
|
71837
|
+
target2.path = removeDotSegments(relative4.path);
|
|
71237
71838
|
} else {
|
|
71238
71839
|
if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
|
|
71239
|
-
target2.path = "/" +
|
|
71840
|
+
target2.path = "/" + relative4.path;
|
|
71240
71841
|
} else if (!base.path) {
|
|
71241
|
-
target2.path =
|
|
71842
|
+
target2.path = relative4.path;
|
|
71242
71843
|
} else {
|
|
71243
|
-
target2.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) +
|
|
71844
|
+
target2.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative4.path;
|
|
71244
71845
|
}
|
|
71245
71846
|
target2.path = removeDotSegments(target2.path);
|
|
71246
71847
|
}
|
|
71247
|
-
target2.query =
|
|
71848
|
+
target2.query = relative4.query;
|
|
71248
71849
|
}
|
|
71249
71850
|
target2.userinfo = base.userinfo;
|
|
71250
71851
|
copyHost(target2, base);
|
|
@@ -71252,7 +71853,7 @@ var require_fast_uri2 = __commonJS({
|
|
|
71252
71853
|
}
|
|
71253
71854
|
target2.scheme = base.scheme;
|
|
71254
71855
|
}
|
|
71255
|
-
target2.fragment =
|
|
71856
|
+
target2.fragment = relative4.fragment;
|
|
71256
71857
|
return target2;
|
|
71257
71858
|
}
|
|
71258
71859
|
function equal(uriA, uriB, options) {
|
|
@@ -71828,7 +72429,7 @@ var require_ajv_compiler = __commonJS({
|
|
|
71828
72429
|
var require_dist3 = __commonJS({
|
|
71829
72430
|
"node_modules/.pnpm/dequal@2.0.3/node_modules/dequal/dist/index.js"(exports) {
|
|
71830
72431
|
var has = Object.prototype.hasOwnProperty;
|
|
71831
|
-
function
|
|
72432
|
+
function find2(iter, tar, key) {
|
|
71832
72433
|
for (key of iter.keys()) {
|
|
71833
72434
|
if (dequal(key, tar)) return key;
|
|
71834
72435
|
}
|
|
@@ -71852,7 +72453,7 @@ var require_dist3 = __commonJS({
|
|
|
71852
72453
|
for (len of foo) {
|
|
71853
72454
|
tmp = len;
|
|
71854
72455
|
if (tmp && typeof tmp === "object") {
|
|
71855
|
-
tmp =
|
|
72456
|
+
tmp = find2(bar, tmp);
|
|
71856
72457
|
if (!tmp) return false;
|
|
71857
72458
|
}
|
|
71858
72459
|
if (!bar.has(tmp)) return false;
|
|
@@ -71866,7 +72467,7 @@ var require_dist3 = __commonJS({
|
|
|
71866
72467
|
for (len of foo) {
|
|
71867
72468
|
tmp = len[0];
|
|
71868
72469
|
if (tmp && typeof tmp === "object") {
|
|
71869
|
-
tmp =
|
|
72470
|
+
tmp = find2(bar, tmp);
|
|
71870
72471
|
if (!tmp) return false;
|
|
71871
72472
|
}
|
|
71872
72473
|
if (!dequal(len[1], bar.get(tmp))) {
|
|
@@ -79781,7 +80382,7 @@ var require_find_my_way = __commonJS({
|
|
|
79781
80382
|
if (handle === null) return this._defaultRoute(req, res, ctx);
|
|
79782
80383
|
return ctx === void 0 ? handle.handler(req, res, handle.params, handle.store, handle.searchParams) : handle.handler.call(ctx, req, res, handle.params, handle.store, handle.searchParams);
|
|
79783
80384
|
};
|
|
79784
|
-
Router.prototype.find = function
|
|
80385
|
+
Router.prototype.find = function find2(method, path, derivedConstraints) {
|
|
79785
80386
|
let currentNode = method === "GET" ? this._treeGET : this.trees[method];
|
|
79786
80387
|
if (currentNode == null) return null;
|
|
79787
80388
|
if (path.charCodeAt(0) !== 47) {
|
|
@@ -83689,7 +84290,7 @@ var init_types3 = __esm({
|
|
|
83689
84290
|
|
|
83690
84291
|
// packages/agents/src/config.ts
|
|
83691
84292
|
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
|
|
84293
|
+
import { dirname as dirname4, join as join8 } from "node:path";
|
|
83693
84294
|
function read(home) {
|
|
83694
84295
|
const path = configPath(home);
|
|
83695
84296
|
if (!existsSync6(path)) return {};
|
|
@@ -83760,7 +84361,7 @@ var init_config = __esm({
|
|
|
83760
84361
|
init_src();
|
|
83761
84362
|
DEFAULT_BASE_URL = "https://openrouter.ai/api/v1";
|
|
83762
84363
|
DEFAULT_MODEL = "anthropic/claude-sonnet-5.5";
|
|
83763
|
-
configPath = (home) =>
|
|
84364
|
+
configPath = (home) => join8(home, "config.json");
|
|
83764
84365
|
}
|
|
83765
84366
|
});
|
|
83766
84367
|
|
|
@@ -83882,6 +84483,7 @@ var init_grammar = __esm({
|
|
|
83882
84483
|
kind: "function",
|
|
83883
84484
|
id: h.id,
|
|
83884
84485
|
label: h.name,
|
|
84486
|
+
...h.title ? { title: h.title } : {},
|
|
83885
84487
|
detail: `${h.path}:${h.evidence?.span.start.line ?? "?"} \xB7 ${plural2(h.callers ?? 0, "caller")} \xB7 ${plural2(h.callees ?? 0, "callee")}`,
|
|
83886
84488
|
file: h.id.slice(0, h.id.lastIndexOf(":")),
|
|
83887
84489
|
path: h.path,
|
|
@@ -83916,6 +84518,7 @@ var init_grammar = __esm({
|
|
|
83916
84518
|
id: c.id,
|
|
83917
84519
|
// The caller; the row's kind already says it is a call to the function asked about.
|
|
83918
84520
|
label: c.function.qualifiedName,
|
|
84521
|
+
...c.function.title ? { title: c.function.title } : {},
|
|
83919
84522
|
...c.function.line !== void 0 ? { fnLine: c.function.line } : {},
|
|
83920
84523
|
detail: `${c.function.path}:${c.evidence.span.start.line}`,
|
|
83921
84524
|
file: c.evidence.file,
|
|
@@ -83952,6 +84555,7 @@ var init_grammar = __esm({
|
|
|
83952
84555
|
kind: "call",
|
|
83953
84556
|
id: c.id,
|
|
83954
84557
|
label: c.function.qualifiedName,
|
|
84558
|
+
...c.function.title ? { title: c.function.title } : {},
|
|
83955
84559
|
...c.function.line !== void 0 ? { fnLine: c.function.line } : {},
|
|
83956
84560
|
detail: `${r.hit.path}:${c.evidence.span.start.line}`,
|
|
83957
84561
|
file: c.evidence.file,
|
|
@@ -84014,6 +84618,7 @@ var init_grammar = __esm({
|
|
|
84014
84618
|
kind: "function",
|
|
84015
84619
|
id: fn.id,
|
|
84016
84620
|
label: fn.qualifiedName,
|
|
84621
|
+
...fn.title ? { title: fn.title } : {},
|
|
84017
84622
|
detail: `line ${fn.evidence.span.start.line} \xB7 ${plural2(fn.callers, "caller")} \xB7 ${plural2(fn.callees, "callee")}${fn.unresolved ? ` \xB7 ${fn.unresolved} unresolved` : ""}`,
|
|
84018
84623
|
file: f.hit.id,
|
|
84019
84624
|
path: f.hit.path,
|
|
@@ -84052,12 +84657,8 @@ var init_grammar = __esm({
|
|
|
84052
84657
|
};
|
|
84053
84658
|
TOP = 10;
|
|
84054
84659
|
largestFiles = (ctx) => {
|
|
84055
|
-
const
|
|
84056
|
-
|
|
84057
|
-
"aggregate",
|
|
84058
|
-
{ label: "Function", groupBy: "file" },
|
|
84059
|
-
() => ctx.engine.aggregate({ project: ctx.project, label: "Function", groupBy: "file" })
|
|
84060
|
-
);
|
|
84660
|
+
const args = { label: "Function", groupBy: "file", filters: { ownCode: true } };
|
|
84661
|
+
const r = tool(ctx, "aggregate", args, () => ctx.engine.aggregate({ project: ctx.project, ...args }));
|
|
84061
84662
|
const top = r.groups.slice(0, TOP);
|
|
84062
84663
|
return {
|
|
84063
84664
|
summary: top.length ? `The largest file is ${top[0].name ?? top[0].key} with ${plural2(top[0].count, "function")}.` : "No functions have been analyzed yet.",
|
|
@@ -84073,12 +84674,8 @@ var init_grammar = __esm({
|
|
|
84073
84674
|
};
|
|
84074
84675
|
};
|
|
84075
84676
|
mostCalled = (ctx) => {
|
|
84076
|
-
const
|
|
84077
|
-
|
|
84078
|
-
"aggregate",
|
|
84079
|
-
{ label: "CALLS", groupBy: "to" },
|
|
84080
|
-
() => ctx.engine.aggregate({ project: ctx.project, label: "CALLS", groupBy: "to" })
|
|
84081
|
-
);
|
|
84677
|
+
const args = { label: "CALLS", groupBy: "to", filters: { ownCode: true } };
|
|
84678
|
+
const r = tool(ctx, "aggregate", args, () => ctx.engine.aggregate({ project: ctx.project, ...args }));
|
|
84082
84679
|
const top = r.groups.slice(0, TOP);
|
|
84083
84680
|
return {
|
|
84084
84681
|
summary: top.length ? `The most-called function is ${say(top[0].name ?? top[0].key)} (${plural2(top[0].count, "call")}).` : "No calls have been found yet.",
|
|
@@ -84222,7 +84819,9 @@ var init_grammar = __esm({
|
|
|
84222
84819
|
"dynamic-dispatch": "type unknown",
|
|
84223
84820
|
reflection: "reflection",
|
|
84224
84821
|
"imported-symbol": "imported",
|
|
84225
|
-
"runtime-global": "built-in"
|
|
84822
|
+
"runtime-global": "built-in",
|
|
84823
|
+
"template-binding": "awaiting its component",
|
|
84824
|
+
"template-reference": "registered elsewhere"
|
|
84226
84825
|
};
|
|
84227
84826
|
STATUS_WORDS = {
|
|
84228
84827
|
analyzed: "analyzed",
|
|
@@ -84827,7 +85426,7 @@ var init_src8 = __esm({
|
|
|
84827
85426
|
|
|
84828
85427
|
// packages/server/src/server.ts
|
|
84829
85428
|
import { existsSync as existsSync7, statSync as statSync3 } from "node:fs";
|
|
84830
|
-
import { dirname as dirname5, isAbsolute, join as
|
|
85429
|
+
import { dirname as dirname5, isAbsolute, join as join9, resolve as resolve3 } from "node:path";
|
|
84831
85430
|
import { fileURLToPath } from "node:url";
|
|
84832
85431
|
function hostName(host) {
|
|
84833
85432
|
return host.startsWith("[") ? host.slice(0, host.indexOf("]") + 1) : host.replace(/:\d+$/, "");
|
|
@@ -84903,6 +85502,66 @@ async function createServer(engine, options = {}) {
|
|
|
84903
85502
|
return reply.status(201).send(engine.addSource({ ...req.body, ...req.params }));
|
|
84904
85503
|
}
|
|
84905
85504
|
);
|
|
85505
|
+
const sourceParams = {
|
|
85506
|
+
type: "object",
|
|
85507
|
+
required: ["project", "source"],
|
|
85508
|
+
properties: { project: str2, source: str2 }
|
|
85509
|
+
};
|
|
85510
|
+
const paths = { type: "array", items: str2, maxItems: 1e4 };
|
|
85511
|
+
app.patch(
|
|
85512
|
+
"/api/projects/:project/sources/:source",
|
|
85513
|
+
{
|
|
85514
|
+
schema: {
|
|
85515
|
+
params: sourceParams,
|
|
85516
|
+
body: {
|
|
85517
|
+
type: "object",
|
|
85518
|
+
additionalProperties: false,
|
|
85519
|
+
properties: { include: paths, exclude: paths, optIn: paths }
|
|
85520
|
+
}
|
|
85521
|
+
}
|
|
85522
|
+
},
|
|
85523
|
+
async (req) => engine.updateSource({ ...req.body, ...req.params })
|
|
85524
|
+
);
|
|
85525
|
+
app.post(
|
|
85526
|
+
"/api/projects/:project/sources/:source/select",
|
|
85527
|
+
{
|
|
85528
|
+
schema: {
|
|
85529
|
+
params: sourceParams,
|
|
85530
|
+
body: {
|
|
85531
|
+
type: "object",
|
|
85532
|
+
required: ["paths", "selected"],
|
|
85533
|
+
additionalProperties: false,
|
|
85534
|
+
properties: { paths: { ...paths, minItems: 1 }, selected: { type: "boolean" } }
|
|
85535
|
+
}
|
|
85536
|
+
}
|
|
85537
|
+
},
|
|
85538
|
+
async (req) => engine.select({ ...req.body, ...req.params })
|
|
85539
|
+
);
|
|
85540
|
+
app.get(
|
|
85541
|
+
"/api/projects/:project/sources/:source/browse",
|
|
85542
|
+
{
|
|
85543
|
+
schema: {
|
|
85544
|
+
params: sourceParams,
|
|
85545
|
+
querystring: { type: "object", additionalProperties: false, properties: { dir: { type: "string" } } }
|
|
85546
|
+
}
|
|
85547
|
+
},
|
|
85548
|
+
async (req) => engine.browse({ ...req.params, dir: req.query.dir ?? "" })
|
|
85549
|
+
);
|
|
85550
|
+
app.get(
|
|
85551
|
+
"/api/projects/:project/settings",
|
|
85552
|
+
{ schema: { params: projectParams } },
|
|
85553
|
+
async (req) => engine.projectSettings(req.params)
|
|
85554
|
+
);
|
|
85555
|
+
app.put(
|
|
85556
|
+
"/api/projects/:project/settings",
|
|
85557
|
+
{
|
|
85558
|
+
schema: {
|
|
85559
|
+
params: projectParams,
|
|
85560
|
+
body: { type: "object", additionalProperties: false, properties: { maxFileMB: { type: "number" } } }
|
|
85561
|
+
}
|
|
85562
|
+
},
|
|
85563
|
+
async (req) => engine.setProjectSettings({ ...req.params, settings: req.body })
|
|
85564
|
+
);
|
|
84906
85565
|
app.post(
|
|
84907
85566
|
"/api/projects/:project/runs",
|
|
84908
85567
|
{ schema: { params: projectParams } },
|
|
@@ -85119,6 +85778,7 @@ async function createServer(engine, options = {}) {
|
|
|
85119
85778
|
label: { type: "string", enum: ["File", "Function", "UnresolvedCallSite", "CALLS"] },
|
|
85120
85779
|
groupBy: str2,
|
|
85121
85780
|
open: { type: "string", enum: ["true", "false"] },
|
|
85781
|
+
ownCode: { type: "string", enum: ["true", "false"] },
|
|
85122
85782
|
path: str2,
|
|
85123
85783
|
limit: { type: "string", pattern: "^[1-9][0-9]*$" }
|
|
85124
85784
|
}
|
|
@@ -85129,9 +85789,10 @@ async function createServer(engine, options = {}) {
|
|
|
85129
85789
|
...req.params,
|
|
85130
85790
|
label: req.query.label,
|
|
85131
85791
|
groupBy: req.query.groupBy,
|
|
85132
|
-
...req.query.open !== void 0 || req.query.path ? {
|
|
85792
|
+
...req.query.open !== void 0 || req.query.path || req.query.ownCode !== void 0 ? {
|
|
85133
85793
|
filters: {
|
|
85134
85794
|
...req.query.open !== void 0 ? { open: req.query.open === "true" } : {},
|
|
85795
|
+
...req.query.ownCode !== void 0 ? { ownCode: req.query.ownCode === "true" } : {},
|
|
85135
85796
|
...req.query.path ? { path: req.query.path } : {}
|
|
85136
85797
|
}
|
|
85137
85798
|
} : {},
|
|
@@ -85171,7 +85832,7 @@ async function createServer(engine, options = {}) {
|
|
|
85171
85832
|
async (req) => engine.snippet({ ...req.params, ...req.body })
|
|
85172
85833
|
);
|
|
85173
85834
|
const webRoot = options.webRoot === void 0 ? defaultWebRoot : options.webRoot;
|
|
85174
|
-
const hasUi = webRoot !== null && existsSync7(
|
|
85835
|
+
const hasUi = webRoot !== null && existsSync7(join9(webRoot, "index.html"));
|
|
85175
85836
|
if (hasUi) await app.register(import_static.default, { root: webRoot });
|
|
85176
85837
|
app.setNotFoundHandler((req, reply) => {
|
|
85177
85838
|
if (req.url.startsWith("/api/") || !hasUi)
|
|
@@ -85273,9 +85934,10 @@ var init_src9 = __esm({
|
|
|
85273
85934
|
// packages/cli/src/main.ts
|
|
85274
85935
|
init_src();
|
|
85275
85936
|
init_src6();
|
|
85937
|
+
init_src2();
|
|
85276
85938
|
import { spawn } from "node:child_process";
|
|
85277
85939
|
import { existsSync as existsSync8, readFileSync as readFileSync4, statSync as statSync4 } from "node:fs";
|
|
85278
|
-
import { basename as basename3, dirname as dirname6, join as
|
|
85940
|
+
import { basename as basename3, dirname as dirname6, join as join10, relative as relative3, resolve as resolve4, sep as sep5 } from "node:path";
|
|
85279
85941
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
85280
85942
|
import { parseArgs } from "node:util";
|
|
85281
85943
|
var USAGE = `veoflow \u2014 a knowledge graph of your code (also runs as \`veo\`)
|
|
@@ -85285,14 +85947,19 @@ Usage:
|
|
|
85285
85947
|
veoflow add <dir> [--project <id>] add a folder to a project and analyze it
|
|
85286
85948
|
[--id <source-id>] [--include <glob>]... [--exclude <glob>]... [--no-run]
|
|
85287
85949
|
veoflow run [--project <id>] analyze a project again
|
|
85950
|
+
veoflow include <path>... [--project <id>] [--source <id>] [--run]
|
|
85951
|
+
veoflow exclude <path>... [--project <id>] [--source <id>] [--run]
|
|
85952
|
+
choose which files and folders are analyzed
|
|
85953
|
+
(paths relative to the working directory)
|
|
85288
85954
|
veoflow serve [--port 7420] [--host 127.0.0.1] [--no-open]
|
|
85289
85955
|
serve the UI and API
|
|
85290
85956
|
veoflow mcp serve the MCP tools over stdio
|
|
85291
85957
|
veoflow ask "<question>" [--project <id>] [--mode auto|grammar|model]
|
|
85292
85958
|
ask about the analyzed code
|
|
85293
|
-
veoflow config [get [<key>] | set <key> <value> | test]
|
|
85959
|
+
veoflow config [get [<key>] | set <key> <value> | test] [--project <id>]
|
|
85294
85960
|
model settings: model.baseUrl, model.name, model.apiKey
|
|
85295
|
-
("set model.apiKey -" reads the key from stdin)
|
|
85961
|
+
("set model.apiKey -" reads the key from stdin);
|
|
85962
|
+
project settings: analysis.maxFileMB (size limit, default 10)
|
|
85296
85963
|
veoflow projects list projects
|
|
85297
85964
|
veoflow help | --version`;
|
|
85298
85965
|
var UsageError = class extends Error {
|
|
@@ -85300,7 +85967,7 @@ var UsageError = class extends Error {
|
|
|
85300
85967
|
function version2() {
|
|
85301
85968
|
if (process.env.VEO_VERSION) return process.env.VEO_VERSION;
|
|
85302
85969
|
const pkg = JSON.parse(
|
|
85303
|
-
readFileSync4(
|
|
85970
|
+
readFileSync4(join10(dirname6(fileURLToPath2(import.meta.url)), "../package.json"), "utf8")
|
|
85304
85971
|
);
|
|
85305
85972
|
return pkg.version;
|
|
85306
85973
|
}
|
|
@@ -85494,8 +86161,83 @@ ${plain(answer.prose)}`);
|
|
|
85494
86161
|
try: ${answer.suggestions.join(" \xB7 ")}`);
|
|
85495
86162
|
return answer.error || mode === "model" && answer.via !== "model" ? 1 : 0;
|
|
85496
86163
|
}
|
|
86164
|
+
case "include":
|
|
86165
|
+
case "exclude": {
|
|
86166
|
+
const { values, positionals } = parseArgs({
|
|
86167
|
+
args: rest,
|
|
86168
|
+
allowPositionals: true,
|
|
86169
|
+
strict: true,
|
|
86170
|
+
options: { project: { type: "string" }, source: { type: "string" }, run: { type: "boolean" } }
|
|
86171
|
+
});
|
|
86172
|
+
if (positionals.length === 0)
|
|
86173
|
+
throw new UsageError(
|
|
86174
|
+
`usage: veoflow ${command} <path>... [--project <id>] [--source <id>] [--run]`
|
|
86175
|
+
);
|
|
86176
|
+
const project2 = pickProject(engine, values.project, io.cwd);
|
|
86177
|
+
const sources = engine.listSources({ project: project2 }).sources;
|
|
86178
|
+
const abs = positionals.map((p) => canonicalPath(resolve4(io.cwd, p)));
|
|
86179
|
+
const source = values.source ? sources.find((s) => s.id === values.source) : sources.filter((s) => abs.every((a) => a === s.root || a.startsWith(s.root + sep5))).sort((a, b) => b.root.length - a.root.length)[0];
|
|
86180
|
+
if (!source)
|
|
86181
|
+
throw values.source ? new VeoError("not-found", `no source ${values.source} in ${project2}`) : new UsageError(
|
|
86182
|
+
"the paths are not all inside one source; pass --source <id> with paths inside it"
|
|
86183
|
+
);
|
|
86184
|
+
const paths = abs.map((a) => relative3(source.root, a).split(sep5).join("/"));
|
|
86185
|
+
if (paths.some((p) => p === "" || p.startsWith("..")))
|
|
86186
|
+
throw new UsageError(
|
|
86187
|
+
`paths must be inside the source ${source.id} (${source.root}), not the root itself`
|
|
86188
|
+
);
|
|
86189
|
+
const { source: updated } = engine.select({
|
|
86190
|
+
project: project2,
|
|
86191
|
+
source: source.id,
|
|
86192
|
+
paths,
|
|
86193
|
+
selected: command === "include"
|
|
86194
|
+
});
|
|
86195
|
+
io.out(`${command === "include" ? "included" : "excluded"} ${paths.join(", ")} in ${source.id}`);
|
|
86196
|
+
const rules = [
|
|
86197
|
+
updated.exclude.length ? `exclude ${updated.exclude.join(" ")}` : "",
|
|
86198
|
+
updated.optIn?.length ? `analyze anyway ${updated.optIn.join(" ")}` : ""
|
|
86199
|
+
].filter(Boolean);
|
|
86200
|
+
if (rules.length) io.out(` rules: ${rules.join("; ")}`);
|
|
86201
|
+
if (!values.run) {
|
|
86202
|
+
io.out(` takes effect at the next run (veoflow run --project ${project2})`);
|
|
86203
|
+
return 0;
|
|
86204
|
+
}
|
|
86205
|
+
return await runAnalysis(engine, project2, io);
|
|
86206
|
+
}
|
|
85497
86207
|
case "config": {
|
|
86208
|
+
const projectFlag = rest.indexOf("--project");
|
|
86209
|
+
const projectArg = projectFlag >= 0 ? rest[projectFlag + 1] : void 0;
|
|
86210
|
+
if (projectFlag >= 0) {
|
|
86211
|
+
if (!projectArg) throw new UsageError("--project needs a project id");
|
|
86212
|
+
rest.splice(projectFlag, 2);
|
|
86213
|
+
}
|
|
85498
86214
|
const [action = "get", key, value] = rest;
|
|
86215
|
+
if (key?.startsWith("analysis.") || action === "get" && projectArg && !key) {
|
|
86216
|
+
if (key && key !== "analysis.maxFileMB")
|
|
86217
|
+
throw new UsageError(`unknown key ${key} (analysis.maxFileMB)`);
|
|
86218
|
+
const project2 = pickProject(engine, projectArg, io.cwd);
|
|
86219
|
+
if (action === "get") {
|
|
86220
|
+
io.out(
|
|
86221
|
+
`${key ? "" : "analysis.maxFileMB = "}${engine.projectSettings({ project: project2 }).settings.maxFileMB}`
|
|
86222
|
+
);
|
|
86223
|
+
return 0;
|
|
86224
|
+
}
|
|
86225
|
+
if (action === "set") {
|
|
86226
|
+
const mb = Number(value);
|
|
86227
|
+
if (value === void 0 || value.trim() === "" || !Number.isFinite(mb))
|
|
86228
|
+
throw new UsageError(
|
|
86229
|
+
"usage: veoflow config set analysis.maxFileMB <megabytes> [--project <id>]"
|
|
86230
|
+
);
|
|
86231
|
+
const { settings } = engine.setProjectSettings({ project: project2, settings: { maxFileMB: mb } });
|
|
86232
|
+
io.out(
|
|
86233
|
+
`analysis.maxFileMB = ${settings.maxFileMB} (project ${project2}; takes effect at the next run)`
|
|
86234
|
+
);
|
|
86235
|
+
return 0;
|
|
86236
|
+
}
|
|
86237
|
+
throw new UsageError(
|
|
86238
|
+
"usage: veoflow config [get|set] analysis.maxFileMB [<value>] [--project <id>]"
|
|
86239
|
+
);
|
|
86240
|
+
}
|
|
85499
86241
|
const { loadSettings: loadSettings2, publicSettings: publicSettings2, saveSettings: saveSettings2, testConnection: testConnection2 } = await Promise.resolve().then(() => (init_src8(), src_exports2));
|
|
85500
86242
|
const home = engine.catalog.home;
|
|
85501
86243
|
const keys = {
|