← back to Corkwallcovering
chore: lint + refactor enrich-cork-ai.mjs, correct 2.5-flash cost constant, v0.1.1 (session close)
2941458c9a72b340bd2988e8966d2703ac6554dd · 2026-07-01 10:39:58 -0700 · Steve Abrams
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Files touched
M package-lock.jsonM package.jsonM scripts/enrich-cork-ai.mjs
Diff
commit 2941458c9a72b340bd2988e8966d2703ac6554dd
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Wed Jul 1 10:39:58 2026 -0700
chore: lint + refactor enrich-cork-ai.mjs, correct 2.5-flash cost constant, v0.1.1 (session close)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
package-lock.json | 4 ++--
package.json | 2 +-
scripts/enrich-cork-ai.mjs | 13 +++++++------
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 411afb4..20862b4 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "corkwallcovering",
- "version": "0.1.0",
+ "version": "0.1.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "corkwallcovering",
- "version": "0.1.0",
+ "version": "0.1.1",
"dependencies": {
"dotenv": "^17.4.2",
"express": "^4.21.0",
diff --git a/package.json b/package.json
index 5569a67..90634e2 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "corkwallcovering",
- "version": "0.1.0",
+ "version": "0.1.1",
"description": "CORK WALLCOVERING — DW family vertical",
"main": "server.js",
"scripts": {
diff --git a/scripts/enrich-cork-ai.mjs b/scripts/enrich-cork-ai.mjs
index baaf73d..7f4723d 100644
--- a/scripts/enrich-cork-ai.mjs
+++ b/scripts/enrich-cork-ai.mjs
@@ -4,7 +4,7 @@
*
* Reads reports/cork-tag-diff.json to find the SKUs still missing a `style`
* and/or `pattern` facet (the ones the free/deterministic pass could NOT fill),
- * sends each product's image_url to Gemini 2.0 Flash vision, and adds the
+ * sends each product's image_url to Gemini 2.5 Flash vision, and adds the
* missing facet tag(s) — CONSTRAINED to the exact vocab in server.js /
* stage-shopify-tags.mjs — back into data/products.json.
*
@@ -16,7 +16,7 @@
* node scripts/enrich-cork-ai.mjs # apply to data/products.json
* node scripts/enrich-cork-ai.mjs --limit 5 --dry-run # first 5 only
*
- * Cost: Gemini 2.0 Flash ~$0.0006 / product image. GEMINI_API_KEY sourced from
+ * Cost: Gemini 2.5 Flash ~$0.0006 / product image. GEMINI_API_KEY sourced from
* the enrich-ai-tags skill .env (or process.env).
*/
import fs from 'node:fs/promises';
@@ -24,9 +24,10 @@ import path from 'node:path';
import os from 'node:os';
const DRY = process.argv.includes('--dry-run');
-const LIMIT = (() => { const i = process.argv.indexOf('--limit'); return i > -1 ? parseInt(process.argv[i + 1], 10) : Infinity; })();
-const PER_IMG_COST = 0.0006;
-const BUDGET = 1.00; // hard cap ($) — 31 imgs ≈ $0.02, so this never bites
+const limitIdx = process.argv.indexOf('--limit');
+const LIMIT = limitIdx > -1 ? parseInt(process.argv[limitIdx + 1], 10) : Infinity;
+const PER_IMG_COST = 0.0002; // Gemini 2.5 Flash vision: ~500 in-tok (image≈258 + prompt) × $0.30/1M ≈ $0.0002/img
+const BUDGET = 1.00; // hard cap ($) — 31 imgs ≈ $0.006, so this never bites
// vocab MIRRORS stage-shopify-tags.mjs / server.js — Gemini must pick from these only
const STYLE_VOCAB = ['Traditional','Contemporary','Modern','Coastal','Tropical','Art Deco','Mid-Century Modern','Bohemian','Transitional','Victorian','Chinoiserie','Minimalist','Maximalist','Rustic','Industrial','Scandinavian','Hollywood Regency','Japandi','Farmhouse'];
@@ -85,7 +86,7 @@ const diff = JSON.parse(await fs.readFile('reports/cork-tag-diff.json', 'utf8'))
const products = JSON.parse(await fs.readFile('data/products.json', 'utf8'));
const bySku = new Map(products.map(p => [p.sku, p]));
-const targets = diff.rows.filter(r => r.still_missing?.length).slice(0, LIMIT === Infinity ? undefined : LIMIT);
+const targets = diff.rows.filter(r => r.still_missing?.length).slice(0, LIMIT);
console.log(`Enriching ${targets.length} SKU(s) via Gemini 2.5 Flash${DRY ? ' [DRY-RUN]' : ''} — est $${(targets.length * PER_IMG_COST).toFixed(4)}`);
let spent = 0, changed = 0, failed = 0;
← 18c3446 cork: correct .deploy.conf to verified live path /var/www/co
·
back to Corkwallcovering
·
auto-save: 2026-07-01T11:11:52 (1 files) — scripts/apply-sho 7f71902 →