Skip to content

Conversation

@nandastone
Copy link

@nandastone nandastone commented Jan 8, 2026

Adds support for .stashignore files that allow users to exclude files and directories from scanning using gitignore-style patterns. Closes #1139.

Some LLM usage as Go is not my preferred language.

Changes

  • New StashIgnoreFilter in pkg/file/stashignore.go that checks for .stashignore files during scans
  • Integrated into scanFilter alongside existing exclusion logic. The scanner doesn't appear to expose plugin hooks for file filtering.
  • Supports nested .stashignore files (patterns cascade from library root to subdirectories)
  • Uses go-gitignore library for pattern matching
  • Added user documentation in Tasks.md

Usage

Place a .stashignore file in any directory within your library:

# Ignore temp files

*.tmp
temp/

# But keep this one

!important.tmp

Test Plan

  • 16 unit tests covering pattern syntax (wildcards, negation, nested files, etc.)
  • 4 integration tests with real scanner and database
  • All existing tests pass

@feederbox826
Copy link
Collaborator

Why not extend or interface with it from the existing ignores menu?

@nandastone
Copy link
Author

nandastone commented Jan 9, 2026

Why not extend or interface with it from the existing ignores menu?

Different mental models:

  • Global excludes = "never scan X anywhere" (admin policy).
  • .stashignore = "in this folder, skip these" (local override). Both are valid, complementary use cases.

The .stashignore file lives with your content. You see what's ignored by looking at the folder. You can share it, back it up, version control it, etc.

And finally, glob syntax (as opposed to regex) is a familiar convention: .gitignore, .dockerignore, .npmignore, etc. The different syntax is why the PR doesn't "append" the discovered file rules to the existing regex rules system.

We also wouldn't want to try and "sync" the .stashignore rules to the regex rules, a two way sync would be brittle and complex.

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.

[Feature] add ignore file to ignore a folder during scanning

2 participants