feat(ship): add stage audit trail and sortable ids
This commit is contained in:
@@ -10,7 +10,7 @@ import sys
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from ship_lib import load_yaml
|
||||
from ship_lib import ensure_stage_layout, load_yaml, record_stage_event, stage_for_step
|
||||
|
||||
SPEC_PLACEHOLDERS = (
|
||||
"<用户可见的目标",
|
||||
@@ -70,6 +70,7 @@ def _out(
|
||||
"stopAt": stop_at,
|
||||
"readyTaskIds": ready_task_ids or [],
|
||||
"summary": summary,
|
||||
"stage": (stage_for_step(step) or (None, None))[0],
|
||||
}
|
||||
|
||||
|
||||
@@ -635,7 +636,25 @@ def main() -> int:
|
||||
json.dump(doc, sys.stdout, ensure_ascii=False, indent=2)
|
||||
sys.stdout.write("\n")
|
||||
return 0
|
||||
current = load_yaml(ship_dir / "current.yaml")
|
||||
if isinstance(current, dict):
|
||||
manager = current.get("manager")
|
||||
if isinstance(manager, dict) and manager.get("lastStep") and manager.get("lastResult"):
|
||||
record_stage_event(
|
||||
ship_dir,
|
||||
step=str(manager.get("lastStep")),
|
||||
status=str(manager.get("lastResult")),
|
||||
summary=str(manager.get("lastSummary") or ""),
|
||||
)
|
||||
doc = decide_next(ship_dir, args.entry)
|
||||
ensure_stage_layout(ship_dir)
|
||||
record_stage_event(
|
||||
ship_dir,
|
||||
step=str(doc.get("step") or ""),
|
||||
status=str(doc.get("status") or "ready"),
|
||||
summary=str(doc.get("summary") or ""),
|
||||
task_id=doc.get("taskId"),
|
||||
)
|
||||
json.dump(doc, sys.stdout, ensure_ascii=False, indent=2)
|
||||
sys.stdout.write("\n")
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user