105 lines
3.2 KiB
Bash
Executable File
105 lines
3.2 KiB
Bash
Executable File
#!/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
|
|
}
|
|
|
|
check_command() {
|
|
local label="$1"
|
|
local command_name="$2"
|
|
|
|
if command -v "$command_name" >/dev/null 2>&1; then
|
|
printf '[ok] %s: %s\n' "$label" "$command_name"
|
|
else
|
|
printf '[missing] %s: %s\n' "$label" "$command_name" >&2
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
check_readable_file() {
|
|
local label="$1"
|
|
local path="$2"
|
|
|
|
if [[ -r "$path" ]]; then
|
|
printf '[ok] %s: %s\n' "$label" "$path"
|
|
else
|
|
printf '[unreadable] %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)"
|
|
local vscode_mcp_file="$vscode_user_dir/mcp.json"
|
|
local copilot_cli_mcp_file="$copilot_home/mcp-config.json"
|
|
local local_mcp_overrides_file="$canonical_home/.local/mcp.local.jsonc"
|
|
local session_start_hook_file="$canonical_home/resources/hooks/session-audit.json"
|
|
local session_start_hook_script="$canonical_home/resources/scripts/report-hook-event.sh"
|
|
|
|
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 "session start hook" "$session_start_hook_file"
|
|
check_path "session start hook script" "$session_start_hook_script"
|
|
check_readable_file "session start hook script" "$session_start_hook_script"
|
|
check_command "session start hook shell" "bash"
|
|
check_path "prompts link" "$vscode_user_dir/prompts"
|
|
check_path "VS Code MCP config" "$vscode_mcp_file"
|
|
check_path "Copilot CLI MCP config" "$copilot_cli_mcp_file"
|
|
check_path "local MCP overrides" "$local_mcp_overrides_file"
|
|
|
|
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"
|
|
check_path "VS Code MCP template" "$repo_root/config/mcp/vscode.mcp.template.jsonc"
|
|
check_path "Copilot CLI MCP template" "$repo_root/config/mcp/copilot-cli.mcp.template.jsonc"
|
|
check_path "MCP local override example" "$repo_root/config/mcp/local-overrides.example.jsonc"
|
|
check_path "Copilot CLI filesystem wrapper" "$repo_root/install/mcp/copilot-cli-filesystem-wrapper.mjs"
|
|
fi
|
|
}
|
|
|
|
main "$@"
|