( graph: ImportGraph, seedFiles: string[], maxPerSide = 8, )
| 79 | * flood the prompt. |
| 80 | */ |
| 81 | export function dependencyContextFor( |
| 82 | graph: ImportGraph, |
| 83 | seedFiles: string[], |
| 84 | maxPerSide = 8, |
| 85 | ): DependencyContext[] { |
| 86 | const out: DependencyContext[] = []; |
| 87 | for (const f of seedFiles) { |
| 88 | const imports = [...(graph.out.get(f) ?? [])].slice(0, maxPerSide); |
| 89 | const importedBy = [...(graph.in.get(f) ?? [])].slice(0, maxPerSide); |
| 90 | if (imports.length === 0 && importedBy.length === 0) continue; |
| 91 | out.push({ file: f, imports, importedBy }); |
| 92 | } |
| 93 | return out; |
| 94 | } |
| 95 | |
| 96 | /** Render dependency context as a compact prompt block, or '' if nothing useful. */ |
| 97 | export function renderDependencyContext(deps: DependencyContext[]): string { |
no test coverage detected