@aiready/core 0.23.2 → 0.23.3

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.
Files changed (79) hide show
  1. package/dist/__tests__/parser-factory.test.d.ts +1 -1
  2. package/dist/__tests__/parser-factory.test.js +62 -50
  3. package/dist/__tests__/python-parser.test.d.ts +1 -1
  4. package/dist/__tests__/python-parser.test.js +111 -109
  5. package/dist/__tests__/scoring.test.d.ts +1 -1
  6. package/dist/__tests__/scoring.test.js +193 -176
  7. package/dist/chunk-3YI4IS3D.mjs +191 -173
  8. package/dist/chunk-5HIXDC3X.mjs +273 -251
  9. package/dist/chunk-5V3L53AE.mjs +805 -0
  10. package/dist/chunk-CKVKHN3G.mjs +228 -211
  11. package/dist/chunk-COHIBX3Q.mjs +213 -195
  12. package/dist/chunk-CWRCDSKZ.mjs +91 -82
  13. package/dist/chunk-D3D3NCRR.mjs +147 -129
  14. package/dist/chunk-HCFYP7UD.mjs +805 -0
  15. package/dist/chunk-HFLFBA6F.mjs +79 -72
  16. package/dist/chunk-HKSARRCD.mjs +66 -58
  17. package/dist/chunk-JJ5JL5FX.mjs +91 -82
  18. package/dist/chunk-KDSTXVLQ.mjs +724 -0
  19. package/dist/chunk-KI7XORTN.mjs +91 -82
  20. package/dist/chunk-LTMHFNFK.mjs +690 -0
  21. package/dist/chunk-LTNXTXRI.mjs +228 -211
  22. package/dist/chunk-M22BXHBR.mjs +805 -0
  23. package/dist/chunk-MH3A3LX6.mjs +200 -182
  24. package/dist/chunk-NGHT7JOG.mjs +697 -0
  25. package/dist/chunk-OQ6IGDXG.mjs +147 -129
  26. package/dist/chunk-QAFB3HXQ.mjs +181 -165
  27. package/dist/chunk-QQBKXHLU.mjs +678 -0
  28. package/dist/chunk-RDHYGES7.mjs +678 -0
  29. package/dist/chunk-SWTDBVYJ.mjs +228 -213
  30. package/dist/chunk-UIWL5JQB.mjs +79 -72
  31. package/dist/chunk-UQGI67WR.mjs +79 -72
  32. package/dist/chunk-UTZOO4XO.mjs +147 -131
  33. package/dist/chunk-X4F46I5L.mjs +213 -195
  34. package/dist/chunk-XKK7YHPX.mjs +204 -186
  35. package/dist/chunk-YCA4FTEK.mjs +190 -172
  36. package/dist/chunk-ZSZRRTJM.mjs +719 -0
  37. package/dist/client-BgmiMoil.d.mts +1344 -0
  38. package/dist/client-BgmiMoil.d.ts +1344 -0
  39. package/dist/client-BxGrPuuN.d.mts +1191 -0
  40. package/dist/client-BxGrPuuN.d.ts +1191 -0
  41. package/dist/client-D-cn9ydj.d.mts +1136 -0
  42. package/dist/client-D-cn9ydj.d.ts +1136 -0
  43. package/dist/client-D9seCH4K.d.mts +1334 -0
  44. package/dist/client-D9seCH4K.d.ts +1334 -0
  45. package/dist/client-DIXIh7rw.d.mts +1193 -0
  46. package/dist/client-DIXIh7rw.d.ts +1193 -0
  47. package/dist/client-DVHXWOHw.d.mts +1245 -0
  48. package/dist/client-DVHXWOHw.d.ts +1245 -0
  49. package/dist/client.d.mts +2 -1098
  50. package/dist/client.d.ts +2 -1098
  51. package/dist/client.js +23 -43
  52. package/dist/client.mjs +3 -25
  53. package/dist/index.d.mts +325 -103
  54. package/dist/index.d.ts +325 -103
  55. package/dist/index.js +307 -324
  56. package/dist/index.mjs +283 -306
  57. package/dist/parsers/parser-factory.d.ts +45 -45
  58. package/dist/parsers/parser-factory.js +86 -84
  59. package/dist/parsers/python-parser.d.ts +33 -28
  60. package/dist/parsers/python-parser.js +224 -222
  61. package/dist/parsers/typescript-parser.d.ts +15 -10
  62. package/dist/parsers/typescript-parser.js +223 -197
  63. package/dist/scoring.d.ts +59 -49
  64. package/dist/scoring.js +129 -127
  65. package/dist/types/language.d.ts +104 -93
  66. package/dist/types/language.js +23 -23
  67. package/dist/types.d.ts +105 -87
  68. package/dist/types.js +1 -1
  69. package/dist/utils/ast-parser.d.ts +42 -33
  70. package/dist/utils/ast-parser.js +159 -162
  71. package/dist/utils/cli-helpers.d.ts +27 -10
  72. package/dist/utils/cli-helpers.js +45 -43
  73. package/dist/utils/config.d.ts +8 -3
  74. package/dist/utils/config.js +67 -69
  75. package/dist/utils/file-scanner.d.ts +1 -1
  76. package/dist/utils/file-scanner.js +80 -76
  77. package/dist/utils/metrics.d.ts +1 -1
  78. package/dist/utils/metrics.js +2 -2
  79. package/package.json +1 -1
