(files: { path: string, content: string }[], repoName: string = "local-project")
| 206 | }; |
| 207 | |
| 208 | const processFiles = async (files: { path: string, content: string }[], repoName: string = "local-project") => { |
| 209 | // Build fileContents map before the worker clears content for memory |
| 210 | const fileContents: Record<string, string> = {}; |
| 211 | for (const f of files) { |
| 212 | fileContents[f.path] = f.content; |
| 213 | } |
| 214 | |
| 215 | setProgress({ text: `Parsing AST for ${files.length} files...`, value: 50 }); |
| 216 | await new Promise(r => setTimeout(r, 800)); |
| 217 | |
| 218 | setProgress({ text: "Initializing WebAssembly tree-sitter...", value: 80 }); |
| 219 | const graphData = await parseFilesIntoGraph( |
| 220 | files, |
| 221 | (msg, val) => setProgress({ text: msg, value: val }), |
| 222 | { |
| 223 | indexVariables: config.indexVariables, |
| 224 | maxNodes: config.maxNodes, |
| 225 | maxEdges: config.maxEdges |
| 226 | } |
| 227 | ); |
| 228 | |
| 229 | setProgress({ text: "Complete!", value: 100 }); |
| 230 | await new Promise(r => setTimeout(r, 400)); |
| 231 | |
| 232 | onComplete({ |
| 233 | ...graphData, |
| 234 | fileContents, |
| 235 | metadata: { |
| 236 | repo: repoName, |
| 237 | version: "1.0.0", |
| 238 | timestamp: new Date().toISOString() |
| 239 | } |
| 240 | }); |
| 241 | }; |
| 242 | |
| 243 | const handleFolderSelect = async () => { |
| 244 | try { |
no test coverage detected