Files
karuo-ai/.restore-backups/F22_恢复前_20260723_210051/脚本/工具预检.sh

48 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
set -uo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
SKILL_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
RUNTIME="$SKILL_DIR/运行资产"
check_cmd() {
local name="$1"
shift
if command -v "$1" >/dev/null 2>&1; then
printf '已安装\t%s\t' "$name"
"$@" 2>&1 | head -n 1
else
printf '待安装\t%s\n' "$name"
fi
}
printf '卡若AI Codex提示词回归工具预检\n'
printf '时间\t%s\n' "$(date '+%Y-%m-%d %H:%M:%S %z')"
check_cmd 'Codex' codex --version
check_cmd 'Node.js' node --version
check_cmd 'npm' npm --version
if [ -x "$RUNTIME/promptfoo/node_modules/.bin/promptfoo" ]; then
printf '已安装\tPromptfoo\t'
"$RUNTIME/promptfoo/node_modules/.bin/promptfoo" --version 2>&1 | tail -n 1
else
printf '待安装\tPromptfoo\n'
fi
check_cmd 'Garak' garak --version
check_cmd 'PyRIT扫描器' pyrit_scan --version
check_cmd 'SkillSpector' skillspector --version
if [ -x "$RUNTIME/.venv-inspect/bin/inspect" ]; then
printf '已安装\tInspect AI\t'
"$RUNTIME/.venv-inspect/bin/inspect" --version 2>&1 | head -n 1
else
printf '待安装\tInspect AI\n'
fi
if command -v python3 >/dev/null 2>&1; then
printf '已安装\tPython\t%s\n' "$(python3 --version 2>&1)"
else
printf '待安装\tPython\n'
fi
printf '资产目录\t%s\n' "$RUNTIME"
printf '提示\t工具环境统一保存在当前 Skill 的运行资产目录;密钥只经环境变量注入。\n'