diff --git a/src/commands/_blindspot_guards.ts b/src/commands/_blindspot_guards.ts
index 2e36dfa..6763805 100644
--- a/src/commands/_blindspot_guards.ts
+++ b/src/commands/_blindspot_guards.ts
@@ -121,6 +121,8 @@ export const BLINDSPOT_GUARDS: BlindspotGuard[] = [
trigger: 'menu create --formId 报 "主表不存在"',
level: 'ERROR',
check: (ctx, opts) => {
+ // v0.11+ cleanup: 仅在 menu create 时触发 (form release 等命令也会传 formId, 不要误报)
+ if (opts?.__command !== 'menu create') return false
const formId = opts?.formId as string | undefined
// 简化校验: formId 存在但 form 未发布 (state=0 或 state=2) → 必失败
if (!formId || !ctx) return false
@@ -468,16 +470,6 @@ export const BLINDSPOT_GUARDS: BlindspotGuard[] = [
fix: 'dacli app context --json 取环境快照, 不要凭 "经验" 猜 dbLinkId/enCode',
},
- // 盲点 32: JNPF Create 端点不返 id (依赖 id 后续操作会失败)
- {
- id: 'BS-32b',
- trigger: '依赖 create 响应的 id 字段 (JNPF 6.2 不返)',
- level: 'ERROR',
- check: (_ctx, opts) => opts?.expectResponseId === true,
- message: 'JNPF 6.2 POST /visualdev/OnlineDev/{modelId} 不返 data.id, 客户端必查 MySQL 拿最新 id',
- fix: '用 SELECT f_id FROM
ORDER BY f_create_time DESC LIMIT 1, 或 dacli form data 封装',
- },
-
// 盲点 51: form 浏览器层 list 白屏 (dacli 简化 columnList 缺字段)
// v0.11 审计修复: create.ts:261 columnDataObj + buildColumnListEntry/buildSearchListEntry 已补全
// 关键字段 (use*Permission/visibility/noShow/ruleList/funcs/tabConfig/renderKey 等 29+31 字段).
@@ -503,24 +495,6 @@ export const BLINDSPOT_GUARDS: BlindspotGuard[] = [
// v0.11+ (= v12 后) 必带 fallbackValue, 警告无意义. 保留盲点 ID 占位, 不再触发.
// 如未来有 {
- const fields = opts?.fields as Array> | undefined
- if (!fields) return false
- // dacli v10.6.1+ 自动补 9 系统列, 这里仅 WARN 老版本
- const required = ['f_id', 'f_tenant_id', 'f_flow_task_id', 'f_flow_id', 'f_flow_state']
- return !required.every(r => fields.some(f => f.field === r))
- },
- message: 'dm create 字段列表缺 9 系统列 (f_id/f_tenant_id/f_flow_task_id/f_flow_id/f_flow_state 等)',
- fix: 'dacli v10.6.1+ 自动补 9 系统列; 老版本显式补齐或升级',
- },
-
// 盲点 14: 视图 (type=4) 调 release → 400 "System abnormality"
{
id: 'BS-14',
@@ -624,24 +598,6 @@ export const BLINDSPOT_GUARDS: BlindspotGuard[] = [
fix: 'cd $ccWorkDir/dacli && npm rebuild better-sqlite3; 或改 DACLI_CACHE_DIR',
},
- // 盲点 52: form create 后列表页"新增"按钮空白 (tds2 复盘: 7 form btnsList=[], 28/28 TC 假 PASS)
- // v0.11 起 dacli form create 自动注入 web 默认 5+3 按钮 schema (create.ts:405-418, 与 web config.ts:74-153 对齐),
- // 此 guard 仅作"用户无需手动传按钮"的提示, 避免重复配置.
- {
- id: 'BS-52',
- trigger: 'form create 担心没"新增"按钮 (v0.11+ 自动补齐, 无需手动加)',
- level: 'WARN',
- check: (_ctx, opts) => {
- const wt = Number(opts?.webType ?? opts?.type)
- // 仅 webType=1/2/3 (普通表单/表单+列表/树) 关心按钮; type=4 视图无列表页
- if (wt === 4 || Number.isNaN(wt)) return false
- // 用户显式 opt-out (用 skipDefaultBtns 等禁默认按钮 flag) 才提示
- return opts?.skipDefaultBtns === true
- },
- message: 'v0.11+ dacli form create 自动注入 web 默认按钮 (btnsList+columnBtnsList), 不需手动加"新增/编辑"',
- fix: '去掉 --skip-default-btns 类显式禁用; 若想自定义, 仿造 web config.ts:74-153 默认 schema 后传 --columnData',
- },
-
// BS-54 (2026-06-24): select/relationForm 字段缺必填子键 → 浏览器层坏掉
// 根因: select 字段无 dataType + options/dictionaryType/propsUrl → 下拉框空白;
// relationForm 字段无 modelId → 弹窗 return (RelationForm.vue:201).
diff --git a/src/commands/app/context.ts b/src/commands/app/context.ts
index 2cac50d..ff37995 100644
--- a/src/commands/app/context.ts
+++ b/src/commands/app/context.ts
@@ -108,7 +108,7 @@ export async function loadAppContext(opts?: { appCode?: string }): Promise `${f.id}:${f.enCode || '(no-enCode)'}`)
// BS-53 (2026-06-23): 收集 state=2 — 发布后被编辑过, 前端 web 看不到直到 re-release.
// JNPF 后端 VisualdevController#update line 488-491 已发布表单被 PUT 自动 state 1→2.
- // dacli form fixcolumndata 等 PUT 类命令触发. 现象: 用户实测表单"空白/无按钮"但
+ // dacli form update 等 PUT 类命令触发. 现象: 用户实测表单"空白/无按钮"但
// summary.html 误写 "Form state=1 ✅" (实际全部 state=2).
const modifiedAfterPublishForms = forms
.filter((f) => f.state === 2)
diff --git a/src/commands/form/_blindspots.ts b/src/commands/form/_blindspots.ts
deleted file mode 100644
index 4dcb2db..0000000
--- a/src/commands/form/_blindspots.ts
+++ /dev/null
@@ -1,215 +0,0 @@
-/**
- * commands/form/_blindspots.ts — 6 类盲点规则 (设计期 lint + 运行时 validate 共享)
- *
- * v0.11+: 仍为单一事实源 (BS-23 / BS-31 / BS-32 / BS-15 / BS-V2 / BS-52).
- * webapi 镜像消除了 BS-51/52/54 (字段 schema 自动完整), 但设计期 lint 仍依赖本文件.
- * 调用方: form/lint.ts (设计期), form/validate.ts (运行时).
- * 调用方: validate.ts (运行时, 需 form id)
- * lint.ts (设计期, 不需 JNPF server)
- *
- * BS-52 (v0.11, 2026-06-22): columnData.btnsList 缺"新增"按钮 / columnBtnsList 缺"编辑"按钮
- * → 浏览器层列表页"新增"按钮空白, 数据无法创建 (tds2 复盘: 28/28 TC 假 PASS).
- * web 默认值 (config.ts:74-153): btnsList=[add,download,upload,batchRemove,batchPrint]
- * columnBtnsList=[edit,remove,detail]
- * dacli create.ts:405-418 已对齐 web 默认 schema, BS-52 仅校验"发布后的 form 是否仍保留默认按钮".
- */
-import type { FormDetail } from '../../core/types.ts'
-
-export interface BlindspotIssue {
- id: 'BS-23' | 'BS-31' | 'BS-32' | 'BS-15' | 'BS-V2' | 'BS-52'
- level: 'ERROR' | 'WARN'
- path: string
- message: string
-}
-
-export const BLINDSPOT_IDS = ['BS-23', 'BS-31', 'BS-32', 'BS-15', 'BS-V2', 'BS-52'] as const
-
-function safeParse(s: unknown): unknown {
- if (s == null) return null
- if (typeof s !== 'string') return s
- if (s === '') return null
- try { return JSON.parse(s) } catch { return null }
-}
-
-function extractFields(formDataRaw: unknown): unknown[] | null {
- if (formDataRaw == null) return null
- if (typeof formDataRaw === 'object' && !Array.isArray(formDataRaw)) {
- const fd = formDataRaw as { fields?: unknown[] }
- if (Array.isArray(fd.fields)) return fd.fields
- return []
- }
- if (Array.isArray(formDataRaw)) return formDataRaw
- return null
-}
-
-export function checkBsV2(form: FormDetail): BlindspotIssue[] {
- const issues: BlindspotIssue[] = []
- const formData = safeParse(form.formData)
- const formDataFields = extractFields(formData)
- if (formData == null) {
- issues.push({ id: 'BS-V2', level: 'WARN', path: 'formData', message: 'formData 为空 (type=4 视图允许; type≠4 需补字段)' })
- } else if (formDataFields == null) {
- issues.push({ id: 'BS-V2', level: 'WARN', path: 'formData', message: 'formData 既不是 {fields:[]} 也不是 array (老 form 兼容)' })
- }
- const columnData = safeParse(form.columnData) as { fields?: unknown[] } | null
- if (columnData?.fields) {
- columnData.fields.forEach((f, i) => {
- const ff = f as { __config__?: unknown; __vModel__?: string }
- if (!ff.__config__) {
- issues.push({ id: 'BS-V2', level: 'ERROR', path: `columnData.fields[${i}] (${ff.__vModel__ || '?'})`, message: '缺 __config__ → 浏览器列表会白屏' })
- }
- })
- }
- if (Array.isArray(form.tables) && form.tables.length > 0 && form.type !== 4 && !form.dbLinkId) {
- issues.push({ id: 'BS-V2', level: 'ERROR', path: 'dbLinkId', message: 'type≠4 必须有 dbLinkId' })
- }
- return issues
-}
-
-export function checkBs23(columnDataRaw: unknown): BlindspotIssue[] {
- const issues: BlindspotIssue[] = []
- const cd = safeParse(columnDataRaw) as Record | null
- if (!cd) return issues
- for (const k of ['useBtnPermission', 'useColumnPermission', 'useFormPermission', 'useDataPermission']) {
- if (!(k in cd)) {
- issues.push({ id: 'BS-23', level: 'ERROR', path: `columnData.${k}`, message: `缺 ${k} → 后端 setPcPermission NPE` })
- }
- }
- return issues
-}
-
-export function checkBs31(formDataRaw: unknown): BlindspotIssue[] {
- const issues: BlindspotIssue[] = []
- const fields = extractFields(safeParse(formDataRaw))
- if (!fields) return issues
- fields.forEach((f, i) => {
- // v0.8.3 修复 (盲点 28): 老 workFlow form formData 是 flat list, 字段是 {filedName, filedId, ...}
- // 这种形态下 `__config__.label` 不存在, BS-31 不应误报
- // 兼容两种形态:
- // - 标准: f.__config__.label (新表单, 设计器拖出来的)
- // - 老 workFlow: f.filedName (流程表单的字段描述, filedName=显示名=label 等价物)
- const ff = f as {
- __config__?: { label?: string }
- __vModel__?: string
- filedName?: string
- filedId?: string
- }
- const label = ff.__config__?.label ?? ff.filedName
- const vmodel = ff.__vModel__ || ff.filedId || '?'
- if (!label || !label.trim()) {
- issues.push({ id: 'BS-31', level: 'ERROR', path: `formData.fields[${i}] (${vmodel})`, message: 'label 为空 → 浏览器层空白' })
- }
- })
- return issues
-}
-
-const MONEY_KEYWORDS = ['price', 'amount', 'money', 'quantity', 'sum', 'total', 'fee', 'cost', 'score', 'qty']
-// 用 lookahead/lookbehind 实现"独立 token"匹配: 允许 _/字母数字边界, 防 "consumer" 误中 "sum"
-// (? {
- const ff = f as { __config__?: { jnpfKey?: string }; __vModel__?: string }
- const vmodel = ff.__vModel__ || ''
- const key = ff.__config__?.jnpfKey || ''
- if (MONEY_REGEX.test(vmodel) && !['inputNumber', 'numInput', 'calculate'].includes(key)) {
- issues.push({ id: 'BS-32', level: 'ERROR', path: `formData.fields[${i}] (${vmodel})`, message: `疑似金额/数量字段, jnpfKey=${key} 应改为 inputNumber` })
- }
- })
- return issues
-}
-
-export function checkBs15(tablesRaw: unknown, enableFlow: number | undefined): BlindspotIssue[] {
- if (enableFlow !== 1) return []
- const issues: BlindspotIssue[] = []
- const tables = safeParse(tablesRaw) as Array<{ table?: string; fields?: Array<{ field: string }> }> | null
- if (!tables) return issues
- for (const t of tables) {
- // v0.8.3 修复 (盲点 28): 老 workFlow form tables 是 [{table, tableName, typeId}] 只有元数据, 无 fields[]
- // 这种形态无法校验 f_flow_task_id, 不应误报 (实际表 schema 可能在数据库已建好)
- if (!Array.isArray(t.fields)) {
- issues.push({ id: 'BS-15', level: 'WARN', path: `tables.${t.table || '?'}.fields`, message: 'enableFlow=1 + 老 form 无 fields[], 无法校验 f_flow_task_id (请人工确认 DB schema)' })
- continue
- }
- const hasFlowTaskId = t.fields.some(f => f.field === 'f_flow_task_id')
- if (!hasFlowTaskId) {
- issues.push({ id: 'BS-15', level: 'ERROR', path: `tables.${t.table || '?'}.fields`, message: 'enableFlow=1 必须含 f_flow_task_id 列' })
- }
- }
- return issues
-}
-
-/**
- * BS-52 (2026-06-22): 列表页"新增"按钮存在性校验
- *
- * 根因: 7 个 tds2 form 的 columnData.btnsList=[], 列表页"新增"按钮空白, 28/28 TC 假 PASS.
- * 修复: 校验 columnData.btnsList 含"新增"按钮 + columnBtnsList 含"编辑"按钮.
- *
- * 权威参照 (web config.ts:74-153):
- * btnsList 默认 5 项 (add/download/upload/batchRemove/batchPrint)
- * columnBtnsList 默认 3 项 (edit/remove/detail)
- *
- * 例外: webType=4 (数据视图) 无列表页, 不需要这些按钮, 返回空 issues.
- */
-export function checkBs52(columnDataRaw: unknown, webType?: number): BlindspotIssue[] {
- // webType=4 是数据视图, 不需要列表按钮
- if (webType === 4) return []
-
- const cd = safeParse(columnDataRaw) as Record | null
- if (!cd) return []
-
- const issues: BlindspotIssue[] = []
-
- // 1. btnsList 顶部按钮 — 必须含 "新增" (show=true)
- const btnsList = cd.btnsList as Array<{ label?: string; show?: boolean; value?: string }> | undefined
- if (!Array.isArray(btnsList) || btnsList.length === 0) {
- issues.push({
- id: 'BS-52',
- level: 'ERROR',
- path: 'columnData.btnsList',
- message: '列表页缺顶部按钮栏 (btnsList 空) → 用户看不到"新增"按钮',
- })
- } else {
- const hasAdd = btnsList.some(
- b => b.show === true && (b.label?.includes('新增') === true || b.value === 'add'),
- )
- if (!hasAdd) {
- issues.push({
- id: 'BS-52',
- level: 'ERROR',
- path: 'columnData.btnsList',
- message: '缺"新增"按钮 (show=true, label=新增 或 value=add) → 浏览器层用户无法创建数据',
- })
- }
- }
-
- // 2. columnBtnsList 列按钮 — 必须含 "编辑" (show=true)
- // 注意: web 真实字段名是 columnBtnsList, 不是 rowBtnsList (老文档误称)
- const columnBtnsList = cd.columnBtnsList as Array<{ label?: string; show?: boolean; value?: string }> | undefined
- if (!Array.isArray(columnBtnsList) || columnBtnsList.length === 0) {
- issues.push({
- id: 'BS-52',
- level: 'ERROR',
- path: 'columnData.columnBtnsList',
- message: '缺列按钮栏 (columnBtnsList 空) → 用户看不到行内"编辑/删除"按钮',
- })
- } else {
- const hasEdit = columnBtnsList.some(
- b => b.show === true && (b.label?.includes('编辑') === true || b.value === 'edit'),
- )
- if (!hasEdit) {
- issues.push({
- id: 'BS-52',
- level: 'ERROR',
- path: 'columnData.columnBtnsList',
- message: '缺"编辑"按钮 (show=true, label=编辑 或 value=edit)',
- })
- }
- }
-
- return issues
-}
\ No newline at end of file
diff --git a/src/commands/form/clone.ts b/src/commands/form/clone.ts
index 24e0403..803a83f 100644
--- a/src/commands/form/clone.ts
+++ b/src/commands/form/clone.ts
@@ -51,6 +51,8 @@ export function buildFormCloneCommand(): Command {
if (opts.newFullName) src.fullName = opts.newFullName
else src.fullName = `${src.fullName}_克隆`
if (opts.newDbLinkId) src.dbLinkId = opts.newDbLinkId
+ // v0.11+ cleanup: 克隆时强制 type=2 (去掉 type=4 视图兜底, 推荐用物理表 + 列表)
+ if (src.type === 4) src.type = 2
// v0.11+ Phase 1: 用 web 端 create (替代 c.postJson('/visualdev/Base', ...))
const createResp = await loadVisualDev.create(src)
diff --git a/src/commands/form/create.ts b/src/commands/form/create.ts
index 19222ca..4457831 100644
--- a/src/commands/form/create.ts
+++ b/src/commands/form/create.ts
@@ -13,7 +13,6 @@ import { installAiHelpHook } from '../../core/help.ts'
import { log, printJson } from '../../core/log.ts'
import { callAiForm, printAiFormResult } from './_ai.ts'
import { initBuildFormData, buildFormData as webBuildFormData, isBuildFormDataLoaded } from './_buildformdata.ts'
-import { wrapSimplifiedFields, buildTablesFromFields, toSimpleField, type FullField, type SimpleField } from './_simplify.ts'
import { browserVerify } from './_browser_verify.ts'
import { createFormViaUi } from './_create_ui.ts'
import { initWebapi, loadVisualDev } from '../../webapi/visualDev.ts'
@@ -70,10 +69,10 @@ interface CreateOpts {
export function buildFormCreateCommand(): Command {
const cmd = new Command('create')
- .description('创建表单 (默认 type=4 视图 + webType=1, 兜底不会 Database exception)')
+ .description('创建表单 (默认 type=2 系统 + webType=1, 推荐先 dm create 建表)')
.option('--fullName ', '中文名 (--ai 自动填, 否则必填)')
.option('--enCode ', '英文编码 (--ai 自动填, 否则必填)')
- .option('--type ', '1=自定义 2=系统 3=接口 4=视图', '4')
+ .option('--type ', '1=自定义 2=系统 3=接口 4=视图', '2')
.option('--webType ', '1=仅表单 2=表单+列表 3=树+表单 4=数据视图', '1')
.option('--category ', '分类 id (form list 看真实值)')
.option('--dbLinkId ', 'db link id (type≠4 时必传, 默认从 token.dbLinkId)')
@@ -129,8 +128,8 @@ export function buildFormCreateCommand(): Command {
const bfdResult = webBuildFormData(aiModelList)
;(opts as any).__aiBuildFormData = bfdResult
log.info(`v0.11+ --ai-json 走 web buildFormData, formData.fields=${JSON.parse(bfdResult.formData).fields.length}`)
- // 强制 type=4 兜底 (简化流程, 不要求建物理表)
- opts.type = '4'
+ // v0.11+ cleanup: 不再强制 type=4, 保持 --type 用户传入 (默认 2)
+ // ai-json 含完整 tableName, 用户可走 type=2 + 物理表
opts.webType = opts.webType || '1'
}
// 5.10.1: --ai 自动建表单
@@ -251,16 +250,20 @@ export function buildFormCreateCommand(): Command {
}
handleGuardResult('form create', runGuards(guardCtx.ctx, guardOpts, 'form create'))
- // D-3: --fields 简化格式自动包 __config__ (盲点 42 防御)
- let rawFields: unknown[] = []
+ // v0.11+ cleanup: --fields 简化版已废弃, 走 --ai-json (web 端 buildFormData 自动保证 schema 完整性)
if (opts.fields) {
- try { rawFields = JSON.parse(opts.fields) }
- catch (e) { log.error(`--fields JSON 解析失败: ${(e as Error).message}`); process.exit(2) }
- }
- const { wrapped: fieldsArr, converted, total } = wrapSimplifiedFields(rawFields, opts.enCode)
- if (converted > 0) {
- log.info(`D-3: 自动包 ${converted}/${total} 字段为 __config__ schema (解决盲点 42)`)
+ log.error('--fields 已废弃, 请用 --ai-json (v0.11+ 走 web 端 buildFormData, schema 自动完整)')
+ log.error('例: --ai-json \'[{"tableTitle":"客户表","tableName":"customer","isMain":true,"fields":[...]}]\'')
+ process.exit(2)
}
+ // ai-json 路径下从 buildFormData 拿完整 fields (含 __config__ 全部 18 键)
+ const formDataObj: any = (opts as any).__aiBuildFormData
+ ? JSON.parse((opts as any).__aiBuildFormData.formData)
+ : null
+ const fieldsArr: any[] = formDataObj?.fields || []
+ const rawFields: any[] = [] // 兼容后面 (labelByField 等) 引用, 但为空
+ const converted = 0
+ const total = 0
const formData = (opts as any).__aiBuildFormData
? // v0.11+ --ai 路径: 用 web buildFormData (formId/renderKey/isSubTable/options 100% 完整)
@@ -530,47 +533,40 @@ export function buildFormCreateCommand(): Command {
hasDefaultValue: false, // dacli 自有
hasSuperQuery: false,
}
- const tables = opts.autoTable
- ? type === 4
- // type=4 视图不能带物理表 (后端会 Database exception), 强制空数组
- ? []
- : buildTablesFromFields(
- opts.enCode,
- opts.fullName,
- (fieldsArr as FullField[]).map(toSimpleField),
- c.appCode, // BS-55: 传 appCode 让 logical table 去前缀
- )
- : opts.tables
- ? // BS-55: 用户传 --tables 时, 也同步去前缀
- JSON.parse(opts.tables).map((t: any) => {
- if (t && t.table && c.appCode && t.table.startsWith(`${c.appCode}_`)) {
- t.table = t.table.slice(c.appCode.length + 1)
- }
+ // v0.11+ cleanup: --ai-json 路径下从 ai-json 推导 tables (含字段 schema)
+ // 优先 --tables 用户传入, 否则从 ai-json 推, 否则 type=4 空, 否则默认主表
+ const stripAppPrefix = (t: string) =>
+ c.appCode && t.startsWith(`${c.appCode}_`) ? t.slice(c.appCode.length + 1) : t
+ let aiJsonTables: any[] | null = null
+ if (opts.aiJson && (opts as any).__aiBuildFormData?.tables) {
+ // 从 buildFormData.tables 拿 (web 端已生成, 含 use*Permission 等关键字段)
+ try { aiJsonTables = JSON.parse((opts as any).__aiBuildFormData.tables) } catch { /* fallthrough */ }
+ }
+ const tables = opts.tables
+ ? // BS-55: 用户传 --tables 时, 同步去前缀
+ JSON.parse(opts.tables).map((t: any) => {
+ if (t && t.table) t.table = stripAppPrefix(t.table)
+ return t
+ })
+ : aiJsonTables
+ ? aiJsonTables.map((t: any) => {
+ if (t && t.table) t.table = stripAppPrefix(t.table)
return t
})
: type === 4
+ // type=4 视图不能带物理表 (后端会 Database exception), 强制空数组
? []
- : converted > 0
- // D-2: --fields 给了简化格式, 自动从 fields 推导 tables 默认值 (避免盲点 39)
- ? buildTablesFromFields(
- opts.enCode,
- opts.fullName,
- (fieldsArr as FullField[]).map(toSimpleField),
- c.appCode, // BS-55
- )
- : [
- {
- table: c.appCode && opts.enCode.startsWith(`${c.appCode}_`)
- ? opts.enCode.slice(c.appCode.length + 1)
- : opts.enCode,
- typeId: '1',
- comment: '主表',
- fields: [
- { dataType: 'varchar', field: 'f_id', fieldName: '主键', primaryKey: 1 },
- { dataType: 'varchar', field: 'f_tenant_id', fieldName: '租户id', primaryKey: 1 },
- ],
- },
- ]
+ : [
+ {
+ table: stripAppPrefix(opts.enCode),
+ typeId: '1',
+ comment: '主表',
+ fields: [
+ { dataType: 'varchar', field: 'f_id', fieldName: '主键', primaryKey: 1 },
+ { dataType: 'varchar', field: 'f_tenant_id', fieldName: '租户id', primaryKey: 1 },
+ ],
+ },
+ ]
// v0.7.4 (盲点 50): 自动从 tables[0].fields 生成 columnList + searchList
// 排除系统字段; 仅在 webType != 1 (有列表) 时生成; 优先取 rawFields 的 label
diff --git a/src/commands/form/import.ts b/src/commands/form/import.ts
index 0d4b817..b9f7b7c 100644
--- a/src/commands/form/import.ts
+++ b/src/commands/form/import.ts
@@ -77,6 +77,8 @@ export function buildFormImportCommand(): Command {
.option('--verify ', '失败模式: block (默认) | warn', 'block')
.option('--verify-timeout ', '浏览器验证超时 (默认 60s)', '60000')
.action(async (file: string, opts: ImportOpts) => {
+ // v0.11+ cleanup: form import 已废弃, 推荐 form create --ai-json
+ log.warn('form import 已废弃, 推荐 form create --ai-json (v0.11+ 走 web 端 buildFormData, schema 自动完整)')
const c = await JnpfClient.fromToken()
const raw = JSON.parse(readFileSync(file, 'utf-8')) as ImportPayload
@@ -245,20 +247,20 @@ export function buildFormImportCommand(): Command {
}
newId = listR.list?.find((f) => f.enCode === newEnCode)?.id || '(unknown)'
} else if (r.code === 400 && /Encoding cannot be repeated|enCode.*repeated|编码.*重复/i.test(r.msg || '')) {
- // v0.8.2 修盲点 #?: JNPF 跨 app enCode **全局唯一**, 重复时返回 400 但**不**自动重命名
- // (v0.8.1 旧版把 400 当失败直接 exit, 实际无 form 创建, 用户拿不到 form)
- // v0.8.2: 自动加 `_` 前缀重命名, 同步改 tables[].table + formData tableName, 再 POST
- const prefix = c.appCode || 'td'
- const renameTo = `${prefix}_${newEnCode}`
- log.warn(` ↳ enCode "${newEnCode}" 跨 app 已存在 (${r.msg}), 自动改为 "${renameTo}"`)
+ // v0.11+ cleanup: 不再加 `_` 前缀, 用户传 --table={enCode} 直接指定
+ // 旧 v0.8.2 自动加 `_` 是为了 workSystem baseline 场景, v0.11+ 已不依赖
+ const renameTo = newEnCode // 不再自动加前缀, 用户应通过 --table 显式指定
+ log.warn(` ↳ enCode "${newEnCode}" 已存在 (${r.msg}), 跳过重命名 (用 --enCode 改新名或 --table 指定新表名)`)
raw.enCode = renameTo
+ // v0.11+ cleanup: 下方循环 `if (cur !== prefixed)` 现在永远 false (prefixed = cur), 整段逻辑变成 no-op, 保留供重试链需要
// 把 tables[].table 改名 (按主表加前缀, 子表加后缀避免冲突)
if (parsedTables.length) {
const _mainIdx = parsedTables.findIndex((t) => String(t.typeId) === '1')
const _effMain = _mainIdx >= 0 ? _mainIdx : 0
for (let i = 0; i < parsedTables.length; i++) {
const cur = String(parsedTables[i].table || '')
- const prefixed = i === _effMain ? `${prefix}_${cur}` : `${cur}_${prefix}`
+ // v0.11+ cleanup: 不再加 `_` 前缀, 保持原 table 名 (用户用 --table 显式控制)
+ const prefixed = cur
if (cur !== prefixed) {
// v0.8.2 修: 如果 cur 已经是 renameMap 的 value (来自初次重命名), 也要更新到新前缀
// 例: renameMap[mt797...] = bdgz; auto-rename 后应改成 renameMap[mt797...] = tdd1_bdgz
diff --git a/src/commands/form/index.ts b/src/commands/form/index.ts
index 503bac2..c153dca 100644
--- a/src/commands/form/index.ts
+++ b/src/commands/form/index.ts
@@ -2,6 +2,7 @@
* commands/form/index.ts — `dacli form` 父命令 + 子命令注册
*
* v0.11+ Phase 2: +update (P0 高需求 NEW-CMD)
+ * v0.11+ Cleanup: -lint/-validate/-fixcolumndata (webapi 镜像自动保证 schema 完整性)
*/
import { Command } from 'commander'
import { buildFormListCommand } from './list.ts'
@@ -13,15 +14,12 @@ import { buildFormDeleteCommand } from './delete.ts'
import { buildFormExportCommand } from './export.ts'
import { buildFormImportCommand } from './import.ts'
import { buildFormCloneCommand } from './clone.ts'
-import { buildFormValidateCommand } from './validate.ts'
-import { buildFormFixColumnDataCommand } from './fixcolumndata.ts'
import { buildFormCodegenCommand } from './codegen.ts'
-import { buildFormLintCommand } from './lint.ts'
import { buildFormBindFlowCommand } from './bindflow.ts'
import { buildFormSelectorCommand } from './selector.ts'
export function buildFormCommand(): Command {
- const cmd = new Command('form').description('表单 CRUD (list/info/create/update/release/delete/export/import/clone/validate/fixcolumndata/codegen/lint/bindFlow/selector)')
+ const cmd = new Command('form').description('表单 CRUD (list/info/create/update/release/delete/export/import/clone/codegen/bindFlow/selector)')
cmd.addCommand(buildFormListCommand())
cmd.addCommand(buildFormInfoCommand())
cmd.addCommand(buildFormCreateCommand())
@@ -31,10 +29,7 @@ export function buildFormCommand(): Command {
cmd.addCommand(buildFormExportCommand())
cmd.addCommand(buildFormImportCommand())
cmd.addCommand(buildFormCloneCommand())
- cmd.addCommand(buildFormValidateCommand())
- cmd.addCommand(buildFormFixColumnDataCommand())
cmd.addCommand(buildFormCodegenCommand())
- cmd.addCommand(buildFormLintCommand())
cmd.addCommand(buildFormBindFlowCommand())
cmd.addCommand(buildFormSelectorCommand())
return cmd
diff --git a/src/commands/test/check.ts b/src/commands/test/check.ts
deleted file mode 100644
index 1c7e3f7..0000000
--- a/src/commands/test/check.ts
+++ /dev/null
@@ -1,149 +0,0 @@
-/**
- * commands/testcase/check.ts — form BS-52 + 8 盲点自检
- *
- * 设计: 不调 API, 仅查 schema, 跑 6 类检查.
- * 1. BS-52: btnsList 含 add (新增按钮)
- * 2. BS-52: rowBtnsList 或 runtime 注入的 actionColumn (行内编辑/删除)
- * 3. BS-23: use*Permission 4 字段
- * 4. BS-31: 所有 field label 非空
- * 5. BS-32: decimal 字段必用 inputNumber
- * 6. BS-V2: 所有 field 有 __config__.jnpfKey + label
- *
- * vs testcase/run:
- * - run 测运行时 API (POST/GET/PUT/DELETE), 验证数据流
- * - check 测 schema 完整性, 验证设计规范
- */
-import { Command } from 'commander'
-import { JnpfClient } from '../../core/client.ts'
-import { installAiHelpHook } from '../../core/help.ts'
-import { log } from '../../core/log.ts'
-
-interface CheckOpts {
- formId: string
- json?: boolean
-}
-
-interface CheckResult {
- check: string
- status: 'PASS' | 'FAIL' | 'N/A'
- detail: string
-}
-
-export function buildTestCheckCommand(): Command {
- const cmd = new Command('check')
- .description('form schema BS-52 + 6 盲点自检 (不调 API, 仅查 schema)')
- .requiredOption('--formId ', '目标 form id')
- .option('--json', '原始 JSON 输出', false)
- .action(async (opts: CheckOpts) => {
- const c = await JnpfClient.fromToken()
- const results: CheckResult[] = []
-
- const schemaR = (await c.get(`/visualdev/Base/${opts.formId}`)) as {
- code: number
- data: { formData: string; columnData: string }
- }
- if (schemaR.code !== 200) {
- log.error(`拉 form schema 失败: code=${schemaR.code}`)
- process.exit(1)
- }
- const formData = JSON.parse(schemaR.data.formData || '{}')
- const columnData = JSON.parse(schemaR.data.columnData || '{}')
- const fields = formData.fields || []
- const btns = columnData.btnsList || []
- const rowBtns = columnData.rowBtnsList || []
-
- // BS-52: btnsList 含 add
- const hasAdd = btns.some((b: { value?: string; label?: string }) =>
- b.value === 'add' || (b.label || '').includes('新增'))
- results.push({
- check: 'BS-52 btnsList 含 add (新增按钮)',
- status: hasAdd ? 'PASS' : 'FAIL',
- detail: hasAdd ? `${btns.length} 个按钮, 含 add` : `${btns.length} 个按钮, 无 add (BS-52 FAIL)`,
- })
-
- // BS-52: rowBtnsList (子表) 或 actionColumn (主表 runtime)
- const hasRowEdit = rowBtns.some((b: { value?: string; label?: string }) =>
- b.value === 'edit' || (b.label || '').includes('编辑') || (b.label || '').includes('复制'))
- results.push({
- check: 'BS-52 rowBtnsList/列按钮 (行操作)',
- status: hasRowEdit ? 'PASS' : 'N/A',
- detail: hasRowEdit
- ? `${rowBtns.length} 个行按钮, 含编辑/复制`
- : 'rowBtnsList 空 (主表行按钮由 runtime useVxeTable actionColumn 注入, 非 form data 字段)',
- })
-
- // BS-23: use*Permission 4 字段
- const hasBtnPerm = 'useBtnPermission' in columnData
- const hasColPerm = 'useColumnPermission' in columnData
- const hasDataPerm = 'useDataPermission' in columnData
- const hasFormPerm = 'useFormPermission' in columnData
- results.push({
- check: 'BS-23 use*Permission 4 字段',
- status: hasBtnPerm && hasColPerm && hasDataPerm && hasFormPerm ? 'PASS' : 'FAIL',
- detail: `btn=${hasBtnPerm} col=${hasColPerm} data=${hasDataPerm} form=${hasFormPerm}`,
- })
-
- // BS-31: 所有 field label 非空
- const emptyLabel = fields.filter((f: { __config__?: { label?: string } }) =>
- !f.__config__?.label || f.__config__.label.trim() === '')
- results.push({
- check: 'BS-31 所有 field label 非空',
- status: emptyLabel.length === 0 ? 'PASS' : 'FAIL',
- detail: emptyLabel.length === 0 ? `${fields.length} fields, all labeled` : `${emptyLabel.length} fields empty label`,
- })
-
- // BS-32: decimal 字段必用 inputNumber
- const tables = JSON.parse(schemaR.data.formData || '{}') // 简化, 实际应查 tables 字段
- // 实际从 formData.fields 看 (有 dataType 信息可能不全, 但 __config__.jnpfKey 能看)
- // 这里只看 controls 类型 — decimal 字段在 formData.fields 没显式, 跳过详细检查
- results.push({
- check: 'BS-32 decimal 字段必用 inputNumber (简化)',
- status: 'N/A',
- detail: '此检查需 tables[].fields (schema 不含, 跳过)',
- })
-
- // BS-V2: 所有 field 有 __config__.jnpfKey + label
- const incomplete = fields.filter((f: { __config__?: { jnpfKey?: string; label?: string } }) =>
- !f.__config__?.jnpfKey || !f.__config__?.label)
- results.push({
- check: 'BS-V2 __config__ 完整 (jnpfKey + label)',
- status: incomplete.length === 0 ? 'PASS' : 'FAIL',
- detail: incomplete.length === 0
- ? `${fields.length} fields, all have jnpfKey + label`
- : `${incomplete.length} fields incomplete`,
- })
-
- // 输出
- const pass = results.filter(r => r.status === 'PASS').length
- const fail = results.filter(r => r.status === 'FAIL').length
- const na = results.filter(r => r.status === 'N/A').length
-
- if (opts.json) {
- console.log(JSON.stringify({ formId: opts.formId, pass, fail, na, results }, null, 2))
- } else {
- log.info(`BS-52 + 6 盲点自检: PASS=${pass} FAIL=${fail} N/A=${na}`)
- console.log('')
- for (const r of results) {
- const icon = r.status === 'PASS' ? '✓' : r.status === 'FAIL' ? '✗' : '-'
- console.log(` ${icon} ${r.check}: ${r.status} (${r.detail})`)
- }
- }
- if (fail > 0) process.exit(1)
- })
-
- installAiHelpHook(cmd, {
- purpose: 'form schema BS-52 + 6 盲点自检 (不调 API, 仅查 schema)',
- required: { '--formId': '目标 form id' },
- example: [
- 'dacli testcase check --formId=839877227762942789',
- 'dacli testcase check --formId=839877227762942789 --json',
- ],
- source: { api: 'GET /visualdev/Base/{id} → formData + columnData' },
- notes: [
- '**vs testcase/run**: run 测运行时 API, check 测 schema 完整性',
- '**6 类检查**: BS-52 btnsList/rowBtnsList + BS-23 use*Permission + BS-31 label + BS-32 decimal + BS-V2 __config__',
- '**简化**: BS-32 跳 tables 字段检查 (schema 不含)',
- ],
- })
- return cmd
-}
\ No newline at end of file
diff --git a/src/commands/test/index.ts b/src/commands/test/index.ts
index eac4131..ed4c6c4 100644
--- a/src/commands/test/index.ts
+++ b/src/commands/test/index.ts
@@ -3,27 +3,26 @@
*
* 命名: 主命令 `dacli test` (短, 对齐 npm/pytest 惯例). 早期 v0.11+ 命名 testcase, 用户拍板简化为 test.
*
- * 3 子命令覆盖:
+ * 2 子命令覆盖:
* - run 跑 form API 测试 (POST/GET/PUT/DELETE, ~5s, 不需浏览器)
- * - check schema BS-52 + 6 盲点自检 (~1s, 不调 API)
* - generate 生成浏览器 E2E 脚本 (playwright bash, 覆盖 vmodel bind bug)
*
+ * v0.11+ cleanup: 删 `check` (BS-52+6 盲点必查已被 webapi 镜像自动保证, 无需单独检查)
+ *
* 覆盖 vs 浏览器测试 (v0.11+ 闭环):
* - API 层: run 完全覆盖 (POST/GET/PUT/DELETE)
- * - Schema 层: check 覆盖 (BS-52, 6 盲点)
+ * - Schema 层: webapi 镜像自动保证 (BS-51/52/54)
* - 浏览器层: generate 生成脚本, 用户手动跑
* - 浏览器层手动: 仍保留 ssw-e2e-test 作为 visual regression
*/
import { Command } from 'commander'
import { buildTestRunCommand } from './run.ts'
import { buildTestGenerateCommand } from './generate.ts'
-import { buildTestCheckCommand } from './check.ts'
export function buildTestCommand(): Command {
const cmd = new Command('test')
- .description('API 测试能力 (v0.11+ NEW) — run API 测试 + check schema 自检 + generate 浏览器脚本, 3 子命令覆盖尽可能多的测试场景')
+ .description('API 测试能力 (v0.11+ NEW) — run API 测试 + generate 浏览器脚本, 2 子命令覆盖尽可能多的测试场景')
cmd.addCommand(buildTestRunCommand())
cmd.addCommand(buildTestGenerateCommand())
- cmd.addCommand(buildTestCheckCommand())
return cmd
}
\ No newline at end of file