From 4fef78d0cafaaeeddbd02c99c49b37f6e5249740 Mon Sep 17 00:00:00 2001 From: Rizel Scarlett Date: Wed, 11 Jun 2025 01:52:50 -0400 Subject: [PATCH 1/3] Docs: Goose now respects gooseignore files --- .../docs/guides/using-gooseignore.md | 63 ++++++++++++------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/documentation/docs/guides/using-gooseignore.md b/documentation/docs/guides/using-gooseignore.md index 8c58de4aca4a..005ace87af1c 100644 --- a/documentation/docs/guides/using-gooseignore.md +++ b/documentation/docs/guides/using-gooseignore.md @@ -23,24 +23,6 @@ Goose supports two types of `.gooseignore` files: You can use both global and local `.gooseignore` files simultaneously. When both exist, Goose will combine the restrictions from both files to determine which paths are restricted. ::: -## Automatic `.gitignore` fallback - -If no `.gooseignore` file is found in your current directory, Goose will automatically use your `.gitignore` file as a fallback. This means: - -1. **Priority Order**: Goose checks for ignore patterns in this order: - - Global `.gooseignore` (if exists) - - Local `.gooseignore` (if exists) - - Local `.gitignore` (if no local `.gooseignore` and `.gitignore` exists) - - Default patterns (if none of the above exist) - -2. **Seamless Integration**: Projects with existing `.gitignore` files get automatic protection without needing a separate `.gooseignore` file. - -3. **Override Capability**: Creating a local `.gooseignore` file will completely override `.gitignore` patterns for that directory. - -:::info Debug logging -When Goose uses `.gitignore` as a fallback, it will log a message to help you understand which ignore file is being used. -::: - ## Example `.gooseignore` file In your `.gooseignore` file, you can write patterns to match files you want Goose to ignore. Here are some common patterns: @@ -65,18 +47,52 @@ downloads/ # Ignore everything in the "downloads" directory !error.log # Except for error.log file ``` -## Default patterns +## Ignore File Types and Priority +Goose respects ignore rules from three sources: global `.gooseignore`, local `.gooseignore`, and `.gitignore`. It uses a priority system to determine which files should be ignored. + +### 1. Global `.gooseignore` +- Highest priority and always applied first +- Located at `~/.config/goose/.gooseignore` +- Affects all projects on your machine + +``` +~/.config/goose/ +└── .gooseignore ← Applied to all projects +``` -By default, if you haven't created any `.gooseignore` files **and no `.gitignore` file exists**, Goose will not modify files matching these patterns: +### 2. Local `.gooseignore` +- Project-specific rules +- Located in your project root directory +- Overrides `.gitignore` completely +``` +~/.config/goose/ +└── .gooseignore ← Global rules applied first + +Project/ +├── .gooseignore ← Local rules applied second +├── .gitignore ← Ignored when .gooseignore exists +└── src/ +``` + +### 3. `.gitignore` Fallback +- Used when no local `.gooseignore` exists +- Goose automatically uses your Git ignore rules + +``` +Project/ +├── .gitignore ← Used by Goose +└── src/ +``` + +### 4. Default Patterns +By default, if you haven't created any .gooseignore files and no .gitignore file exists, Goose will not modify files matching these patterns: ```plaintext **/.env **/.env.* **/secrets.* ``` -These default patterns only apply when neither `.gooseignore` nor `.gitignore` files are found in your project. - ## Common use cases Here are some typical scenarios where `.gooseignore` is helpful: @@ -86,5 +102,4 @@ Here are some typical scenarios where `.gooseignore` is helpful: - **Important Configurations**: Protect critical configuration files from accidental modifications - **Version Control**: Prevent changes to version control files like `.git` directory - **Existing Projects**: Most projects already have `.gitignore` files that work automatically as ignore patterns for Goose -- **Custom Restrictions**: Create `.gooseignore` when you need different patterns than your `.gitignore` (e.g., allowing Goose to read files that Git ignores) - +- **Custom Restrictions**: Create `.gooseignore` when you need different patterns than your `.gitignore` (e.g., allowing Goose to read files that Git ignores) \ No newline at end of file From de3da414172d33b312149ce0f5d4bd128ef413c3 Mon Sep 17 00:00:00 2001 From: Rizel Scarlett Date: Wed, 11 Jun 2025 11:18:31 -0400 Subject: [PATCH 2/3] Update documentation/docs/guides/using-gooseignore.md Co-authored-by: dianed-square <73617011+dianed-square@users.noreply.github.com> --- documentation/docs/guides/using-gooseignore.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/guides/using-gooseignore.md b/documentation/docs/guides/using-gooseignore.md index 005ace87af1c..fb323c207563 100644 --- a/documentation/docs/guides/using-gooseignore.md +++ b/documentation/docs/guides/using-gooseignore.md @@ -86,7 +86,7 @@ Project/ ``` ### 4. Default Patterns -By default, if you haven't created any .gooseignore files and no .gitignore file exists, Goose will not modify files matching these patterns: +By default, if you haven't created any `.gooseignore` files and no `.gitignore` file exists, Goose will not modify files matching these patterns: ```plaintext **/.env **/.env.* From 83d22b46237ba4bf08b420e91950fca9afc4c429 Mon Sep 17 00:00:00 2001 From: Rizel Scarlett Date: Wed, 11 Jun 2025 15:36:16 -0400 Subject: [PATCH 3/3] adding clarity --- documentation/docs/guides/using-gooseignore.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/documentation/docs/guides/using-gooseignore.md b/documentation/docs/guides/using-gooseignore.md index fb323c207563..fb526b7a3dbe 100644 --- a/documentation/docs/guides/using-gooseignore.md +++ b/documentation/docs/guides/using-gooseignore.md @@ -77,16 +77,17 @@ Project/ ### 3. `.gitignore` Fallback - Used when no local `.gooseignore` exists -- Goose automatically uses your Git ignore rules +- Goose automatically uses your `.gitignore` rules +- If a global `.gooseignore` file exists, those rules will be applied in addition to the `.gitignore` patterns. ``` Project/ -├── .gitignore ← Used by Goose +├── .gitignore ← Used by Goose (when no local .gooseignore) └── src/ ``` ### 4. Default Patterns -By default, if you haven't created any `.gooseignore` files and no `.gitignore` file exists, Goose will not modify files matching these patterns: +By default, if you haven't created any .gooseignore files and no .gitignore file exists, Goose will not modify files matching these patterns: ```plaintext **/.env **/.env.*