Skip to content

Bootstrap

FieldValue
TypeSkill Resource
Source~/.copilot/skills/go-task/templates/scripts/bootstrap.sh
DescriptionNot specified

Source Content

#!/usr/bin/env bash
#
# bootstrap.sh — the non-destructive half of project lifecycle: restore .env from
# .env.example when missing, install dependencies for the detected stack, and
# build once so the tree is runnable. Idempotent: safe to run repeatedly.
#
# Wired to `task setup` (first-time, on its own) and `task reset` (run right
# after reset.sh has cleaned the tree). Detects Go / Node and degrades quietly
# when neither is present.
set -euo pipefail
log() { printf '\033[36m▸ %s\033[0m\n' "$*"; }
if [ ! -f .env ] && [ -f .env.example ]; then
log "Creating .env from .env.example"
cp .env.example .env
fi
if [ -f go.mod ]; then
log "Tidying Go module dependencies"
go mod tidy
elif [ -f package.json ]; then
if [ -f package-lock.json ]; then
log "Installing Node dependencies (npm ci)"
npm ci
else
log "Installing Node dependencies (npm install)"
npm install
fi
else
log "No go.mod or package.json found — skipping dependency install"
fi
log "Bootstrap complete"