daemon-setup
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese/asciinema-tools:daemon-setup
/asciinema-tools:daemon-setup
Interactive wizard to set up the asciinema chunker daemon. This daemon runs independently of Claude Code CLI, using dedicated credentials stored in macOS Keychain.
用于设置asciinema分块守护进程的交互式向导。该守护进程独立于Claude Code CLI运行,使用存储在macOS Keychain中的专用凭证。
Why a Daemon?
为什么要使用守护进程?
| Problem with old approach | Daemon solution |
|---|---|
Uses | Uses dedicated PAT from Keychain |
| Dies when terminal closes | launchd keeps it running |
| Silent push failures | Logs + Pushover notifications |
| Tied to Claude Code session | Completely decoupled |
| 旧方案存在的问题 | 守护进程解决方案 |
|---|---|
使用共享的 | 使用Keychain中存储的专用PAT |
| 终端关闭时进程退出 | launchd保持进程持续运行 |
| 推送失败无任何提示 | 日志记录 + Pushover通知提醒 |
| 与Claude Code会话绑定 | 完全独立解耦 |
Setup Phases Overview
设置阶段概览
| Phase | Name | Details |
|---|---|---|
| 1 | Preflight Check | Below |
| 2 | Check Existing | Below |
| 3 | GitHub PAT Setup | PAT Setup Guide |
| 4 | Pushover Setup | Pushover Setup Guide |
| 5-6 | Config + Install | launchd Installation Guide |
| 7 | Verify + Troubleshoot | Verification & Troubleshooting |
| 阶段 | 名称 | 详情 |
|---|---|---|
| 1 | 预检检查 | 见下文 |
| 2 | 现有安装检查 | 见下文 |
| 3 | GitHub PAT设置 | PAT设置指南 |
| 4 | Pushover设置 | Pushover设置指南 |
| 5-6 | 配置+安装 | launchd安装指南 |
| 7 | 验证+问题排查 | 验证与问题排查指南 |
Execution
执行流程
Phase 1: Preflight Check
阶段1:预检检查
Check required tools:
bash
/usr/bin/env bash << 'PREFLIGHT_EOF'
MISSING=()
for tool in asciinema zstd git curl jq; do
command -v "$tool" &>/dev/null || MISSING+=("$tool")
done检查所需工具:
bash
/usr/bin/env bash << 'PREFLIGHT_EOF'
MISSING=()
for tool in asciinema zstd git curl jq; do
command -v "$tool" &>/dev/null || MISSING+=("$tool")
donemacOS-specific: security command for Keychain
macOS专属:Keychain对应的security命令
if [[ "$(uname)" == "Darwin" ]]; then
command -v security &>/dev/null || MISSING+=("security (macOS Keychain)")
fi
if [[ ${#MISSING[@]} -gt 0 ]]; then
echo "MISSING:${MISSING[*]}"
exit 1
fi
echo "PREFLIGHT:OK"
PREFLIGHT_EOF
**If MISSING not empty, use AskUserQuestion:**
Question: "Missing required tools: {MISSING}. How would you like to proceed?"
Header: "Dependencies"
Options:
- label: "Install via Homebrew (Recommended)" description: "Run: brew install {MISSING}"
- label: "I'll install manually" description: "Pause setup and show install instructions"
- label: "Abort setup" description: "Exit the setup wizard"
**If "Install via Homebrew"**: Run `brew install {MISSING}` and continue.
---if [[ "$(uname)" == "Darwin" ]]; then
command -v security &>/dev/null || MISSING+=("security (macOS Keychain)")
fi
if [[ ${#MISSING[@]} -gt 0 ]]; then
echo "MISSING:${MISSING[*]}"
exit 1
fi
echo "PREFLIGHT:OK"
PREFLIGHT_EOF
**如果存在缺失工具,调用AskUserQuestion:**
Question: "缺失所需工具:{MISSING}。你希望如何继续?"
Header: "依赖项检查"
Options:
- label: "通过Homebrew安装(推荐)" description: "执行命令:brew install {MISSING}"
- label: "手动安装" description: "暂停设置并展示安装说明"
- label: "中止设置" description: "退出设置向导"
**如果选择「通过Homebrew安装」:** 执行`brew install {MISSING}`后继续流程。
---Phase 2: Check Existing Installation
阶段2:现有安装检查
bash
/usr/bin/env bash << 'CHECK_EXISTING_EOF'
PLIST_PATH="$HOME/Library/LaunchAgents/com.cc-skills.asciinema-chunker.plist"
DAEMON_RUNNING="false"
if [[ -f "$PLIST_PATH" ]]; then
echo "PLIST_EXISTS:true"
if launchctl list 2>/dev/null | grep -q "asciinema-chunker"; then
DAEMON_RUNNING="true"
fi
else
echo "PLIST_EXISTS:false"
fi
echo "DAEMON_RUNNING:$DAEMON_RUNNING"bash
/usr/bin/env bash << 'CHECK_EXISTING_EOF'
PLIST_PATH="$HOME/Library/LaunchAgents/com.cc-skills.asciinema-chunker.plist"
DAEMON_RUNNING="false"
if [[ -f "$PLIST_PATH" ]]; then
echo "PLIST_EXISTS:true"
if launchctl list 2>/dev/null | grep -q "asciinema-chunker"; then
DAEMON_RUNNING="true"
fi
else
echo "PLIST_EXISTS:false"
fi
echo "DAEMON_RUNNING:$DAEMON_RUNNING"Check if PAT already in Keychain
检查Keychain中是否已存在PAT
if security find-generic-password -s "asciinema-github-pat" -a "$USER" -w &>/dev/null 2>&1; then
echo "PAT_EXISTS:true"
else
echo "PAT_EXISTS:false"
fi
CHECK_EXISTING_EOF
**If PLIST_EXISTS=true, use AskUserQuestion:**
Question: "Existing daemon installation found. What would you like to do?"
Header: "Existing"
Options:
- label: "Reinstall (keep credentials)" description: "Update daemon script and plist, keep Keychain credentials"
- label: "Fresh install (reset everything)" description: "Remove existing credentials and start fresh"
- label: "Cancel" description: "Exit without changes"
---if security find-generic-password -s "asciinema-github-pat" -a "$USER" -w &>/dev/null 2>&1; then
echo "PAT_EXISTS:true"
else
echo "PAT_EXISTS:false"
fi
CHECK_EXISTING_EOF
**如果PLIST_EXISTS=true,调用AskUserQuestion:**
Question: "检测到已存在守护进程安装,你希望执行什么操作?"
Header: "已有安装检测"
Options:
- label: "重新安装(保留凭证)" description: "更新守护进程脚本和plist文件,保留Keychain中存储的凭证"
- label: "全新安装(重置所有内容)" description: "删除现有所有凭证,从头开始设置"
- label: "取消" description: "不做任何修改直接退出"
---Phase 3: GitHub PAT Setup
阶段3:GitHub PAT设置
See PAT Setup Guide for the full interactive flow: PAT creation walkthrough, Keychain storage, and verification.
完整交互流程请参考PAT设置指南:包含PAT创建引导、Keychain存储和验证步骤。
Phase 4: Pushover Setup (Optional)
阶段4:Pushover设置(可选)
See Pushover Setup Guide for the full interactive flow: Pushover explanation, app creation, credential storage, and test notification.
完整交互流程请参考Pushover设置指南:包含Pushover功能介绍、应用创建、凭证存储和测试通知步骤。
Phase 5-6: Daemon Configuration and launchd Installation
阶段5-6:守护进程配置与launchd安装
See launchd Installation Guide for chunking settings selection, plist generation from template, and service installation.
分块参数选择、模板生成plist文件、服务安装步骤请参考launchd安装指南。
Phase 7: Verification
阶段7:验证
See Verification & Troubleshooting for daemon health checks, post-install verification, the final success message, and the troubleshooting table.
守护进程健康检查、安装后验证、最终成功提示以及问题排查表请参考验证与问题排查指南。
Quick Reference
快速参考
Troubleshooting
问题排查
| Issue | Cause | Solution |
|---|---|---|
| Keychain access denied | macOS permission not granted | Grant access in System Settings |
| PAT test failed | Token expired or invalid scope | Generate new token with |
| launchctl load failed | plist syntax error | Check |
| Daemon keeps stopping | Script error or crash | Check |
| Pushover not working | Invalid credentials | Re-run setup with correct app/user key |
| Health file missing | Daemon not running | Run |
| 问题 | 原因 | 解决方案 |
|---|---|---|
| Keychain访问被拒绝 | 未授予macOS对应权限 | 在系统设置中授予对应权限 |
| PAT测试失败 | Token过期或权限范围无效 | 生成带有 |
| launchctl加载失败 | plist语法错误 | 执行 |
| 守护进程持续崩溃退出 | 脚本错误或运行异常 | 查看 |
| Pushover通知不生效 | 凭证无效 | 使用正确的应用/用户密钥重新运行设置 |
| 健康检查文件缺失 | 守护进程未运行 | 执行 |
Related Commands
相关命令
| Command | Description |
|---|---|
| Check daemon health |
| View logs |
| Stop daemon |
| Start daemon |
| 命令 | 描述 |
|---|---|
| 检查守护进程健康状态 |
| 查看运行日志 |
| 停止守护进程 |
| 启动守护进程 |