import { spawnSync } from 'node:child_process'; import type { ExecutorContext } from '@nx/devkit'; import type { AgentVerifyExecutorSchema } from './schema'; interface ExecutorResult { success: boolean; } /** * `errored` is not `failed` (issues/codex-security/53). A stage that could not RUN — the binary * vanished, the child was killed, its output overran the capture buffer — says nothing about whether * the code is correct, and reporting it as a failure tells the agent its fix did not work when the * verification never reached a verdict. */ type StageResult = 'passed' | 'failed' | 'skipped' | 'errored'; /** * `agent-verify` — the deterministic verification loop the agent runs * to know "did my fix work?". * * Phase 2 covers the frontend slice: typecheck (`tsc --noEmit`), lint * (`eslint`), and build (`vite build`). Each stage runs sequentially; * a stage failure marks the verify as `failed` but later stages still * run so the agent gets a complete picture, not just the first error. * * The report is written to `.lensmcp/verifications/-.json` * and to `.lensmcp/verifications/latest.json` for easy resource access. * The MCP-side `agent://latest-verification` resource (Phase 2.5) reads * from `latest.json`. */ export default function agentVerifyExecutor(options: AgentVerifyExecutorSchema, context: ExecutorContext): Promise; interface StageOutcome { result: StageResult; exitCode?: number; summary?: string; } /** * Run a verify sub-command, capturing its output and re-emitting it INDENTED. * * agent-verify deliberately runs commands that may fail — it IS the agent's * edit→verify loop, so a failing stage is a normal, expected outcome. In CI a * raw tool error printed at column 0 (`file(line,col): error TS....`) is picked * up by GitHub's problem matchers and turned into a spurious build *annotation*. * Indenting every line by two spaces keeps the output fully readable while * defeating the matchers (they anchor on a non-space first character), so a * verify failure never masquerades as a CI error. * * `r.error` is inspected, because "the tool could not be run" and "the tool said no" are different * answers and only one of them is about the code. */ export declare function runStageCommand(label: string, bin: string, args: string[], cwd: string, spawn?: typeof spawnSync): StageOutcome; /** The spawn result → a stage outcome. Split out so every branch is reachable from a test. */ export declare function classifyStage(r: { error?: Error & { code?: string; }; status?: number | null; signal?: NodeJS.Signals | null; }): StageOutcome; export {};