Commit f4b416c
Changed files (2)
lib
elelem
lib/elelem/agent.rb
@@ -125,7 +125,7 @@ module Elelem
- execute: shell command
# Editing
- Use `patch` tool for multi-line changes (unified diff format)
+ Use `patch -p1` for multi-line changes: `echo "DIFF" | patch -p1`
Use sed for single-line changes: `sed -i'' 's/old/new/' file`
Use write for new files or full rewrites
lib/elelem/toolbox.rb
@@ -27,18 +27,6 @@ module Elelem
params: { command: { type: "string" } },
required: ["command"],
fn: ->(a) { Elelem.sh("bash", args: ["-c", a["command"]]) { |x| $stdout.print(x) } }
- },
- "patch" => {
- desc: "Apply unified diff",
- params: { diff: { type: "string", description: "Unified diff content" } },
- required: ["diff"],
- fn: lambda do |a|
- Tempfile.create("patch") do |f|
- f.write(a["diff"])
- f.flush
- Elelem.sh("patch", args: ["-p1", "-i", f.path])
- end
- end
}
}.freeze