mcpField
M
maintenance

maintenance

github.com/fellowship-dev云与 DevOps3145 次安装2 周前更新
代码仓库

关于 maintenance

用于基础设施健康审计的维护技能,检查进程、密钥、依赖项、分支和系统状态,并整理发现的问题。它明确禁止修改代码、配置或仓库内容,可将需要跟进的问题记录为 GitHub issue。

主要功能

  1. 01检查密钥与依赖覆盖情况
  2. 02审计过期分支和 LaunchAgent
  3. 03检查计划任务日志与系统健康
  4. 04核对仓库清单和标签
  5. 05将发现的问题记录为 GitHub issue

适用场景

  1. 01定期执行基础设施巡检
  2. 02排查自动化任务停止运行
  3. 03检查磁盘、brew 或密钥问题

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/fellowship-dev/dogfooded-skills --skill maintenance

安装后在 Claude Code 中输入/maintenance确认已加载。

详细介绍

维护

基础设施健康审计。调查 → 标记 → 创建 issue。绝不修改代码、配置或仓库内容。

通过 npx 安装:

npx skills add fellowship-dev/dogfooded-skills/ops/maintenance

架构/文档检查已移至 /entropy-check。 此技能仅涵盖基础设施: 进程、密钥、标签、分支、依赖项、系统健康状况和记忆清理。

适用场景

  • 每周定时运行(cron)——全面检查基础设施
  • 系统变更后(新增 LaunchAgent、新增 cron 作业)
  • 自动化任务似乎停止运行时
  • 怀疑存在磁盘或 brew 问题时

指导原则

维护所需的精力是构建的 10 倍。这项工作会发现 Max 日常看不到的问题。输出:一份报告,以及针对所有值得跟踪的问题创建的 GitHub issue。


说明

运行所有检查。每项发现都应在 fellowship-dev/claude-buddy 中创建 GitHub issue,或标记为正常。

# Set GH_TOKEN at the start of every run
export GH_TOKEN=$(grep GH_TOKEN_FELLOWSHIP /home/ubuntu/projects/fellowship-dev/claude-buddy/.env | cut -d= -f2)

1. 记忆整理(始终执行)
wc -l /home/ubuntu/projects/fellowship-dev/claude-buddy/memory/MEMORY.md
ls ~/.claude/projects/-Users-maxfindel-Projects-claude-buddy/*.jsonl | wc -l
  • MEMORY.md 超过 180 行 → 精简并运行 /save-memory
  • JSONL 会话文件:忽略其累积——每个约 5MB 属于正常情况,无需处理

2. 密钥扫描
grep -r "ghp_\|ghs_\|sk-\|xoxb-\|AAEi\|AAAA[a-zA-Z0-9]" \
  /home/ubuntu/projects/fellowship-dev/claude-buddy/ \
  --include="*.md" --include="*.sh" --include="*.py" --include="*.mjs" \
  -l 2>/dev/null | grep -v ".git"

标记任何包含看似有效的令牌/密钥且由 Git 跟踪的文件。


3. Dependabot 覆盖情况

读取 PROJECTS.md。检查每个活跃仓库(Products + Tooling,跳过 FVL):

GH_TOKEN=$GH_TOKEN gh api repos/{org}/{repo}/contents/.github/dependabot.yml 2>&1
  • 缺少配置 → 标记为 issue
  • 存在配置但超过 30 天无动静 → 标记

4. 过时分支

检查活跃仓库中已合并但尚未删除的分支:

GH_TOKEN=$GH_TOKEN gh api repos/{org}/{repo}/branches --paginate \
  --jq '.[].name' 2>/dev/null
# Cross-reference against merged PRs

标记拥有超过 5 个已合并过时分支的仓库。


5. LaunchAgent 健康状况
ls ~/Library/LaunchAgents/fry.*.plist | while read f; do
  target=$(grep -o '/[^<]*' "$f" | grep -E '\.sh|\.py|\.mjs' | head -1)
  [ -f "$target" ] || echo "MISSING: $f → $target"
done
launchctl list | grep fry

标记任何指向缺失文件的 plist,或任何未加载的 fry Agent。


6. Cron 日志错误(最近 7 天)
ls -t ~/.local/share/fry-bot/cron-logs/*.log | head -20 | xargs grep -l "FAILED\|ERROR\|timeout" 2>/dev/null

同一作业反复失败 = 附上日志摘录并标记为 issue。


7. PROJECTS.md 准确性
  • 检查列为活跃的仓库:它们在 GitHub 上是否仍然存在?
  • 检查列为 Dormant 的仓库:过去 30 天内是否有提交?
  • Max 创建的新仓库是否有未列入 PROJECTS.md 的?
GH_TOKEN=$GH_TOKEN gh repo list {org} --json name,isArchived,pushedAt --limit 50

对以下对象运行:maxfindel、fellowship-dev、Lexgo-cl、CLAPES-UC、Energia-UC。


8. Spacestation 系统健康状况
brew outdated --quiet | wc -l
df -h / | tail -1
  • 过时的 Brew 软件包超过 20 个 → 标记
  • 磁盘使用率超过 85% → 标记

9. 标签同步

验证活跃仓库中的标准标签。

对每个活跃的 fellowship-dev 仓库(farmesa、inbox-angel、booster-pack、mtg-lotr、commander):

STANDARD="ready-to-work in-progress needs-manual-review reviewed double-checked ready-to-merge groundwork dependencies bug enhancement documentation"
for repo in farmesa inbox-angel booster-pack mtg-lotr commander; do
  existing=$(GH_TOKEN=$GH_TOKEN gh label list --repo fellowship-dev/$repo \
    --json name --jq '.[].name' 2>/dev/null | tr '\n' ' ')
  for label in $STANDARD; do
    echo "$existing" | grep -q "$label" || echo "MISSING: fellowship-dev/$repo → $label"
  done
done
  • 缺少任何标签 → 运行 gh label create 添加(幂等,可安全地直接执行)
  • 报告已创建和已存在的标签数量

10. Booster-Pack 同步

将更改拉取到依赖它的网站中。

查找所有具有 booster Git 远程仓库的本地仓库:

for dir in ~/Projects/fellowship-dev/*/; do
  if git -C "$dir" remote | grep -q '^booster$' 2>/dev/null; then
    repo=$(basename "$dir")
    BEHIND=$(git -C "$dir" rev-list HEAD..booster/main --count 2>/dev/null || echo "?")
    echo "fellowship-dev/$repo: $BEHIND commits behind booster-pack"
  fi
