@aiready/core 0.23.3 → 0.23.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/dist/index.d.mts CHANGED
@@ -376,7 +376,7 @@ declare function calculateImportSimilarity(export1: ExportWithImports, export2:
376
376
  * @param language - Target language
377
377
  * @returns Generic AST node or null if unsupported
378
378
  */
379
- declare function parseCode(code: string, language: string): ASTNode | null;
379
+ declare function parseCode(_code: string, _language: string): ASTNode | null;
380
380
  /**
381
381
  * Extract functions from an AST.
382
382
  * @deprecated Use parseFileExports instead for complete export metadata.
@@ -384,7 +384,7 @@ declare function parseCode(code: string, language: string): ASTNode | null;
384
384
  * @param ast - The AST to scan
385
385
  * @returns Array of function nodes
386
386
  */
387
- declare function extractFunctions(ast: ASTNode): ASTNode[];
387
+ declare function extractFunctions(_ast: ASTNode): ASTNode[];
388
388
  /**
389
389
  * Extract imports from an AST.
390
390
  * @deprecated Use parseFileExports instead for structured import info.
@@ -392,7 +392,7 @@ declare function extractFunctions(ast: ASTNode): ASTNode[];
392
392
  * @param ast - The AST to scan
393
393
  * @returns Array of imported module names
394
394
  */
395
- declare function extractImports(ast: ASTNode): string[];
395
+ declare function extractImports(_ast: ASTNode): string[];
396
396
 
397
397
  /**
398
398
  * Estimate token count for text (rough approximation)
@@ -774,7 +774,7 @@ declare abstract class BaseLanguageParser implements LanguageParser {
774
774
  * Get the parser name for tree-sitter setup
775
775
  */
776
776
  protected abstract getParserName(): string;
777
- getAST(code: string, filePath: string): Promise<Parser.Tree | null>;
777
+ getAST(code: string, _filePath?: string): Promise<Parser.Tree | null>;
778
778
  abstract analyzeMetadata(node: Parser.Node, code: string): Partial<ExportInfo>;
779
779
  parse(code: string, filePath: string): ParseResult;
780
780
  protected abstract extractImportsAST(rootNode: Parser.Node): ImportInfo[];
@@ -810,7 +810,7 @@ declare class JavaParser extends BaseLanguageParser {
810
810
  readonly extensions: string[];
811
811
  protected getParserName(): string;
812
812
  analyzeMetadata(node: Parser.Node, code: string): Partial<ExportInfo>;
813
- protected parseRegex(code: string, filePath: string): ParseResult;
813
+ protected parseRegex(code: string): ParseResult;
814
814
  protected extractImportsAST(rootNode: Parser.Node): ImportInfo[];
815
815
  protected extractExportsAST(rootNode: Parser.Node, code: string): ExportInfo[];
816
816
  private getModifiers;
@@ -828,7 +828,7 @@ declare class CSharpParser extends BaseLanguageParser {
828
828
  readonly extensions: string[];
829
829
  protected getParserName(): string;
830
830
  analyzeMetadata(node: Parser.Node, code: string): Partial<ExportInfo>;
831
- protected parseRegex(code: string, filePath: string): ParseResult;
831
+ protected parseRegex(code: string): ParseResult;
832
832
  protected extractImportsAST(rootNode: Parser.Node): ImportInfo[];
833
833
  protected extractExportsAST(rootNode: Parser.Node, code: string): ExportInfo[];
834
834
  private getModifiers;
@@ -845,7 +845,7 @@ declare class GoParser extends BaseLanguageParser {
845
845
  readonly extensions: string[];
846
846
  protected getParserName(): string;
847
847
  analyzeMetadata(node: Parser.Node, code: string): Partial<ExportInfo>;
848
- protected parseRegex(code: string, filePath: string): ParseResult;
848
+ protected parseRegex(code: string): ParseResult;
849
849
  protected extractImportsAST(rootNode: Parser.Node): ImportInfo[];
850
850
  protected extractExportsAST(rootNode: Parser.Node, code: string): ExportInfo[];
851
851
  private extractParameters;
package/dist/index.d.ts CHANGED
@@ -376,7 +376,7 @@ declare function calculateImportSimilarity(export1: ExportWithImports, export2:
376
376
  * @param language - Target language
377
377
  * @returns Generic AST node or null if unsupported
378
378
  */
379
- declare function parseCode(code: string, language: string): ASTNode | null;
379
+ declare function parseCode(_code: string, _language: string): ASTNode | null;
380
380
  /**
381
381
  * Extract functions from an AST.
382
382
  * @deprecated Use parseFileExports instead for complete export metadata.
@@ -384,7 +384,7 @@ declare function parseCode(code: string, language: string): ASTNode | null;
384
384
  * @param ast - The AST to scan
385
385
  * @returns Array of function nodes
386
386
  */
387
- declare function extractFunctions(ast: ASTNode): ASTNode[];
387
+ declare function extractFunctions(_ast: ASTNode): ASTNode[];
388
388
  /**
389
389
  * Extract imports from an AST.
390
390
  * @deprecated Use parseFileExports instead for structured import info.
@@ -392,7 +392,7 @@ declare function extractFunctions(ast: ASTNode): ASTNode[];
392
392
  * @param ast - The AST to scan
393
393
  * @returns Array of imported module names
394
394
  */
395
- declare function extractImports(ast: ASTNode): string[];
395
+ declare function extractImports(_ast: ASTNode): string[];
396
396
 
397
397
  /**
398
398
  * Estimate token count for text (rough approximation)
@@ -774,7 +774,7 @@ declare abstract class BaseLanguageParser implements LanguageParser {
774
774
  * Get the parser name for tree-sitter setup
775
775
  */
776
776
  protected abstract getParserName(): string;
777
- getAST(code: string, filePath: string): Promise<Parser.Tree | null>;
777
+ getAST(code: string, _filePath?: string): Promise<Parser.Tree | null>;
778
778
  abstract analyzeMetadata(node: Parser.Node, code: string): Partial<ExportInfo>;
779
779
  parse(code: string, filePath: string): ParseResult;
780
780
  protected abstract extractImportsAST(rootNode: Parser.Node): ImportInfo[];
@@ -810,7 +810,7 @@ declare class JavaParser extends BaseLanguageParser {
810
810
  readonly extensions: string[];
811
811
  protected getParserName(): string;
812
812
  analyzeMetadata(node: Parser.Node, code: string): Partial<ExportInfo>;
813
- protected parseRegex(code: string, filePath: string): ParseResult;
813
+ protected parseRegex(code: string): ParseResult;
814
814
  protected extractImportsAST(rootNode: Parser.Node): ImportInfo[];
815
815
  protected extractExportsAST(rootNode: Parser.Node, code: string): ExportInfo[];
816
816
  private getModifiers;
@@ -828,7 +828,7 @@ declare class CSharpParser extends BaseLanguageParser {
828
828
  readonly extensions: string[];
829
829
  protected getParserName(): string;
830
830
  analyzeMetadata(node: Parser.Node, code: string): Partial<ExportInfo>;
831
- protected parseRegex(code: string, filePath: string): ParseResult;
831
+ protected parseRegex(code: string): ParseResult;
832
832
  protected extractImportsAST(rootNode: Parser.Node): ImportInfo[];
833
833
  protected extractExportsAST(rootNode: Parser.Node, code: string): ExportInfo[];
834
834
  private getModifiers;
@@ -845,7 +845,7 @@ declare class GoParser extends BaseLanguageParser {
845
845
  readonly extensions: string[];
846
846
  protected getParserName(): string;
847
847
  analyzeMetadata(node: Parser.Node, code: string): Partial<ExportInfo>;
848
- protected parseRegex(code: string, filePath: string): ParseResult;
848
+ protected parseRegex(code: string): ParseResult;
849
849
  protected extractImportsAST(rootNode: Parser.Node): ImportInfo[];
850
850
  protected extractExportsAST(rootNode: Parser.Node, code: string): ExportInfo[];
851
851
  private extractParameters;
package/dist/index.js CHANGED
@@ -645,7 +645,7 @@ async function scanFiles(options) {
645
645
  try {
646
646
  const txt = await (0, import_promises.readFile)(ignoreFilePath, "utf-8");
647
647
  ignoreFromFile = txt.split(/\r?\n/).map((s) => s.trim()).filter(Boolean).filter((l) => !l.startsWith("#")).filter((l) => !l.startsWith("!"));
648
- } catch (e) {
648
+ } catch {
649
649
  ignoreFromFile = [];
650
650
  }
651
651
  }
@@ -699,7 +699,7 @@ async function scanFiles(options) {
699
699
  return !ig.ignores(rel);
700
700
  });
701
701
  return filtered;
702
- } catch (e) {
702
+ } catch {
703
703
  return files;
704
704
  }
705
705
  }
@@ -707,14 +707,14 @@ async function scanFiles(options) {
707
707
  }
708
708
  async function scanEntries(options) {
709
709
  const files = await scanFiles(options);
710
- const { rootDir, include = ["**/*"], exclude, includeTests } = options;
710
+ const { rootDir, exclude, includeTests } = options;
711
711
  const ignoreFilePath = (0, import_path.join)(rootDir || ".", ".aireadyignore");
712
712
  let ignoreFromFile = [];
713
713
  if ((0, import_fs.existsSync)(ignoreFilePath)) {
714
714
  try {
715
715
  const txt = await (0, import_promises.readFile)(ignoreFilePath, "utf-8");
716
716
  ignoreFromFile = txt.split(/\r?\n/).map((s) => s.trim()).filter(Boolean).filter((l) => !l.startsWith("#")).filter((l) => !l.startsWith("!"));
717
- } catch (e) {
717
+ } catch {
718
718
  ignoreFromFile = [];
719
719
  }
720
720
  }
@@ -1509,7 +1509,7 @@ function findFileRecursively(dir, fileName, depth) {
1509
1509
  if (found) return found;
1510
1510
  }
1511
1511
  }
1512
- } catch (err) {
1512
+ } catch {
1513
1513
  }
1514
1514
  return null;
1515
1515
  }
@@ -1543,7 +1543,7 @@ async function setupParser(language) {
1543
1543
  const Lang = await Parser.Language.load(wasmPath);
1544
1544
  parser.setLanguage(Lang);
1545
1545
  return parser;
1546
- } catch (error) {
1546
+ } catch {
1547
1547
  return null;
1548
1548
  }
1549
1549
  }
@@ -1566,7 +1566,8 @@ var BaseLanguageParser = class {
1566
1566
  console.warn(`Failed to initialize ${this.language} parser:`, error);
1567
1567
  }
1568
1568
  }
1569
- async getAST(code, filePath) {
1569
+ async getAST(code, _filePath) {
1570
+ void _filePath;
1570
1571
  if (!this.initialized) await this.initialize();
1571
1572
  if (!this.parser) return null;
1572
1573
  return this.parser.parse(code);
@@ -1801,10 +1802,11 @@ var PythonParser = class extends BaseLanguageParser {
1801
1802
  ]
1802
1803
  };
1803
1804
  } catch (error) {
1804
- throw new ParseError(
1805
- `Failed to parse Python file ${filePath}: ${error.message}`,
1806
- filePath
1805
+ const wrapper = new Error(
1806
+ `Failed to parse Python file ${filePath}: ${error.message}`
1807
1807
  );
1808
+ wrapper.cause = error;
1809
+ throw wrapper;
1808
1810
  }
1809
1811
  }
1810
1812
  getNamingConventions() {
@@ -1835,6 +1837,7 @@ var PythonParser = class extends BaseLanguageParser {
1835
1837
  return filePath.toLowerCase().endsWith(".py");
1836
1838
  }
1837
1839
  extractImportsRegex(code, _filePath) {
1840
+ void _filePath;
1838
1841
  const imports = [];
1839
1842
  const lines = code.split("\n");
1840
1843
  const importRegex = /^\s*import\s+([a-zA-Z0-9_., ]+)/;
@@ -1885,6 +1888,7 @@ var PythonParser = class extends BaseLanguageParser {
1885
1888
  return imports;
1886
1889
  }
1887
1890
  extractExportsRegex(code, _filePath) {
1891
+ void _filePath;
1888
1892
  const exports2 = [];
1889
1893
  const lines = code.split("\n");
1890
1894
  const funcRegex = /^def\s+([a-zA-Z0-9_]+)\s*\(/;
@@ -2068,7 +2072,7 @@ var JavaParser = class extends BaseLanguageParser {
2068
2072
  ]
2069
2073
  });
2070
2074
  }
2071
- parseRegex(code, filePath) {
2075
+ parseRegex(code) {
2072
2076
  const lines = code.split("\n");
2073
2077
  const exports2 = [];
2074
2078
  const imports = [];
@@ -2142,10 +2146,8 @@ var JavaParser = class extends BaseLanguageParser {
2142
2146
  for (const node of rootNode.children) {
2143
2147
  if (node.type === "import_declaration") {
2144
2148
  const sourceArr = [];
2145
- let isStatic = false;
2146
2149
  let isWildcard = false;
2147
2150
  for (const child of node.children) {
2148
- if (child.type === "static") isStatic = true;
2149
2151
  if (child.type === "scoped_identifier" || child.type === "identifier") {
2150
2152
  sourceArr.push(child.text);
2151
2153
  }
@@ -2270,7 +2272,7 @@ var CSharpParser = class extends BaseLanguageParser {
2270
2272
  sideEffectSignatures: ["Console.Write", "File.Write", "Logging."]
2271
2273
  });
2272
2274
  }
2273
- parseRegex(code, filePath) {
2275
+ parseRegex(code) {
2274
2276
  const lines = code.split("\n");
2275
2277
  const exports2 = [];
2276
2278
  const imports = [];
@@ -2480,7 +2482,7 @@ var GoParser = class extends BaseLanguageParser {
2480
2482
  sideEffectSignatures: ["<-", "fmt.Print", "fmt.Fprintf", "os.Exit"]
2481
2483
  });
2482
2484
  }
2483
- parseRegex(code, filePath) {
2485
+ parseRegex(code) {
2484
2486
  const lines = code.split("\n");
2485
2487
  const exports2 = [];
2486
2488
  const imports = [];
@@ -2970,7 +2972,7 @@ function parseFileExports(code, filePath) {
2970
2972
  isTypeOnly: i.isTypeOnly || false
2971
2973
  }))
2972
2974
  };
2973
- } catch (e) {
2975
+ } catch {
2974
2976
  return { exports: [], imports: [] };
2975
2977
  }
2976
2978
  }
@@ -2984,7 +2986,7 @@ function parseFileExports(code, filePath) {
2984
2986
  const imports = extractFileImports(ast);
2985
2987
  const exports2 = extractExportsWithDependencies(ast, imports);
2986
2988
  return { exports: exports2, imports };
2987
- } catch (error) {
2989
+ } catch {
2988
2990
  return { exports: [], imports: [] };
2989
2991
  }
2990
2992
  }
@@ -2998,13 +3000,17 @@ function calculateImportSimilarity(export1, export2) {
2998
3000
  const union = /* @__PURE__ */ new Set([...set1, ...set2]);
2999
3001
  return intersection.size / union.size;
3000
3002
  }
3001
- function parseCode(code, language) {
3003
+ function parseCode(_code, _language) {
3004
+ void _code;
3005
+ void _language;
3002
3006
  return null;
3003
3007
  }
3004
- function extractFunctions(ast) {
3008
+ function extractFunctions(_ast) {
3009
+ void _ast;
3005
3010
  return [];
3006
3011
  }
3007
- function extractImports(ast) {
3012
+ function extractImports(_ast) {
3013
+ void _ast;
3008
3014
  return [];
3009
3015
  }
3010
3016
 
package/dist/index.mjs CHANGED
@@ -304,7 +304,7 @@ async function scanFiles(options) {
304
304
  try {
305
305
  const txt = await readFile(ignoreFilePath, "utf-8");
306
306
  ignoreFromFile = txt.split(/\r?\n/).map((s) => s.trim()).filter(Boolean).filter((l) => !l.startsWith("#")).filter((l) => !l.startsWith("!"));
307
- } catch (e) {
307
+ } catch {
308
308
  ignoreFromFile = [];
309
309
  }
310
310
  }
@@ -358,7 +358,7 @@ async function scanFiles(options) {
358
358
  return !ig.ignores(rel);
359
359
  });
360
360
  return filtered;
361
- } catch (e) {
361
+ } catch {
362
362
  return files;
363
363
  }
364
364
  }
@@ -366,14 +366,14 @@ async function scanFiles(options) {
366
366
  }
367
367
  async function scanEntries(options) {
368
368
  const files = await scanFiles(options);
369
- const { rootDir, include = ["**/*"], exclude, includeTests } = options;
369
+ const { rootDir, exclude, includeTests } = options;
370
370
  const ignoreFilePath = join(rootDir || ".", ".aireadyignore");
371
371
  let ignoreFromFile = [];
372
372
  if (existsSync(ignoreFilePath)) {
373
373
  try {
374
374
  const txt = await readFile(ignoreFilePath, "utf-8");
375
375
  ignoreFromFile = txt.split(/\r?\n/).map((s) => s.trim()).filter(Boolean).filter((l) => !l.startsWith("#")).filter((l) => !l.startsWith("!"));
376
- } catch (e) {
376
+ } catch {
377
377
  ignoreFromFile = [];
378
378
  }
379
379
  }
@@ -1174,7 +1174,7 @@ function findFileRecursively(dir, fileName, depth) {
1174
1174
  if (found) return found;
1175
1175
  }
1176
1176
  }
1177
- } catch (err) {
1177
+ } catch {
1178
1178
  }
1179
1179
  return null;
1180
1180
  }
@@ -1208,7 +1208,7 @@ async function setupParser(language) {
1208
1208
  const Lang = await Parser.Language.load(wasmPath);
1209
1209
  parser.setLanguage(Lang);
1210
1210
  return parser;
1211
- } catch (error) {
1211
+ } catch {
1212
1212
  return null;
1213
1213
  }
1214
1214
  }
@@ -1231,7 +1231,8 @@ var BaseLanguageParser = class {
1231
1231
  console.warn(`Failed to initialize ${this.language} parser:`, error);
1232
1232
  }
1233
1233
  }
1234
- async getAST(code, filePath) {
1234
+ async getAST(code, _filePath) {
1235
+ void _filePath;
1235
1236
  if (!this.initialized) await this.initialize();
1236
1237
  if (!this.parser) return null;
1237
1238
  return this.parser.parse(code);
@@ -1466,10 +1467,11 @@ var PythonParser = class extends BaseLanguageParser {
1466
1467
  ]
1467
1468
  };
1468
1469
  } catch (error) {
1469
- throw new ParseError(
1470
- `Failed to parse Python file ${filePath}: ${error.message}`,
1471
- filePath
1470
+ const wrapper = new Error(
1471
+ `Failed to parse Python file ${filePath}: ${error.message}`
1472
1472
  );
1473
+ wrapper.cause = error;
1474
+ throw wrapper;
1473
1475
  }
1474
1476
  }
1475
1477
  getNamingConventions() {
@@ -1500,6 +1502,7 @@ var PythonParser = class extends BaseLanguageParser {
1500
1502
  return filePath.toLowerCase().endsWith(".py");
1501
1503
  }
1502
1504
  extractImportsRegex(code, _filePath) {
1505
+ void _filePath;
1503
1506
  const imports = [];
1504
1507
  const lines = code.split("\n");
1505
1508
  const importRegex = /^\s*import\s+([a-zA-Z0-9_., ]+)/;
@@ -1550,6 +1553,7 @@ var PythonParser = class extends BaseLanguageParser {
1550
1553
  return imports;
1551
1554
  }
1552
1555
  extractExportsRegex(code, _filePath) {
1556
+ void _filePath;
1553
1557
  const exports = [];
1554
1558
  const lines = code.split("\n");
1555
1559
  const funcRegex = /^def\s+([a-zA-Z0-9_]+)\s*\(/;
@@ -1733,7 +1737,7 @@ var JavaParser = class extends BaseLanguageParser {
1733
1737
  ]
1734
1738
  });
1735
1739
  }
1736
- parseRegex(code, filePath) {
1740
+ parseRegex(code) {
1737
1741
  const lines = code.split("\n");
1738
1742
  const exports = [];
1739
1743
  const imports = [];
@@ -1807,10 +1811,8 @@ var JavaParser = class extends BaseLanguageParser {
1807
1811
  for (const node of rootNode.children) {
1808
1812
  if (node.type === "import_declaration") {
1809
1813
  const sourceArr = [];
1810
- let isStatic = false;
1811
1814
  let isWildcard = false;
1812
1815
  for (const child of node.children) {
1813
- if (child.type === "static") isStatic = true;
1814
1816
  if (child.type === "scoped_identifier" || child.type === "identifier") {
1815
1817
  sourceArr.push(child.text);
1816
1818
  }
@@ -1935,7 +1937,7 @@ var CSharpParser = class extends BaseLanguageParser {
1935
1937
  sideEffectSignatures: ["Console.Write", "File.Write", "Logging."]
1936
1938
  });
1937
1939
  }
1938
- parseRegex(code, filePath) {
1940
+ parseRegex(code) {
1939
1941
  const lines = code.split("\n");
1940
1942
  const exports = [];
1941
1943
  const imports = [];
@@ -2145,7 +2147,7 @@ var GoParser = class extends BaseLanguageParser {
2145
2147
  sideEffectSignatures: ["<-", "fmt.Print", "fmt.Fprintf", "os.Exit"]
2146
2148
  });
2147
2149
  }
2148
- parseRegex(code, filePath) {
2150
+ parseRegex(code) {
2149
2151
  const lines = code.split("\n");
2150
2152
  const exports = [];
2151
2153
  const imports = [];
@@ -2635,7 +2637,7 @@ function parseFileExports(code, filePath) {
2635
2637
  isTypeOnly: i.isTypeOnly || false
2636
2638
  }))
2637
2639
  };
2638
- } catch (e) {
2640
+ } catch {
2639
2641
  return { exports: [], imports: [] };
2640
2642
  }
2641
2643
  }
@@ -2649,7 +2651,7 @@ function parseFileExports(code, filePath) {
2649
2651
  const imports = extractFileImports(ast);
2650
2652
  const exports = extractExportsWithDependencies(ast, imports);
2651
2653
  return { exports, imports };
2652
- } catch (error) {
2654
+ } catch {
2653
2655
  return { exports: [], imports: [] };
2654
2656
  }
2655
2657
  }
@@ -2663,13 +2665,17 @@ function calculateImportSimilarity(export1, export2) {
2663
2665
  const union = /* @__PURE__ */ new Set([...set1, ...set2]);
2664
2666
  return intersection.size / union.size;
2665
2667
  }
2666
- function parseCode(code, language) {
2668
+ function parseCode(_code, _language) {
2669
+ void _code;
2670
+ void _language;
2667
2671
  return null;
2668
2672
  }
2669
- function extractFunctions(ast) {
2673
+ function extractFunctions(_ast) {
2674
+ void _ast;
2670
2675
  return [];
2671
2676
  }
2672
- function extractImports(ast) {
2677
+ function extractImports(_ast) {
2678
+ void _ast;
2673
2679
  return [];
2674
2680
  }
2675
2681
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiready/core",
3
- "version": "0.23.3",
3
+ "version": "0.23.4",
4
4
  "description": "Shared utilities for AIReady analysis tools",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",