Files
planet/scripts/harness/doctor.sh
rayd1o a54fcdbeed
Some checks failed
ci / backend (push) Has been cancelled
ci / frontend (push) Has been cancelled
ci / delivery (push) Has been cancelled
release / images (push) Has been cancelled
ci / backend (pull_request) Has been cancelled
ci / frontend (pull_request) Has been cancelled
ci / delivery (pull_request) Has been cancelled
release: bump version to 0.74.3
2026-09-13 02:17:55 +08:00

118 lines
2.8 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
source "$ROOT_DIR/scripts/harness/lib.sh"
failures=0
warnings=0
ok() {
printf "ok: %s\n" "$1"
}
warn() {
warnings=$((warnings + 1))
printf "warn: %s\n" "$1"
}
fail() {
failures=$((failures + 1))
printf "fail: %s\n" "$1"
}
check_cmd() {
local cmd="$1"
local found
if found="$(harness_find_cmd "$cmd")"; then
harness_prepend_tool_dir "$found"
ok "found command: $cmd ($found)"
else
fail "missing required command: $cmd"
fi
}
check_optional_cmd() {
local cmd="$1"
local reason="$2"
local found
if found="$(harness_find_cmd "$cmd")"; then
harness_prepend_tool_dir "$found"
ok "found optional command: $cmd ($found)"
else
warn "missing optional command: $cmd ($reason)"
fi
}
check_file() {
local path="$1"
if [ -e "$ROOT_DIR/$path" ]; then
ok "found file: $path"
else
fail "missing required file: $path"
fi
}
check_absent() {
local path="$1"
local reason="$2"
if [ -e "$ROOT_DIR/$path" ]; then
fail "unexpected file: $path ($reason)"
else
ok "absent as expected: $path"
fi
}
main() {
cd "$ROOT_DIR"
check_file README.md
check_file rules.md
check_file project_context.md
check_file AGENTS.md
check_file CODEMAP.md
check_file docs/HARNESS.md
check_file docs/harness-audit.md
check_file docs/documentation-coverage-rules.md
check_file planet.sh
check_file scripts/lib/docker-bootstrap.zsh
check_file scripts/harness/test_docker_bootstrap.py
check_file pyproject.toml
check_file frontend/package.json
check_file scripts/harness/security-check.sh
check_file scripts/harness/backend-rules-check.sh
check_file scripts/harness/frontend-rules-check.sh
check_file scripts/harness/docs-consistency-check.sh
check_file scripts/harness/frontend-smoke.mjs
check_file .gitea/workflows/ci.yaml
check_cmd git
check_cmd zsh
check_cmd uv
check_cmd bun
check_optional_cmd docker "needed for local stack and optional image smoke builds"
check_optional_cmd helm "needed for optional Helm delivery smoke checks"
check_absent frontend/package-lock.json "frontend package management is Bun-only"
check_absent frontend/pnpm-lock.yaml "frontend package management is Bun-only"
check_absent frontend/yarn.lock "frontend package management is Bun-only"
check_absent agents.md "AGENTS.md is the single agent guide"
if [ ! -x "$ROOT_DIR/planet.sh" ]; then
warn "planet.sh is not executable; run it with zsh or restore executable bit"
else
ok "planet.sh is executable"
fi
if [ "$failures" -gt 0 ]; then
printf "harness doctor failed: %d failure(s), %d warning(s)\n" "$failures" "$warnings"
exit 1
fi
printf "harness doctor passed: %d warning(s)\n" "$warnings"
}
main "$@"