import http from 'http'; function req(m, p, b, t) { return new Promise((r, j) => { const o = http.request({ hostname: 'localhost', port: 3002, path: p, method: m, headers: { 'Content-Type': 'application/json', ...(t ? { Authorization: 'Bearer ' + t } : {}) } }, s => { let d = ''; s.on('data', c => d += c); s.on('end', () => { try { r({ status: s.statusCode, body: d }) } catch (e) { r({ status: 0, body: '' }) } }); }); o.on('error', j); if (b) o.end(JSON.stringify(b)); else o.end(); setTimeout(() => { o.destroy(); j(new Error('timeout')); }, 10000); }); } const t = JSON.parse((await req('POST', '/api/auth/login', { password: 'admin123' })).body).token; const p = JSON.parse((await req('POST', '/api/projects', { name: 'E2E验证', deadline: '2026-08-01' }, t)).body); const pid = p.id; console.log('1. 项目创建:', pid.slice(0, 8)); const md = '## 功能完整性(25分)\n要点\n## 设计文档(15分)\n要点\n## 代码质量(10分)\n要点\n## AGENTS.md(15分)\n要点\n## 样本数据(15分)\n要点\n## 测试用例(10分)\n要点\n## 演示录屏(10分)\n要点'; const std = JSON.parse((await req('POST', `/api/projects/${pid}/standards`, { name: 'L2标准', content: md }, t)).body); console.log('2. 标准创建:', std.dimensions.length, '维度'); const e1 = JSON.parse((await req('POST', `/api/projects/${pid}/entries`, { title: '张三-题01', repo_url: 'https://github.com/opencode-ai/opencode', participant: '张三', difficulty: '★★', category_tag: '赛道一' }, t)).body); const e2 = JSON.parse((await req('POST', `/api/projects/${pid}/entries`, { title: '张三-题05', repo_url: 'https://github.com/anthropics/anthropic-cookbook', participant: '张三', difficulty: '★★★★', category_tag: '赛道二' }, t)).body); console.log('3. 条目创建:', e1.title, 'pass:', e1.pass_line, '/', e2.title, 'pass:', e2.pass_line); const pj = JSON.parse((await req('GET', `/api/projects/${pid}`, null, t)).body); console.log('4. 项目详情:', pj.total, 'entries'); const list = JSON.parse((await req('GET', `/api/projects/${pid}/entries?limit=10`, null, t)).body); console.log('5. 条目列表:', list.total, '条'); const d = JSON.parse((await req('GET', `/api/projects/${pid}/entries/${e1.id}`, null, t)).body); console.log('6. 条目详情:', d.dimensions?.length, '维度'); const summary = JSON.parse((await req('GET', `/api/projects/${pid}/summary`, null, t)).body); console.log('7. 汇总:', summary.totalEntries, '条目,', summary.categories?.length, '分类'); console.log('\n✅ Phase 1-3 全链路验证通过');