|
| 1 | +#!/usr/bin/env bash |
| 2 | +# 通用 skill QA 模板:布局 + skills-ref + markdownlint + skillcheck。 |
| 3 | +set -euo pipefail |
| 4 | + |
| 5 | +ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" |
| 6 | +QA_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 7 | +SKILL_DIR="$(cd "$QA_DIR/../../skills/huawei-cloud-account-onboarding" && pwd)" |
| 8 | + |
| 9 | +fail() { printf 'FAIL: %s\n' "$1" >&2; exit 1; } |
| 10 | +need_cmd() { command -v "$1" >/dev/null 2>&1 || fail "missing command: $1"; } |
| 11 | + |
| 12 | +run_local_or_npx() { |
| 13 | + local bin=$1; shift |
| 14 | + if command -v "$bin" >/dev/null 2>&1; then "$bin" "$@" |
| 15 | + else need_cmd npx; npx "$bin" "$@"; fi |
| 16 | +} |
| 17 | + |
| 18 | +# skill 安装包纯度:不含 eval/qa/.workspaces 等 |
| 19 | +check_skill_layout() { |
| 20 | + [[ -f "$SKILL_DIR/SKILL.md" ]] || fail "missing SKILL.md" |
| 21 | + [[ -f "$QA_DIR/README.md" ]] || fail "missing QA README" |
| 22 | + local item |
| 23 | + local forbidden=(.DS_Store .agents analysis evals qa scripts tests .workspaces) |
| 24 | + for item in "${forbidden[@]}"; do |
| 25 | + [[ ! -e "$SKILL_DIR/$item" ]] || fail "forbidden in skill dir: $item" |
| 26 | + done |
| 27 | + local sibling |
| 28 | + for sibling in "$SKILL_DIR"/*-workspace; do |
| 29 | + [[ -e "$sibling" ]] || continue |
| 30 | + fail "Skill Creator workspace belongs at repo root, not skills/: $(basename "$sibling")" |
| 31 | + done |
| 32 | + [[ -f "$QA_DIR/evals/evals.json" ]] || fail "missing evals file: $QA_DIR/evals/evals.json" |
| 33 | + [[ -f "$QA_DIR/assertions/README.md" ]] || fail "missing assertions guide" |
| 34 | + [[ ! -f "$QA_DIR/evals.json" ]] || fail "duplicate eval source: $QA_DIR/evals.json" |
| 35 | +} |
| 36 | + |
| 37 | +need_cmd rg |
| 38 | +check_skill_layout |
| 39 | +run_local_or_npx skills-ref validate "$SKILL_DIR" |
| 40 | +run_local_or_npx markdownlint-cli2 "$SKILL_DIR/**/*.md" |
| 41 | +need_cmd skillcheck |
| 42 | +skillcheck "$SKILL_DIR" --target-agent cursor --strict-cursor --min-desc-score 70 |
| 43 | + |
| 44 | +printf 'OK: huawei-cloud-account-onboarding validation passed\n' |
0 commit comments