feat(02-01): add --check mode for prerequisite verification
This commit is contained in:
parent
1eddd9336d
commit
7001303436
1 changed files with 45 additions and 0 deletions
45
claudebox.sh
45
claudebox.sh
|
|
@ -16,6 +16,51 @@ while (( $# > 0 )); do
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
export SKIP_AUDIT # consumed by Plan 02 audit display
|
||||||
|
|
||||||
|
# --check: verify prerequisites and exit (D-10, UX-05)
|
||||||
|
if [[ "$CHECK_MODE" == true ]]; then
|
||||||
|
pass=true
|
||||||
|
green=$'\033[32m' red=$'\033[31m' yellow=$'\033[33m' reset=$'\033[0m'
|
||||||
|
|
||||||
|
check_cmd() {
|
||||||
|
if command -v "$1" &>/dev/null; then
|
||||||
|
echo "${green}OK${reset} $1" >&2
|
||||||
|
else
|
||||||
|
echo "${red}FAIL${reset} $1 -- not found" >&2
|
||||||
|
pass=false
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "claudebox prerequisites:" >&2
|
||||||
|
echo "" >&2
|
||||||
|
check_cmd bwrap
|
||||||
|
check_cmd claude
|
||||||
|
check_cmd git
|
||||||
|
check_cmd curl
|
||||||
|
check_cmd nix
|
||||||
|
|
||||||
|
if [[ -d "$HOME/.claudebox" ]]; then
|
||||||
|
echo "${green}OK${reset} ~/.claudebox exists" >&2
|
||||||
|
else
|
||||||
|
echo "${red}FAIL${reset} ~/.claudebox -- not found (will be created on first run)" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -v ANTHROPIC_API_KEY ]]; then
|
||||||
|
echo "${green}OK${reset} ANTHROPIC_API_KEY is set" >&2
|
||||||
|
else
|
||||||
|
echo "${yellow}WARN${reset} ANTHROPIC_API_KEY is not set" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "" >&2
|
||||||
|
if [[ "$pass" == true ]]; then
|
||||||
|
echo "${green}All checks passed.${reset}" >&2
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "${red}Some checks failed.${reset}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# SANDBOX_PATH is injected by flake.nix via makeBinPath (only runtimeInputs, no host PATH)
|
# SANDBOX_PATH is injected by flake.nix via makeBinPath (only runtimeInputs, no host PATH)
|
||||||
# Resolve binary paths from runtimeInputs
|
# Resolve binary paths from runtimeInputs
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue