@aiready/core 0.21.17 → 0.21.18

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
@@ -1,8 +1,8 @@
1
1
  import { ToolName, ScanOptions, SpokeOutput, ToolScoringOutput, AIReadyConfig, ModelContextTier, CostConfig, TokenBudget, ProductivityImpact, AcceptancePrediction, ComprehensionDifficulty, TechnicalValueChainSummary, TechnicalValueChain, LanguageParser, Language, ExportInfo, ParseResult, NamingConvention } from './client.mjs';
2
2
  export { AnalysisResult, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, BusinessReport, COMMON_FINE_TUNING_OPTIONS, CONTEXT_TIER_THRESHOLDS, CommonASTNode, DEFAULT_TOOL_WEIGHTS, FRIENDLY_TOOL_NAMES, GLOBAL_INFRA_OPTIONS, GLOBAL_SCAN_OPTIONS, GraphData, GraphEdge, GraphIssueSeverity, GraphMetadata, GraphNode, ImportInfo, Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, LanguageConfig, Location, LocationSchema, Metrics, MetricsSchema, ModelTier, ModelTierSchema, ParseError, ParseStatistics, Report, SIZE_ADJUSTED_THRESHOLDS, ScoringConfig, ScoringResult, Severity, SeveritySchema, SourceLocation, SourceRange, SpokeOutputSchema, SpokeSummary, SpokeSummarySchema, TOOL_NAME_MAP, ToolNameSchema, UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString } from './client.mjs';
3
3
  import { z } from 'zod';
4
- import { TSESTree } from '@typescript-eslint/typescript-estree';
5
4
  import * as Parser from 'web-tree-sitter';
5
+ import { TSESTree } from '@typescript-eslint/typescript-estree';
6
6
 
7
7
  /**
8
8
  * Spoke-to-Hub Contract Definitions
@@ -475,6 +475,19 @@ declare function isFileSupported(filePath: string): boolean;
475
475
  */
476
476
  declare function getSupportedLanguages(): Language[];
477
477
 
478
+ /**
479
+ * Initialize tree-sitter once
480
+ */
481
+ declare function initTreeSitter(): Promise<void>;
482
+ /**
483
+ * Find a WASM file for a specific language
484
+ */
485
+ declare function getWasmPath(language: string): string | null;
486
+ /**
487
+ * Load a language and return a configured parser
488
+ */
489
+ declare function setupParser(language: string): Promise<Parser.Parser | null>;
490
+
478
491
  /**
479
492
  * TypeScript/JavaScript Parser
480
493
  *
@@ -923,4 +936,4 @@ declare function getRepoMetadata(directory: string): {
923
936
  author?: string;
924
937
  };
925
938
 
926
- export { AIReadyConfig, type ASTNode, AcceptancePrediction, type AgentGroundingScore, type AiSignalClarity, type AiSignalClaritySignal, type CLIOptions, CSharpParser, type ChangeAmplificationScore, type CognitiveLoad, ComprehensionDifficulty, type ConceptCohesion, CostConfig, DEFAULT_COST_CONFIG, DEFAULT_EXCLUDE, type DependencyHealthScore, type DocDriftRisk, ExportInfo, type ExportWithImports, type FileImport, type FileWithDomain, GoParser, JavaParser, type KnowledgeConcentrationRisk, Language, LanguageParser, type LoadFactor, MODEL_PRICING_PRESETS, ModelContextTier, type ModelPricingPreset, NamingConvention, ParseResult, ParserFactory, type PatternEntropy, ProductivityImpact, PythonParser, SEVERITY_TIME_ESTIMATES, ScanOptions, type ScoreHistoryEntry, type ScoreTrend, type SemanticDistance, SpokeOutput, type TechnicalDebtInterest, TechnicalValueChain, TechnicalValueChainSummary, type TestabilityIndex, TokenBudget, ToolName, type ToolProvider, ToolRegistry, ToolScoringOutput, TypeScriptParser, VAGUE_FILE_NAMES, calculateAgentGrounding, calculateAiSignalClarity, calculateBusinessROI, calculateChangeAmplification, calculateCognitiveLoad, calculateComprehensionDifficulty, calculateConceptCohesion, calculateDebtInterest, calculateDependencyHealth, calculateDocDrift, calculateExtendedFutureProofScore, calculateFutureProofScore, calculateImportSimilarity, calculateKnowledgeConcentration, calculateMonthlyCost, calculatePatternEntropy, calculateProductivityImpact, calculateSemanticDistance, calculateTechnicalValueChain, calculateTestabilityIndex, calculateTokenBudget, clearHistory, emitProgress, estimateCostFromBudget, estimateTokens, exportHistory, extractFunctions, extractImports, formatAcceptanceRate, formatCost, formatHours, generateValueChain, getElapsedTime, getFileCommitTimestamps, getFileExtension, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getSafetyIcon, getScoreBar, getSeverityColor, getSupportedLanguages, handleCLIError, handleJSONOutput, initializeParsers, isFileSupported, isSourceFile, loadConfig, loadMergedConfig, loadScoreHistory, mergeConfigWithDefaults, parseCode, parseFileExports, predictAcceptanceRate, readFileContent, resolveOutputPath, saveScoreEntry, scanEntries, scanFiles, validateSpokeOutput, validateWithSchema };
939
+ export { AIReadyConfig, type ASTNode, AcceptancePrediction, type AgentGroundingScore, type AiSignalClarity, type AiSignalClaritySignal, type CLIOptions, CSharpParser, type ChangeAmplificationScore, type CognitiveLoad, ComprehensionDifficulty, type ConceptCohesion, CostConfig, DEFAULT_COST_CONFIG, DEFAULT_EXCLUDE, type DependencyHealthScore, type DocDriftRisk, ExportInfo, type ExportWithImports, type FileImport, type FileWithDomain, GoParser, JavaParser, type KnowledgeConcentrationRisk, Language, LanguageParser, type LoadFactor, MODEL_PRICING_PRESETS, ModelContextTier, type ModelPricingPreset, NamingConvention, ParseResult, ParserFactory, type PatternEntropy, ProductivityImpact, PythonParser, SEVERITY_TIME_ESTIMATES, ScanOptions, type ScoreHistoryEntry, type ScoreTrend, type SemanticDistance, SpokeOutput, type TechnicalDebtInterest, TechnicalValueChain, TechnicalValueChainSummary, type TestabilityIndex, TokenBudget, ToolName, type ToolProvider, ToolRegistry, ToolScoringOutput, TypeScriptParser, VAGUE_FILE_NAMES, calculateAgentGrounding, calculateAiSignalClarity, calculateBusinessROI, calculateChangeAmplification, calculateCognitiveLoad, calculateComprehensionDifficulty, calculateConceptCohesion, calculateDebtInterest, calculateDependencyHealth, calculateDocDrift, calculateExtendedFutureProofScore, calculateFutureProofScore, calculateImportSimilarity, calculateKnowledgeConcentration, calculateMonthlyCost, calculatePatternEntropy, calculateProductivityImpact, calculateSemanticDistance, calculateTechnicalValueChain, calculateTestabilityIndex, calculateTokenBudget, clearHistory, emitProgress, estimateCostFromBudget, estimateTokens, exportHistory, extractFunctions, extractImports, formatAcceptanceRate, formatCost, formatHours, generateValueChain, getElapsedTime, getFileCommitTimestamps, getFileExtension, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getSafetyIcon, getScoreBar, getSeverityColor, getSupportedLanguages, getWasmPath, handleCLIError, handleJSONOutput, initTreeSitter, initializeParsers, isFileSupported, isSourceFile, loadConfig, loadMergedConfig, loadScoreHistory, mergeConfigWithDefaults, parseCode, parseFileExports, predictAcceptanceRate, readFileContent, resolveOutputPath, saveScoreEntry, scanEntries, scanFiles, setupParser, validateSpokeOutput, validateWithSchema };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { ToolName, ScanOptions, SpokeOutput, ToolScoringOutput, AIReadyConfig, ModelContextTier, CostConfig, TokenBudget, ProductivityImpact, AcceptancePrediction, ComprehensionDifficulty, TechnicalValueChainSummary, TechnicalValueChain, LanguageParser, Language, ExportInfo, ParseResult, NamingConvention } from './client.js';
2
2
  export { AnalysisResult, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, BusinessReport, COMMON_FINE_TUNING_OPTIONS, CONTEXT_TIER_THRESHOLDS, CommonASTNode, DEFAULT_TOOL_WEIGHTS, FRIENDLY_TOOL_NAMES, GLOBAL_INFRA_OPTIONS, GLOBAL_SCAN_OPTIONS, GraphData, GraphEdge, GraphIssueSeverity, GraphMetadata, GraphNode, ImportInfo, Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, LanguageConfig, Location, LocationSchema, Metrics, MetricsSchema, ModelTier, ModelTierSchema, ParseError, ParseStatistics, Report, SIZE_ADJUSTED_THRESHOLDS, ScoringConfig, ScoringResult, Severity, SeveritySchema, SourceLocation, SourceRange, SpokeOutputSchema, SpokeSummary, SpokeSummarySchema, TOOL_NAME_MAP, ToolNameSchema, UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString } from './client.js';
3
3
  import { z } from 'zod';
4
- import { TSESTree } from '@typescript-eslint/typescript-estree';
5
4
  import * as Parser from 'web-tree-sitter';
5
+ import { TSESTree } from '@typescript-eslint/typescript-estree';
6
6
 
7
7
  /**
8
8
  * Spoke-to-Hub Contract Definitions
@@ -475,6 +475,19 @@ declare function isFileSupported(filePath: string): boolean;
475
475
  */