package/dist/scoring.js CHANGED
@@ -9,27 +9,27 @@
9
9
  * New tools get weight of 10 if not specified.
10
10
  */
11
11
  export const DEFAULT_TOOL_WEIGHTS = {
12
- 'pattern-detect': 40,
13
- 'context-analyzer': 35,
14
- 'consistency': 25,
15
- 'doc-drift': 20,
16
- 'deps': 15,
12
+ 'pattern-detect': 40,
13
+ 'context-analyzer': 35,
14
+ consistency: 25,
15
+ 'doc-drift': 20,
16
+ deps: 15,
17
17
  };
18
18
  /**
19
19
  * Tool name normalization map (shorthand -> full name)
20
20
  */
21
21
  export const TOOL_NAME_MAP = {
22
- 'patterns': 'pattern-detect',
23
- 'context': 'context-analyzer',
24
- 'consistency': 'consistency',
25
- 'doc-drift': 'doc-drift',
26
- 'deps': 'deps',
22
+ patterns: 'pattern-detect',
23
+ context: 'context-analyzer',
24
+ consistency: 'consistency',
25
+ 'doc-drift': 'doc-drift',
26
+ deps: 'deps',
27
27
  };
28
28
  /**
29
29
  * Normalize tool name from shorthand to full name
30
30
  */
31
31
  export function normalizeToolName(shortName) {
32
- return TOOL_NAME_MAP[shortName] || shortName;
32
+ return TOOL_NAME_MAP[shortName] || shortName;
33
33
  }
34
34
  /**
35
35
  * Get tool weight with fallback priority:
@@ -39,37 +39,37 @@ export function normalizeToolName(shortName) {
39
39
  * 4. 10 (for unknown tools)
40
40
  */
41
41
  export function getToolWeight(toolName, toolConfig, cliOverride) {
42
- // CLI override has highest priority
43
- if (cliOverride !== undefined) {
44
- return cliOverride;
45
- }
46
- // Check tool's own config
47
- if (toolConfig?.scoreWeight !== undefined) {
48
- return toolConfig.scoreWeight;
49
- }
50
- // Fall back to defaults
51
- return DEFAULT_TOOL_WEIGHTS[toolName] || 10;
42
+ // CLI override has highest priority
43
+ if (cliOverride !== undefined) {
44
+ return cliOverride;
45
+ }
46
+ // Check tool's own config
47
+ if (toolConfig?.scoreWeight !== undefined) {
48
+ return toolConfig.scoreWeight;
49
+ }
50
+ // Fall back to defaults
51
+ return DEFAULT_TOOL_WEIGHTS[toolName] || 10;
52
52
  }
53
53
  /**
54
54
  * Parse weight string from CLI (e.g., "patterns:50,context:30")
55
55
  */
