feat(ship): add stage audit trail and sortable ids

This commit is contained in:
2026-10-14 10:57:16 +08:00
parent 4814bc1026
commit 57879cffdd
10 changed files with 371 additions and 4 deletions
+20 -1
View File
@@ -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