Skip to content

Modify textEditor to allow overwriting existing files #192

@github-actions

Description

@github-actions

Description

Currently, the textEditor tool throws an error when trying to use the 'create' command on a file that already exists. This behavior can be limiting in many workflows where overwriting files is a valid use case.

Proposed Change

Modify the textEditor implementation to allow overwriting existing files when using the 'create' command, rather than throwing an error when a file already exists.

Implementation Details

  • Modify the 'create' command in the textEditor tool to check if a file exists but not throw an error
  • Update the file with the new content instead of failing
  • Add appropriate history tracking for the undo functionality
  • Update tests to verify this new behavior

Files to Modify

  • /packages/agent/src/tools/io/textEditor.ts
  • /packages/agent/src/tools/io/textEditor.test.ts (to add tests for the new behavior)

Impact

This change will improve the flexibility of the textEditor tool, allowing users to more easily update files without having to use different commands depending on whether the file exists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions