Текущая версия ClaudePing содержит hardcoded пути и привязки к конкретному Mac, что делает невозможной установку на других машинах без ручного редактирования кода.
1. Hardcoded путь к Claude CLI:
# В ping_claude.sh и test_ping.sh
/Users/aleksandrilinskii/.bun/bin/claude- Привязан к конкретному пользователю
- Предполагает установку через bun
- Не будет работать на других Mac
2. Hardcoded путь к проекту:
# В различных plist файлах
/Users/aleksandrilinskii/Projects/Mac_scripts/ping_claude.sh- Абсолютный путь к конкретной директории
- Не адаптируется к другим установкам
3. Различные способы установки Claude:
- Через bun:
~/.bun/bin/claude - Через npm:
/usr/local/bin/claudeили~/.npm/bin/claude - Через Homebrew:
/opt/homebrew/bin/claude - Системная установка:
/usr/local/bin/claude
4. PATH проблемы в launchd:
export PATH="/usr/local/bin:/usr/bin:/bin:$PATH"- Может не включать все возможные пути установки Claude
- Различается между Intel и Apple Silicon Mac
Текущий код:
RESPONSE=$(echo "ping" | /Users/aleksandrilinskii/.bun/bin/claude -p "..." 2>&1)Нужно заменить на:
detect_claude() {
# Попробовать найти claude в различных локациях
local claude_locations=(
"$(which claude 2>/dev/null)"
"$HOME/.bun/bin/claude"
"$HOME/.npm/bin/claude"
"/usr/local/bin/claude"
"/opt/homebrew/bin/claude"
"/usr/bin/claude"
)
for location in "${claude_locations[@]}"; do
if [ -n "$location" ] && [ -x "$location" ]; then
echo "$location"
return 0
fi
done
return 1
}
CLAUDE_PATH=$(detect_claude)
if [ -z "$CLAUDE_PATH" ]; then
echo "Error: Claude CLI not found. Please install Claude Code first."
echo "Visit: https://docs.anthropic.com/claude-code"
exit 1
fi
RESPONSE=$(echo "ping" | "$CLAUDE_PATH" -p "..." 2>&1)Текущий generate_schedule.sh создает:
<string>/Users/aleksandrilinskii/Projects/Mac_scripts/ping_claude.sh</string>Нужно заменить на:
# В generate_schedule.sh
PING_SCRIPT="$SCRIPT_DIR/ping_claude.sh"
cat > "$PLIST_FILE" << EOF
<string>$PING_SCRIPT</string>
EOFРасширить PATH для поддержки различных установок:
# Универсальный PATH для Intel и Apple Silicon Mac
export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:$HOME/.bun/bin:$HOME/.npm/bin:$PATH"Добавить в install.sh:
check_dependencies() {
echo "🔍 Checking dependencies..."
# Проверить Claude CLI
if ! detect_claude >/dev/null; then
echo "❌ Claude CLI not found"
echo "Please install Claude Code first:"
echo "https://docs.anthropic.com/claude-code"
exit 1
fi
echo "✅ Claude CLI found at: $(detect_claude)"
# Проверить jq
if ! command -v jq >/dev/null 2>&1; then
echo "📦 Installing jq..."
if command -v brew >/dev/null 2>&1; then
brew install jq
else
echo "❌ jq required but Homebrew not found"
echo "Please install Homebrew first: https://brew.sh"
exit 1
fi
fi
echo "✅ jq available"
# Проверить dialog
if ! command -v dialog >/dev/null 2>&1; then
echo "📦 Installing dialog..."
if command -v brew >/dev/null 2>&1; then
brew install dialog
else
echo "⚠️ dialog not found, will use basic interface"
fi
fi
# Проверить права sudo для pmset
echo "🔐 Checking sudo access for power management..."
if ! sudo -n pmset -g >/dev/null 2>&1; then
echo "⚠️ Sudo access needed for Mac wake scheduling"
echo "You will be prompted for password during setup"
fi
}Создать quick-install.sh:
#!/bin/bash
# Quick installer for ClaudePing
set -e
REPO_URL="https://github.com/Amico1285/mac_scripts"
INSTALL_DIR="$HOME/ClaudePing"
echo "🚀 Installing ClaudePing..."
# Download and extract
if command -v git >/dev/null 2>&1; then
git clone "$REPO_URL" "$INSTALL_DIR"
else
curl -fsSL "$REPO_URL/archive/main.tar.gz" | tar -xz -C "$HOME"
mv "$HOME/mac_scripts-main" "$INSTALL_DIR"
fi
cd "$INSTALL_DIR"
# Run installation
./install.sh
./install_global.sh
echo "✅ ClaudePing installed successfully!"
echo "Run 'claudeping' to get started."Использование:
bash <(curl -fsSL https://raw.githubusercontent.com/Amico1285/mac_scripts/main/quick-install.sh)Создать Formula/claudeping.rb:
class Claudeping < Formula
desc "Automated Claude Code session maintenance system"
homepage "https://github.com/Amico1285/mac_scripts"
url "https://github.com/Amico1285/mac_scripts/archive/refs/tags/v1.0.0.tar.gz"
sha256 "..."
license "MIT"
depends_on "jq"
depends_on "dialog"
def install
# Install scripts
bin.install "claudeping"
prefix.install Dir["*.sh"]
prefix.install "config.json"
# Create wrapper script that handles paths
(bin/"claudeping").write <<~EOS
#!/bin/bash
export CLAUDEPING_HOME="#{prefix}"
exec "#{prefix}/claudeping" "$@"
EOS
end
def post_install
puts "Run 'claudeping-setup' to configure the system"
end
endУстановка:
brew tap username/claudeping
brew install claudeping
claudeping-setupСтруктура:
ClaudePing.app/
├── Contents/
│ ├── Info.plist
│ ├── MacOS/
│ │ └── claudeping-launcher
│ ├── Resources/
│ │ ├── scripts/
│ │ │ ├── ping_claude.sh
│ │ │ ├── install.sh
│ │ │ └── ...
│ │ └── icon.icns
│ └── SharedSupport/
│ └── config.json
Преимущества:
- Простая установка через drag&drop
- Автономная установка
- Интегрированный GUI
- Автоматическая настройка
Создать build script:
#!/bin/bash
# build.sh - Create distributable package
VERSION="1.0.0"
BUILD_DIR="build/claudeping-$VERSION"
mkdir -p "$BUILD_DIR"
# Copy files and make them portable
cp *.sh *.json claudeping "$BUILD_DIR/"
# Create portable installer
cat > "$BUILD_DIR/install.sh" << 'EOF'
#!/bin/bash
# Portable installer with auto-detection
EOF
# Package
tar -czf "claudeping-$VERSION-macos.tar.gz" -C build "claudeping-$VERSION"setup_wizard() {
clear
echo "╔══════════════════════════════════════╗"
echo "║ ClaudePing Setup ║"
echo "╚══════════════════════════════════════╝"
echo ""
# 1. Проверить Claude
echo "🔍 Detecting Claude CLI..."
CLAUDE_PATH=$(detect_claude)
if [ -n "$CLAUDE_PATH" ]; then
echo "✅ Found Claude at: $CLAUDE_PATH"
else
echo "❌ Claude CLI not found"
echo ""
echo "Please install Claude Code first:"
echo "https://docs.anthropic.com/claude-code"
echo ""
read -p "Press Enter after installing Claude..."
CLAUDE_PATH=$(detect_claude)
if [ -z "$CLAUDE_PATH" ]; then
echo "Still not found. Exiting."
exit 1
fi
fi
# 2. Выбрать время старта
echo ""
echo "⏰ Choose start time for first ping:"
echo "Current time: $(date '+%H:%M')"
echo ""
echo "Recommended hours:"
echo " 5 - Early morning (05:00, 10:01, 15:02, 20:03)"
echo " 7 - Morning (07:00, 12:01, 17:02, 22:03)"
echo " 9 - Late morning (09:00, 14:01, 19:02, 00:03)"
echo ""
while true; do
read -p "Enter start hour [5-12]: " start_hour
if [[ "$start_hour" =~ ^[5-9]$|^1[0-2]$ ]]; then
break
else
echo "Please enter a number between 5 and 12"
fi
done
# 3. Создать конфигурацию
cat > config.json << EOF
{
"start_hour": $start_hour,
"log_file": "~/Library/Logs/claude_ping.log",
"claude_path": "$CLAUDE_PATH"
}
EOF
# 4. Показать расписание
local times=()
local hour=$start_hour
local minute=0
echo ""
echo "📅 Your ping schedule:"
for i in {1..4}; do
local time_str=$(printf "%02d:%02d" $hour $minute)
times+=("$time_str")
echo " Ping $i: $time_str"
minute=$((minute + 1))
hour=$((hour + 5))
if [ $hour -ge 24 ]; then
hour=$((hour - 24))
fi
done
# 5. Подтверждение
echo ""
read -p "Continue with this setup? [Y/n]: " confirm
if [[ "$confirm" =~ ^[Nn] ]]; then
echo "Setup cancelled"
exit 0
fi
# 6. Установка
echo ""
echo "🚀 Installing ClaudePing..."
# ... rest of installation
}| macOS Version | Intel | Apple Silicon | Claude Install | Status |
|---|---|---|---|---|
| Monterey 12.x | ✓ | ✓ | npm global | ✅ |
| Ventura 13.x | ✓ | ✓ | bun | ✅ |
| Sonoma 14.x | ✓ | ✓ | homebrew | ✅ |
| Sequoia 15.x | ? | ✓ | local bin | ? |
test_installation() {
echo "🧪 Testing installation..."
# Test 1: Claude detection
if ! detect_claude >/dev/null; then
echo "❌ Claude detection failed"
return 1
fi
# Test 2: Configuration
if [ ! -f "config.json" ]; then
echo "❌ Configuration not created"
return 1
fi
# Test 3: Services
local count=$(launchctl list | grep -c "claude-ping" || true)
if [ "$count" -ne 4 ]; then
echo "❌ Expected 4 services, found $count"
return 1
fi
# Test 4: Ping functionality
if ! ./ping_claude.sh >/dev/null 2>&1; then
echo "❌ Ping test failed"
return 1
fi
echo "✅ All tests passed"
return 0
}# ClaudePing - Automated Claude Code Session Maintenance
Keep your Claude Code 5-hour intervals active with automated pings.
## Quick Install
```bash
bash <(curl -fsSL https://raw.githubusercontent.com/username/mac_scripts/main/quick-install.sh)- Download:
git clone https://github.com/username/mac_scripts - Install:
cd mac_scripts && ./install.sh - Setup:
./install_global.sh && claudeping
- macOS 12+ (Monterey or later)
- Claude Code CLI installed
- Admin access for wake scheduling
- Issues: https://github.com/username/mac_scripts/issues
- Docs: See CLAUDE.md for technical details
### Troubleshooting Guide
```markdown
## Common Issues
**"Claude command not found"**
- Install Claude Code: https://docs.anthropic.com/claude-code
- Check PATH: `echo $PATH`
- Manual path: Edit ping_claude.sh with full claude path
**"Permission denied"**
- Run: `chmod +x *.sh`
- Admin needed: `sudo ./setup_wake.sh`
**"Services not running"**
- Check: `launchctl list | grep claude`
- Reload: `./install.sh`
- Logs: `tail ~/Library/Logs/claude_ping.log`
- ✅ Автоопределение пути к Claude CLI
- ✅ Динамические пути в plist файлах
- ✅ Универсальный PATH для launchd
- ✅ Проверка зависимостей в install.sh
- ✅ Setup wizard для первой установки
- ✅ One-liner installer
- ✅ Улучшенная документация
- ✅ Автоматические тесты
- ⏳ Homebrew formula
- ⏳ GitHub Releases
- ⏳ Mac App Bundle
- ⏳ Automated testing на разных системах
Для успешного распространения ClaudePing необходимо:
- Убрать все hardcoded пути - критично для работы на других Mac
- Добавить автоопределение Claude CLI - поддержка разных способов установки
- Создать setup wizard - упростить первичную настройку
- Подготовить one-liner installer - максимально простая установка
- Протестировать на разных системах - обеспечить совместимость
Текущая версия работает отлично на вашем Mac, но требует доработки для массового распространения. Основной объем работы - в автоматизации определения окружения и создании удобного процесса установки.