Skip to content

freyjay/claude-code-command-fix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔧 Claude Code Command Fix

GitHub Issues Community Solution Temporary Fix

⚠️ TEMPORARY FIX - This tool will be unnecessary once Anthropic fixes the copy-paste issue in Claude Code.

Featured: Community solution for Claude Code Issue #4686 - helping 100+ developers resolve copy-paste formatting problems.

🚨 Problem

Claude Code has a formatting bug where long terminal commands get line-wrapped when copied from code blocks, causing them to fail when pasted into Terminal.

GitHub Issue: #4686 - Copy-paste from Claude Code introduces extra spaces/characters in code blocks

Example of the Problem:

❌ What you get when copying from Claude Code:

sudo launchctl unload
  /System/Library/LaunchDaemons/com.apple.backupd-auto.plist && sudo
  launchctl load /System/Library/LaunchDaemons/com.apple.backupd-auto.plist

✅ What you need (single line):

sudo launchctl unload /System/Library/LaunchDaemons/com.apple.backupd-auto.plist && sudo launchctl load /System/Library/LaunchDaemons/com.apple.backupd-auto.plist

🛠️ Solution

This tool fixes the formatting issues and copies the corrected command to your clipboard.

📦 Installation

Option 1: Install from GitHub (Recommended)

pip install git+https://github.com/your-username/claude-code-command-fix.git

Option 2: Install locally

git clone https://github.com/your-username/claude-code-command-fix.git
cd claude-code-command-fix
pip install -e .

Option 3: Download and run directly

curl -O https://raw.githubusercontent.com/your-username/claude-code-command-fix/main/claude_code_fix/formatter.py
python3 formatter.py

🚀 Usage

After installation, you have several options:

Command Line Usage

Short command:

claude-fix "your broken command here"

Alternative command:

claude-command-fix "your broken command here"

Interactive Mode

claude-fix

Then paste your broken command and press Enter twice.

Example Usage

# Fix a broken command
claude-fix "sudo launchctl unload
  /System/Library/LaunchDaemons/com.apple.backupd-auto.plist && sudo
  launchctl load /System/Library/LaunchDaemons/com.apple.backupd-auto.plist"

Output:

============================================================
🔧 CLAUDE CODE COMMAND FIX - FORMATTED RESULT:
============================================================
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.backupd-auto.plist && sudo launchctl load /System/Library/LaunchDaemons/com.apple.backupd-auto.plist
============================================================
✅ Your code is in the clipboard and you may paste it

⚠️  TEMPORARY FIX: This tool will be unnecessary once
   Anthropic fixes the copy-paste issue in Claude Code
   GitHub Issue: https://github.com/anthropics/claude-code/issues/4686

🔧 What It Fixes

  • ✅ Removes unwanted line breaks
  • ✅ Fixes extra whitespace and indentation
  • ✅ Preserves proper operator spacing (&&, |, ;)
  • ✅ Copies corrected command to clipboard automatically
  • ✅ Works on macOS (pbcopy) and Linux (xclip)

🗑️ When to Uninstall

Delete this package when:

  • Anthropic releases a fix for the copy-paste issue
  • Claude Code adds a "Copy" button to code blocks
  • The formatting issue is resolved in a future update
pip uninstall claude-code-command-fix

🐛 Related Issues

  • Primary Issue: Claude Code #4686 - Copy-paste formatting problems
  • Impact: Critical configurations fail silently, causing difficult-to-debug errors
  • Affects: Terminal commands, connection strings, configuration files

🤝 Contributing

This is a temporary community fix. Once Anthropic resolves the underlying issue, this repository will be archived.

If you want to help:

  1. Test the tool with different command types
  2. Report bugs or edge cases
  3. Improve cross-platform clipboard support

📄 License

MIT License - See LICENSE file for details.

⚡ Quick Start

# Install
pip install git+https://github.com/your-username/claude-code-command-fix.git

# Use
claude-fix "your broken command"

# Uninstall when Claude Code is fixed
pip uninstall claude-code-command-fix

🎯 Remember: This is a temporary workaround. The real solution is for Anthropic to fix the copy-paste formatting in Claude Code itself.

📞 Support: If Claude Code is fixed and this tool is no longer needed, please create an issue to let others know!

About

TEMPORARY FIX: Format terminal commands copied from Claude Code that get mangled with line breaks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages