Commit Graph
659 Commits
Author SHA1 Message Date
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
sswandClaude fc2282f259 chore: remove all dacli-ts references, rename to dacli
Co-Authored-By: Claude <[email protected]>
2026-07-17 12:20:48 +08:00
ssw 08787a6f94 feat(dacli): add check_clean_comments.sh script
- Detects violation comments in dacli/src/** (BS-*/R\d+/jxcj/v0.x+ patterns)
- Whitelists _anti_patterns.ts (must retain source references)
- Run: ./scripts/check_clean_comments.sh
- Finds 1709 current violations (to be cleaned in Task 3.5)
2026-07-17 12:05:37 +08:00
ssw 60432caef2 feat(dacli): add gen-anti-patterns-md.sh + first auto-generated anti-patterns markdown
- scripts/extract_anti_patterns.ts: extracts ANTI_PATTERNS from _anti_patterns.ts to stdout
- scripts/gen-anti-patterns-md.sh: bash wrapper with --check mode for CI
- docs/anti-patterns.md: auto-generated from 25 entries across 11 commands
2026-07-17 12:03:07 +08:00
ssw 79447386ad docs(dacli): create decisions/ directory + 9 ADR documents (0001-0009) 2026-07-17 11:59:47 +08:00
sswandClaude ad1c65b975 feat(dacli): migrate 11 commands to installHelpHookWithPatterns
Migrate form/create, form/update, form/info, form/delete, menu/create,
dict/typeCreate, workflow/create, dm/create, di/create, test/run,
app/context from installHelpHook to installHelpHookWithPatterns.

Each command now passes its ANTI_PATTERNS key so --help auto-injects
relevant pitfalls (踩过的坑) content.

Co-Authored-By: Claude <[email protected]>
2026-07-17 11:55:49 +08:00
ssw d659fa2a80 feat(dacli): integrate enrichHelp into installHelpHook via installHelpHookWithPatterns 2026-07-17 11:49:25 +08:00
ssw 394b8ce867 feat(dacli): implement enrichHelp() to merge ANTI_PATTERNS into DacliHelp 2026-07-17 11:46:07 +08:00
ssw 4c114229a8 feat(dacli): populate ANTI_PATTERNS for 11 commands (25 total entries) 2026-07-17 11:43:54 +08:00
ssw a45145e5b9 feat(dacli): populate ANTI_PATTERNS['form create'] with 8 patterns 2026-07-17 11:40:40 +08:00
ssw 5d7efca370 feat(dacli): define AntiPattern interface + ANTI_PATTERNS skeleton 2026-07-17 11:36:19 +08:00
ssw 04c758d15a chore(dacli): remove installAiHelpHook alias + dead code (AI_FLAGS/getMeta/maybeInterceptAiHelp/renderAiHelp) 2026-07-17 08:59:51 +08:00
ssw 4a5cae861a refactor(dacli): migrate remaining 167 installAiHelpHook call sites to installHelpHook 260716 2026-07-16 22:13:15 +08:00
ssw 9e82b1657a refactor(dacli): migrate form/create.ts to installHelpHook (proof for Task 1.5) 2026-07-16 22:05:56 +08:00