artifact_hash.py python
26 lines 702 B
Raw
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 1 day ago
1 """Parse ``ARTIFACT_SHA256`` from verify script stdout (§K9.5)."""
2
3 from __future__ import annotations
4
5 import re
6
7 _SHA_LINE = re.compile(r"^ARTIFACT_SHA256=([0-9a-fA-F]+)$")
8
9
10 def parse_artifact_sha256(stdout: bytes) -> str | None:
11 """Decode stdout, strip trailing newlines, parse last line for artifact hash."""
12 try:
13 text = stdout.decode("utf-8")
14 except UnicodeDecodeError:
15 return None
16 stripped = text.rstrip("\n\r")
17 if not stripped:
18 return None
19 if "\n" in stripped:
20 line = stripped.rsplit("\n", 1)[-1]
21 else:
22 line = stripped
23 match = _SHA_LINE.match(line)
24 if not match:
25 return None
26 return match.group(1).lower()
File History 2 commits
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 1 day ago
sha256:4671b7f787ddbe63ced31c895b688c77ab495653b65a730b423329f26b3c1439 feat: K1-P1 complete — agent provenance, build-verification… Sonnet 4.6 patch 53 days ago