/** Capture a fresh baseline and a bounded, topic-driven discovery plan. */ import fs from 'node:fs'; import {read,publicApi,save} from './lib/research-enrichment.mjs'; const work='work/five-topic-research-20261111';fs.mkdirSync(work,{recursive:true}); const old=JSON.parse(fs.readFileSync('work/five-topic-collection-20261110/collection-plan.json','utf8')); const topics=old.topics; const searches={wellness:['药食同源 方便面','菌菇 非油炸 方便面'],student:['宿舍 开水即食 拌面','夜宵 小份 方便面'], premium:['真肉 高汤 方便面','冻干 方便面'],stockpile:['方便面 多口味 整箱','非油炸 方便面 家庭装'],novelty:['香菜 方便面 新品','冬阴功 拌面']}; const plan={schema:'ksf.five-topic.multisource.v1',topics,scope:old.scope,jobs:topics.flatMap(t=>searches[t.id].map(keyword=>({topic:t.id,platform:'jd',endpoint:'jd.search_item_list_v1',params:{keyword,page:'1'}}))), evidenceTypes:['ecommerce_product','ecommerce_review','industry_reporting','community_experience','official_policy','ingredient_process_reference'], rules:['题材相关且有实际正文或商品事实;不采娱乐/邮费/饮料','中式食材不等于健康功效,高端产品不证明购买者收入','保留时间、参数、原件和SHA,按实体类型分开统计']}; save(work+'/collection-plan.json',plan); const contract=await read('contract');save(work+'/contract-before.json',contract); save(work+'/summary-before.json',await publicApi({op:'summary',generation:contract.generation})); for(const entity of ['documents','social']){ if(entity==='documents')save(work+'/documents-before.json',await publicApi({op:'browse',entity,quality:'audit',limit:100,generation:contract.generation})); } console.log(JSON.stringify({ok:true,generation:contract.generation,counts:contract.counts,jobs:plan.jobs.length}));