@aiready/core 0.23.23 → 0.24.0
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/chunk-2ILVUVRK.mjs +860 -0
- package/dist/chunk-G4Z45SMK.mjs +852 -0
- package/dist/chunk-LTAZ7Z62.mjs +855 -0
- package/dist/chunk-SM6INS52.mjs +501 -0
- package/dist/client/index.d.mts +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +20 -12
- package/dist/client/index.mjs +1 -1
- package/dist/index-CkM98qn1.d.mts +1299 -0
- package/dist/index-CkM98qn1.d.ts +1299 -0
- package/dist/index-DLHCsiAk.d.mts +1294 -0
- package/dist/index-DLHCsiAk.d.ts +1294 -0
- package/dist/index-EQ2jRSlB.d.mts +1301 -0
- package/dist/index-EQ2jRSlB.d.ts +1301 -0
- package/dist/index.d.mts +177 -139
- package/dist/index.d.ts +177 -139
- package/dist/index.js +483 -253
- package/dist/index.mjs +451 -240
- package/dist/python-parser-SJ3LFZFJ.mjs +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseLanguageParser
|
|
3
|
+
} from "./chunk-2N7ISIKE.mjs";
|
|
4
|
+
|
|
5
|
+
// src/parsers/metadata-utils.ts
|
|
6
|
+
function analyzeNodeMetadata(node, code, options) {
|
|
7
|
+
const metadata = {
|
|
8
|
+
isPure: true,
|
|
9
|
+
hasSideEffects: false
|
|
10
|
+
};
|
|
11
|
+
try {
|
|
12
|
+
let prev = node.previousSibling || null;
|
|
13
|
+
while (prev && /comment/i.test(prev.type)) {
|
|
14
|
+
const text = prev.text || "";
|
|
15
|
+
const loc = {
|
|
16
|
+
start: {
|
|
17
|
+
line: prev.startPosition.row + 1,
|
|
18
|
+
column: prev.startPosition.column
|
|
19
|
+
},
|
|
20
|
+
end: {
|
|
21
|
+
line: prev.endPosition.row + 1,
|
|
22
|
+
column: prev.endPosition.column
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
if (text.trim().startsWith("/**") || text.trim().startsWith("/*")) {
|
|
26
|
+
metadata.documentation = {
|
|
27
|
+
content: text.replace(/^[/*]+|[/*]+$/g, "").trim(),
|
|
28
|
+
type: "comment",
|
|
29
|
+
loc
|
|
30
|
+
};
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
if (text.trim().startsWith("///")) {
|
|
34
|
+
metadata.documentation = {
|
|
35
|
+
content: text.replace(/^\/\/\//, "").trim(),
|
|
36
|
+
type: "xml-doc",
|
|
37
|
+
loc
|
|
38
|
+
};
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
if (text.trim().startsWith("//")) {
|
|
42
|
+
metadata.documentation = {
|
|
43
|
+
content: text.replace(/^\/\//, "").trim(),
|
|
44
|
+
type: "comment",
|
|
45
|
+
loc
|
|
46
|
+
};
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
prev = prev.previousSibling;
|
|
50
|
+
}
|
|
51
|
+
if (node.type === "function_definition" || node.type === "class_definition") {
|
|
52
|
+
const body2 = node.childForFieldName ? node.childForFieldName("body") : node.children.find((c) => c.type === "block");
|
|
53
|
+
if (body2 && body2.children.length > 0) {
|
|
54
|
+
const firstStmt = body2.children[0];
|
|
55
|
+
if (firstStmt.type === "expression_statement" && firstStmt.firstChild?.type === "string") {
|
|
56
|
+
metadata.documentation = {
|
|
57
|
+
content: firstStmt.firstChild.text.replace(/['"`]/g, "").trim(),
|
|
58
|
+
type: "docstring",
|
|
59
|
+
loc: {
|
|
60
|
+
start: {
|
|
61
|
+
line: firstStmt.startPosition.row + 1,
|
|
62
|
+
column: firstStmt.startPosition.column
|
|
63
|
+
},
|
|
64
|
+
end: {
|
|
65
|
+
line: firstStmt.endPosition.row + 1,
|
|
66
|
+
column: firstStmt.endPosition.column
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
} catch {
|
|
74
|
+
}
|
|
75
|
+
const defaultSignatures = [
|
|
76
|
+
"console.",
|
|
77
|
+
"fmt.",
|
|
78
|
+
"panic(",
|
|
79
|
+
"os.Exit",
|
|
80
|
+
"log.",
|
|
81
|
+
"Console.Write",
|
|
82
|
+
"File.Write",
|
|
83
|
+
"System.out",
|
|
84
|
+
"System.err",
|
|
85
|
+
"Files.write",
|
|
86
|
+
"process.exit",
|
|
87
|
+
"exit("
|
|
88
|
+
];
|
|
89
|
+
const signatures = Array.from(
|
|
90
|
+
/* @__PURE__ */ new Set([...options?.sideEffectSignatures || [], ...defaultSignatures])
|
|
91
|
+
);
|
|
92
|
+
const walk = (n) => {
|
|
93
|
+
try {
|
|
94
|
+
const t = n.type || "";
|
|
95
|
+
if (/assign|assignment|assignment_statement|assignment_expression|throw|throw_statement|send_statement|global_statement|nonlocal_statement/i.test(
|
|
96
|
+
t
|
|
97
|
+
)) {
|
|
98
|
+
metadata.isPure = false;
|
|
99
|
+
metadata.hasSideEffects = true;
|
|
100
|
+
}
|
|
101
|
+
const text = n.text || "";
|
|
102
|
+
for (const s of signatures) {
|
|
103
|
+
if (text.includes(s)) {
|
|
104
|
+
metadata.isPure = false;
|
|
105
|
+
metadata.hasSideEffects = true;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
for (let i = 0; i < n.childCount; i++) {
|
|
110
|
+
const c = n.child(i);
|
|
111
|
+
if (c) walk(c);
|
|
112
|
+
}
|
|
113
|
+
} catch {
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
const body = node.childForFieldName?.("body") || node.children.find(
|
|
117
|
+
(c) => /body|block|class_body|declaration_list|function_body/.test(c.type)
|
|
118
|
+
);
|
|
119
|
+
if (body) walk(body);
|
|
120
|
+
return metadata;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// src/parsers/python-parser.ts
|
|
124
|
+
var PythonParser = class extends BaseLanguageParser {
|
|
125
|
+
constructor() {
|
|
126
|
+
super(...arguments);
|
|
127
|
+
this.language = "python" /* Python */;
|
|
128
|
+
this.extensions = [".py"];
|
|
129
|
+
}
|
|
130
|
+
getParserName() {
|
|
131
|
+
return "python";
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Analyze metadata for a Python node (purity, side effects).
|
|
135
|
+
*
|
|
136
|
+
* @param node - Tree-sitter node to analyze.
|
|
137
|
+
* @param code - Source code for context.
|
|
138
|
+
* @returns Partial ExportInfo containing discovered metadata.
|
|
139
|
+
*/
|
|
140
|
+
analyzeMetadata(node, code) {
|
|
141
|
+
return analyzeNodeMetadata(node, code, {
|
|
142
|
+
sideEffectSignatures: ["print(", "input(", "open("]
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Extract import information using AST walk.
|
|
147
|
+
*
|
|
148
|
+
* @param rootNode - Root node of the Python AST.
|
|
149
|
+
* @returns Array of discovered FileImport objects.
|
|
150
|
+
*/
|
|
151
|
+
extractImportsAST(rootNode) {
|
|
152
|
+
const imports = [];
|
|
153
|
+
const processImportNode = (node) => {
|
|
154
|
+
if (node.type === "import_statement") {
|
|
155
|
+
for (const child of node.children) {
|
|
156
|
+
if (child.type === "dotted_name") {
|
|
157
|
+
const source = child.text;
|
|
158
|
+
imports.push({
|
|
159
|
+
source,
|
|
160
|
+
specifiers: [source],
|
|
161
|
+
loc: {
|
|
162
|
+
start: {
|
|
163
|
+
line: child.startPosition.row + 1,
|
|
164
|
+
column: child.startPosition.column
|
|
165
|
+
},
|
|
166
|
+
end: {
|
|
167
|
+
line: child.endPosition.row + 1,
|
|
168
|
+
column: child.endPosition.column
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
} else if (child.type === "aliased_import") {
|
|
173
|
+
const nameNode = child.childForFieldName("name");
|
|
174
|
+
if (nameNode) {
|
|
175
|
+
const source = nameNode.text;
|
|
176
|
+
imports.push({
|
|
177
|
+
source,
|
|
178
|
+
specifiers: [source],
|
|
179
|
+
loc: {
|
|
180
|
+
start: {
|
|
181
|
+
line: child.startPosition.row + 1,
|
|
182
|
+
column: child.startPosition.column
|
|
183
|
+
},
|
|
184
|
+
end: {
|
|
185
|
+
line: child.endPosition.row + 1,
|
|
186
|
+
column: child.endPosition.column
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
} else if (node.type === "import_from_statement") {
|
|
194
|
+
const moduleNameNode = node.childForFieldName("module_name");
|
|
195
|
+
if (moduleNameNode) {
|
|
196
|
+
const source = moduleNameNode.text;
|
|
197
|
+
const specifiers = [];
|
|
198
|
+
for (const child of node.children) {
|
|
199
|
+
if (child.type === "dotted_name" && child !== moduleNameNode) {
|
|
200
|
+
specifiers.push(child.text);
|
|
201
|
+
} else if (child.type === "aliased_import") {
|
|
202
|
+
const nameNode = child.childForFieldName("name");
|
|
203
|
+
if (nameNode) specifiers.push(nameNode.text);
|
|
204
|
+
} else if (child.type === "wildcard_import") {
|
|
205
|
+
specifiers.push("*");
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
if (specifiers.length > 0) {
|
|
209
|
+
imports.push({
|
|
210
|
+
source,
|
|
211
|
+
specifiers,
|
|
212
|
+
loc: {
|
|
213
|
+
start: {
|
|
214
|
+
line: node.startPosition.row + 1,
|
|
215
|
+
column: node.startPosition.column
|
|
216
|
+
},
|
|
217
|
+
end: {
|
|
218
|
+
line: node.endPosition.row + 1,
|
|
219
|
+
column: node.endPosition.column
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
for (const node of rootNode.children) {
|
|
228
|
+
processImportNode(node);
|
|
229
|
+
}
|
|
230
|
+
return imports;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Extract export information using AST walk.
|
|
234
|
+
*
|
|
235
|
+
* @param rootNode - Root node of the Python AST.
|
|
236
|
+
* @param code - Source code for documentation extraction.
|
|
237
|
+
* @returns Array of discovered ExportInfo objects.
|
|
238
|
+
*/
|
|
239
|
+
extractExportsAST(rootNode, code) {
|
|
240
|
+
const exports = [];
|
|
241
|
+
for (const node of rootNode.children) {
|
|
242
|
+
if (node.type === "function_definition") {
|
|
243
|
+
const nameNode = node.childForFieldName("name");
|
|
244
|
+
if (nameNode) {
|
|
245
|
+
const name = nameNode.text;
|
|
246
|
+
const isPrivate = name.startsWith("_") && !name.startsWith("__");
|
|
247
|
+
if (!isPrivate) {
|
|
248
|
+
const metadata = this.analyzeMetadata(node, code);
|
|
249
|
+
exports.push({
|
|
250
|
+
name,
|
|
251
|
+
type: "function",
|
|
252
|
+
loc: {
|
|
253
|
+
start: {
|
|
254
|
+
line: node.startPosition.row + 1,
|
|
255
|
+
column: node.startPosition.column
|
|
256
|
+
},
|
|
257
|
+
end: {
|
|
258
|
+
line: node.endPosition.row + 1,
|
|
259
|
+
column: node.endPosition.column
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
parameters: this.extractParameters(node),
|
|
263
|
+
...metadata
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
} else if (node.type === "class_definition") {
|
|
268
|
+
const nameNode = node.childForFieldName("name");
|
|
269
|
+
if (nameNode) {
|
|
270
|
+
const metadata = this.analyzeMetadata(node, code);
|
|
271
|
+
exports.push({
|
|
272
|
+
name: nameNode.text,
|
|
273
|
+
type: "class",
|
|
274
|
+
loc: {
|
|
275
|
+
start: {
|
|
276
|
+
line: node.startPosition.row + 1,
|
|
277
|
+
column: node.startPosition.column
|
|
278
|
+
},
|
|
279
|
+
end: {
|
|
280
|
+
line: node.endPosition.row + 1,
|
|
281
|
+
column: node.endPosition.column
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
...metadata
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
} else if (node.type === "expression_statement") {
|
|
288
|
+
const assignment = node.firstChild;
|
|
289
|
+
if (assignment && assignment.type === "assignment") {
|
|
290
|
+
const left = assignment.childForFieldName("left");
|
|
291
|
+
if (left && left.type === "identifier") {
|
|
292
|
+
const name = left.text;
|
|
293
|
+
const isInternal = name === "__all__" || name === "__version__" || name === "__author__";
|
|
294
|
+
const isPrivate = name.startsWith("_") && !name.startsWith("__");
|
|
295
|
+
if (!isInternal && !isPrivate) {
|
|
296
|
+
exports.push({
|
|
297
|
+
name,
|
|
298
|
+
type: name === name.toUpperCase() ? "const" : "variable",
|
|
299
|
+
loc: {
|
|
300
|
+
start: {
|
|
301
|
+
line: node.startPosition.row + 1,
|
|
302
|
+
column: node.startPosition.column
|
|
303
|
+
},
|
|
304
|
+
end: {
|
|
305
|
+
line: node.endPosition.row + 1,
|
|
306
|
+
column: node.endPosition.column
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return exports;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Extract parameter names from a function definition node.
|
|
319
|
+
*
|
|
320
|
+
* @param node - Function definition node.
|
|
321
|
+
* @returns Array of parameter name strings.
|
|
322
|
+
*/
|
|
323
|
+
extractParameters(node) {
|
|
324
|
+
const paramsNode = node.childForFieldName("parameters");
|
|
325
|
+
if (!paramsNode) return [];
|
|
326
|
+
return paramsNode.children.filter(
|
|
327
|
+
(c) => c.type === "identifier" || c.type === "typed_parameter" || c.type === "default_parameter"
|
|
328
|
+
).map((c) => {
|
|
329
|
+
if (c.type === "identifier") return c.text;
|
|
330
|
+
if (c.type === "typed_parameter" || c.type === "default_parameter") {
|
|
331
|
+
return c.firstChild?.text || "unknown";
|
|
332
|
+
}
|
|
333
|
+
return "unknown";
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Fallback regex-based parsing when tree-sitter is unavailable.
|
|
338
|
+
*
|
|
339
|
+
* @param code - Source code content.
|
|
340
|
+
* @param filePath - Path to the file being parsed.
|
|
341
|
+
* @returns Consolidated ParseResult.
|
|
342
|
+
*/
|
|
343
|
+
parseRegex(code, filePath) {
|
|
344
|
+
try {
|
|
345
|
+
const imports = this.extractImportsRegex(code, filePath);
|
|
346
|
+
const exports = this.extractExportsRegex(code, filePath);
|
|
347
|
+
return {
|
|
348
|
+
exports,
|
|
349
|
+
imports,
|
|
350
|
+
language: "python" /* Python */,
|
|
351
|
+
warnings: [
|
|
352
|
+
"Python parsing is currently using regex-based extraction as tree-sitter wasm was not available."
|
|
353
|
+
]
|
|
354
|
+
};
|
|
355
|
+
} catch (error) {
|
|
356
|
+
const wrapper = new Error(
|
|
357
|
+
`Failed to parse Python file ${filePath}: ${error.message}`
|
|
358
|
+
);
|
|
359
|
+
wrapper.cause = error;
|
|
360
|
+
throw wrapper;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
getNamingConventions() {
|
|
364
|
+
return {
|
|
365
|
+
variablePattern: /^[a-z_][a-z0-9_]*$/,
|
|
366
|
+
functionPattern: /^[a-z_][a-z0-9_]*$/,
|
|
367
|
+
classPattern: /^[A-Z][a-zA-Z0-9]*$/,
|
|
368
|
+
constantPattern: /^[A-Z][A-Z0-9_]*$/,
|
|
369
|
+
exceptions: [
|
|
370
|
+
"__init__",
|
|
371
|
+
"__str__",
|
|
372
|
+
"__repr__",
|
|
373
|
+
"__name__",
|
|
374
|
+
"__main__",
|
|
375
|
+
"__file__",
|
|
376
|
+
"__doc__",
|
|
377
|
+
"__all__",
|
|
378
|
+
"__version__",
|
|
379
|
+
"__author__",
|
|
380
|
+
"__dict__",
|
|
381
|
+
"__class__",
|
|
382
|
+
"__module__",
|
|
383
|
+
"__bases__"
|
|
384
|
+
]
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
canHandle(filePath) {
|
|
388
|
+
return filePath.toLowerCase().endsWith(".py");
|
|
389
|
+
}
|
|
390
|
+
extractImportsRegex(code, _filePath) {
|
|
391
|
+
void _filePath;
|
|
392
|
+
const imports = [];
|
|
393
|
+
const lines = code.split("\n");
|
|
394
|
+
const importRegex = /^\s*import\s+([a-zA-Z0-9_., ]+)/;
|
|
395
|
+
const fromImportRegex = /^\s*from\s+([a-zA-Z0-9_.]+)\s+import\s+(.+)/;
|
|
396
|
+
lines.forEach((line, idx) => {
|
|
397
|
+
if (line.trim().startsWith("#")) return;
|
|
398
|
+
const importMatch = line.match(importRegex);
|
|
399
|
+
if (importMatch) {
|
|
400
|
+
const modules = importMatch[1].split(",").map((m) => m.trim().split(" as ")[0]);
|
|
401
|
+
modules.forEach((module) => {
|
|
402
|
+
imports.push({
|
|
403
|
+
source: module,
|
|
404
|
+
specifiers: [module],
|
|
405
|
+
loc: {
|
|
406
|
+
start: { line: idx + 1, column: 0 },
|
|
407
|
+
end: { line: idx + 1, column: line.length }
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
});
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
const fromMatch = line.match(fromImportRegex);
|
|
414
|
+
if (fromMatch) {
|
|
415
|
+
const module = fromMatch[1];
|
|
416
|
+
const importsStr = fromMatch[2];
|
|
417
|
+
if (importsStr.trim() === "*") {
|
|
418
|
+
imports.push({
|
|
419
|
+
source: module,
|
|
420
|
+
specifiers: ["*"],
|
|
421
|
+
loc: {
|
|
422
|
+
start: { line: idx + 1, column: 0 },
|
|
423
|
+
end: { line: idx + 1, column: line.length }
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
const specifiers = importsStr.split(",").map((s) => s.trim().split(" as ")[0]);
|
|
429
|
+
imports.push({
|
|
430
|
+
source: module,
|
|
431
|
+
specifiers,
|
|
432
|
+
loc: {
|
|
433
|
+
start: { line: idx + 1, column: 0 },
|
|
434
|
+
end: { line: idx + 1, column: line.length }
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
return imports;
|
|
440
|
+
}
|
|
441
|
+
extractExportsRegex(code, _filePath) {
|
|
442
|
+
void _filePath;
|
|
443
|
+
const exports = [];
|
|
444
|
+
const lines = code.split("\n");
|
|
445
|
+
const funcRegex = /^def\s+([a-zA-Z0-9_]+)\s*\(/;
|
|
446
|
+
const classRegex = /^class\s+([a-zA-Z0-9_]+)/;
|
|
447
|
+
lines.forEach((line, idx) => {
|
|
448
|
+
const indent = line.search(/\S/);
|
|
449
|
+
if (indent !== 0) return;
|
|
450
|
+
const classMatch = line.match(classRegex);
|
|
451
|
+
if (classMatch) {
|
|
452
|
+
exports.push({
|
|
453
|
+
name: classMatch[1],
|
|
454
|
+
type: "class",
|
|
455
|
+
visibility: "public",
|
|
456
|
+
isPure: true,
|
|
457
|
+
hasSideEffects: false,
|
|
458
|
+
loc: {
|
|
459
|
+
start: { line: idx + 1, column: 0 },
|
|
460
|
+
end: { line: idx + 1, column: line.length }
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
const funcMatch = line.match(funcRegex);
|
|
466
|
+
if (funcMatch) {
|
|
467
|
+
const name = funcMatch[1];
|
|
468
|
+
if (name.startsWith("_") && !name.startsWith("__")) return;
|
|
469
|
+
let docContent;
|
|
470
|
+
const nextLines = lines.slice(idx + 1, idx + 4);
|
|
471
|
+
for (const nextLine of nextLines) {
|
|
472
|
+
const docMatch = nextLine.match(/^\s*"""([\s\S]*?)"""/) || nextLine.match(/^\s*'''([\s\S]*?)'''/);
|
|
473
|
+
if (docMatch) {
|
|
474
|
+
docContent = docMatch[1].trim();
|
|
475
|
+
break;
|
|
476
|
+
}
|
|
477
|
+
if (nextLine.trim() && !nextLine.trim().startsWith('"""') && !nextLine.trim().startsWith("'''"))
|
|
478
|
+
break;
|
|
479
|
+
}
|
|
480
|
+
const isImpure = name.toLowerCase().includes("impure") || line.includes("print(") || idx + 1 < lines.length && lines[idx + 1].includes("print(");
|
|
481
|
+
exports.push({
|
|
482
|
+
name,
|
|
483
|
+
type: "function",
|
|
484
|
+
visibility: "public",
|
|
485
|
+
isPure: !isImpure,
|
|
486
|
+
hasSideEffects: isImpure,
|
|
487
|
+
documentation: docContent ? { content: docContent, type: "docstring" } : void 0,
|
|
488
|
+
loc: {
|
|
489
|
+
start: { line: idx + 1, column: 0 },
|
|
490
|
+
end: { line: idx + 1, column: line.length }
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
return exports;
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
export {
|
|
500
|
+
PythonParser
|
|
501
|
+
};
|
package/dist/client/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { e as AIReadyConfig, o as AIReadyConfigSchema, i as AcceptancePrediction, A as AnalysisResult, q as AnalysisResultSchema, r as AnalysisStatus, s as AnalysisStatusSchema, aN as BaseGraphLink, aO as BaseGraphNode, B as BusinessMetrics, t as COMMON_FINE_TUNING_OPTIONS, u as CONTEXT_TIER_THRESHOLDS, v as CommonASTNode, j as ComprehensionDifficulty, w as Config, C as CostConfig, D as DEFAULT_TOOL_WEIGHTS, n as ExportInfo, x as FRIENDLY_TOOL_NAMES, y as FileContent, G as GLOBAL_INFRA_OPTIONS, z as GLOBAL_SCAN_OPTIONS, H as GraphData, J as GraphEdge, K as GraphIssueSeverity, O as GraphMetadata, Q as GraphNode, I as Issue, R as IssueOverlay, U as IssueSchema, V as IssueType, W as IssueTypeSchema, X as LANGUAGE_EXTENSIONS, L as Language, Y as LanguageConfig, l as LanguageParser, Z as Lead, _ as LeadSchema, $ as LeadSource, a0 as LeadSourceSchema, a1 as LeadSubmission, a2 as LeadSubmissionSchema, a3 as Location, a4 as LocationSchema, M as Metrics, a7 as MetricsSchema, g as ModelContextTier, a8 as ModelTier, a9 as ModelTierSchema, N as NamingConvention, aa as ParseError, m as ParseResult, ab as ParseStatistics, P as ProductivityImpact, ad as RecommendationPriority, ae as SCORING_PROFILES, af as SIZE_ADJUSTED_THRESHOLDS, S as ScanOptions, ag as ScanResult, ah as ScoringConfig, ai as ScoringProfile, aj as ScoringResult,
|
|
1
|
+
export { e as AIReadyConfig, o as AIReadyConfigSchema, i as AcceptancePrediction, A as AnalysisResult, q as AnalysisResultSchema, r as AnalysisStatus, s as AnalysisStatusSchema, aN as BaseGraphLink, aO as BaseGraphNode, B as BusinessMetrics, t as COMMON_FINE_TUNING_OPTIONS, u as CONTEXT_TIER_THRESHOLDS, v as CommonASTNode, j as ComprehensionDifficulty, w as Config, C as CostConfig, D as DEFAULT_TOOL_WEIGHTS, n as ExportInfo, x as FRIENDLY_TOOL_NAMES, y as FileContent, G as GLOBAL_INFRA_OPTIONS, z as GLOBAL_SCAN_OPTIONS, H as GraphData, J as GraphEdge, K as GraphIssueSeverity, O as GraphMetadata, Q as GraphNode, I as Issue, R as IssueOverlay, U as IssueSchema, V as IssueType, W as IssueTypeSchema, X as LANGUAGE_EXTENSIONS, L as Language, Y as LanguageConfig, l as LanguageParser, Z as Lead, _ as LeadSchema, $ as LeadSource, a0 as LeadSourceSchema, a1 as LeadSubmission, a2 as LeadSubmissionSchema, a3 as Location, a4 as LocationSchema, M as Metrics, a7 as MetricsSchema, g as ModelContextTier, a8 as ModelTier, a9 as ModelTierSchema, N as NamingConvention, aa as ParseError, m as ParseResult, ab as ParseStatistics, P as ProductivityImpact, ad as RecommendationPriority, ae as SCORING_PROFILES, af as SIZE_ADJUSTED_THRESHOLDS, S as ScanOptions, ag as ScanResult, ah as ScoringConfig, ai as ScoringProfile, aj as ScoringResult, c as Severity, ak as SeveritySchema, c as SeverityType, al as SourceLocation, am as SourceRange, a as SpokeOutput, an as SpokeOutputSchema, ao as SpokeSummary, ap as SpokeSummarySchema, aq as TOOL_NAME_MAP, f as TechnicalValueChain, k as TechnicalValueChainSummary, h as TokenBudget, T as ToolName, ar as ToolNameSchema, d as ToolOptions, as as ToolOutput, b as ToolScoringOutput, at as UnifiedReport, au as UnifiedReportSchema, av as calculateOverallScore, aw as formatScore, ax as formatToolScore, ay as generateHTML, aA as getProjectSizeTier, aB as getRating, aC as getRatingDisplay, aG as getRatingSlug, aH as getRatingWithContext, aI as getRecommendedThreshold, aK as getToolWeight, aL as normalizeToolName, aM as parseWeightString } from '../index-EQ2jRSlB.mjs';
|
|
2
2
|
import 'zod';
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { e as AIReadyConfig, o as AIReadyConfigSchema, i as AcceptancePrediction, A as AnalysisResult, q as AnalysisResultSchema, r as AnalysisStatus, s as AnalysisStatusSchema, aN as BaseGraphLink, aO as BaseGraphNode, B as BusinessMetrics, t as COMMON_FINE_TUNING_OPTIONS, u as CONTEXT_TIER_THRESHOLDS, v as CommonASTNode, j as ComprehensionDifficulty, w as Config, C as CostConfig, D as DEFAULT_TOOL_WEIGHTS, n as ExportInfo, x as FRIENDLY_TOOL_NAMES, y as FileContent, G as GLOBAL_INFRA_OPTIONS, z as GLOBAL_SCAN_OPTIONS, H as GraphData, J as GraphEdge, K as GraphIssueSeverity, O as GraphMetadata, Q as GraphNode, I as Issue, R as IssueOverlay, U as IssueSchema, V as IssueType, W as IssueTypeSchema, X as LANGUAGE_EXTENSIONS, L as Language, Y as LanguageConfig, l as LanguageParser, Z as Lead, _ as LeadSchema, $ as LeadSource, a0 as LeadSourceSchema, a1 as LeadSubmission, a2 as LeadSubmissionSchema, a3 as Location, a4 as LocationSchema, M as Metrics, a7 as MetricsSchema, g as ModelContextTier, a8 as ModelTier, a9 as ModelTierSchema, N as NamingConvention, aa as ParseError, m as ParseResult, ab as ParseStatistics, P as ProductivityImpact, ad as RecommendationPriority, ae as SCORING_PROFILES, af as SIZE_ADJUSTED_THRESHOLDS, S as ScanOptions, ag as ScanResult, ah as ScoringConfig, ai as ScoringProfile, aj as ScoringResult,
|
|
1
|
+
export { e as AIReadyConfig, o as AIReadyConfigSchema, i as AcceptancePrediction, A as AnalysisResult, q as AnalysisResultSchema, r as AnalysisStatus, s as AnalysisStatusSchema, aN as BaseGraphLink, aO as BaseGraphNode, B as BusinessMetrics, t as COMMON_FINE_TUNING_OPTIONS, u as CONTEXT_TIER_THRESHOLDS, v as CommonASTNode, j as ComprehensionDifficulty, w as Config, C as CostConfig, D as DEFAULT_TOOL_WEIGHTS, n as ExportInfo, x as FRIENDLY_TOOL_NAMES, y as FileContent, G as GLOBAL_INFRA_OPTIONS, z as GLOBAL_SCAN_OPTIONS, H as GraphData, J as GraphEdge, K as GraphIssueSeverity, O as GraphMetadata, Q as GraphNode, I as Issue, R as IssueOverlay, U as IssueSchema, V as IssueType, W as IssueTypeSchema, X as LANGUAGE_EXTENSIONS, L as Language, Y as LanguageConfig, l as LanguageParser, Z as Lead, _ as LeadSchema, $ as LeadSource, a0 as LeadSourceSchema, a1 as LeadSubmission, a2 as LeadSubmissionSchema, a3 as Location, a4 as LocationSchema, M as Metrics, a7 as MetricsSchema, g as ModelContextTier, a8 as ModelTier, a9 as ModelTierSchema, N as NamingConvention, aa as ParseError, m as ParseResult, ab as ParseStatistics, P as ProductivityImpact, ad as RecommendationPriority, ae as SCORING_PROFILES, af as SIZE_ADJUSTED_THRESHOLDS, S as ScanOptions, ag as ScanResult, ah as ScoringConfig, ai as ScoringProfile, aj as ScoringResult, c as Severity, ak as SeveritySchema, c as SeverityType, al as SourceLocation, am as SourceRange, a as SpokeOutput, an as SpokeOutputSchema, ao as SpokeSummary, ap as SpokeSummarySchema, aq as TOOL_NAME_MAP, f as TechnicalValueChain, k as TechnicalValueChainSummary, h as TokenBudget, T as ToolName, ar as ToolNameSchema, d as ToolOptions, as as ToolOutput, b as ToolScoringOutput, at as UnifiedReport, au as UnifiedReportSchema, av as calculateOverallScore, aw as formatScore, ax as formatToolScore, ay as generateHTML, aA as getProjectSizeTier, aB as getRating, aC as getRatingDisplay, aG as getRatingSlug, aH as getRatingWithContext, aI as getRecommendedThreshold, aK as getToolWeight, aL as normalizeToolName, aM as parseWeightString } from '../index-EQ2jRSlB.js';
|
|
2
2
|
import 'zod';
|
package/dist/client/index.js
CHANGED
|
@@ -154,6 +154,7 @@ var ToolName = /* @__PURE__ */ ((ToolName2) => {
|
|
|
154
154
|
ToolName2["PatternEntropy"] = "pattern-entropy";
|
|
155
155
|
ToolName2["ConceptCohesion"] = "concept-cohesion";
|
|
156
156
|
ToolName2["SemanticDistance"] = "semantic-distance";
|
|
157
|
+
ToolName2["ContractEnforcement"] = "contract-enforcement";
|
|
157
158
|
return ToolName2;
|
|
158
159
|
})(ToolName || {});
|
|
159
160
|
var ToolNameSchema = import_zod2.z.nativeEnum(ToolName);
|
|
@@ -170,7 +171,8 @@ var FRIENDLY_TOOL_NAMES = {
|
|
|
170
171
|
["cognitive-load" /* CognitiveLoad */]: "Cognitive Load",
|
|
171
172
|
["pattern-entropy" /* PatternEntropy */]: "Pattern Entropy",
|
|
172
173
|
["concept-cohesion" /* ConceptCohesion */]: "Concept Cohesion",
|
|
173
|
-
["semantic-distance" /* SemanticDistance */]: "Semantic Distance"
|
|
174
|
+
["semantic-distance" /* SemanticDistance */]: "Semantic Distance",
|
|
175
|
+
["contract-enforcement" /* ContractEnforcement */]: "Contract Enforcement"
|
|
174
176
|
};
|
|
175
177
|
var IssueType = /* @__PURE__ */ ((IssueType2) => {
|
|
176
178
|
IssueType2["DuplicatePattern"] = "duplicate-pattern";
|
|
@@ -191,6 +193,7 @@ var IssueType = /* @__PURE__ */ ((IssueType2) => {
|
|
|
191
193
|
IssueType2["AgentNavigationFailure"] = "agent-navigation-failure";
|
|
192
194
|
IssueType2["AmbiguousApi"] = "ambiguous-api";
|
|
193
195
|
IssueType2["ChangeAmplification"] = "change-amplification";
|
|
196
|
+
IssueType2["ContractGap"] = "contract-gap";
|
|
194
197
|
return IssueType2;
|
|
195
198
|
})(IssueType || {});
|
|
196
199
|
var IssueTypeSchema = import_zod2.z.nativeEnum(IssueType);
|
|
@@ -306,12 +309,12 @@ var UnifiedReportSchema = import_zod6.z.object({
|
|
|
306
309
|
// src/types/schemas/config.ts
|
|
307
310
|
var import_zod7 = require("zod");
|
|
308
311
|
var AIReadyConfigSchema = import_zod7.z.object({
|
|
309
|
-
/** Target score threshold (0-100) */
|
|
310
|
-
threshold: import_zod7.z.number().optional(),
|
|
311
|
-
/** Files or directories to include in scan */
|
|
312
|
-
include: import_zod7.z.array(import_zod7.z.string()).optional(),
|
|
313
312
|
/** Files or directories to exclude from scan */
|
|
314
313
|
exclude: import_zod7.z.array(import_zod7.z.string()).optional(),
|
|
314
|
+
/** Fail CI/CD if score below threshold (0-100) */
|
|
315
|
+
threshold: import_zod7.z.number().optional(),
|
|
316
|
+
/** Fail on issues: critical, major, any */
|
|
317
|
+
failOn: import_zod7.z.enum(["critical", "major", "any", "none"]).optional(),
|
|
315
318
|
/** Scan-specific configuration */
|
|
316
319
|
scan: import_zod7.z.object({
|
|
317
320
|
include: import_zod7.z.array(import_zod7.z.string()).optional(),
|
|
@@ -475,7 +478,8 @@ var DEFAULT_TOOL_WEIGHTS = {
|
|
|
475
478
|
["testability-index" /* TestabilityIndex */]: 10,
|
|
476
479
|
["doc-drift" /* DocDrift */]: 8,
|
|
477
480
|
["dependency-health" /* DependencyHealth */]: 6,
|
|
478
|
-
["change-amplification" /* ChangeAmplification */]: 8
|
|
481
|
+
["change-amplification" /* ChangeAmplification */]: 8,
|
|
482
|
+
["contract-enforcement" /* ContractEnforcement */]: 10
|
|
479
483
|
};
|
|
480
484
|
var TOOL_NAME_MAP = {
|
|
481
485
|
patterns: "pattern-detect" /* PatternDetect */,
|
|
@@ -494,7 +498,9 @@ var TOOL_NAME_MAP = {
|
|
|
494
498
|
"deps-health": "dependency-health" /* DependencyHealth */,
|
|
495
499
|
"dependency-health": "dependency-health" /* DependencyHealth */,
|
|
496
500
|
"change-amp": "change-amplification" /* ChangeAmplification */,
|
|
497
|
-
"change-amplification": "change-amplification" /* ChangeAmplification
|
|
501
|
+
"change-amplification": "change-amplification" /* ChangeAmplification */,
|
|
502
|
+
contract: "contract-enforcement" /* ContractEnforcement */,
|
|
503
|
+
"contract-enforcement": "contract-enforcement" /* ContractEnforcement */
|
|
498
504
|
};
|
|
499
505
|
var ScoringProfile = /* @__PURE__ */ ((ScoringProfile2) => {
|
|
500
506
|
ScoringProfile2["Default"] = "default";
|
|
@@ -508,9 +514,10 @@ var ScoringProfile = /* @__PURE__ */ ((ScoringProfile2) => {
|
|
|
508
514
|
var SCORING_PROFILES = {
|
|
509
515
|
["default" /* Default */]: DEFAULT_TOOL_WEIGHTS,
|
|
510
516
|
["agentic" /* Agentic */]: {
|
|
511
|
-
["ai-signal-clarity" /* AiSignalClarity */]:
|
|
512
|
-
["agent-grounding" /* AgentGrounding */]:
|
|
513
|
-
["testability-index" /* TestabilityIndex */]:
|
|
517
|
+
["ai-signal-clarity" /* AiSignalClarity */]: 25,
|
|
518
|
+
["agent-grounding" /* AgentGrounding */]: 25,
|
|
519
|
+
["testability-index" /* TestabilityIndex */]: 15,
|
|
520
|
+
["contract-enforcement" /* ContractEnforcement */]: 15,
|
|
514
521
|
["context-analyzer" /* ContextAnalyzer */]: 10,
|
|
515
522
|
["naming-consistency" /* NamingConsistency */]: 10
|
|
516
523
|
},
|
|
@@ -535,8 +542,9 @@ var SCORING_PROFILES = {
|
|
|
535
542
|
["dependency-health" /* DependencyHealth */]: 10
|
|
536
543
|
},
|
|
537
544
|
["security" /* Security */]: {
|
|
538
|
-
["naming-consistency" /* NamingConsistency */]:
|
|
539
|
-
["testability-index" /* TestabilityIndex */]:
|
|
545
|
+
["naming-consistency" /* NamingConsistency */]: 30,
|
|
546
|
+
["testability-index" /* TestabilityIndex */]: 25,
|
|
547
|
+
["contract-enforcement" /* ContractEnforcement */]: 15,
|
|
540
548
|
["dependency-health" /* DependencyHealth */]: 20,
|
|
541
549
|
["context-analyzer" /* ContextAnalyzer */]: 10
|
|
542
550
|
}
|