Skip to content

Conversation

tiborvass
Copy link
Collaborator

Also modifies List to add an ignore argument.

Copy link
Member

@aluzzardi aluzzardi left a comment

Choose a reason for hiding this comment

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

Looks good to me!

I'll let @vito and @kpenfound do a review -- not too familiar with what other agents tools do (line based edit vs search and replace etc)


func (env *Environment) FileGrep(ctx context.Context, path, pattern, include string) (string, error) {
// Hack: use busybox to run `sed` since dagger doesn't have native file editing primitives.
args := []string{"/bin/grep", "-E", "--", pattern, include}
Copy link
Member

Choose a reason for hiding this comment

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

What about using ripgrep instead? It's smart enough to avoid grepping through node_modules and other crap

)

// FIXME: See hack where it's used
const fileUtilsBaseImage = "busybox"
Copy link
Member

Choose a reason for hiding this comment

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

nit: I think there's another one of this pointing to alpine in the codebase, can we merge the two?

nit2: can we pin this to a digest? Otherwise AFAIK buildkit will ping the registry each time to resolve the digest and see if it changed compared to local

}
defer dag.Close()

go warmCache(ctx, dag)
Copy link
Member

Choose a reason for hiding this comment

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

sneaky ;)


func (env *Environment) FileGrep(ctx context.Context, path, pattern, include string) (string, error) {
// Hack: use busybox to run `sed` since dagger doesn't have native file editing primitives.
args := []string{"/bin/grep", "-E", "--", pattern, include}
Copy link
Contributor

Choose a reason for hiding this comment

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

Claude choked on this command when I gave it a go:

https://dagger.cloud/vito/traces/b72d0edd3100fb0789cb2f718eba3b0e?span=af8472a10106d33f

Looks like grep didn't like a blank include arg. Maybe it should default to .?

mcp.Required(),
),
mcp.WithArray("edits",
mcp.Description("Array of sed search-replace operations to perform on the contents of target_file (e.g. \"s/old/new/g\").\nUses extended regex syntax."),
Copy link
Contributor

Choose a reason for hiding this comment

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

Claude choked on this too:

● container-use - environment_file_edit (MCP)(environment_source: "/var/home/vito/src/bind", environment_id: "oriented-deer", target_file: "treesitter/binding.gyp", edits:
                                             ["s/tree_sitter_bind_binding/tree_sitter_sprout_binding/g"], explanation: "Updating binding.gyp to use sprout instead of bind")
  ⎿  Error: MCP error -32603: could not bind arguments

● Let me read and update the file content:

I think the description is just out of date - looks like it's no longer sed syntax (which I think makes sense, since Claude by necessity includes a bunch of context to ensure it doesn't misfire edits and that'd be awkward to squish into sed syntax).

@aluzzardi
Copy link
Member

@tiborvass btw -- with @grouville's new integration tests / MCP fan-out, perhaps we can now actually test those (once we're happy with the signatures)?

@tiborvass
Copy link
Collaborator Author

@aluzzardi yes, that's why it was in Draft, wanted to add tests.

@tiborvass tiborvass force-pushed the fstools branch 6 times, most recently from 122e3aa to 4c0c3d0 Compare July 9, 2025 12:19
Also modifies List to add an `ignore` argument.

Signed-off-by: Tibor Vass <[email protected]>
This prevents streaming all the contents of a file from dagger.

Signed-off-by: Tibor Vass <[email protected]>
@tiborvass tiborvass force-pushed the fstools branch 3 times, most recently from 6961f0d to 6a592ed Compare July 16, 2025 12:45
@vito
Copy link
Contributor

vito commented Jul 18, 2025

@tiborvass I'm working on a couple of Dagger PRs that may be useful here:

Would have pinged earlier about it, but I just started on these on a whim the other day and it ended up going smoother than I expected. 🙏

@tiborvass
Copy link
Collaborator Author

@vito nice thank you! Feel free to take over the branch or steal from it whatever you need, i'm not attached to it!

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