From 3797ed32deeff82ecd4fc2ac448a8a1abcaa62c0 Mon Sep 17 00:00:00 2001 From: Noah Brier Date: Wed, 17 Sep 2025 18:42:25 -0400 Subject: [PATCH 1/4] fix: upgrade command to prevent interactive prompts and auto-selection - Replace cp/cp -f with cat > for guaranteed non-interactive file replacement - Add explicit instruction to WAIT for user input (don't auto-select option 1) - Clarify that cp -f still causes prompts on some systems - Ensures upgrade process doesn't hang on file overwrites --- .claude/commands/upgrade.md | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/.claude/commands/upgrade.md b/.claude/commands/upgrade.md index 022c0b8..e0c11f0 100644 --- a/.claude/commands/upgrade.md +++ b/.claude/commands/upgrade.md @@ -76,10 +76,13 @@ capabilities. **⚠️ CRITICAL IMPLEMENTATION REQUIREMENT:** -- **NEVER blindly overwrite files with `cat > file` or `cp`** +- **NEVER blindly overwrite files without showing diffs first** - **ALWAYS show diffs to the user first** - **ALWAYS ask for confirmation before replacing files** - **Skipping these steps can lose user customizations!** +- **NEVER use `cp` or `cp -f` (both can cause prompts on protected files)** +- **ALWAYS USE `cat source > dest` for guaranteed non-interactive replacement** +- **WAIT for actual user input - don't automatically choose option 1** For EACH file in the checklist: @@ -103,10 +106,26 @@ For EACH file in the checklist: 3. View diff and decide 4. Try to merge both (AI-assisted) - Choice (1/2/3/4): _ + Choice (1/2/3/4): [WAIT FOR USER TO TYPE NUMBER AND PRESS ENTER] ``` -4. Apply the chosen strategy + **IMPORTANT**: Actually WAIT for the user to type their choice! + Do NOT automatically select any option. The user must manually + type 1, 2, 3, or 4 and press Enter. + +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 + ``` + - **For option 2 (Keep your version)**: + ```bash + echo "✅ Kept your version" + ``` + - **For option 4 (AI merge)**: Read both files and create merged version 5. **CRITICAL: Update the checklist file immediately**: ```markdown [ ] .claude/commands/init-bootstrap.md → becomes → [x] From 3f9cfb3cf40f09afca8d31b051df21ca3287866e Mon Sep 17 00:00:00 2001 From: Noah Brier Date: Wed, 17 Sep 2025 18:43:38 -0400 Subject: [PATCH 2/4] fix: improve upgrade command with explicit backup steps and non-interactive file replacement --- .claude/commands/upgrade.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.claude/commands/upgrade.md b/.claude/commands/upgrade.md index e0c11f0..eb36831 100644 --- a/.claude/commands/upgrade.md +++ b/.claude/commands/upgrade.md @@ -29,7 +29,21 @@ capabilities. ### 1. **Version Check & Setup** - Get current version from package.json -- Create timestamped backup in `.backup/upgrade-YYYY-MM-DD-HHMMSS/` +- Create timestamped backup in `.backup/upgrade-YYYY-MM-DD-HHMMSS/`: + ```bash + # Create backup directory + BACKUP_DIR=".backup/upgrade-$(date +%Y-%m-%d-%H%M%S)" + mkdir -p "$BACKUP_DIR" + + # Copy all important files to backup + cp -r .claude "$BACKUP_DIR/" + cp -r .scripts "$BACKUP_DIR/" + cp package.json "$BACKUP_DIR/" + cp CHANGELOG.md "$BACKUP_DIR/" 2>/dev/null || true + cp README.md "$BACKUP_DIR/" 2>/dev/null || true + + echo "✅ Backup created in $BACKUP_DIR" + ``` - Clone latest claudesidian to temp directory (doesn't affect user's repo): ```bash # Get fresh copy in .tmp dir (hidden from Obsidian) - user's repo stays disconnected From 3ebe784df001d8bbd4c11e0d9a56629aa00bd95c Mon Sep 17 00:00:00 2001 From: Noah Brier Date: Wed, 17 Sep 2025 18:50:13 -0400 Subject: [PATCH 3/4] 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 --- .claude/commands/upgrade.md | 51 +++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/.claude/commands/upgrade.md b/.claude/commands/upgrade.md index eb36831..9093e52 100644 --- a/.claude/commands/upgrade.md +++ b/.claude/commands/upgrade.md @@ -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 From 8223db7c669d354b1c76c2194fef6c4c327271a0 Mon Sep 17 00:00:00 2001 From: Noah Brier Date: Thu, 18 Sep 2025 06:20:13 -0400 Subject: [PATCH 4/4] chore: apply linting fixes to upgrade command and changelog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .claude/commands/upgrade.md | 16 +++++++++++++--- CHANGELOG.md | 6 ++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.claude/commands/upgrade.md b/.claude/commands/upgrade.md index 9093e52..435e6c8 100644 --- a/.claude/commands/upgrade.md +++ b/.claude/commands/upgrade.md @@ -30,6 +30,7 @@ capabilities. - 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/') @@ -39,7 +40,9 @@ capabilities. exit 0 fi ``` + - Create timestamped backup in `.backup/upgrade-YYYY-MM-DD-HHMMSS/`: + ```bash # Create backup directory BACKUP_DIR=".backup/upgrade-$(date +%Y-%m-%d-%H%M%S)" @@ -54,6 +57,7 @@ capabilities. echo "✅ Backup created in $BACKUP_DIR" ``` + - Clone latest claudesidian to temp directory (doesn't affect user's repo): ```bash # Get fresh copy in .tmp dir (hidden from Obsidian) - user's repo stays disconnected @@ -64,6 +68,7 @@ capabilities. ### 2. **Create Upgrade Checklist** - Compare system files between current directory and .tmp/claudesidian-upgrade/: + ```bash # Find all system files that differ AND new files in upstream # First, find files that exist in both but differ @@ -77,6 +82,7 @@ capabilities. [ ! -f "$local_file" ] && echo "NEW: $local_file" done ``` + - Create checklist of files that need review - Explicitly EXCLUDE: - User content folders (00_Inbox, 01_Projects, etc.) @@ -140,9 +146,9 @@ For EACH file in the checklist: Choice (1/2/3/4): [WAIT FOR USER TO TYPE NUMBER AND PRESS ENTER] ``` - **IMPORTANT**: Actually WAIT for the user to type their choice! - Do NOT automatically select any option. The user must manually - type 1, 2, 3, or 4 and press Enter. + **IMPORTANT**: Actually WAIT for the user to type their choice! Do NOT + automatically select any option. The user must manually type 1, 2, 3, or 4 + and press Enter. 4. Apply the chosen strategy: - **For option 1 (Apply update/Take upstream)**: @@ -175,7 +181,9 @@ For EACH file in the checklist: - **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 @@ -187,7 +195,9 @@ 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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 13be7dc..c591929 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,8 +12,10 @@ and this project adheres to ### Added -- New `/download-attachment` command for downloading web content and files to Obsidian attachments folder -- New `/pull-request` command for creating PRs with intelligent change analysis and description generation +- New `/download-attachment` command for downloading web content and files to + Obsidian attachments folder +- New `/pull-request` command for creating PRs with intelligent change analysis + and description generation - Both commands integrate seamlessly with Obsidian's vault structure ### Fixed