476
476
  declare function getSupportedLanguages(): Language[];
477
477
 
478
+ /**
479
+ * Initialize tree-sitter once
480
+ */
481
+ declare function initTreeSitter(): Promise<void>;
482
+ /**
483
+ * Find a WASM file for a specific language
484
+ */
485
+ declare function getWasmPath(language: string): string | null;
486
+ /**
487
+ * Load a language and return a configured parser
488
+ */
489
+ declare function setupParser(language: string): Promise<Parser.Parser | null>;
490
+
478
491
  /**
479
492
  * TypeScript/JavaScript Parser
480
493
  *
@@ -923,4 +936,4 @@ declare function getRepoMetadata(directory: string): {
923
936
  author?: string;
924
937
  };
925
938
 
926
- export { AIReadyConfig, type ASTNode, AcceptancePrediction, type AgentGroundingScore, type AiSignalClarity, type AiSignalClaritySignal, type CLIOptions, CSharpParser, type ChangeAmplificationScore, type CognitiveLoad, ComprehensionDifficulty, type ConceptCohesion, CostConfig, DEFAULT_COST_CONFIG, DEFAULT_EXCLUDE, type DependencyHealthScore, type DocDriftRisk, ExportInfo, type ExportWithImports, type FileImport, type FileWithDomain, GoParser, JavaParser, type KnowledgeConcentrationRisk, Language, LanguageParser, type LoadFactor, MODEL_PRICING_PRESETS, ModelContextTier, type ModelPricingPreset, NamingConvention, ParseResult, ParserFactory, type PatternEntropy, ProductivityImpact, PythonParser, SEVERITY_TIME_ESTIMATES, ScanOptions, type ScoreHistoryEntry, type ScoreTrend, type SemanticDistance, SpokeOutput, type TechnicalDebtInterest, TechnicalValueChain, TechnicalValueChainSummary, type TestabilityIndex, TokenBudget, ToolName, type ToolProvider, ToolRegistry, ToolScoringOutput, TypeScriptParser, VAGUE_FILE_NAMES, calculateAgentGrounding, calculateAiSignalClarity, calculateBusinessROI, calculateChangeAmplification, calculateCognitiveLoad, calculateComprehensionDifficulty, calculateConceptCohesion, calculateDebtInterest, calculateDependencyHealth, calculateDocDrift, calculateExtendedFutureProofScore, calculateFutureProofScore, calculateImportSimilarity, calculateKnowledgeConcentration, calculateMonthlyCost, calculatePatternEntropy, calculateProductivityImpact, calculateSemanticDistance, calculateTechnicalValueChain, calculateTestabilityIndex, calculateTokenBudget, clearHistory, emitProgress, estimateCostFromBudget, estimateTokens, exportHistory, extractFunctions, extractImports, formatAcceptanceRate, formatCost, formatHours, generateValueChain, getElapsedTime, getFileCommitTimestamps, getFileExtension, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getSafetyIcon, getScoreBar, getSeverityColor, getSupportedLanguages, handleCLIError, handleJSONOutput, initializeParsers, isFileSupported, isSourceFile, loadConfig, loadMergedConfig, loadScoreHistory, mergeConfigWithDefaults, parseCode, parseFileExports, predictAcceptanceRate, readFileContent, resolveOutputPath, saveScoreEntry, scanEntries, scanFiles, validateSpokeOutput, validateWithSchema };
939
+ export { AIReadyConfig, type ASTNode, AcceptancePrediction, type AgentGroundingScore, type AiSignalClarity, type AiSignalClaritySignal, type CLIOptions, CSharpParser, type ChangeAmplificationScore, type CognitiveLoad, ComprehensionDifficulty, type ConceptCohesion, CostConfig, DEFAULT_COST_CONFIG, DEFAULT_EXCLUDE, type DependencyHealthScore, type DocDriftRisk, ExportInfo, type ExportWithImports, type FileImport, type FileWithDomain, GoParser, JavaParser, type KnowledgeConcentrationRisk, Language, LanguageParser, type LoadFactor, MODEL_PRICING_PRESETS, ModelContextTier, type ModelPricingPreset, NamingConvention, ParseResult, ParserFactory, type PatternEntropy, ProductivityImpact, PythonParser, SEVERITY_TIME_ESTIMATES, ScanOptions, type ScoreHistoryEntry, type ScoreTrend, type SemanticDistance, SpokeOutput, type TechnicalDebtInterest, TechnicalValueChain, TechnicalValueChainSummary, type TestabilityIndex, TokenBudget, ToolName, type ToolProvider, ToolRegistry, ToolScoringOutput, TypeScriptParser, VAGUE_FILE_NAMES, calculateAgentGrounding, calculateAiSignalClarity, calculateBusinessROI, calculateChangeAmplification, calculateCognitiveLoad, calculateComprehensionDifficulty, calculateConceptCohesion, calculateDebtInterest, calculateDependencyHealth, calculateDocDrift, calculateExtendedFutureProofScore, calculateFutureProofScore, calculateImportSimilarity, calculateKnowledgeConcentration, calculateMonthlyCost, calculatePatternEntropy, calculateProductivityImpact, calculateSemanticDistance, calculateTechnicalValueChain, calculateTestabilityIndex, calculateTokenBudget, clearHistory, emitProgress, estimateCostFromBudget, estimateTokens, exportHistory, extractFunctions, extractImports, formatAcceptanceRate, formatCost, formatHours, generateValueChain, getElapsedTime, getFileCommitTimestamps, getFileExtension, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getSafetyIcon, getScoreBar, getSeverityColor, getSupportedLanguages, getWasmPath, handleCLIError, handleJSONOutput, initTreeSitter, initializeParsers, isFileSupported, isSourceFile, loadConfig, loadMergedConfig, loadScoreHistory, mergeConfigWithDefaults, parseCode, parseFileExports, predictAcceptanceRate, readFileContent, resolveOutputPath, saveScoreEntry, scanEntries, scanFiles, setupParser, validateSpokeOutput, validateWithSchema };
package/dist/index.js CHANGED
@@ -124,8 +124,10 @@ __export(index_exports, {
124
124
  getSeverityColor: () => getSeverityColor,
125
125
  getSupportedLanguages: () => getSupportedLanguages,
126
126
  getToolWeight: () => getToolWeight,
127
+ getWasmPath: () => getWasmPath,
127
128
  handleCLIError: () => handleCLIError,
128
129
  handleJSONOutput: () => handleJSONOutput,
130
+ initTreeSitter: () => initTreeSitter,
129
131
  initializeParsers: () => initializeParsers,
130
132
  isFileSupported: () => isFileSupported,
131
133
  isSourceFile: () => isSourceFile,
@@ -143,6 +145,7 @@ __export(index_exports, {
143
145
  saveScoreEntry: () => saveScoreEntry,
144
146
  scanEntries: () => scanEntries,
145
147
  scanFiles: () => scanFiles,
148
+ setupParser: () => setupParser,
146
149
  validateSpokeOutput: () => validateSpokeOutput,
147
150
  validateWithSchema: () => validateWithSchema
148
151
  });
@@ -336,15 +339,15 @@ var COMMON_FINE_TUNING_OPTIONS = [
336
339
  var GLOBAL_SCAN_OPTIONS = [...GLOBAL_INFRA_OPTIONS];
337
340
 
338
341
  // src/types/language.ts
339
- var Language = /* @__PURE__ */ ((Language6) => {
340
- Language6["TypeScript"] = "typescript";
341
- Language6["JavaScript"] = "javascript";
342
- Language6["Python"] = "python";
343
- Language6["Java"] = "java";
344
- Language6["Go"] = "go";
345
- Language6["Rust"] = "rust";
346
- Language6["CSharp"] = "csharp";
347
- return Language6;
342
+ var Language = /* @__PURE__ */ ((Language3) => {
343
+ Language3["TypeScript"] = "typescript";
344
+ Language3["JavaScript"] = "javascript";
345
+ Language3["Python"] = "python";
346
+ Language3["Java"] = "java";
347
+ Language3["Go"] = "go";
348
+ Language3["Rust"] = "rust";
349
+ Language3["CSharp"] = "csharp";
350
+ return Language3;
348
351
  })(Language || {});
349
352
  var LANGUAGE_EXTENSIONS = {
350
353
  ".ts": "typescript" /* TypeScript */,
@@ -1119,10 +1122,95 @@ var TypeScriptParser = class {
1119
1122
  }
1120
1123
  };
1121
1124
 
1122
- // src/parsers/python-parser.ts
1125
+ // src/parsers/tree-sitter-utils.ts
1123
1126
  var Parser = __toESM(require("web-tree-sitter"));
1124
1127
  var path = __toESM(require("path"));
1125
1128
  var fs = __toESM(require("fs"));
1129
+ var isTreeSitterInitialized = false;
1130
+ async function initTreeSitter() {
1131
+ if (isTreeSitterInitialized) return;
1132
+ try {
1133
+ const wasmPath = getWasmPath("web-tree-sitter");
1134
+ await Parser.Parser.init({
1135
+ locateFile() {
1136
+ return wasmPath || "web-tree-sitter.wasm";
1137
+ }
1138
+ });
1139
+ isTreeSitterInitialized = true;
1140
+ } catch (error) {
1141
+ console.error("Failed to initialize web-tree-sitter:", error);
1142
+ isTreeSitterInitialized = true;
1143
+ }
1144
+ }
1145
+ function findInPnpmStore(startDir, fileName, depth = 0) {
1146
+ if (depth > 8) return null;
1147
+ const pnpmDir = path.join(startDir, "node_modules", ".pnpm");
1148
+ if (fs.existsSync(pnpmDir)) {
1149
+ return findFileRecursively(pnpmDir, fileName, 0);
1150
+ }
1151
+ const parent = path.dirname(startDir);
1152
+ if (parent === startDir) return null;
1153
+ return findInPnpmStore(parent, fileName, depth + 1);
1154
+ }
1155
+ function findFileRecursively(dir, fileName, depth) {
1156
+ if (depth > 6) return null;
1157
+ try {
1158
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
1159
+ for (const entry of entries) {
1160
+ if (entry.isFile() && entry.name === fileName) {
1161
+ return path.join(dir, entry.name);
1162
+ }
1163
+ }
1164
+ for (const entry of entries) {
1165
+ if (entry.isDirectory()) {
1166
+ const found = findFileRecursively(
1167
+ path.join(dir, entry.name),
1168
+ fileName,
1169
+ depth + 1
1170
+ );
1171
+ if (found) return found;
1172
+ }
1173
+ }
1174
+ } catch (err) {
1175
+ }
1176
+ return null;
1177
+ }
1178
+ function getWasmPath(language) {
1179
+ const wasmFileName = language === "web-tree-sitter" ? "web-tree-sitter.wasm" : `tree-sitter-${language}.wasm`;
1180
+ const immediatePaths = [
1181
+ path.join(process.cwd(), wasmFileName),
1182
+ path.join(__dirname, wasmFileName),
1183
+ path.join(__dirname, "assets", wasmFileName)
1184
+ ];
1185
+ for (const p of immediatePaths) {
1186
+ if (fs.existsSync(p)) return p;
1187
+ }
1188
+ const pnpmPath = findInPnpmStore(__dirname, wasmFileName);
1189
+ if (pnpmPath) return pnpmPath;
1190
+ const pnpmPathCwd = findInPnpmStore(process.cwd(), wasmFileName);
1191
+ if (pnpmPathCwd) return pnpmPathCwd;
1192
+ console.warn(
1193
+ `[Parser] WASM file for ${language} not found. CWD: ${process.cwd()}, DIR: ${__dirname}`
1194
+ );
1195
+ return null;
1196
+ }
1197
+ async function setupParser(language) {
1198
+ await initTreeSitter();
1199
+ const wasmPath = getWasmPath(language);
1200
+ if (!wasmPath) {
1201
+ return null;
1202
+ }
1203
+ try {
1204
+ const parser = new Parser.Parser();
1205
+ const Lang = await Parser.Language.load(wasmPath);
1206
+ parser.setLanguage(Lang);
1207
+ return parser;
1208
+ } catch (error) {
1209
+ return null;
1210
+ }
1211
+ }
1212
+
1213
+ // src/parsers/python-parser.ts
1126
1214
  var PythonParser = class {
1127
1215
  constructor() {
1128
1216
  this.language = "python" /* Python */;
@@ -1135,47 +1223,8 @@ var PythonParser = class {
1135
1223
  */
1136
1224
  async initialize() {
1137
1225
  if (this.initialized) return;
1138
- try {
1139
- await Parser.Parser.init();
1140
- this.parser = new Parser.Parser();
1141
- const possiblePaths = [
1142
- path.join(
1143
- process.cwd(),
1144
- "node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-python.wasm"
1145
- ),
1146
- path.join(
1147
- __dirname,
1148
- "../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-python.wasm"
1149
- ),
1150
- path.join(
1151
- __dirname,
1152
- "../../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-python.wasm"
1153
- ),
1154
- path.join(
1155
- __dirname,
1156
- "../../../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-python.wasm"
1157
- ),
1158
- path.join(
1159
- process.cwd(),
1160
- "node_modules/tree-sitter-wasms/out/tree-sitter-python.wasm"
1161
- ),
1162
- path.join(__dirname, "../assets/tree-sitter-python.wasm")
1163
- ];
1164
- let wasmPath = "";
1165
- for (const p of possiblePaths) {
1166
- if (fs.existsSync(p)) {
1167
- wasmPath = p;
1168
- break;
1169
- }
1170
- }
1171
- if (!wasmPath) {
1172
- return;
1173
- }
1174
- const Python = await Parser.Language.load(wasmPath);
1175
- this.parser.setLanguage(Python);
1176
- this.initialized = true;
1177
- } catch (error) {
1178
- }
1226
+ this.parser = await setupParser("python");
1227
+ this.initialized = true;
1179
1228
  }
1180
1229
  async getAST(code, filePath) {
1181
1230
  if (!this.initialized) await this.initialize();
@@ -1564,9 +1613,6 @@ var PythonParser = class {
1564
1613
  };
1565
1614
 
1566
1615
  // src/parsers/java-parser.ts
1567
- var Parser3 = __toESM(require("web-tree-sitter"));
1568
- var path2 = __toESM(require("path"));
1569
- var fs2 = __toESM(require("fs"));
1570
1616
  var JavaParser = class {
1571
1617
  constructor() {
1572
1618
  this.language = "java" /* Java */;
@@ -1579,55 +1625,8 @@ var JavaParser = class {
1579
1625
  */
1580
1626
  async initialize() {
1581
1627
  if (this.initialized) return;
1582
- try {
1583
- if (typeof Parser3.Parser.init === "function") {
1584
- await Parser3.Parser.init();
1585
- }
1586
- this.parser = new Parser3.Parser();
1587
- const possiblePaths = [
1588
- path2.join(
1589
- process.cwd(),
1590
- "node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-java.wasm"
1591
- ),
1592
- path2.join(
1593
- __dirname,
1594
- "../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-java.wasm"
1595
- ),
1596
- path2.join(
1597
- __dirname,
1598
- "../../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-java.wasm"
1599
- ),
1600
- path2.join(
1601
- __dirname,
1602
- "../../../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-java.wasm"
1603
- ),
1604
- path2.join(
1605
- process.cwd(),
1606
- "node_modules/tree-sitter-wasms/out/tree-sitter-java.wasm"
1607
- )
1608
- ];
1609
- let wasmPath = "";
1610
- for (const p of possiblePaths) {
1611
- if (fs2.existsSync(p)) {
1612
- wasmPath = p;
1613
- break;
1614
- }
1615
- }
1616
- if (!wasmPath) {
1617
- console.warn(
1618
- `Java WASM not found. Tried paths: ${possiblePaths.join(", ")}`
1619
- );
1620
- return;
1621
- }
1622
- const Java = await Parser3.Language.load(wasmPath);
1623
- this.parser.setLanguage(Java);
1624
- this.initialized = true;
1625
- } catch (error) {
1626
- console.error("Failed to initialize tree-sitter-java:", error);
1627
- if (error instanceof Error && error.stack) {
1628
- console.error(error.stack);
1629
- }
1630
- }
1628
+ this.parser = await setupParser("java");
1629
+ this.initialized = true;
1631
1630
  }
1632
1631
  async getAST(code, filePath) {
1633
1632
  if (!this.initialized) await this.initialize();
@@ -1897,9 +1896,6 @@ var JavaParser = class {
1897
1896
  };
1898
1897
 
1899
1898
  // src/parsers/csharp-parser.ts
1900
- var Parser5 = __toESM(require("web-tree-sitter"));
1901
- var path3 = __toESM(require("path"));
1902
- var fs3 = __toESM(require("fs"));
1903
1899
  var CSharpParser = class {
1904
1900
  constructor() {
1905
1901
  this.language = "csharp" /* CSharp */;
@@ -1912,48 +1908,8 @@ var CSharpParser = class {
1912
1908
  */
1913
1909
  async initialize() {
1914
1910
  if (this.initialized) return;
1915
- try {
1916
- if (typeof Parser5.Parser.init === "function") {
1917
- await Parser5.Parser.init();
1918
- }
1919
- this.parser = new Parser5.Parser();
1920
- const possiblePaths = [
1921
- path3.join(
1922
- process.cwd(),
1923
- "node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-c_sharp.wasm"
1924
- ),
1925
- path3.join(
1926
- __dirname,
1927
- "../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-c_sharp.wasm"
1928
- ),
1929
- path3.join(
1930
- __dirname,
1931
- "../../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-c_sharp.wasm"
1932
- ),
1933
- path3.join(
1934
- __dirname,
1935
- "../../../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-c_sharp.wasm"
1936
- )
1937
- ];
1938
- let wasmPath = "";
1939
- for (const p of possiblePaths) {
1940
- if (fs3.existsSync(p)) {
1941
- wasmPath = p;
1942
- break;
1943
- }
1944
- }
1945
- if (!wasmPath) {
1946
- console.warn(
1947
- `C# WASM not found. Tried paths: ${possiblePaths.join(", ")}`
1948
- );
1949
- return;
1950
- }
1951
- const CSharp = await Parser5.Language.load(wasmPath);
1952
- this.parser.setLanguage(CSharp);
1953
- this.initialized = true;
1954
- } catch (error) {
1955
- console.error("Failed to initialize tree-sitter-c-sharp:", error);
1956
- }
1911
+ this.parser = await setupParser("c_sharp");
1912
+ this.initialized = true;
1957
1913
  }
1958
1914
  async getAST(code, filePath) {
1959
1915
  if (!this.initialized) await this.initialize();
@@ -2234,9 +2190,6 @@ var CSharpParser = class {
2234
2190
  };
2235
2191
 
2236
2192
  // src/parsers/go-parser.ts
2237
- var Parser7 = __toESM(require("web-tree-sitter"));
2238
- var path4 = __toESM(require("path"));
2239
- var fs4 = __toESM(require("fs"));
2240
2193
  var GoParser = class {
2241
2194
  constructor() {
2242
2195
  this.language = "go" /* Go */;
@@ -2249,48 +2202,8 @@ var GoParser = class {
2249
2202
  */
2250
2203
  async initialize() {
2251
2204
  if (this.initialized) return;
2252
- try {
2253
- if (typeof Parser7.Parser.init === "function") {
2254
- await Parser7.Parser.init();
2255
- }
2256
- this.parser = new Parser7.Parser();
2257
- const possiblePaths = [
2258
- path4.join(
2259
- process.cwd(),
2260
- "node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-go.wasm"
2261
- ),
2262
- path4.join(
2263
- __dirname,
2264
- "../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-go.wasm"
2265
- ),
2266
- path4.join(
2267
- __dirname,
2268
- "../../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-go.wasm"
2269
- ),
2270
- path4.join(
2271
- __dirname,
2272
- "../../../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-go.wasm"
2273
- )
2274
- ];
2275
- let wasmPath = "";
2276
- for (const p of possiblePaths) {
2277
- if (fs4.existsSync(p)) {
2278
- wasmPath = p;
2279
- break;
2280
- }
2281
- }
2282
- if (!wasmPath) {
2283
- console.warn(
2284
- `Go WASM not found. Tried paths: ${possiblePaths.join(", ")}`
2285
- );
2286
- return;
2287
- }
2288
- const Go = await Parser7.Language.load(wasmPath);
2289
- this.parser.setLanguage(Go);
2290
- this.initialized = true;
2291
- } catch (error) {
2292
- console.error("Failed to initialize tree-sitter-go:", error);
2293
- }
2205
+ this.parser = await setupParser("go");
2206
+ this.initialized = true;
2294
2207
  }
2295
2208
  async getAST(code, filePath) {
2296
2209
  if (!this.initialized) await this.initialize();
@@ -4813,8 +4726,10 @@ function getRepoMetadata(directory) {
4813
4726
  getSeverityColor,
4814
4727
  getSupportedLanguages,
4815
4728
  getToolWeight,
4729
+ getWasmPath,
4816
4730
  handleCLIError,
4817
4731
  handleJSONOutput,
4732
+ initTreeSitter,
4818
4733
  initializeParsers,
4819
4734
  isFileSupported,
4820
4735
  isSourceFile,
@@ -4832,6 +4747,7 @@ function getRepoMetadata(directory) {
4832
4747
  saveScoreEntry,
4833
4748
  scanEntries,
4834
4749
  scanFiles,
4750
+ setupParser,
4835
4751
  validateSpokeOutput,
4836
4752
  validateWithSchema
4837
4753
  });
package/dist/index.mjs CHANGED
@@ -794,10 +794,95 @@ var TypeScriptParser = class {
794
794
  }
795
795
  };
796
796
 
797
- // src/parsers/python-parser.ts
797
+ // src/parsers/tree-sitter-utils.ts
798
798
  import * as Parser from "web-tree-sitter";
799
799
  import * as path from "path";
800
800
  import * as fs from "fs";
801
+ var isTreeSitterInitialized = false;
802
+ async function initTreeSitter() {
803
+ if (isTreeSitterInitialized) return;
804
+ try {
805
+ const wasmPath = getWasmPath("web-tree-sitter");
806
+ await Parser.Parser.init({
807
+ locateFile() {
808
+ return wasmPath || "web-tree-sitter.wasm";
809
+ }
810
+ });
811
+ isTreeSitterInitialized = true;
812
+ } catch (error) {
813
+ console.error("Failed to initialize web-tree-sitter:", error);
814
+ isTreeSitterInitialized = true;
815
+ }
816
+ }
817
+ function findInPnpmStore(startDir, fileName, depth = 0) {
818
+ if (depth > 8) return null;
819
+ const pnpmDir = path.join(startDir, "node_modules", ".pnpm");
820
+ if (fs.existsSync(pnpmDir)) {
821
+ return findFileRecursively(pnpmDir, fileName, 0);
822
+ }
823
+ const parent = path.dirname(startDir);
824
+ if (parent === startDir) return null;
825
+ return findInPnpmStore(parent, fileName, depth + 1);
826
+ }
827
+ function findFileRecursively(dir, fileName, depth) {
828
+ if (depth > 6) return null;
829
+ try {
830
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
831
+ for (const entry of entries) {
832
+ if (entry.isFile() && entry.name === fileName) {
833
+ return path.join(dir, entry.name);
834
+ }
835
+ }
836
+ for (const entry of entries) {
837
+ if (entry.isDirectory()) {
838
+ const found = findFileRecursively(
839
+ path.join(dir, entry.name),
840
+ fileName,
841
+ depth + 1
842
+ );
843
+ if (found) return found;
844
+ }
845
+ }
846
+ } catch (err) {
847
+ }
848
+ return null;
849
+ }
850
+ function getWasmPath(language) {
851
+ const wasmFileName = language === "web-tree-sitter" ? "web-tree-sitter.wasm" : `tree-sitter-${language}.wasm`;
852
+ const immediatePaths = [
853
+ path.join(process.cwd(), wasmFileName),
854
+ path.join(__dirname, wasmFileName),
855
+ path.join(__dirname, "assets", wasmFileName)
856
+ ];
857
+ for (const p of immediatePaths) {
858
+ if (fs.existsSync(p)) return p;
859
+ }
860
+ const pnpmPath = findInPnpmStore(__dirname, wasmFileName);
861
+ if (pnpmPath) return pnpmPath;
862
+ const pnpmPathCwd = findInPnpmStore(process.cwd(), wasmFileName);
863
+ if (pnpmPathCwd) return pnpmPathCwd;
864
+ console.warn(
865
+ `[Parser] WASM file for ${language} not found. CWD: ${process.cwd()}, DIR: ${__dirname}`
866
+ );
867
+ return null;
868
+ }
869
+ async function setupParser(language) {
870
+ await initTreeSitter();
871
+ const wasmPath = getWasmPath(language);
872
+ if (!wasmPath) {
873
+ return null;
874
+ }
875
+ try {
876
+ const parser = new Parser.Parser();
877
+ const Lang = await Parser.Language.load(wasmPath);
878
+ parser.setLanguage(Lang);
879
+ return parser;
880
+ } catch (error) {
881
+ return null;
882
+ }
883
+ }
884
+
885
+ // src/parsers/python-parser.ts
801
886
  var PythonParser = class {
802
887
  constructor() {
803
888
  this.language = "python" /* Python */;
@@ -810,47 +895,8 @@ var PythonParser = class {
810
895
  */
811
896
  async initialize() {
812
897
  if (this.initialized) return;
813
- try {
814
- await Parser.Parser.init();
815
- this.parser = new Parser.Parser();
816
- const possiblePaths = [
817
- path.join(
818
- process.cwd(),
819
- "node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-python.wasm"
820
- ),
821
- path.join(
822
- __dirname,
823
- "../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-python.wasm"
824
- ),
825
- path.join(
826
- __dirname,
827
- "../../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-python.wasm"
828
- ),
829
- path.join(
830
- __dirname,
831
- "../../../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-python.wasm"
832
- ),
833
- path.join(
834
- process.cwd(),
835
- "node_modules/tree-sitter-wasms/out/tree-sitter-python.wasm"
836
- ),
837
- path.join(__dirname, "../assets/tree-sitter-python.wasm")
838
- ];
839
- let wasmPath = "";
840
- for (const p of possiblePaths) {
841
- if (fs.existsSync(p)) {
842
- wasmPath = p;
843
- break;
844
- }
845
- }
846
- if (!wasmPath) {
847
- return;
848
- }
849
- const Python = await Parser.Language.load(wasmPath);
850
- this.parser.setLanguage(Python);
851
- this.initialized = true;
852
- } catch (error) {
853
- }
898
+ this.parser = await setupParser("python");
899
+ this.initialized = true;
854
900
  }
855
901
  async getAST(code, filePath) {
856
902
  if (!this.initialized) await this.initialize();
@@ -1239,9 +1285,6 @@ var PythonParser = class {
1239
1285
  };
1240
1286
 
1241
1287
  // src/parsers/java-parser.ts
1242
- import * as Parser3 from "web-tree-sitter";
1243
- import * as path2 from "path";
1244
- import * as fs2 from "fs";
1245
1288
  var JavaParser = class {
1246
1289
  constructor() {
1247
1290
  this.language = "java" /* Java */;
@@ -1254,55 +1297,8 @@ var JavaParser = class {
1254
1297
  */
1255
1298
  async initialize() {
1256
1299
  if (this.initialized) return;
1257
- try {
1258
- if (typeof Parser3.Parser.init === "function") {
1259
- await Parser3.Parser.init();
1260
- }
1261
- this.parser = new Parser3.Parser();
1262
- const possiblePaths = [
1263
- path2.join(
1264
- process.cwd(),
1265
- "node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-java.wasm"
1266
- ),
1267
- path2.join(
1268
- __dirname,
1269
- "../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-java.wasm"
1270
- ),
1271
- path2.join(
1272
- __dirname,
1273
- "../../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-java.wasm"
1274
- ),
1275
- path2.join(
1276
- __dirname,
1277
- "../../../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-java.wasm"
1278
- ),
1279
- path2.join(
1280
- process.cwd(),
1281
- "node_modules/tree-sitter-wasms/out/tree-sitter-java.wasm"
1282
- )
1283
- ];
1284
- let wasmPath = "";
1285
- for (const p of possiblePaths) {
1286
- if (fs2.existsSync(p)) {
1287
- wasmPath = p;
1288
- break;
1289
- }
1290
- }
1291
- if (!wasmPath) {
1292
- console.warn(
1293
- `Java WASM not found. Tried paths: ${possiblePaths.join(", ")}`
1294
- );
1295
- return;
1296
- }
1297
- const Java = await Parser3.Language.load(wasmPath);
1298
- this.parser.setLanguage(Java);
1299
- this.initialized = true;
1300
- } catch (error) {
1301
- console.error("Failed to initialize tree-sitter-java:", error);
1302
- if (error instanceof Error && error.stack) {
1303
- console.error(error.stack);
1304
- }
1305
- }
1300
+ this.parser = await setupParser("java");
1301
+ this.initialized = true;
1306
1302
  }
1307
1303
  async getAST(code, filePath) {
1308
1304
  if (!this.initialized) await this.initialize();
@@ -1572,9 +1568,6 @@ var JavaParser = class {
1572
1568
  };
1573
1569
 
1574
1570
  // src/parsers/csharp-parser.ts
1575
- import * as Parser5 from "web-tree-sitter";
1576
- import * as path3 from "path";
1577
- import * as fs3 from "fs";
1578
1571
  var CSharpParser = class {
1579
1572
  constructor() {
1580
1573
  this.language = "csharp" /* CSharp */;
@@ -1587,48 +1580,8 @@ var CSharpParser = class {
1587
1580
  */
1588
1581
  async initialize() {
1589
1582
  if (this.initialized) return;
1590
- try {
1591
- if (typeof Parser5.Parser.init === "function") {
1592
- await Parser5.Parser.init();
1593
- }
1594
- this.parser = new Parser5.Parser();
1595
- const possiblePaths = [
1596
- path3.join(
1597
- process.cwd(),
1598
- "node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-c_sharp.wasm"
1599
- ),
1600
- path3.join(
1601
- __dirname,
1602
- "../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-c_sharp.wasm"
1603
- ),
1604
- path3.join(
1605
- __dirname,
1606
- "../../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-c_sharp.wasm"
1607
- ),
1608
- path3.join(
1609
- __dirname,
1610
- "../../../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-c_sharp.wasm"
1611
- )
1612
- ];
1613
- let wasmPath = "";
1614
- for (const p of possiblePaths) {
1615
- if (fs3.existsSync(p)) {
1616
- wasmPath = p;
1617
- break;
1618
- }
1619
- }
1620
- if (!wasmPath) {
1621
- console.warn(
1622
- `C# WASM not found. Tried paths: ${possiblePaths.join(", ")}`
1623
- );
1624
- return;
1625
- }
1626
- const CSharp = await Parser5.Language.load(wasmPath);
1627
- this.parser.setLanguage(CSharp);
1628
- this.initialized = true;
1629
- } catch (error) {
1630
- console.error("Failed to initialize tree-sitter-c-sharp:", error);
1631
- }
1583
+ this.parser = await setupParser("c_sharp");
1584
+ this.initialized = true;
1632
1585
  }
1633
1586
  async getAST(code, filePath) {
1634
1587
  if (!this.initialized) await this.initialize();
@@ -1909,9 +1862,6 @@ var CSharpParser = class {
1909
1862
  };
1910
1863
 
1911
1864
  // src/parsers/go-parser.ts
1912
- import * as Parser7 from "web-tree-sitter";
1913
- import * as path4 from "path";
1914
- import * as fs4 from "fs";
1915
1865
  var GoParser = class {
1916
1866
  constructor() {
1917
1867
  this.language = "go" /* Go */;
@@ -1924,48 +1874,8 @@ var GoParser = class {
1924
1874
  */
1925
1875
  async initialize() {
1926
1876
  if (this.initialized) return;
1927
- try {
1928
- if (typeof Parser7.Parser.init === "function") {
1929
- await Parser7.Parser.init();
1930
- }
1931
- this.parser = new Parser7.Parser();
1932
- const possiblePaths = [
1933
- path4.join(
1934
- process.cwd(),
1935
- "node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-go.wasm"
1936
- ),
1937
- path4.join(
1938
- __dirname,
1939
- "../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-go.wasm"
1940
- ),
1941
- path4.join(
1942
- __dirname,
1943
- "../../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-go.wasm"
1944
- ),
1945
- path4.join(
1946
- __dirname,
1947
- "../../../../node_modules/@unit-mesh/treesitter-artifacts/wasm/tree-sitter-go.wasm"
1948
- )
1949
- ];
1950
- let wasmPath = "";
1951
- for (const p of possiblePaths) {
1952
- if (fs4.existsSync(p)) {
1953
- wasmPath = p;
1954
- break;
1955
- }
1956
- }
1957
- if (!wasmPath) {
1958
- console.warn(
1959
- `Go WASM not found. Tried paths: ${possiblePaths.join(", ")}`
1960
- );
1961
- return;
1962
- }
1963
- const Go = await Parser7.Language.load(wasmPath);
1964
- this.parser.setLanguage(Go);
1965
- this.initialized = true;
1966
- } catch (error) {
1967
- console.error("Failed to initialize tree-sitter-go:", error);
1968
- }
1877
+ this.parser = await setupParser("go");
1878
+ this.initialized = true;
1969
1879
  }
1970
1880
  async getAST(code, filePath) {
1971
1881
  if (!this.initialized) await this.initialize();
@@ -2569,8 +2479,8 @@ function estimateTokens(text) {
2569
2479
  }
2570
2480
 
2571
2481
  // src/utils/config.ts
2572
- import { readFileSync, existsSync as existsSync7 } from "fs";
2573
- import { join as join7, resolve, dirname as dirname3 } from "path";
2482
+ import { readFileSync, existsSync as existsSync4 } from "fs";
2483
+ import { join as join4, resolve, dirname as dirname4 } from "path";
2574
2484
  import { pathToFileURL } from "url";
2575
2485
  var CONFIG_FILES = [
2576
2486
  "aiready.json",
@@ -2584,8 +2494,8 @@ async function loadConfig(rootDir) {
2584
2494
  let currentDir = resolve(rootDir);
2585
2495
  while (true) {
2586
2496
  for (const configFile of CONFIG_FILES) {
2587
- const configPath = join7(currentDir, configFile);
2588
- if (existsSync7(configPath)) {
2497
+ const configPath = join4(currentDir, configFile);
2498
+ if (existsSync4(configPath)) {
2589
2499
  try {
2590
2500
  let config;
2591
2501
  if (configFile.endsWith(".js")) {
@@ -2613,7 +2523,7 @@ async function loadConfig(rootDir) {
2613
2523
  }
2614
2524
  }
2615
2525
  }
2616
- const parent = dirname3(currentDir);
2526
+ const parent = dirname4(currentDir);
2617
2527
  if (parent === currentDir) {
2618
2528
  break;
2619
2529
  }
@@ -3891,14 +3801,14 @@ function calculateExtendedFutureProofScore(params) {
3891
3801
  }
3892
3802
 
3893
3803
  // src/utils/history.ts
3894
- import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, existsSync as existsSync8, mkdirSync as mkdirSync2 } from "fs";
3895
- import { join as join8, dirname as dirname4 } from "path";
3804
+ import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, existsSync as existsSync5, mkdirSync as mkdirSync2 } from "fs";
3805
+ import { join as join5, dirname as dirname5 } from "path";
3896
3806
  function getHistoryPath(rootDir) {
3897
- return join8(rootDir, ".aiready", "history.json");
3807
+ return join5(rootDir, ".aiready", "history.json");
3898
3808
  }
3899
3809
  function loadScoreHistory(rootDir) {
3900
3810
  const historyPath = getHistoryPath(rootDir);
3901
- if (!existsSync8(historyPath)) {
3811
+ if (!existsSync5(historyPath)) {
3902
3812
  return [];
3903
3813
  }
3904
3814
  try {
@@ -3911,8 +3821,8 @@ function loadScoreHistory(rootDir) {
3911
3821
  }
3912
3822
  function saveScoreEntry(rootDir, entry) {
3913
3823
  const historyPath = getHistoryPath(rootDir);
3914
- const historyDir = dirname4(historyPath);
3915
- if (!existsSync8(historyDir)) {
3824
+ const historyDir = dirname5(historyPath);
3825
+ if (!existsSync5(historyDir)) {
3916
3826
  mkdirSync2(historyDir, { recursive: true });
3917
3827
  }
3918
3828
  const history = loadScoreHistory(rootDir);
@@ -3959,7 +3869,7 @@ function exportHistory(rootDir, format = "json") {
3959
3869
  }
3960
3870
  function clearHistory(rootDir) {
3961
3871
  const historyPath = getHistoryPath(rootDir);
3962
- if (existsSync8(historyPath)) {
3872
+ if (existsSync5(historyPath)) {
3963
3873
  writeFileSync2(historyPath, JSON.stringify([]));
3964
3874
  }
3965
3875
  }
@@ -4130,8 +4040,10 @@ export {
4130
4040
  getSeverityColor,
4131
4041
  getSupportedLanguages,
4132
4042
  getToolWeight,
4043
+ getWasmPath,
4133
4044
  handleCLIError,
4134
4045
  handleJSONOutput,
4046
+ initTreeSitter,
4135
4047
  initializeParsers,
4136
4048
  isFileSupported,
4137
4049
  isSourceFile,
@@ -4149,6 +4061,7 @@ export {
4149
4061
  saveScoreEntry,
4150
4062
  scanEntries,
4151
4063
  scanFiles,
4064
+ setupParser,
4152
4065
  validateSpokeOutput,
4153
4066
  validateWithSchema
4154
4067
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiready/core",
3
- "version": "0.21.17",
3
+ "version": "0.21.18",
4
4
  "description": "Shared utilities for AIReady analysis tools",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",