Skip to content

Automatically create missing directories with a tool call! #1123

@tobiashochguertel

Description

@tobiashochguertel

Describe the feature or problem you'd like to solve

When copilot-cli calls “Create” tool with a filepath which includes intermediate directories which are not existing, the tool call fails!

Proposed solution

The “Create” tool and the other tools which create or update a file, could be smarter, and check in one go if all required directories for the given filepath are existing, and if not it creates them. I don’t understand why we have to see each time a error, then the AI has to get again asked how to handle and it starts to think again then it creates the missing directories first and finally it calls “Create” again with the content and the same filepath.

That’s so stupid, I think. Why does the tool not support the AI and just create the missing directories while it creates the file, and stops the tool from failing, because the full path wasn’t existing in forehand.

I think often that would save a lot of tokens / context window space and it would make the Agent much faster and might also reduce energy consumption in the server farm where the AI is running. It would reduce a lot of requests and save my time.

Example prompts or workflows

I have not a specific prompt which can show this improvement / feature. But a screenshot from a session which shows the issue.

Imagehich would

Additional context

We can make it configureable via copilot-cli config to enable or disable this feature if that would be easier for everyone.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions