ssw
87a246ed9e
feat(dacli): Tier 1 固化 3 项 — hook + idempotent + health check
...
回应用户"还有哪些要 dacli 固化的" — 落地 Tier 1 全部 3 件:
[1/3] Pre-commit hook 加 doc:check (scripts/quality-gate.sh)
- 质量门从 [1/3] tsc + [2/3] vitest + [3/3] smoke → [1/4]+[2/4]+[3/4]+[4/4]
- 新 [3/4] doc:check (npx tsx scripts/check-doc-drift.ts) — 防回归
- 任何 doc drift 立即阻断 commit (呼应 audit 2026-07-24 §6 治本建议)
- DACLI_SKIP_GATE=1 紧急绕过 (与现有 tsc/vitest 一致)
- 注释同步更新 pre-commit (scripts/githooks/pre-commit)
[2/3] form create --reuse-if-exists (src/commands/form/create.ts)
- 防 BS-新131 AI agent 反复跑场景返工
- 命中已存在 enCode → 跳过创建, 返回现有 id + state (state=0/1 都支持)
- 抽 findExistingForm() 纯函数 + 6 个单元测试 (exact match, 不 fuzzy)
- 新选项: --reuse-if-exists (默认 false, 向后兼容)
[3/3] app status 加 3 项深度健康检查 (src/commands/app/status.ts)
- dbPing: GET /system/DataSource/{dbLinkId}/Actions/TestConnection (防 BS-E14)
· 404/405 视为 skip (端点可能未暴露, 不阻断)
· dbLinkId=0 视为 skip (主库, 不需测试)
- llmPing: GET /visualdev/ai/health (防 --ai 路径 LLM 挂掉)
· 404 视为 skip (端点可能未部署 health)
- menuIntegrity: /oauth/CurrentUser menuList.urlAddress 不空 (防 BS-56 SPA 404)
· 任意 fail → 退出码 1 (AI agent 应停下修复)
- 人类可读模式 + --json 模式都展示 deepChecks 数组
- 实战验证: tdd8 跑出 menuIntegrity 真问题 (4 项 menu urlAddress 空)
验证:
- typecheck 0 errors
- vitest 39 文件 / 393 tests pass (含 6 新 reuse-if-exists 测试)
- doc:check 0 drift
- 实战: dacli app status 跑出 3 项深度检查 + 1 个真 backend finding
测试未跑 (需要 live JNPF):
- form create --reuse-if-exists 端到端 (受 auto-classifier 误判限制)
2026-07-24 18:26:45 +08:00
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 and Claude
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
ssw and Claude
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
ssw and Claude
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
ssw and Claude
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
ssw
a650cf6b04
test(dacli): final dogfood regression test — all 9 success criteria PASS
2026-07-17 12:51:50 +08:00
ssw
3f87c226c2
auto(bfc0cfa2c3a4): session end @ 2026-07-17T12:25:27 (+1f)
2026-07-17 12:25:27 +08:00
ssw and Claude
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 and Claude
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
508069be6c
TC-B workflow 加 ensure-tc-b-todo.sh setup 脚本 (v0.21+ 运行时, 2026-07-14)
...
user 反馈: '是不是可以模拟办理数据' (option A: 一次性脚本 + setup 文档)
* scripts/ensure-tc-b-todo.sh 新增:
- 查询 admin 当前待办数 (调 /workflow/operator/List/1, 镜像 web flowTodo L121)
- ≥1 时: 提示跑 dacli test browser
- =0 时: 给恢复指引 (testspace 切 / 其他 app 浏览器发起 / API 模拟未实现)
- 双 app 实测: testspace 3 待办 (PASS 路径) + workSystem 0 待办 (给恢复指引)
* browser.ts help 文本加:
- 示例: bash scripts/ensure-tc-b-todo.sh testspace
- 0 待办时 check 1-3 PASS, check 4-7 正确识别无任务 (符合预期)
- ≥1 待办时 7/7 PASS, 覆盖完整运行时
* MEMORY 同步: tc-b-test-user-runtime-not-admin-design.md
- 关键洞察: TC-B 选页面要选 user-context (flowTodo), 不是 entity-context (flowEngine)
- 设计器/配置器 (onlineDev/*) 由 TC-C 静态分析 + TC-A API 覆盖, 浏览器层浪费
- 运行时/业务页面 (workFlow/flowTodo 等) 才是 TC-B 应该验的
实测:
bash scripts/ensure-tc-b-todo.sh testspace → 3 待办, PASS 路径
bash scripts/ensure-tc-b-todo.sh workSystem → 0 待办, 给恢复指引
dacli test browser --module=workflow --appCode=testspace → 7/7 PASS, 11s
2026-07-14 16:18:47 +08:00
ssw and Claude
7a78bdadea
dacli(kb): Commander arg bug fix + seed 4 domains (commit 3c/3)
...
## Bug fix (11 files)
原代码用 new Command('search <query>'), Commander 把整串当 command name,
结果子命令名变成 "search <query>", 实际调用报 "unknown command 'search'"。
修正: new Command('search').argument('<query>', 'desc')。
受影响: show/search/audit/add/entry/update/remove/expire/renew/archive/deprecate (11 个)
未受影响: list/map/rebuild-fts/serve (无 arg), _init.ts (走 registerInit(program))
验证: npx tsx src/cli.ts kb search scanBasePackages → 2 results (BM25 + <mark>)
## Seed 4 domains (scripts/seed-kb.ts)
非交互 .ts 脚本, 直接调 _client.ts execute()/transaction(), 跳过 readline。
幂等: 重复运行会清掉旧数据 (DELETE 域级联 entries/source_files)。
4 域 ~54 条目 (按 plan §4.1 蒸馏):
- dacli (14 entries, 9 sources) - CLI 命令/盲点/架构
- jnpf (14 entries, 5 sources) - 平台机制/scanBasePackages/ServiceImpMarco
- ssw-loop (14 entries, 8 sources) - 7 阶段/4 关卡/子代理派发
- ssw-e2e-test (12 entries, 2 sources) - TC-A/B/C + webapi 复用
数据本身不入 git (DB 内容); 仅 scripts/seed-kb.ts 入库。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <[email protected] >
2026-07-02 16:25:56 +08:00
ssw
700ad86fd6
auto(284e8d004cbb): session end @ 2026-06-30T16:45:06 (+2f)
2026-06-30 16:45:11 +08:00
ssw and Claude
a17fd0307d
chore(v0.11): Phase 2 清理 - 删 scripts/extract-all.mjs (Phase 1 之前已删 data/*.json, 这是 snap 脚本)
...
docs/dacli/v0.11-mirror-refactor.md Phase 2 删除清单:
- data/field-schemas.json ← v0.10 之前 commit 已删
- data/component-map.json ← v0.10 之前 commit 已删
- data/l2-rules.json ← v0.10 之前 commit 已删
- data/validation-rules.json ← v0.10 之前 commit 已删
- scripts/extract-web-schema.py ← v0.10 之前 commit 已删
- scripts/extract-all.mjs ← 本次删 (350 行 snapshot 提取脚本)
scripts/extract-all.mjs 用途: 从 web/.../componentMap.ts/formValidate.ts/R*.vue
正则提取到 dacli/data/*.json, 然后 FieldBuilder.ts read 这些 JSON.
v0.11+ 后:
- dacli/src/commands/form/_buildformdata.ts 直接 import web buildFormData
- dacli/data/buildformdata-contract.md 留文档
- 不再需要 snapshot 中间产物, 也不再需要 extract 脚本
package.json: 移除 'extract' script (tsx scripts/extract-all.mjs)
Co-Authored-By: Claude <[email protected] >
2026-06-25 12:27:49 +08:00
ssw
f584aaf1bd
chore: Task 9 清理 v0.10 旧模式
...
删除 (真正死的):
- data/form-type-rules.json: 被 buildFormData 内置规则替代
- scripts/extract-web-schema.py: 被 _buildformdata.ts 动态 import 替代
加 @deprecated 标记 (手动 --fields 路径仍依赖):
- src/commands/form/_simplify.ts (wrapSimplifiedFields 等)
- src/commands/form/_blindspots.ts (5 类 schema 完整性检查)
- src/commands/form/validate.ts (老 form 校验工具)
- src/commands/form/fixcolumndata.ts (老 form 修复工具)
- src/commands/_precheck.ts (dbLinkId/enCode 检查仍有用, 但 schema 部分已废)
- src/commands/_blindspot_guards.ts (BS-48/49/50 仍有用, BS-51/52/54 已废)
更新 .claude/skills/dacli-ts/SKILL.md:
- 顶部加 'v0.11+ 架构重大变化' 段 (buildFormData 直连 + 3 种输入方式)
- 三层防御体系降级为辅助 (BS-51/52/54 已由 buildFormData 解决)
- 列已删除/已废弃文件
注意:
- 手动 --fields 路径仍可用 (用户已习惯简化格式)
- 未来若都用 AI/JSON, _simplify 可彻底删
2026-06-25 11:45:49 +08:00
ssw
8a21b07119
feat(dacli): web/ 源码参照机制 + web-source-map.md (P0.3, 解决 AI 舍近求远根因 G)
2026-06-22 15:33:35 +08:00
ssw
e5e215af36
W7-D4: 4 新 extractor (report/portal/bigdata-schemas + datasource-drivers 8 driver)
2026-06-12 21:09:04 +08:00
ssw
c98ad4f425
init: TS 版 dacli v0.7 baseline (8 父命令/26+ 子命令, 0.4MB, .claude/skills/dacli-ts)
...
参考 boot/ 仓库结构初始化, 同步到 gitea:3000/ssw/dacli (private).
包括:
- src/ 8 父命令 (form/menu/dm/dict/di/apis/doc/workflow + login/status) + core (client/crypto/help/log/types/config)
- src/schema/ FieldBuilder (从 JNPF web 源码提取, 避免 53 个手写 builder)
- tests/ vitest 单元 + playwright E2E (含 workSystem/developSystem baseline regression)
- scripts/ extract-all.mjs (从 jnpf-web 源码生成 schema) + seed-tds-baseline.ts
- doc/ architecture/plan/api/extractors/baseline/RESUME/help-system + v0.6/v0.7 changelog
- .claude/skills/dacli-ts/ Claude 集成 skill (SKILL.md + 5 references + 7 examples + 3 baseline)
- CLAUDE.md (项目说明) + README.md + prompt.md (开发任务说明书)
- 配置文件: package.json/lock, tsconfig, vitest.config, playwright.config
2026-06-12 18:26:39 +08:00