| name | agent-ide |
| description | Agent IDE CLI for TypeScript/JavaScript code intelligence and safe refactoring. Use when Codex needs to inspect or change TS/JS projects with agent-ide: cycles, impact, search/find-references, call-hierarchy, rename symbols, move files or members, change function signatures, clean dead code, update imports/call sites, or control index cache with --no-cache/--cache-dir. |
Agent IDE
TS/JS 程式碼智能重構工具。
功能列表
全域選項
--no-cache:停用索引快取
--cache-dir <path>:覆寫索引快取目錄
--verbose:顯示詳細處理資訊
最佳實踐
重構標準流程
1. deadcode → 清理未使用程式碼(清場)
2. search → 找入口與主要符號(偵察)
3. cycles → 檢測循環依賴(診斷)
4. move → 重組檔案/成員(重構)
5. rename → 修正命名風格(收尾)
場景選用指南
| 場景 | 功能 | 說明 |
|---|
| 接手新專案 | deadcode → search | 先清垃圾,再找入口 |
| 重構前診斷 | cycles → impact | 找問題點,評估影響範圍 |
| 找符號入口 | search <symbol> | 模糊搜尋符號位置 |
| 檔案重組 | move src/a.ts src/b/ | 自動更新所有 import |
| 抽取函式 | move src/a.ts:25 src/b.ts | 移動成員到新位置 |
| 統一命名 | rename --from userId --to uid | 全專案一致性 |
| 修改 API | change-signature | 參數順序/名稱變更 |
| 追蹤呼叫 | call-hierarchy → find-references | 理解函式使用情況 |
安全操作原則
- 先
--dry-run 再執行:變更類功能務必預覽
- 清理優先於重構:
deadcode 減少不必要的移動/重命名
- 小步快跑:一次只做一種類型的變更,便於回滾
- 重構後驗證:
cycles 確保沒引入循環依賴