feat(dacli): P3 全量 18 _validate.ts → ValidationError 一源

每个 per-module _validate.ts 之前都自己 declare `export interface
ValidationError { field?, message, code? }` (跟 _error_codes.ts 完全一致),
导致跟 _error_codes.ts 定义漂移 (有的加 step/stepName, 有的加 docstring,
字段含义略不同但定义都一样).

这次统一 18 文件 import { ValidationError } from '../_error_codes.ts',
让所有 step machine 输出格式 + aggregate 跨模块一致.

机械改造:
  - 18 文件: 删本地 export interface ValidationError block
  - 加 `import { ValidationError } from '../_error_codes.ts'`
  - 5 个文件 (dict/form/menu/role/workflow) import 因 docstring 在前, 落
    在 interface 之后, 第二次 fix-up 移到 import 块首
  - 总变更: 18 insertions, 131 deletions (净减 113 行, 重复 definition 没了)

验证:
  - TS compile: 56 errors baseline 不变, 0 新错误
  - 65/65 单元测试 (output_filter/auto_fix/report_wired 3 文件)
  - blindspot_guards 12 个测试失败 (跑 `git stash` 验证: 是 pre-existing
    baseline 问题, 不是本次引入)
  - dacli datasource create 端到端 validation 错误格式不变

附带: docs/cmd-review/scan-2026-07-21.md 8 维度扫描报告 (含 ADR 0015
没列的 4 项新发现: workflow shim / console.log 范围扩大 / form/create 13
process.exit / DacliError 实际无重复).
This commit is contained in:
ssw committed 2026-07-21 17:20:55 +08:00
1 parent a5c22b98d3
commit 715fcb9a59
19 files changed
+207 -131

No files matched your search

