mirror of
https://github.com/boshu2/agentops.git
synced 2026-09-14 15:08:13 +08:00
8b94f1461e
Adds a Step 0.5 "Recommend bd" section to skills/bootstrap/SKILL.md (and its codex variant). When `bd` is missing, /bootstrap reports a one-line recommendation pointing at `scripts/install-bd.sh` and continues — it never executes the installer on the user's behalf. Mirrors the existing HAS_AO graceful-degrade pattern. - HAS_BD probe added to Step 0 - External Tools subsection documents bd as optional/recommended - Step 6 report row + Troubleshooting row for the new state - skills/bootstrap/scripts/validate.sh: structural check that SKILL.md mentions install-bd.sh and probes bd - tests/scripts/install-bd.bats: wiring assertion case (5/5 OK) - skills-codex/bootstrap/ mirrored; codex hashes regenerated
52 lines
1.6 KiB
Bash
52 lines
1.6 KiB
Bash
#!/usr/bin/env bats
|
|
|
|
# Lightweight smoke tests for scripts/install-bd.sh. Network-dependent paths
|
|
# (download, version-resolve from GitHub) are skipped here to keep CI offline-
|
|
# safe; the verify-existing-install short-circuit and the unsupported-platform
|
|
# branches are exercised.
|
|
|
|
setup() {
|
|
REPO_ROOT="$(cd "$BATS_TEST_DIRNAME/../.." && pwd)"
|
|
SCRIPT="$REPO_ROOT/scripts/install-bd.sh"
|
|
}
|
|
|
|
@test "script exists and is executable" {
|
|
[ -f "$SCRIPT" ]
|
|
[ -x "$SCRIPT" ]
|
|
}
|
|
|
|
@test "--help prints usage and exits 0" {
|
|
run "$SCRIPT" --help
|
|
[ "$status" -eq 0 ]
|
|
[[ "$output" == *"install the \`bd\`"* ]]
|
|
[[ "$output" == *"--version"* ]]
|
|
}
|
|
|
|
@test "rejects unknown flag" {
|
|
run "$SCRIPT" --bogus
|
|
[ "$status" -ne 0 ]
|
|
[[ "$output" == *"unknown flag"* ]]
|
|
}
|
|
|
|
@test "short-circuits when bd is already installed at the requested version" {
|
|
if ! command -v bd >/dev/null 2>&1; then
|
|
skip "bd not on PATH on this host"
|
|
fi
|
|
have="$(bd version 2>&1 | head -1 || true)"
|
|
# Pull the version number out of "bd version 1.0.3 (Homebrew)".
|
|
ver="$(printf '%s' "$have" | sed -n 's/.*version[[:space:]]\([0-9.][0-9.]*\).*/\1/p' | head -1)"
|
|
if [[ -z "$ver" ]]; then
|
|
skip "could not parse current bd version: $have"
|
|
fi
|
|
run "$SCRIPT" --version "v$ver"
|
|
[ "$status" -eq 0 ]
|
|
[[ "$output" == *"already installed"* ]] || [[ "$output" == *"skipping"* ]]
|
|
}
|
|
|
|
@test "skills/bootstrap/SKILL.md wires install-bd.sh" {
|
|
run grep -q "install-bd.sh" "$REPO_ROOT/skills/bootstrap/SKILL.md"
|
|
[ "$status" -eq 0 ]
|
|
run grep -q "command -v bd" "$REPO_ROOT/skills/bootstrap/SKILL.md"
|
|
[ "$status" -eq 0 ]
|
|
}
|