KeiSeiKit-1.0/_primitives/_rust/kei-leak-matrix/src/main.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

32 lines
1.3 KiB
Rust

//! kei-leak-matrix — binary entry. Dispatch only; logic lives in modules.
use anyhow::Result;
use clap::Parser;
use kei_leak_matrix::cli::{Cli, Cmd};
use kei_leak_matrix::matrix::{cmd_lint, cmd_list, default_matrix_path, Matrix};
use kei_leak_matrix::scanner::{cmd_scan_cmd, cmd_scan_file, cmd_scan_tree};
use kei_leak_matrix::substituter::cmd_substitute;
use std::process::ExitCode;
fn run() -> Result<i32> {
let cli = Cli::parse();
let path = cli.matrix.unwrap_or_else(default_matrix_path);
let matrix = Matrix::load(&path)?;
Ok(match cli.cmd {
Cmd::Scan { file, scope, severity } =>
cmd_scan_file(&matrix, &file, scope.into_matrix(), severity.map(|s| s.into_matrix()))?,
Cmd::ScanTree { dir, scope, severity } =>
cmd_scan_tree(&matrix, &dir, scope.into_matrix(), severity.map(|s| s.into_matrix()))?,
Cmd::Substitute { scope } => cmd_substitute(&matrix, scope.into_matrix())?,
Cmd::Lint { pattern } => cmd_lint(&matrix, &pattern),
Cmd::List { category } => cmd_list(&matrix, category.map(|c| c.into_matrix())),
Cmd::ScanCmd { cmd, scope } => cmd_scan_cmd(&matrix, &cmd, scope.into_matrix()),
})
}
fn main() -> ExitCode {
match run() {
Ok(code) => ExitCode::from(code as u8),
Err(e) => { eprintln!("kei-leak-matrix: {e:#}"); ExitCode::from(1) }
}
}