Community-Übersetzungen von veiseule.ai — Help improve them on Crowdin
Zum Hauptinhalt springen

apply_patch-Werkzeug

Wenden Sie Dateiänderungen mit einem strukturierten Patch-Format an. Dies ist ideal für Änderungen über mehrere Dateien oder mehrere Hunks hinweg, bei denen ein einzelner edit-Aufruf fragil wäre.

Das Werkzeug akzeptiert eine einzelne input-Zeichenkette, die eine oder mehrere Dateioperationen kapselt:

*** Begin Patch
*** Add File: path/to/file.txt
+line 1
+line 2
*** Update File: src/app.ts
@@
-old line
+new line
*** Delete File: obsolete.txt
*** End Patch

Parameter

  • input (erforderlich): Vollständiger Patch-Inhalt einschließlich *** Begin Patch und *** End Patch.

Hinweise

  • Patch paths support relative paths (from the workspace directory) and absolute paths.
  • tools.exec.applyPatch.workspaceOnly defaults to true (workspace-contained). Set it to false only if you intentionally want apply_patch to write/delete outside the workspace directory.
  • Verwenden Sie *** Move to: innerhalb eines *** Update File:-Hunks, um Dateien umzubenennen.
  • *** End of File kennzeichnet bei Bedarf ein reines EOF-Insertion.
  • Experimentell und standardmäßig deaktiviert. Aktivieren Sie es mit tools.exec.applyPatch.enabled.
  • Nur für OpenAI (einschließlich OpenAI Codex). Optional nach Modell steuerbar über tools.exec.applyPatch.allowModels.
  • Die Konfiguration befindet sich ausschließlich unter tools.exec.

Beispiel

{
  "tool": "apply_patch",
  "input": "*** Begin Patch\n*** Update File: src/index.ts\n@@\n-const foo = 1\n+const foo = 2\n*** End Patch"
}