fix: improve upgrade command based on real usage feedback

- Add check for files that exist in upstream before updating
- Add version comparison to avoid unnecessary upgrades
- Add batch update examples for similar files
- Better handling of missing upstream files (like deprecated agents)
- Include instructions for finding NEW files in upstream
- Clearer error messages when files don't exist
This commit is contained in:
Noah Brier
2025-09-17 18:50:13 -04:00
parent 3f9cfb3cf4
commit 3ebe784df0
+46 -5
View File
@@ -29,6 +29,16 @@ capabilities.
### 1. **Version Check & Setup**
- Get current version from package.json
- Check if already on latest version:
```bash
CURRENT=$(grep '"version"' package.json | sed 's/.*: "\(.*\)".*/\1/')
LATEST=$(curl -s https://raw.githubusercontent.com/heyitsnoah/claudesidian/main/package.json | grep '"version"' | sed 's/.*: "\(.*\)".*/\1/')
if [ "$CURRENT" = "$LATEST" ]; then
echo "✅ You're already on the latest version ($CURRENT)"
exit 0
fi
```
- Create timestamped backup in `.backup/upgrade-YYYY-MM-DD-HHMMSS/`:
```bash
# Create backup directory
@@ -55,10 +65,17 @@ capabilities.
- Compare system files between current directory and .tmp/claudesidian-upgrade/:
```bash
# Find all system files that differ
# Find all system files that differ AND new files in upstream
# First, find files that exist in both but differ
diff -qr . .tmp/claudesidian-upgrade/ --include="*.md" --include="*.sh" --include="*.json" |
grep -E '(\.claude/|\.scripts/|package\.json|CHANGELOG\.md|README\.md)' |
grep -v '(00_|01_|02_|03_|04_|05_|06_|\.obsidian|CLAUDE\.md)'
# Also find NEW files in upstream (like new commands)
find .tmp/claudesidian-upgrade/.claude/commands -name "*.md" | while read f; do
local_file=${f#.tmp/claudesidian-upgrade/}
[ ! -f "$local_file" ] && echo "NEW: $local_file"
done
```
- Create checklist of files that need review
- Explicitly EXCLUDE:
@@ -130,10 +147,12 @@ For EACH file in the checklist:
4. Apply the chosen strategy:
- **For option 1 (Apply update/Take upstream)**:
```bash
# IMPORTANT: Use cat with redirection to avoid ALL prompts
# Do NOT use cp or cp -f as they may still prompt on some systems
cat .tmp/claudesidian-upgrade/path/to/file > path/to/file && echo "✅ Updated"
# Alternative if needed: rm -f path/to/file && cat .tmp/claudesidian-upgrade/path/to/file > path/to/file
# IMPORTANT: Check if file exists first, then use cat with redirection
if [ -f ".tmp/claudesidian-upgrade/path/to/file" ]; then
cat .tmp/claudesidian-upgrade/path/to/file > path/to/file && echo "✅ Updated"
else
echo "⚠️ File not found in upstream - keeping local version"
fi
```
- **For option 2 (Keep your version)**:
```bash
@@ -155,6 +174,28 @@ For EACH file in the checklist:
- **Needs review**: `package.json` (preserve user's custom scripts)
- **Never touch**: User content folders, CLAUDE.md, API configs
#### Batch Updates for Similar Files
For commands that have only formatting changes, you can batch update:
```bash
# Batch update multiple command files with same type of changes
for file in thinking-partner.md daily-review.md inbox-processor.md; do
if [ -f ".tmp/claudesidian-upgrade/.claude/commands/$file" ]; then
cat ".tmp/claudesidian-upgrade/.claude/commands/$file" > ".claude/commands/$file"
echo "✅ Updated $file"
fi
done
```
#### Handling Missing Upstream Files
Some files may exist locally but not in upstream (like deprecated agents):
```bash
# Check if file exists in upstream before trying to update
if [ ! -f ".tmp/claudesidian-upgrade/$filepath" ]; then
echo "⚠️ $filepath not in upstream - keeping local version"
# Mark as skipped in checklist: [-]
fi
```
### 5. **Progress Tracking**
- Use TodoWrite tool to track progress alongside the checklist