mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-02-15 10:53:18 +08:00
- Add try-catch around readFileSync in validate-agents, validate-commands, validate-skills to handle TOCTOU races and file read errors - Add validate-hooks.js and all test suites to package.json test script (was only running 4/5 validators and 0/4 test files) - Fix shell variable injection in observe.sh: use os.environ instead of interpolating $timestamp/$OBSERVATIONS_FILE into Python string literals - Fix $? always being 0 in start-observer.sh: capture exit code before conditional since `if !` inverts the status - Add OLD_VERSION validation in release.sh and use pipe delimiter in sed to avoid issues with slash-containing values - Add jq dependency check in evaluate-session.sh before parsing config - Sync .cursor/ copies of all modified shell scripts
72 lines
1.8 KiB
Bash
Executable File
72 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Release script for bumping plugin version
|
|
# Usage: ./scripts/release.sh VERSION
|
|
|
|
VERSION="${1:-}"
|
|
PLUGIN_JSON=".claude-plugin/plugin.json"
|
|
|
|
# Function to show usage
|
|
usage() {
|
|
echo "Usage: $0 VERSION"
|
|
echo "Example: $0 1.5.0"
|
|
exit 1
|
|
}
|
|
|
|
# Validate VERSION is provided
|
|
if [[ -z "$VERSION" ]]; then
|
|
echo "Error: VERSION argument is required"
|
|
usage
|
|
fi
|
|
|
|
# Validate VERSION is semver format (X.Y.Z)
|
|
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
echo "Error: VERSION must be in semver format (e.g., 1.5.0)"
|
|
exit 1
|
|
fi
|
|
|
|
# Check current branch is main
|
|
CURRENT_BRANCH=$(git branch --show-current)
|
|
if [[ "$CURRENT_BRANCH" != "main" ]]; then
|
|
echo "Error: Must be on main branch (currently on $CURRENT_BRANCH)"
|
|
exit 1
|
|
fi
|
|
|
|
# Check working tree is clean
|
|
if ! git diff --quiet || ! git diff --cached --quiet; then
|
|
echo "Error: Working tree is not clean. Commit or stash changes first."
|
|
exit 1
|
|
fi
|
|
|
|
# Verify plugin.json exists
|
|
if [[ ! -f "$PLUGIN_JSON" ]]; then
|
|
echo "Error: $PLUGIN_JSON not found"
|
|
exit 1
|
|
fi
|
|
|
|
# Read current version
|
|
OLD_VERSION=$(grep -oE '"version": *"[^"]*"' "$PLUGIN_JSON" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
|
|
if [[ -z "$OLD_VERSION" ]]; then
|
|
echo "Error: Could not extract current version from $PLUGIN_JSON"
|
|
exit 1
|
|
fi
|
|
echo "Bumping version: $OLD_VERSION -> $VERSION"
|
|
|
|
# Update version in plugin.json (cross-platform sed, pipe-delimiter avoids issues with slashes)
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
# macOS
|
|
sed -i '' "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|" "$PLUGIN_JSON"
|
|
else
|
|
# Linux
|
|
sed -i "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|" "$PLUGIN_JSON"
|
|
fi
|
|
|
|
# Stage, commit, tag, and push
|
|
git add "$PLUGIN_JSON"
|
|
git commit -m "chore: bump plugin version to $VERSION"
|
|
git tag "v$VERSION"
|
|
git push origin main "v$VERSION"
|
|
|
|
echo "Released v$VERSION"
|