evorule_cli/commands/replay.rs
1// SPDX-License-Identifier: AGPL-3.0-or-later
2// Copyright (C) 2026 EvoRule Project
3// This file is part of EvoRule, licensed under GNU Affero General Public License v3 or later.
4//! `evorule replay` —— 重放 fact log(pretty-print 每个 Fact)
5//!
6//! 读 fact.log(tier1 WAL JSONL 格式),用 `output::facts_to_human` 格式化输出。
7
8use std::path::Path;
9
10use crate::error::CliError;
11use crate::{fact_log, output};
12
13/// 执行 replay 子命令
14pub fn run(fact_log_path: &Path) -> Result<(), CliError> {
15 let facts = fact_log::read_facts(fact_log_path)?;
16
17 println!("=== Replaying {} ===", fact_log_path.display());
18 println!("{}", output::facts_to_human(&facts));
19 println!("=== End ({} facts) ===", facts.len());
20
21 Ok(())
22}