← back to Gmc 425 Supplemental Feed
republish-channel-canary.mjs
31 lines
#!/usr/bin/env node
/** republish-channel-canary.mjs — GATED. Unpublish 5 SUPP_CANT_HELP products from Google & YouTube channel,
* wait for MC drop, then republish to force fresh full-variant resubmission.
* DO NOT RUN without Steve approval. */
import fs from 'node:fs';
const SHOPIFY_DOMAIN = 'designer-laboratory-sandbox.myshopify.com';
const TOKEN = process.env.SHOPIFY_ADMIN_TOKEN;
if (!TOKEN) { console.error('SHOPIFY_ADMIN_TOKEN required'); process.exit(1); }
// Google & YouTube publication ID (known)
const GOOGLE_PUB_ID = 'gid://shopify/Publication/65064968306'; // Google & YouTube channel
const rollback = JSON.parse(fs.readFileSync(process.env.HOME + '/.claude/yolo-queue/restore-maps/reorder-canary-rollback.jsonl'
.replace(/\n.*$/g,'').split('\n').map(l=>l).join('\n'))
.split('\n').filter(Boolean).map(l=>JSON.parse(l)));
// Canary: first 5
const canary = rollback.slice(0,5).map(r=>r.pid);
async function shopify(query, vars={}) {
const r = await fetch(`https://${SHOPIFY_DOMAIN}/admin/api/2024-10/graphql.json`, {
method:'POST', headers:{'X-Shopify-Access-Token':TOKEN,'Content-Type':'application/json'},
body: JSON.stringify({query, variables:vars})
});
return r.json();
}
console.log('DRY-RUN: would unpublish+republish these 5 SUPP_CANT_HELP pids:', canary);
console.log('Run with --apply to execute. GATED — needs Steve approval.');