#!/usr/bin/env bash set -euo pipefail script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" repo_root="$(cd -- "$script_dir/.." && pwd -P)" canonical_home="${COPILOT_RESOURCES_HOME:-$HOME/.copilot-resources}" copilot_home="${COPILOT_HOME:-$HOME/.copilot}" quick="false" detect_vscode_user_dir() { if [[ -n "${VSCODE_USER_DIR:-}" ]]; then printf '%s\n' "$VSCODE_USER_DIR" return 0 fi case "$(uname -s)" in Darwin) printf '%s\n' "$HOME/Library/Application Support/Code/User" ;; Linux) printf '%s\n' "$HOME/.config/Code/User" ;; *) printf '%s\n' "$HOME/.config/Code/User" ;; esac } check_path() { local label="$1" local path="$2" if [[ -e "$path" ]]; then printf '[ok] %s: %s\n' "$label" "$path" else printf '[missing] %s: %s\n' "$label" "$path" >&2 return 1 fi } main() { if [[ "${1:-}" == "--quick" ]]; then quick="true" fi local vscode_user_dir vscode_user_dir="$(detect_vscode_user_dir)" check_path "repo root" "$repo_root" check_path "canonical home" "$canonical_home" check_path "skills link" "$copilot_home/skills" check_path "agents link" "$copilot_home/agents" check_path "instructions link" "$copilot_home/instructions" check_path "hooks link" "$copilot_home/hooks" check_path "prompts link" "$vscode_user_dir/prompts" if [[ "$quick" != "true" ]]; then check_path "VS Code settings template" "$repo_root/config/vscode/settings.template.jsonc" check_path "CLI env template" "$repo_root/config/copilot-cli/env.example.sh" fi } main "$@"