KeiSeiKit-1.0/_primitives/_rust/kei-artifact/src/schemas.rs
Parfii-bot 537589e6a7 feat(primitives): kei-artifact typed handoff pipeline (BMAD-style doc passthrough)
- kei-artifact Rust crate (25th): schema registry + artifact store + SHA-256 id + chain walker
- 5 schemas (JSON Schema 2020-12 strict): spec / plan / patch / review / research
- Manifest extension: optional produces_artifact + expects_artifact per handoff (non-breaking)
- Validator extension: KNOWN_ARTIFACT_SCHEMAS whitelist check + 4 new tests
- 3 kei-* manifests updated with typed handoff (architect→code-implementer→critic chain)
- compose-solution phase-5 cross-ref to kei-artifact

Tests: 189 Rust workspace (was 167, +22 artifact tests) + 24 assembler (was 20, +4 validator tests)
2026-04-22 14:10:08 +08:00

27 lines
1 KiB
Rust

//! Built-in schemas — 5 shipped schemas, embedded at compile time.
//!
//! Chain: architect(spec) → code-implementer(plan → patch) →
//! critic/security(review) → researcher(research) feeds back.
//! Each file lives in `kei-artifact/schemas/*.json` and is embedded via
//! `include_str!` so the CLI `--self-register` path needs no filesystem.
use crate::artifact::register_schema;
use crate::store::Store;
use anyhow::Result;
/// (name, schema JSON text). Keep in sync with `schemas/*.json`.
pub const BUILTIN: &[(&str, &str)] = &[
("spec", include_str!("../schemas/spec.json")),
("plan", include_str!("../schemas/plan.json")),
("patch", include_str!("../schemas/patch.json")),
("review", include_str!("../schemas/review.json")),
("research", include_str!("../schemas/research.json")),
];
/// Register all 5 built-in schemas. Idempotent.
pub fn register_builtins(store: &Store) -> Result<()> {
for (name, text) in BUILTIN {
register_schema(store, name, text)?;
}
Ok(())
}