Skip to content

Commit 8849f33

Browse files
committed
test: 更新脚本
1 parent 9819f03 commit 8849f33

12 files changed

Lines changed: 558 additions & 259 deletions

.github/workflows/ci-pr.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,19 @@ permissions:
1313
contents: read
1414

1515
jobs:
16+
skillsLint:
17+
name: skills-lint
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 10
20+
21+
steps:
22+
- name: 拉取代码
23+
uses: actions/checkout@v4
24+
25+
- name: 校验 skills、agents 与路由评测样本
26+
run: |
27+
bash ./run_local_skills.sh --validate-only
28+
1629
unitFull:
1730
name: unit-full
1831
runs-on: ubuntu-latest

memoryUsageCompareHost.md

Lines changed: 0 additions & 48 deletions
This file was deleted.

memoryUsageCompareQemu.md

Lines changed: 0 additions & 48 deletions
This file was deleted.

rfc8259ReportHost.md

Lines changed: 0 additions & 51 deletions
This file was deleted.

rfc8259ReportQemu.md

Lines changed: 0 additions & 51 deletions
This file was deleted.

run_local_memory.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ print_banner() {
166166
}
167167

168168
run_host_memory() {
169-
local markdownPath="${repoRoot}/memoryUsageCompareHost.md"
169+
local markdownPath="${repoRoot}/reports/memory/host.md"
170170
local rc=0
171171
local caseRc=0
172172
local entry=""
@@ -224,7 +224,7 @@ run_host_memory() {
224224
}
225225

226226
run_qemu_memory() {
227-
local markdownPath="${repoRoot}/memoryUsageCompareQemu.md"
227+
local markdownPath="${repoRoot}/reports/memory/qemu.md"
228228
local rc=0
229229
local caseRc=0
230230
local entry=""

run_local_rfc8259.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ print_banner() {
238238
}
239239

240240
run_host_rfc8259() {
241-
local markdownPath="${repoRoot}/rfc8259ReportHost.md"
241+
local markdownPath="${repoRoot}/reports/rfc8259/host.md"
242242
local streamPath="${repoRoot}/localLogs/_tmp/rfc8259_stream_host.$$"
243243
local rc=0
244244
local caseRc=0
@@ -286,7 +286,7 @@ run_host_rfc8259() {
286286
}
287287

288288
run_qemu_rfc8259() {
289-
local markdownPath="${repoRoot}/rfc8259ReportQemu.md"
289+
local markdownPath="${repoRoot}/reports/rfc8259/qemu.md"
290290
local streamPath="${repoRoot}/localLogs/_tmp/rfc8259_stream_qemu.$$"
291291
local rc=0
292292
local caseRc=0

run_local_skills.sh

Lines changed: 17 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ set -euo pipefail
44
# 本地一键 skills 同步与规范校验。
55
# 默认行为:
66
# 1) 同步各技能的 references/terminology.md 到统一占位模板
7-
# 2) 使用 skill-creator 的 quick_validate.py 校验每个技能
8-
# 3) 校验 agents/openai.yaml 关键字段与默认 prompt 的技能名引用
7+
# 2) 使用仓库内 validator 校验每个技能的 frontmatter 与 agents/openai.yaml
8+
# 3) 校验 skills 文档中的明确路径引用与 AGENTS 路由
9+
# 4) 校验 skills 路由评测样本(deterministic eval cases)
910
#
1011
# 可选参数:
1112
# --sync-only 仅执行同步
@@ -19,7 +20,8 @@ cd "${repoRoot}"
1920

2021
doSync=1
2122
doValidate=1
22-
validator="/root/.codex/skills/.system/skill-creator/scripts/quick_validate.py"
23+
validator="${repoRoot}/scripts/tools/validate_skills.py"
24+
casesValidator="${repoRoot}/scripts/tools/validate_skill_cases.py"
2325

2426
declare -a skillDirs=()
2527

@@ -48,8 +50,8 @@ parse_args() {
4850
}
4951

5052
load_skills() {
51-
# 收集 skills 目录(排除 shared)
52-
mapfile -t skillDirs < <(find skills -mindepth 1 -maxdepth 1 -type d ! -name shared | sort)
53+
# 收集真正的 skill 目录(要求存在 SKILL.md,排除 shared 与非技能辅助目录
54+
mapfile -t skillDirs < <(find skills -mindepth 1 -maxdepth 1 -type d -exec test -f '{}/SKILL.md' ';' -print | sort)
5355
if [[ ${#skillDirs[@]} -eq 0 ]]; then
5456
ryanjson_log_info "未发现可处理的技能目录(skills/*,排除 skills/shared)"
5557
exit 0
@@ -90,60 +92,24 @@ INNER_EOF
9092
}
9193

9294
validate_skills() {
93-
ryanjson_log_phase "校验技能结构与 agents 元数据..."
95+
ryanjson_log_phase "校验技能结构、agents 元数据、Markdown 路径与评测样本..."
9496
for skillDir in "${skillDirs[@]}"; do
95-
skillFile="${skillDir}/SKILL.md"
96-
openaiFile="${skillDir}/agents/openai.yaml"
97-
98-
python3 "${validator}" "${skillDir}" >/dev/null
99-
100-
if [[ ! -f "${openaiFile}" ]]; then
101-
ryanjson_log_error "缺少 agents/openai.yaml: ${openaiFile}"
102-
exit 1
103-
fi
104-
105-
if ! grep -Eq '^[[:space:]]*display_name:' "${openaiFile}"; then
106-
ryanjson_log_error "缺少 interface.display_name: ${openaiFile}"
107-
exit 1
108-
fi
109-
if ! grep -Eq '^[[:space:]]*short_description:' "${openaiFile}"; then
110-
ryanjson_log_error "缺少 interface.short_description: ${openaiFile}"
111-
exit 1
112-
fi
113-
if ! grep -Eq '^[[:space:]]*default_prompt:' "${openaiFile}"; then
114-
ryanjson_log_error "缺少 interface.default_prompt: ${openaiFile}"
115-
exit 1
116-
fi
117-
118-
skillName="$(awk '
119-
BEGIN { inFm=0 }
120-
/^---[[:space:]]*$/ { if (inFm==0) { inFm=1; next } else { exit } }
121-
inFm==1 && /^name:[[:space:]]*/ {
122-
sub(/^name:[[:space:]]*/, "", $0)
123-
print $0
124-
exit
125-
}
126-
' "${skillFile}")"
127-
128-
if [[ -z "${skillName}" ]]; then
129-
ryanjson_log_error "未能从 ${skillFile} 读取 name"
130-
exit 1
131-
fi
132-
133-
if ! grep -Fq "\$${skillName}" "${openaiFile}"; then
134-
ryanjson_log_error "default_prompt 未引用 \$${skillName}: ${openaiFile}"
135-
exit 1
136-
fi
137-
138-
ryanjson_log_info "valid ${skillDir}"
97+
ryanjson_log_info "queued ${skillDir}"
13998
done
99+
100+
python3 "${validator}"
101+
python3 "${casesValidator}"
140102
}
141103

142104
main() {
143105
parse_args "$@"
144106

145107
if [[ ! -f "${validator}" ]]; then
146-
ryanjson_log_error "未找到技能校验脚本: ${validator}"
108+
ryanjson_log_error "未找到仓库内技能校验脚本: ${validator}"
109+
exit 1
110+
fi
111+
if [[ ! -f "${casesValidator}" ]]; then
112+
ryanjson_log_error "未找到仓库内评测样本校验脚本: ${casesValidator}"
147113
exit 1
148114
fi
149115

scripts/README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,18 @@
3737
- header=8 align=4
3838
- header=4 align=4
3939
- 结构化输出 `[MEM][COMPARE]`
40-
- 仅输出 Markdown 汇总(项目根目录):
41-
- `memoryUsageCompareHost.md`
42-
- `memoryUsageCompareQemu.md`
40+
- 仅输出 Markdown 汇总(`reports/memory/`):
41+
- `reports/memory/host.md`
42+
- `reports/memory/qemu.md`
4343
- `run_local_rfc8259.sh`
4444
- 本地一键生成 RFC8259 报告(仅 RFC runner),支持 host / qemu
4545
- 默认仅跑单配置(`RFC_SINGLE_CASE=1`),默认语义:`RFC_DEFAULT_CASE="false false true"`
4646
- 默认同时生成 host + qemu 两份报告(`RFC_PLATFORM=both`
4747
- 默认清理 ANSI 颜色:`RFC_STRIP_ANSI_LOG=1`(如需保留颜色设为 0)
4848
- Host/QEMU 均使用内嵌 RFC8259 数据集(避免依赖文件系统)
49-
- 仅输出 Markdown 汇总(项目根目录):
50-
- `rfc8259ReportHost.md`
51-
- `rfc8259ReportQemu.md`
49+
- 仅输出 Markdown 汇总(`reports/rfc8259/`):
50+
- `reports/rfc8259/host.md`
51+
- `reports/rfc8259/qemu.md`
5252
- `scripts/tools/gen_rfc8259_embedded.py`
5353
- 生成 RFC8259 内嵌数据文件(`test/unityTest/cases/RFC8259/rfc8259Embedded.*`
5454
-`test/data/rfc8259` 更新时需要重新生成
@@ -58,3 +58,8 @@
5858
- 日志目录默认 `localLogs/qemu`(已在 `.gitignore` 中忽略)
5959
- `run_local_skills.sh`
6060
- 本地同步并校验 `skills/*`
61+
- 同时校验 `skills/evals/cases/*.json` 路由评测样本
62+
- `scripts/tools/validate_skills.py`
63+
- 校验 skills frontmatter、agents/openai.yaml、AGENTS 路由与 Markdown 明确路径引用
64+
- `scripts/tools/validate_skill_cases.py`
65+
- 校验 `skills/evals/cases/*.json` 的格式、路由目标、引用路径与覆盖分布

0 commit comments

Comments
 (0)