#!/usr/bin/env bash set -euo pipefail ROOT="$(cd "$(dirname "$0")/../.." && pwd)" VENDOR="$ROOT/.persistent-chat-v1.1/vendor/cochat-engine/3.3.34" node -e " const crypto=require('crypto'),fs=require('fs'),path=require('path'); const vendor=process.argv[1]; const im=JSON.parse(fs.readFileSync(path.join(vendor,'resources/integrity-manifest.json'),'utf8')); const hashes=JSON.parse(im.manifest).hashes; const map={ 'extension.js':'dist/extension.js','mcp-server.cjs':'resources/mcp-server.cjs', 'license-core.wasm':'resources/license-core.wasm','webview-js':'dist/webview/main.js', 'webview-css':'dist/webview/main.css','uninstall':'dist/uninstall.cjs', 'reset':'resources/reset-cursor-env.mjs','sqljs':'resources/sqljs/sql-wasm.js', 'skill-autopilot':'resources/skills/co-autopilot/SKILL.md', }; function sha(p){return crypto.createHash('sha256').update(fs.readFileSync(p)).digest('hex');} let ok=0,fail=0; for(const [k,rel] of Object.entries(map)){ const p=path.join(vendor,rel); if(!fs.existsSync(p)){console.log('MISSING',k);fail++;continue;} if(sha(p)===hashes[k]){console.log('OK',k);ok++;} else{console.log('FAIL',k);fail++;} } ['resources/sqljs/sql-wasm.wasm','resources/sqlite3/darwin-arm64/sqlite3','dist/reset-cursor-env.mjs'].forEach(r=>{ console.log(fs.existsSync(path.join(vendor,r))?'OK':'MISS',r); }); console.log('---',ok,'manifest ok',fail,'fail'); process.exit(fail?1:0); " "$VENDOR"