Skip to content

tools/filesystem: Add post-edit command support#89

Merged
rumpl merged 1 commit intodocker:mainfrom
vvoland:post-edit
Sep 15, 2025
Merged

tools/filesystem: Add post-edit command support#89
rumpl merged 1 commit intodocker:mainfrom
vvoland:post-edit

Conversation

@vvoland
Copy link
Copy Markdown
Contributor

@vvoland vvoland commented Sep 3, 2025

Implements post-edit functionality for the filesystem builtin tool, allowing automatic execution of commands after file edits based on file path patterns.

Use cases:

  • Automatic code formatting (like gofmt for Go, shfmt for bash)
  • Running linters with auto-fix capabilities

The feature supports:

  • Glob-style path patterns (*.go, *.py, etc.)
  • $path placeholder replacement in commands
  • Multiple post-edit rules per toolset

Implements post-edit functionality for the filesystem builtin tool,
allowing automatic execution of commands after file edits based on file
path patterns.

Use cases:
- Automatic code formatting (like gofmt for Go, shfmt for bash)
- Running linters with auto-fix capabilities

The feature supports:
- Glob-style path patterns (*.go, *.py, etc.)
- $path placeholder replacement in commands
- Multiple post-edit rules per toolset

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Copy link
Copy Markdown
Contributor

@krissetto krissetto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this idea. I'm not super sure on the implementation as a config of the filesystem tool though.

This kinda feels like a sort of "tool chaining/triggering" feature, where we can force the trigger of one tool (in this case, a shell command), based on the output conditions of another tool (filesystem). Here it could be worded as something like "if the filesystem tool's input param (file here) fits x condition (the glob), then run the shell command 'whatever' after successful execution of the filesystem tool"

This here could be a good enough quick solution for this specific case, but I have a feeling that thinking about this problem a bit more could lead to a nice solution that's reusable across a wide range of tools.

Any thoughts?

@rumpl rumpl merged commit be1d5b9 into docker:main Sep 15, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants