The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | /** The loader owns deduplication and the shared request cap, including other tree loads. */ |
| 2 | export async function loadFileAncestors( |
| 3 | selectedPath: string, |
| 4 | load: (directoryPath: string) => Promise<void>, |
| 5 | options: { readonly signal: AbortSignal }, |
| 6 | ) { |
| 7 | const segments = selectedPath.split("/"); |
| 8 | let next = 0; |
| 9 | const worker = async () => { |
| 10 | while (next < segments.length && !options.signal.aborted) { |
| 11 | await load(segments.slice(0, next++).join("/")); |
| 12 | } |
| 13 | }; |
| 14 | await Promise.all(Array.from({ length: Math.min(4, segments.length) }, worker)); |
| 15 | } |