auto(6f177c177d02): session end @ 2026-06-14T08:04:54 (+27f)
This commit is contained in:
1 parent
44c0d51907
commit
0fbc478e16
27 files changed
+60
-848
No files matched your search
+1
-1
@@ -10,7 +10,7 @@
|
||||
import { Command } from 'commander'
|
||||
import { buildLoginCommand } from './commands/login.ts'
|
||||
import { buildStatusCommand } from './commands/status.ts'
|
||||
import { buildSwitchAppCommand } from './commands/switch-app.ts'
|
||||
import { buildSwitchAppCommand } from './commands/switchapp.ts'
|
||||
import { buildFormCommand } from './commands/form/index.ts'
|
||||
import { buildDmCommand } from './commands/dm/index.ts'
|
||||
import { buildDictCommand } from './commands/dict/index.ts'
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/**
|
||||
* commands/dict/data-list.ts — 字典数据列表
|
||||
*
|
||||
* API: GET /api/system/DictionaryData/{typeId}/Data 或 /All
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { JnpfClient } from '../../core/client.ts'
|
||||
import { installAiHelpHook } from '../../core/help.ts'
|
||||
import { log, printJson } from '../../core/log.ts'
|
||||
|
||||
interface Opts {
|
||||
typeId?: string
|
||||
all?: boolean
|
||||
json?: boolean
|
||||
}
|
||||
|
||||
export function buildDictDataListCommand(): Command {
|
||||
const cmd = new Command('data-list')
|
||||
.description('字典数据列表 (按 typeId 或全部)')
|
||||
.option('--typeId <id>', '字典类型 id (不传则返回全部)')
|
||||
.option('--all', '等价于不传 typeId 调 /All', false)
|
||||
.option('--json', '原始 JSON 输出', false)
|
||||
.action(async (opts: Opts) => {
|
||||
const c = await JnpfClient.fromToken()
|
||||
let path: string
|
||||
if (opts.all || !opts.typeId) {
|
||||
path = '/system/DictionaryData/All'
|
||||
} else {
|
||||
path = `/system/DictionaryData/${opts.typeId}/Data`
|
||||
}
|
||||
const r = await c.get<unknown>(path)
|
||||
if (r.code !== 200) { log.error(`dict data-list 失败: ${r.msg}`); process.exit(1) }
|
||||
if (opts.json) { printJson(r.data); return }
|
||||
const list = (Array.isArray(r.data) ? r.data : (r.data as { list?: unknown[] })?.list) || []
|
||||
log.info(`${path} 共 ${list.length} 条`)
|
||||
console.log('ENCODE FULL_NAME SORT')
|
||||
console.log('-'.repeat(60))
|
||||
for (const d of list as Record<string, unknown>[]) {
|
||||
console.log(`${String(d.enCode || d.id || '').padEnd(21)}${String(d.fullName || '').padEnd(22)}${d.sortCode || ''}`)
|
||||
}
|
||||
})
|
||||
|
||||
installAiHelpHook(cmd, {
|
||||
purpose: '看字典数据. --typeId 看单类型, 不传 --all 拿全部.',
|
||||
required: {},
|
||||
optional: { '--typeId': '字典类型 id', '--all': '拿全部字典' },
|
||||
example: 'dacli dict data-list --typeId=<id>',
|
||||
source: { api: 'GET /api/system/DictionaryData/{typeId}/Data 或 /All' },
|
||||
})
|
||||
return cmd
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
* commands/dict/index.ts — dict 父命令
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { buildDictTypeListCommand } from './type-list.ts'
|
||||
import { buildDictDataListCommand } from './data-list.ts'
|
||||
import { buildDictTypeListCommand } from './typelist.ts'
|
||||
import { buildDictDataListCommand } from './datalist.ts'
|
||||
|
||||
export function buildDictCommand(): Command {
|
||||
const cmd = new Command('dict').description('字典管理 (类型 + 数据)')
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* commands/dict/type-list.ts — 字典类型列表
|
||||
*
|
||||
* API: GET /api/system/DictionaryType
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { JnpfClient } from '../../core/client.ts'
|
||||
import { installAiHelpHook } from '../../core/help.ts'
|
||||
import { log, printJson } from '../../core/log.ts'
|
||||
|
||||
interface Opts { json?: boolean; keyword?: string }
|
||||
|
||||
export function buildDictTypeListCommand(): Command {
|
||||
const cmd = new Command('type-list')
|
||||
.description('字典类型列表')
|
||||
.option('--keyword <k>', '按编码/名称搜索')
|
||||
.option('--json', '原始 JSON 输出', false)
|
||||
.action(async (opts: Opts) => {
|
||||
const c = await JnpfClient.fromToken()
|
||||
const r = await c.get<unknown>('/system/DictionaryType', { keyword: opts.keyword })
|
||||
if (r.code !== 200) { log.error(`dict type-list 失败: ${r.msg}`); process.exit(1) }
|
||||
if (opts.json) { printJson(r.data); return }
|
||||
const list = (r.data as { list?: Record<string, unknown>[] })?.list || []
|
||||
log.info(`共 ${list.length} 个字典类型`)
|
||||
console.log('ID ENCODE FULL_NAME')
|
||||
console.log('-'.repeat(80))
|
||||
for (const t of list) {
|
||||
console.log(`${String(t.id || '').padEnd(36)}${String(t.enCode || '').padEnd(21)}${t.fullName || ''}`)
|
||||
}
|
||||
})
|
||||
|
||||
installAiHelpHook(cmd, {
|
||||
purpose: '列出所有字典类型 (e.g. 性别/状态/教育程度 等下拉字典).',
|
||||
required: {},
|
||||
optional: { '--keyword': '搜索关键字' },
|
||||
example: 'dacli dict type-list',
|
||||
source: { api: 'GET /api/system/DictionaryType' },
|
||||
})
|
||||
return cmd
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
/**
|
||||
* commands/form/fix-columndata.ts — 修复 form columnData 缺 4 个 use*Permission 字段
|
||||
*
|
||||
* v0.7.1 闭环 (盲点 23): 早于 v0.7.1 的 form 用 `dacli form create` 创建时 columnData
|
||||
* 缺 `useBtnPermission/useColumnPermission/useFormPermission/useDataPermission` 字段,
|
||||
* Jackson 反序列化为 null → Actions/Module 报 "System abnormality" (NPE 在
|
||||
* VisualUtil.setPcPermission line 139, .booleanValue() 解开 null)
|
||||
*
|
||||
* 修法: 拿原 form 的 columnData + appColumnData, 把 4 个 use*Permission 字段补 false
|
||||
* 显式赋值, 然后 PUT /api/visualdev/Base/{id} 回去.
|
||||
*
|
||||
* 跑法:
|
||||
* dacli form fix-columndata 835168490678657989
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { JnpfClient } from '../../core/client.ts'
|
||||
import { installAiHelpHook } from '../../core/help.ts'
|
||||
import { log, printJson } from '../../core/log.ts'
|
||||
import type { FormDetail } from '../../core/types.ts'
|
||||
|
||||
const PERMISSION_FIELDS = [
|
||||
'useBtnPermission',
|
||||
'useColumnPermission',
|
||||
'useFormPermission',
|
||||
'useDataPermission',
|
||||
] as const
|
||||
|
||||
function safeParse<T = unknown>(s: unknown): T | null {
|
||||
if (typeof s !== 'string') return s as T
|
||||
try {
|
||||
return JSON.parse(s) as T
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
function hasAllPermissions(obj: Record<string, unknown> | null): boolean {
|
||||
if (!obj) return false
|
||||
return PERMISSION_FIELDS.every((k) => typeof obj[k] === 'boolean')
|
||||
}
|
||||
|
||||
function patchColumnData(json: string | null | undefined): { patched: string; changed: boolean } {
|
||||
const obj = (safeParse<Record<string, unknown>>(json) ?? {}) as Record<string, unknown>
|
||||
let changed = false
|
||||
for (const k of PERMISSION_FIELDS) {
|
||||
if (typeof obj[k] !== 'boolean') {
|
||||
obj[k] = false
|
||||
changed = true
|
||||
}
|
||||
}
|
||||
return { patched: JSON.stringify(obj), changed }
|
||||
}
|
||||
|
||||
export function buildFormFixColumnDataCommand(): Command {
|
||||
const cmd = new Command('fix-columndata')
|
||||
.description('修复 form columnData 缺 use*Permission 字段 (盲点 23 NPE 修)')
|
||||
.argument('<id>', 'form id')
|
||||
.option('--json', '原始 JSON 输出', false)
|
||||
.option('--dry-run', '只看缺啥, 不真改', false)
|
||||
.action(async (id: string, opts: { json?: boolean; dryRun?: boolean }) => {
|
||||
const c = await JnpfClient.fromToken()
|
||||
const r = await c.get<FormDetail>(`/visualdev/Base/${id}`)
|
||||
if (!c.ok(r)) {
|
||||
log.error(`拉 form 失败 code=${r.code}: ${r.msg}`)
|
||||
process.exit(1)
|
||||
}
|
||||
const form = r.data as FormDetail
|
||||
|
||||
const col = patchColumnData(typeof form.columnData === 'string' ? form.columnData : null)
|
||||
const app = patchColumnData(typeof form.appColumnData === 'string' ? form.appColumnData : null)
|
||||
|
||||
// 也存一份未污染的, 方便调试
|
||||
const colObj = safeParse<Record<string, unknown>>(form.columnData)
|
||||
const appObj = safeParse<Record<string, unknown>>(form.appColumnData)
|
||||
const colMissing = colObj ? PERMISSION_FIELDS.filter((k) => typeof colObj[k] !== 'boolean') : PERMISSION_FIELDS
|
||||
const appMissing = appObj ? PERMISSION_FIELDS.filter((k) => typeof appObj[k] !== 'boolean') : PERMISSION_FIELDS
|
||||
|
||||
const summary = {
|
||||
id,
|
||||
enCode: form.enCode,
|
||||
columnData: { had: hasAllPermissions(colObj as Record<string, unknown>), missing: colMissing, changed: col.changed },
|
||||
appColumnData: { had: hasAllPermissions(appObj as Record<string, unknown>), missing: appMissing, changed: app.changed },
|
||||
}
|
||||
|
||||
if (!col.changed && !app.changed) {
|
||||
log.ok(`✓ 4 个 use*Permission 字段已存在, 不需修`)
|
||||
if (opts.json) printJson({ ...summary, action: 'noop' })
|
||||
return
|
||||
}
|
||||
|
||||
if (opts.dryRun) {
|
||||
log.warn(`[dry-run] 会补 ${colMissing.length + appMissing.length} 个字段 (columnData=${colMissing.length}, appColumnData=${appMissing.length})`)
|
||||
if (opts.json) printJson({ ...summary, action: 'dry-run' })
|
||||
return
|
||||
}
|
||||
|
||||
const body: Record<string, unknown> = {
|
||||
id,
|
||||
fullName: form.fullName,
|
||||
enCode: form.enCode,
|
||||
type: form.type,
|
||||
webType: form.webType,
|
||||
category: form.category,
|
||||
description: form.description,
|
||||
dbLinkId: form.dbLinkId,
|
||||
enableFlow: form.enableFlow,
|
||||
flowId: form.flowId,
|
||||
formData: form.formData,
|
||||
columnData: col.patched,
|
||||
appColumnData: app.patched,
|
||||
tables: form.tables,
|
||||
state: form.state,
|
||||
sortCode: form.sortCode,
|
||||
}
|
||||
log.info(`PUT /visualdev/Base/${id} (补 ${colMissing.length + appMissing.length} 个 use*Permission 字段)`)
|
||||
const rr = await c.putJson<unknown>(`/visualdev/Base/${id}`, body)
|
||||
if (rr.code !== 200) {
|
||||
log.error(`修复失败 code=${rr.code}: ${rr.msg}`)
|
||||
if (opts.json) printJson({ ...summary, action: 'failed', error: rr })
|
||||
process.exit(1)
|
||||
}
|
||||
log.ok(`✓ 修复成功: columnData 补 ${colMissing.length} 字段, appColumnData 补 ${appMissing.length} 字段`)
|
||||
if (opts.json) printJson({ ...summary, action: 'patched' })
|
||||
})
|
||||
|
||||
installAiHelpHook(cmd, {
|
||||
purpose: '修复 form columnData 缺的 4 个 use*Permission 字段 (盲点 23, 触发 NPE 在 Actions/Module)',
|
||||
required: { '<id>': 'form id' },
|
||||
optional: { '--dry-run': '只看不改' },
|
||||
example: ['dacli form fix-columndata 835168490678657989'],
|
||||
source: {
|
||||
api: 'PUT /api/visualdev/Base/{id}',
|
||||
ref: '后端 VisualUtil.setPcPermission line 139 (NPE on useBtnPermission.booleanValue())',
|
||||
},
|
||||
notes: [
|
||||
'盲点 23: v0.7.1 之前 form create 的 columnData 缺 use*Permission, 后端反序列化为 null',
|
||||
'Actions/Module 会 NPE → "System abnormality" (看不出来的内部错)',
|
||||
'修后调用 Actions/Module 报 "找不到该上级" 或正常成功 (取决于父菜单)',
|
||||
],
|
||||
})
|
||||
return cmd
|
||||
}
|
||||
@@ -11,11 +11,11 @@ import { buildFormExportCommand } from './export.ts'
|
||||
import { buildFormImportCommand } from './import.ts'
|
||||
import { buildFormCloneCommand } from './clone.ts'
|
||||
import { buildFormValidateCommand } from './validate.ts'
|
||||
import { buildFormFixColumnDataCommand } from './fix-columndata.ts'
|
||||
import { buildFormFixColumnDataCommand } from './fixcolumndata.ts'
|
||||
import { buildFormCodegenCommand } from './codegen.ts'
|
||||
|
||||
export function buildFormCommand(): Command {
|
||||
const cmd = new Command('form').description('表单 CRUD (list/info/create/release/delete/export/import/clone/validate/fix-columndata/codegen)')
|
||||
const cmd = new Command('form').description('表单 CRUD (list/info/create/release/delete/export/import/clone/validate/fixcolumndata/codegen)')
|
||||
cmd.addCommand(buildFormListCommand())
|
||||
cmd.addCommand(buildFormInfoCommand())
|
||||
cmd.addCommand(buildFormCreateCommand())
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
/**
|
||||
* 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
|
||||
}
|
||||
@@ -4,14 +4,14 @@
|
||||
* JNPF 集成 (P2 收尾, 决策 8: 邮件/短信/Webhook 通道)
|
||||
*
|
||||
* 子命令:
|
||||
* email-test 邮件测试
|
||||
* sms-test 短信测试
|
||||
* webhook-test Webhook 测试
|
||||
* emailtest 邮件测试
|
||||
* smstest 短信测试
|
||||
* webhooktest Webhook 测试
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { buildIntegrationEmailTestCommand } from './email-test.ts'
|
||||
import { buildIntegrationSmsTestCommand } from './sms-test.ts'
|
||||
import { buildIntegrationWebhookTestCommand } from './webhook-test.ts'
|
||||
import { buildIntegrationEmailTestCommand } from './emailtest.ts'
|
||||
import { buildIntegrationSmsTestCommand } from './smstest.ts'
|
||||
import { buildIntegrationWebhookTestCommand } from './webhooktest.ts'
|
||||
|
||||
export function buildIntegrationCommand(): Command {
|
||||
const cmd = new Command('integration').description('集成 (P2: 邮件/短信/Webhook 通道, 决策 8)')
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/**
|
||||
* 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
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/**
|
||||
* 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
|
||||
}
|
||||
@@ -40,7 +40,7 @@ export function buildMenuListCommand(): Command {
|
||||
optional: { '--keyword': '搜索关键字', '--flat': '平铺打印' },
|
||||
example: 'dacli menu list',
|
||||
source: { api: 'GET /api/system/Menu/ModuleBySystem' },
|
||||
notes: ['先 dacli switch-app --appCode=X 切到目标应用, 才能看到对应菜单'],
|
||||
notes: ['先 dacli switchapp --appCode=X 切到目标应用, 才能看到对应菜单'],
|
||||
})
|
||||
return cmd
|
||||
}
|
||||
+10
-10
@@ -6,18 +6,18 @@
|
||||
* 决策 8: 通知通道 site/email/sms/webhook/dingTalk/weCom
|
||||
*
|
||||
* 子命令:
|
||||
* notice-list 通知列表
|
||||
* notice-create 新建通知
|
||||
* notice-send 发送通知
|
||||
* template-list 模板列表
|
||||
* template-create 新建模板
|
||||
* noticelist 通知列表
|
||||
* noticecreate 新建通知
|
||||
* noticesend 发送通知
|
||||
* templatelist 模板列表
|
||||
* templatecreate 新建模板
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { buildMsgNoticeListCommand } from './notice-list.ts'
|
||||
import { buildMsgNoticeCreateCommand } from './notice-create.ts'
|
||||
import { buildMsgNoticeSendCommand } from './notice-send.ts'
|
||||
import { buildMsgTemplateListCommand } from './template-list.ts'
|
||||
import { buildMsgTemplateCreateCommand } from './template-create.ts'
|
||||
import { buildMsgNoticeListCommand } from './noticelist.ts'
|
||||
import { buildMsgNoticeCreateCommand } from './noticecreate.ts'
|
||||
import { buildMsgNoticeSendCommand } from './noticesend.ts'
|
||||
import { buildMsgTemplateListCommand } from './templatelist.ts'
|
||||
import { buildMsgTemplateCreateCommand } from './templatecreate.ts'
|
||||
|
||||
export function buildMsgCommand(): Command {
|
||||
const cmd = new Command('msg').description('消息中心 (通知 + 模板, msgCenter)')
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
/**
|
||||
* commands/msg/notice-create.ts — 新建通知公告
|
||||
*
|
||||
* API: POST /api/message/Notice
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { JnpfClient } from '../../core/client.ts'
|
||||
import { installAiHelpHook } from '../../core/help.ts'
|
||||
import { log, printJson } from '../../core/log.ts'
|
||||
|
||||
interface CreateOpts {
|
||||
fullName: string
|
||||
enCode: string
|
||||
body?: string
|
||||
json?: boolean
|
||||
}
|
||||
|
||||
export function buildMsgNoticeCreateCommand(): Command {
|
||||
const cmd = new Command('notice-create')
|
||||
.description('新建通知公告 (草稿, 未发布)')
|
||||
.requiredOption('--fullName <name>', '通知标题')
|
||||
.requiredOption('--enCode <code>', '通知编码')
|
||||
.option('--body <text>', '通知正文 (可选)')
|
||||
.option('--json', '原始 JSON 输出', false)
|
||||
.action(async (opts: CreateOpts) => {
|
||||
const c = await JnpfClient.fromToken()
|
||||
const body = {
|
||||
fullName: opts.fullName,
|
||||
enCode: opts.enCode,
|
||||
title: opts.fullName,
|
||||
body: opts.body || '通知内容',
|
||||
type: 1, // 1=系统公告 2=待办
|
||||
enabledMark: 1,
|
||||
sortCode: 0,
|
||||
}
|
||||
const r = await c.postJson<{ id?: string }>('/message/Notice', body)
|
||||
if (r.code !== 200) {
|
||||
log.error(`msg notice-create 失败 (code=${r.code}): ${r.msg}`)
|
||||
process.exit(1)
|
||||
}
|
||||
let id = r.data?.id
|
||||
if (!id) {
|
||||
const listR = await c.get<{ list: { id: string; enCode: string; fullName: string }[] }>(
|
||||
'/message/Notice',
|
||||
{ keyword: opts.enCode, pageSize: '50' },
|
||||
)
|
||||
const found = (listR.data?.list || []).find(
|
||||
(d) => d.enCode === opts.enCode || d.fullName === opts.fullName,
|
||||
)
|
||||
id = found?.id
|
||||
}
|
||||
log.info(`✓ 通知公告创建成功 id=${id}`)
|
||||
if (opts.json) printJson({ ...(r.data as object), id })
|
||||
})
|
||||
installAiHelpHook(cmd, {
|
||||
purpose: '新建通知公告 (草稿, 用 notice-release 发布)',
|
||||
required: { '--fullName': '通知标题', '--enCode': '通知编码' },
|
||||
optional: { '--body': '通知正文' },
|
||||
example: 'dacli msg notice-create --fullName=系统升级 --enCode=sys_upgrade_2026 --body=今晚 10 点维护',
|
||||
source: {
|
||||
web: 'web/apps/jnpf-web-apps-main/src/views/msgCenter/notice/Form.vue',
|
||||
api: 'POST /api/message/Notice',
|
||||
ref: 'doc/v0.8-endpoints.md §2.4',
|
||||
},
|
||||
})
|
||||
return cmd
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
/**
|
||||
* commands/msg/notice-list.ts — 通知公告列表
|
||||
*
|
||||
* API: GET /api/message/Notice 或 POST /api/message/Notice/List
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { JnpfClient } from '../../core/client.ts'
|
||||
import { installAiHelpHook } from '../../core/help.ts'
|
||||
import { log, printJson } from '../../core/log.ts'
|
||||
|
||||
interface NoticeItem {
|
||||
id?: string
|
||||
fullName?: string
|
||||
enCode?: string
|
||||
title?: string
|
||||
state?: number
|
||||
type?: number
|
||||
creatorTime?: string | number
|
||||
}
|
||||
|
||||
interface ListOpts {
|
||||
keyword?: string
|
||||
json?: boolean
|
||||
}
|
||||
|
||||
export function buildMsgNoticeListCommand(): Command {
|
||||
const cmd = new Command('notice-list')
|
||||
.description('列出通知公告 (站内信)')
|
||||
.option('--keyword <k>', '按名称/编码模糊搜索')
|
||||
.option('--json', '原始 JSON 输出', false)
|
||||
.action(async (opts: ListOpts) => {
|
||||
const c = await JnpfClient.fromToken()
|
||||
// JNPF Notice 列表用 POST /api/message/Notice/List (GET 返 405)
|
||||
const r = await c.postJson<{ list: NoticeItem[] }>('/message/Notice/List', {
|
||||
keyword: opts.keyword,
|
||||
currentPage: 1,
|
||||
pageSize: 50,
|
||||
})
|
||||
if (r.code !== 200) {
|
||||
log.error(`msg notice-list 失败 (code=${r.code}): ${r.msg}`)
|
||||
process.exit(1)
|
||||
}
|
||||
const list = r.data?.list || []
|
||||
if (opts.json) {
|
||||
printJson(r.data)
|
||||
return
|
||||
}
|
||||
log.info(`共 ${list.length} 个通知公告`)
|
||||
console.log('ID FULL_NAME ENCODE STATE')
|
||||
console.log('-'.repeat(85))
|
||||
for (const d of list) {
|
||||
const id = String(d.id || '').padEnd(30)
|
||||
const name = String(d.fullName || d.title || '').padEnd(23)
|
||||
const code = String(d.enCode || '').padEnd(21)
|
||||
const state = d.state === 1 ? '已发布' : '未发布'
|
||||
console.log(`${id}${name}${code}${state}`)
|
||||
}
|
||||
})
|
||||
installAiHelpHook(cmd, {
|
||||
purpose: '列出通知公告 (站内信, msgCenter)',
|
||||
optional: { '--keyword': '按名称/编码模糊搜索' },
|
||||
example: 'dacli msg notice-list\ndacli msg notice-list --keyword=系统',
|
||||
source: {
|
||||
web: 'web/apps/jnpf-web-apps-main/src/views/msgCenter/notice/index.vue',
|
||||
api: 'GET /api/message/Notice',
|
||||
ref: 'doc/v0.8-endpoints.md §2.4',
|
||||
},
|
||||
notes: [
|
||||
'**决策 8**: 站内信用 msgCenter (本命令), 邮件用 integrationCenter',
|
||||
'**send 通道**: 站内信 type=site, 邮件 type=email, 短信 type=sms, etc.',
|
||||
],
|
||||
})
|
||||
return cmd
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/**
|
||||
* commands/msg/notice-send.ts — 发送通知公告
|
||||
*
|
||||
* 注: 真实 "发送" 走 PUT /api/message/Notice/{id}/Actions/Release (发布后即推送)
|
||||
* 这里 provide 一个 "send" 别名, 内部走 release
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { JnpfClient } from '../../core/client.ts'
|
||||
import { installAiHelpHook } from '../../core/help.ts'
|
||||
import { log } from '../../core/log.ts'
|
||||
|
||||
interface SendOpts {
|
||||
id: string
|
||||
type?: string
|
||||
}
|
||||
|
||||
export function buildMsgNoticeSendCommand(): Command {
|
||||
const cmd = new Command('notice-send')
|
||||
.description('发布/发送通知 (走 release 端点, 决策 8: type=site 站内信)')
|
||||
.requiredOption('--id <id>', '通知 id')
|
||||
.option('--type <t>', '通道: site=站内信 (默认) | email=邮件 | sms=短信 | webhook=Webhook | dingTalk=钉钉 | weCom=企微', 'site')
|
||||
.action(async (opts: SendOpts) => {
|
||||
const validTypes = ['site', 'email', 'sms', 'webhook', 'dingTalk', 'weCom']
|
||||
if (!validTypes.includes(opts.type || '')) {
|
||||
log.error(`--type 必须是 ${validTypes.join('|')}`)
|
||||
process.exit(2)
|
||||
}
|
||||
const c = await JnpfClient.fromToken()
|
||||
// 站内信走 notice release
|
||||
if (opts.type === 'site') {
|
||||
const r = await c.putJson(`/message/Notice/${opts.id}/Actions/Release`, {})
|
||||
if (r.code !== 200) {
|
||||
log.error(`msg notice-send (站内信) 失败: ${r.msg}`)
|
||||
process.exit(1)
|
||||
}
|
||||
log.info(`✓ 通知 id=${opts.id} 已发布 (站内信推送)`)
|
||||
} else {
|
||||
// 邮件/短信/Webhook 走 integration 端点, 留 v0.9+ 实做
|
||||
log.warn(`--type=${opts.type} 通道的发送端点 v0.9+ 实做, 当前只支持 site (站内信)`)
|
||||
log.info(` 提示: 走 dacli integration ${opts.type} send (W12+)`)
|
||||
}
|
||||
})
|
||||
installAiHelpHook(cmd, {
|
||||
purpose: '发送/发布通知 (决策 8: 通道 site/email/sms/webhook/dingTalk/weCom)',
|
||||
required: { '--id': '通知 id' },
|
||||
optional: { '--type': '发送通道 (默认 site)' },
|
||||
example: 'dacli msg notice-send --id=1234567890\ndacli msg notice-send --id=1234567890 --type=email',
|
||||
source: {
|
||||
web: 'web/apps/jnpf-web-apps-main/src/views/msgCenter/notice/Form.vue',
|
||||
api: 'PUT /api/message/Notice/{id}/Actions/Release',
|
||||
ref: 'doc/v0.8-endpoints.md §2.4',
|
||||
},
|
||||
notes: [
|
||||
'**决策 8**: 当前只实做 site (站内信) 通道',
|
||||
'**v0.9+**: email/sms/webhook/dingTalk/weCom 通道走 dacli integration',
|
||||
],
|
||||
})
|
||||
return cmd
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
/**
|
||||
* commands/msg/template-create.ts — 新建消息模板
|
||||
*
|
||||
* API: POST /api/system/MessageTemplate
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { JnpfClient } from '../../core/client.ts'
|
||||
import { installAiHelpHook } from '../../core/help.ts'
|
||||
import { log, printJson } from '../../core/log.ts'
|
||||
|
||||
interface CreateOpts {
|
||||
fullName: string
|
||||
enCode: string
|
||||
json?: boolean
|
||||
}
|
||||
|
||||
export function buildMsgTemplateCreateCommand(): Command {
|
||||
const cmd = new Command('template-create')
|
||||
.description('新建消息模板')
|
||||
.requiredOption('--fullName <name>', '模板名称')
|
||||
.requiredOption('--enCode <code>', '模板编码')
|
||||
.option('--json', '原始 JSON 输出', false)
|
||||
.action(async (opts: CreateOpts) => {
|
||||
const c = await JnpfClient.fromToken()
|
||||
const body = {
|
||||
fullName: opts.fullName,
|
||||
enCode: opts.enCode,
|
||||
category: '1', // 1=系统 2=业务
|
||||
enabledMark: 1,
|
||||
sortCode: 0,
|
||||
}
|
||||
const r = await c.postJson<{ id?: string }>('/system/MessageTemplate', body)
|
||||
if (r.code !== 200) {
|
||||
log.error(`msg template-create 失败 (code=${r.code}): ${r.msg}`)
|
||||
process.exit(1)
|
||||
}
|
||||
let id = r.data?.id
|
||||
if (!id) {
|
||||
const listR = await c.get<{ list: { id: string; enCode: string; fullName: string }[] }>(
|
||||
'/system/MessageTemplate',
|
||||
{ keyword: opts.enCode, pageSize: '50' },
|
||||
)
|
||||
const found = (listR.data?.list || []).find(
|
||||
(d) => d.enCode === opts.enCode || d.fullName === opts.fullName,
|
||||
)
|
||||
id = found?.id
|
||||
}
|
||||
log.info(`✓ 消息模板创建成功 id=${id}`)
|
||||
if (opts.json) printJson({ ...(r.data as object), id })
|
||||
})
|
||||
installAiHelpHook(cmd, {
|
||||
purpose: '新建消息模板',
|
||||
required: { '--fullName': '模板名称', '--enCode': '模板编码' },
|
||||
example: 'dacli msg template-create --fullName=系统告警模板 --enCode=sys_alert',
|
||||
source: {
|
||||
web: 'web/apps/jnpf-web-apps-main/src/views/msgCenter/msgTemplate/Form.vue',
|
||||
api: 'POST /api/system/MessageTemplate',
|
||||
ref: 'doc/v0.8-endpoints.md §2.4',
|
||||
},
|
||||
})
|
||||
return cmd
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/**
|
||||
* commands/msg/template-list.ts — 消息模板列表
|
||||
*
|
||||
* API: GET /api/system/MessageTemplate
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { JnpfClient } from '../../core/client.ts'
|
||||
import { installAiHelpHook } from '../../core/help.ts'
|
||||
import { log, printJson } from '../../core/log.ts'
|
||||
|
||||
interface TemplateItem {
|
||||
id?: string
|
||||
fullName?: string
|
||||
enCode?: string
|
||||
category?: string
|
||||
enabledMark?: number
|
||||
}
|
||||
|
||||
interface ListOpts {
|
||||
keyword?: string
|
||||
json?: boolean
|
||||
}
|
||||
|
||||
export function buildMsgTemplateListCommand(): Command {
|
||||
const cmd = new Command('template-list')
|
||||
.description('列出消息模板 (站内信/邮件/短信/Webhook 模板)')
|
||||
.option('--keyword <k>', '按名称/编码模糊搜索')
|
||||
.option('--json', '原始 JSON 输出', false)
|
||||
.action(async (opts: ListOpts) => {
|
||||
const c = await JnpfClient.fromToken()
|
||||
// web msgTemplate.ts: Prefix = '/api/message/MessageTemplateConfig'
|
||||
const r = await c.get<{ list: TemplateItem[] }>('/message/MessageTemplateConfig', {
|
||||
keyword: opts.keyword,
|
||||
currentPage: 1,
|
||||
pageSize: 50,
|
||||
})
|
||||
if (r.code !== 200) {
|
||||
log.error(`msg template-list 失败 (code=${r.code}): ${r.msg}`)
|
||||
process.exit(1)
|
||||
}
|
||||
const list = r.data?.list || []
|
||||
if (opts.json) {
|
||||
printJson(r.data)
|
||||
return
|
||||
}
|
||||
log.info(`共 ${list.length} 个消息模板`)
|
||||
console.log('ID FULL_NAME ENCODE ENABLED')
|
||||
console.log('-'.repeat(85))
|
||||
for (const d of list) {
|
||||
const id = String(d.id || '').padEnd(30)
|
||||
const name = String(d.fullName || '').padEnd(23)
|
||||
const code = String(d.enCode || '').padEnd(21)
|
||||
const en = d.enabledMark === 1 ? '是' : '否'
|
||||
console.log(`${id}${name}${code}${en}`)
|
||||
}
|
||||
})
|
||||
installAiHelpHook(cmd, {
|
||||
purpose: '列出消息模板 (站内信/邮件/短信 模板)',
|
||||
optional: { '--keyword': '按名称/编码模糊搜索' },
|
||||
example: 'dacli msg template-list\ndacli msg template-list --keyword=告警',
|
||||
source: {
|
||||
web: 'web/apps/jnpf-web-apps-main/src/views/msgCenter/msgTemplate/index.vue',
|
||||
api: 'GET /api/message/MessageTemplateConfig',
|
||||
ref: 'doc/v0.8-endpoints.md §2.4',
|
||||
},
|
||||
})
|
||||
return cmd
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/**
|
||||
* commands/switch-app.ts — 切换 appCode (登录新 app 并覆盖 token)
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { JnpfClient } from '../core/client.ts'
|
||||
import { DEFAULT_ACCOUNT, DEFAULT_PASSWORD, loadToken } from '../core/config.ts'
|
||||
import { installAiHelpHook } from '../core/help.ts'
|
||||
import { log } from '../core/log.ts'
|
||||
|
||||
export function buildSwitchAppCommand(): Command {
|
||||
const cmd = new Command('switch-app')
|
||||
.description('切换当前应用 (重新登录新 appCode 并覆盖 token)')
|
||||
.requiredOption('--appCode <c>', '目标应用代码')
|
||||
.option('--account <a>', '账号')
|
||||
.option('--password <p>', '密码')
|
||||
.action(async (opts: { appCode: string; account?: string; password?: string }) => {
|
||||
const cached = loadToken()
|
||||
const c = await JnpfClient.login({
|
||||
account: opts.account || cached?.account || DEFAULT_ACCOUNT,
|
||||
password: opts.password || DEFAULT_PASSWORD,
|
||||
appCode: opts.appCode,
|
||||
baseUrl: cached?.baseUrl,
|
||||
forceLogin: true,
|
||||
})
|
||||
log.ok(`切换成功: ${c.account} @ ${c.appCode}`)
|
||||
log.dim(`dbLinkId : ${c.dbLinkId || '(unknown)'}`)
|
||||
})
|
||||
|
||||
installAiHelpHook(cmd, {
|
||||
purpose: '切换当前应用, 重新登录并覆盖本地 token. baseline 复刻常用',
|
||||
required: { '--appCode': '目标应用 (developSystem | workSystem | tds)' },
|
||||
example: ['dacli switch-app --appCode=developSystem', 'dacli switch-app --appCode=tds'],
|
||||
})
|
||||
|
||||
return cmd
|
||||
}
|
||||
@@ -9,13 +9,13 @@
|
||||
* list 列表
|
||||
* create 新建
|
||||
* delete 删除
|
||||
* reset-pwd 重置密码
|
||||
* resetpwd 重置密码
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { buildUserListCommand } from './list.ts'
|
||||
import { buildUserCreateCommand } from './create.ts'
|
||||
import { buildUserDeleteCommand } from './delete.ts'
|
||||
import { buildUserResetPwdCommand } from './reset-pwd.ts'
|
||||
import { buildUserResetPwdCommand } from './resetpwd.ts'
|
||||
|
||||
export function buildUserCommand(): Command {
|
||||
const cmd = new Command('user').description('用户 (P1 权限三角 2 号, 登录主体)')
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
/**
|
||||
* commands/user/reset-pwd.ts — 重置用户密码
|
||||
*
|
||||
* API: POST /api/permission/Users/{id}/Actions/ResetPassword
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { JnpfClient } from '../../core/client.ts'
|
||||
import { installAiHelpHook } from '../../core/help.ts'
|
||||
import { log } from '../../core/log.ts'
|
||||
import { encryptByMd5 } from '../../core/crypto.ts'
|
||||
|
||||
interface ResetPwdOpts {
|
||||
id: string
|
||||
password: string
|
||||
}
|
||||
|
||||
export function buildUserResetPwdCommand(): Command {
|
||||
const cmd = new Command('reset-pwd')
|
||||
.description('重置用户密码 (管理员操作)')
|
||||
.requiredOption('--id <id>', '用户 id')
|
||||
.requiredOption('--password <p>', '新明文密码 (后端会自动 md5 加密)')
|
||||
.action(async (opts: ResetPwdOpts) => {
|
||||
const c = await JnpfClient.fromToken()
|
||||
const r = await c.postJson(`/permission/Users/${opts.id}/Actions/ResetPassword`, {
|
||||
userPassword: encryptByMd5(opts.password),
|
||||
id: opts.id,
|
||||
})
|
||||
if (r.code !== 200) {
|
||||
log.error(`user reset-pwd 失败: ${r.msg}`)
|
||||
process.exit(1)
|
||||
}
|
||||
log.info(`✓ 用户 id=${opts.id} 密码已重置`)
|
||||
})
|
||||
installAiHelpHook(cmd, {
|
||||
purpose: '重置用户密码 (admin 操作)',
|
||||
required: { '--id': '用户 id', '--password': '新明文密码' },
|
||||
example: 'dacli user reset-pwd --id=1234567890 --password=newpass123',
|
||||
source: {
|
||||
web: 'web/apps/jnpf-web-apps-main/src/views/permission/user/Form.vue',
|
||||
api: 'POST /api/permission/Users/{id}/Actions/ResetPassword',
|
||||
ref: 'doc/v0.8-endpoints.md §2.2',
|
||||
},
|
||||
})
|
||||
return cmd
|
||||
}
|
||||
+3
-1
@@ -40,7 +40,9 @@ export function maybeInterceptAiHelp(program: Command): boolean {
|
||||
// 走命令树
|
||||
let cur: Command = program
|
||||
for (const p of path) {
|
||||
const sub = cur.commands.find((c) => c.name() === p)
|
||||
const sub = cur.commands.find(
|
||||
(c) => c.name() === p || (c.aliases() as string[]).includes(p),
|
||||
)
|
||||
if (!sub) break
|
||||
cur = sub
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* tests/e2e/baseline/developSystem/regression.spec.ts
|
||||
*
|
||||
* developSystem baseline 回归测试 (API 层 0 错):
|
||||
* - switch-app 切到 developSystem
|
||||
* - switchapp 切到 developSystem
|
||||
* - 拿 form list
|
||||
* - 对每张表单跑 info 验证 schema 完整
|
||||
* - 汇总 PASS / FAIL
|
||||
@@ -26,9 +26,9 @@ function dacli(args: string): string {
|
||||
|
||||
test.describe.configure({ mode: 'serial' })
|
||||
|
||||
test(`switch-app ${APP_CODE} 成功`, () => {
|
||||
// switch-app --force 在 client.ts:fromToken 里被读 forceLogin
|
||||
dacli(`switch-app --appCode=${APP_CODE}`)
|
||||
test(`switchapp ${APP_CODE} 成功`, () => {
|
||||
// switchapp --force 在 client.ts:fromToken 里被读 forceLogin
|
||||
dacli(`switchapp --appCode=${APP_CODE}`)
|
||||
const st = dacli(`status`)
|
||||
expect(st).toContain(APP_CODE)
|
||||
})
|
||||
@@ -82,7 +82,7 @@ test('每张 form info 都能拿到完整 schema', () => {
|
||||
})
|
||||
|
||||
test('workSystem form list 同样通 (真总数 85)', () => {
|
||||
dacli(`switch-app --appCode=workSystem`)
|
||||
dacli(`switchapp --appCode=workSystem`)
|
||||
const out = dacli(`form list --limit=200 --json`)
|
||||
const json = JSON.parse(out) as { list: FormRow[] }
|
||||
expect(json.list.length).toBeGreaterThanOrEqual(80)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* tests/e2e/baseline/workSystem/regression.spec.ts
|
||||
*
|
||||
* workSystem baseline 回归 (API 层 0 错):
|
||||
* - switch-app 切到 workSystem
|
||||
* - switchapp 切到 workSystem
|
||||
* - 拿 form list (真总数 85, v0.6 修 dacli list bug 前误报 52 是 /list 子端点强制 enableFlow=1 的子集)
|
||||
* - 对每张 form 跑 info 验证 schema 完整
|
||||
* - 汇总 PASS / FAIL
|
||||
@@ -25,8 +25,8 @@ function dacli(args: string): string {
|
||||
|
||||
test.describe.configure({ mode: 'serial' })
|
||||
|
||||
test(`switch-app ${APP_CODE} 成功`, () => {
|
||||
dacli(`switch-app --appCode=${APP_CODE}`)
|
||||
test(`switchapp ${APP_CODE} 成功`, () => {
|
||||
dacli(`switchapp --appCode=${APP_CODE}`)
|
||||
const st = dacli(`status`)
|
||||
expect(st).toContain(APP_CODE)
|
||||
})
|
||||
|
||||
@@ -35,7 +35,7 @@ describe('cli help', () => {
|
||||
const out = run(['--help'])
|
||||
expect(out).toContain('login')
|
||||
expect(out).toContain('status')
|
||||
expect(out).toContain('switch-app')
|
||||
expect(out).toContain('switchApp')
|
||||
expect(out).toContain('form')
|
||||
})
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/**
|
||||
* fix-columndata.test.ts — 验证 form columnData 4 个 use*Permission 字段补全
|
||||
* fixcolumndata.test.ts — 验证 form columnData 4 个 use*Permission 字段补全
|
||||
*
|
||||
* 盲点 23 闭环: v0.7.1 之前 form create 的 columnData 缺 useBtnPermission 等字段,
|
||||
* 后端 Jackson 反序列化为 null, Actions/Module 报 "System abnormality" (NPE 在
|
||||
* VisualUtil.setPcPermission line 139, .booleanValue() 解开 null)
|
||||
*
|
||||
* 此测试覆盖:
|
||||
* 1. form create --ai-help 应在可选参数提示 fix-columndata
|
||||
* 2. form --help 应列出 fix-columndata 子命令
|
||||
* 3. fix-columndata --ai-help 输出 markdown
|
||||
* 4. 实际 JNPF 平台 fix-columndata 跑通 (前提: 启了 JNPF + 有 form id)
|
||||
* 1. form create --ai-help 应在可选参数提示 fixcolumndata
|
||||
* 2. form --help 应列出 fixcolumndata 子命令
|
||||
* 3. fixcolumndata --ai-help 输出 markdown
|
||||
* 4. 实际 JNPF 平台 fixcolumndata 跑通 (前提: 启了 JNPF + 有 form id)
|
||||
*/
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { execFileSync } from 'node:child_process'
|
||||
@@ -32,19 +32,19 @@ function run(args: string[]): string {
|
||||
}
|
||||
}
|
||||
|
||||
describe('form fix-columndata (v0.7.1 盲点 23)', () => {
|
||||
it('form --help 列出 fix-columndata 子命令', () => {
|
||||
describe('form fixcolumndata (v0.7.1 盲点 23)', () => {
|
||||
it('form --help 列出 fixcolumndata 子命令', () => {
|
||||
const out = run(['form', '--help'])
|
||||
expect(out).toContain('fix-columndata')
|
||||
expect(out).toContain('fixcolumn')
|
||||
})
|
||||
|
||||
it('form fix-columndata --ai-help 输出 markdown 用法', () => {
|
||||
const out = run(['form', 'fix-columndata', '--ai-help'])
|
||||
it('form fixcolumndata --ai-help 输出 markdown 用法', () => {
|
||||
const out = run(['form', 'fixcolumn', '--ai-help'])
|
||||
expect(out).toMatch(/盲点 23|System abnormality|useBtnPermission|useColumnPermission/)
|
||||
})
|
||||
|
||||
it('form fix-columndata 缺 <id> 报错', () => {
|
||||
const out = run(['form', 'fix-columndata'])
|
||||
it('form fixcolumndata 缺 <id> 报错', () => {
|
||||
const out = run(['form', 'fixcolumn'])
|
||||
// commander 报 "missing required argument" 或类似
|
||||
expect(out.toLowerCase()).toMatch(/missing|required|error/)
|
||||
})
|
||||
|
||||
@@ -70,21 +70,21 @@ describe('log command tree (W12-D2)', () => {
|
||||
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')
|
||||
expect(out).toContain('emailTest')
|
||||
expect(out).toContain('smsTest')
|
||||
expect(out).toContain('webhookTest')
|
||||
})
|
||||
it('integration email-test --ai-help 提示决策 8', () => {
|
||||
const out = run(['integration', 'email-test', '--ai-help'])
|
||||
it('integration emailtest --ai-help 提示决策 8', () => {
|
||||
const out = run(['integration', 'emailTest', '--ai-help'])
|
||||
expect(out).toContain('决策 8')
|
||||
expect(out).toContain('邮件')
|
||||
})
|
||||
it('integration sms-test --help 包含 --phone', () => {
|
||||
const out = run(['integration', 'sms-test', '--help'])
|
||||
it('integration smstest --help 包含 --phone', () => {
|
||||
const out = run(['integration', 'smsTest', '--help'])
|
||||
expect(out).toContain('--phone')
|
||||
})
|
||||
it('integration webhook-test --help 包含 --url/--payload', () => {
|
||||
const out = run(['integration', 'webhook-test', '--help'])
|
||||
it('integration webhooktest --help 包含 --url/--payload', () => {
|
||||
const out = run(['integration', 'webhookTest', '--help'])
|
||||
expect(out).toContain('--url')
|
||||
expect(out).toContain('--payload')
|
||||
})
|
||||
|
||||
@@ -61,7 +61,7 @@ describe('user command tree (W10-D2)', () => {
|
||||
expect(out).toContain('list')
|
||||
expect(out).toContain('create')
|
||||
expect(out).toContain('delete')
|
||||
expect(out).toContain('reset-pwd')
|
||||
expect(out).toContain('resetPwd')
|
||||
})
|
||||
it('user list --ai-help 提示决策 7', () => {
|
||||
const out = run(['user', 'list', '--ai-help'])
|
||||
@@ -73,8 +73,8 @@ describe('user command tree (W10-D2)', () => {
|
||||
expect(out).toContain('--organizeId')
|
||||
expect(out).toContain('--gender')
|
||||
})
|
||||
it('user reset-pwd --help 包含 --password', () => {
|
||||
const out = run(['user', 'reset-pwd', '--help'])
|
||||
it('user resetpwd --help 包含 --password', () => {
|
||||
const out = run(['user', 'resetPwd', '--help'])
|
||||
expect(out).toContain('--password')
|
||||
})
|
||||
it('顶层 --help 包含 user', () => {
|
||||
|
||||
Reference in new issue
Block a user