Add robust command availability checks to all shell scripts

- Add check for @defaultPackageName@-devenv in activateDevenv.sh
- Add check for uv command in initPython.sh
- Add check for git command in initProject.sh (with graceful degradation)
- Add checks for wget, sed, nix in updateDeps.sh
- Provide clear error messages when commands are not available
- Prevent scripts from failing with cryptic errors when tools are missing

Co-authored-by: dwinkler1 <22460147+dwinkler1@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-01-11 20:11:12 +00:00
commit 0273515951
4 changed files with 56 additions and 16 deletions

View file

@ -3,10 +3,29 @@ set -euo pipefail
echo "🔄 Updating project dependencies..."
# Check for required commands
if ! command -v wget &> /dev/null; then
echo "❌ Error: 'wget' command not found."
echo "Please install wget to fetch R version information."
exit 1
fi
if ! command -v sed &> /dev/null; then
echo "❌ Error: 'sed' command not found."
echo "Please install sed to update flake.nix."
exit 1
fi
if ! command -v nix &> /dev/null; then
echo "❌ Error: 'nix' command not found."
echo "Please install Nix to update flake inputs."
exit 1
fi
# Ensure we're in the repository root
if [[ ! -f "flake.nix" ]]; then
# Try to find git root
if git rev-parse --show-toplevel >/dev/null 2>&1; then
if command -v git &> /dev/null && git rev-parse --show-toplevel >/dev/null 2>&1; then
cd "$(git rev-parse --show-toplevel)"
if [[ ! -f "flake.nix" ]]; then
echo "❌ Error: flake.nix not found in repository root"