Files
xstudio agent c1cf6f54e5 merge sandbox/ai-1790562657-0EF743: chg_0001 dth scaffold + chg_0002 experiment_platform MVP
- chg_0001_dth_scaffold (skip_coverage): openspec framework + NestJS+React+PGlite scaffold
- chg_0002_sp1_experiment_platform_mvp: 6 scenarios S1-S6 + 21 perm-smoke + 16 e2e + 3 demo operators (hello-mpc/pir/vertical-lr)

Sandbox task exit 0. Independent verification: check_spec_coverage.sh gap=0 PASS.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-09-28 10:54:34 +08:00

48 lines
2.0 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# ==============================================================================
# scripts/lib/parse.sh (skill: ai-collab-framework)
# 公共解析器:被 check_spec_coverage.sh 以及未来脚本(extract_spec.sh / 子代理
# 探活 / CI 报告生成器)共用,保证解析规则 0 漂移。
#
# 用法:. "$SKILL/scripts/lib/parse.sh"
# 调用:extract_s_blocks <spec.md 路径>
# 输出:每行一个 S 块,TSV:id \t ADDED|MODIFIED|REMOVED|PLAIN [\t FLAG]
# FLAG: NO-WHEN / NO-THEN / NO-REASON / NO-MIGRATION(空块标志;空时该列无值)
#
# 改这里的解析函数前请跑:
# bash scripts/selftest_check_spec_coverage.sh
# 确认 gate 默认输出(无 --json)字节级不变。
# ==============================================================================
# S 块结构提取(awk):输出 "S<n>\tADDED|MODIFIED|REMOVED|PLAIN[\tFLAG...]" 行。
# PLAIN = 不在 delta 段内(delta 模式下视为散块;全量模式下是正常块)。
# FLAG: NO-WHEN / NO-THEN(空壳)、NO-REASON / NO-MIGRATION(REMOVED 缺项)。
extract_s_blocks() {
awk '
function flush( id, k, out) {
if (sid == "") return
id = sid
sub(/^###[ \t]+/, "", id)
sub(/[ \t:].*$/, "", id)
k = "PLAIN"
if (sec ~ /^ADDED[ \t]+Scenarios/) k = "ADDED"
else if (sec ~ /^MODIFIED[ \t]+Scenarios/) k = "MODIFIED"
else if (sec ~ /^REMOVED[ \t]+Scenarios/) k = "REMOVED"
out = id "\t" k
if (k == "REMOVED") {
if (body !~ /Reason/) out = out "\tNO-REASON"
if (body !~ /Migration/) out = out "\tNO-MIGRATION"
} else {
if (body !~ /\*\*WHEN\*\*/) out = out "\tNO-WHEN"
if (body !~ /\*\*THEN\*\*/) out = out "\tNO-THEN"
}
print out
sid = ""; body = ""
}
/^## / { flush(); sec = $0; sub(/^##[ \t]+/, "", sec); next }
/^###[ \t]+S[0-9]/ { flush(); sid = $0; body = ""; next }
{ if (sid != "") body = body "\n" $0 }
END { flush() }
' "$1" 2>/dev/null || true
}