Frontend continuous-quality loop landed. Three composable cubes:
Wave 1 — kei-db-contract primitive (~870 LOC, 7 cubes per Constructor Pattern):
- Diffs SQL CREATE TABLE migrations against TypeScript type/interface declarations
- 4 drift modes: ORPHAN-SQL, ORPHAN-TS, TYPE-MISMATCH, NULL-MISMATCH
- Reuses sqlparser-rs (Apache 2.0) + regex + walkdir + serde_json + clap
- CLI: kei-db-contract <project-root> [--output json|text] [--strict]
- 5/5 integration tests pass (cargo check + cargo test green)
- Smoke-tested on keisei-marketplace: drift_count=266 across 30 tables
(expected — marketplace uses raw better-sqlite3 without explicit row types)
Wave 2 — frontend-validator agent + dev-guard skill extension:
- New _manifests/frontend-validator.toml (substrate_role: edit-local, tools: Bash+Read+Glob+Grep)
- Agent runs: stack detect → tsc --noEmit → eslint → kei-db-contract → playwright (optional)
- Severity rules: TYPE_CHECK FAIL = block, DB_CONTRACT drift > 0 = block, lint = advisory
- skills/dev-guard/SKILL.md extended: 4th agent triggered on .tsx/.ts/.dart edits or DB-layer touches
- adaptive-depth table extended with frontend + DB-layer rows
Wave 3 — auto-dev-guard.sh hook (PostToolUse:Edit|Write):
- Trivial-edit gate: skip if delta < 30 LOC (avoid spawn fatigue)
- File-pattern match: *.tsx|*.ts|*.svelte|*.vue|*.dart OR migrations/*.sql OR src/db/** OR src/types/** OR prisma/schema.prisma OR drizzle.config.*
- Auto-runs kei-db-contract for DB-layer edits if binary on PATH
- Stderr advisory only (exit 0 always — never blocks)
- Bypass: KEI_DISABLED_HOOKS or KEI_HOOK_PROFILE in {advisory-off, minimal, off}
- Smoke-tested with synthetic Edit input (39 LOC delta on .tsx → emits advisory)
- Registered in hooks/hooks.json under PostToolUse:Write|Edit chain
Reusability map (Constructor Pattern compose):
shared cubes: detect-stack, tsc, eslint, kei-db-contract, kei-visual-snapshot (deferred)
orchestrators: /dev-start (pre), /dev-guard (during, NOW with frontend-validator),
/dev-ship (final), /site-create (init)
Verify-before-commit (RULE 0.13):
- cargo check -p kei-db-contract: PASS
- cargo test -p kei-db-contract: 5 passed
- jq . hooks/hooks.json: valid
- bash hooks/auto-dev-guard.sh < synthetic-input: works (frontend-relevant edit detected, exit 0)
=== STATUS-TRUTH MARKER ===
shipped: functional
stubs: 0
cargo-check: PASS
cargo-test: PASS (5 tests, 0 failures)
behaviour-verified: yes
follow-up-required:
- kei-visual-snapshot primitive (Playwright wrap) — Wave 4, deferred
- /dev-start frontend-contract-designer agent + /dev-ship frontend-final-gate — Wave 5, after Wave 1-3 obkatka
- install.sh wiring for kei-db-contract binary
- hermes-style emit-on-drift advisory mode
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
72 lines
2.9 KiB
TOML
72 lines
2.9 KiB
TOML
# Atomar agent — frontend continuous-quality validator.
|
|
# 1 cube = 1 responsibility. Edit this manifest, not the .md.
|
|
|
|
name = "frontend-validator"
|
|
description = "Frontend continuous validator. Runs tsc --noEmit, eslint, kei-db-contract, optional visual snapshot. Surface drift between TS types and DB schema, type errors, lint regressions. Advisory by default."
|
|
tools = ["Glob", "Grep", "Read", "Bash"]
|
|
model = "opus"
|
|
substrate_role = "edit-local"
|
|
|
|
role = """
|
|
You are the frontend continuous-validator. Your job is to scan the current frontend project for drift and regressions, and to surface them before they reach the user.
|
|
|
|
Your steps in order, each emitting a section of the final report:
|
|
|
|
1. **Stack detect** — read package.json / pubspec.yaml / vite.config.* / next.config.* in the project root. State stack: Next.js / Vite / Flutter / SvelteKit / Astro / unknown.
|
|
|
|
2. **Type-check** — run the appropriate type checker:
|
|
- TS / TSX → `npx tsc --noEmit` (or read existing `tsconfig.json`)
|
|
- Flutter → `dart analyze`
|
|
Capture errors. List file:line + message. Severity: BLOCK if any.
|
|
|
|
3. **Lint** — run `npx eslint .` (or `dart analyze`, already covered). Capture errors and warnings separately. Severity: WARN.
|
|
|
|
4. **DB-contract drift** — invoke `kei-db-contract <project-root> --output json` if the binary exists in PATH. Parse JSON. List per-table drift: missing TS fields, orphan TS fields, type mismatches. Severity: ENFORCE if drift_count > 0 and project has DB; else N/A.
|
|
|
|
5. **Visual regression (optional)** — if `playwright.config.*` exists AND a baseline snapshot dir is set, invoke `npx playwright test --reporter=json` for visual tests. Severity: WARN if any pixel diff exceeds threshold.
|
|
|
|
6. **Verdict block** — summary table: each check, status (PASS / WARN / FAIL), brief evidence pointer.
|
|
|
|
You do NOT autofix. You do NOT spawn other agents. You do NOT commit. You report.
|
|
"""
|
|
|
|
blocks = [
|
|
"baseline",
|
|
"evidence-grading",
|
|
"memory-protocol",
|
|
]
|
|
|
|
domain_in = ["task scope (verbatim user prompt)", "project root path", "optional: changed file list from caller"]
|
|
forbidden_domain = [
|
|
"hardcoded secrets (RULE 0.8)",
|
|
"git operations (orchestrator owns commits per RULE 0.13)",
|
|
"infrastructure deploys (delegate to infra-implementer)",
|
|
]
|
|
output_extra_fields = ["Stack detected", "Type errors count", "Lint warnings count", "DB drift count", "Visual diff count"]
|
|
|
|
[[handoff]]
|
|
target = "code-implementer-typescript"
|
|
trigger = "TS type errors or lint failures need fixing"
|
|
|
|
[[handoff]]
|
|
target = "validator"
|
|
trigger = "general fact-check fallback"
|
|
|
|
[references]
|
|
extra = [
|
|
"~/.claude/rules/code-style.md",
|
|
"~/.claude/rules/karpathy-behavioral.md",
|
|
]
|
|
|
|
[taxonomy]
|
|
kingdom = "manifest"
|
|
mechanism = "compose"
|
|
domain = "agent"
|
|
layer = "agent-substrate"
|
|
stage = "design-time"
|
|
stability = "stable"
|
|
language = "toml"
|
|
|
|
[lineage]
|
|
creator = "ag-orchestrator-human"
|
|
created = "2026-05-01"
|