clean-component-removal
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseClean Component Removal
组件的干净移除
Orderly teardown of TTS and Telegram bot components with proper sequencing to avoid orphaned processes and stale state.
Platform: macOS (Apple Silicon)
按顺序拆解TTS和Telegram机器人组件,通过合理的步骤避免出现孤立进程和无效状态。
平台: macOS (Apple Silicon)
When to Use This Skill
何时使用此技能
- User wants to uninstall the Kokoro TTS engine
- User wants to remove the Telegram bot
- User wants to clean up all TTS-related files
- User wants to do a full teardown before reinstallation
- User wants to remove specific components selectively
- 用户想要卸载Kokoro TTS引擎
- 用户想要移除Telegram机器人
- 用户想要清理所有与TTS相关的文件
- 用户想要在重新安装前进行完整的拆解
- 用户想要选择性地移除特定组件
Requirements
要求
- No special tools needed (removal uses only ,
rm, and the install script)pkill - User confirmation before destructive operations
- 无需特殊工具(移除仅使用、
rm和安装脚本)pkill - 执行破坏性操作前需用户确认
Removal Order
移除顺序
The removal sequence matters. Components must be torn down in this order to avoid orphaned processes or lock contention.
| Step | Component | Command | Reversible? |
|---|---|---|---|
| 1 | Bot process | | Yes (restart bot) |
| 2 | Kokoro venv | | Yes (reinstall) |
| 3 | Shell symlinks | | Yes (re-symlink) |
| 4 | Temp files | | N/A |
| 5 | Secrets (optional) | | Requires re-creation |
移除顺序至关重要。必须按照以下顺序拆解组件,以避免出现孤立进程或锁竞争问题。
| 步骤 | 组件 | 命令 | 是否可逆? |
|---|---|---|---|
| 1 | 机器人进程 | | 是(重启机器人) |
| 2 | Kokoro虚拟环境 | | 是(重新安装) |
| 3 | Shell符号链接 | | 是(重新创建符号链接) |
| 4 | 临时文件 | | 不适用 |
| 5 | 密钥(可选) | | 需要重新创建 |
What Is NOT Removed (Unless Explicitly Asked)
默认不会移除的内容(除非明确要求)
These are preserved by default to allow easy reinstallation:
| Resource | Path | Why Preserved |
|---|---|---|
| Model cache | | ~400MB download, reusable |
| Bot source code | | Git-tracked, not ephemeral |
| mise.toml config | | Configuration SSoT |
| Centralized logs | | Audit trail |
以下内容默认会被保留,以便于重新安装:
| 资源 | 路径 | 保留原因 |
|---|---|---|
| 模型缓存 | | 约400MB的下载文件,可重复使用 |
| 机器人源代码 | | Git追踪的文件,非临时文件 |
| mise.toml配置 | | 配置的单一可信来源 (SSoT) |
| 集中式日志 | | 审计追踪 |
Workflow Phases
工作流阶段
Phase 1: Confirmation
阶段1:确认
Use AskUserQuestion to confirm which components to remove. Present options:
- Full teardown -- Remove everything (steps 1-4, ask about secrets)
- TTS only -- Remove Kokoro venv + symlinks + temp files (steps 2-4)
- Bot only -- Stop bot process (step 1 only)
- Selective -- Let user pick individual steps
使用AskUserQuestion确认要移除哪些组件。提供以下选项:
- 完整拆解 -- 移除所有内容(步骤1-4,询问是否移除密钥)
- 仅TTS -- 移除Kokoro虚拟环境 + 符号链接 + 临时文件(步骤2-4)
- 仅机器人 -- 停止机器人进程(仅步骤1)
- 选择性移除 -- 让用户选择单独的步骤
Phase 2: Stop Bot Process
阶段2:停止机器人进程
bash
undefinedbash
undefinedCheck if bot is running
检查机器人是否在运行
pgrep -la 'bun.*src/main.ts'
pgrep -la 'bun.*src/main.ts'
Stop it
停止进程
pkill -f 'bun.*src/main.ts' || echo "Bot was not running"
undefinedpkill -f 'bun.*src/main.ts' || echo "机器人未在运行"
undefinedPhase 3: Remove Kokoro Venv
阶段3:移除Kokoro虚拟环境
bash
undefinedbash
undefinedUses kokoro-install.sh --uninstall (removes venv, keeps model cache)
使用kokoro-install.sh --uninstall(移除虚拟环境,保留模型缓存)
~/eon/cc-skills/plugins/tts-telegram-sync/scripts/kokoro-install.sh --uninstall
undefined~/eon/cc-skills/plugins/tts-telegram-sync/scripts/kokoro-install.sh --uninstall
undefinedPhase 4: Remove Symlinks
阶段4:移除符号链接
bash
undefinedbash
undefinedList existing symlinks first
先列出现有符号链接
ls -la ~/.local/bin/tts_*.sh 2>/dev/null
ls -la ~/.local/bin/tts_*.sh 2>/dev/null
Remove them
移除符号链接
rm -f ~/.local/bin/tts_*.sh
undefinedrm -f ~/.local/bin/tts_*.sh
undefinedPhase 5: Clean Temp Files
阶段5:清理临时文件
bash
rm -f /tmp/kokoro-tts-*.wav
rm -f /tmp/kokoro-tts.lockbash
rm -f /tmp/kokoro-tts-*.wav
rm -f /tmp/kokoro-tts.lockPhase 6: Optional Secret Removal
阶段6:可选的密钥移除
Only with explicit user confirmation:
bash
undefined仅在用户明确确认后执行:
bash
undefinedShow what would be removed
显示将要移除的内容
ls -la ~/.claude/.secrets/ccterrybot-telegram
ls -la ~/.claude/.secrets/ccterrybot-telegram
Remove (requires confirmation)
移除(需要确认)
rm -f ~/.claude/.secrets/ccterrybot-telegram
---rm -f ~/.claude/.secrets/ccterrybot-telegram
---TodoWrite Task Templates
TodoWrite任务模板
1. [Confirm] Ask user which components to remove via AskUserQuestion
2. [Stop] Stop bot process
3. [Venv] Run kokoro-install.sh --uninstall
4. [Symlinks] Remove ~/.local/bin/ symlinks
5. [Temp] Clean /tmp/ TTS files
6. [Secrets] Optionally remove secrets (with confirmation)
7. [Verify] Confirm all selected components removed1. [确认] 通过AskUserQuestion询问用户要移除哪些组件
2. [停止] 停止机器人进程
3. [虚拟环境] 运行kokoro-install.sh --uninstall
4. [符号链接] 移除~/.local/bin/下的符号链接
5. [临时文件] 清理/tmp/下的TTS文件
6. [密钥] 可选地移除密钥(需确认)
7. [验证] 确认所有选中的组件已被移除Post-Change Checklist
变更后检查清单
- Bot process is not running (returns nothing)
pgrep -la 'bun.*src/main.ts' - Kokoro venv removed (returns "No such file")
ls ~/.local/share/kokoro/.venv - Symlinks removed (returns "No such file")
ls ~/.local/bin/tts_*.sh - No stale lock file (returns "No such file")
ls /tmp/kokoro-tts.lock - No orphan audio processes (returns nothing)
pgrep -x afplay
- 机器人进程未在运行(无返回结果)
pgrep -la 'bun.*src/main.ts' - Kokoro虚拟环境已移除(返回“No such file”)
ls ~/.local/share/kokoro/.venv - 符号链接已移除(返回“No such file”)
ls ~/.local/bin/tts_*.sh - 无无效锁文件(返回“No such file”)
ls /tmp/kokoro-tts.lock - 无孤立音频进程(无返回结果)
pgrep -x afplay
Troubleshooting
故障排除
| Problem | Likely Cause | Fix |
|---|---|---|
| Symlinks still exist after removal | Glob mismatch or permission | |
| Stale lock after removal | Process died without cleanup | |
| Model cache taking space | ~400MB in HuggingFace cache | |
| Bot respawns after kill | Launched with | Check |
| Audio still playing after teardown | | |
| 问题 | 可能原因 | 解决方法 |
|---|---|---|
| 移除后符号链接仍然存在 | 通配符不匹配或权限问题 | |
| 移除后存在无效锁文件 | 进程退出时未清理 | |
| 模型缓存占用空间 | HuggingFace缓存中约400MB的文件 | |
| 杀死进程后机器人重新启动 | 通过launchd的 | 检查 |
| 拆解后音频仍在播放 | | |
Reference Documentation
参考文档
- Evolution Log -- Change history for this skill
- 演进日志 -- 此技能的变更历史