2.8 KiB
2.8 KiB
06. Pluggable check registry and command wiring
meta: id: pygienium-06 feature: pygienium priority: P1 depends_on: [pygienium-02, pygienium-03, pygienium-04, pygienium-05] tags: [core, integration]
objective:
- Build the check registry + check runner that turns a
CheckDefinitioninto a/pygienium-<name>command, wiring recon → sub-agent analysis → sub-agent fixes → verify → cleanup, and expose a phase-strip UI.
deliverables:
src/checks/registry.ts:CheckDefinitioninterface (name,label,description,agentName,phaseId,buildScanTask(cwd,scope),buildFixTask(cwd,scope,findings),gate(cwd)) and aregisterCheck(def)/getAllChecks()registrysrc/modes/check-runner.ts:runCheck(opts)orchestrating Q0 recon (shared) → analysis sub-agent → fix sub-agent (optional on--fix) → verify gate → cleanup transient artifacts; writes run-state via task 04src/agents.ts:loadAgents({cwd})reading markdown agent defs fromagents/*.md(name, systemPrompt, allowedTools, sourcePath)src/index.tsupdated: register/pygienium-helpand auto-register one/pygienium-<check>command per registered CheckDefinition; phase-strip status UI helpersrc/help.ts: command + flag help builder (skeleton, populated in task 14)
steps:
- Define
CheckDefinitionand a module-levelMapregistry withregisterCheck - Implement
runCheck: init/resolve run state → run shared recon if missing → spawn analysis agent via agent-runner (task 03) withbuildScanTask→ if--fix, spawn fix agent withbuildFixTask→ applyPhaseStatus complete/failed → markRunStatus - Implement phase-strip UI helper (status key, initial phase, console stream forwarding) adapted from piolium's createPhaseStripCommandUi (simplified)
- In index.ts: iterate registry,
pi.registerCommand("pygienium-"+def.name, { description, handler: runCheck wrapper }) - Ship
agents/scanner.mdandagents/fixer.mdgeneric agent definitions used by all checks (analysis + fix roles)
tests:
- Unit: registry register/getAll returns inserted defs
- Integration: register a no-op check whose agent writes a marker file; invoke its stub command; assert run-state marks it complete and the marker exists
acceptance_criteria:
- A check registered via
registerCheck({name:"smoke", ...})automatically exposes/pygienium-smoke runCheckwrites run-state and honors--fixvs scan-only- The phase strip UI shows the active phase and clears on completion
validation:
- Register a throwaway smoke check, run
/pygienium-smoke, inspectpygienium/run-state.json
notes:
- This is the integration keystone; task 07 builds the first real check on top of it
- Keep the registry open for extension: adding a check must NOT require editing index.ts command wiring