agents-reverse-engineer 0.2.11 → 0.2.12

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.
@@ -14,15 +14,18 @@ export declare const DEFAULT_VENDOR_DIRS: readonly ["node_modules", "vendor", ".
14
14
  /**
15
15
  * Creates a vendor filter that excludes files within specified directories.
16
16
  *
17
- * @param vendorDirs - Array of directory names to exclude. Files within
18
- * any of these directories (at any nesting level) will
19
- * be excluded.
17
+ * Supports two patterns:
18
+ * - Single directory names (e.g., 'node_modules') - matches anywhere in path
19
+ * - Path patterns (e.g., 'apps/vendor' or '.agents/skills') - matches path containing this sequence
20
+ *
21
+ * @param vendorDirs - Array of directory names or path patterns to exclude.
20
22
  * @returns A FileFilter that checks if a path is within a vendor directory
21
23
  *
22
24
  * @example
23
25
  * ```typescript
24
- * const filter = createVendorFilter(['node_modules', 'vendor']);
26
+ * const filter = createVendorFilter(['node_modules', '.agents/skills']);
25
27
  * filter.shouldExclude('/project/node_modules/lodash/index.js'); // true
28
+ * filter.shouldExclude('/project/apps/foo/.agents/skills/bar.md'); // true
26
29
  * filter.shouldExclude('/project/src/utils.js'); // false
27
30
  * ```
28
31
  */
@@ -1 +1 @@
1
- {"version":3,"file":"vendor.d.ts","sourceRoot":"","sources":["../../../src/discovery/filters/vendor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,iHAWtB,CAAC;AAEX;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,UAAU,CAoBnE"}
1
+ {"version":3,"file":"vendor.d.ts","sourceRoot":"","sources":["../../../src/discovery/filters/vendor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,iHAWtB,CAAC;AAEX;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,UAAU,CAqCnE"}
@@ -25,28 +25,48 @@ export const DEFAULT_VENDOR_DIRS = [
25
25
  /**
26
26
  * Creates a vendor filter that excludes files within specified directories.
27
27
  *
28
- * @param vendorDirs - Array of directory names to exclude. Files within
29
- * any of these directories (at any nesting level) will
30
- * be excluded.
28
+ * Supports two patterns:
29
+ * - Single directory names (e.g., 'node_modules') - matches anywhere in path
30
+ * - Path patterns (e.g., 'apps/vendor' or '.agents/skills') - matches path containing this sequence
31
+ *
32
+ * @param vendorDirs - Array of directory names or path patterns to exclude.
31
33
  * @returns A FileFilter that checks if a path is within a vendor directory
32
34
  *
33
35
  * @example
34
36
  * ```typescript
35
- * const filter = createVendorFilter(['node_modules', 'vendor']);
37
+ * const filter = createVendorFilter(['node_modules', '.agents/skills']);
36
38
  * filter.shouldExclude('/project/node_modules/lodash/index.js'); // true
39
+ * filter.shouldExclude('/project/apps/foo/.agents/skills/bar.md'); // true
37
40
  * filter.shouldExclude('/project/src/utils.js'); // false
38
41
  * ```
39
42
  */
40
43
  export function createVendorFilter(vendorDirs) {
41
- // Convert to Set for O(1) lookup
42
- const vendorSet = new Set(vendorDirs);
44
+ // Separate single segments from path patterns
45
+ const singleSegments = new Set();
46
+ const pathPatterns = [];
47
+ for (const dir of vendorDirs) {
48
+ // Normalize path separators to current OS
49
+ const normalized = dir.replace(/[\\/]/g, path.sep);
50
+ if (normalized.includes(path.sep)) {
51
+ pathPatterns.push(normalized);
52
+ }
53
+ else {
54
+ singleSegments.add(dir);
55
+ }
56
+ }
43
57
  return {
44
58
  name: 'vendor',
45
59
  shouldExclude(absolutePath) {
46
- // Split path by separator and check if any segment matches vendor dirs
60
+ // Check single segment matches
47
61
  const segments = absolutePath.split(path.sep);
48
62
  for (const segment of segments) {
49
- if (vendorSet.has(segment)) {
63
+ if (singleSegments.has(segment)) {
64
+ return true;
65
+ }
66
+ }
67
+ // Check path pattern matches
68
+ for (const pattern of pathPatterns) {
69
+ if (absolutePath.includes(pattern)) {
50
70
  return true;
51
71
  }
52
72
  }
@@ -1 +1 @@
1
- {"version":3,"file":"vendor.js","sourceRoot":"","sources":["../../../src/discovery/filters/vendor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,cAAc;IACd,QAAQ;IACR,MAAM;IACN,MAAM;IACN,OAAO;IACP,aAAa;IACb,OAAO;IACP,MAAM;IACN,OAAO;IACP,QAAQ;CACA,CAAC;AAEX;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,kBAAkB,CAAC,UAAoB;IACrD,iCAAiC;IACjC,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;IAEtC,OAAO;QACL,IAAI,EAAE,QAAQ;QAEd,aAAa,CAAC,YAAoB;YAChC,uEAAuE;YACvE,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAE9C,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;gBAC/B,IAAI,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;oBAC3B,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;YAED,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"vendor.js","sourceRoot":"","sources":["../../../src/discovery/filters/vendor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,cAAc;IACd,QAAQ;IACR,MAAM;IACN,MAAM;IACN,OAA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version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "CLI tool for reverse-engineering codebase documentation for AI agents",
5
5
  "type": "module",
6
6
  "bin": {