Files
dacli/src/commands/integration/emailtest.ts
T
sswandClaude 07efd25528 feat: 规范化dacli命令结构 (1/2/3级无短横线) + tdca 7 阶段端到端
- 命令规范化: 13 个违规子命令重命名 (switch-app→switchapp, fix-columndata→fixcolumndata, type-list→typelist, data-list→datalist, email-test→emailtest, sms-test→smstest, webhook-test→webhooktest, reset-pwd→resetpwd, notice-list→noticelist, notice-send→noticesend, notice-create→noticecreate, template-list→templatelist, template-create→templatecreate)
- 旧名保留为 alias 向后兼容
- help.ts 拦截器也认 alias
- tdca app (可信数据空间增强C版) 端到端: 5 form (tdcaDept/Employee/Salary/Leave/Performance) state=2 + 6 业务表 + 8 菜单 (5 form + 3 spa) + 3 no-spa-page 扩展页 (hr-dashboard/attendance/help)
- Playwright 8/8 端到端测试 PASS (state 验证 + 物理表字段 + 菜单 + 浏览器渲染 + CRUD 链路)
- 实战发现新盲点 30/31/32/33 (JNPF 6.2 OnlineDev 端点 + List bug + Create 不返 id + 跨应用 clone release 失败) 已写入 troubleshooting.md
- tsc 0 错 + 103/103 单测全过 + 8/8 e2e 全过

Co-Authored-By: Claude <[email protected]>
2026-06-14 11:19:10 +08:00

47 lines
1.6 KiB
TypeScript

/**
* commands/integration/emailtest.ts — 邮件测试发送
*
* 走 JNPF SendMessageConfig/testSendConfig 端点
*/
import { Command } from 'commander'
import { JnpfClient } from '../../core/client.ts'
import { installAiHelpHook } from '../../core/help.ts'
import { log } from '../../core/log.ts'
interface EmailTestOpts {
configId: string
email?: string
}
export function buildIntegrationEmailTestCommand(): Command {
const cmd = new Command('emailTest')
.alias('email-test')
.description('邮件测试发送 (走 SendMessageConfig/testSendConfig)')
.requiredOption('--configId <id>', '发送配置 id')
.option('--email <e>', '目标邮箱')
.action(async (opts: EmailTestOpts) => {
const c = await JnpfClient.fromToken()
const r = await c.postJson('/message/SendMessageConfig/testSendConfig', {
id: opts.configId,
email: opts.email,
})
if (r.code !== 200) {
log.error(`integration emailtest 失败: ${r.msg}`)
process.exit(1)
}
log.info(`✓ 邮件测试发送 OK (configId=${opts.configId})`)
})
installAiHelpHook(cmd, {
purpose: '邮件测试发送 (决策 8: 邮件通道)',
required: { '--configId': '发送配置 id' },
optional: { '--email': '目标邮箱' },
example: 'dacli integration emailtest --configId=123 [email protected]',
source: {
web: 'web/apps/jnpf-web-apps-main/src/views/integrationCenter/email/index.vue',
api: 'POST /api/message/SendMessageConfig/testSendConfig',
ref: 'doc/v0.8-endpoints.md §3.3',
},
})
return cmd
}