56
56
  export function parseWeightString(weightStr) {
57
- const weights = new Map();
58
- if (!weightStr) {
59
- return weights;
60
- }
61
- const pairs = weightStr.split(',');
62
- for (const pair of pairs) {
63
- const [toolShortName, weightStr] = pair.split(':');
64
- if (toolShortName && weightStr) {
65
- const toolName = normalizeToolName(toolShortName.trim());
66
- const weight = parseInt(weightStr.trim(), 10);
67
- if (!isNaN(weight) && weight > 0) {
68
- weights.set(toolName, weight);
69
- }
70
- }
71
- }
57
+ const weights = new Map();
58
+ if (!weightStr) {
72
59
  return weights;
60
+ }
61
+ const pairs = weightStr.split(',');
62
+ for (const pair of pairs) {
63
+ const [toolShortName, weightStr] = pair.split(':');
64
+ if (toolShortName && weightStr) {
65
+ const toolName = normalizeToolName(toolShortName.trim());
66
+ const weight = parseInt(weightStr.trim(), 10);
67
+ if (!isNaN(weight) && weight > 0) {
68
+ weights.set(toolName, weight);
69
+ }
70
+ }
71
+ }
72
+ return weights;
73
73
  }
74
74
  /**
75
75
  * Calculate overall AI Readiness Score from multiple tool scores.
@@ -80,116 +80,118 @@ export function parseWeightString(weightStr) {
80
80
  * based on which tools actually ran.
81
81
  */
