Files
dacli/scripts/validate-baseline.sh
T
sswandClaude 3f1cb3a03b feat(dacli): JNPF7 验证闭环 Stage 0 + P0-6 preview + workflow canvas 回归修复
Stage 0 (验证基础设施):
- 5 层验证工具链 (tools/) + JSON Schema + validate-baseline.sh CI gate
- P0-9: components-whitelist.yaml 单一来源 + parseFlowXml 消漂移 (create.ts tag 改消费 component-map.json)
- E-2: docs/components.md 文档化 6 个 pass-through 组件
- P1-16: validate-baseline 接入 quality-gate.sh
- L3 回归测试 (bs117 / bpmn-bs / antipattern-output) + mock LLM 库

P0-6 (user-in-the-loop):
- form create --ai --preview: 提交前渲染字段表格 (CJK 对齐) + TTY 交互确认 (_preview.ts)

workflow canvas 回归修复 (v0.22+ SSW 迁移引入):
- parseFlowXml 命名空间无关 (flowNodes 缺口)
- _autoLayout 无 DI 时合成完整 BPMNDiagram+Shape+Edge + bpmn2 归一化 (canvas 缺口)
- 真实后端 + 浏览器设计器验证画布渲染; 详见 jnpf7-analysis §14

quality-gate 全绿: tsc 0 · vitest 483 · doc:check · baseline L1-L5

Co-Authored-By: Claude <[email protected]>
2026-07-27 12:49:44 +08:00

78 lines
2.4 KiB
Bash
Executable File

#!/bin/bash
# dacli/scripts/validate-baseline.sh — CI gate for JNPF7 antipattern baseline
#
# Runs all 5 validation layers + vitest regression suite.
# Exit 0 = all pass; Exit 1 = one or more failures
#
# Usage:
# bash scripts/validate-baseline.sh
# bash scripts/validate-baseline.sh --skip-llm # skip tests that need base_ai
set -e
cd "$(dirname "$0")/.."
SKIP_LLM=false
[ "$1" = "--skip-llm" ] && SKIP_LLM=true
echo "=========================================="
echo " dacli 5-Layer Validation Baseline"
echo "=========================================="
echo ""
# Layer 1.1 — VisualAiModel schema
echo "── L1.1: VisualAiModel JSON Schema ──"
if [ -f "/tmp/dacli-baseline-form.json" ]; then
npx tsx tools/validate-form-schema.ts /tmp/dacli-baseline-form.json || echo " ⚠ skipped (no baseline file)"
else
echo " ⚠ skipped (no /tmp/dacli-baseline-form.json)"
fi
echo ""
# Layer 1.2 — BPMN XSD
echo "── L1.2: BPMN XSD ──"
if [ -f "/tmp/dacli-baseline-bpmn.xml" ]; then
npx tsx tools/validate-bpmn-xsd.ts /tmp/dacli-baseline-bpmn.xml || echo " ⚠ skipped (no baseline file)"
else
echo " ⚠ skipped (no /tmp/dacli-baseline-bpmn.xml)"
fi
echo ""
# Layer 1.3 — JNPF antipattern scanner
echo "── L1.3: JNPF Antipattern Static Scanner ──"
npx tsx tools/scan-antipatterns.ts
echo ""
# Layer 2.1 — Prompt rules coverage
echo "── L2.1: Prompt Rules Coverage ──"
npx tsx tools/check-prompt-rules.ts
echo ""
# Layer 2.2 — Parser coverage
echo "── L2.2: Parser Coverage ──"
# check-parsers.ts (P0-9): reads config/components-whitelist.yaml.
# Exits 0 when 6 documented pass-through components lack refs; exits 1 only on a
# real regression (a 'handled' component losing coverage). Let set -e propagate.
npx tsx tools/check-parsers.ts
echo ""
# Layer 3 — Vitest regression tests
echo "── L3: Vitest Regression Tests ──"
npx vitest run tests/unit/bs117-regression.test.ts tests/unit/bpmn-bs-regression.test.ts tests/unit/antipattern-output.test.ts
echo ""
# Layer 4 — Historical BS replay
echo "── L4: Historical BS Case Replay ──"
npx tsx tools/replay-history.ts
echo ""
# Layer 5 — Static A/B
echo "── L5: Static Prompt A/B Comparison ──"
npx tsx tools/prompt-ab-static.ts
echo ""
echo "=========================================="
echo " ✓ All baseline validations completed"
echo "=========================================="
echo ""
echo "See: docs/dacli-validation-baseline-2026-07-27.md"