improve review-plan preview output and docs
This commit is contained in:
@@ -10,6 +10,7 @@ import click
|
||||
from vlm.context import CLIContext
|
||||
from vlm.executor import ExecutionEngine
|
||||
from vlm.planner import load_plan
|
||||
from vlm.plan_render import preferred_plan_summary
|
||||
from vlm.state import StateManager
|
||||
|
||||
|
||||
@@ -58,7 +59,10 @@ def execute_cmd(
|
||||
|
||||
if safe_mode:
|
||||
click.echo("Safe mode enabled - validating plan for directory preservation...")
|
||||
emptied_dirs = execution_plan.metadata.get("emptied_directories", [])
|
||||
validation_snapshot = execution_plan.metadata.get("validation_snapshot", {})
|
||||
if not isinstance(validation_snapshot, dict):
|
||||
validation_snapshot = {}
|
||||
emptied_dirs = validation_snapshot.get("emptied_directories", execution_plan.metadata.get("emptied_directories", []))
|
||||
if emptied_dirs:
|
||||
raise ValueError(
|
||||
"SAFE MODE VIOLATION: plan would empty directories. "
|
||||
@@ -82,22 +86,10 @@ def execute_cmd(
|
||||
click.echo(f"Created at: {execution_plan.created_at}")
|
||||
click.echo(f"Total operations: {len(execution_plan.operations)}")
|
||||
|
||||
if execution_plan.human_summary:
|
||||
plan_summary = preferred_plan_summary(execution_plan)
|
||||
if plan_summary:
|
||||
click.echo()
|
||||
click.echo(execution_plan.human_summary)
|
||||
elif execution_plan.summary or execution_plan.summary_by_reason:
|
||||
s = execution_plan.summary or {}
|
||||
by_r = execution_plan.summary_by_reason or {}
|
||||
parts = [
|
||||
"操作统计:共 "
|
||||
f"{s.get('total', len(execution_plan.operations))} 条"
|
||||
f"(move {s.get('move', 0)},rename {s.get('rename', 0)},"
|
||||
f"quarantine {s.get('quarantine', 0)},no-op {s.get('no-op', 0)})"
|
||||
]
|
||||
if by_r:
|
||||
parts.append("原因分布:" + ";".join(f"{r}: {c}" for r, c in list(by_r.items())[:5]))
|
||||
click.echo()
|
||||
click.echo("\n".join(parts))
|
||||
click.echo(plan_summary)
|
||||
click.echo()
|
||||
|
||||
if mode == "dry-run":
|
||||
|
||||
Reference in New Issue
Block a user