Files
onion-mc/analysis/audit/fetch.py
T
logan 611a1a5952 docs: client-perf analysis, bench harness and work journal
Everything the next agent needs to run the Phase 2 optimisation loop on a
machine that can launch the client:

- analysis/client-perf/: LEVERS (ranked levers + corrections), BENCH-MATRIX
  (world, scenes, config IDs, blocks B0-B14 with decision rules),
  PLAYER-TUNING, SPAWN-TUNING, research briefs, the jar scanner and its
  output, observed default configs, and proposed-configs/ (build.py
  generates tiers and bench variants and fails on unknown keys;
  apply_variant.py applies a variant and merges options.txt).
- analysis/client-perf/bench/onion-bench/: bench-world datapack (scene
  teleports, Create grid, mob pen, sound storm, 120 s teleport tour).
- analysis/audit/: the static recipe/dependency audit, including gen_fixes.py,
  which generates the shipped Paxi datapack and was never tracked.
- phase0/: per-machine measurement harness (Steam Deck, 7700K/1060,
  6700K/1080 Ti).
- .pi/journal.md: running work log; read it first.

All of it is packwizignored, so nothing here ships to players.
2026-10-14 18:15:32 -04:00

22 lines
1.1 KiB
Python

import tomllib, hashlib, os, glob, shutil, urllib.request, concurrent.futures as cf
P="/home/logan/Development/onion-mc/mods"
srcs=[os.path.expanduser("~/.local/share/PrismLauncher/instances/Onion MC/minecraft/mods"),"/tmp/fd/jars"]
def h(p): return hashlib.new
def one(f):
t=tomllib.load(open(f,"rb")); fn=t["filename"]; d=t["download"]; out=f"jars/{fn}"
def ok(p):
hh=hashlib.new(d["hash-format"]); hh.update(open(p,"rb").read()); return hh.hexdigest()==d["hash"]
if os.path.exists(out) and ok(out): return fn,"cached"
for s in srcs:
p=os.path.join(s,fn)
if os.path.exists(p) and ok(p): shutil.copy(p,out); return fn,"local"
url=d.get("url")
if not url: return fn,"NOURL "+str(t.get("update"))
req=urllib.request.Request(url.replace(" ","%20"),headers={"User-Agent":"onion-mc-audit"})
open(out,"wb").write(urllib.request.urlopen(req,timeout=120).read())
return fn,"dl" if ok(out) else "BADHASH"
with cf.ThreadPoolExecutor(8) as ex:
for fn,s in ex.map(one,sorted(glob.glob(P+"/*.pw.toml"))):
if s not in("cached","local","dl"): print(s,fn)
print(len(os.listdir("jars")))