KeiSeiKit-1.0/_primitives/_rust/kei-refactor-engine/src/input.rs
Parfii-bot 0be354a920 KeiSeiKit-public — clean state
Single-commit clean baseline after security scrub of niche-tells,
project codenames, internal jargon, and contributor-email leaks.

Contents:
- 100 Rust crates (_primitives/_rust/)
- 37 agent manifests (_manifests/) + generated specs (_generated/)
- 67 user-invocable skills (skills/)
- 33 hooks (hooks/)
- Composition blocks (_blocks/)
- Documentation (docs/, README.md)
- TS adapter packages (_ts_packages/)
- Assembler (_assembler/)
- Roles (_roles/)
- Templates (_templates/)
- Forgejo CI (.forgejo/)

Author: Denis Parfionovich <info@greendragon.info>

License: see LICENSE.
2026-05-01 12:09:03 +08:00

41 lines
1.2 KiB
Rust

//! Conflict input schema (mirror of kei-conflict-scan output).
//!
//! Deserialized locally so this crate does not depend on kei-conflict-scan
//! as a library — the pipe is JSON, both sides speak the same contract.
use anyhow::{Context, Result};
use serde::Deserialize;
use std::fs;
use std::path::Path;
#[derive(Debug, Clone, Deserialize)]
pub struct Conflict {
pub category: String,
pub severity: String,
pub files: Vec<String>,
pub evidence: String,
pub suggested_fix: String,
pub auto_resolvable: bool,
}
#[derive(Debug, Deserialize)]
struct Wrapper {
#[serde(default)]
pub conflicts: Vec<Conflict>,
}
pub fn read_conflicts(path: &Path) -> Result<Vec<Conflict>> {
let bytes = fs::read(path).with_context(|| format!("read {}", path.display()))?;
let w: Wrapper = serde_json::from_slice(&bytes).context("parse JSON")?;
Ok(w.conflicts)
}
pub fn read_from_stdin() -> Result<Vec<Conflict>> {
use std::io::Read;
let mut buf = String::new();
std::io::stdin()
.read_to_string(&mut buf)
.context("read stdin")?;
let w: Wrapper = serde_json::from_str(&buf).context("parse JSON")?;
Ok(w.conflicts)
}