( filePath: string, content: string )
| 618 | typeof r.lineno === "number" && typeof r.end_lineno === "number" |
| 619 | ? detectTagsForLineSpan(lines, r.lineno, r.end_lineno) |
| 620 | : tags, |
| 621 | framework, |
| 622 | params: extractPathParams(r.path), |
| 623 | confidence: "ast" as const, |
| 624 | })); |
| 625 | } |
| 626 | |
| 627 | /** |
| 628 | * Extract SQLAlchemy models from a Python file using AST. |
| 629 | * Returns models with confidence: "ast", or null if Python is unavailable. |
| 630 | */ |
| 631 | export async function extractSQLAlchemyAST( |
| 632 | filePath: string, |
| 633 | content: string |
| 634 | ): Promise<SchemaModel[] | null> { |
| 635 | const result = await runPythonWithStdin(PYTHON_SCHEMA_SCRIPT, content, filePath); |
| 636 | if (!result || !Array.isArray(result) || result.length === 0) return null; |
| 637 | |
| 638 | return result.map((m: any) => ({ |
| 639 | name: m.name, |
| 640 | fields: (m.fields || []).map((f: any) => ({ |
| 641 | name: f.name, |
no test coverage detected