Commit Graph
739 Commits
Author SHA1 Message Date
ssw 0bb32d5ae2 auto(14b5ea1b9bd9): session end @ 2026-07-23T15:04:41 (+10f) 2026-07-23 15:04:41 +08:00
sswandClaude 64fbb4ac0a docs: archive cmd-review 25 + drift round 20 (2026-07-23)
清理 help 体系干扰/过期信息, 整体归档:

1. cmd-review/ 25 文件 → archive/cmd-review-2026-07/
   - 22 个 2026-06-30 一波生成的命令审计
   - 1 个 bigscreen-components (2026-07-01)
   - 1 个 bigscreen (2026-07-01)
   - 1 个 app (2026-07-01)
   - 含 form/dm/menu M2 实战更新版 (建议已落地, 整体降级归档)
   - cmd-review/ 留 README.md 指针

2. drift/ 20 个 round summary → archive/drift-rounds-2026-07/
   - round 3-4/5/6/7/7b/8/9/10/11/12/13/14/15/16/17 + day summary
   - drift/ 保留 README/USAGE/fetch-baseline.sh 基础设施
   - drift/README.md 加 ⚠️ 头

3. 改引用:
   - dacli/README.md §必读文档 改指 archive
   - 7 个 ADR (0001-0004/0011/0013/0015) 顶部加 ⚠️ 头说明引用路径已迁
   - archive/README.md 加 cmd-review-2026-07/ + drift-rounds-2026-07/ 段, 更新结构图, 更新 AI 误读防御清单

新权威源:
- 命令用法 → 'dacli <cmd> --help' (DacliHelp 注入 pitfalls/bestPractices/decisionTree)
- 决策理由 → docs/decisions/0001-0016 ADR (git-tracked, 权威)
- 反模式 → docs/anti-patterns.md (auto-gen, _anti_patterns.ts 为单一权威)

触发: 用户反馈 'dacli help 体系感觉很多干扰/过期信息, 看看怎么处理'
      + 'cmd-review 22 + drift 13 round 意义不大, 也可归档'

Co-Authored-By: Claude <[email protected]>
2026-07-23 15:04:18 +08:00
ssw 51ffaf00ba feat(dacli): hard-bind form smartProps, DI list enCode, codegen sub-table searchList, form info --bindings, test run dictionary mapping
- form create: extract applyFinalSmartProps/shouldRunFinalSmartProps so
  --ai-only paths also re-run smart props after the final buildFormData.
  Adds unit test for the gate predicate.
- form update: mergeFormFieldUpdates deep-merges __config__ and matches
  vmodel/__vModel__, preventing schema loss on partial diffs.
- form info: new --bindings projection flattens field configs to
  {field, jnpfKey, dataType, dictionaryType, modelId, required} for
  callers without jq piercing the JNPF nested formData JSON.
- form codegen: normalizeCodegenSearchList now walks children/tableList
  payloads; new _codegen_schema helper repairs searchList id/prop across
  nested scopes, avoiding SearchTypeModel.id NPE in JNPF CodeGenerateFactoryV3.
- di list: enrichDataInterfaceListWithEnCode backfills the enCode field
  selector omits; walks every category folder so callers can filter on
  enCode reliably.
- test run: pickChoiceValue routes select/radio/checkbox through
  loadDict.getDictionaryDataSelector (cached) before falling back to
  options[0].value, removing the brittle dependency on option order.

Tests: 56/56 PASS across 9 unit specs.
2026-07-23 13:59:11 +08:00
ssw 4a3dd4b9d5 auto(14b5ea1b9bd9): session end @ 2026-07-23T13:56:28 (+4f) 2026-07-23 13:56:29 +08:00
ssw ff259efdd5 auto(14b5ea1b9bd9): session end @ 2026-07-23T13:28:26 (+5f) 2026-07-23 13:28:27 +08:00
ssw 41cc72a309 auto(14b5ea1b9bd9): session end @ 2026-07-23T10:49:11 (+1f) 2026-07-23 10:49:11 +08:00
ssw 571737ccaa auto(14b5ea1b9bd9): session end @ 2026-07-23T09:50:13 (+1f) 2026-07-23 09:50:15 +08:00
ssw 15d39451c3 auto(14b5ea1b9bd9): session end @ 2026-07-22T21:25:12 (+1f) 2026-07-22 21:25:12 +08:00
sswandClaude b69d94c133 merge: eventhub blocker fixes
Co-Authored-By: Claude <[email protected]>
2026-07-22 16:56:12 +08:00
sswandClaude fa605579f3 test: cover eventhub blocker fixes
Co-Authored-By: Claude <[email protected]>
2026-07-22 16:51:06 +08:00
ssw a756b009a8 auto(14b5ea1b9bd9): session end @ 2026-07-22T16:46:31 (+7f) 2026-07-22 16:46:32 +08:00
sswandClaude 88dff4715b refactor(dacli): 修 6 错默认/标号 + 8 factory 落 L3 + 11 长注释短化
A. 6 处过期错:
- form/create.ts --notes 默认值错 (type=4 / webType=1 → 实际 1/2)
- form/create.ts --notes '默认 type=2' → 实际 1
- 删 P0-5 / B-15 / B-8 / v0.7.4 / BS-drift-1 历史标号 (用户看不到 batch name 含义)
- 删 codegen.ts P1-3 标号残留 (stdout + notes)

