智能体工具

multi_edit

multi_edit({ path, edits: [{ old_string, new_string, replace_all? }] })

在一个文件中有几个精确的替换, 应用顺序, 全部或全部或全部没有。 一次转一个 而不是一次转一个 。

category: writein orderatomic
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

pathstring必填

档案

editsarray必填

每个带 old_string, new_string 和任择 replace_all.

全部或无

如果无法替换一个文件, 则没有写成文件。 文件从不被半修改, 当更改取决于彼此时, 关键是文件上的重命名 。

以可见的状态

每个编辑都看到前一个编辑的结果

因此,较早的替代者可以创建或销毁后一个文件所要搜索的案文,按文件所列顺序列出,并区分其背景。

{
  path: "src/auth.js",
  edits: [
    { old_string: "const TTL = 3600",     new_string: "const TTL = 900" },
    { old_string: "// TODO: rotate",      new_string: "// rotated on refresh" },
    { old_string: "oldName",              new_string: "newName", replace_all: true }
  ]
}
{
    "path": "src/auth.js",
    "edits": [
        {"old_string": "const TTL = 3600", "new_string": "const TTL = 900"},
        {"old_string": "// TODO: rotate", "new_string": "// rotated on refresh"},
        {"old_string": "oldName", "new_string": "newName", "replace_all": True},
    ],
}

当它是正确的工具

在一个文件的交叉文件重命名,一系列相关的修改,应用什么 greep 复数 在一个文件中找到。 在多个文件中, 每一个都是一个呼叫, 没有多个文件编辑 。