+189
View File
@@ -0,0 +1,189 @@
# dacli 子命令源码 8 维度扫描 (2026-07-21)
> **扫描目的**: 配合 ADR 0015 (源码遗留清单), 在 P0 wrapCommand 落地后 (`c637a58`) 复查剩余可收口项.
> **范围**: `src/commands/**/*.ts` (45 子命令文件 + 18 per-module `_validate.ts` + 6 cross-command helper).
> **方法**: bash + grep 多维度并行扫描 (8 维度), 关键样本 Read 验证.
## 1. 扫描矩阵 (8 维度)
| # | 维度 | 文件数 | 行数 | 状态 |
|---|------|--------|------|------|
| 1 | `printCommandEnd` 仍用 (5c 样板未迁) | **39** | – | P0 还有 33 文件未迁 (本次迁了 6) |
| 2 | 裸 `process.exit(1/2/3)` 散布 | 30+ | **331** | _output_filter.ts 自身 5 处 (应有); form/create.ts 13 处 (P6 重灾) |
| 3 | `console.log` (绕开 log 过滤) | 30+ | **350** | 多为 list/table 输出 (≥10 文件合法用法, P4 重点) |
| 4 | `throw new Error` (没用 DacliError) | 20+ | **37** | test/helper/SDK 边界, 命令路径可控 |
| 5 | `class DacliError` 重复定义 | **1** | 1 | ✅ `src/core/types.ts:57`, **无重复** |
| 6 | per-module `_validate.ts` 自声明 `ValidationError` | **18/18** | – | **100% drift**, 应统一 import `'../_error_codes.ts'` |
| 7 | 裸 `c.get/c.postJson` (绕开 webapi 镜像) | 20+ | **108** | test 类 fetch 合法 (test/run 7, test/render 7); 命令路径少 (menu/create 2, workflow/create 1) |
| 8 | 真实 TODO 注释 | 3 文件 | 3 | form/codegen `--auto-menu` × 2 + dm/drop TTY × 1 |
## 2. 各维度明细
### 2.1 5c 样板残存 (维度 1, 39 文件)
#### 已完成 wrapCommand 迁移 (6, 本次 session `c637a58`)
- `datasource/{create, delete, list, test}.ts`
- `dict/typecreate.ts`
- `menu/create.ts` (原本有 local `printEnd`, 现切到 wrapCommand)
#### 未迁移 (33, 按优先级)
| 文件 | 历史 printCommandEnd 数 | 备注 |
|------|-------------------------|------|
| `form/create.ts` | (含 process.exit) | 13 个 process.exit, 不在 wrapCommand 内, 是 P6 重灾 |
| `workflow/create.ts` | 9 个 process.exit | 同上 |
| `form/codegen.ts` | 8 个 process.exit | 复杂 codegen, 单独排期 |
| `app/create.ts` | 6 个 process.exit | 跟 app clear 同 PR 不合适, 独立 commit |
| `report/{create, release, update, publish, save}.ts` | 各 4-6 | 报表模块批量推进 |
| `bigscreen/construct.ts` | 6 | 大屏复杂构造 |
| `di/create.ts` | 5 | data interface 5 模块 |
| `storage/info.ts` | 1 | ADR 0015 标 P1 (另含 DacliError 分叉) |
| `print/create.ts` 等 8-10 文件 | 1-5 各 | 简单迁移, 按模块推进 |
### 2.2 裸 process.exit 散布 (维度 2, 331 处)
#### Top 15 高频文件
| 文件 | exit 数 | 备注 |
|------|---------|------|
| `form/create.ts` | 13 | step machine validation exit 2 + API fail exit 1 + AI 4 限制 exit 1 |
| `workflow/create.ts` | 9 | 长流程多 fail/exit |
| `form/codegen.ts` | 8 | codegen 边角 case 多 |
| `workflow/update.ts` | 6 | |
| `role/assign.ts` | 6 | |
| `report/release.ts` | 6 | |
| `menu/delete.ts` | 6 | |
| `di/create.ts` | 6 | |
| `bigscreen/construct.ts` | 6 | |
| `app/create.ts` | 6 | |
| `_output_filter.ts` | 5 | ✅ wrapCommand 自身 (应有) |
| `test/render.ts` | 5 | 测试沙盒 exit 合法 |
#### 形态分类
- `process.exit(1)`: 命令失败退出 (大多伴随 printCommandEnd 错误路径)
- `process.exit(2)`: 输入校验失败 (e.g. 必填缺失, JSON 解析失败)
- `process.exit(0)`: 极少, 通常显式列表退出
**P6 改造策略**: 不能一刀切. 应按模块逐个迁, 每个模块先 wrapCommand 化 process.exit(1) → `ctx.fail()`, 然后处理 process.exit(2) → 走 pre-check 路径.
### 2.3 console.log 散布 (维度 3, 350 行 / 30+ 文件)
#### 形态分类
- **合法 list/table 输出** (e.g. `datasource/list.ts` 画 ID/Full_Name/enCode 表格): 10+ 文件
- **stdout 信息** (e.g. doc/list.ts 打印搜索结果): 不直接绑 stdout 过滤
#### ADR 0015 P4 范围 vs 实际
- ADR 0015 P4 写 "1h", 但实际涉及 30+ 文件, 应单独排期更长周期
- 需新 primitive `log.printRawTable()` 让 stdout 表格与 verbose 日志分清
### 2.4 throw new Error (维度 4, 37 处)
#### 大多合法场景
- **SDK 内部**: `_ssw_retry.ts`, `apis/_cache.ts`, `form/_ai.ts` (调用外部)
- **test 路径**: `test/{generate,render,run}.ts` (单元测试预期抛出)
- **webapi shim**: `form/_buildformdata.ts`, `form/_browser_verify.ts`
- **命令路径小量** (应改 DacliError): `portal/create.ts`, `report/{info,list}.ts`, `storage/info.ts`, `user/{auth-list, batch-state}.ts` 等
**改 DacliError ROI**: 中. 失败时 log 落点更一致 (L2 catch 路径能识别 DacliError instanceof, 而 new Error 不可识别). 建议作为 P5 子集.
### 2.5 class DacliError (维度 5, 1 处)
✅ **唯一**: `src/core/types.ts:57 export class DacliError extends Error { ... }`
- 5 文件 import 它 (form/_validate.ts 等)
- ADR 0015 提到 `storage/info.ts:38 DacliError 分叉` — **实际不存在**, 可能是上次 session 误读或已修复
- 本次扫描确认 0 重复定义
### 2.6 _validate.ts import 不一致 (维度 6, 18/18 drift)
#### 100% 全 drift
所有 18 个 per-module `_validate.ts` 都自己声明 `export interface ValidationError` 而非 import 共享的. 复刻 `_error_codes.ts` 的字段 (但常常多 `step`/`stepName`/`line` 等).
**待改清单**:
1. `src/commands/bigscreen/_validate.ts`
2. `src/commands/datasource/_validate.ts`
3. `src/commands/di/_validate.ts`
4. `src/commands/dict/_validate.ts`
5. `src/commands/dm/_validate.ts`
6. `src/commands/form/_validate.ts`
7. `src/commands/integration/_validate.ts`
8. `src/commands/menu/_validate.ts`
9. `src/commands/msg/_validate.ts`
10. `src/commands/org/_validate.ts`
11. `src/commands/portal/_validate.ts`
12. `src/commands/print/_validate.ts`
13. `src/commands/report/_validate.ts`
14. `src/commands/role/_validate.ts`
15. `src/commands/schedule/_validate.ts`
16. `src/commands/storage/_validate.ts`
17. `src/commands/user/_validate.ts`
18. `src/commands/workflow/_validate.ts`
**修法**: 删本地 `export interface ValidationError`, 改 `import { ValidationError } from '../_error_codes.ts'`. 多余字段 (`step`/`stepName`) 用 type intersection 或在新 canonical 接口加字段.
### 2.7 裸 c.get/c.postJson 散布 (维度 7, 108 处)
#### 合法 (test 类 fetch 业务数据)
- `test/run.ts` 7 处 (fetch form data 测试: createR/listR/infoR 等)
- `test/render.ts` 7 处 (render 渲染层测试 fetch)
#### 命令路径少量 (跨 app 引用, escape)
- `menu/create.ts` 2 处 (fetch form info for propertyJson — 历史原因)
- `workflow/{tasks, create}.ts` 各 1 处
- `user/{resetpwd, changepwd, batch-state, ...}.ts` 各 1 处 (用户管理 API)
#### 应改 webapi 的 (低 ROI, 可不动)
- `form/codegen.ts:246` (Actions/Module 调用 — 历史遗留, 没 webapi)
**建议**: 这块 ROI 低, 不强行迁. 但 `user/*` (10+ 文件) 若有重复 API 调用, 可考虑合并到 user webapi shim.
### 2.8 真实 TODO (维度 8, 3 处)
| 文件:行 | TODO |
|---------|------|
| `src/commands/form/codegen.ts:17` | `--auto-menu`: 生成完直接调 `dacli menu create` 挂菜单 |
| `src/commands/form/codegen.ts:1008` | 同上 (option 文案) |
| `src/commands/dm/drop.ts:7` | 加 TTY 拦截 (`⚠️ 危险操作`) |
#### ADR 0015 P1 部分对应该 TODO
- `dm/drop.ts` TTY 拦截: ADR 0015 P1 已列
- `form/codegen.ts --auto-menu`: 没在 ADR 0015 中 (遗漏)
- 7 处 grep 命中减 3 真实 = 4 处是 "TODO:" 文本 (例如 `--no-column-list-subtable-check (tableFieldXXX-F_* 引用错配, 默认 ON)` 里有 "XXX" 字符)
## 3. ADR 0015 没列的新发现
### 3.1 `workflow/_output.ts` 向后兼容 shim (11 子命令)
- `src/commands/workflow/_output.ts` (文件本身是 shim, 只是 `export from '../_output_filter.ts'`)
- 11 workflow 子命令 (`info/approve/create/tasks/syncForm/decision/list/launch/delete/update/selector`) import 它
- **建议**: 改 11 文件直接 `import from '../_output_filter.ts'`, 删 shim 文件
- **工作量**: 0.5h (11 文件 × 1 import 改, 删 1 shim)
### 3.2 `datasource/list.ts` 等用 console.log 画表格
- 已见维度 3. **ADR 0015 P4 写 "1h" 不准确**, 实际 30+ 文件
- 需要新 primitive `log.printRawTable()` 或类似, 让 stdout 表格与 verbose log 分清
- **建议**: 单独 ADR 0015 跟进 (e.g. P4 v2 范围扩大)
### 3.3 `form/create.ts` 13 个 process.exit
- 不仅 printCommandEnd 散布, **process.exit 自己也散布**
- P0 wrapCommand 已能收口 printCommandEnd, 但 form/create.ts 还有 step machine exit 2 + AI 4 限制 exit 1 + 后端 fail exit 1 等
- **建议**: form/create 拆分 sub-handler (e.g. buildFormData / createFormSteps), 每个 sub-handler 自己 wrapCommand 后, 主 .action 只调用 sub-handler
- **风险**: 大改. 建议先 P3 + shim 清理, 再回头处理 form/create.
### 3.4 ADR 0015 P1 "storage/info.ts:38 DacliError 分叉" — **不存在**
- 当前扫描: `class DacliError` 仅 `src/core/types.ts:57` 一处定义
- ADR 0015 §2.2 提到的 storage/info.ts:38 分叉可能:
- (a) 上次 session 已修复但 ADR 写错
- (b) 上次 session 误读 (storage/info.ts 可能有别的问题, 不是 DacliError)
- **建议**: 实际看 `storage/info.ts:38` 上下文, 再删 ADR 0015 P1 第二行
## 4. 推荐下一步 (按 ROI 排序, 2h 闭环)
| 优先级 | 工作量 | 工作 | 起点 |
|--------|--------|------|------|
| **P3** | 1h | 18 `_validate.ts` 全改统一 import | `src/commands/form/_validate.ts:16` 起 (代表, 全员同样模式) |
| **shim 清理** | 0.5h | 11 workflow 文件改 import + 删 `workflow/_output.ts` | 起点: 改 11 文件 + `git rm workflow/_output.ts` |
| **P1 dm/drop** | 0.5h | TTY 拦截 + 验 storage/info.ts:38 真分叉 | `src/commands/dm/drop.ts:7` |
| **下次 session**: P5/P6 | 4+h | console.log → log.flush + 裸 process.exit 收口 | 大坑, 单独排期 |
## 5. 关联决策
- ADR 0015 (源码遗留清单 + P0-P6 优先级路线)
- `dacli/docs/decisions/0010-dacli-v2-self-correcting-cli.md` (三层架构)
- `dacli/README.md:213-228` 三层处理总结
+1 -7
View File
@@ -18,13 +18,7 @@
*/
import { ENCODE_REGEXP } from '../_encode_validator.ts'
export interface ValidationError {
field?: string
message: string
/** v0.11e+: ErrorCode */
code?: string
}
import { ValidationError } from '../_error_codes.ts'
export interface StepValidation {
ok: boolean
step: 0 | 1
+1 -6
View File
@@ -23,12 +23,7 @@
*/
import { ENCODE_REGEXP } from '../_encode_validator.ts'
export interface ValidationError {
field?: string
message: string
code?: string
}
import { ValidationError } from '../_error_codes.ts'
export interface StepValidation {
ok: boolean
step: 0
+1 -8
View File
@@ -1,3 +1,4 @@
import { ValidationError } from '../_error_codes.ts'
/**
* commands/di/_validate.ts — di update step machine 校验
*
@@ -29,14 +30,6 @@
* - dacli 必须镜像, 不加正则 (否则会误报)
*/
export interface ValidationError {
field?: string
message: string
/** v0.11e+: ErrorCode (镜像后端 MsgCode.java, AI 能查表)
* 复刻 _error_codes.ts 的 ValidationError 字段, 让 step machine 输出格式统一 */
code?: string
}
export interface StepValidation {
ok: boolean
step: 0 | 1 | 2
+1 -8
View File
@@ -19,14 +19,6 @@
* - item enCode 不重复
*/
export interface ValidationError {
field?: string
message: string
/** ErrorCode (镜像后端 MsgCode.java, AI 能查表)
* 复刻 _error_codes.ts 的 ValidationError 字段, 让 step machine 输出格式统一 */
code?: string
}
export interface StepValidation {
ok: boolean
step: 0 | 1 | 2
@@ -45,6 +37,7 @@ export interface DictItemLite {
/** enCode 正则 — 镜像 web packages/jnpf/utils/src/helpers/formValidate.ts:24-28
* 改用共享 _encode_validator.ts (增强: 自动建议别名)
*/
import { ValidationError } from '../_error_codes.ts'
import { ENCODE_REGEXP, FULLNAME_REGEXP } from '../_encode_validator.ts'
/**
+1 -10
View File
@@ -1,3 +1,4 @@
import { ValidationError } from '../_error_codes.ts'
/**
* commands/dm/_validate.ts — dm create step machine 校验
* 镜像 web dataModel/Form.vue handleSubmit (L210-242) + 后端 DbTableController checkName (L92-112) 的前端校验
@@ -25,16 +26,6 @@
* - 表名不重复 (后端 EXIST001 预校验)
*/
export interface ValidationError {
/** 错误字段 (formId/字段名) */
field?: string
/** 错误消息 (镜像 web 文案 + 后端 EXIST 码, AI 能对照) */
message: string
/** ErrorCode (镜像后端 MsgCode.java, AI 能查表)
* 复刻 _error_codes.ts 的 ValidationError 字段, 让 step machine 输出格式统一 */
code?: string
}
export interface StepValidation {
ok: boolean
step: 0 | 1 | 2
+1 -10
View File
@@ -13,16 +13,6 @@
* step 2: columnData (columnList ≥ 1 当 webType≠1, 树形 treeDataSource/props/relation/sync 必填, 卡片/分组/父级字段)
*/
export interface ValidationError {
/** 错误字段 (formId/字段名) */
field?: string
/** 错误消息 (镜像 web 文案, AI 能对照) */
message: string
/** ErrorCode (镜像后端 MsgCode.java, AI 能查表)
* 复刻 _error_codes.ts 的 ValidationError 字段, 让 step machine 输出格式统一 */
code?: string
}
export interface StepValidation {
ok: boolean
step: 0 | 1 | 2
@@ -39,6 +29,7 @@ const VMODEL_REGEXP = /(^_([a-z0-9]_?)*$)|(^[a-z](_?[a-z0-9])*_?$)/i
// 镜像 web 端 formValidate('enCode') (formValidate.ts:24-28) 禁下划线/连字符
// 增强: 校验失败时输出清晰原因 + 自动建议别名 (去下划线/连字符)
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { ValidationError } from '../_error_codes.ts'
import { ENCODE_REGEXP, FULLNAME_REGEXP, validateEnCode, validateFullName } from '../_encode_validator.ts'
import { log } from '../../core/log.ts'
+1 -6
View File
@@ -1,3 +1,4 @@
import { ValidationError } from '../_error_codes.ts'
/**
* commands/integration/_validate.ts — integration create/update step machine 校验 (Phase D1)
*
@@ -23,12 +24,6 @@
* dacli 不再硬编码正则, 直接复用 ENCODE_REGEXP (与 dict/menu 一致, BS-56)
*/
export interface ValidationError {
field?: string
message: string
code?: string
}
export interface StepValidation {
ok: boolean
step: 0 | 1
+1 -10
View File
@@ -29,16 +29,6 @@
* - ⚠️ step machine 预校验, 后端还会再查 (双重防御)
*/
export interface ValidationError {
/** 错误字段 (对应 web Form.vue 字段名 / 后端 ModuleController 入参) */
field?: string
/** 错误消息 (镜像 web 文案 + 后端 EXIST 码, AI 能对照) */
message: string
/** v0.11e+: ErrorCode (镜像后端 MsgCode.java, AI 能查表)
* 复刻 _error_codes.ts 的 ValidationError 字段, 让 step machine 输出格式统一 */
code?: string
}
export interface StepValidation {
ok: boolean
step: 0 | 1 | 2 | 3
@@ -50,6 +40,7 @@ export interface StepValidation {
/** enCode 正则 — 镜像 web packages/jnpf/utils/src/helpers/formValidate.ts:24-28
* v0.11h+ (2026-06-28): 改用共享 _encode_validator.ts (BS-56 增强: 自动建议别名)
*/
import { ValidationError } from '../_error_codes.ts'
import { ENCODE_REGEXP } from '../_encode_validator.ts'
/** 合法 type 值 — 镜像 web Form.vue:75-87 typeData + 88 typeData */
+1 -6
View File
@@ -20,12 +20,7 @@
*/
import { ENCODE_REGEXP } from '../_encode_validator.ts'
export interface ValidationError {
field?: string
message: string
code?: string
}
import { ValidationError } from '../_error_codes.ts'
export interface StepValidation {
ok: boolean
step: 0
+1 -6
View File
@@ -1,3 +1,4 @@
import { ValidationError } from '../_error_codes.ts'
/**
* commands/org/_validate.ts — org create/update step machine 校验 (Phase D1, v3.0+ 镜像化)
*
@@ -18,12 +19,6 @@
* dacli 复用 ENCODE_REGEXP 常量 (BS-56, 镜像 web packages/jnpf/utils/src/helpers/formValidate.ts:24-28)
*/
export interface ValidationError {
field?: string
message: string
code?: string
}
export interface StepValidation {
ok: boolean
step: 0 | 1
+1 -7
View File
@@ -1,3 +1,4 @@
import { ValidationError } from '../_error_codes.ts'
/**
* commands/portal/_validate.ts — portal create step machine 校验 (Phase B1)
*
@@ -12,13 +13,6 @@
* v0.11e+ Phase B1: 完整设计 + step machine 镜像
*/
export interface ValidationError {
field?: string
message: string
/** v0.11e+: ErrorCode (镜像后端 MsgCode.java) */
code?: string
}
export interface StepValidation {
ok: boolean
step: 0 | 1
+1 -6
View File
@@ -1,3 +1,4 @@
import { ValidationError } from '../_error_codes.ts'
/**
* commands/print/_validate.ts — print create/update step machine 校验 (Phase D1)
*
@@ -30,12 +31,6 @@
* dacli 不再硬编码正则, 直接复用 ENCODE_REGEXP (BS-56)
*/
export interface ValidationError {
field?: string
message: string
code?: string
}
export interface StepValidation {
ok: boolean
step: 0 | 1 | 2
+1 -7
View File
@@ -1,3 +1,4 @@
import { ValidationError } from '../_error_codes.ts'
/**
* commands/report/_validate.ts — report create step machine 校验 (Phase B1, v3.0+ 镜像化)
*
@@ -17,13 +18,6 @@
* dacli 复用 ENCODE_REGEXP 常量 (BS-56, 镜像 web packages/jnpf/utils/src/helpers/formValidate.ts:24-28)
*/
export interface ValidationError {
field?: string
message: string
/** v0.11e+: ErrorCode */
code?: string
}
export interface StepValidation {
ok: boolean
step: 0 | 1
+1 -8
View File
@@ -26,14 +26,6 @@
* - fullName 按 type 分类唯一 → EXIST001
*/
export interface ValidationError {
field?: string
message: string
/** v0.11e+: ErrorCode (镜像后端 MsgCode.java, AI 能查表)
* 复刻 _error_codes.ts 的 ValidationError 字段, 让 step machine 输出格式统一 */
code?: string
}
export interface StepValidation {
ok: boolean
step: 0 | 1 | 2
@@ -43,6 +35,7 @@ export interface StepValidation {
/** enCode 正则 — 镜像 web formValidate.ts:24-28 (同 menu/dict/workflow)
* v0.11h+ (2026-06-28): 改用共享 _encode_validator.ts (BS-56 增强: 自动建议别名) */
import { ValidationError } from '../_error_codes.ts'
import { ENCODE_REGEXP } from '../_encode_validator.ts'
/** 约束类型常量 — 镜像 web Form.vue:24-28 */
+1 -6
View File
@@ -17,12 +17,7 @@
*/
import { ENCODE_REGEXP } from '../_encode_validator.ts'
export interface ValidationError {
field?: string
message: string
code?: string
}
import { ValidationError } from '../_error_codes.ts'
export interface StepValidation {
ok: boolean
step: 0
+1 -6
View File
@@ -1,3 +1,4 @@
import { ValidationError } from '../_error_codes.ts'
/**
* commands/storage/_validate.ts — storage create/update step machine 校验 (Phase C1, v3.0+ 升级)
*
@@ -25,12 +26,6 @@
* - 标注镜像源: web 端无 Form.vue, 镜像后端 Java 端
*/
export interface ValidationError {
field?: string
message: string
code?: string
}
export interface StepValidation {
ok: boolean
step: 0 | 1
+1 -6
View File
@@ -26,12 +26,7 @@
*/
import { ENCODE_REGEXP, FULLNAME_REGEXP } from '../_encode_validator.ts'
export interface ValidationError {
field?: string
message: string
code?: string
}
import { ValidationError } from '../_error_codes.ts'
export interface StepValidation {
ok: boolean
step: 0 | 1
+1 -8
View File
@@ -22,14 +22,6 @@
* - category 合法 (从 dict dataList 查, 镜像 web Select)
*/
export interface ValidationError {
field?: string
message: string
/** ErrorCode (镜像后端 MsgCode.java, AI 能查表)
* 复刻 _error_codes.ts 的 ValidationError 字段, 让 step machine 输出格式统一 */
code?: string
}
export interface StepValidation {
ok: boolean
step: 0 | 1 | 2
@@ -42,6 +34,7 @@ export interface StepValidation {
* 新: import 共享 ENCODE_REGEXP + validateEnCode (增强信息含 suggestedAlias)
* 镜像 web packages/jnpf/utils/src/helpers/formValidate.ts:24-28
* 允许: 字母/数字/小数点, 小数点不能放首尾 */
import { ValidationError } from '../_error_codes.ts'
import { ENCODE_REGEXP, validateEnCode } from '../_encode_validator.ts'
/** 合法 showType — 镜像 web Form.vue:85-89 */