跳到正文
DEV Community· Faris Han·· 4 天前AI 評分47

sweep + doctor:維護 OpenCode 專案健康

sweep + doctor: Keep Your OpenCode Project Healthy

AI 導讀

sweep 和 doctor 兩款 OpenCode 插件分別掃描未使用的程式碼,以及檢查專案設定的健康狀況,協助維持程式碼庫整潔並找出設定問題。sweep 會列出結果的位置和大小,支援 dry-run,亦不會刪除無法確認為未使用的內容;doctor 則會按檢查項目列出通過、警告或失敗狀態及建議修正方法。

正文

Faris Han

sweep + doctor: Keep Your OpenCode Project Healthy

Agent-built repos rot fast. Dead code accumulates, configs drift, and six weeks
later nobody knows which files are load-bearing. Two small plugins attack this
directly: sweep finds unused code; doctor checks config health.

sweep

sweep scans an OpenCode project for unused code: unreferenced functions,
orphaned files, stale imports. It reports what it found with sizes and locations
before touching anything, and supports dry-run. It never deletes what it cannot
verify is unused.

Use it:

  • Before a release, to shrink the surface area.
  • After a refactor, to remove leftovers.
  • On a schedule, to keep drift visible.

doctor

doctor checks the health of an OpenCode project's configuration: missing or
inconsistent settings, broken references, and common misconfigurations. It
prints a report with pass/warn/fail per check and suggested fixes.

Use it:

  • When onboarding a new repo.
  • After changing provider or model config.
  • In CI, as a gate.

Together

sweep keeps the codebase small; doctor keeps the config honest. Run both
before /ship:

sweep --dry-run
doctor
wf-verify

If all three pass, the repo is in better shape than most.

Get it

sweep and doctor are OpenCode plugins that ship with the OpenCode Dev
Toolkit (Pro). The core workflow kit is free (MIT).

Takeaway

Agent-built code does not rot because agents are bad. It rots because nobody
runs the janitor. sweep and doctor are the janitor.

來源:DEV Community · dev.to