B. 8 factory 落 L3 (v2.4+):
_post_reminders.ts 新增:
- remindEnCodeStrip / remindFullNameSoften (preWrapFixes 收集, wrapCommand.fixes 接收)
- remindFormRepairSkipped / remindSmartPropsPostProcessFailed
- remindHeuristicRelFormSkipped / remindPhysicalTableMissing
- remindAiTokenRelogin / remindCodeGenMenuMountFail

create.ts:
- enCode/fullName strip 改 preWrapFixes (wrapCommand.fixes 接收)
- smartProps 后处理失败 / heuristicRelForm skipped / FormRepair skipped / 物理表缺失 / AI token 重登 → ctx.addSuggestion / ctx.addFix
codegen.ts:
- autoMountMenu 失败 (code!=200 + 异常) → ctx.addFix

C. 11 长注释短化:
- --ai-json 历史说明 5→1 行
- P1-7 AI Login fallback 5→1 行
- P1-5 AI enCode diverge 4→1 行
- relationForm wire up 5→1 行
- dos 26 P0 修复 4→2 行
- Round 12 smartProps fallback 3→1 行
- FormRepair in-process 5→1 行
- 业务分类 4→1 行
- lombok + annotationProcessorPaths 7→1 行
- 前端 web/uniapp 重定向 7→1 行
- @RequestMapping 路径改写 8→1 行

数字:
- form/create.ts: 1524 → 1516
- form/codegen.ts: 1055 → 1040
- _post_reminders.ts: 213 → 338 (+125)

校验: typecheck 0 新增 error (10 个 pre-existing 不动)
单测: 48/48 pass (output_filter 22 + auto_fix 26)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
2026-07-22 01:24:38 +08:00
sswandClaude 05e5f6b5fe refactor(dacli): 清 form/create form/codegen dead code + 7 inline ⚠ 落 L3
form/create.ts (1572→1524):
- 删硬编码 BUSINESS_TYPE_ID 兜底分支 (compatible old NCPF, 真 dead)
- 删 rawFields/converted/total 空壳 (rawFields 在空数组循环是真 dead)
- 删老 ternary `__aiBuildFormData ? ... : { 默认空 schema }` 老分支 (--fields 已 ctx.fail, 走不到)
- 删 type=webType 默认值 override (commander declaration 已经默认)
- 简化"删 dead code (aiModelList[0].fields 手动映射)" 4 行注释 → 1 行

form/codegen.ts:
- 删 autoFixNames option (已废弃, 全文 0 引用)
- 修错 TODO: --auto-menu + L17 + L1022 (已实现 autoMountMenu)
- 修"auto-fix-names 已废弃" 注释

_post_reminders.ts (+5 factory):
- remindCategoryGuess (category 兜底提示)
- remindSmartPropsAIFallback (启发式标必填兜底)
- remindRelationFormAutoSkip (注入失败提示)
- remindCodeGenMenuAttachFail (codegen 成功但 menu 未挂)
- remindCodeGenPomConflict (互斥 flag 提示)

L3 落点 (7 inline log.warn → ctx.addSuggestion):
- form/create: categoryGuess × 4 + smartProps × 2 + relationForm × 1
- form/codegen: menuAttachFail + pomConflict × 1

类型校验: 0 新增 error (10 个 pre-existing id/fullName/aiModelList 类型错不动)
单测: 48/48 pass (output_filter 22 + auto_fix 26)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
2026-07-21 22:31:12 +08:00
ssw e2b1381c50 auto(14b5ea1b9bd9): session end @ 2026-07-21T22:04:07 (+20f) 2026-07-21 22:04:07 +08:00
ssw c584e9f4c1 auto(14b5ea1b9bd9): session end @ 2026-07-21T21:53:43 (+1f) 2026-07-21 21:53:43 +08:00
sswandClaude 2bce9dd3e1 feat(dacli): form/codegen.ts wrapCommand 迁移 (P2 batch4, 8 exit 收口)
全 action 包 wrapCommand + try/catch. 3 action process.exit + ensureAlias helper 5 process.exit → throw/ctx.fail.
顶层提前 const c (原 c 在首个 exit 后声明), 删冗余 const c. 空 tree/json 早返 → ctx.success.

