mirror of
https://github.com/seanbetts/steam-hardware-watch.git
synced 2026-10-06 04:04:22 +02:00
Initial commit
This commit is contained in:
commit
fbb8c3da72
24 files changed
+2476
No files matched your search
Executable
+160
@@ -0,0 +1,160 @@
|
||||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
MAX_LINE_LEN = 220
|
||||
FILTER_TERMS = (
|
||||
"controller",
|
||||
"machine",
|
||||
"frame",
|
||||
"triton",
|
||||
"puck",
|
||||
"ibex",
|
||||
"unboxing",
|
||||
"coming",
|
||||
"2026",
|
||||
"pair",
|
||||
"firmware",
|
||||
)
|
||||
REJECT_TERMS = (
|
||||
"application_config",
|
||||
"data-config",
|
||||
""",
|
||||
"localized_",
|
||||
)
|
||||
|
||||
|
||||
def read_lines(path: Path):
|
||||
if not path.exists():
|
||||
return []
|
||||
return [line.rstrip("\n") for line in path.read_text(encoding="utf-8", errors="ignore").splitlines() if line.strip()]
|
||||
|
||||
|
||||
def count(path: Path):
|
||||
return len(read_lines(path))
|
||||
|
||||
|
||||
def first(path: Path, n: int):
|
||||
return read_lines(path)[:n]
|
||||
|
||||
|
||||
def concise(line: str):
|
||||
trimmed = " ".join(line.split())
|
||||
if len(trimmed) > MAX_LINE_LEN:
|
||||
return trimmed[: MAX_LINE_LEN - 3] + "..."
|
||||
return trimmed
|
||||
|
||||
|
||||
def filtered_first(path: Path, n: int):
|
||||
selected = []
|
||||
for line in read_lines(path):
|
||||
lowered = line.lower()
|
||||
if any(term in lowered for term in REJECT_TERMS):
|
||||
continue
|
||||
if path.name == "valve-key-lines.txt" and not any(term in lowered for term in FILTER_TERMS):
|
||||
continue
|
||||
selected.append(concise(line))
|
||||
if len(selected) >= n:
|
||||
break
|
||||
return selected
|
||||
|
||||
|
||||
def blocked_asset_urls(path: Path, n: int):
|
||||
urls = []
|
||||
if not path.exists():
|
||||
return urls
|
||||
for line in read_lines(path):
|
||||
parts = line.split("\t")
|
||||
if len(parts) > 4 and parts[4].startswith("http"):
|
||||
urls.append(parts[4])
|
||||
if len(urls) >= n:
|
||||
break
|
||||
return urls
|
||||
|
||||
|
||||
def count_block_reason(path: Path, reason: str):
|
||||
total = 0
|
||||
if not path.exists():
|
||||
return total
|
||||
for line in read_lines(path):
|
||||
parts = line.split("\t")
|
||||
if parts and parts[0] == reason:
|
||||
total += 1
|
||||
return total
|
||||
|
||||
|
||||
def build(run_dir: Path):
|
||||
reports = run_dir / "reports"
|
||||
compare = sorted(reports.glob("compare-vs-*.md"))
|
||||
compare_file = compare[-1] if compare else None
|
||||
|
||||
discovered = count(reports / "discovered-visual-assets.tsv")
|
||||
retrieved = count(reports / "retrieved-visual-assets.tsv")
|
||||
blocked = count(reports / "blocked-visual-assets.tsv")
|
||||
session_required = count_block_reason(reports / "blocked-visual-assets.tsv", "session_required")
|
||||
|
||||
lines = [
|
||||
f"# Run Summary: {run_dir.name}",
|
||||
"",
|
||||
f"Artifacts: `{run_dir}`",
|
||||
"",
|
||||
"## At A Glance",
|
||||
"",
|
||||
f"- Komodo blocked: `{'yes' if count(reports / 'komodo-errors.txt') else 'no'}`",
|
||||
f"- SteamDB blocked: `{'yes' if count(reports / 'steamdb-errors.txt') else 'no'}`",
|
||||
f"- Valve blocked: `{'yes' if count(reports / 'valve-errors.txt') else 'no'}`",
|
||||
f"- Discovered visual assets: `{discovered}`",
|
||||
f"- Retrieved visual assets: `{retrieved}`",
|
||||
f"- Blocked visual assets: `{blocked}`",
|
||||
f"- Blocked assets requiring trusted session: `{session_required}`",
|
||||
"",
|
||||
"## Most Relevant Outputs",
|
||||
"",
|
||||
f"- Status draft: `{reports / 'status-draft.md'}`",
|
||||
f"- Discovered assets: `{reports / 'discovered-visual-assets.tsv'}`",
|
||||
f"- Retrieved assets: `{reports / 'retrieved-visual-assets.tsv'}`",
|
||||
f"- Blocked assets: `{reports / 'blocked-visual-assets.tsv'}`",
|
||||
f"- Manual retry URLs: `{reports / 'manual-asset-urls.txt'}`",
|
||||
]
|
||||
|
||||
if compare_file:
|
||||
lines.append(f"- Comparison report: `{compare_file}`")
|
||||
|
||||
lines.extend(["", "## Notable Lines", ""])
|
||||
|
||||
notable = []
|
||||
notable.extend([f"- SteamDB: `{line}`" for line in filtered_first(reports / "steamdb-key-lines.txt", 5)])
|
||||
notable.extend([f"- SteamTracking: `{line}`" for line in filtered_first(reports / "steamtracking-pairing-focus.txt", 5)])
|
||||
notable.extend([f"- Valve: `{line}`" for line in filtered_first(reports / "valve-key-lines.txt", 5)])
|
||||
notable.extend([f"- Asset blocked: `{line}`" for line in filtered_first(reports / "blocked-visual-assets.tsv", 5)])
|
||||
|
||||
if notable:
|
||||
lines.extend(notable)
|
||||
else:
|
||||
lines.append("- No notable lines were extracted.")
|
||||
|
||||
manual_urls = blocked_asset_urls(reports / "blocked-visual-assets.tsv", 10)
|
||||
lines.extend(["", "## Manual Follow-Up URLs", ""])
|
||||
if manual_urls:
|
||||
lines.extend([f"- `{url}`" for url in manual_urls])
|
||||
else:
|
||||
lines.append("- No blocked asset URLs were recorded in this run.")
|
||||
|
||||
lines.extend(["", "## Next Human Step", "", "- Review this summary first, then open the detailed reports only if something changed or looks important.", ""])
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Write a concise human-readable run summary.")
|
||||
parser.add_argument("--run-dir", required=True)
|
||||
parser.add_argument("--output", help="Optional output path")
|
||||
args = parser.parse_args()
|
||||
|
||||
run_dir = Path(args.run_dir)
|
||||
output = Path(args.output) if args.output else run_dir / "reports" / "run-summary.md"
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text(build(run_dir), encoding="utf-8")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user