diff --git a/.github/workflows/validate-manifests.yml b/.github/workflows/validate-manifests.yml index d5a58f9..6b7e96f 100644 --- a/.github/workflows/validate-manifests.yml +++ b/.github/workflows/validate-manifests.yml @@ -25,30 +25,21 @@ jobs: import glob, hashlib, json, re, sys, urllib.request EMPTY_SHA256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - REQUIRED_KEYS = ("version", "description", "homepage", "license", "url", "hash") + BASE_KEYS = ("version", "description", "homepage", "license") errors = [] - for path in sorted(glob.glob("bucket/*.json")): - try: - manifest = json.load(open(path, encoding="utf-8")) - except Exception as exc: - errors.append(f"{path}: invalid JSON: {exc}") - continue - - missing = [k for k in REQUIRED_KEYS if not manifest.get(k)] - if missing: - errors.append(f"{path}: missing required keys: {missing}") - continue - - url = manifest["url"] - raw_hash = str(manifest["hash"]).strip() + def verify_target(path, ver, url, raw_hash, label=""): + raw_hash = str(raw_hash or "").strip() expected = raw_hash.removeprefix("sha256:").lower() + if not url: + errors.append(f"{path}{label}: missing url") + return if not re.fullmatch(r"[0-9a-f]{64}", expected): - errors.append(f"{path}: invalid SHA-256 hash '{raw_hash}'") - continue + errors.append(f"{path}{label}: invalid SHA-256 hash '{raw_hash}'") + return if expected == EMPTY_SHA256: - errors.append(f"{path}: placeholder empty-file SHA-256 detected") - continue + errors.append(f"{path}{label}: placeholder empty-file SHA-256 detected") + return req = urllib.request.Request(url, headers={"User-Agent": "RitualDev-Scoop-CI/1.0"}) try: @@ -56,11 +47,35 @@ jobs: data = resp.read() actual = hashlib.sha256(data).hexdigest() if actual != expected: - errors.append(f"{path}: SHA-256 mismatch for {url}\n expected: {expected}\n actual: {actual}") + errors.append(f"{path}{label}: SHA-256 mismatch for {url}\n expected: {expected}\n actual: {actual}") else: - print(f"OK {path} v{manifest['version']} ({len(data)} bytes) sha256={actual[:16]}...") + print(f"OK {path}{label} v{ver} ({len(data)} bytes) sha256={actual[:16]}...") except Exception as exc: - errors.append(f"{path}: failed fetching {url}: {exc}") + errors.append(f"{path}{label}: failed fetching {url}: {exc}") + + for path in sorted(glob.glob("bucket/*.json")): + try: + manifest = json.load(open(path, encoding="utf-8")) + except Exception as exc: + errors.append(f"{path}: invalid JSON: {exc}") + continue + + missing = [k for k in BASE_KEYS if not manifest.get(k)] + if missing: + errors.append(f"{path}: missing required keys: {missing}") + continue + + arch_map = manifest.get("architecture") + if isinstance(arch_map, dict) and arch_map: + for arch_name, arch_cfg in arch_map.items(): + if not isinstance(arch_cfg, dict) or not arch_cfg.get("url") or not arch_cfg.get("hash"): + errors.append(f"{path} [{arch_name}]: missing 'url' or 'hash'") + continue + verify_target(path, manifest["version"], arch_cfg["url"], arch_cfg["hash"], f" [{arch_name}]") + elif manifest.get("url") and manifest.get("hash"): + verify_target(path, manifest["version"], manifest["url"], manifest["hash"]) + else: + errors.append(f"{path}: missing required keys: ['url', 'hash'] (or 'architecture..url/hash')") if errors: print("\nFAILURES:\n" + "\n".join(errors), file=sys.stderr) diff --git a/bucket/poly.json b/bucket/poly.json index eb14b61..896e6d2 100644 --- a/bucket/poly.json +++ b/bucket/poly.json @@ -1,12 +1,12 @@ { - "version": "0.6.0", + "version": "0.6.2", "description": "The Universal Polyglot CLI Package & Dependency Orchestrator", "homepage": "https://poly.ritualdev.in", "license": "MIT", "architecture": { "64bit": { - "url": "https://github.com/RitualDev-Lab/poly/releases/download/v0.6.0/poly-windows-x64.zip", - "hash": "sha256:4b225fb330abde4821b381e82e5cc239d14478c47b84e410b572c928bfe976fe" + "url": "https://github.com/RitualDev-Lab/poly/releases/download/v0.6.2/poly-windows-x64.zip", + "hash": "sha256:f8f2be13337329d2eec9d5290f664fb0a19027466470936195ba3884e3bf732d" } }, "bin": "poly.exe", diff --git a/bucket/promptshield.json b/bucket/promptshield.json index b228623..891918d 100644 --- a/bucket/promptshield.json +++ b/bucket/promptshield.json @@ -6,7 +6,7 @@ "suggest": { "nodejs": "nodejs-lts" }, - "url": "https://github.com/RitualDev-Lab/PromptShield/releases/download/v0.1.0/ritualdev-promptshield-0.1.0.tgz", + "url": "https://github.com/RitualDev-Lab/PromptShield/releases/download/v0%2C1.1/ritualdev-promptshield-0.1.0.tgz", "hash": "sha256:8f0c3400825d6e006b6443f1ceabccfefdba834a2b7389ab6f290e159e88bfe5", "extract_dir": "package", "bin": [