Add --framework-only flag to migrate command and enhance framework-pull
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -8,12 +8,21 @@ set -e
|
||||
|
||||
# Parse arguments
|
||||
NO_REBUILD=false
|
||||
SHOW_DIFF=false
|
||||
STASH_CHANGES=false
|
||||
for arg in "$@"; do
|
||||
if [ "$arg" = "--no-rebuild" ]; then
|
||||
NO_REBUILD=true
|
||||
elif [ "$arg" = "--diff" ]; then
|
||||
SHOW_DIFF=true
|
||||
elif [ "$arg" = "--stash" ]; then
|
||||
STASH_CHANGES=true
|
||||
fi
|
||||
done
|
||||
|
||||
# Configure git to ignore file mode changes
|
||||
git config core.fileMode false
|
||||
|
||||
# Determine project mode: Check for .rspade-dev-environment or rsx/.git
|
||||
IS_PROJECT_MODE=false
|
||||
if [ -f ".rspade-dev-environment" ] || [ -d "rsx/.git" ]; then
|
||||
@@ -148,6 +157,15 @@ if [ "$CURRENT_HEAD" = "$UPSTREAM_HEAD" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Handle --diff option: show diff and exit
|
||||
if [ "$SHOW_DIFF" = true ]; then
|
||||
echo ""
|
||||
echo "=== Git Diff: Local Changes vs Upstream ==="
|
||||
echo ""
|
||||
git diff HEAD "$UPSTREAM_BRANCH"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# In project mode, check for uncommitted changes outside ./rsx
|
||||
if [ "$IS_PROJECT_MODE" = true ]; then
|
||||
# Get uncommitted changes (modified, staged, deleted) excluding ./rsx
|
||||
@@ -175,7 +193,23 @@ if [ "$IS_PROJECT_MODE" = true ]; then
|
||||
echo ""
|
||||
echo "OPTIONS:"
|
||||
echo ""
|
||||
echo " 1️⃣ DISCARD FRAMEWORK CHANGES (recommended)"
|
||||
echo " 1. VIEW DIFFERENCES"
|
||||
echo " See what changed between your local files and upstream:"
|
||||
echo ""
|
||||
echo " php artisan rsx:framework:pull --diff"
|
||||
echo ""
|
||||
echo " 2. STASH CHANGES AND UPDATE (recommended)"
|
||||
echo " Your changes will be stashed automatically, then the framework"
|
||||
echo " will be updated. You can review or restore the stashed changes after:"
|
||||
echo ""
|
||||
echo " php artisan rsx:framework:pull --stash"
|
||||
echo ""
|
||||
echo " After update, review your stashed changes:"
|
||||
echo " git stash list"
|
||||
echo " git stash show"
|
||||
echo " git stash pop (to restore)"
|
||||
echo ""
|
||||
echo " 3. DISCARD FRAMEWORK CHANGES"
|
||||
echo " If these were accidental edits, reset them:"
|
||||
echo ""
|
||||
echo " git checkout HEAD -- [file paths]"
|
||||
@@ -183,25 +217,14 @@ if [ "$IS_PROJECT_MODE" = true ]; then
|
||||
echo " Or reset all framework changes:"
|
||||
echo " git checkout HEAD -- . ':!rsx'"
|
||||
echo ""
|
||||
echo " 2️⃣ STASH CHANGES AND UPDATE"
|
||||
echo " Your changes will be stashed automatically, then the framework"
|
||||
echo " will be updated. You can review or restore the stashed changes after:"
|
||||
echo ""
|
||||
echo " php artisan rsx:framework:pull --stash-changes"
|
||||
echo ""
|
||||
echo " After update, review your stashed changes:"
|
||||
echo " git stash list"
|
||||
echo " git stash show"
|
||||
echo " git stash pop (to restore)"
|
||||
echo ""
|
||||
echo " 3️⃣ COMMIT THEN UPDATE (framework developers only)"
|
||||
echo " 4. COMMIT THEN UPDATE (framework developers only)"
|
||||
echo " If you're intentionally modifying the framework:"
|
||||
echo ""
|
||||
echo " git add -A"
|
||||
echo " git commit -m \"Framework modifications\""
|
||||
echo " php artisan rsx:framework:pull"
|
||||
echo ""
|
||||
echo " 4️⃣ FORK THE FRAMEWORK"
|
||||
echo " 5. FORK THE FRAMEWORK"
|
||||
echo " If you need to preserve framework modifications permanently:"
|
||||
echo ""
|
||||
echo " php artisan rsx:man framework_fork"
|
||||
@@ -223,7 +246,7 @@ if [ "$IS_PROJECT_MODE" = true ]; then
|
||||
echo " or stash them and proceed with the update?'"
|
||||
echo ""
|
||||
echo "You MUST NOT proceed until the developer has made a decision."
|
||||
echo "You MUST NOT automatically use --stash-changes without explicit permission."
|
||||
echo "You MUST NOT automatically use --stash without explicit permission."
|
||||
echo ""
|
||||
echo "════════════════════════════════════════════════════════════════════════════════"
|
||||
exit 1
|
||||
@@ -232,7 +255,7 @@ if [ "$IS_PROJECT_MODE" = true ]; then
|
||||
echo ""
|
||||
echo "⚠️ Stashing uncommitted framework changes..."
|
||||
echo ""
|
||||
STASH_MESSAGE="Auto-stashed by framework update with --stash-changes on $(date '+%Y-%m-%d %H:%M:%S')"
|
||||
STASH_MESSAGE="Auto-stashed by framework update with --stash on $(date '+%Y-%m-%d %H:%M:%S')"
|
||||
|
||||
if ! git stash push -u -m "$STASH_MESSAGE" -- . ":(exclude)rsx" 2>&1; then
|
||||
echo "ERROR: Failed to stash changes"
|
||||
@@ -250,6 +273,84 @@ if [ "$IS_PROJECT_MODE" = true ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# In framework mode, check for uncommitted changes
|
||||
if [ "$IS_PROJECT_MODE" = false ]; then
|
||||
# Get uncommitted changes (modified, staged, deleted)
|
||||
UNCOMMITTED_CHANGES=$(git diff --name-only 2>&1)
|
||||
STAGED_CHANGES=$(git diff --cached --name-only 2>&1)
|
||||
|
||||
# Combine and deduplicate (|| true prevents grep exit code 1 from killing script)
|
||||
ALL_CHANGES=$(echo -e "${UNCOMMITTED_CHANGES}\n${STAGED_CHANGES}" | sort -u | grep -v "^$" || true)
|
||||
|
||||
if [ -n "$ALL_CHANGES" ]; then
|
||||
if [ "$STASH_CHANGES" = false ]; then
|
||||
echo ""
|
||||
echo "════════════════════════════════════════════════════════════════════════════════"
|
||||
echo "❌ ERROR: Uncommitted changes detected"
|
||||
echo "════════════════════════════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
echo "You are in FRAMEWORK MODE where this repository is the framework itself."
|
||||
echo "The following files have uncommitted changes:"
|
||||
echo ""
|
||||
echo "$ALL_CHANGES" | sed 's/^/ /'
|
||||
echo ""
|
||||
echo "These changes must be resolved before updating the framework."
|
||||
echo ""
|
||||
echo "OPTIONS:"
|
||||
echo ""
|
||||
echo " 1. VIEW DIFFERENCES"
|
||||
echo " See what changed between your local files and upstream:"
|
||||
echo ""
|
||||
echo " php artisan rsx:framework:pull --diff"
|
||||
echo ""
|
||||
echo " 2. STASH CHANGES AND UPDATE (recommended)"
|
||||
echo " Your changes will be stashed automatically, then the framework"
|
||||
echo " will be updated. You can review or restore the stashed changes after:"
|
||||
echo ""
|
||||
echo " php artisan rsx:framework:pull --stash"
|
||||
echo ""
|
||||
echo " After update, review your stashed changes:"
|
||||
echo " git stash list"
|
||||
echo " git stash show"
|
||||
echo " git stash pop (to restore)"
|
||||
echo ""
|
||||
echo " 3. DISCARD CHANGES"
|
||||
echo " If these were accidental edits, reset them:"
|
||||
echo ""
|
||||
echo " git reset --hard HEAD"
|
||||
echo ""
|
||||
echo " 4. COMMIT THEN UPDATE"
|
||||
echo " If you're intentionally modifying the framework:"
|
||||
echo ""
|
||||
echo " git add -A"
|
||||
echo " git commit -m \"Framework modifications\""
|
||||
echo " php artisan rsx:framework:pull"
|
||||
echo ""
|
||||
echo "════════════════════════════════════════════════════════════════════════════════"
|
||||
exit 1
|
||||
else
|
||||
# Stash changes with descriptive message
|
||||
echo ""
|
||||
echo "⚠️ Stashing uncommitted changes..."
|
||||
echo ""
|
||||
STASH_MESSAGE="Auto-stashed by framework update with --stash on $(date '+%Y-%m-%d %H:%M:%S')"
|
||||
|
||||
if ! git stash push -u -m "$STASH_MESSAGE" 2>&1; then
|
||||
echo "ERROR: Failed to stash changes"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo " ✓ Changes stashed"
|
||||
echo ""
|
||||
echo "Your changes have been saved. After update completes, you can review them:"
|
||||
echo " git stash list"
|
||||
echo " git stash show"
|
||||
echo " git stash pop (to restore changes)"
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Extract and display changelog
|
||||
echo ""
|
||||
echo "⚠ RSpade framework has upstream changes"
|
||||
@@ -325,10 +426,24 @@ else
|
||||
echo ""
|
||||
fi
|
||||
|
||||
echo "To resolve, either:"
|
||||
echo " 1. Commit your changes and try again"
|
||||
echo " 2. Discard modifications: git reset --hard $UPSTREAM_BRANCH"
|
||||
echo " 3. Check status: php artisan rsx:framework:status"
|
||||
echo "To resolve:"
|
||||
echo ""
|
||||
echo " 1. VIEW DIFFERENCES"
|
||||
echo " php artisan rsx:framework:pull --diff"
|
||||
echo ""
|
||||
echo " 2. STASH CHANGES AND UPDATE (recommended)"
|
||||
echo " php artisan rsx:framework:pull --stash"
|
||||
echo ""
|
||||
echo " 3. DISCARD MODIFICATIONS"
|
||||
echo " git reset --hard $UPSTREAM_BRANCH"
|
||||
echo ""
|
||||
echo " 4. COMMIT THEN UPDATE"
|
||||
echo " git add -A"
|
||||
echo " git commit -m \"Framework modifications\""
|
||||
echo " php artisan rsx:framework:pull"
|
||||
echo ""
|
||||
echo " 5. CHECK STATUS"
|
||||
echo " php artisan rsx:framework:status"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
@@ -368,7 +483,7 @@ else
|
||||
echo ""
|
||||
|
||||
# Step 1: Clean caches
|
||||
echo "Step 1/3: Cleaning caches..."
|
||||
echo "Step 1/4: Cleaning caches..."
|
||||
if ! php artisan rsx:clean; then
|
||||
echo "ERROR: Cache clean failed"
|
||||
exit 1
|
||||
@@ -377,7 +492,7 @@ else
|
||||
echo ""
|
||||
|
||||
# Step 2: Rebuild manifest
|
||||
echo "Step 2/3: Rebuilding manifest..."
|
||||
echo "Step 2/4: Rebuilding manifest..."
|
||||
if ! php artisan rsx:manifest:build; then
|
||||
echo "ERROR: Manifest rebuild failed"
|
||||
echo " Run manually: php artisan rsx:manifest:build"
|
||||
@@ -387,7 +502,7 @@ else
|
||||
echo ""
|
||||
|
||||
# Step 3: Compile bundles
|
||||
echo "Step 3/3: Compiling all bundles..."
|
||||
echo "Step 3/4: Compiling all bundles..."
|
||||
if ! php artisan rsx:bundle:compile; then
|
||||
echo "ERROR: Bundle compilation failed"
|
||||
echo " Check errors above and fix bundle issues"
|
||||
@@ -395,6 +510,16 @@ else
|
||||
fi
|
||||
echo " ✓ All bundles compiled"
|
||||
echo ""
|
||||
|
||||
# Step 4: Run framework migrations
|
||||
echo "Step 4/4: Running framework migrations..."
|
||||
if ! php artisan migrate --framework-only --force; then
|
||||
echo "ERROR: Framework migrations failed"
|
||||
echo " Check errors above and fix migration issues"
|
||||
exit 1
|
||||
fi
|
||||
echo " ✓ Framework migrations completed"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Set read-only attribute on CLAUDE.dist.md after successful update
|
||||
|
||||
Reference in New Issue
Block a user