@vibe-agent-toolkit/discovery 0.1.8 → 0.1.10
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-scanner.d.ts","sourceRoot":"","sources":["../../src/scanners/local-scanner.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"local-scanner.d.ts","sourceRoot":"","sources":["../../src/scanners/local-scanner.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAkB,WAAW,EAAc,WAAW,EAAE,MAAM,aAAa,CAAC;AAaxF;;;;;GAKG;AACH,wBAAsB,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAoGrE"}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import * as fs from 'node:fs';
|
|
2
2
|
import * as path from 'node:path';
|
|
3
|
-
import { crawlDirectory,
|
|
3
|
+
import { crawlDirectory, gitCheckIgnoredBatch } from '@vibe-agent-toolkit/utils';
|
|
4
4
|
import { detectFormat } from '../detectors/format-detector.js';
|
|
5
5
|
import { createPatternFilter } from '../filters/pattern-filter.js';
|
|
6
|
+
/**
|
|
7
|
+
* Directories that should ALWAYS be excluded from scanning to prevent catastrophic performance.
|
|
8
|
+
* These contain tens of thousands of files and are never useful for discovery.
|
|
9
|
+
*/
|
|
10
|
+
const PERFORMANCE_POISON = [
|
|
11
|
+
'**/.git/**', // Git objects (1000s of files), never useful for discovery
|
|
12
|
+
'**/node_modules/**', // Dependencies (40K+ files), never user content
|
|
13
|
+
'**/coverage/**', // Test coverage reports, never useful for discovery
|
|
14
|
+
'**/.test-output/**', // Test artifacts, never useful for discovery
|
|
15
|
+
];
|
|
6
16
|
/**
|
|
7
17
|
* Scan local filesystem for VAT agents and Claude Skills
|
|
8
18
|
*
|
|
@@ -29,10 +39,13 @@ export async function scan(options) {
|
|
|
29
39
|
}
|
|
30
40
|
else if (stat.isDirectory()) {
|
|
31
41
|
if (recursive) {
|
|
42
|
+
// Merge performance poison patterns with user's exclude patterns
|
|
43
|
+
// This prevents catastrophic crawls of .git, node_modules, etc. (52K+ files)
|
|
44
|
+
const crawlExclusions = [...PERFORMANCE_POISON, ...(exclude ?? [])];
|
|
32
45
|
filePaths = await crawlDirectory({
|
|
33
46
|
baseDir: absolutePath,
|
|
34
47
|
respectGitignore: false, // We handle gitignore separately
|
|
35
|
-
exclude:
|
|
48
|
+
exclude: crawlExclusions, // Skip poison directories during crawl (not after)
|
|
36
49
|
});
|
|
37
50
|
}
|
|
38
51
|
else {
|
|
@@ -47,28 +60,34 @@ export async function scan(options) {
|
|
|
47
60
|
else {
|
|
48
61
|
throw new Error(`Path is neither file nor directory: ${absolutePath}`);
|
|
49
62
|
}
|
|
50
|
-
// Create pattern filter
|
|
63
|
+
// Create pattern filter for include patterns only
|
|
64
|
+
// (exclude patterns already applied during crawl for performance)
|
|
51
65
|
const patternFilter = createPatternFilter({
|
|
52
66
|
...(include && { include }),
|
|
53
|
-
|
|
67
|
+
// Note: For recursive scans, exclude patterns are applied during crawl.
|
|
68
|
+
// For non-recursive scans, we apply them here for consistency.
|
|
69
|
+
...(!recursive && exclude && { exclude }),
|
|
54
70
|
});
|
|
55
|
-
//
|
|
56
|
-
const
|
|
71
|
+
// Filter files by pattern and detect formats
|
|
72
|
+
const filteredFiles = [];
|
|
57
73
|
for (const filePath of filePaths) {
|
|
58
74
|
const relativePath = path.relative(scanRoot, filePath);
|
|
59
|
-
// Apply pattern filter
|
|
75
|
+
// Apply pattern filter (include patterns, and exclude for non-recursive)
|
|
60
76
|
if (!patternFilter(relativePath)) {
|
|
61
77
|
continue;
|
|
62
78
|
}
|
|
63
79
|
const format = detectFormat(filePath);
|
|
64
|
-
|
|
65
|
-
results.push({
|
|
66
|
-
path: filePath,
|
|
67
|
-
format,
|
|
68
|
-
isGitIgnored: gitIgnored,
|
|
69
|
-
relativePath,
|
|
70
|
-
});
|
|
80
|
+
filteredFiles.push({ path: filePath, relativePath, format });
|
|
71
81
|
}
|
|
82
|
+
// Batch check git-ignored status (single git subprocess instead of N)
|
|
83
|
+
const gitIgnoredMap = gitCheckIgnoredBatch(filteredFiles.map((f) => f.path), scanRoot);
|
|
84
|
+
// Build final results
|
|
85
|
+
const results = filteredFiles.map((file) => ({
|
|
86
|
+
path: file.path,
|
|
87
|
+
format: file.format,
|
|
88
|
+
isGitIgnored: gitIgnoredMap.get(file.path) ?? false,
|
|
89
|
+
relativePath: file.relativePath,
|
|
90
|
+
}));
|
|
72
91
|
// Build summary
|
|
73
92
|
const byFormat = results.reduce((acc, r) => {
|
|
74
93
|
acc[r.format] = (acc[r.format] ?? 0) + 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-scanner.js","sourceRoot":"","sources":["../../src/scanners/local-scanner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"local-scanner.js","sourceRoot":"","sources":["../../src/scanners/local-scanner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjF,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAGnE;;;GAGG;AACH,MAAM,kBAAkB,GAAG;IACzB,YAAY,EAAW,2DAA2D;IAClF,oBAAoB,EAAG,gDAAgD;IACvE,gBAAgB,EAAO,oDAAoD;IAC3E,oBAAoB,EAAG,6CAA6C;CACrE,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,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AAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACzD,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,YAAY,EAAE,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK;QACnD,YAAY,EAAE,IAAI,CAAC,YAAY;KAChC,CAAC,CAAC,CAAC;IAEJ,gBAAgB;IAChB,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;QACzC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACzC,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAA4B,CAAC,CAAC;IAEjC,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;IACzD,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;IAEzD,OAAO;QACL,OAAO;QACP,YAAY,EAAE,OAAO,CAAC,MAAM;QAC5B,QAAQ,EAAE,QAAmC;QAC7C,WAAW;QACX,YAAY;KACb,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibe-agent-toolkit/discovery",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "Intelligent file discovery for VAT agents and Claude Skills",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"typecheck": "tsc --noEmit"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@vibe-agent-toolkit/utils": "0.1.
|
|
25
|
+
"@vibe-agent-toolkit/utils": "0.1.10",
|
|
26
26
|
"picomatch": "^4.0.2"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|