clean-component-removal

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Clean 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
    ,
    pkill
    , and the install script)
  • 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.
StepComponentCommandReversible?
1Bot process
pkill -f 'bun.*src/main.ts'
Yes (restart bot)
2Kokoro venv
kokoro-install.sh --uninstall
Yes (reinstall)
3Shell symlinks
rm -f ~/.local/bin/tts_*.sh
Yes (re-symlink)
4Temp files
rm -f /tmp/kokoro-tts-*.wav /tmp/kokoro-tts.lock
N/A
5Secrets (optional)
rm -f ~/.claude/.secrets/ccterrybot-telegram
Requires re-creation

移除顺序至关重要。必须按照以下顺序拆解组件,以避免出现孤立进程或锁竞争问题。
步骤组件命令是否可逆?
1机器人进程
pkill -f 'bun.*src/main.ts'
是(重启机器人)
2Kokoro虚拟环境
kokoro-install.sh --uninstall
是(重新安装)
3Shell符号链接
rm -f ~/.local/bin/tts_*.sh
是(重新创建符号链接)
4临时文件
rm -f /tmp/kokoro-tts-*.wav /tmp/kokoro-tts.lock
不适用
5密钥(可选)
rm -f ~/.claude/.secrets/ccterrybot-telegram
需要重新创建

What Is NOT Removed (Unless Explicitly Asked)

默认不会移除的内容(除非明确要求)

These are preserved by default to allow easy reinstallation:
ResourcePathWhy Preserved
Model cache
~/.cache/huggingface/hub/models--hexgrad--Kokoro-82M
~400MB download, reusable
Bot source code
~/.claude/automation/claude-telegram-sync/
Git-tracked, not ephemeral
mise.toml config
~/.claude/automation/claude-telegram-sync/mise.toml
Configuration SSoT
Centralized logs
~/.local/share/tts-telegram-sync/logs/
Audit trail

以下内容默认会被保留,以便于重新安装:
资源路径保留原因
模型缓存
~/.cache/huggingface/hub/models--hexgrad--Kokoro-82M
约400MB的下载文件,可重复使用
机器人源代码
~/.claude/automation/claude-telegram-sync/
Git追踪的文件,非临时文件
mise.toml配置
~/.claude/automation/claude-telegram-sync/mise.toml
配置的单一可信来源 (SSoT)
集中式日志
~/.local/share/tts-telegram-sync/logs/
审计追踪

Workflow Phases

工作流阶段

Phase 1: Confirmation

阶段1:确认

Use AskUserQuestion to confirm which components to remove. Present options:
  1. Full teardown -- Remove everything (steps 1-4, ask about secrets)
  2. TTS only -- Remove Kokoro venv + symlinks + temp files (steps 2-4)
  3. Bot only -- Stop bot process (step 1 only)
  4. Selective -- Let user pick individual steps
使用AskUserQuestion确认要移除哪些组件。提供以下选项:
  1. 完整拆解 -- 移除所有内容(步骤1-4,询问是否移除密钥)
  2. 仅TTS -- 移除Kokoro虚拟环境 + 符号链接 + 临时文件(步骤2-4)
  3. 仅机器人 -- 停止机器人进程(仅步骤1)
  4. 选择性移除 -- 让用户选择单独的步骤

Phase 2: Stop Bot Process

阶段2:停止机器人进程

bash
undefined
bash
undefined

Check 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"
undefined
pkill -f 'bun.*src/main.ts' || echo "机器人未在运行"
undefined

Phase 3: Remove Kokoro Venv

阶段3:移除Kokoro虚拟环境

bash
undefined
bash
undefined

Uses 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
undefined

Phase 4: Remove Symlinks

阶段4:移除符号链接

bash
undefined
bash
undefined

List 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
undefined
rm -f ~/.local/bin/tts_*.sh
undefined

Phase 5: Clean Temp Files

阶段5:清理临时文件

bash
rm -f /tmp/kokoro-tts-*.wav
rm -f /tmp/kokoro-tts.lock
bash
rm -f /tmp/kokoro-tts-*.wav
rm -f /tmp/kokoro-tts.lock

Phase 6: Optional Secret Removal

阶段6:可选的密钥移除

Only with explicit user confirmation:
bash
undefined
仅在用户明确确认后执行:
bash
undefined

Show 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 removed

1. [确认] 通过AskUserQuestion询问用户要移除哪些组件
2. [停止] 停止机器人进程
3. [虚拟环境] 运行kokoro-install.sh --uninstall
4. [符号链接] 移除~/.local/bin/下的符号链接
5. [临时文件] 清理/tmp/下的TTS文件
6. [密钥] 可选地移除密钥(需确认)
7. [验证] 确认所有选中的组件已被移除

Post-Change Checklist

变更后检查清单

  • Bot process is not running (
    pgrep -la 'bun.*src/main.ts'
    returns nothing)
  • Kokoro venv removed (
    ls ~/.local/share/kokoro/.venv
    returns "No such file")
  • Symlinks removed (
    ls ~/.local/bin/tts_*.sh
    returns "No such file")
  • No stale lock file (
    ls /tmp/kokoro-tts.lock
    returns "No such file")
  • No orphan audio processes (
    pgrep -x afplay
    returns nothing)

  • 机器人进程未在运行(
    pgrep -la 'bun.*src/main.ts'
    无返回结果)
  • Kokoro虚拟环境已移除(
    ls ~/.local/share/kokoro/.venv
    返回“No such file”)
  • 符号链接已移除(
    ls ~/.local/bin/tts_*.sh
    返回“No such file”)
  • 无无效锁文件(
    ls /tmp/kokoro-tts.lock
    返回“No such file”)
  • 无孤立音频进程(
    pgrep -x afplay
    无返回结果)

Troubleshooting

故障排除

ProblemLikely CauseFix
Symlinks still exist after removalGlob mismatch or permission
ls -la ~/.local/bin/tts_*
then
rm -f
each one
Stale lock after removalProcess died without cleanup
rm -f /tmp/kokoro-tts.lock
Model cache taking space~400MB in HuggingFace cache
rm -rf ~/.cache/huggingface/hub/models--hexgrad--Kokoro-82M
Bot respawns after killLaunched with
--watch
from launchd
Check
launchctl list
for relevant agents
Audio still playing after teardown
afplay
process outlives bot
pkill -x afplay

问题可能原因解决方法
移除后符号链接仍然存在通配符不匹配或权限问题
ls -la ~/.local/bin/tts_*
然后逐个执行
rm -f
删除
移除后存在无效锁文件进程退出时未清理
rm -f /tmp/kokoro-tts.lock
模型缓存占用空间HuggingFace缓存中约400MB的文件
rm -rf ~/.cache/huggingface/hub/models--hexgrad--Kokoro-82M
杀死进程后机器人重新启动通过launchd的
--watch
选项启动
检查
launchctl list
中的相关代理
拆解后音频仍在播放
afplay
进程未随机器人退出
pkill -x afplay

Reference Documentation

参考文档

  • Evolution Log -- Change history for this skill
  • 演进日志 -- 此技能的变更历史