|
#!/usr/bin/env bash |
|
set -euo pipefail |
|
|
|
echo "==> Running post-install steps" |
|
|
|
mkdir -p "$HOME/Code" |
|
|
|
echo "==> Initializing Git LFS" |
|
git lfs install |
|
|
|
echo "==> Starting Ollama service" |
|
if command -v brew >/dev/null 2>&1; then |
|
brew services start ollama || true |
|
fi |
|
|
|
echo "==> Starting Docker Desktop" |
|
open -a Docker || true |
|
|
|
resolve_cmd() { |
|
local command_name="$1" |
|
local fallback="$2" |
|
|
|
if command -v "$command_name" >/dev/null 2>&1; then |
|
command -v "$command_name" |
|
elif [[ -x "$fallback" ]]; then |
|
printf '%s\n' "$fallback" |
|
else |
|
return 1 |
|
fi |
|
} |
|
|
|
install_vscode_extensions() { |
|
local code_bin="${1:-}" |
|
|
|
if [[ -z "$code_bin" ]]; then |
|
return 0 |
|
fi |
|
|
|
echo "==> Installing VS Code extensions using: $code_bin" |
|
|
|
local extensions=( |
|
"ms-vscode-remote.remote-containers" |
|
"GitHub.copilot" |
|
"GitHub.copilot-chat" |
|
"GitHub.vscode-pull-request-github" |
|
"GitHub.vscode-github-actions" |
|
"EditorConfig.EditorConfig" |
|
"ms-azuretools.vscode-docker" |
|
) |
|
|
|
for extension in "${extensions[@]}"; do |
|
"$code_bin" --install-extension "$extension" --force || true |
|
done |
|
} |
|
|
|
CODE_BIN="$(resolve_cmd code "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code" || true)" |
|
CODE_INSIDERS_BIN="$(resolve_cmd code-insiders "/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/bin/code-insiders" || true)" |
|
|
|
install_vscode_extensions "$CODE_BIN" |
|
install_vscode_extensions "$CODE_INSIDERS_BIN" |
|
|
|
echo "==> Verifying tools" |
|
git --version || true |
|
git lfs version || true |
|
gh --version || true |
|
pwsh --version || true |
|
ollama --version || true |
|
llmfit --version || true |
|
copilot --version || true |
|
docker --version || true |
|
|
|
if [[ -n "${CODE_BIN:-}" ]]; then |
|
"$CODE_BIN" --version || true |
|
fi |
|
|
|
if [[ -n "${CODE_INSIDERS_BIN:-}" ]]; then |
|
"$CODE_INSIDERS_BIN" --version || true |
|
fi |
|
|
|
echo "==> Opening VS Code" |
|
open -a "Visual Studio Code" "$HOME/Code" || true |