Files
gh-jezweb-claude-skills-ski…/scripts/check-versions.sh
2025-11-30 08:24:51 +08:00

77 lines
2.3 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Check @google/genai package version and warn about deprecated SDK
# Usage: ./scripts/check-versions.sh
echo "🔍 Checking Gemini API SDK versions..."
echo ""
# Check if package.json exists
if [ ! -f "package.json" ]; then
echo "❌ No package.json found in current directory"
exit 1
fi
# Check for deprecated SDK
if grep -q "@google/generative-ai" package.json; then
echo "⚠️ WARNING: DEPRECATED SDK DETECTED!"
echo ""
echo " Package: @google/generative-ai"
echo " Status: DEPRECATED (sunset Nov 30, 2025)"
echo ""
echo " Action required:"
echo " 1. npm uninstall @google/generative-ai"
echo " 2. npm install @google/genai@1.27.0"
echo " 3. Update imports (see sdk-migration-guide.md)"
echo ""
fi
# Check for current SDK
if grep -q "@google/genai" package.json; then
# Get installed version
INSTALLED_VERSION=$(npm list @google/genai --depth=0 2>/dev/null | grep @google/genai | sed 's/.*@//' | sed 's/ .*//')
RECOMMENDED_VERSION="1.27.0"
echo "✅ Current SDK installed: @google/genai"
echo " Installed version: $INSTALLED_VERSION"
echo " Recommended version: $RECOMMENDED_VERSION"
echo ""
# Check if version matches recommendation
if [ "$INSTALLED_VERSION" != "$RECOMMENDED_VERSION" ]; then
echo " Consider updating to recommended version:"
echo " npm install @google/genai@$RECOMMENDED_VERSION"
echo ""
fi
else
echo "❌ @google/genai not found in package.json"
echo ""
echo " Install with:"
echo " npm install @google/genai@1.27.0"
echo ""
fi
# Check Node.js version
NODE_VERSION=$(node -v | sed 's/v//')
REQUIRED_NODE="18.0.0"
echo "Node.js version: $NODE_VERSION"
echo "Required: >= $REQUIRED_NODE"
echo ""
# Summary
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Summary:"
echo ""
if grep -q "@google/generative-ai" package.json; then
echo "❌ Migration needed: Remove deprecated SDK"
elif grep -q "@google/genai" package.json; then
echo "✅ Using current SDK (@google/genai)"
else
echo "❌ Gemini SDK not installed"
fi
echo ""
echo "For migration help, see:"
echo " references/sdk-migration-guide.md"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"