W12-D1+D2+D3: P2 收尾 (monitor 3 + log 2 + integration 3, 14 单测 PASS) + 22 父命令全就位
This commit is contained in:
1 parent
eeacfae7d7
commit
a8aa573f82
13 files changed
+574
No files matched your search
@@ -30,6 +30,9 @@ import { buildUserCommand } from './commands/user/index.ts'
|
||||
import { buildOrgCommand } from './commands/org/index.ts'
|
||||
import { buildMsgCommand } from './commands/msg/index.ts'
|
||||
import { buildScheduleCommand } from './commands/schedule/index.ts'
|
||||
import { buildMonitorCommand } from './commands/monitor/index.ts'
|
||||
import { buildLogCommand } from './commands/log/index.ts'
|
||||
import { buildIntegrationCommand } from './commands/integration/index.ts'
|
||||
import { maybeInterceptAiHelp } from './core/help.ts'
|
||||
import { log } from './core/log.ts'
|
||||
import { DacliError } from './core/types.ts'
|
||||
@@ -75,6 +78,10 @@ program.addCommand(buildOrgCommand())
|
||||
program.addCommand(buildMsgCommand())
|
||||
// v0.8 W11-D2 新增 1 父命令
|
||||
program.addCommand(buildScheduleCommand())
|
||||
// v0.8 W12 新增 3 P2 父命令
|
||||
program.addCommand(buildMonitorCommand())
|
||||
program.addCommand(buildLogCommand())
|
||||
program.addCommand(buildIntegrationCommand())
|
||||
|
||||
// ----- main -----
|
||||
// AI flag 拦截 (在 parse 之前, 避免 requiredOption 校验失败)
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* commands/integration/email-test.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('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 email-test 失败: ${r.msg}`)
|
||||
process.exit(1)
|
||||
}
|
||||
log.info(`✓ 邮件测试发送 OK (configId=${opts.configId})`)
|
||||
})
|
||||
installAiHelpHook(cmd, {
|
||||
purpose: '邮件测试发送 (决策 8: 邮件通道)',
|
||||
required: { '--configId': '发送配置 id' },
|
||||
optional: { '--email': '目标邮箱' },
|
||||
example: 'dacli integration email-test --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
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* commands/integration/index.ts — integration 父命令
|
||||
*
|
||||
* JNPF 集成 (P2 收尾, 决策 8: 邮件/短信/Webhook 通道)
|
||||
*
|
||||
* 子命令:
|
||||
* email-test 邮件测试
|
||||
* sms-test 短信测试
|
||||
* webhook-test Webhook 测试
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { buildIntegrationEmailTestCommand } from './email-test.ts'
|
||||
import { buildIntegrationSmsTestCommand } from './sms-test.ts'
|
||||
import { buildIntegrationWebhookTestCommand } from './webhook-test.ts'
|
||||
|
||||
export function buildIntegrationCommand(): Command {
|
||||
const cmd = new Command('integration').description('集成 (P2: 邮件/短信/Webhook 通道, 决策 8)')
|
||||
cmd.addCommand(buildIntegrationEmailTestCommand())
|
||||
cmd.addCommand(buildIntegrationSmsTestCommand())
|
||||
cmd.addCommand(buildIntegrationWebhookTestCommand())
|
||||
return cmd
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* commands/integration/sms-test.ts — 短信测试发送
|
||||
*
|
||||
* API: POST /api/system/SmsTemplate/testSent
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { JnpfClient } from '../../core/client.ts'
|
||||
import { installAiHelpHook } from '../../core/help.ts'
|
||||
import { log } from '../../core/log.ts'
|
||||
|
||||
interface SmsTestOpts {
|
||||
templateId: string
|
||||
phone?: string
|
||||
json?: boolean
|
||||
}
|
||||
|
||||
export function buildIntegrationSmsTestCommand(): Command {
|
||||
const cmd = new Command('sms-test')
|
||||
.description('短信测试发送 (走 SmsTemplate/testSent 端点)')
|
||||
.requiredOption('--templateId <id>', '短信模板 id')
|
||||
.option('--phone <n>', '目标手机号')
|
||||
.action(async (opts: SmsTestOpts) => {
|
||||
const c = await JnpfClient.fromToken()
|
||||
const r = await c.postJson('/system/SmsTemplate/testSent', {
|
||||
templateId: opts.templateId,
|
||||
phone: opts.phone,
|
||||
})
|
||||
if (r.code !== 200) {
|
||||
log.error(`integration sms-test 失败: ${r.msg}`)
|
||||
process.exit(1)
|
||||
}
|
||||
log.info(`✓ 短信测试发送 OK (templateId=${opts.templateId})`)
|
||||
})
|
||||
installAiHelpHook(cmd, {
|
||||
purpose: '短信测试发送 (决策 8: 短信通道)',
|
||||
required: { '--templateId': '短信模板 id' },
|
||||
optional: { '--phone': '目标手机号' },
|
||||
example: 'dacli integration sms-test --templateId=123 --phone=13800138000',
|
||||
source: {
|
||||
web: 'web/apps/jnpf-web-apps-main/src/views/integrationCenter/sms/index.vue',
|
||||
api: 'POST /api/system/SmsTemplate/testSent',
|
||||
ref: 'doc/v0.8-endpoints.md §3.3',
|
||||
},
|
||||
notes: ['**决策 8**: 短信走 integrationCenter/sms, 不用 msgCenter'],
|
||||
})
|
||||
return cmd
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* commands/integration/webhook-test.ts — Webhook 测试发送
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { JnpfClient } from '../../core/client.ts'
|
||||
import { installAiHelpHook } from '../../core/help.ts'
|
||||
import { log } from '../../core/log.ts'
|
||||
|
||||
interface WebhookTestOpts {
|
||||
url: string
|
||||
payload?: string
|
||||
}
|
||||
|
||||
export function buildIntegrationWebhookTestCommand(): Command {
|
||||
const cmd = new Command('webhook-test')
|
||||
.description('Webhook 测试发送')
|
||||
.requiredOption('--url <u>', '目标 URL')
|
||||
.option('--payload <p>', 'JSON payload (字符串)')
|
||||
.action(async (opts: WebhookTestOpts) => {
|
||||
const c = await JnpfClient.fromToken()
|
||||
let payload: unknown = { test: true }
|
||||
if (opts.payload) {
|
||||
try {
|
||||
payload = JSON.parse(opts.payload)
|
||||
} catch (e) {
|
||||
log.error(`--payload JSON 解析失败: ${(e as Error).message}`)
|
||||
process.exit(2)
|
||||
}
|
||||
}
|
||||
// 走 SendMessageConfig/testSendConfig (channel=webhook)
|
||||
const r = await c.postJson('/message/SendMessageConfig/testSendConfig', {
|
||||
url: opts.url,
|
||||
channel: 'webhook',
|
||||
payload,
|
||||
})
|
||||
if (r.code !== 200) {
|
||||
log.error(`integration webhook-test 失败: ${r.msg}`)
|
||||
process.exit(1)
|
||||
}
|
||||
log.info(`✓ Webhook 测试发送 OK (url=${opts.url})`)
|
||||
})
|
||||
installAiHelpHook(cmd, {
|
||||
purpose: 'Webhook 测试发送',
|
||||
required: { '--url': '目标 URL' },
|
||||
optional: { '--payload': 'JSON payload' },
|
||||
example: 'dacli integration webhook-test --url=https://example.com/hook --payload=\'{"key":"value"}\'',
|
||||
source: {
|
||||
web: 'web/apps/jnpf-web-apps-main/src/views/integrationCenter/webhook/index.vue',
|
||||
api: 'POST /api/message/SendMessageConfig/testSendConfig',
|
||||
ref: 'doc/v0.8-endpoints.md §3.3',
|
||||
},
|
||||
})
|
||||
return cmd
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* commands/log/index.ts — log 父命令
|
||||
*
|
||||
* JNPF 日志 (P2 收尾)
|
||||
*
|
||||
* 子命令:
|
||||
* login 登录日志
|
||||
* operate 操作日志
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { buildLogLoginCommand } from './login.ts'
|
||||
import { buildLogOperateCommand } from './operate.ts'
|
||||
|
||||
export function buildLogCommand(): Command {
|
||||
const cmd = new Command('log').description('日志 (P2: 登录日志 + 操作日志)')
|
||||
cmd.addCommand(buildLogLoginCommand())
|
||||
cmd.addCommand(buildLogOperateCommand())
|
||||
return cmd
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* commands/log/login.ts — 登录日志
|
||||
*
|
||||
* 注: JNPF 登录日志走 GET /api/system/Log (LogType 区分: login/operate/异常/请求)
|
||||
* 这里用 logType 字段过滤
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { JnpfClient } from '../../core/client.ts'
|
||||
import { installAiHelpHook } from '../../core/help.ts'
|
||||
import { log, printJson } from '../../core/log.ts'
|
||||
|
||||
interface ListOpts {
|
||||
keyword?: string
|
||||
json?: boolean
|
||||
}
|
||||
|
||||
export function buildLogLoginCommand(): Command {
|
||||
const cmd = new Command('login')
|
||||
.description('登录日志 (近 30 天)')
|
||||
.option('--keyword <k>', '按账号/姓名模糊搜索')
|
||||
.option('--json', '原始 JSON 输出', false)
|
||||
.action(async (opts: ListOpts) => {
|
||||
const c = await JnpfClient.fromToken()
|
||||
// JNPF 登录日志 = Log + category=login
|
||||
const r = await c.get<{ list: Record<string, unknown>[] }>('/system/Log', {
|
||||
category: 'login',
|
||||
keyword: opts.keyword,
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
})
|
||||
if (r.code !== 200) {
|
||||
log.error(`log login 失败: ${r.msg}`)
|
||||
process.exit(1)
|
||||
}
|
||||
const list = r.data?.list || []
|
||||
if (opts.json) {
|
||||
printJson(r.data)
|
||||
return
|
||||
}
|
||||
log.info(`登录日志 ${list.length} 条`)
|
||||
for (const d of list) {
|
||||
console.log(JSON.stringify(d).slice(0, 200))
|
||||
}
|
||||
})
|
||||
installAiHelpHook(cmd, {
|
||||
purpose: '登录日志',
|
||||
optional: { '--keyword': '按账号/姓名模糊搜索' },
|
||||
example: 'dacli log login\ndacli log login --keyword=admin',
|
||||
source: {
|
||||
web: 'web/apps/jnpf-web-apps-main/src/views/sysLog/loginLog/index.vue',
|
||||
api: 'GET /api/system/Log?category=login',
|
||||
ref: 'doc/v0.8-endpoints.md §3.2',
|
||||
},
|
||||
})
|
||||
return cmd
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* commands/log/operate.ts — 操作日志
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { JnpfClient } from '../../core/client.ts'
|
||||
import { installAiHelpHook } from '../../core/help.ts'
|
||||
import { log, printJson } from '../../core/log.ts'
|
||||
|
||||
interface ListOpts {
|
||||
keyword?: string
|
||||
json?: boolean
|
||||
}
|
||||
|
||||
export function buildLogOperateCommand(): Command {
|
||||
const cmd = new Command('operate')
|
||||
.description('操作日志')
|
||||
.option('--keyword <k>', '按账号/姓名模糊搜索')
|
||||
.option('--json', '原始 JSON 输出', false)
|
||||
.action(async (opts: ListOpts) => {
|
||||
const c = await JnpfClient.fromToken()
|
||||
const r = await c.get<{ list: Record<string, unknown>[] }>('/system/Log', {
|
||||
category: 'operate',
|
||||
keyword: opts.keyword,
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
})
|
||||
if (r.code !== 200) {
|
||||
log.error(`log operate 失败: ${r.msg}`)
|
||||
process.exit(1)
|
||||
}
|
||||
const list = r.data?.list || []
|
||||
if (opts.json) {
|
||||
printJson(r.data)
|
||||
return
|
||||
}
|
||||
log.info(`操作日志 ${list.length} 条`)
|
||||
for (const d of list) {
|
||||
console.log(JSON.stringify(d).slice(0, 200))
|
||||
}
|
||||
})
|
||||
installAiHelpHook(cmd, {
|
||||
purpose: '操作日志',
|
||||
optional: { '--keyword': '按账号/姓名模糊搜索' },
|
||||
example: 'dacli log operate\ndacli log operate --keyword=admin',
|
||||
source: {
|
||||
web: 'web/apps/jnpf-web-apps-main/src/views/sysLog/operateLog/index.vue',
|
||||
api: 'GET /api/system/Log?category=operate',
|
||||
ref: 'doc/v0.8-endpoints.md §3.2',
|
||||
},
|
||||
})
|
||||
return cmd
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* commands/monitor/flow.ts — 流程监控
|
||||
*
|
||||
* API: GET /api/workflow/monitor
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { JnpfClient } from '../../core/client.ts'
|
||||
import { installAiHelpHook } from '../../core/help.ts'
|
||||
import { log, printJson } from '../../core/log.ts'
|
||||
|
||||
interface FlowOpts {
|
||||
json?: boolean
|
||||
}
|
||||
|
||||
export function buildMonitorFlowCommand(): Command {
|
||||
const cmd = new Command('flow')
|
||||
.description('流程监控 (待办/运行中流程)')
|
||||
.option('--json', '原始 JSON 输出', false)
|
||||
.action(async (opts: FlowOpts) => {
|
||||
const c = await JnpfClient.fromToken()
|
||||
const r = await c.get<{ list: Record<string, unknown>[] }>('/workflow/monitor', {
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
})
|
||||
if (r.code !== 200) {
|
||||
log.error(`monitor flow 失败: ${r.msg}`)
|
||||
process.exit(1)
|
||||
}
|
||||
const list = r.data?.list || []
|
||||
if (opts.json) {
|
||||
printJson(r.data)
|
||||
return
|
||||
}
|
||||
log.info(`当前 ${list.length} 条流程监控记录`)
|
||||
for (const d of list) {
|
||||
console.log(JSON.stringify(d))
|
||||
}
|
||||
})
|
||||
installAiHelpHook(cmd, {
|
||||
purpose: '流程监控 (待办/运行中流程)',
|
||||
example: 'dacli monitor flow',
|
||||
source: {
|
||||
web: 'web/apps/jnpf-web-apps-main/src/views/monitor/flowMonitor/index.vue',
|
||||
api: 'GET /api/workflow/monitor',
|
||||
ref: 'doc/v0.8-endpoints.md §3.1',
|
||||
},
|
||||
notes: [
|
||||
'**决策 9**: 流程监控用 workflow/monitor 端点, 区别于 schedule (定时)',
|
||||
],
|
||||
})
|
||||
return cmd
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* commands/monitor/index.ts — monitor 父命令
|
||||
*
|
||||
* JNPF 监控 (P2 收尾)
|
||||
*
|
||||
* 子命令:
|
||||
* online 在线用户
|
||||
* sql SQL 监控 (走数据接口 id)
|
||||
* flow 流程监控
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { buildMonitorOnlineCommand } from './online.ts'
|
||||
import { buildMonitorSqlCommand } from './sql.ts'
|
||||
import { buildMonitorFlowCommand } from './flow.ts'
|
||||
|
||||
export function buildMonitorCommand(): Command {
|
||||
const cmd = new Command('monitor').description('监控 (P2: 在线用户/SQL 监控/流程监控)')
|
||||
cmd.addCommand(buildMonitorOnlineCommand())
|
||||
cmd.addCommand(buildMonitorSqlCommand())
|
||||
cmd.addCommand(buildMonitorFlowCommand())
|
||||
return cmd
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* commands/monitor/online.ts — 在线用户监控
|
||||
*
|
||||
* API: GET /api/system/OnlineUser
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { JnpfClient } from '../../core/client.ts'
|
||||
import { installAiHelpHook } from '../../core/help.ts'
|
||||
import { log, printJson } from '../../core/log.ts'
|
||||
|
||||
interface ListOpts {
|
||||
json?: boolean
|
||||
}
|
||||
|
||||
export function buildMonitorOnlineCommand(): Command {
|
||||
const cmd = new Command('online')
|
||||
.description('在线用户监控')
|
||||
.option('--json', '原始 JSON 输出', false)
|
||||
.action(async (opts: ListOpts) => {
|
||||
const c = await JnpfClient.fromToken()
|
||||
const r = await c.get<{ list: Record<string, unknown>[] }>('/system/OnlineUser', {
|
||||
currentPage: 1,
|
||||
pageSize: 50,
|
||||
})
|
||||
if (r.code !== 200) {
|
||||
log.error(`monitor online 失败: ${r.msg}`)
|
||||
process.exit(1)
|
||||
}
|
||||
const list = r.data?.list || []
|
||||
if (opts.json) {
|
||||
printJson(r.data)
|
||||
return
|
||||
}
|
||||
log.info(`当前在线 ${list.length} 个用户`)
|
||||
console.log('ID USER')
|
||||
console.log('-'.repeat(60))
|
||||
for (const d of list) {
|
||||
console.log(`${String(d.id || '').padEnd(30)}${String(d.userName || d.account || '')}`)
|
||||
}
|
||||
})
|
||||
installAiHelpHook(cmd, {
|
||||
purpose: '在线用户监控 (当前登录的用户)',
|
||||
example: 'dacli monitor online',
|
||||
source: {
|
||||
web: 'web/apps/jnpf-web-apps-main/src/views/monitor/userOnline/index.vue',
|
||||
api: 'GET /api/system/OnlineUser',
|
||||
ref: 'doc/v0.8-endpoints.md §3.1',
|
||||
},
|
||||
})
|
||||
return cmd
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* commands/monitor/sql.ts — SQL 监控 (dataInterface 调用日志)
|
||||
*
|
||||
* API: GET /api/system/DataInterfaceLog/{id}
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { JnpfClient } from '../../core/client.ts'
|
||||
import { installAiHelpHook } from '../../core/help.ts'
|
||||
import { log, printJson } from '../../core/log.ts'
|
||||
|
||||
interface SqlOpts {
|
||||
id: string
|
||||
json?: boolean
|
||||
}
|
||||
|
||||
export function buildMonitorSqlCommand(): Command {
|
||||
const cmd = new Command('sql')
|
||||
.description('SQL 监控 (数据接口调用日志)')
|
||||
.requiredOption('--id <id>', '数据接口 id')
|
||||
.option('--json', '原始 JSON 输出', false)
|
||||
.action(async (opts: SqlOpts) => {
|
||||
const c = await JnpfClient.fromToken()
|
||||
const r = await c.get<{ list: Record<string, unknown>[] }>(`/system/DataInterfaceLog/${opts.id}`, {
|
||||
currentPage: 1,
|
||||
pageSize: 50,
|
||||
})
|
||||
if (r.code !== 200) {
|
||||
log.error(`monitor sql 失败: ${r.msg}`)
|
||||
process.exit(1)
|
||||
}
|
||||
const list = r.data?.list || []
|
||||
if (opts.json) {
|
||||
printJson(r.data)
|
||||
return
|
||||
}
|
||||
log.info(`数据接口 id=${opts.id} 共 ${list.length} 条调用日志`)
|
||||
for (const d of list) {
|
||||
console.log(JSON.stringify(d))
|
||||
}
|
||||
})
|
||||
installAiHelpHook(cmd, {
|
||||
purpose: 'SQL 监控 (数据接口调用日志)',
|
||||
required: { '--id': '数据接口 id' },
|
||||
example: 'dacli monitor sql --id=420587863533428357',
|
||||
source: {
|
||||
web: 'web/apps/jnpf-web-apps-main/src/views/monitor/platformMonitor/index.vue',
|
||||
api: 'GET /api/system/DataInterfaceLog/{id}',
|
||||
ref: 'doc/v0.8-endpoints.md §3.1',
|
||||
},
|
||||
})
|
||||
return cmd
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
* p2-monitor-log-integration.test.ts — P2 3 父命令烟囱测试
|
||||
*/
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { execFileSync } from 'node:child_process'
|
||||
import { resolve } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const __dirname = fileURLToPath(new URL('.', import.meta.url))
|
||||
const CLI = resolve(__dirname, '../../src/cli.ts')
|
||||
|
||||
function run(args: string[]): string {
|
||||
try {
|
||||
return execFileSync('npx', ['tsx', CLI, ...args], {
|
||||
encoding: 'utf-8',
|
||||
stdio: ['pipe', 'pipe', 'pipe'],
|
||||
timeout: 30_000,
|
||||
})
|
||||
} catch (e) {
|
||||
const err = e as { stdout?: Buffer | string; status?: number }
|
||||
return (err.stdout?.toString() || '')
|
||||
}
|
||||
}
|
||||
|
||||
describe('monitor command tree (W12-D1)', () => {
|
||||
it('monitor --help 列出 3 个子命令', () => {
|
||||
const out = run(['monitor', '--help'])
|
||||
expect(out).toContain('online')
|
||||
expect(out).toContain('sql')
|
||||
expect(out).toContain('flow')
|
||||
})
|
||||
it('monitor online --ai-help 含 API 路径', () => {
|
||||
const out = run(['monitor', 'online', '--ai-help'])
|
||||
expect(out).toContain('/api/system/OnlineUser')
|
||||
})
|
||||
it('monitor sql --help 包含 --id', () => {
|
||||
const out = run(['monitor', 'sql', '--help'])
|
||||
expect(out).toContain('--id')
|
||||
})
|
||||
it('monitor flow --ai-help 含 API 路径', () => {
|
||||
const out = run(['monitor', 'flow', '--ai-help'])
|
||||
expect(out).toContain('/api/workflow/monitor')
|
||||
})
|
||||
it('顶层 --help 包含 monitor', () => {
|
||||
const out = run(['--help'])
|
||||
expect(out).toContain('monitor')
|
||||
})
|
||||
})
|
||||
|
||||
describe('log command tree (W12-D2)', () => {
|
||||
it('log --help 列出 2 个子命令', () => {
|
||||
const out = run(['log', '--help'])
|
||||
expect(out).toContain('login')
|
||||
expect(out).toContain('operate')
|
||||
})
|
||||
it('log login --ai-help 含 API 路径', () => {
|
||||
const out = run(['log', 'login', '--ai-help'])
|
||||
expect(out).toContain('/api/system/Log')
|
||||
})
|
||||
it('log operate --help 包含 --keyword', () => {
|
||||
const out = run(['log', 'operate', '--help'])
|
||||
expect(out).toContain('--keyword')
|
||||
})
|
||||
it('顶层 --help 包含 log', () => {
|
||||
const out = run(['--help'])
|
||||
expect(out).toContain('log')
|
||||
})
|
||||
})
|
||||
|
||||
describe('integration command tree (W12-D3)', () => {
|
||||
it('integration --help 列出 3 个子命令', () => {
|
||||
const out = run(['integration', '--help'])
|
||||
expect(out).toContain('email-test')
|
||||
expect(out).toContain('sms-test')
|
||||
expect(out).toContain('webhook-test')
|
||||
})
|
||||
it('integration email-test --ai-help 提示决策 8', () => {
|
||||
const out = run(['integration', 'email-test', '--ai-help'])
|
||||
expect(out).toContain('决策 8')
|
||||
expect(out).toContain('邮件')
|
||||
})
|
||||
it('integration sms-test --help 包含 --phone', () => {
|
||||
const out = run(['integration', 'sms-test', '--help'])
|
||||
expect(out).toContain('--phone')
|
||||
})
|
||||
it('integration webhook-test --help 包含 --url/--payload', () => {
|
||||
const out = run(['integration', 'webhook-test', '--help'])
|
||||
expect(out).toContain('--url')
|
||||
expect(out).toContain('--payload')
|
||||
})
|
||||
it('顶层 --help 包含 integration', () => {
|
||||
const out = run(['--help'])
|
||||
expect(out).toContain('integration')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user