@aiready/context-analyzer 0.19.15 → 0.19.16
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/.turbo/turbo-build.log +8 -8
- package/.turbo/turbo-test.log +19 -19
- package/dist/chunk-YYB6NZE3.mjs +1869 -0
- package/dist/cli.js +48 -0
- package/dist/cli.mjs +1 -1
- package/dist/index.js +48 -0
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
- package/src/graph-builder.ts +56 -0
package/dist/cli.js
CHANGED
|
@@ -699,6 +699,9 @@ function buildDependencyGraph(files, options) {
|
|
|
699
699
|
function extractImportsFromContent(content, filePath) {
|
|
700
700
|
const imports = [];
|
|
701
701
|
const isPython = filePath?.toLowerCase().endsWith(".py");
|
|
702
|
+
const isJava = filePath?.toLowerCase().endsWith(".java");
|
|
703
|
+
const isCSharp = filePath?.toLowerCase().endsWith(".cs");
|
|
704
|
+
const isGo = filePath?.toLowerCase().endsWith(".go");
|
|
702
705
|
if (isPython) {
|
|
703
706
|
const pythonPatterns = [
|
|
704
707
|
/^\s*import\s+([a-zA-Z0-9_., ]+)/gm,
|
|
@@ -714,6 +717,51 @@ function extractImportsFromContent(content, filePath) {
|
|
|
714
717
|
}
|
|
715
718
|
}
|
|
716
719
|
}
|
|
720
|
+
} else if (isJava) {
|
|
721
|
+
const javaPatterns = [/^\s*import\s+(?:static\s+)?([a-zA-Z0-9_.]+)/gm];
|
|
722
|
+
for (const pattern of javaPatterns) {
|
|
723
|
+
let match;
|
|
724
|
+
while ((match = pattern.exec(content)) !== null) {
|
|
725
|
+
const importPath = match[1];
|
|
726
|
+
if (importPath) {
|
|
727
|
+
const cleanPath = importPath.endsWith(".*") ? importPath.slice(0, -2) : importPath;
|
|
728
|
+
imports.push(cleanPath);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
} else if (isCSharp) {
|
|
733
|
+
const csharpPatterns = [
|
|
734
|
+
/^\s*using\s+(?:static\s+)?(?:[a-zA-Z0-9_.]+\s*=\s*)?([a-zA-Z0-9_.]+);/gm
|
|
735
|
+
];
|
|
736
|
+
for (const pattern of csharpPatterns) {
|
|
737
|
+
let match;
|
|
738
|
+
while ((match = pattern.exec(content)) !== null) {
|
|
739
|
+
const importPath = match[1];
|
|
740
|
+
if (importPath) {
|
|
741
|
+
imports.push(importPath);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
} else if (isGo) {
|
|
746
|
+
const goPatterns = [
|
|
747
|
+
/^\s*import\s+"([^"]+)"/gm,
|
|
748
|
+
/^\s*import\s+\(\s*([^)]+)\)/gm
|
|
749
|
+
];
|
|
750
|
+
for (const pattern of goPatterns) {
|
|
751
|
+
let match;
|
|
752
|
+
while ((match = pattern.exec(content)) !== null) {
|
|
753
|
+
if (pattern.source.includes("\\(")) {
|
|
754
|
+
const block = match[1];
|
|
755
|
+
const lines = block.split("\n");
|
|
756
|
+
for (const line of lines) {
|
|
757
|
+
const lineMatch = /"([^"]+)"/.exec(line);
|
|
758
|
+
if (lineMatch) imports.push(lineMatch[1]);
|
|
759
|
+
}
|
|
760
|
+
} else {
|
|
761
|
+
if (match[1]) imports.push(match[1]);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
}
|
|
717
765
|
} else {
|
|
718
766
|
const patterns = [
|
|
719
767
|
/import\s+.*?\s+from\s+['"](.+?)['"]/g,
|
package/dist/cli.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -815,6 +815,9 @@ function buildDependencyGraph(files, options) {
|
|
|
815
815
|
function extractImportsFromContent(content, filePath) {
|
|
816
816
|
const imports = [];
|
|
817
817
|
const isPython = filePath?.toLowerCase().endsWith(".py");
|
|
818
|
+
const isJava = filePath?.toLowerCase().endsWith(".java");
|
|
819
|
+
const isCSharp = filePath?.toLowerCase().endsWith(".cs");
|
|
820
|
+
const isGo = filePath?.toLowerCase().endsWith(".go");
|
|
818
821
|
if (isPython) {
|
|
819
822
|
const pythonPatterns = [
|
|
820
823
|
/^\s*import\s+([a-zA-Z0-9_., ]+)/gm,
|
|
@@ -830,6 +833,51 @@ function extractImportsFromContent(content, filePath) {
|
|
|
830
833
|
}
|
|
831
834
|
}
|
|
832
835
|
}
|
|
836
|
+
} else if (isJava) {
|
|
837
|
+
const javaPatterns = [/^\s*import\s+(?:static\s+)?([a-zA-Z0-9_.]+)/gm];
|
|
838
|
+
for (const pattern of javaPatterns) {
|
|
839
|
+
let match;
|
|
840
|
+
while ((match = pattern.exec(content)) !== null) {
|
|
841
|
+
const importPath = match[1];
|
|
842
|
+
if (importPath) {
|
|
843
|
+
const cleanPath = importPath.endsWith(".*") ? importPath.slice(0, -2) : importPath;
|
|
844
|
+
imports.push(cleanPath);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
} else if (isCSharp) {
|
|
849
|
+
const csharpPatterns = [
|
|
850
|
+
/^\s*using\s+(?:static\s+)?(?:[a-zA-Z0-9_.]+\s*=\s*)?([a-zA-Z0-9_.]+);/gm
|
|
851
|
+
];
|
|
852
|
+
for (const pattern of csharpPatterns) {
|
|
853
|
+
let match;
|
|
854
|
+
while ((match = pattern.exec(content)) !== null) {
|
|
855
|
+
const importPath = match[1];
|
|
856
|
+
if (importPath) {
|
|
857
|
+
imports.push(importPath);
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
} else if (isGo) {
|
|
862
|
+
const goPatterns = [
|
|
863
|
+
/^\s*import\s+"([^"]+)"/gm,
|
|
864
|
+
/^\s*import\s+\(\s*([^)]+)\)/gm
|
|
865
|
+
];
|
|
866
|
+
for (const pattern of goPatterns) {
|
|
867
|
+
let match;
|
|
868
|
+
while ((match = pattern.exec(content)) !== null) {
|
|
869
|
+
if (pattern.source.includes("\\(")) {
|
|
870
|
+
const block = match[1];
|
|
871
|
+
const lines = block.split("\n");
|
|
872
|
+
for (const line of lines) {
|
|
873
|
+
const lineMatch = /"([^"]+)"/.exec(line);
|
|
874
|
+
if (lineMatch) imports.push(lineMatch[1]);
|
|
875
|
+
}
|
|
876
|
+
} else {
|
|
877
|
+
if (match[1]) imports.push(match[1]);
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
}
|
|
833
881
|
} else {
|
|
834
882
|
const patterns = [
|
|
835
883
|
/import\s+.*?\s+from\s+['"](.+?)['"]/g,
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/context-analyzer",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.16",
|
|
4
4
|
"description": "AI context window cost analysis - detect fragmented code, deep import chains, and expensive context budgets",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"commander": "^14.0.0",
|
|
50
50
|
"chalk": "^5.3.0",
|
|
51
51
|
"prompts": "^2.4.2",
|
|
52
|
-
"@aiready/core": "0.21.
|
|
52
|
+
"@aiready/core": "0.21.16"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/node": "^24.0.0",
|
package/src/graph-builder.ts
CHANGED
|
@@ -140,6 +140,9 @@ export function extractImportsFromContent(
|
|
|
140
140
|
): string[] {
|
|
141
141
|
const imports: string[] = [];
|
|
142
142
|
const isPython = filePath?.toLowerCase().endsWith('.py');
|
|
143
|
+
const isJava = filePath?.toLowerCase().endsWith('.java');
|
|
144
|
+
const isCSharp = filePath?.toLowerCase().endsWith('.cs');
|
|
145
|
+
const isGo = filePath?.toLowerCase().endsWith('.go');
|
|
143
146
|
|
|
144
147
|
if (isPython) {
|
|
145
148
|
const pythonPatterns = [
|
|
@@ -160,6 +163,59 @@ export function extractImportsFromContent(
|
|
|
160
163
|
}
|
|
161
164
|
}
|
|
162
165
|
}
|
|
166
|
+
} else if (isJava) {
|
|
167
|
+
const javaPatterns = [/^\s*import\s+(?:static\s+)?([a-zA-Z0-9_.]+)/gm];
|
|
168
|
+
|
|
169
|
+
for (const pattern of javaPatterns) {
|
|
170
|
+
let match;
|
|
171
|
+
while ((match = pattern.exec(content)) !== null) {
|
|
172
|
+
const importPath = match[1];
|
|
173
|
+
if (importPath) {
|
|
174
|
+
// Handle wildcard imports: import java.util.*; -> java.util
|
|
175
|
+
const cleanPath = importPath.endsWith('.*')
|
|
176
|
+
? importPath.slice(0, -2)
|
|
177
|
+
: importPath;
|
|
178
|
+
imports.push(cleanPath);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
} else if (isCSharp) {
|
|
183
|
+
const csharpPatterns = [
|
|
184
|
+
/^\s*using\s+(?:static\s+)?(?:[a-zA-Z0-9_.]+\s*=\s*)?([a-zA-Z0-9_.]+);/gm,
|
|
185
|
+
];
|
|
186
|
+
|
|
187
|
+
for (const pattern of csharpPatterns) {
|
|
188
|
+
let match;
|
|
189
|
+
while ((match = pattern.exec(content)) !== null) {
|
|
190
|
+
const importPath = match[1];
|
|
191
|
+
if (importPath) {
|
|
192
|
+
imports.push(importPath);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
} else if (isGo) {
|
|
197
|
+
const goPatterns = [
|
|
198
|
+
/^\s*import\s+"([^"]+)"/gm,
|
|
199
|
+
/^\s*import\s+\(\s*([^)]+)\)/gm,
|
|
200
|
+
];
|
|
201
|
+
|
|
202
|
+
for (const pattern of goPatterns) {
|
|
203
|
+
let match;
|
|
204
|
+
while ((match = pattern.exec(content)) !== null) {
|
|
205
|
+
if (pattern.source.includes('\\(')) {
|
|
206
|
+
// Block import
|
|
207
|
+
const block = match[1];
|
|
208
|
+
const lines = block.split('\n');
|
|
209
|
+
for (const line of lines) {
|
|
210
|
+
const lineMatch = /"([^"]+)"/.exec(line);
|
|
211
|
+
if (lineMatch) imports.push(lineMatch[1]);
|
|
212
|
+
}
|
|
213
|
+
} else {
|
|
214
|
+
// Single import
|
|
215
|
+
if (match[1]) imports.push(match[1]);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
163
219
|
} else {
|
|
164
220
|
const patterns = [
|
|
165
221
|
/import\s+.*?\s+from\s+['"](.+?)['"]/g,
|