goose icon indicating copy to clipboard operation
goose copied to clipboard

.gooseignore (.gitignore) blocks commands that happen to match files

Open tkinz27 opened this issue 6 months ago • 2 comments

Describe the bug

I have build/ in my .gitignore file. I am now trying to get goose to compile some go code to fix the errors, but the command go build is matching and being blocked from being run.

A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Add a directory build/ to a .gitignore or .gooseignore
  2. Ask goose to run a command with build in it like go build

Expected behavior A clear and concise description of what you expected to happen.

Should still run the command since the command doesn't match the build directory.

Screenshots If applicable, add screenshots to help explain your problem.

( O)> Fix the compilation errors for this command "go build -o /dev/null ./cmd/tools/bindingsreplayer"
I'll fix it. I'll run the command to see the errors first.
─── shell | developer ──────────────────────────
command: go build -o /dev/null ./cmd/tools/bindingsreplayer


I see that the `go build` command is restricted in this environment. I can use other Go tools to check for compilation errors. I'll start by running `go vet` on the package to identify any issues.

Please provide following information:

  • OS & Arch: -- macos 15
  • Interface: CLI
  • Version: 1.0.27-canary+1326db2
  • Extensions enabled: Developer
  • Provider & Model: Gemini Pro 06-05

Additional context Add any other context about the problem here.

tkinz27 avatar Jun 13 '25 18:06 tkinz27

Also encountering this issue with commands that reference ignored paths as arguments, even when not actually accessing them.

Example: Command: grep -v node_modules

This gets blocked because the validation checks if "node_modules" exists as a path and is ignored, without understanding that grep -v means "exclude" rather than "access."

The root cause appears to be in validate_shell_command (in crates/goose-mcp/src/developer/rmcp_developer.rs), which context-blindly checks every non-flag argument to see if it exists as a path and matches ignore patterns, regardless of the command's actual intent.

This affects any command that mentions ignored paths in arguments: filtering, exclusion patterns, comparison operations, etc.

dianed-square avatar Oct 27 '25 18:10 dianed-square

the solution here is to just remove .gitignore as a synonym to .gooseignore but also revisit a bit on how the filtering works

DOsinga avatar Oct 31 '25 17:10 DOsinga