Files
Omair Saleh 056c47581f feat: editorial review dashboard + elite-grade pilot batch (5 SKUs)
Ships the second dashboard surface — a Pattern Library + Preview Theatre — that
presents the 4-section PDP pilot batch back to Umar, compliance, and the board
in an editorial format. Adds the full data layer that drives it: 5 source-backed
per-SKU drafts at QA 100/100, 15 competitor PDP semantic extracts, PubMed
evidence packs, EFSA claims library extension, JV brand voice guide, hand-curated
product FAQs, and the Matrixify-ready CSV exports for Lewis.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-02 18:50:09 +08:00

45 lines
2.0 KiB
TypeScript

#!/usr/bin/env bun
import { intelPath, listProducts, readPilotDoc, sourcePath, listJson, sourceStatus, writeJson, now } from './lib/intel-utils'
const rawFiles = listJson(sourcePath('reddit'))
writeJson(sourcePath('reddit-status.json'), {
generatedAt: now(),
sourceType: 'reddit_import_status',
status: rawFiles.length ? 'available' : 'missing',
files: rawFiles,
note: rawFiles.length ? 'Reddit source drops detected.' : 'Place Reddit thread/comment JSON exports in data/sources/reddit/. No synthetic Reddit evidence generated.'
})
console.log(`Reddit source files: ${rawFiles.length}`)
for (const product of listProducts()) {
const sku = product.sku
const { aspects, blockers } = readPilotDoc(sku)
const seededBenefits = product.metafields?.pdpProductBenefits || []
const pulses = (blockers.blockers || []).length
? blockers.blockers.slice(0, 7).map((item: any) => ({
rank: item.rank,
topic: item.blocker,
whyItMatters: item.fix,
expectedSubreddits: sku.includes('TURMERIC') ? ['r/Supplements', 'r/Biohackers', 'r/Arthritis'] : ['r/Supplements', 'r/VitaminD', 'r/Nutrition'],
status: rawFiles.length ? 'ready_for_extraction' : 'needs_reddit_ingestion'
}))
: seededBenefits.slice(0, 7).map((benefit: string, index: number) => ({
rank: index + 1,
topic: benefit,
whyItMatters: 'Seeded from product content; validate against deeper social listening before using as market-wide language.',
expectedSubreddits: ['r/Supplements', 'r/Nutrition'],
status: rawFiles.length ? 'source_seed_available_needs_sku_validation' : 'needs_reddit_ingestion'
}))
writeJson(intelPath(sku, 'reddit-pulse.json'), {
sku,
name: aspects.name || product.name || sku,
generatedAt: now(),
generatedBy: 'scrape-reddit.ts/import-normalizer',
n: rawFiles.length,
sourceStatus: { reddit: sourceStatus('reddit') },
coverage: rawFiles.length ? 'catalogue_queue_seeded_from_limited_source_drop' : 'missing_source_drop',
pulses
})
console.log(`${sku}: refreshed Reddit pulse queue`)
}