feat(ship): merge short-ship and long-ship into one entry
Promote ship to the user-facing delivery skill. Kind is short or long from an explicit mode, then self-judgment, then a question, defaulting to short. Old names remain deprecation stubs.
This commit is contained in:
@@ -232,6 +232,19 @@ def _ready_tasks(tasks: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
||||
return ready
|
||||
|
||||
|
||||
def infer_entry(entry: str | None, current: dict[str, Any] | None) -> str:
|
||||
if entry in {"short", "long", "pr"}:
|
||||
return entry
|
||||
if isinstance(current, dict):
|
||||
source = current.get("source") if isinstance(current.get("source"), dict) else {}
|
||||
if source.get("kind") == "pr":
|
||||
return "pr"
|
||||
kind = current.get("kind")
|
||||
if kind in {"short", "long"}:
|
||||
return kind
|
||||
return "short"
|
||||
|
||||
|
||||
def decide_next(ship_dir: Path, entry: str) -> dict[str, Any]:
|
||||
current_path = ship_dir / "current.yaml"
|
||||
if not current_path.is_file():
|
||||
@@ -629,13 +642,13 @@ def main() -> int:
|
||||
parser = argparse.ArgumentParser(description="计算 ship 的下一步")
|
||||
parser.add_argument("--project-root", required=True)
|
||||
parser.add_argument("--ship-id", required=True)
|
||||
parser.add_argument("--entry", choices=("short", "long", "pr"), required=True)
|
||||
parser.add_argument("--entry", choices=("short", "long", "pr"), default=None)
|
||||
args = parser.parse_args()
|
||||
ship_dir = Path(args.project_root).resolve() / ".pouch" / "ship" / args.ship_id
|
||||
if not ship_dir.is_dir():
|
||||
doc = _out(
|
||||
ship_id=args.ship_id,
|
||||
entry=args.entry,
|
||||
entry=infer_entry(args.entry, None),
|
||||
actor="manager",
|
||||
step="ensure_record",
|
||||
status="blocked",
|
||||
@@ -645,6 +658,7 @@ def main() -> int:
|
||||
sys.stdout.write("\n")
|
||||
return 0
|
||||
current = load_yaml(ship_dir / "current.yaml")
|
||||
entry = infer_entry(args.entry, current if isinstance(current, dict) else None)
|
||||
if isinstance(current, dict):
|
||||
manager = current.get("manager")
|
||||
if isinstance(manager, dict) and manager.get("lastStep") and manager.get("lastResult"):
|
||||
@@ -654,7 +668,7 @@ def main() -> int:
|
||||
status=str(manager.get("lastResult")),
|
||||
summary=str(manager.get("lastSummary") or ""),
|
||||
)
|
||||
doc = decide_next(ship_dir, args.entry)
|
||||
doc = decide_next(ship_dir, entry)
|
||||
ensure_stage_layout(ship_dir)
|
||||
record_stage_event(
|
||||
ship_dir,
|
||||
|
||||
Reference in New Issue
Block a user