MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / captureBaseline

Function captureBaseline

src/agent/verification.ts:226–254  ·  view source on GitHub ↗
(opts: {
  cwd: string;
  signal?: AbortSignal;
  timeoutMs?: number;
})

Source from the content-addressed store, hash-verified

224 * capture must never block the task.
225 */
226export async function captureBaseline(opts: {
227 cwd: string;
228 signal?: AbortSignal;
229 timeoutMs?: number;
230}): Promise<Diagnostic[]> {
231 try {
232 const rootFiles = await detectProjectFiles(opts.cwd);
233 // Baseline EVERY language's checker (one per language), in parallel, so the post-edit
234 // verify can subtract pre-existing debt for whichever language(s) the model touches.
235 // Per-file checkers (php -l) are skipped: linting the whole project to baseline is
236 // costly and near-useless — a working project has no syntax errors, so any the agent
237 // introduces are by definition new.
238 const specs = pickCheckers(rootFiles).filter(s => !s.perFile);
239 if (specs.length === 0) return [];
240 const timeoutMs = opts.timeoutMs ?? 120_000;
241 const perChecker = await Promise.all(specs.map(async spec => {
242 try {
243 const run = await runChecker(spec.argv, opts.cwd, timeoutMs, opts.signal);
244 if (run.spawnError || run.code === 127) return [] as Diagnostic[];
245 return spec.parse(checkerText(spec, run));
246 } catch {
247 return [] as Diagnostic[];
248 }
249 }));
250 return perChecker.flat();
251 } catch {
252 return [];
253 }
254}
255
256/** Re-export so callers don't need to import the registry directly. */
257export { CHECKERS };

Callers 1

runMethod · 0.85

Calls 4

detectProjectFilesFunction · 0.85
pickCheckersFunction · 0.85
runCheckerFunction · 0.85
checkerTextFunction · 0.85

Tested by

no test coverage detected