49 lines
2.8 KiB
Markdown
49 lines
2.8 KiB
Markdown
# 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 `CheckDefinition` into 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`: `CheckDefinition` interface (`name`, `label`, `description`, `agentName`, `phaseId`, `buildScanTask(cwd,scope)`, `buildFixTask(cwd,scope,findings)`, `gate(cwd)`) and a `registerCheck(def)` / `getAllChecks()` registry
|
|
- `src/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 04
|
|
- `src/agents.ts`: `loadAgents({cwd})` reading markdown agent defs from `agents/*.md` (name, systemPrompt, allowedTools, sourcePath)
|
|
- `src/index.ts` updated: register `/pygienium-help` and auto-register one `/pygienium-<check>` command per registered CheckDefinition; phase-strip status UI helper
|
|
- `src/help.ts`: command + flag help builder (skeleton, populated in task 14)
|
|
|
|
steps:
|
|
|
|
- Define `CheckDefinition` and a module-level `Map` registry with `registerCheck`
|
|
- Implement `runCheck`: init/resolve run state → run shared recon if missing → spawn analysis agent via agent-runner (task 03) with `buildScanTask` → if `--fix`, spawn fix agent with `buildFixTask` → 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.md` and `agents/fixer.md` generic 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`
|
|
- `runCheck` writes run-state and honors `--fix` vs scan-only
|
|
- The phase strip UI shows the active phase and clears on completion
|
|
|
|
validation:
|
|
|
|
- Register a throwaway smoke check, run `/pygienium-smoke`, inspect `pygienium/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
|