Initial commit
This commit is contained in:
42
skills/version/SKILL.md
Normal file
42
skills/version/SKILL.md
Normal file
@@ -0,0 +1,42 @@
|
||||
---
|
||||
name: version
|
||||
description: Search and fetch the latest version of a Go or Python package.
|
||||
license: Complete terms in LICENSE.txt
|
||||
---
|
||||
|
||||
# Version Fetcher Skill
|
||||
|
||||
Fetch latest package versions for Go and Python packages.
|
||||
|
||||
## Tools
|
||||
|
||||
### get_go_version
|
||||
Fetch the latest version of a Go package/module.
|
||||
|
||||
**Example:** `get_go_version github.com/gin-gonic/gin`
|
||||
|
||||
```bash
|
||||
bash scripts/go-version.sh "$PACKAGE"
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
- `PACKAGE` (required): Go module path (e.g., github.com/gin-gonic/gin)
|
||||
|
||||
#### Alternative
|
||||
|
||||
Get the latest version of all the go mod files using `go list -m -u all`
|
||||
|
||||
---
|
||||
|
||||
### get_python_version
|
||||
Fetch the latest version of a Python package from PyPI.
|
||||
|
||||
**Example:** `get_python_version requests`
|
||||
|
||||
```bash
|
||||
bash scripts/python-version.sh "$PACKAGE"
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
- `PACKAGE` (required): Python package name (e.g., requests, numpy)
|
||||
|
||||
23
skills/version/scripts/go-version.sh
Executable file
23
skills/version/scripts/go-version.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
PACKAGE="$1"
|
||||
|
||||
# Query Go proxy for latest version
|
||||
URL="https://proxy.golang.org/${PACKAGE}/@latest"
|
||||
RESPONSE=$(curl -sf "$URL" 2>/dev/null || echo "")
|
||||
|
||||
if [ -z "$RESPONSE" ]; then
|
||||
echo "Error: Package '$PACKAGE' not found or unreachable" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Extract version from JSON response
|
||||
VERSION=$(echo "$RESPONSE" | grep -o '"Version":"[^"]*"' | cut -d'"' -f4)
|
||||
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Error: Could not parse version from response" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "$VERSION"
|
||||
23
skills/version/scripts/python-version.sh
Executable file
23
skills/version/scripts/python-version.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
PACKAGE="$1"
|
||||
|
||||
# Query PyPI API for package info
|
||||
URL="https://pypi.org/pypi/${PACKAGE}/json"
|
||||
RESPONSE=$(curl -sf "$URL" 2>/dev/null || echo "")
|
||||
|
||||
if [ -z "$RESPONSE" ]; then
|
||||
echo "Error: Package '$PACKAGE' not found on PyPI" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Extract latest version from JSON response
|
||||
VERSION=$(echo "$RESPONSE" | grep -o '"version":"[^"]*"' | head -1 | cut -d'"' -f4)
|
||||
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Error: Could not parse version from response" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "$VERSION"
|
||||
Reference in New Issue
Block a user