Co-Authored-By: Claude <[email protected]>
2026-07-21 21:47:12 +08:00
sswandClaude 32904b2efc feat(dacli): workflow/create.ts wrapCommand 迁移 (P2 batch3, 9 exit 收口)
全 action 包 wrapCommand + try/catch. 8 action process.exit + runWorkflowStepMachine helper process.exit → throw/ctx.fail.
成功 printCommandEnd → ctx.success. stale-retry 3 分支 exit → ctx.fail (create_stale_retry 测试仍 PASS).
cmdFix 在 wrapCommand 前算 (静态 populated), fixes 正常透传.

Co-Authored-By: Claude <[email protected]>
2026-07-21 21:44:34 +08:00
sswandClaude 11082bff6e feat(dacli): form/create.ts wrapCommand 迁移 (P2 batch2, 11 exit 收口)
1554 行核心命令: 全 action 包 wrapCommand + try/catch. 11 process.exit → ctx.fail/ctx.success.
precheck/guard throw 被 handler catch. 成功路径保留原 saveCommandLog (含 fixLog) 不双写.
副作用修复: 顶层提前 const c (原 --ai 路径 line 307 c 在 line 624 声明前引用, TS used-before-decl),
  删冗余 606/624 两处 const c. TS baseline 57→49 (修复 8 个 pre-existing c 错误, 无新增).

Co-Authored-By: Claude <[email protected]>
2026-07-21 21:41:52 +08:00
sswandClaude f0d0af518f refactor(dacli): handlePreCheckResult/handleGuardResult 改 throw + dm/create + form/release wrapCommand 迁移 (P2 batch1)
_precheck.handlePreCheckResult + _blindspot_guards.handleGuardResult: process.exit(2) → throw Error
  (wrapCommand handler catch → ctx.fail 落 L3). 沿用 DirtyCheckError 同款模式.
dm/create: 完整 wrapCommand 迁移 (runDmStepMachine process.exit → throw + await 修复未 await 逃逸,
  precheck/guard throw 被 handler catch). form/release: wrapCommand 迁移 (承接 guard throw).
menu/create 已 wrapCommand (自动承接). form/create 下一 commit 承接 (P2 batch2).

Co-Authored-By: Claude <[email protected]>
2026-07-21 21:34:46 +08:00
sswandClaude 8839466f3c feat(dacli): dm/drop.ts wrapCommand 迁移 (2 exit 收口)
TTY 确认 + DB201 错误 → ctx.fail (保留 ADR 0011 修复指引). dm/create 因纠缠 keep-list helper (handlePreCheckResult/handleGuardResult 内部 process.exit), 归入 P2 待专门 session.

Co-Authored-By: Claude <[email protected]>
2026-07-21 21:28:02 +08:00
sswandClaude 0d9151f343 feat(dacli): org/monitor/report/doc 小命令 wrapCommand 迁移 (8 exit 收口)
org/create (旧 printCommandEnd 升级) + org/tree, monitor/server, report/delete (保留 --cascade 级联清理), doc/search (无 appCode 本地文件搜索). process.exit → ctx.fail.