82
82
  export function calculateOverallScore(toolOutputs, config, cliWeights) {
83
- if (toolOutputs.size === 0) {
84
- throw new Error('No tool outputs provided for scoring');
85
- }
86
- // Build weights map with priority: CLI > config > defaults
87
- const weights = new Map();
88
- for (const [toolName] of toolOutputs.entries()) {
89
- const cliWeight = cliWeights?.get(toolName);
90
- const configWeight = config?.tools?.[toolName]?.scoreWeight;
91
- const weight = cliWeight ?? configWeight ?? DEFAULT_TOOL_WEIGHTS[toolName] ?? 10;
92
- weights.set(toolName, weight);
83
+ if (toolOutputs.size === 0) {
84
+ throw new Error('No tool outputs provided for scoring');
85
+ }
86
+ // Build weights map with priority: CLI > config > defaults
87
+ const weights = new Map();
88
+ for (const [toolName] of toolOutputs.entries()) {
89
+ const cliWeight = cliWeights?.get(toolName);
90
+ const configWeight = config?.tools?.[toolName]?.scoreWeight;
91
+ const weight =
92
+ cliWeight ?? configWeight ?? DEFAULT_TOOL_WEIGHTS[toolName] ?? 10;
93
+ weights.set(toolName, weight);
94
+ }
95
+ // Calculate weighted sum and total weight
96
+ let weightedSum = 0;
97
+ let totalWeight = 0;
98
+ const breakdown = [];
99
+ const toolsUsed = [];
100
+ const calculationWeights = {};
101
+ for (const [toolName, output] of toolOutputs.entries()) {
102
+ const weight = weights.get(toolName) || 10;
103
+ const weightedScore = output.score * weight;
104
+ weightedSum += weightedScore;
105
+ totalWeight += weight;
106
+ toolsUsed.push(toolName);
107
+ calculationWeights[toolName] = weight;
108
+ breakdown.push(output);
109
+ }
110
+ // Calculate final score
111
+ const overall = Math.round(weightedSum / totalWeight);
112
+ // Determine rating
113
+ const rating = getRating(overall);
114
+ // Build formula string
115
+ const formulaParts = Array.from(toolOutputs.entries()).map(
116
+ ([name, output]) => {
117
+ const w = weights.get(name) || 10;
118
+ return `(${output.score} × ${w})`;
93
119
  }
94
- // Calculate weighted sum and total weight
95
- let weightedSum = 0;
96
- let totalWeight = 0;
97
- const breakdown = [];
98
- const toolsUsed = [];
99
- const calculationWeights = {};
100
- for (const [toolName, output] of toolOutputs.entries()) {
101
- const weight = weights.get(toolName) || 10;
102
- const weightedScore = output.score * weight;
103
- weightedSum += weightedScore;
104
- totalWeight += weight;
105
- toolsUsed.push(toolName);
106
- calculationWeights[toolName] = weight;
107
- breakdown.push(output);
108
- }
109
- // Calculate final score
110
- const overall = Math.round(weightedSum / totalWeight);
111
- // Determine rating
112
- const rating = getRating(overall);
113
- // Build formula string
114
- const formulaParts = Array.from(toolOutputs.entries())
115
- .map(([name, output]) => {
116
- const w = weights.get(name) || 10;
117
- return `(${output.score} × ${w})`;
118
- });
119
- const formulaStr = `[${formulaParts.join(' + ')}] / ${totalWeight} = ${overall}`;
120
- return {
121
- overall,
122
- rating,
123
- timestamp: new Date().toISOString(),
124
- toolsUsed,
125
- breakdown,
126
- calculation: {
127
- formula: formulaStr,
128
- weights: calculationWeights,
129
- normalized: formulaStr,
130
- },
131
- };
120
+ );
121
+ const formulaStr = `[${formulaParts.join(' + ')}] / ${totalWeight} = ${overall}`;
122
+ return {
123
+ overall,
124
+ rating,
125
+ timestamp: new Date().toISOString(),
126
+ toolsUsed,
127
+ breakdown,
128
+ calculation: {
129
+ formula: formulaStr,
130
+ weights: calculationWeights,
131
+ normalized: formulaStr,
132
+ },
133
+ };
132
134
  }
133
135
  /**
134
136
  * Convert numeric score to rating category
135
137
  */
136
138
  export function getRating(score) {
137
- if (score >= 90)
138
- return 'Excellent';
139
- if (score >= 75)
140
- return 'Good';
141
- if (score >= 60)
142
- return 'Fair';
143
- if (score >= 40)
144
- return 'Needs Work';
145
- return 'Critical';
139
+ if (score >= 90) return 'Excellent';
140
+ if (score >= 75) return 'Good';
141
+ if (score >= 60) return 'Fair';
142
+ if (score >= 40) return 'Needs Work';
143
+ return 'Critical';
146
144
  }
147
145
  /**
148
146
  * Get rating emoji and color for display
149
147
  */
150
148
  export function getRatingDisplay(rating) {
151
- switch (rating) {
152
- case 'Excellent':
153
- return { emoji: '✅', color: 'green' };
154
- case 'Good':
155
- return { emoji: '👍', color: 'blue' };
156
- case 'Fair':
157
- return { emoji: '⚠️', color: 'yellow' };
158
- case 'Needs Work':
159
- return { emoji: '🔨', color: 'orange' };
160
- case 'Critical':
161
- return { emoji: '❌', color: 'red' };
162
- }
149
+ switch (rating) {
150
+ case 'Excellent':
151
+ return { emoji: '✅', color: 'green' };
152
+ case 'Good':
153
+ return { emoji: '👍', color: 'blue' };
154
+ case 'Fair':
155
+ return { emoji: '⚠️', color: 'yellow' };
156
+ case 'Needs Work':
157
+ return { emoji: '🔨', color: 'orange' };
158
+ case 'Critical':
159
+ return { emoji: '❌', color: 'red' };
160
+ }
163
161
  }
164
162
  /**
165
163
  * Format score for display with rating
166
164
  */
167
165
  export function formatScore(result) {
168
- const { emoji, color } = getRatingDisplay(result.rating);
169
- return `${result.overall}/100 (${result.rating}) ${emoji}`;
166
+ const { emoji, color } = getRatingDisplay(result.rating);
167
+ return `${result.overall}/100 (${result.rating}) ${emoji}`;
170
168
  }
171
169
  /**
172
170
  * Format individual tool score for display
173
171
  */
174
172
  export function formatToolScore(output) {
175
- let result = ` Score: ${output.score}/100\n\n`;
176
- if (output.factors && output.factors.length > 0) {
177
- result += ` Factors:\n`;
178
- output.factors.forEach(factor => {
179
- const impactSign = factor.impact > 0 ? '+' : '';
180
- result += ` • ${factor.name}: ${impactSign}${factor.impact} - ${factor.description}\n`;
181
- });
182
- result += '\n';
183
- }
184
- if (output.recommendations && output.recommendations.length > 0) {
185
- result += ` Recommendations:\n`;
186
- output.recommendations.forEach((rec, i) => {
187
- const priorityIcon = rec.priority === 'high' ? '🔴' :
188
- rec.priority === 'medium' ? '🟡' : '🔵';
189
- result += ` ${i + 1}. ${priorityIcon} ${rec.action}\n`;
190
- result += ` Impact: +${rec.estimatedImpact} points\n\n`;
191
- });
192
- }
193
- return result;
173
+ let result = ` Score: ${output.score}/100\n\n`;
174
+ if (output.factors && output.factors.length > 0) {
175
+ result += ` Factors:\n`;
176
+ output.factors.forEach((factor) => {
177
+ const impactSign = factor.impact > 0 ? '+' : '';
178
+ result += ` • ${factor.name}: ${impactSign}${factor.impact} - ${factor.description}\n`;
179
+ });
180
+ result += '\n';
181
+ }
182
+ if (output.recommendations && output.recommendations.length > 0) {
183
+ result += ` Recommendations:\n`;
184
+ output.recommendations.forEach((rec, i) => {
185
+ const priorityIcon =
186
+ rec.priority === 'high'
187
+ ? '🔴'
188
+ : rec.priority === 'medium'
189
+ ? '🟡'
190
+ : '🔵';
191
+ result += ` ${i + 1}. ${priorityIcon} ${rec.action}\n`;
192
+ result += ` Impact: +${rec.estimatedImpact} points\n\n`;
193
+ });
194
+ }
195
+ return result;
194
196
  }
195
- //# sourceMappingURL=scoring.js.map
197
+ //# sourceMappingURL=scoring.js.map
@@ -8,13 +8,13 @@
8
8
  * Supported programming languages
9
9
  */
10
10
  export declare enum Language {
11
- TypeScript = "typescript",
12
- JavaScript = "javascript",
13
- Python = "python",
14
- Java = "java",
15
- Go = "go",
16
- Rust = "rust",
17
- CSharp = "csharp"
11
+ TypeScript = 'typescript',
12
+ JavaScript = 'javascript',
13
+ Python = 'python',
14
+ Java = 'java',
15
+ Go = 'go',
16
+ Rust = 'rust',
17
+ CSharp = 'csharp',
18
18
  }
19
19
  /**
20
20
  * File extensions mapped to languages
@@ -24,138 +24,149 @@ export declare const LANGUAGE_EXTENSIONS: Record<string, Language>;
24
24
  * Location information in source code
25
25
  */
26
26
  export interface SourceLocation {
27
- line: number;
28
- column: number;
27
+ line: number;
28
+ column: number;
29
29
  }
30
30
  export interface SourceRange {
31
- start: SourceLocation;
32
- end: SourceLocation;
31
+ start: SourceLocation;
32
+ end: SourceLocation;
33
33
  }
34
34
  /**
35
35
  * Common AST node type (language-agnostic)
36
36
  */
37
37
  export interface CommonASTNode {
38
- type: string;
39
- loc?: SourceRange;
40
- raw?: any;
38
+ type: string;
39
+ loc?: SourceRange;
40
+ raw?: any;
41
41
  }
42
42
  /**
43
43
  * Export information (function, class, variable, etc.)
44
44
  */
45
45
  export interface ExportInfo {
46
- name: string;
47
- type: 'function' | 'class' | 'const' | 'type' | 'interface' | 'default' | 'variable';
48
- loc?: SourceRange;
49
- /** Imports used within this export */
50
- imports?: string[];
51
- /** Dependencies on other exports in same file */
52
- dependencies?: string[];
53
- /** TypeScript types referenced */
54
- typeReferences?: string[];
55
- /** For methods: parent class name */
56
- parentClass?: string;
57
- /** For functions/methods: parameters */
58
- parameters?: string[];
59
- /** Visibility (public, private, protected) */
60
- visibility?: 'public' | 'private' | 'protected';
46
+ name: string;
47
+ type:
48
+ | 'function'
49
+ | 'class'
50
+ | 'const'
51
+ | 'type'
52
+ | 'interface'
53
+ | 'default'
54
+ | 'variable';
55
+ loc?: SourceRange;
56
+ /** Imports used within this export */
57
+ imports?: string[];
58
+ /** Dependencies on other exports in same file */
59
+ dependencies?: string[];
60
+ /** TypeScript types referenced */
61
+ typeReferences?: string[];
62
+ /** For methods: parent class name */
63
+ parentClass?: string;
64
+ /** For functions/methods: parameters */
65
+ parameters?: string[];
66
+ /** Visibility (public, private, protected) */
67
+ visibility?: 'public' | 'private' | 'protected';
61
68
  }
62
69
  /**
63
70
  * Import information
64
71
  */
65
72
  export interface ImportInfo {
66
- /** Module being imported from */
67
- source: string;
68
- /** What's being imported */
69
- specifiers: string[];
70
- /** Is this a type-only import (TypeScript) */
71
- isTypeOnly?: boolean;
72
- /** Location in source */
73
- loc?: SourceRange;
73
+ /** Module being imported from */
74
+ source: string;
75
+ /** What's being imported */
76
+ specifiers: string[];
77
+ /** Is this a type-only import (TypeScript) */
78
+ isTypeOnly?: boolean;
79
+ /** Location in source */
80
+ loc?: SourceRange;
74
81
  }
75
82
  /**
76
83
  * Parse result containing exports and imports
77
84
  */
78
85
  export interface ParseResult {
79
- exports: ExportInfo[];
80
- imports: ImportInfo[];
81
- /** Language of the parsed file */
82
- language: Language;
83
- /** Any parse warnings (non-fatal) */
84
- warnings?: string[];
86
+ exports: ExportInfo[];
87
+ imports: ImportInfo[];
88
+ /** Language of the parsed file */
89
+ language: Language;
90
+ /** Any parse warnings (non-fatal) */
91
+ warnings?: string[];
85
92
  }
86
93
  /**
87
94
  * Naming convention rules per language
88
95
  */
89
96
  export interface NamingConvention {
90
- /** Allowed variable naming patterns */
91
- variablePattern: RegExp;
92
- /** Allowed function naming patterns */
93
- functionPattern: RegExp;
94
- /** Allowed class naming patterns */
95
- classPattern: RegExp;
96
- /** Allowed constant naming patterns */
97
- constantPattern: RegExp;
98
- /** Language-specific exceptions (e.g., __init__ in Python) */
99
- exceptions?: string[];
97
+ /** Allowed variable naming patterns */
98
+ variablePattern: RegExp;
99
+ /** Allowed function naming patterns */
100
+ functionPattern: RegExp;
101
+ /** Allowed class naming patterns */
102
+ classPattern: RegExp;
103
+ /** Allowed constant naming patterns */
104
+ constantPattern: RegExp;
105
+ /** Language-specific exceptions (e.g., __init__ in Python) */
106
+ exceptions?: string[];
100
107
  }
101
108
  /**
102
109
  * Language-specific configuration
103
110
  */
104
111
  export interface LanguageConfig {
105
- language: Language;
106
- /** File extensions for this language */
107
- extensions: string[];
108
- /** Naming conventions */
109
- namingConventions: NamingConvention;
110
- /** Common abbreviations allowed */
111
- allowedAbbreviations?: string[];
112
- /** Language-specific keywords to ignore */
113
- keywords?: string[];
112
+ language: Language;
113
+ /** File extensions for this language */
114
+ extensions: string[];
115
+ /** Naming conventions */
116
+ namingConventions: NamingConvention;
117
+ /** Common abbreviations allowed */
118
+ allowedAbbreviations?: string[];
119
+ /** Language-specific keywords to ignore */
120
+ keywords?: string[];
114
121
  }
115
122
  /**
116
123
  * Abstract interface for language parsers
117
124
  * Each language implementation should implement this interface
118
125
  */
119
126
  export interface LanguageParser {
120
- /** Language this parser handles */
121
- readonly language: Language;
122
- /** File extensions this parser supports */
123
- readonly extensions: string[];
124
- /**
125
- * Parse source code and extract structure
126
- * @param code - Source code to parse
127
- * @param filePath - Path to the file (for context)
128
- * @returns Parse result with exports and imports
129
- * @throws ParseError if code has syntax errors
130
- */
131
- parse(code: string, filePath: string): ParseResult;
132
- /**
133
- * Get naming conventions for this language
134
- */
135
- getNamingConventions(): NamingConvention;
136
- /**
137
- * Check if this parser can handle a file
138
- * @param filePath - File path to check
139
- */
140
- canHandle(filePath: string): boolean;
127
+ /** Language this parser handles */
128
+ readonly language: Language;
129
+ /** File extensions this parser supports */
130
+ readonly extensions: string[];
131
+ /**
132
+ * Parse source code and extract structure
133
+ * @param code - Source code to parse
134
+ * @param filePath - Path to the file (for context)
135
+ * @returns Parse result with exports and imports
136
+ * @throws ParseError if code has syntax errors
137
+ */
138
+ parse(code: string, filePath: string): ParseResult;
139
+ /**
140
+ * Get naming conventions for this language
141
+ */
142
+ getNamingConventions(): NamingConvention;
143
+ /**
144
+ * Check if this parser can handle a file
145
+ * @param filePath - File path to check
146
+ */
147
+ canHandle(filePath: string): boolean;
141
148
  }
142
149
  /**
143
150
  * Parser error with location information
144
151
  */
145
152
  export declare class ParseError extends Error {
146
- readonly filePath: string;
147
- readonly loc?: SourceLocation | undefined;
148
- constructor(message: string, filePath: string, loc?: SourceLocation | undefined);
153
+ readonly filePath: string;
154
+ readonly loc?: SourceLocation | undefined;
155
+ constructor(
156
+ message: string,
157
+ filePath: string,
158
+ loc?: SourceLocation | undefined
159
+ );
149
160
  }
150
161
  /**
151
162
  * Statistics about parsed code
152
163
  */
153
164
  export interface ParseStatistics {
154
- language: Language;
155
- filesAnalyzed: number;
156
- totalExports: number;
157
- totalImports: number;
158
- parseErrors: number;
159
- warnings: number;
165
+ language: Language;
166
+ filesAnalyzed: number;
167
+ totalExports: number;
168
+ totalImports: number;
169
+ parseErrors: number;
170
+ warnings: number;
160
171
  }
161
- //# sourceMappingURL=language.d.ts.map
172
+ //# sourceMappingURL=language.d.ts.map
@@ -9,37 +9,37 @@
9
9
  */
10
10
  export var Language;
11
11
  (function (Language) {
12
- Language["TypeScript"] = "typescript";
13
- Language["JavaScript"] = "javascript";
14
- Language["Python"] = "python";
15
- Language["Java"] = "java";
16
- Language["Go"] = "go";
17
- Language["Rust"] = "rust";
18
- Language["CSharp"] = "csharp";
12
+ Language['TypeScript'] = 'typescript';
13
+ Language['JavaScript'] = 'javascript';
14
+ Language['Python'] = 'python';
15
+ Language['Java'] = 'java';
16
+ Language['Go'] = 'go';
17
+ Language['Rust'] = 'rust';
18
+ Language['CSharp'] = 'csharp';
19
19
  })(Language || (Language = {}));
20
20
  /**
21
21
  * File extensions mapped to languages
22
22
  */
23
23
  export const LANGUAGE_EXTENSIONS = {
24
- '.ts': Language.TypeScript,
25
- '.tsx': Language.TypeScript,
26
- '.js': Language.JavaScript,
27
- '.jsx': Language.JavaScript,
28
- '.py': Language.Python,
29
- '.java': Language.Java,
30
- '.go': Language.Go,
31
- '.rs': Language.Rust,
32
- '.cs': Language.CSharp,
24
+ '.ts': Language.TypeScript,
25
+ '.tsx': Language.TypeScript,
26
+ '.js': Language.JavaScript,
27
+ '.jsx': Language.JavaScript,
28
+ '.py': Language.Python,
29
+ '.java': Language.Java,
30
+ '.go': Language.Go,
31
+ '.rs': Language.Rust,
32
+ '.cs': Language.CSharp,
33
33
  };
34
34
  /**
35
35
  * Parser error with location information
36
36
  */
37
37
  export class ParseError extends Error {
38
- constructor(message, filePath, loc) {
39
- super(message);
40
- this.filePath = filePath;
41
- this.loc = loc;
42
- this.name = 'ParseError';
43
- }
38
+ constructor(message, filePath, loc) {
39
+ super(message);
40
+ this.filePath = filePath;
41
+ this.loc = loc;
42
+ this.name = 'ParseError';
43
+ }
44
44
  }
45
- //# sourceMappingURL=language.js.map
45
+ //# sourceMappingURL=language.js.map