| 123456789101112131415161718192021 |
- import fs from 'node:fs';
- import path from 'node:path';
- import { checkPackage } from '../install.js';
- import { resultEnvelope } from '../mcp/src/core/result-envelope.mjs';
- import { buildImageSetPlan, verifyPlan } from '../mcp/src/features/planning/planner.mjs';
- const root = path.resolve(import.meta.dirname, '..');
- const checked = checkPackage(root);
- if (!checked.ok) throw new Error(`Package check failed: ${checked.errors.join(', ')}`);
- const envelope = resultEnvelope({ status: 'ok', assistantMessage: 'smoke' });
- for (const key of ['status','assistantMessage','summary','data','files','nextActions','warnings','errors']) {
- if (!(key in envelope)) throw new Error(`Missing envelope field: ${key}`);
- }
- const plan = buildImageSetPlan({ request: '规划七张商品套图', productDescription: '测试商品' });
- verifyPlan(plan);
- if (plan.items.length !== 7 || plan.requiresConfirmation !== true) throw new Error('Planning smoke failed.');
- for (const locale of ['zh', 'en']) {
- const directory = path.join(root, 'mcp', 'catalog', 'templates', locale);
- if (fs.readdirSync(directory).filter(name => name.endsWith('.json')).length !== 25) throw new Error(`${locale} template count mismatch`);
- }
- console.log(JSON.stringify({ status: 'ok', check: checked, planId: plan.planId, templates: 50 }, null, 2));
|