Files
claude-hub/debug-file-copy.sh
Jonathan a71cdcad40 feat: implement rock-solid Claude Max subscription authentication
This comprehensive update adds support for Claude Max subscription authentication
and improves the overall authentication system with multiple methods:

🔐 Claude Authentication Enhancements:
- Add setup container method for Claude Max/20x subscription usage ($20-200/month)
- Create interactive authentication script (setup-claude-interactive.sh)
- Add authentication testing utility (test-claude-auth.sh)
- Support three authentication methods: Setup Container, API Key, AWS Bedrock
- Comprehensive authentication documentation

📁 Directory Configuration:
- Add CLAUDE_HUB_DIR environment variable (default: ~/.claude-hub)
- Update .gitignore to use .claude-hub/ instead of hardcoded paths
- Consistent environment variable usage across all scripts

🐙 GitHub Token Support:
- Add fine-grained GitHub token support (github_pat_) alongside classic tokens (ghp_)
- Update token validation in claudeService and githubService
- Enhanced token detection and authentication flow

📖 Documentation & Guides:
- Add complete Claude Authentication Guide with all three methods
- Add Setup Container Deep Dive documentation
- Update CLAUDE.md with quick start authentication section
- Comprehensive cost comparison and use case recommendations

🐳 Container & Docker Improvements:
- Update Dockerfile.claudecode with proper entrypoint script copying
- Add Dockerfile.claude-setup for interactive authentication
- Update docker-compose.yml with new port (3003) and environment variables
- Enhanced container volume mounting for authentication

🔧 Infrastructure Updates:
- Add TRUST_PROXY configuration for reverse proxy environments
- Update port configuration from 3002 to 3003
- Enhanced environment variable documentation in .env.example
- Debug utilities for troubleshooting authentication issues

This update enables Claude Max subscribers to use their existing subscriptions
for automation, potentially saving thousands in API costs while maintaining
full production capabilities.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-31 10:22:16 -05:00

77 lines
2.9 KiB
Bash
Executable File

#!/bin/bash
set -e
echo "=== Debugging Claude Auth File Copying ==="
# Test the exact same logic as the entrypoint scripts
SOURCE_DIR="/home/node/.claude"
DEST_DIR="/workspace/.claude"
echo "1. Checking source directory..."
if [ -d "$SOURCE_DIR" ]; then
echo "✓ Source directory exists: $SOURCE_DIR"
echo "Source contents:"
ls -la "$SOURCE_DIR/" || echo "ERROR: Cannot list source directory"
echo "Checking .credentials.json specifically:"
if [ -f "$SOURCE_DIR/.credentials.json" ]; then
echo "✓ .credentials.json exists in source"
echo "Size: $(stat -c%s "$SOURCE_DIR/.credentials.json" 2>/dev/null || echo 'unknown') bytes"
echo "Permissions: $(stat -c%a "$SOURCE_DIR/.credentials.json" 2>/dev/null || echo 'unknown')"
else
echo "✗ .credentials.json NOT found in source"
fi
else
echo "✗ Source directory does not exist: $SOURCE_DIR"
exit 1
fi
echo -e "\n2. Creating destination directory..."
mkdir -p "$DEST_DIR"
echo "✓ Destination directory created: $DEST_DIR"
echo -e "\n3. Testing rsync copy..."
if command -v rsync >/dev/null 2>&1; then
echo "Using rsync for copy..."
rsync -av "$SOURCE_DIR/" "$DEST_DIR/" || echo "ERROR: rsync failed"
else
echo "rsync not available, using cp..."
cp -r "$SOURCE_DIR"/* "$DEST_DIR/" 2>/dev/null || true
cp -r "$SOURCE_DIR"/.* "$DEST_DIR/" 2>/dev/null || true
fi
echo -e "\n4. Checking destination after copy..."
if [ -d "$DEST_DIR" ]; then
echo "✓ Destination directory exists after copy"
echo "Destination contents:"
ls -la "$DEST_DIR/" || echo "ERROR: Cannot list destination directory"
echo "Checking .credentials.json in destination:"
if [ -f "$DEST_DIR/.credentials.json" ]; then
echo "✓ .credentials.json successfully copied"
echo "Size: $(stat -c%s "$DEST_DIR/.credentials.json" 2>/dev/null || echo 'unknown') bytes"
echo "Permissions: $(stat -c%a "$DEST_DIR/.credentials.json" 2>/dev/null || echo 'unknown')"
echo "First 100 chars of content:"
head -c 100 "$DEST_DIR/.credentials.json" 2>/dev/null || echo "ERROR: Cannot read file"
else
echo "✗ .credentials.json NOT copied to destination"
fi
else
echo "✗ Destination directory does not exist after copy"
fi
echo -e "\n5. Setting permissions..."
chown -R node:node "$DEST_DIR" 2>/dev/null || echo "WARNING: Cannot change ownership"
chmod 600 "$DEST_DIR/.credentials.json" 2>/dev/null || echo "WARNING: Cannot change file permissions"
chmod 755 "$DEST_DIR" 2>/dev/null || echo "WARNING: Cannot change directory permissions"
echo -e "\n6. Final verification..."
if [ -f "$DEST_DIR/.credentials.json" ]; then
echo "✓ Final check: .credentials.json exists and is accessible"
echo "Final permissions: $(stat -c%a "$DEST_DIR/.credentials.json" 2>/dev/null || echo 'unknown')"
echo "Owner: $(stat -c%U:%G "$DEST_DIR/.credentials.json" 2>/dev/null || echo 'unknown')"
else
echo "✗ Final check: .credentials.json still missing"
fi
echo -e "\n=== Debug Complete ==="