Commit Graph
758 Commits
Author SHA1 Message Date
ssw df213fdfad fix(dacli-docs): 修审计报告 14 项 + 加 CI 校验防再漂 (P0/P1/P2 全清)
审计报告 docs/dacli-doc-audit-report.md 14 项全部采纳:

P0 (3 项事实错误, 直接误导 AI 执行):
- ANTI_PATTERN F_→f_ 前缀 (form update --fields 实际是小写)
- ANTI_PATTERN AP-fc-4 vs AP-fu-1 矛盾 (统一指向 form import --autoTable)
- ANTI_PATTERN form info <enCode> 误导 (改为 <id>, 加 enCode 自动解析 fallback)

P1 (3 项文档漂移):
- CLAUDE.md "含 FK 时必用 --fields" → 实际已废弃, 删除 + form/create.ts Commander 加 DEPRECATED
- doc/get.ts 引用 Java DocCommand.java → 改指 TS _parser.ts
- AP-fd-1 "--cascade 必带" 过度约束 → 改为可选

P2 (2 项衔接断裂):
- Source 路径 web/.../ → web/apps/jnpf-web-apps-main/src/ (73 文件)
- test/run TC-B 前置提示 (需 menu 挂载)

附加 (CI script 抓出的 8 条额外路径 drift, 已就近修正):
- di/create|export|copy: DataInterfaceController.java 路径补 jnpf-java-boot/ + jnpf/base/controller/
- print/delete|update: PrintDevController.java 同上
- org/create: OrganizeController.java 路径 jnpf/controller/ → jnpf/permission/controller/
- form/codegen|audit: FormGenerator/FormGenerator.vue 加 /components/ + /src/ 前缀
- workflow/create: flowEngine + FlowProcess 加 views/onlineDev/ + components/ 前缀
- workflow/syncForm: FlowableProcessDesigner.vue 不存在 → 改指 Form.vue
- msg/notice*: notice.ts 不存在 → 改指 msgMonitor.ts
- bigscreen/delete|update: 双前缀 web/.../src/jnpf-web-datascreen-vue3/ → jnpf/前端/
- app/login: api/auth.ts → api/core/auth.ts
- apis/refresh|status|info: Java ApiService 路径 → TS 化指向
- test/render: sysData/formDesign 加 views/ 前缀
- form/create: formDesign/Form.vue 加 views/onlineDev/ 前缀

Task 1.6 收尾: 删 core/help.ts legacy (~85 行 dead code):
- AI_FLAGS / getMeta / maybeInterceptAiHelp / renderAiHelp
- installAiHelpHook alias / _aiMeta 副作用 / AiHelp type alias

新增 docs/doc-drift-findings-2026-07-24.md (2 条无法自动修复的 docs 路径, 待人工)

新增 scripts/check-doc-drift.ts (scripts/check-doc-drift.ts, 218 行):
- 4 类检查: 命令引用 / arg-opt 一致性 / source 路径 / ANTI_PATTERNS 命令引用
- 接入 npm run doc:check
- 验证: 修复前 21 处 drift → 修复后 2 处 (已归档)

测试: typecheck 0 errors, 387/387 tests pass, doc:check 报告 2 known issues
2026-07-24 16:33:31 +08:00
ssw 4cc0df3ced auto(14b5ea1b9bd9): session end @ 2026-07-24T15:56:59 (+6f) 2026-07-24 15:57:01 +08:00
sswandClaude 891a600245 test(guards): P2.5 — verify guards effective, reconcile stale test, un-quarantine
Verified (evidence, not guess): the guards ARE effective — command-scoped by design,
wired into form/create, form/release, dm/create, menu/create; BS-47/BS-50 fire
correctly when called with their command (as all production callers + verify_option.test.ts do).
The 12 failures were a STALE test, not broken guards:
- 8 'should-trigger' used pre-command-scoping calls → added command args (BS-47 'dict typeCreate', BS-50 'menu create')
- BS-15b / BS-28 / BS-32b: guards removed from registry long ago → dropped stale assertions
- BS-5: real check is ctx===null (not 'empty existingEnCodes') → fixed test
- BS-51 WARN / BS-44 INFO / BS-60 ERROR: test asserted wrong levels → fixed
- BS-60 repurposed (invalid jnpfKey / placeholder columnOptions, not missing vmodel) → fixed trigger
Impl: fixed objective dup-id bug — renamed 2nd 'BS-14' (type=4 view-release WARN) → 'BS-14b'.
Un-quarantined: removed --exclude from scripts/quality-gate.sh.

Verified: full gate green WITH blindspot_guards (tsc 0 + all unit incl. 41/41 guards + smoke).

Co-Authored-By: Claude <[email protected]>
2026-07-24 13:45:48 +08:00
sswandClaude 2c38b4666d refactor(exit): P6c-2 — migrate 6 mutation commands to wrapCommand
Failures now route through ctx.fail → CommandLog (dacli log last) instead of bare
process.exit(1); success → ctx.success. Follows the form/delete exemplar.
- form/import (3 fails→ctx.fail), form/fix_entity (2 pre-flight guards kept, success→ctx.success),
  form/bindflow (persistence-verify fail→ctx.fail), app/logout, kb/deprecate, kb/entry
- pre-flight/interactive guards (未登录/未找到目录) stay as pre-flight process.exit (user abort, not loggable)

Scope note: app/use was NOT migrated (reverted) — it is a display command (like
app/status/context) whose value is its context output; wrapCommand's quiet-by-default
would suppress that. wrapCommand fits mutations, not display commands.

Verified: tsc 0; gate green (vitest 336); app use display intact; log lines net-zero
(only re-indented); form/delete exemplar already proved the ctx.fail runtime path.

Co-Authored-By: Claude <[email protected]>
2026-07-24 13:03:28 +08:00
sswandClaude 6009044fec refactor(exit): P6c-2 exemplar — migrate form delete to wrapCommand
First of the mutation-command wrapCommand migrations. Delete failure now routes
through ctx.fail → CommandLog (dacli log last) instead of bare process.exit(1).
The --yes interactive confirmation stays a pre-flight guard (user abort, not a
loggable failure). Establishes the transform pattern for the remaining mutation cmds.

