( task: EditPreflightTask, rootPath: string )
| 130 | } |
| 131 | |
| 132 | async function runSearchPreflight( |
| 133 | task: EditPreflightTask, |
| 134 | rootPath: string |
| 135 | ): Promise<EditPreflightResponse> { |
| 136 | const project = createProjectState(rootPath); |
| 137 | project.indexState.status = 'ready'; |
| 138 | |
| 139 | const response = await searchCodebaseHandle( |
| 140 | { |
| 141 | query: task.query, |
| 142 | intent: 'edit', |
| 143 | limit: task.limit ?? 5 |
| 144 | }, |
| 145 | { |
| 146 | indexState: project.indexState, |
| 147 | paths: project.paths, |
| 148 | rootPath: project.rootPath, |
| 149 | performIndexing: () => undefined |
| 150 | } |
| 151 | ); |
| 152 | const payload = response.content?.[0]?.text ?? '{}'; |
| 153 | const parsed = JSON.parse(payload) as unknown; |
| 154 | |
| 155 | if (typeof parsed === 'object' && parsed !== null) { |
| 156 | return parsed as EditPreflightResponse; |
| 157 | } |
| 158 | |
| 159 | return {}; |
| 160 | } |
| 161 | |
| 162 | export async function evaluateEditPreflightFixture({ |
| 163 | fixture, |
nothing calls this directly
no test coverage detected