From 4d2feb20f300d4eb74efd3a0d407cff163f93820 Mon Sep 17 00:00:00 2001 From: opoojkk <33021407+opoojkk@users.noreply.github.com> Date: Thu, 28 May 2026 18:59:37 +0800 Subject: [PATCH] Fix manifest timestamp consistency for overridden run timestamps --- skills/html-to-design-spec/scripts/create_run_dir.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/skills/html-to-design-spec/scripts/create_run_dir.py b/skills/html-to-design-spec/scripts/create_run_dir.py index 252bebebe..86fbe5658 100755 --- a/skills/html-to-design-spec/scripts/create_run_dir.py +++ b/skills/html-to-design-spec/scripts/create_run_dir.py @@ -18,6 +18,16 @@ def slugify(value: str) -> str: return value or "prototype" +def timestamp_to_iso(timestamp: str, local_timezone) -> str | None: + for fmt in ("%Y%m%d-%H%M%S", "%Y%m%d%H%M%S"): + try: + parsed = datetime.strptime(timestamp, fmt) + except ValueError: + continue + return parsed.replace(tzinfo=local_timezone).isoformat(timespec="seconds") + return None + + def main() -> int: parser = argparse.ArgumentParser() parser.add_argument("project_dir", help="Directory where the analysis result should be created.") @@ -36,7 +46,7 @@ def main() -> int: project_dir = Path(args.project_dir).expanduser().resolve() now = datetime.now().astimezone() timestamp = args.timestamp or now.strftime("%Y%m%d-%H%M%S") - created_at_iso = now.isoformat(timespec="seconds") + created_at_iso = timestamp_to_iso(timestamp, now.tzinfo) if args.timestamp else now.isoformat(timespec="seconds") base_name = args.name or (Path(args.target).name if args.target else project_dir.name) run_dir = project_dir / f"{slugify(base_name)}-{timestamp}"