Files
dacli/tests
ssw c637a589a4 feat(dacli): wrapCommand helper 收口 5c 样板 (P0)
P0 of ADR 0015 (源码遗留清单): 39+ 命令文件散布 printCommandEnd + process.exit
样板, 5 个重复字段 (command/appCode/fixes/duration_ms/verbose+json) 在每个出错
分支都要 copy-paste + 配 process.exit(1). 加 wrapCommand helper:

  wrapCommand({command, appCode, startTime, verbose, json, fixes}, async (ctx) => {
    if (failure) ctx.fail('msg', summary)        // exit 1
    else if (partial) ctx.partial('msg', summary)
    else ctx.success(summary)
  })

替换 6 命令文件样板:
  - datasource/{create, delete, list, test}.ts
  - dict/typecreate.ts (含 partial case)
  - menu/create.ts (原本有 local printEnd, 现在切到 wrapCommand)

17 单测覆盖 (5c × 3 路径 + 必填项 + 透传参数).

后续 P1-P6 (见 ADR 0015):
  - P1: storage/info.ts + dm/drop.ts 2 小坑
  - P3: 18 个 per-module _validate.ts 改为统一 import 错误码
  - P4: addOutputOptions 迁移 38 文件 (L1 stdout 文案统一)
  - P5: console.log + throw new Error 统一收口
  - P6: 350+ 裸 process.exit 跨 session 治理 (大坑)

测试: 17/17 wrapCommand 单测 + 65/65 跨模块 + 0 新 TS 错误.
端到端: datasource list/delete/test --help + menu create --help 验证.
2026-07-21 17:04:29 +08:00
..