done
  • 如果任何网站落后超过 0 个提交 → 在 overnight-tasks.md 中排入任务:pull-booster-{repo-slug},类型为 maintenance,执行器为 {project-path},提示词为 git pull booster main --no-edit && git push。
  • 如果存在冲突 → 改为标记并交由 Max 处理,不要自行拉取。

11. fellowship-dev/claude-buddy 中的未关闭 issue

列出所有未关闭的 issue——无需采取行动,只需在报告中列出,方便 Max 了解待办事项。

GH_TOKEN=$GH_TOKEN gh issue list --repo fellowship-dev/claude-buddy --state open \
  --json number,title,labels,createdAt

创建 issue

创建任何 issue 前,先检查是否存在重复项:

# Fetch open + closed issue titles (closed catches older attempts at the same problem)
GH_TOKEN=$GH_TOKEN gh issue list --repo fellowship-dev/claude-buddy \
  --state all --limit 200 --json number,title,state \
  --jq '.[] | "\(.state) #\(.number): \(.title)"'
  • 如果已有匹配的未关闭 issue → 添加评论,或仅在报告中注明。不要创建重复 issue。
  • 如果存在匹配的已关闭 issue → 仅当问题明确再次出现时,才重新打开或创建新 issue。在正文中注明之前的 issue 编号。

对于每项新的发现,如果不存在对应 issue:

GH_TOKEN=$GH_TOKEN gh issue create \
  --repo fellowship-dev/claude-buddy \
  --title "Maintenance: {finding}" \
  --label "maintenance" \
  --body "..."

输出

将报告保存到 reports/maintenance/YYYY-MM-DD.md:

# Maintenance Report — YYYY-MM-DD

## Checks Run
- [x] Memory consolidation
- [x] Secrets scan
- [x] Dependabot coverage
- [x] Stale branches
- [x] LaunchAgent health
- [x] Cron log errors
- [x] PROJECTS.md accuracy
- [x] Spacestation system health
- [x] Label sync
- [x] Booster-pack sync
- [x] Open issues review

> Note: Architecture/doc drift checks have moved to /entropy-check (separate skill)

## Findings

### Issues Created
- issue [fellowship-dev/claude-buddy#N](url): {title}

### Clean
- {area}: nothing flagged

### Noted (no issue, low severity)
- {finding}

## Memory
- MEMORY.md: {N} lines
- JSONL sessions: {N} files

然后输出简短的 Telegram 摘要:

🔧 Maintenance — YYYY-MM-DD

{N} issues created: [list with links]
{N} areas clean
Memory: {N}/200 lines

Full report: reports/maintenance/YYYY-MM-DD.md

此技能移除了什么

**第 11 节(导入的 lib 偏差——speckit 和 toolkit)**已提取至 /entropy-check。

**原因:**检查 speckit 命令是否与事实来源一致,属于架构/文档检查——它用于衡量工具知识层是否保持最新。Entropy-check 负责所有文档/架构新鲜度信号。此技能仅负责基础设施。

若要检查 speckit 偏差,请针对目标仓库运行 /entropy-check。

评论

支持 Markdown