(options: SkeletonOptions)
| 34 | } |
| 35 | |
| 36 | export async function getFileSkeleton(options: SkeletonOptions): Promise<string> { |
| 37 | const fullPath = resolve(options.rootDir, options.filePath); |
| 38 | |
| 39 | if (!isSupportedFile(fullPath)) { |
| 40 | const content = await readFile(fullPath, "utf-8"); |
| 41 | const preview = content.split("\n").slice(0, 20).join("\n"); |
| 42 | return `[Unsupported language, showing first 20 lines]\n\n${preview}`; |
| 43 | } |
| 44 | |
| 45 | const analysis = await analyzeFile(fullPath); |
| 46 | |
| 47 | if (analysis.symbols.length === 0) { |
| 48 | const content = await readFile(fullPath, "utf-8"); |
| 49 | const preview = content.split("\n").slice(0, 30).join("\n"); |
| 50 | return `[No symbols detected, showing first 30 lines]\n\n${preview}`; |
| 51 | } |
| 52 | |
| 53 | return [ |
| 54 | `File: ${options.filePath} (${analysis.lineCount} lines)`, |
| 55 | `Symbols: ${analysis.symbols.length} top-level definitions`, |
| 56 | "", |
| 57 | formatSignatureBlock(analysis), |
| 58 | ].join("\n"); |
| 59 | } |
no test coverage detected