[object Object]

← back to Designer Wallcoverings

TK-00134: fix documented cleanWallpaper snippet in CLAUDE.md to brand-aware

7ff04f87296b84a106f869e0400dfa8837c173c7 · 2026-07-27 18:41:58 -0700 · Steve Abrams

The canonical helper that gets copy-pasted into every updater was still the blanket
version in the docs — the source of the fleet-wide brand-name corruption. Replaced
with the brand-aware + derived-word-safe version (matches the 13 code copies), plus a
warning explaining the 17-brand hazard. Verified the doc snippet is copy-paste-correct.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit 7ff04f87296b84a106f869e0400dfa8837c173c7
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon Jul 27 18:41:58 2026 -0700

    TK-00134: fix documented cleanWallpaper snippet in CLAUDE.md to brand-aware
    
    The canonical helper that gets copy-pasted into every updater was still the blanket
    version in the docs — the source of the fleet-wide brand-name corruption. Replaced
    with the brand-aware + derived-word-safe version (matches the 13 code copies), plus a
    warning explaining the 17-brand hazard. Verified the doc snippet is copy-paste-correct.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
 CLAUDE.md | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/CLAUDE.md b/CLAUDE.md
index 810ee7c4..39ab209a 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -382,13 +382,26 @@ When updating ANY product data:
 - All other architectural vendors
 
 **Post-processing cleanup (MANDATORY in all updaters):**
+⚠️ MUST be **brand-aware** — 17 legitimate brand names END in "Wallpaper" (Ralph Lauren,
+Missoni, Grasscloth, Scalamandre, Schumacher, etc.) and a blanket `\bWallpaper\b` swap
+CORRUPTS them (e.g. "Ralph Lauren Wallpaper" → "Ralph Lauren Wallcovering"). It must also
+skip the derived words `wallpapered`/`wallpapering`. Use this version (TK-00134):
 ```javascript
 const cleanWallpaper = (str) => {
   if (!str) return str;
-  return str
-    .replace(/\bWallpaper\b/gi, 'Wallcovering')
-    .replace(/\bWalls Wallpaper\b/gi, 'Wallcoverings')
-    .replace(/\bWallpapers\b/gi, 'Wallcoverings');
+  // Preserve the 17 brands ending in "Wallpaper"; skip wallpapered/wallpapering; case-preserving.
+  const WALLPAPER_BRANDS = ['Apartment','Boråstapeter','China Seas','DW Exclusive','Edge','Fentucci','Grasscloth','Laura Ashley','Malibu','MC Escher','Missoni','Nicolette Mayer','PS Removable','Ralph Lauren','Roberto Cavalli','Scalamandre','Schumacher'];
+  const brandRe = new RegExp('(' + WALLPAPER_BRANDS.map(b => b.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|') + ')\\s+Wallpaper', 'gi');
+  const SENT = '', hold = [];
+  let out = String(str).replace(brandRe, m => { hold.push(m); return SENT + (hold.length - 1) + SENT; });
+  out = out.replace(/\bWallpaper(s?)\b(?!ed|ing)/gi, (m, plural) => {
+    const base = plural ? 'wallcoverings' : 'wallcovering';
+    if (m === m.toUpperCase()) return base.toUpperCase();
+    if (m[0] === m[0].toUpperCase()) return base[0].toUpperCase() + base.slice(1);
+    return base;
+  });
+  hold.forEach((h, i) => { out = out.split(SENT + i + SENT).join(h); });
+  return out;
 };
 ```
 

← 8661e2fa TK-00134: patch last 3 blanket cleanWallpaper() copies to br  ·  back to Designer Wallcoverings  ·  auto-save: 2026-07-27T18:53:10 (2 files) — shopify/scripts/d 97023338 →