# View file
await editor(command="view", path="/app/main.py", view_range=[1, 50])
# View directory
await editor(command="view", path="/app")
# Create file
await editor(
command="create",
path="/app/new.py",
file_text="def hello():\n print('Hello!')",
)
# Replace text (old_str must be unique in file)
await editor(
command="str_replace",
path="/app/main.py",
old_str="print('old')",
new_str="print('new')",
)
# Insert at line
await editor(
command="insert",
path="/app/main.py",
insert_line=10,
new_str="# New comment\n",
)
# Undo last edit
await editor(command="undo_edit", path="/app/main.py")