常用命令与实用案例汇总
/read path/to/file
读取文件内容,支持 offset/limit 分块读取大文件
/edit path/to/file
精确编辑文件,oldText 必须完全匹配(包括空格)
/write path/to/file
创建或覆盖写入文件,自动创建父目录
/exec "command"
执行 shell 命令,支持后台运行和超时控制
/read file.py --offset=100 --limit=50
从第 100 行开始读取 50 行
/exec "tree -L 2 -I 'node_modules'"
查看项目结构(排除 node_modules)
/exec "grep -r 'func' ./src"
递归搜索代码
/exec "git log --oneline -10"
查看最近 10 条 git 提交
/read src/api/user.js - 读取问题文件/edit src/api/user.js - 精确修复/exec "npm test" - 运行测试验证/read 现有模型和代码/edit 添加新字段和逻辑/exec 运行迁移脚本/exec 运行相关测试/exec "npx create-react-app my-app --template typescript"/exec "npm install axios @tanstack/react-query"/write 配置文件/exec "npm run dev" 验证启动📅 更新于 2026-03-30 | 临时目录