Co-Authored-By: Claude <[email protected]>
2026-07-21 21:26:43 +08:00
sswandClaude 1ee19dd23c feat(dacli): bigscreen/* 模块 wrapCommand 迁移 (create/delete/info/release/update, 5 exit 收口)
create 从旧 printCommandEnd 升级 (保留 auto-fix). update 复用 DirtyCheckError catch.
delete/info/release process.exit → ctx.fail. bigscreen/ 模块 process.exit 归零 (construct 上次已迁移).

Co-Authored-By: Claude <[email protected]>
2026-07-21 21:23:41 +08:00
sswandClaude 0677370d9c feat(dacli): workflow/* 小命令 wrapCommand 迁移 (approve/decision/delete/launch/syncForm, 9 exit 收口)
approve/launch/syncForm/delete/decision 全部 process.exit → ctx.fail.
delete --yes 检查移入 ctx.fail (保留 BS-E13 排查提示). decision --list 分支保留.
workflow/create.ts (9 exit, P2 高风险) 暂不动, 留专门 session 拆 sub-handler.

Co-Authored-By: Claude <[email protected]>
2026-07-21 21:16:21 +08:00
sswandClaude e1eb1f07ab feat(dacli): di/* 模块 wrapCommand 迁移 (delete/info/test/update, 8 exit 收口)
update 复用 DirtyCheckError catch + runDiStepMachine process.exit → throw. test JSON parse/API → ctx.fail.
delete/info process.exit → ctx.fail. di/ 模块 process.exit 归零 (create 已迁移).

Co-Authored-By: Claude <[email protected]>
2026-07-21 21:13:30 +08:00
sswandClaude d8df559075 feat(dacli): portal/datasource/apis 残留 wrapCommand 迁移 (6 exit 收口)
portal/info+release, datasource/delete (--yes 检查移入 ctx.fail), apis/info.
portal/release 保留 BS-109 自动检测逻辑, 2 exit → ctx.fail. apis meta 模块 wrapCommand 化.

Co-Authored-By: Claude <[email protected]>
2026-07-21 21:11:07 +08:00
sswandClaude 980dbedbbd feat(dacli): print/* 模块 wrapCommand 迁移 (create/delete/info/update, 10 exit 收口)
create 从旧 printCommandEnd 升级 (保留 auto-fix). delete/info/update process.exit → ctx.fail.
step machine 校验失败 → ctx.fail (聚合错误). print/ 模块 process.exit 归零.

Co-Authored-By: Claude <[email protected]>
2026-07-21 21:07:48 +08:00
sswandClaude 2795d7f2db feat(dacli): storage/* 模块 wrapCommand 迁移 (info/test/use, 5 exit 收口)
info 从旧 finally+printCommandEnd 升级 (无 appCode 跳过 L3, DacliError throw 被 wrapCommand catch).
test 批量连通测试用 ctx.partial (fail>0). use 纯 yml 无 appCode, process.exit → ctx.fail/success.
storage/ 模块 process.exit 归零.

Co-Authored-By: Claude <[email protected]>
2026-07-21 21:05:16 +08:00
sswandClaude 2a1fd000a6 feat(dacli): schedule/* 模块 wrapCommand 迁移 (create/delete/info/trigger/update, 9 exit 收口)
create 从旧 printCommandEnd 升级 (保留 auto-fix). trigger 从旧 printCommandEnd 升级.
update 复用 DirtyCheckError catch + step machine → ctx.fail. delete/info process.exit → ctx.fail.
schedule/ 模块 process.exit 归零.

Co-Authored-By: Claude <[email protected]>
2026-07-21 21:03:07 +08:00
sswandClaude 183d07bcc6 feat(dacli): msg/* 模块 wrapCommand 迁移 (notice+template CRUD 7 文件, 14 exit 收口)
notice/templateCreate 从旧 printCommandEnd 升级到 wrapCommand (保留 auto-fix fixes).
noticeUpdate 复用 DirtyCheckError catch. noticeSend 非 site 通道 → ctx.success (note).
notice/template Delete/Update process.exit → ctx.fail. msg/ 模块 process.exit 归零.

Co-Authored-By: Claude <[email protected]>
2026-07-21 21:00:25 +08:00
sswandClaude 6d190a947c feat(dacli): menu/* 残留 wrapCommand 迁移 (create/unrelease/purge, 4 exit 收口)
create.ts runStepMachine 内部 process.exit → throw (wrapCommand catch).
unrelease 完整 wrapCommand 迁移. purge 批量命令用 ctx.partial (fail>0).
menu/ 模块 process.exit 归零 (delete/list/update 已迁移).

Co-Authored-By: Claude <[email protected]>
2026-07-21 20:50:02 +08:00
sswandClaude 1a9f18285f feat(dacli): dict/* 模块 wrapCommand 迁移 (datacreate/datadelete/dataupdate/typedelete/typeupdate + typecreate 收尾, 12 exit 收口)
datacreate 批量命令用 ctx.partial (fail>0) / ctx.success. typecreate 补齐 (runDictStepMachine process.exit → throw + 移除冗余 pre-wrap check).
data/typeupdate 复用 DirtyCheckError catch. data/typedelete process.exit → ctx.fail.
dict/ 模块 process.exit 归零.

Co-Authored-By: Claude <[email protected]>
2026-07-21 20:47:51 +08:00
sswandClaude 17c0f353ab feat(dacli): role/* 模块 wrapCommand 迁移 (create/delete/info/update, 8 exit 收口)
create.ts 从旧 printCommandEnd 升级到 wrapCommand (runRoleStepMachine 内部 process.exit → throw).
update.ts 复用 DirtyCheckError catch → ctx.fail 模式.
delete/info process.exit → ctx.fail. assign.ts 已迁移 (无变更).
role/ 模块 process.exit 归零.

Co-Authored-By: Claude <[email protected]>
2026-07-21 20:44:07 +08:00
sswandClaude c6763c4129 feat(dacli): user/* 剩余 11 文件 wrapCommand 迁移 (batch2+batch-delete, 全模块收口)
baseinfo/batch-set-position/batch-state/online-kick/delete/resetpwd/
socials-unbind/batch-delete/update/info/create — 全部 process.exit → ctx.fail.
create.ts 从旧 printCommandEnd 模式升级到 wrapCommand (保留 runCommandAutoFix fixes).
update.ts 复用 DirtyCheckError catch → ctx.fail 模式.
user/ 模块 20 文件 process.exit 归零 (100% 收口).

Co-Authored-By: Claude <[email protected]>
2026-07-21 20:41:02 +08:00
sswandClaude 2f7482c7c2 feat(dacli): user/* batch1 wrapCommand 迁移 (auth-groups/auth-list/changepwd/set-position/unlock, 5 exit 收口)
Co-Authored-By: Claude <[email protected]>
2026-07-21 20:35:35 +08:00
ssw e091907db7 feat(dacli): bigscreen/construct.ts 完整 wrapCommand 迁移 (P6 6 exit 收口)
6 处 process.exit(1) → ctx.fail():
- main action catch (构造失败兜底)
- runConstruct --from-json 文件不存在 (改 throw DacliError → handler catch → ctx.fail)
- runConstruct --from-json JSON.parse 失败 (同上)
- runConstruct validateOnly 校验失败 (原 process.exit(1) 单一分支)
- runConstruct 校验失败 (原 else 分支)
- runConstruct addObj 后端未返 id (同上)

runConstruct 内部 5 处 process.exit(1) → throw new DacliError (P5 已就绪模式)
main action 兜底 catch → ctx.fail. wrapCommand handler 自动 catch 所有 throw.

修改方式: Write 整文件重写.

验证:
  - TS compile 0 新错误 (baseline 57 不变)
  - 73/73 单元测试 PASS
2026-07-21 20:25:04 +08:00
ssw e05d87300f feat(dacli): portal/create.ts 完整 wrapCommand 迁移 (P6 4 exit 收口)
4 处 process.exit(1) → ctx.fail():
- Bug 5 category 解析失败 (resolvePortalCategory throw DacliError catch)
- step machine 校验失败
- 后端 createPortal code !== 200 (含 enhanceFromBackend 错误增强)
- BS-新12 silent fail (后端返 code=200 但 r.id undefined, list 反查仍空)

删 4 处 printCommandEnd (L3 落盘) — wrapCommand 自动调用
保留 runCommandAutoFix pipeline (silent fix 透传)
保留 resolvePortalCategory 内部 DacliError (P5 已就绪)

修改方式: Write 整文件重写.

验证:
  - TS compile 0 新错误 (baseline 57 不变)
  - 73/73 单元测试 PASS
2026-07-21 20:23:13 +08:00
ssw bb2d485d91 feat(dacli): app/create.ts 完整 wrapCommand 迁移 (P6 1 exit 收口)
1 处 process.exit(1) → ctx.fail() (catch 末尾):
- runCreate 抛 AppCreateError 或其他 Error → wrapCommand handler catch
- 显式 AppCreateError 分支: ctx.fail([step] msg, { stepName })
- 其他 Error: ctx.fail(app create 失败, { appCode, appName })

runCreate 内部 4 处 throw AppCreateError (v2.1+ P1-2b 已就绪) 不变, wrapCommand
handler 直接 catch 走 ctx.fail 收口.

console.log(JSON.stringify) → log.raw(JSON.stringify+\n) (走 quiet buffer).

修改方式: Edit (导入 + 整块 .action 替换).

验证:
  - TS compile 0 新错误 (baseline 57 不变)
  - 73/73 单元测试 PASS
2026-07-21 20:21:39 +08:00
ssw ab7ed34154 feat(dacli): menu/update.ts 完整 wrapCommand 迁移 (P6 4 exit 收口)
4 处 process.exit → ctx.fail():
- 缺 menuId (位置参数 + --id 都缺)
- BS-49 expected-enCode 不匹配 (dirty check)
- --propertyJson JSON 解析失败
- 后端 PUT code !== 200 (含 enhanceFromBackend 错误增强)

修改方式: Write 整文件重写.
与 form/update.ts 同模式 (BS-49 防覆盖 + dirty check + propertyJson 合并).

验证:
  - TS compile 0 新错误 (baseline 57 不变)
  - 73/73 单元测试 PASS
2026-07-21 20:20:55 +08:00
ssw 418afb5180 feat(dacli): workflow/update.ts 完整 wrapCommand 迁移 (P6 6 exit 收口)
6 处 process.exit → ctx.fail():
- 拉原模板失败 (step 0)
- dirty check 失败 (DirtyCheckError catch, 同 form/update 模式)
- --enabledMark=0 无 API (step 2)
- saveFlow 缺 flowId (step 2)
- saveFlow 缺 flowXml (step 2)
- 后端 saveFlow code !== 200
- 后端 PUT code !== 200 (含 enhanceFromBackend 错误增强)

dirty check 集成: 与 form/update.ts 同模式 (try { dirtyCheckFailAndExit }
catch (e) { if (e instanceof DirtyCheckError) ctx.fail(e.message, ...) else throw })

修改方式: Write 整文件重写.

验证:
  - TS compile 0 新错误 (baseline 57 不变)
  - 73/73 单元测试 PASS
2026-07-21 20:20:07 +08:00
ssw a7bae746b9 feat(dacli): doc/get.ts 完整 wrapCommand 迁移 (P6 4 exit 收口)
4 处 process.exit(1) → ctx.fail():
- section 不存在 (含可用 section 列表提示)
- 起始行超出文件长度
- ENOENT 文件不存在
- 其他 catch (log.error wrap)

console.log(sec.text/out.content) → log.raw(sec.text+\n) (走 quiet buffer,
verbose 模式即时输出, json 模式跳过 stdout 表格输出)

修改方式: Write 整文件重写.

验证:
  - TS compile 0 新错误 (baseline 57 不变)
  - 73/73 单元测试 PASS
2026-07-21 20:19:23 +08:00
ssw 901a479602 feat(dacli): report/save.ts 完整 wrapCommand 迁移 (P6 4 exit 收口)
4 处 process.exit(1) → ctx.fail():
- 拉原报表失败
- validateReportCreate 校验失败
- --cells 不是合法 JSON
- 后端 code !== 200

修改方式: Write 整文件重写.
与 report/release/publish/update 同 pattern.

验证:
  - TS compile 0 新错误 (baseline 57 不变)
  - 73/73 单元测试 PASS
2026-07-21 20:18:47 +08:00
ssw 8efb4a55e0 feat(dacli): form/update.ts 完整 wrapCommand 迁移 + _dirty_check 改 throw + test 更新
form/update.ts (5 处 process.exit → ctx.fail):
- releaseOnly 模式 后端 code !== 200
- BS-49 enCode 冲突
- --fields JSON 解析失败
- --fields 不是非空数组
- PUT 后端 code !== 200 (含 enhanceFromBackend 错误增强)

关联改动:
1. src/commands/_dirty_check.ts: dirtyCheckFailAndExit 改 throw DirtyCheckError
   (替代原 process.exit(2), 让 wrapCommand handler catch → ctx.fail)
   新增 DirtyCheckError 类 (entityType/entityId/errorCount 字段供 handler 区分)
2. tests/unit/report_wired.test.ts: 更新 report/create.ts 契约 (3 处断言)
   - printCommandEnd 6+ → wrapCommand + ctx.fail 5+
   - 成功路径 printCommandEnd success → ctx.success
   - 删 printCommandEnd 直接 import 断言 (wrapCommand 内部已包)

form/update 整合 DirtyCheckError 实例化:
  try { dirtyCheckFailAndExit(...) }
  catch (e) {
    if (e instanceof DirtyCheckError) return ctx.fail(e.message, { id, errorCount })
    throw e
  }

修改方式: Write 整文件重写.

验证:
  - TS compile 0 新错误 (baseline 57 不变)
  - 73/73 单元测试 PASS (含 test 更新)
  - workflow/update.ts 也用 dirtyCheckFailAndExit, 仍兼容 throw (下次迁 wrapCommand 时一并处理)
2026-07-21 20:16:59 +08:00
ssw 140c0dc691 feat(dacli): report/create.ts 完整 wrapCommand 迁移 (P6 5 exit 收口)
5 处 process.exit(1) → ctx.fail():
- validateReportCreate 校验失败
- --from-json-file 文件不存在
- --from-json-file JSON.parse 失败
- 后端 code !== 200
- BS-新12 silent fail (后端返 code=200 但 r 不可解析为 id)

删分散的 5 处 printCommandEnd (L3 落盘) — wrapCommand 自动调用
保留 runCommandAutoFix pipeline (silent fix 透传)

修改方式: Write 整文件重写.

验证:
  - TS compile 0 新错误 (baseline 57 不变)
  - 73/73 单元测试 PASS
2026-07-21 20:14:31 +08:00
ssw 39166d11c6 feat(dacli): report/publish.ts 完整 wrapCommand 迁移 (P6 5 exit 收口)
5 处 process.exit(1) → ctx.fail():
- 拉原报表失败
- validateReportCreate 校验失败 (basic info 缺)
- --cells 必传缺失 (publish 隐式 type=1)
- --cells 不是合法 JSON
- 后端 code !== 200 (含 enhanceFromBackend 错误增强)

修改方式: Write 整文件重写.
与 report/release/update 同 pattern (P2-2 cells JSON 预校验保留).

验证:
  - TS compile 0 新错误 (baseline 57 不变)
  - 73/73 单元测试 PASS
2026-07-21 20:13:44 +08:00
ssw 06224b8133 feat(dacli): report/update.ts 完整 wrapCommand 迁移 (P6 5 exit 收口)
5 处 process.exit(1) → ctx.fail():
- validateBasicInfo 失败 (P1-1)
- validateNumeric 失败
- report id 不存在
- --cells 不是合法 JSON (P2-2)
- 后端 code !== 200

修改方式: Write 整文件重写 (Edit 工具不匹配, step 重排风险).
与 report/release 同 pattern (P1-2 spread 后 delete systemId 保留).

验证:
  - TS compile 0 新错误 (baseline 57 不变)
  - 73/73 单元测试 PASS
2026-07-21 20:13:06 +08:00
ssw 4e2ee5f286 feat(dacli): portal/setDefault.ts 完整 wrapCommand 迁移 (P6 5 exit 收口)
5 处 process.exit(1) → ctx.fail(), 写 CommandLog (L3):
- 必传校验 (--portalId / --menuId 二选一)
- --portalId 数字校验失败 (P2-4 修复, 输 fullName 提前 fail)
- --menuId 数字校验失败
- BS-110 portalId 解析 menuId 失败
- 后端 code !== 200

迁移模式统一:
  - import { setupOutputFilter, addOutputOptions, wrapCommand }
  - 删本地 --json (改 addOutputOptions 注入)
  - Opts interface 加 verbose?: boolean
  - .action 开头 setupOutputFilter(opts)
  - 整块业务逻辑 wrapCommand 包 + try/catch → ctx.success/fail

修改方式: Write 整文件重写 (Edit 工具不匹配, step 重排风险).
注: Write tool 转义反引号时产生 quote imbalance, 后续 Python 脚本清理.

验证:
  - TS compile 0 新错误 (baseline 57 不变)
  - 73/73 单元测试 PASS

P6 累计: 剩 workflow/create (9) + form/codegen (8) + workflow/update (6) + form/create (13)
+ bigscreen/construct (6) + app/create (6) + report/update (5) + report/publish (5)
+ report/create (5) + form/update (5) = ~62 exit 散布 10 文件.
2026-07-21 20:04:36 +08:00
ssw b665b8b260 feat(dacli): di/create.ts 完整 wrapCommand 迁移 (P6 6 exit 收口, 含 step machine)
6 处 process.exit → wrapCommand handler ctx.fail():
- validation 缺 fullName/enCode/category (exit 2 → fail summary 含 3 个 bool)
- runDiStepMachineCreate 抛错 (替代原 process.exit(1), handler catch → fail)
- --from-json-file 文件不存在
- --from-json-file JSON.parse 失败
- 后端 code !== 200 (含 enhanceFromBackend + formatErrorLine 错误增强)
- (其他 try/catch 兜底)

重构关键:
  - runDiStepMachineCreate 内部 process.exit(1) → throw new Error(...)
    wrapCommand handler catch → ctx.fail(`step machine 校验失败: ...`)
    原版内部 exit 会绕开 L3 CommandLog 落盘, 改抛错后 handler 收口
  - 删分散的 4 处 printCommandEnd (L3 落盘) — wrapCommand 自动调用
  - 删本地 --verbose/--json (改 addOutputOptions 注入)
  - runCommandAutoFix 后 opts.assign 保留 (silent fix 透传)

迁移模式统一:
  - import { setupOutputFilter, addOutputOptions, wrapCommand }
  - Opts interface 加 verbose?: boolean (原 verbose 已存在)
  - .action 开头 setupOutputFilter(opts)
  - 整块业务逻辑 wrapCommand 包 + try/catch → ctx.success/fail
  - log.error 输出保留 (用户感知) + ctx.fail 收口 (供 L3)

修改方式: Write 整文件重写 (Edit 工具不匹配, step machine 重排 + 6 exit 收口风险).

验证:
  - TS compile 0 新错误 (baseline 57 不变)
  - 73/73 单元测试 PASS

P6 累计: 剩 workflow/create (9) + form/codegen (8) + workflow/update (6) + form/create (13)
+ bigscreen/construct (6) + app/create (6) + report/update (5) + report/publish (5)
+ report/create (5) + portal/setDefault (5) + form/update (5) = ~67 exit 散布 11 文件.
form/audit.ts + log/last.ts 跳过 (semantic 退出码 / meta-recursive).
2026-07-21 20:02:32 +08:00
ssw 9a59adc9ac feat(dacli): report/release.ts 完整 wrapCommand 迁移 (P6 6 exit 收口)
6 处 process.exit(1) → ctx.fail(), 写 CommandLog (L3):
- step 1: id 不存在
- step 1.5a: basic info 校验失败 (fullName/enCode/category)
- step 1.5b: numeric 校验失败 (sortCode/enabledMark)
- step 2: --type=1 必传 --cells 缺失
- step 2.5: --cells 不是合法 JSON
- step 4: 后端 code !== 200

每步 summary 含 id/type/code/msg/errors 详细 (供 dacli log last 复盘).

DEPRECATION 警告 (v0.16+) 保留在 wrapCommand 内, log.warn 进 buffer (quiet
模式下汇总输出, verbose 立即可见), 不影响 exit code.

迁移模式统一:
  - import { setupOutputFilter, addOutputOptions, wrapCommand }
  - 删本地 --json (改 addOutputOptions 注入)
  - Opts interface 加 verbose?: boolean
  - .action 开头 setupOutputFilter(opts)
  - 整块 step machine (step 1-4) wrapCommand 包 + try/catch → ctx.success/fail
  - validateBasicInfo/validateNumeric 错误保留 log.error 输出 (用户感知)

修改方式: Write 整文件重写 (Edit 工具不匹配, step machine 重排风险).

验证:
  - TS compile 0 新错误 (baseline 57 不变)
  - 73/73 单元测试 PASS

P6 累计: 剩 form/create (13) + workflow/create (9) + form/codegen (8) + workflow/update (6)
+ di/create (6) + bigscreen/construct (6) + app/create (6) + report/update (5) + report/publish (5)
+ report/create (5) + portal/setDefault (5) + form/update (5) = ~73 exit 散布 12 文件.
form/audit.ts + log/last.ts 跳过 (semantic 退出码 / meta-recursive).
2026-07-21 20:01:10 +08:00
ssw 8b8f9cf5b3 feat(dacli): di/copy + di/export 完整 wrapCommand 迁移 (P2 收口 P0-9)
2 文件 4 处 process.exit(1) → ctx.fail(), 写 CommandLog (L3):
- di/copy.ts: id 校验失败 / 后端 code!=200 / 后端未返新 id 三路径全 ctx.fail
  - summary 含 sourceId/newId/code/msg (供 `dacli log last` 复盘)
- di/export.ts: id 校验失败 / 后端 code!=200 / 后端未返 url 三路径全 ctx.fail
  - summary 含 id/name/url (下载 URL 是 OSS/MinIO 预签名短期有效, log 留痕很重要)

每文件统一模式:
  - import { setupOutputFilter, addOutputOptions, wrapCommand }
  - 删本地 --json (改 addOutputOptions 注入 --verbose --json)
  - Opts interface 加 verbose?: boolean
  - .action 开头 setupOutputFilter(opts)
  - 整块业务逻辑 wrapCommand 包 + try/catch → ctx.success/fail
  - log.error 输出保留 (用户感知) + ctx.fail 收口 (供 L3)

修改方式: Write 整文件重写 (Edit 工具不匹配, per handoff 规则 #6).

验证:
  - TS compile 0 新错误 (baseline 57 不变)
  - 73/73 单元测试 PASS

P0-9 (id 校验提示 '用 dacli di list 查 id') + P2 (wrapCommand 化) 一并收口.
剩: P2 form/create + workflow/create + form/codegen (大文件 sub-handler 拆分) + P6 大坑.
2026-07-21 18:51:33 +08:00
ssw aa21fc57ef docs(ADR 0015): P4 v3 全量收口固化 + §4.1 经验教训段
新增 §4.1 'P4 v3 全量收口 (2026-07-21)' 详细段:
- 范围修正: scan 估算 ~330 处, 实际 25 文件 33+ 处真表格. 其余分
  (a) 树/key:value dump (dict/typelist + storage/info + user/auth-groups + user/info + menu/info)
  (b) 调试日志 (form/_ai + kb/show + apis/info 等)
- 8 批 commit 表格 (15b3361 → 07463cb, 本 session 19 文件 + 前 session 6 = 25/25)
- 迁移模式固化 (代码模板)
- 6 条经验教训 (估算偏差 / Edit vs Write / UUID 截断 / --include-actions / 进度条保留 / 不需新 primitive)

§3 优先级表 P4 v3 行: '待' → '✅ DONE', 加 8 commit 引用 + ~310 散布分类

原 §4.1-4.4 顺延 → §4.2-4.5 (P0 ROI / P1 紧跟 / P3 不放 P1 前 / P5-P6 风险).

验证:
  - TS compile baseline 57 不变
  - 73/73 vitest PASS
  - P4 v3 全量收口闭环: 25/25 REAL_TABLE 文件
2026-07-21 18:48:56 +08:00