Files
troupe-standup/wizard-work/sol/_probe_untracked_state.py

58 lines
1.7 KiB
Python

#!/usr/bin/env python3
"""Probe current untracked state for sol-lane untracked triage."""
import hashlib
import json
import subprocess
import sys
REPO = "/root/troupe-standup"
def git_status():
proc = subprocess.run(
["git", "-C", REPO, "status", "--porcelain=v1"],
check=True, capture_output=True, text=True,
)
return proc.stdout
def main():
out = git_status()
untracked_dir = []
untracked_file = []
for line in out.splitlines():
if line.startswith("??"):
p = line[3:].strip()
if p.endswith("/"):
untracked_dir.append(p)
elif p.startswith("wizard-work/sol/"):
pass
else:
untracked_file.append(p)
untracked_file = sorted(untracked_file)
print("UNTRACKED_DIRS:")
for p in untracked_dir:
print(" ", p)
print("UNTRACKED_FILES:", len(untracked_file))
for p in untracked_file:
print(" ", p)
# manifest recorded set
try:
man = json.load(open(REPO + "/wizard-work/sol/Untracked-Triad-2026-11-02.json"))
rec = sorted(man["files"])
print("MANIFEST_FILES:", len(rec))
cur = set(untracked_file)
recset = set(rec)
print("MANIFEST==CUR? ", cur == recset)
print("IN CUR NOT MANIFEST:", sorted(cur - recset))
print("IN MANIFEST NOT CUR:", sorted(recset - cur))
canon = json.dumps({"files": rec}, sort_keys=True, separators=(",", ":")).encode()
print("MANIFEST corpus_sha256:", hashlib.sha256(canon).hexdigest())
except Exception as e:
print("manifest read error:", e)
return 0
if __name__ == "__main__":
sys.exit(main())