Last active
March 2, 2026 04:53
-
-
Save shanedolley/1868970117ea5dad8fbb9a5052ef6e7d to your computer and use it in GitHub Desktop.
Dolche Ventures OpenCode Setup - One-Line Installer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Dolche Ventures OpenCode Setup — One-Line Bootstrap (Windows) | |
| # Usage (cmd.exe): powershell -ExecutionPolicy Bypass -Command "irm https://gist.githubusercontent.com/shanedolley/1868970117ea5dad8fbb9a5052ef6e7d/raw/bootstrap.ps1 | iex" | |
| # Usage (PowerShell): irm https://gist.githubusercontent.com/shanedolley/1868970117ea5dad8fbb9a5052ef6e7d/raw/bootstrap.ps1 | iex | |
| # | |
| # This script is hosted as a public GitHub Gist because the setup repo is private. | |
| # It installs git + GitHub CLI, authenticates the user, clones the private repo, | |
| # and runs the full installer (which sets up OpenCode, symlinks, config, API key, and IDE). | |
| # Use "Continue" globally — native executables (git, gh) write to stderr | |
| # which PowerShell treats as terminating errors under "Stop". We check | |
| # $LASTEXITCODE explicitly after each native command instead. | |
| $ErrorActionPreference = "Continue" | |
| $Repo = "Dolche-Ventures/pvt-dv-opencode-setup" | |
| $InstallDir = "$env:USERPROFILE\.local\share\dv-opencode-setup" | |
| function Write-Info { param($Msg) Write-Host "[info] " -ForegroundColor Blue -NoNewline; Write-Host $Msg } | |
| function Write-Ok { param($Msg) Write-Host "[ok] " -ForegroundColor Green -NoNewline; Write-Host $Msg } | |
| function Write-Warn { param($Msg) Write-Host "[warn] " -ForegroundColor Yellow -NoNewline; Write-Host $Msg } | |
| function Write-Err { param($Msg) Write-Host "[error] " -ForegroundColor Red -NoNewline; Write-Host $Msg } | |
| Write-Host "Dolche Ventures OpenCode Setup" -ForegroundColor White | |
| Write-Host "" | |
| # ── Step 1: Ensure git is available ────────────────────── | |
| try { | |
| $null = Get-Command git -ErrorAction Stop | |
| $gitVersion = (git --version) -replace 'git version ', '' | |
| Write-Ok "git installed ($gitVersion)" | |
| } | |
| catch { | |
| Write-Info "git not found - installing..." | |
| try { | |
| $null = Get-Command winget -ErrorAction Stop | |
| winget install --id Git.Git -e --accept-package-agreements --accept-source-agreements | |
| Write-Host "" | |
| # Refresh PATH | |
| $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") | |
| if (Get-Command git -ErrorAction SilentlyContinue) { | |
| Write-Ok "git installed" | |
| } | |
| else { | |
| Write-Warn "git installed but not on PATH yet" | |
| Write-Host " Restart your terminal and re-run this command." | |
| exit 0 | |
| } | |
| } | |
| catch { | |
| Write-Err "Cannot install git automatically (winget not found)" | |
| Write-Host "" | |
| Write-Host " Install git manually: https://git-scm.com/downloads/win" | |
| Write-Host " Then re-run this command." | |
| exit 1 | |
| } | |
| } | |
| # ── Step 2: Ensure GitHub CLI is available ─────────────── | |
| try { | |
| $null = Get-Command gh -ErrorAction Stop | |
| $ghVersion = (gh --version | Select-Object -First 1) -replace 'gh version ', '' -replace ' .*', '' | |
| Write-Ok "GitHub CLI installed ($ghVersion)" | |
| } | |
| catch { | |
| Write-Info "GitHub CLI not found - installing..." | |
| try { | |
| $null = Get-Command winget -ErrorAction Stop | |
| winget install --id GitHub.cli -e --accept-package-agreements --accept-source-agreements | |
| Write-Host "" | |
| # Refresh PATH | |
| $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") | |
| if (Get-Command gh -ErrorAction SilentlyContinue) { | |
| Write-Ok "GitHub CLI installed" | |
| } | |
| else { | |
| Write-Warn "GitHub CLI installed but not on PATH yet" | |
| Write-Host " Restart your terminal and re-run this command." | |
| exit 0 | |
| } | |
| } | |
| catch { | |
| Write-Err "Cannot install GitHub CLI automatically (winget not found)" | |
| Write-Host "" | |
| Write-Host " Install manually: https://cli.github.com" | |
| Write-Host " Then re-run this command." | |
| exit 1 | |
| } | |
| } | |
| # ── Step 3: Authenticate with GitHub ───────────────────── | |
| Write-Host "" | |
| gh auth status 2>&1 | Out-Null | |
| if ($LASTEXITCODE -eq 0) { | |
| Write-Ok "Authenticated with GitHub" | |
| } | |
| else { | |
| Write-Warn "Not logged in to GitHub" | |
| Write-Host "" | |
| Write-Info "Opening browser for GitHub login..." | |
| Write-Host " Follow the prompts to authenticate." | |
| Write-Host "" | |
| gh auth login --web --git-protocol https | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Err "GitHub authentication failed" | |
| Write-Host " Try again or run manually: gh auth login" | |
| exit 1 | |
| } | |
| Write-Host "" | |
| Write-Ok "Authenticated with GitHub" | |
| } | |
| # Configure git to use gh as credential helper (so git pull works on HTTPS clones) | |
| gh auth setup-git 2>&1 | Out-Null | |
| # ── Step 4: Clone or update repo ──────────────────────── | |
| Write-Host "" | |
| if ((Test-Path $InstallDir) -and -not (Test-Path "$InstallDir\.git")) { | |
| Write-Err "Incomplete installation found at: $InstallDir" | |
| Write-Host " Remove it and re-run: Remove-Item -Recurse -Force '$InstallDir'" | |
| exit 1 | |
| } | |
| if (Test-Path "$InstallDir\.git") { | |
| Write-Info "Updating existing installation..." | |
| # Try git pull with gh credential helper, suppress interactive prompts | |
| gh auth setup-git 2>&1 | Out-Null | |
| $env:GIT_TERMINAL_PROMPT = "0" | |
| git -C $InstallDir pull --ff-only 2>&1 | Out-Null | |
| $pullResult = $LASTEXITCODE | |
| $env:GIT_TERMINAL_PROMPT = $null | |
| if ($pullResult -eq 0) { | |
| Write-Ok "Updated to latest version" | |
| } | |
| else { | |
| # git pull failed (credentials not configured) - re-clone via gh | |
| Write-Warn "git pull failed, re-cloning via GitHub CLI..." | |
| Remove-Item -Recurse -Force $InstallDir | |
| gh repo clone $Repo $InstallDir | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Err "Failed to clone $Repo" | |
| Write-Host " Make sure you have access to the Dolche-Ventures organization." | |
| Write-Host " Ask your admin to grant you access if needed." | |
| exit 1 | |
| } | |
| Write-Ok "Cloned successfully" | |
| } | |
| } | |
| else { | |
| Write-Info "Cloning setup repo..." | |
| gh repo clone $Repo $InstallDir | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Err "Failed to clone $Repo" | |
| Write-Host " Make sure you have access to the Dolche-Ventures organization." | |
| Write-Host " Ask your admin to grant you access if needed." | |
| exit 1 | |
| } | |
| Write-Ok "Cloned successfully" | |
| } | |
| # ── Step 5: Run installer ─────────────────────────────── | |
| Write-Host "" | |
| & "$InstallDir\install.ps1" @args |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| # Dolche Ventures OpenCode Setup — One-Line Bootstrap | |
| # Usage: curl -fsSL https://gist.githubusercontent.com/shanedolley/1868970117ea5dad8fbb9a5052ef6e7d/raw/bootstrap.sh | bash | |
| # | |
| # This script is hosted as a public GitHub Gist because the setup repo is private. | |
| # It installs git + GitHub CLI, authenticates the user, clones the private repo, | |
| # and runs the full installer. | |
| # | |
| # The main() wrapper ensures bash reads the entire script into memory before | |
| # executing, which is required for curl ... | bash to work correctly. | |
| main() { | |
| REPO="Dolche-Ventures/pvt-dv-opencode-setup" | |
| INSTALL_DIR="$HOME/.local/share/dv-opencode-setup" | |
| # Colors (disabled if not a terminal) | |
| if [ -t 1 ]; then | |
| RED='\033[0;31m' | |
| GREEN='\033[0;32m' | |
| YELLOW='\033[0;33m' | |
| BLUE='\033[0;34m' | |
| BOLD='\033[1m' | |
| NC='\033[0m' | |
| else | |
| RED='' GREEN='' YELLOW='' BLUE='' BOLD='' NC='' | |
| fi | |
| info() { echo -e "${BLUE}[info]${NC} $1"; } | |
| ok() { echo -e "${GREEN}[ok]${NC} $1"; } | |
| warn() { echo -e "${YELLOW}[warn]${NC} $1"; } | |
| error() { echo -e "${RED}[error]${NC} $1"; } | |
| echo -e "${BOLD}Dolche Ventures OpenCode Setup${NC}" | |
| echo "" | |
| # ── Step 1: Ensure git is available ────────────────────── | |
| if command -v git &>/dev/null; then | |
| ok "git installed ($(git --version | awk '{print $3}'))" | |
| else | |
| info "git not found — installing..." | |
| case "$(uname -s)" in | |
| Darwin) | |
| if command -v brew &>/dev/null; then | |
| brew install git | |
| else | |
| info "Installing Xcode Command Line Tools (includes git)..." | |
| xcode-select --install 2>/dev/null || true | |
| echo "" | |
| echo " If a dialog appeared, click Install and re-run this command when done." | |
| exit 0 | |
| fi | |
| ;; | |
| Linux) | |
| if command -v apt-get &>/dev/null; then | |
| sudo apt-get update && sudo apt-get install -y git | |
| elif command -v dnf &>/dev/null; then | |
| sudo dnf install -y git | |
| elif command -v pacman &>/dev/null; then | |
| sudo pacman -S --noconfirm git | |
| elif command -v apk &>/dev/null; then | |
| sudo apk add git | |
| else | |
| error "Cannot install git: no supported package manager found" | |
| echo " Install manually: https://git-scm.com/downloads" | |
| exit 1 | |
| fi | |
| ;; | |
| *) | |
| error "Unsupported platform: $(uname -s)" | |
| exit 1 | |
| ;; | |
| esac | |
| if ! command -v git &>/dev/null; then | |
| error "git installation failed" | |
| exit 1 | |
| fi | |
| ok "git installed" | |
| fi | |
| # ── Step 2: Ensure GitHub CLI is available ─────────────── | |
| if command -v gh &>/dev/null; then | |
| ok "GitHub CLI installed ($(gh --version | head -1 | awk '{print $3}'))" | |
| else | |
| info "GitHub CLI not found — installing..." | |
| case "$(uname -s)" in | |
| Darwin) | |
| if command -v brew &>/dev/null; then | |
| brew install gh | |
| else | |
| error "Homebrew required to install GitHub CLI on macOS" | |
| echo " Install Homebrew: https://brew.sh" | |
| echo " Then run: brew install gh" | |
| exit 1 | |
| fi | |
| ;; | |
| Linux) | |
| if command -v apt-get &>/dev/null; then | |
| # Official GitHub CLI repo for Debian/Ubuntu | |
| curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg | |
| sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg | |
| echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null | |
| sudo apt-get update && sudo apt-get install -y gh | |
| elif command -v dnf &>/dev/null; then | |
| sudo dnf install -y 'dnf-command(config-manager)' | |
| sudo dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo | |
| sudo dnf install -y gh | |
| elif command -v pacman &>/dev/null; then | |
| sudo pacman -S --noconfirm github-cli | |
| else | |
| error "Cannot install GitHub CLI: no supported package manager found" | |
| echo " Install manually: https://cli.github.com" | |
| exit 1 | |
| fi | |
| ;; | |
| *) | |
| error "Unsupported platform: $(uname -s)" | |
| exit 1 | |
| ;; | |
| esac | |
| if ! command -v gh &>/dev/null; then | |
| error "GitHub CLI installation failed" | |
| exit 1 | |
| fi | |
| ok "GitHub CLI installed" | |
| fi | |
| # ── Step 3: Authenticate with GitHub ───────────────────── | |
| echo "" | |
| if gh auth status &>/dev/null; then | |
| ok "Authenticated with GitHub" | |
| else | |
| warn "Not logged in to GitHub" | |
| echo "" | |
| info "Opening browser for GitHub login..." | |
| echo " Follow the prompts to authenticate." | |
| echo "" | |
| if ! gh auth login --web --git-protocol https; then | |
| error "GitHub authentication failed" | |
| echo " Try again or run manually: gh auth login" | |
| exit 1 | |
| fi | |
| echo "" | |
| ok "Authenticated with GitHub" | |
| fi | |
| # Configure git to use gh as credential helper (so git pull works on HTTPS clones) | |
| gh auth setup-git 2>/dev/null || true | |
| # ── Step 4: Clone or update repo ──────────────────────── | |
| echo "" | |
| if [ -d "$INSTALL_DIR" ] && [ ! -d "$INSTALL_DIR/.git" ]; then | |
| error "Incomplete installation found at: $INSTALL_DIR" | |
| echo " Remove it and re-run: rm -rf '$INSTALL_DIR'" | |
| exit 1 | |
| fi | |
| if [ -d "$INSTALL_DIR/.git" ]; then | |
| info "Updating existing installation..." | |
| # Try git pull with gh credential helper, suppress interactive prompts | |
| gh auth setup-git 2>/dev/null || true | |
| if GIT_TERMINAL_PROMPT=0 git -C "$INSTALL_DIR" pull --ff-only 2>/dev/null; then | |
| ok "Updated to latest version" | |
| else | |
| # git pull failed (credentials not configured) — re-clone via gh | |
| warn "git pull failed, re-cloning via GitHub CLI..." | |
| rm -rf "$INSTALL_DIR" | |
| if gh repo clone "$REPO" "$INSTALL_DIR"; then | |
| ok "Cloned successfully" | |
| else | |
| error "Failed to clone $REPO" | |
| echo " Make sure you have access to the Dolche-Ventures organization." | |
| echo " Ask your admin to grant you access if needed." | |
| exit 1 | |
| fi | |
| fi | |
| else | |
| info "Cloning setup repo..." | |
| if gh repo clone "$REPO" "$INSTALL_DIR"; then | |
| ok "Cloned successfully" | |
| else | |
| error "Failed to clone $REPO" | |
| echo " Make sure you have access to the Dolche-Ventures organization." | |
| echo " Ask your admin to grant you access if needed." | |
| exit 1 | |
| fi | |
| fi | |
| # ── Step 5: Run installer ─────────────────────────────── | |
| echo "" | |
| # Redirect stdin from /dev/tty so install.sh's interactive prompts work | |
| # even when this script was piped (curl ... | bash). sudo and gh handle | |
| # their own /dev/tty access, but bash's `read` builtin needs this. | |
| if [ ! -t 0 ] && [ -e /dev/tty ]; then | |
| exec bash "$INSTALL_DIR/install.sh" "$@" < /dev/tty | |
| else | |
| exec bash "$INSTALL_DIR/install.sh" "$@" | |
| fi | |
| } | |
| # Invoke main — the function wrapper ensures bash parses the entire script | |
| # into memory before executing, which is required for curl ... | bash | |
| main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment