[object Object]

← back to Corkwallcovering

cork: PROD tag-apply accepts BEFORE_PRODUCTS_JSON baseline (Scope B works on hosts lacking the enrich commit git history, e.g. Kamatera)

a663b22d72ee0468476324e79dc119ed4bebb489 · 2026-07-01 13:47:01 -0700 · Steve Abrams

Files touched

Diff

commit a663b22d72ee0468476324e79dc119ed4bebb489
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Wed Jul 1 13:47:01 2026 -0700

    cork: PROD tag-apply accepts BEFORE_PRODUCTS_JSON baseline (Scope B works on hosts lacking the enrich commit git history, e.g. Kamatera)
---
 scripts/apply-shopify-tags-PROD.mjs | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/scripts/apply-shopify-tags-PROD.mjs b/scripts/apply-shopify-tags-PROD.mjs
index 2213acc..d28e9b8 100644
--- a/scripts/apply-shopify-tags-PROD.mjs
+++ b/scripts/apply-shopify-tags-PROD.mjs
@@ -79,10 +79,16 @@ async function buildPlan() {
     for (const t of r.add_tags) { want(h, t, r.title); scopeA++; }
   }
 
-  // Scope B — Gemini-enriched style/pattern tags: diff products.json vs pre-enrich version
+  // Scope B — Gemini-enriched style/pattern tags: diff products.json vs pre-enrich version.
+  // Baseline source: BEFORE_PRODUCTS_JSON (a file containing the exact ee5ed29~1
+  // products.json) when set — needed on hosts (Kamatera) whose deployed repo lacks
+  // the enrich commit's git history; otherwise reconstruct it from git.
   let scopeB = 0;
   try {
-    const beforeRaw = execFileSync('git', ['show', `${ENRICH_COMMIT}~1:data/products.json`], { encoding: 'utf8', maxBuffer: 32 * 1024 * 1024 });
+    const beforeFile = process.env.BEFORE_PRODUCTS_JSON;
+    const beforeRaw = (beforeFile && existsSync(beforeFile))
+      ? await fs.readFile(beforeFile, 'utf8')
+      : execFileSync('git', ['show', `${ENRICH_COMMIT}~1:data/products.json`], { encoding: 'utf8', maxBuffer: 32 * 1024 * 1024 });
     const before = JSON.parse(beforeRaw);
     const beforeTags = new Map(before.map(p => [p.handle || p.sku, new Set((p.tags || []).map(String))]));
     for (const p of products) {

← 516be0a cork: untrack dev screenshots (~9MB), exclude .image-cache +  ·  back to Corkwallcovering  ·  auto-save: 2026-07-01T14:06:35 (3 files) — scripts/_cork-app bbf65d9 →