feat: add non-technical user onboarding
- setup.sh: interactive wizard for Docker check and auth configuration - launch.sh: folder-picker launcher (macOS native dialog, zenity/kdialog on Linux, text fallback) - launch.bat: Windows launcher using PowerShell folder browser + Git Bash - claude.sh: friendlier error messages with actionable links; prompt setup.sh if .env missing - hooks/pre-commit: add setup.sh and launch.sh to executable enforcement - README: add Quick Start section aimed at non-technical users Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
51e7ab2b08
commit
f68ed674d0
6 changed files with 297 additions and 45 deletions
111
setup.sh
Executable file
111
setup.sh
Executable file
|
|
@ -0,0 +1,111 @@
|
|||
#!/usr/bin/env bash
|
||||
# setup.sh — First-time setup wizard for docker-claude
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
ENV_FILE="$SCRIPT_DIR/.env"
|
||||
|
||||
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'; BOLD='\033[1m'; NC='\033[0m'
|
||||
info() { echo -e "${GREEN}[+]${NC} $*"; }
|
||||
warn() { echo -e "${YELLOW}[!]${NC} $*"; }
|
||||
error() { echo -e "${RED}[✗]${NC} $*" >&2; }
|
||||
step() { echo -e "\n${BOLD}$*${NC}"; }
|
||||
|
||||
# ─── Check Docker ─────────────────────────────────────────────────────────────
|
||||
check_docker() {
|
||||
step "Checking Docker..."
|
||||
|
||||
if ! command -v docker &>/dev/null; then
|
||||
error "Docker is not installed."
|
||||
echo " → Download Docker Desktop (free): https://www.docker.com/products/docker-desktop/"
|
||||
echo " It includes everything you need — no extra tools required."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! docker info &>/dev/null 2>&1; then
|
||||
error "Docker is installed but not running."
|
||||
echo " → Open Docker Desktop and wait for the whale icon to stop animating,"
|
||||
echo " then run this setup again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! docker compose version &>/dev/null 2>&1; then
|
||||
error "Docker Compose is not available."
|
||||
echo " → Download Docker Desktop (includes Compose): https://www.docker.com/products/docker-desktop/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
info "Docker is ready."
|
||||
}
|
||||
|
||||
# ─── Auth setup ───────────────────────────────────────────────────────────────
|
||||
setup_auth() {
|
||||
step "Authentication"
|
||||
echo " How would you like to sign in to Claude?"
|
||||
echo ""
|
||||
echo " 1) Anthropic API key (pay-per-use)"
|
||||
echo " Get one at: https://console.anthropic.com/settings/keys"
|
||||
echo ""
|
||||
echo " 2) Claude subscription (Claude Pro or Max)"
|
||||
echo " Generates a token from your existing subscription."
|
||||
echo ""
|
||||
echo " 3) Browser login (sign in when Claude first starts)"
|
||||
echo ""
|
||||
read -rp " Choice [1/2/3, default: 3]: " choice
|
||||
choice="${choice:-3}"
|
||||
|
||||
case "$choice" in
|
||||
1)
|
||||
echo ""
|
||||
read -rp " Paste your API key (sk-ant-...): " api_key
|
||||
if [[ -z "$api_key" ]]; then
|
||||
error "No API key entered. Run setup again when you have one."
|
||||
exit 1
|
||||
fi
|
||||
echo "ANTHROPIC_API_KEY=$api_key" > "$ENV_FILE"
|
||||
;;
|
||||
2)
|
||||
echo ""
|
||||
echo " You'll need to run 'claude setup-token' on your host to generate a token."
|
||||
echo " If Claude Code is installed natively, run that command now and paste the result."
|
||||
echo " Otherwise choose option 3 (browser login)."
|
||||
echo ""
|
||||
read -rp " Paste your OAuth token: " token
|
||||
if [[ -z "$token" ]]; then
|
||||
error "No token entered. Run setup again when you have one."
|
||||
exit 1
|
||||
fi
|
||||
echo "CLAUDE_CODE_OAUTH_TOKEN=$token" > "$ENV_FILE"
|
||||
;;
|
||||
3)
|
||||
touch "$ENV_FILE"
|
||||
warn "Browser login selected."
|
||||
warn "When Claude starts for the first time, it will print a login URL."
|
||||
warn "Open that URL in your browser to sign in."
|
||||
;;
|
||||
*)
|
||||
error "Invalid choice: $choice"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# ─── Main ─────────────────────────────────────────────────────────────────────
|
||||
echo -e "\n${BOLD}docker-claude setup${NC}"
|
||||
echo "────────────────────"
|
||||
|
||||
if [[ -f "$ENV_FILE" ]]; then
|
||||
warn ".env already exists (setup was already run)."
|
||||
read -rp " Reconfigure authentication? [y/N]: " confirm
|
||||
if [[ "${confirm,,}" != "y" ]]; then
|
||||
info "Setup skipped. Run ./launch.sh to start Claude."
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
check_docker
|
||||
setup_auth
|
||||
|
||||
echo ""
|
||||
info "Setup complete!"
|
||||
info "→ Run ./launch.sh to start Claude Code."
|
||||
Loading…
Add table
Add a link
Reference in a new issue