Commit Graph
672 Commits
Author SHA1 Message Date
ssw 45e9f1053a feat(dacli): P5 sample 9 文件 throw new Error → DacliError
命令路径 9 文件 throw new Error(改 DacliError (提升 L2 catch 一致性):
  - datasource/test.ts (2 throws) — wrapCommand 内 throw
  - integration/{emailtest,smstest,webhooktest}.ts (8 throws) — input validation
  - report/{info,list}.ts (2 throws) — input failure
  - storage/info.ts:38 (1 throw) — platform 不存在错误
  - user/{auth-list,batch-state}.ts (2 throws) — 用户管理

跳过:
  - test/{run,render,generate} (10 处) — 单元测试 intentional throws
  - form/_*.ts SDK helper (_ai/_browser_verify/_buildformdata 等) — 内部 SDK 边界
  - _ssw_retry, apis/_cache — 网络重试/缓存 helper
  - menu/_helpers.ts — utility

为什么 DacliError 而不是 plain Error:
  - DacliError.code 字段 (-1 默认) 让 L2 catch 可分类 (wrapCommand 自动 catch)
  - DacliError.raw 字段保留后端原响应
  - DacliError extends Error, 现有 (e as Error).message 写法仍兼容

验证:
  - TS compile 56 baseline 不变
  - 端到端抽样: storage info nonexistent / datasource test --help / integration
    webhooktest --help 都正常
2026-07-21 17:45:54 +08:00
ssw 22593df7c4 feat(dacli): P4a console.error/warn → log.* + P6 sample wrapCommand (7 文件)
P4a (高置信, 0 风险):
  - 17 处 console.error/warn → log.error/warn across 11 文件
  - 自动 import { log } from '../core/log.ts' (没引过的)
  - 影响: _blindspot_guards/app/status/bigscreen/construct/form/release/kb/*/test/*
  - 剩 333 处 console.log 是表格输出 (new primitive log.printRawTable 待 ADR)

P6 sample (5-8 文件, 命中 7):
  - dm/list, dm/fields, dict/datalist, dict/typelist, form/info
  - workflow/info (原本 P6 raw exit, 没落 CommandLog — 顺手补全)
  - workflow/list (原本 2 printCommandEnd 重复, 双落 log)
  - 全部 try/catch/finally → wrapCommand + ctx.fail/success
  - 每个文件消除 1-3 个裸 process.exit

验证:
  - TS compile 56 baseline 不变, 0 新错误 (修了一个我自己引入的: workflow/info Opts
    interface 缺 verbose? field)
  - 端到端: dm list/fields, dict data-list/typeList, form info --summary, workflow
    list 都正确输出 + CommandLog 落盘
  - workflow/info 同时修了 CommandLog 落盘缺失的 bug (原本裸 process.exit(1), 历史
    可追溯不到)

剩余 P5 (throw new Error → DacliError, 37 处) + P6 大坑 (350+ process.exit 跨 session
治理) + console.log → log.printRawTable 新 primitive (P4 v2 范围扩大)
留待后续 session 推进.
2026-07-21 17:44:05 +08:00
ssw 5ead157903 feat(dacli): P1 dm/drop TTY 拦截 + workflow shim 清理 (11 文件)
P1 (0.5h):
  - dm/drop.ts 加 TTY 拦截 — 镜像 form/delete.ts:25 + print/delete.ts:46 +
    report/delete.ts:39 已稳定的 pattern: `if (!opts.yes && process.stdin.isTTY)` 时
    warn + exit 1; 非 TTY 模式 (CI/脚本) 静默 --yes 走即可. 同步 DOC 注释 + 移除 TODO.
  - storage/info.ts:38 DacliError 分叉 — 验证**实际不存在** (`class DacliError`
    仅 src/core/types.ts:57 一处定义, 已被 storage/_helpers.ts:21 正确 import).
    ADR 0015 §2.2 早期记述有误, 修订清空.

shim 清理 (0.5h):
  - 11 个 workflow 子命令 (approve/create/decision/delete/info/launch/list/
    selector/syncForm/tasks/update) 把 `import { ... } from './_output.ts'`
    改成 `from '../_output_filter.ts'` (1 行 sed × 11 文件).
  - 删除 src/commands/workflow/_output.ts shim 文件 (D 掉), 减少 1 个间接层.
  - 不影响 L1 输出过滤 / L3 CommandLog 落盘, 因接口签名不变.

验证:
  - TS compile: 56 errors baseline 不变, 0 新错误
  - 68/68 单元测试 PASS (含 tests/unit/workflow/create_stale_retry)
  - 端到端: dacli dm drop --help + dacli workflow info --help 完整
2026-07-21 17:35:09 +08:00
ssw 72766bc629 docs(ADR 0015): mark P3 done (715fcb9 18 _validate.ts 统一 import) 2026-07-21 17:21:39 +08:00
ssw 715fcb9a59 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 实际无重复).
2026-07-21 17:20:55 +08:00
ssw a5c22b98d3 docs(0015): 源码 5 类遗留清单 (v2.2+ 实证 P0 已 done + P1-P6 待办)
基于 c637a58 wrapCommand 实证重建 (上次 86d9dac 因太早被 7cdc818 revert).

5 类遗留 (§2):
  - §2.1 P0 printCommandEnd 5c 样板 ✅ DONE (c637a58)
  - §2.2 P1 2 个已知 baseline 坑 (dm/drop + storage/info)
  - §2.3 P2 25+ 高严重度文件批量
  - §2.4 P3 18 个 _validate.ts 错误码 import 不一致
  - §2.5 P4 addOutputOptions 已加但 stdout 风格不统一
  - §2.6 P5 console.log + throw 统一 (4+h 大改)
  - §2.7 P6 350+ 裸 process.exit 跨 session 治理 (大坑)

决策依据 (§4):
  - P0 为什么 ROI 极高: 一行 helper = 30+ 行样板 + 单测 17 条已稳
  - P1 紧跟: 独立 1 文件修改, 风险极低
  - P3 不放 P1 前: 批量一致性调整 < 已知坑修复
  - P5/P6 大坑单独排期

README §引用: ADR 索引 0001-0015 系列, 版本加 v2.2+ wrapCommand.
2026-07-21 17:05:31 +08:00
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
ssw 7cdc8187cc Revert "docs(0015-source-leftovers): 源码 5 类遗留清单 + P0-P6 优先级路线"
This reverts commit 86d9dac83d.
2026-07-21 16:38:00 +08:00
ssw 86d9dac83d docs(0015-source-leftovers): 源码 5 类遗留清单 + P0-P6 优先级路线
扫描方法: Explore agent 全 codebase 扫描 dacli/src/commands/*.ts, 5 类规则 + 文件:行号.

5 大类遗留:
1. 裸 process.exit — 350+ 处 / 35+ 文件 (printCommandEnd L3 落盘被绕过)
2. console.log 残留 — 360 处 / 96 文件 (L1 stdout 三模式受影响)
3. throw new Error 未统一 DacliError — 37 处 (类型分叉风险)
4. TODO 注释 — 仅 3 处 (form/codegen --auto-menu + dm/drop TTY 拦截)
5. 重复 boilerplate:
   5a addOutputOptions helper 覆盖不全 (38 文件手写 verbose/json)
   5b per-module _validate.ts 18 处复制 ValidationError interface
   5c printCommandEnd 失败收口样板 30+ 处重复, 无 helper 收口 (这是 P0 高 ROI)
   5d history_bak backup name 字符串仅 app/clear.ts 单文件 6+ 处重复

优先级路线 (P0-P6, P0 最高价值 1 小时 + P1 0.5h 是 1 文件快修):
- P0 (1h, 极高): wrapCommand(handler) helper 收口 5c
- P1 (0.5h, 高): storage/info.ts:38 分叉修复 + dm/drop.ts TTY 拦截
- P2 (2-3h, 高): 大批量 printCommandEnd + try/catch 改造 (25+ 文件)
- P3 (1h, 中): 18 _validate.ts 改 import ValidationError
- P4 (1h, 中): addOutputOptions 38 文件迁移
- P5 (4+h, 中低): 360 console.log + 37 throw 统一
- P6 (大坑, 极高): 350+ process.exit 全量重构 (单 session 不可能, 留独立 ADR)

不做源码改造 (本 session 已收尾):
- 已完成 6 commits (本 session) + 全部关键闭环
- 源码层遗留是 massive 后续工程, 强行做会引入更多问题
- 留 ADR 让后续 session 拿优先级列表直接挑目标

下游 hook:
- 任一 P0-P4 完成时更新本 ADR 状态 (Superseded by 0016-...) 或新增 ADR
- P6 350+ process.exit 太大坑, 留跨 session 专项治理
2026-07-21 16:25:37 +08:00
ssw 1e2a271713 docs(README): ADR 索引更新 0010 → 0014
闭合本会话遗留集成:
- 历史决策段引用 `0001-0010 系列` → `0001-0014 系列`
- 加注 ADR 0014 app clear 覆盖 (用户指引找到最新决策)

配合 .claude 773cc98 (关卡 I 注册) + dacli f7bc8d5 (ADR 0014) 形成完整索引
2026-07-21 16:05:55 +08:00
ssw cab1bb45f3 tier3(app/clear v3.1+ P1-2 follow-up): 业务库 preview fallback 走 dacli dm list
ADR 0014 §Downstream §2: 当 ssw-common DbClearServiceImpl.listBizTables
走 openConn(appCode, null) 对 PG schema 共享库 (j62 schema=jxcj) 不识别
业务表时, dacli 端自动 fallback 走 loadDataModel.getDataModelList
(dacli dm list 内部用 GET /api/system/DataModel/{dbLinkId}/Tables)

实现细节:
- fetchDbPreview 拿 ssw-common preview 结果后, 仅当:
  * bizTables.length === 0 (ssw-common 漏识别)
  * token.appCode === opts.appCode (避免跨 app 误报)
  走 fallback loadDataModel.getDataModelList(linkId=token.dbLinkId, ...)
- 跨 app 场景: 输出明确警告 + 提示 dacli app login --appCode=...
- rowCount=0 (dacli dm list 不查行数; 用于透明显示"会被清的表清单")

E2E 测试:
- testspace (ssw-common 正常): 输出无 fallback 警告 (72 张表已由 ssw-common 列出)
- jxcj (跨 app 测试): 输出 "ssw-common 业务库 preview 返空, 但 token 当前 appCode=testspace ≠ jxcj"
  + 提示 "如需看 jxcj 真实业务表, 请: dacli app login --appCode=jxcj"
  不会拿 testspace 的 72 张表冒充 jxcj 表 (避免误报)

已知 fallback 局限:
- 实际 fallback 完全发挥需要 dacli app login --appCode=jxcj 后才能列 jxcj 表
- 但 jxcj 系统被基础架构清理过, 当前 token=testspace 无法直接登录
- 真实业务表清理仍依赖 ssw-common 端点 (其 P0 fix 在 ADR 0014 §1, 需 Java 改 + 重启)

TS 编译: 0 新错误
CI 关卡 G: 23 PASS / 0 FAIL (白名单 di 模块架构差异)
2026-07-21 15:56:05 +08:00
ssw f7bc8d55d0 docs(0014-app-clear-docs-coverage): app clear docs 残留缺口决策记录
事实: docs/jxcj 实测 14 项残留 (8 MD + 4 子目录 + 设计说明)
      不被清理, 历史 DOC_HTML_FILES 只清 4 html

根因: docs/dacli/ssw-dacli/.../ClearAppCommand.java 用 DOC_HTML_FILES 白名单
      Dacli 也复用了同样限制, 漏了所有非 html 文件

修复 (P1-2d commit 60adaab): dacli 端加 --clean-docs flag (默认 false 保持向后兼容)
  true:  docs/{app}/ 整体打包成 FileTarget, 移到 history-bak/{ts}/files/docs/{app}/
  false: 历史行为 + DRY-RUN 警告提示残留项数 + 提示 --clean-docs

决策依据:
- docs/{app}/ 是 ssw-loop 关卡 A/B/C 强依赖 (design/testcase/summary/learnings/plan/debug + _assets 6+ MD)
- 默认不改, 用户显式加 --clean-docs 才真清, history-bak 保留可还原
- 与 P0-3 (2026-07-15) DB fallback 同模式: --no-relation-form-auto / --autoRelease 等 flag

已知 ssw-common 端点 bug (留下游路线 §1):
- DbClearServiceImpl.listBizTables 走 openConn(appCode, null) 把 jxcj 当独立 db
- 但 jxcj 在 PG 共享库 j62 schema=jxcj, 不是独立 db
- 修复需要改 Java 5-10 处 + Maven 编译 + JNPF 重启 (Java 无 devtools auto-reload)
- 风险: testspace 当前活跃测试会中断
- 跨项目路线, 不在 dacli 端实现

下游路线 (ADR §Downstream):
1. ssw-common 端点改进 (跨项目, 高优)
2. dacli 端 fallback 查询 (P1, 中优)
3. ssw-loop 关卡 check_clear_coverage.sh (P2, 低优)
4. dacli app history 子命令 (P3, 远期)

E2E 验证 (testspace 默认应用):
- DRY-RUN --clean-docs 显示 [MOVE] docs/testspace/ 整体打包
- 业务库 preview 列出 72 张表 (testspace schema=public 正常工作)
- jxcj schema=public 不识别业务表 (符合 ADR §已知风险)

README 路径速查表加 "--clean-docs 行为" 行, 指向 0014-ADR
2026-07-21 15:47:19 +08:00
ssw 60adaab4b1 tier3(app/create, app/clear v3.0+ P1-2b/c/d): 三层接入 + docs/{app} 完整清理
P1-2b app/create.ts (5-step refactor):
- 4 处 process.exit(1) 改为 throw AppCreateError(stepName, message)
  step 1 createSystem (rCode != 200)
  step 1 创建后未找到 id
  step 2 DB fallback 仍失败
  step 3 dblinkExt/create 失败
- action 用 try/catch 集中调 printCommandEnd failure 路径
- runCreate 返回 success summary {systemId, dbLinkId, dbName} 给 action 走 success path
- L1/L2/L3 boilerplate 完整接入, runCommandAutoFix (S-X1 enCode strip silent)

P1-2c app/clear.ts (三层接入 + audit trail):
- L1: --verbose / --json 新增 (默认静默, --dry-run + --json 给 AI 解析清单)
- L2: 跨命令 auto-fix (S-X1 enCode strip silent)
- L3: 集中 try/catch 调 printCommandEnd 强制落 CommandLog (destructive command 强 audit, --dry-run 也落)
- requireTty() process.exit(1) 改 throw DacliError, 让外层 catch 接管

P1-2d (v3.0+) app/clear.ts 加 --clean-docs flag:
事实: docs/jxcj 实测 14 项残留 (8 MD + 4 子目录 + 设计说明) 不被清理
      历史 DOC_HTML_FILES 只清 4 html, 漏了 design/testcase/learnings/debug/research/plan/summary md
      + _assets/test_logs/screenshots/scripts 子目录 + 设计说明
缺口原因: 上一版(包括 Java 版)用 DOC_HTML_FILES 白名单, 漏了非 html 文件
修复: 加 --clean-docs flag (默认 false 保持向后兼容, docs 是设计依据建议保留)
  true:  docs/{app}/ 整体打包成单个 FileTarget, 移到 history-bak/{ts}/files/docs/{app}/
  false: 历史行为, 但 DRY-RUN 警告提示残留项数 + 提示用 --clean-docs

测试:
- npx tsc --noEmit 0 新错误 (app/create + app/clear 干净)
- DRY-RUN (jxcj 默认) 警告: docs/jxcj/ 残留 14 项: _assets, debug.md, design.md, ..., screenshots
- DRY-RUN (jxcj --clean-docs) fileTarget: [MOVE] docs/jxcj/ (整体而非单 html)

已知 baseline pre-existing:
- ssw-common DbClearServiceImpl.listBizTables 走 openConn(appCode) 对 PG 共享库 (j62) + schema=jxcj 不识别
  jxcj 业务库预览显示 "业务库 jxcj: (无表或不存在)"
  实际 jxcj 11 张业务表 (competition/team/...) 在 j62 schema=jxcj 下
  这是 ssw-common 端点层 bug, 不在 dacli 改, 后续触发 PG biz conn 改进 ADR
2026-07-21 15:43:31 +08:00
ssw bcf874db2b tier3(print/msg/org/schedule/app, 7 files): 跨命令 auto-fix pipeline 接入 (S-X1/S-X2 silent + G-X1 suggest + L3 CommandLog 落盘)
参照 dict/typecreate.ts:14-66 boilerplate, 给写操作命令补齐三重提醒三重修复:

L1 (--verbose/--json stdout 三模式): setupOutputFilter from _output_filter.ts
L2 (silent/assertive/suggest 三级 fix): runCommandAutoFix + fetchExistingLists from _auto_fix.ts
L3 (CommandLog 落盘, 失败也落): printCommandEnd from _output_filter.ts

修改文件:
- print/create.ts (先于 dfeb935 自动 commit)
- org/create.ts
- msg/noticecreate.ts (MSERR114)
- msg/templatecreate.ts (MSERR114 + 端点修复注释保留)
- schedule/create.ts (SYS131 时间关系)
- schedule/trigger.ts (W11-D4 手动触发, 仅 L1+L3)
- app/login.ts (Phase E base_system 检测 + app 不存在回滚命令)
- app/context.ts (新会话第一步入口, L3 落 dbLinkId/forms/menus 数量)

未触及 (留待后续 batch):
- app/create.ts: 5-step 复杂创建 (system→DB→DataSource→授权→重登), 5 处 process.exit(1) 需重构为 throw + 集中 try/catch, 超出本轮估算
- app/clear.ts: 30KB destructive 操作, 三层接入风险 > 收益, 需先 --dry-run 保护再接入
- 已知 baseline pre-existing bugs: org/create 的 405 后端路由 fallback 问题, msg/notice 的 GET fallback 405 — 与本 commit 无关

L1 验证: npx tsc --noEmit 0 新错误 (7 文件相关 error 为空)
L2/L3 e2e 抽样:
- msg templateCreate S-X1/S-X2+L3 跑通 (e2e id=849237951593317317 已清理)
- print create S-X1+S-X2+L3 跑通 (前置 commit dfeb935)
- app context --json 单行 JSON + L3 落盘跑通
2026-07-21 13:09:13 +08:00
ssw dfeb935ac8 auto(bfc0cfa2c3a4): session end @ 2026-07-21T12:59:18 (+1f) 2026-07-21 13:00:16 +08:00
ssw a104101a8a feat(dacli): info 类接 CommandLog + README 路径速查更新 + drift 日志归档
src/commands/form/info.ts: --json 特殊语义 (BS-新1 解码 formData escaped) 用手动 .option(--verbose) 避开 addOutputOptions 重复 --json 注册
src/commands/dict/datalist.ts: try/catch/finally + CommandLog L3
src/commands/dm/{list,fields}.ts: 同模式

README.md: 路径速查表加 datasource/storage/integration/report + G-X1 workflow 扩展提示 (2026-07-21 nginx 尾 slash 调整后)

docs/drift/2026-07-20-d0720-jxcj.md: jxcj drift 日志归档
tests/unit/defhttp_shim_envelope.test.ts (新): defhttp shim envelope 单元测试
2026-07-21 13:00:16 +08:00
ssw 40e04eb4fd feat(dacli): report 三层接入 + static contract 测试
src/commands/report/{create,list,info}.ts: 4 步 pattern (imports → addOutputOptions → setupOutputFilter + runCommandAutoFix → printCommandEnd)
- report/create.ts: 删 inline autoStripEnCode (改由 runCommandAutoFix S-X1 统一)
- report/create: 5 失败 + 1 成功 printCommandEnd 调用
- report/list + info: try/catch/finally, process.exit(1) 在 finally 兜底

tests/unit/report_wired.test.ts (新): 22 个静态契约测试
- 防止未来被悄悄撤掉 3 个 helper (regression detection)
- runtime smoke: --help 注册 --verbose/--json
2026-07-21 13:00:16 +08:00
ssw 508cabface feat(dacli): v2.1+ 命令输出 + auto-fix helper (含 workflow G-X1 扩展)
src/commands/_output_filter.ts (新): 跨命令输出过滤 + CommandLog 落盘
  - setupOutputFilter: 默认 quiet, --verbose/--json 解除
  - addOutputOptions: 注册 --verbose/--json
  - printCommandEnd: 落 L3 CommandLog + 打印 L1 summary + 'dacli log last' 提示
  - 三档 result: success / partial / failure

src/commands/_auto_fix.ts (改): workflow enCode 也参与 G-X1 BS-47 重名查重
  - CommandFixContext 新增 existingWorkflows 字段
  - fetchExistingLists 加 workflows flag + GET /workflow/template 调用
  - fixUniquenessSuggest 把 workflows 加入 allExisting 冲突检查

tests/unit/output_filter.test.ts (新): 11 个 helper 单元测试

tests/unit/auto_fix.test.ts (新): 23 baseline + 3 本 session workflow G-X1 测试
2026-07-21 13:00:16 +08:00
ssw 3d4002f6cc auto(bfc0cfa2c3a4): session end @ 2026-07-21T12:22:16 (+15f) 2026-07-21 12:22:16 +08:00
ssw bf7edeae8c auto(bfc0cfa2c3a4): session end @ 2026-07-21T12:08:09 (+7f) 2026-07-21 12:08:09 +08:00
ssw f058ddead0 auto(bfc0cfa2c3a4): session end @ 2026-07-21T11:39:46 (+16f) 2026-07-21 11:39:46 +08:00
ssw 2c849e1604 auto(bfc0cfa2c3a4): session end @ 2026-07-21T11:03:58 (+5f) 2026-07-21 11:04:00 +08:00
ssw 42fe387621 auto(bfc0cfa2c3a4): session end @ 2026-07-21T10:32:05 (+6f) 2026-07-21 10:32:06 +08:00
ssw a949cfadd1 auto(bfc0cfa2c3a4): session end @ 2026-07-21T09:47:17 (+5f) 2026-07-21 09:47:17 +08:00
ssw 84b5e39c2e auto(bfc0cfa2c3a4): session end @ 2026-07-21T08:54:25 (+1f) 2026-07-21 08:54:25 +08:00
ssw 7997d73db9 auto(bfc0cfa2c3a4): session end @ 2026-07-20T22:28:44 (+1f) 2026-07-20 22:28:45 +08:00
ssw e10086fcea auto(bfc0cfa2c3a4): session end @ 2026-07-20T22:23:58 (+10f) 2026-07-20 22:23:58 +08:00
sswandClaude 9f0473563a chore(dacli): add README 5 大铁律速查 + workflow output filter helper
文件:
- README.md (新增): dacli 基本原则速查, 5 大铁律 (web 源码权威 / 不写 LLM prompt /
  镜像架构 0 漂移 / dacli form 信息完整 / 不绕过 dacli), 跨 app 通用
- src/commands/workflow/_output.ts (新增): workflow 命令输出过滤 helper
  复用 dacli form 的输出过滤模式 (log.setQuiet + --verbose + --json +
  完成后 '详情: dacli log last' 提示)

清理: 解决 2026-07-20 提醒的 'git 改动没切过来' 问题,
  把今日 (2026-07-20) untracked 的 2 个文件 commit 进来

stash@{0} (707c3fb 'ssw-h5dev-flow v0.9 lint + dispatch 协议固化') 不动, 等其他 session 处理

Co-Authored-By: Claude <[email protected]>
2026-07-20 20:26:33 +08:00
sswandClaude 4f30cf35ad fix(help): 补加 installHelpHookWithPatterns export (merge 后 main 跑不起来)
来源: 2026-07-20 合并 p1-8-browser-auto-login 到 main 后, 跑 dacli form info 报
  'installHelpHookWithPatterns is not exported'

根因: merge 时 help.ts 没冲突 (main 没有这个 export) 所以保留 main 原状态,
  但 create.ts / info.ts 在 p1-8 上改用 installHelpHookWithPatterns (d659fa2 加的)
  合并后 import 找不到对应 export

修复: 在 help.ts 加 import { enrichHelp } from '../commands/_anti_patterns'
  + 加 installHelpHookWithPatterns 函数 (单函数, 调用 enrichHelp 增强 help)

验证: dacli form info <formId> --summary 跑通

Co-Authored-By: Claude <[email protected]>
2026-07-20 19:48:03 +08:00
ssw ef1bb0a137 merge p1-8-browser-auto-login (2026-07-20)
合并内容:
- 27d508a BS-18 BUG 修 (modelId 用 formId 而非 enCode) + BS-新62 失败兜底 (applyHeuristicRelationForm) + form/update 物理表同步 log
- bbcdf9f M2 实战固化 (jxcj 2026-07-20)

修复 jxcj 2026-07-16 阶段 7 + 2026-07-20 实战:
- 9 张新表 relationForm 字段自动含 modelId (不靠 AI Login expired 失败的 smartProps)
- form create '✓ 物理表已建' log 透明化物理表状态
- form update '⚠ 物理表未同步' 警告 + 修复路径提示

详见 .claude/skills/dacli-ts/references/anti-patterns §15.1 §15.2 + form-physical-table-sync.md + form-create-ai-prompt-template.md

Co-Authored-By: Claude <[email protected]>

# Conflicts:
#	src/core/help.ts
#	tests/core/help.spec.ts
2026-07-20 19:37:52 +08:00
ssw bbcdf9fab2 dacli: M2 实战固化 (jxcj 2026-07-20)
3 跨项目问题 + 修复 + 文档:

1. ADR 0011 — dm drop DB201 错误信息明确化
   - 旧: 表有数据时报 DB201 "The table has already been used" 误导用户
   - 新: catch DB201 输出修复指引 (TRUNCATE + ADR 0011 P1 待加 dm truncate 命令)
   - 文件: src/commands/dm/drop.ts + docs/cmd-review/dm.md + docs/decisions/0011

2. ADR 0012 — form create --ai relationForm 软降级
   - 旧: AI 生成 relationForm 缺三元组 (~40%) 触发 step machine 硬 FAIL
   - 新: validateFormData 软降级 — 三元组不全时自动改 jnpfKey='input' + 警告 (而非硬错)
   - 测试: 4/4 PASS (含缺 1/2/3 个三元组场景, 均软降级)
   - 文件: src/commands/form/_validate.ts + docs/cmd-review/form.md + docs/decisions/0012

3. ADR 0013 — menu create CurrentUser 缓存阻塞
   - 现象: menu create --formId 成功后 CurrentUser.menuList 不刷新, TC-B 阻塞
   - 修复: P1 待加 menu cache clear + menu create 后自动 invalidate
   - 兜底: test browser fallback 到 /jnpf_app_${appCode}/model/${formEnCode} 直接 URL
   - 文件: docs/cmd-review/menu.md + docs/decisions/0013

jxcj M2 重启 (2026-07-20) 实战产出, 跨项目通用 (testspace/developSystem/workSystem/dos 等)
详见 docs/jxcj/summary.md + docs/jxcj/learnings.md 阶段 4 段
2026-07-20 18:02:38 +08:00
ssw a10a829a86 auto(bfc0cfa2c3a4): session end @ 2026-07-20T14:09:33 (+11f) 2026-07-20 14:09:35 +08:00
ssw cd724ca53e auto(bfc0cfa2c3a4): session end @ 2026-07-20T13:40:51 (+1f) 2026-07-20 13:40:53 +08:00
ssw 7a69fe2f33 auto(bfc0cfa2c3a4): session end @ 2026-07-20T13:01:24 (+1f) 2026-07-20 13:01:25 +08:00
sswandClaude 3d45ac8f3b fix(dacli): default log._quiet=false — only form create opts in
Other commands (app/dict/menu/dm/etc) were silently broken because
log._quiet defaulted to true, swallowing all output. Now defaults
to false; only form/create.ts calls log.setQuiet(true).

Co-Authored-By: Claude <[email protected]>
2026-07-20 11:55:27 +08:00
sswandClaude 7b0ef40f38 fix(dacli): remove process.on('exit') flush — error output now clean
Error path: only log.error() messages shown (stderr, always visible).
Buffer discarded on process.exit(), no noise from process logs.
--verbose still shows full 26-line output for debugging.

Verified 3 scenarios:
  Default success:   2 lines (v2 summary)
  --verbose success: 26 lines (full process logs)
  Default error:     6 lines (only errors, no buffer dump)

Co-Authored-By: Claude <[email protected]>
2026-07-20 11:01:39 +08:00
sswandClaude 4e5e271019 feat(dacli): default quiet output + --verbose for full logs
- log.ts: add setQuiet/flush/discard buffer mode
- form/create.ts: default quiet (2-line summary), --verbose for full output
- Error messages always go to stderr regardless of mode
- process.on('exit') fallback: flush buffer on crash to preserve context

Output comparison:
  Default:  ✓ quiettest  (id=...)  修正 1 处  [5.3s]
             详情: dacli log last
  --verbose: 26 lines (v1 behavior preserved)

Co-Authored-By: Claude <[email protected]>
2026-07-20 10:56:32 +08:00
sswandClaude 741a175766 feat(dacli): v2.0 auto-fix pipeline + structured logging
Core changes:
- _auto_fix.ts: 3-tier fix pipeline (Silent/Assertive/Suggest)
  - Silent: jnpfKey whitelist, child table component restrictions, _fk suffix removal
  - Assertive: datetime→datePicker, timePicker→datePicker, int+dict→select, FK→relationForm
  - Suggest: FK找不到匹配表单, int+select缺dictType
- logfile.ts: structured JSON logs under ~/.dacli/logs/{appCode}/
- log/last.ts: dacli log last command for querying
- form/create.ts: integrated auto_fix pipeline + AI token pre-check auto-re-login

Verified:
- NCPF AI token expired → auto re-login before AI call
- f_signup_time (timePicker) → auto-fixed to datePicker ✅
- f_user_id (inputNumber) → suggestion (no matching 'user' form in testspace)
- Output ends with v2 one-line summary + 'dacli log last' hint

Co-Authored-By: Claude <[email protected]>
2026-07-20 10:35:12 +08:00
sswandClaude 61405e128d fix(dacli): resolve merge conflicts + add v2 architecture spec
- resolve 10 merge conflicts across 4 files (app/init, dict/typecreate, form/create, webapi/_defhttp)
- fix syntax errors in typecreate.ts (commented-out if block)
- add ADR-0010: dacli v2 self-correcting CLI architecture design
- add simulation test comparing v1 vs v2 behavior

Co-Authored-By: Claude <[email protected]>
2026-07-20 10:11:41 +08:00
ssw ec10f7ddfc auto(bfc0cfa2c3a4): session end @ 2026-07-20T08:58:21 (+1f) 2026-07-20 08:58:21 +08:00
ssw 5a8cbca732 chore(.claude): archive dacli-ts + jnpf-browser-automation skills, clean CLAUDE.md references 2026-07-17 13:26:49 +08:00
ssw a650cf6b04 test(dacli): final dogfood regression test — all 9 success criteria PASS 2026-07-17 12:51:50 +08:00
sswandClaude 761405a8b7 chore(dacli): clean comment violations batch 5 (5 files)
Files: test/run.ts, form/import.ts, form/audit.ts, dm/_validate.ts, workflow/_validate.ts

Co-Authored-By: Claude <[email protected]>
2026-07-17 12:46:53 +08:00
sswandClaude 5a8bc1d1f5 chore(dacli): clean comment violations batch 4 (5 files)
Files: report/index.ts, form/update.ts, form/_smart_props.ts, di/_lookup.ts, dict/typecreate.ts

Co-Authored-By: Claude <[email protected]>
2026-07-17 12:43:23 +08:00
sswandClaude da43d93af3 chore(dacli): clean comment violations batch 3 (5 files)
Files: app/context.ts, _encode_validator.ts, form/release.ts, di/update.ts, test/browser.ts

Co-Authored-By: Claude <[email protected]>
2026-07-17 12:40:30 +08:00
sswandClaude cbeb429a6d chore(dacli): clean comment violations batch 2 (5 files)
Files: form/_validate.ts, di/create.ts, form/_ai.ts, workflow/create.ts, dict/_validate.ts

Co-Authored-By: Claude <[email protected]>
2026-07-17 12:34:30 +08:00
sswandClaude 42e596aecc chore(dacli): clean comment violations in top 5 files (batch 1)
Files cleaned: form/create.ts, _blindspot_guards.ts, form/codegen.ts,
test/render.ts, menu/create.ts

- Removed BS-*/R\d+/v0.x+/date markers from comments
- Cleaned app name references (jxcj/workSystem/developSystem/tds) in comments
- Updated check_clean_comments.sh to only flag comment lines
- Added scripts/clean_comments.py for automated comment cleaning
- Vitest: 22 tests pass, 0 errors

Co-Authored-By: Claude <[email protected]>
2026-07-17 12:28:52 +08:00
ssw 3f87c226c2 auto(bfc0cfa2c3a4): session end @ 2026-07-17T12:25:27 (+1f) 2026-07-17 12:25:27 +08:00
sswandClaude b37564171b ci(dacli): add check_no_dacli_ts_refs.sh CI gate
Co-Authored-By: Claude <[email protected]>
2026-07-17 12:24:56 +08:00
ssw c22695b5ca auto(bfc0cfa2c3a4): session end @ 2026-07-17T12:23:13 (+2f) 2026-07-17 12:23:13 +08:00