Key scoping finding (recorded in PLAN P6c-2): wrapCommand adds printCommandEnd
side-effects meant for MUTATIONS — READ/utility commands (log/*, app/status·context,
kb/show·audit, test/generate, form/preview) should NOT be wrapped (output noise, no
failure worth logging). So P6c-2 targets mutation cmds only, not all 23.

Verified: tsc 0; form delete --help wires up; delete non-existent id → ctx.fail
path prints failure + 'dacli log last' (routes through CommandLog).

Co-Authored-By: Claude <[email protected]>
2026-07-24 12:11:34 +08:00
sswandClaude d4cc3d09db feat(ssw-loop): P7 — generate command reference from commander tree (kill drift)
Per DESIGN §6 / user catch: ssw-loop subagent templates hand-code dacli command
syntax and drift (typ. missing --category). Command tree is now the single source.
- src/program.ts: extract buildProgram() (assembles commander tree, no parse/side-effect)
- src/cli.ts: slimmed to import buildProgram() + parse + top-level error handling
- scripts/gen-command-reference.ts: walk tree → .claude/.../command-reference.generated.md
  (190 commands w/ all options + defaults, incl --category/--column-naming)

Verified: tsc 0; cli entry smoke (form list) intact after refactor; generator emits
190 commands. (.claude side: generated ref + drift-check committed separately.)

Co-Authored-By: Claude <[email protected]>
2026-07-24 11:45:30 +08:00
sswandClaude 7988ead926 chore(pkg): P6 — single package manager (npm) + pg pool allowExitOnIdle
- delete pnpm-lock.yaml + pnpm-workspace.yaml (6-week-stale invalid placeholder);
  package-lock.json is the live one (has @types/pg). set [email protected].
  gitignore pnpm-lock/workspace so they can't creep back (audit M1)
- kb/_client.ts pool: allowExitOnIdle:true — process exits when connections idle,
  fixes kb commands hanging the event loop (audit M3, pool.end never called)

Co-Authored-By: Claude <[email protected]>
2026-07-24 11:22:13 +08:00
sswandClaude 571ac27ab2 refactor(paths): P5 — getCcWorkDir() single source, drop 37 hardcoded /home/ubuntu
Per audit §7 / H1: ~37 src files hardcoded '/home/ubuntu/ccWorkDir', welding the
whole pipeline to one container (external CI / other machines crash).
- new src/core/paths.ts: getCcWorkDir() (env CCWORKDIR || default) + getWebSrc()
- swept 36 files: '/home/ubuntu/ccWorkDir<sub>' literals → `${getCcWorkDir()}<sub>`
  templates; collapsed 3 inline (process.env.CCWORKDIR || '...') dupes to getCcWorkDir()
- covers webapi mirror (_loader WEB_SRC/JNPF_UTILS_UUID + 24 module *_SRC), db/verify
  paths, drift/coverage/selfcheck, buildformdata, codegen, render, blindspot boot paths
- playwright .cache path + doc-comment refs left as-is (not ccWorkDir-rooted)

Verified: tsc 0 (validates every inserted import path); runtime menu webapi
initWebapi OK; smoke form list returns real data (WEB_SRC end-to-end via getCcWorkDir);
vitest unit 336 pass.

Co-Authored-By: Claude <[email protected]>
2026-07-24 10:48:55 +08:00
sswandClaude 2c6e92d3e9 fix(security): P4 — spawn over execSync, token 0600, env-only crypto key
Per audit §8 / H2 / H3 / M4:
- form/create.ts AI-relogin: execSync(`...--password=123456...`) → spawnSync
  array form (no shell → no command injection via cliEntry/appCode); creds from
  config DEFAULT_ACCOUNT/DEFAULT_PASSWORD (env-overridable), no inline literal
- config.ts saveToken: token.json 0600 + dir 0700 + chmod fallback for existing
  0644 files (token holds bearer, was world-readable)
- crypto.ts: drop hardcoded FALLBACK_KEY ('EY8...'); missing key → throw (refuse
  to encrypt with weak key under AES-ECB) instead of silent weak fallback
- @types/pg already installed in P1 (kb SQL client no longer any-typed)

Verified: tsc 0; crypto still loads key from web/.env (96-char hex, no throw →
login intact in container); vitest unit 336 pass (blindspot_guards quarantined).

Co-Authored-By: Claude <[email protected]>
2026-07-24 10:42:51 +08:00
sswandClaude 21eb5520c7 build(quality): P3 — real pre-commit gate (tsc+vitest+smoke); ceremony gate → advisory
Root-cause fix (audit §12.4.1): the only pre-commit gate was _gate_webapi,
which greps comment provenance / webapi ref-rate but NEVER runs tsc or vitest
→ 48 type errors + 20 failing tests could merge under an all-green gate (false green).

- scripts/quality-gate.sh: [1] tsc --noEmit (block) [2] vitest run tests/unit (block)
  [3] backend smoke (advisory local / mandatory CI). No ceremony (no magic-string grep).
  git rev-parse for root (no hardcoded /home/ubuntu).
- scripts/githooks/pre-commit (version-controlled): runs quality-gate (blocking),
  then _gate_webapi as advisory (never blocks).
- scripts/install-hooks.sh: git config core.hooksPath scripts/githooks
- README §232: gate now enforced, tsc rule 靠自觉 → 门强制

blindspot_guards.test.ts quarantined via --exclude (12 fails = registry drift,
PLAN §P2.5) — loudly documented, not silently hidden.

Verified: NEGATIVE test — injected a type error, gate BLOCKED the commit (exit 2);
removed → tsc 0, gate passes. Gate passes its own gate.

Co-Authored-By: Claude <[email protected]>
2026-07-24 09:58:07 +08:00
sswandClaude fc16d93114 test(fixtures): restore tests/fixtures/plan.md (deleted in d982753, tests still ref it)
doc-md-slice.test.ts reads this fixture; cleanup commit removed the file but
left 7 tests referencing it → they fell back to placeholder and failed.
Restored from d982753^. doc-md-slice now 14/14 green. Honest fix (test always
needed this asset), not fake-green.

Co-Authored-By: Claude <[email protected]>
2026-07-24 09:50:39 +08:00
sswandClaude 6210a273c6 fix(tests): P2 — test tsc errors 18→0 (tsc now fully 0/51)
- 4 AppContext fixtures (blindspot_guards/bs54_guard/dbLinkId/verify_option):
  add topLevelMenus:[] + currentSystemId:'' (fields added in BS-109, fixtures drifted)
- CreateOpts: add internal __aiBuildFormData?:{formData} hook (was (opts as any));
  fixes 3 form_create_smartprops_ai.test.ts errors
- e2e/_helpers/nav.ts: /// <reference lib=dom /> for page.evaluate browser context
  (resolves document/HTMLElement + item/e unknown)
- bs66-70 test: type formVm as Set<string>
- auto_fix.test: gX1!.candidates!  ; defhttp test: HeadersInit → Record<string,string>
- output_filter.test: cast stdout spy to declared MockInstance type

Verified: tsc 0 errors; vitest unit 361 pass / 19 fail == pre-existing
(blindspot_guards registry drift + doc-md-slice fixture, audit §12.2) — no regression.

Co-Authored-By: Claude <[email protected]>
2026-07-24 09:47:46 +08:00
sswandClaude e4b9ffa471 fix(types): P1 — src tsc errors 33→0
Root cause (24/33): JnpfResp<T> envelope treated as inner type.
- form/_ai.ts: callNcpfBackendWithRetry returns JnpfResp<AiFormResponse>
  (body already reads .code/.msg/.data); callAiForm r typed as envelope,
  unwrap data explicitly; drop as-unknown-as casts; fix stale workflow log fields
- form/create.ts: infer-category postJson generic was double-wrapped envelope
  → pass inner {id,fullName}; add columnNaming to CreateOpts (option existed)
- form/bindflow.ts: workflow Info get<> passed envelope shape → inner type,
  flowNodes typed string|Record instead of any-ized {data?:any}
Stragglers:
- _precheck.ts: await fromToken() before initWebapi
- verify-runner.ts: import currentBaseUrl (was undefined name, real bug); +warn? on VerifyResult
- codegen.ts: ctx.addFix → addSuggestion (only method on ctx)
- audit.ts: source.blindspot → ref (fits type)
- test/render.ts: componentOk widened to number|boolean (holds false|count)
- log.ts: raw writer param (s:string) → (...a) to match writer map contravariance
- kb/_client.ts: install @types/pg (also P4)

Verified: tsc src=0 (total 51→18, rest in tests/); vitest unit 361 pass /
19 fail (fail set == pre-existing blindspot_guards + doc-md-slice, audit §12.2;
no regression in touched files).

Co-Authored-By: Claude <[email protected]>
2026-07-24 09:36:58 +08:00
sswandClaude d52744d697 docs(decisions): add ADR 0016 app clear p1-2e scope ghost
Co-Authored-By: Claude <[email protected]>
2026-07-24 08:44:55 +08:00
ssw 4042bac60f auto(14b5ea1b9bd9): session end @ 2026-07-23T19:20:56 (+1f) 2026-07-23 19:20:57 +08:00
ssw 2357cb97be auto(14b5ea1b9bd9): session end @ 2026-07-23T18:49:07 (+1f) 2026-07-23 18:49:08 +08:00
sswandClaude cba74702f2 chore(docs): commit 上轮遗留文件 (归档指针 + 2 审计 + jxcj M2 字段修复脚本) (2026-07-23)
补提交上一轮 (commit 64fbb4a cmd-review/drift 归档 + 76c2937 broken ref reroute + b4dce30 auto-gen 撤回) 期间未落库的 4 个文件:

1. docs/cmd-review/README.md (30 行)
   - 上轮归档逻辑产出物, 指向 archive/cmd-review-2026-07/, 给新会话 AI 引路
   - 本应在 commit 64fbb4a (cmd-review 全归档) 一并提交, 但当时遗漏
   - 含归档原因 / 当前权威 (dacli <cmd> --help) / 历史快照定位指引

2. docs/audit-2026-07-22.md (192 → 196 行, 顶部加 deprecate 头)
   - macOS 上做的中立审计, 已知 3 条核心结论 (本机崩溃 / 硬编码路径 / B 关卡退化) 全部是环境错位误判
   - 顶部加 ⚠️ 头, 指向 audit-2026-07-23-deep §更正声明 + §12 容器内实跑复核
   - 仍成立部分: 硬编码 /home/ubuntu/...ccWorkDir (脆弱性), 双包管理器, wrapCommand 迁移不完整

3. docs/audit-2026-07-23-deep.md (292 行, 完整)
   - 深度审计 (架构层), 容器内 'docker exec jnpf-all-in-one' 复跑后更正前一版 3 条误判
   - 实测: tsc --noEmit 48 错 (src 内, 违反 README §232 铁律), vitest unit 20 失败 (集中在 blindspot_guards 漂移)
   - 主结论修订: ssw-loop 在 intended 环境里 '能驱动开发' (int 撤回初版 '仪式化' 措辞)
   - 但真正结构性盲点: 整套质量体系不跑 tsc/vitest → 48 类型错 + 20 失败与全绿关卡并存
   - 修订后 5 件优先事: (1) 补 tsc+vitest 进回路 (2) 修 48 src 类型错 (3) 修 blindspot 漂移 (4) 抽 getCcWorkDir() (5) 统一包管理器

4. docs/web-patches/jxcj-m2-field-fix.py (227 行)
   - jxcj M2 form schema 字段修正脚本 (webapi PUT fallback)
   - 背景: dacli form create --ai 重命名字段 + 丢失 dictType + 误判 userSelect, form update --fields 间歇报 'System abnormality'
   - 走 Python PUT 直接调 JNPF webapi 兜底修复 (跟 DACLI 数据建模路径平行)
   - 配套 web-patches/README.md 当前 Patches 状态表 (只列 .md, py 脚本独立)
   - 注: 该脚本不属于 jnpf/boot 基线改动, 是 dacli 之外的应用级修复脚本, 按 web-patches 规则不入归档

触发: 用户要求 '提交' untracked 3 文件, 顺手补 cmd-review/README.md 上轮遗漏.

Co-Authored-By: Claude <[email protected]>
2026-07-23 15:58:49 +08:00
sswandClaude b4dce306a0 revert: 删除 auto-gen anti-patterns.md 链路 (_anti_patterns.ts 保留给 --help Pitfalls) (2026-07-23)
撤回上一轮尝试 (commit 9e21fea 之前 '加 AP-* entry + 重生成 md' 意向未落 commit 但改了文件) 涉及的反模式 auto-gen 链路.

# 之前考虑
- _anti_patterns.ts 是 13 个命令 --help Pitfalls 段的 compile-time SSOT (installHelpHookWithPatterns → enrichHelp 自动注入)
- docs/anti-patterns.md 通过 gen-anti-patterns-md.sh 从 ts 生成, 用于人类/外部 AI 读

# 撤回原因
- 重生成时 4 个手动加的内容被覆盖丢失: AP-cross-business-info-leak + AP-cross-smartprops-missing-update + BS-新132 修订 + BS-新133 修订
- 根因: AntiPattern schema (1 行 wrong / 1-2 行 right / 1-2 句 rationale) 信息密度太低, 装不下 'mitigation 多步骤 + BS 修订 + jxcj M2 验证实验数据'
- 强行加进去违反 schema 精神, 不加进去就丢内容
- 两难说明: ts→md auto-gen 对反模式这种文档不合适 (schema 跟实际信息密度不匹配)

# 此 commit
1. 删除 docs/anti-patterns.md (304 行, 人类阅读目的)
2. 删除 scripts/gen-anti-patterns-md.sh (49 行, generator)
3. 删除 scripts/extract_anti_patterns.ts (20 行, extractor)
4. _anti_patterns.ts: 文件头注释 '由 TS 自动生成 md' → 'compile-time SSOT, 不再 auto-gen md'
5. ANTI_PATTERNS 撤回到 253 行纯净版 (撤上一轮加的 'form codegen' + 'cross' CommandKey + 3 个 entry)

# 保留
- _anti_patterns.ts 本身保留 (installHelpHookWithPatterns 仍依赖 enrichHelp 注入 AP-* 给 --help 输出)
- 实测: 'dacli form create --help' 仍输出 'Pitfalls (踩过的坑):' 段
- 13 个命令 (form create/info/update/delete, di create, app context, test run, workflow create, menu create, dm create, dict typeCreate) --help 仍自动含 AP-* 反模式

# 后续
- 4 个丢失内容 (AP-cross-business-info-leak + AP-cross-smartprops-missing-update + BS-新132/133 修订) 暂未沉淀, 后续如需可入 docs/{app}/jxcj/learnings.md (应用特定) 或 ssw-loop SKILL.md (通用元规则)
- 反模式新内容优先入 _anti_patterns.ts 走 --help 自动路径 (machine-readable 优势)

Co-Authored-By: Claude <[email protected]>
2026-07-23 15:37:40 +08:00
sswandClaude 76c2937020 fix(src): reroute 45 broken cmd-review/drift refs to archive paths (2026-07-23)
清理 src/ 注释 + DacliHelp ref 字段里指向 cmd-review/ + drift/Rxx 的 broken 引用, 全部改指到 archive/ 子目录 (随上一轮 cmd-review/drift 整体归档):

A. 8 处 DacliHelp 'ref:' 字段 (改 archive 路径, 保留 AI 溯源):
   - src/commands/bigscreen/{list,info,release}.ts → archive/review/v0.14-webapi-rollout-plan.md §2.1
   - src/commands/bigscreen/{construct,_validate}.ts → archive/review/v0.13-webapi-form-workflow-refactor.md §8.2.4
   - src/commands/msg/templatecreate.ts → archive/cmd-review-2026-07/msg.md
   - src/commands/integration/{smstest,webhooktest}.ts → archive/cmd-review-2026-07/integration.md

B. 16 处 anti-patterns.ts 'source: drift/Rxx' (改 archive 路径, 保持源唯一):
   - R5/R9/R12/R17/R12-fix-batch1/R12-fix-batch2 → archive/drift-rounds-2026-07/<对应文件>
   - BS-新38 / column_drift / F3 / BS-DI-1/2/3 子标签保留

C. 21 处注释里 broken 引用清理:
   - 具体路径 (app/{list,info}, datascreen, print/create, regression-2026-06-29) → 改 archive 路径
   - 通用引用 ('cmd-review/app.md 已识别' / 'cmd-review 已知 X') → 改 'v3.0+ 评审已识别/已知'
   - 孤儿引用 (config.ts v0.15-token-home.md 不存在) → 改 archive/review/regression-2026-06-29.md (实际决策文件)
   - 移除 '/cmd-review/xxx' path 引用, 保留描述信息

最终:
- src/ 只剩 3 处 'archive/cmd-review-2026-07/*' 引用 (正确指向 archive)
- tsc --noEmit 未引入新错误 (3 处现有 ts 错都在 tests/unit/, audit-2026-07-23-deep 已记录)
- 下一轮 anti-patterns.md 自动重生成会反映新的 archive 路径

Co-Authored-By: Claude <[email protected]>
2026-07-23 15:16:28 +08:00
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