[object Object]

← back to Wallco Ai

gen-luxe grounds on real Shopify SKUs by DW SKU prefix (grs-/lin-/sil-/crk-/mad-/raf-/mic-/nat-/sis-/jut-/sea-/aba-), not just title word; material label falls back to prefix

252689cd7db08ee36c8f70590f799e8e41a70972 · 2026-05-31 19:03:06 -0700 · Steve

Files touched

Diff

commit 252689cd7db08ee36c8f70590f799e8e41a70972
Author: Steve <steve@designerwallcoverings.com>
Date:   Sun May 31 19:03:06 2026 -0700

    gen-luxe grounds on real Shopify SKUs by DW SKU prefix (grs-/lin-/sil-/crk-/mad-/raf-/mic-/nat-/sis-/jut-/sea-/aba-), not just title word; material label falls back to prefix
---
 scripts/gen-luxe.js | 32 +++++++++++++++++++++++++++-----
 1 file changed, 27 insertions(+), 5 deletions(-)

diff --git a/scripts/gen-luxe.js b/scripts/gen-luxe.js
index 0ecd5c8..62b315b 100644
--- a/scripts/gen-luxe.js
+++ b/scripts/gen-luxe.js
@@ -114,14 +114,23 @@ function buildLuxePrompt(motif, attempt, textureBrief) {
 // Pull one ground texture from the unified /api/bg-textures pool (or
 // directly from PG if the server isn't reachable) — returns a short
 // natural-language brief the LLM can paint over.
+// Steve 2026-06-01: ground on REAL Shopify natural-texture SKUs, matched by the
+// authoritative DW SKU prefix (grs-=grasscloth, lin-=linen, sil-=silk, crk-/cork-=cork,
+// mad-=madagascar/raffia-cloth, raf-=raffia, mic-=mica, nat-=natural textile, sis-/jut-/sea-/aba-),
+// not just a fuzzy title word. Per-material prefix alternation used in the SKU regex.
+const SKU_PREFIX = {
+  grasscloth: 'grs|grass', linen: 'lin', silk: 'sil', cork: 'crk|cork',
+  raffia: 'raf|mad', madagascar: 'mad', mica: 'mic', natural: 'nat',
+  sisal: 'sis', jute: 'jut', seagrass: 'sea', abaca: 'aba',
+};
+const ALL_PREFIX = 'grs|grass|lin|sil|crk|cork|raf|mad|mic|nat|sis|jut|sea|aba';
 function pickTextureBrief(category) {
   const cat = (category || '').toLowerCase();
+  const pfx = SKU_PREFIX[cat] || '';
   const where = cat
-    ? `AND p.title ~* '\\m(${cat})\\M'`
-    // Steve 2026-06-01: always anchor on a REAL natural wallcovering texture.
-    // Added mica + other natural substrates DW actually sells (abaca, seagrass,
-    // jute, hemp, arrowroot, paperweave, bamboo, reed) alongside the originals.
-    : `AND p.title ~* '\\m(grasscloth|linen|silk|cork|raffia|mica|madagascar|sisal|abaca|seagrass|jute|hemp|arrowroot|paperweave|paper-weave|bamboo|reed)\\M'`;
+    ? `AND (p.title ~* '\\m(${cat})\\M'${pfx ? ` OR p.sku ~* '^(${pfx})[-_]'` : ''})`
+    // Default pool: any real natural texture, by title word OR DW SKU prefix.
+    : `AND (p.title ~* '\\m(grasscloth|linen|silk|cork|raffia|mica|madagascar|sisal|abaca|seagrass|jute|hemp|arrowroot|paperweave|paper-weave|bamboo|reed)\\M' OR p.sku ~* '^(${ALL_PREFIX})[-_]')`;
   const sql = `
     SELECT
       regexp_replace(split_part(p.title, '|', 1), '\\s+(Wallpaper|Wallcoverings?|Vinyl|-\\s*Sample)\\s*$', '', 'gi') AS name,
@@ -144,6 +153,19 @@ function pickTextureBrief(category) {
         WHEN p.title ~* '\\m(paperweave|paper-weave)\\M' THEN 'paperweave'
         WHEN p.title ~* '\\mbamboo\\M'     THEN 'bamboo'
         WHEN p.title ~* '\\mreed\\M'       THEN 'reed'
+        -- fall back to the DW SKU prefix when the title omits the material word
+        WHEN p.sku ~* '^(grs|grass)[-_]' THEN 'grasscloth'
+        WHEN p.sku ~* '^lin[-_]'  THEN 'linen'
+        WHEN p.sku ~* '^sil[-_]'  THEN 'silk'
+        WHEN p.sku ~* '^(crk|cork)[-_]' THEN 'cork'
+        WHEN p.sku ~* '^raf[-_]'  THEN 'raffia'
+        WHEN p.sku ~* '^mad[-_]'  THEN 'madagascar raffia cloth'
+        WHEN p.sku ~* '^mic[-_]'  THEN 'mica'
+        WHEN p.sku ~* '^nat[-_]'  THEN 'natural textile'
+        WHEN p.sku ~* '^sis[-_]'  THEN 'sisal'
+        WHEN p.sku ~* '^jut[-_]'  THEN 'jute'
+        WHEN p.sku ~* '^sea[-_]'  THEN 'seagrass'
+        WHEN p.sku ~* '^aba[-_]'  THEN 'abaca'
         ELSE 'natural textile'
       END AS material
     FROM shopify_products p

← 6804379 deploy: exclude prod-authored logs (cactus-decisions/ghost-s  ·  back to Wallco Ai  ·  pdp-theme: atomic write (temp+rename) so a crash mid-write c 2343a75 →