(params: ProjectIndexInput)
| 145 | const MAX_DISCOVERED_PROJECT_READ_BYTES = 1_000_000 |
| 146 | |
| 147 | async function computeProjectIndex(params: ProjectIndexInput): Promise<{ |
| 148 | fileTree: FileTreeNode[] |
| 149 | fileTokenScores: Record<string, any> |
| 150 | tokenCallers: Record<string, any> |
| 151 | }> { |
| 152 | const { cwd, fileTree, filePaths, readFile } = params |
| 153 | let fileTokenScores = {} |
| 154 | let tokenCallers = {} |
| 155 | |
| 156 | if (filePaths.length > 0) { |
| 157 | try { |
| 158 | const tokenData = await getFileTokenScores(cwd, filePaths, readFile) |
| 159 | fileTokenScores = tokenData.tokenScores |
| 160 | tokenCallers = tokenData.tokenCallers |
| 161 | } catch (error) { |
| 162 | // If token scoring fails, continue with empty scores |
| 163 | console.warn('Failed to generate parsed symbol scores:', error) |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | return { fileTree, fileTokenScores, tokenCallers } |
| 168 | } |
| 169 | |
| 170 | function getProjectIndexInput(params: { |
| 171 | cwd: string |
no test coverage detected