Skip to content

Feat/stageignore#51

Merged
dastratakos merged 6 commits into
ReviewStage:mainfrom
onequbitaway:feat/stageignore
Jun 1, 2026
Merged

Feat/stageignore#51
dastratakos merged 6 commits into
ReviewStage:mainfrom
onequbitaway:feat/stageignore

Conversation

@onequbitaway

@onequbitaway onequbitaway commented May 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds .stageignore support — a repo-level config file that lets users exclude files from Stage's diff analysis using glob patterns, similar to .gitignore. This solves the problem of auto-generated or project-specific files (build
artifacts, generated configs, vendor directories) bloating the LLM context when the built-in denylist doesn't cover them.

Changes

  • Added loadStageIgnorePatterns() to filter-files.ts to read and parse .stageignore from the repo root
  • Extended filterFilesForLlm() to accept optional ignore patterns, matched via picomatch
  • Wired pattern loading into both prep.ts and show.ts so both commands respect the same ignore file
  • Added picomatch as a dependency for glob matching
  • Added 9 new tests covering pattern matching, comment/blank line handling, combination with built-in denylist, and empty/missing file edge cases
  • Documented .stageignore usage in the README

Testing

  • All 183 existing CLI tests pass, 9 new tests added (64 total in filter-files.test.ts)
  • Lint passes clean via Biome
  • Manually tested against a real repo where build/config.gypi (520 lines of auto-generated node-gyp config) was being included in the diff — confirmed it is excluded with a .stageignore containing build/**
  • Verified excluded files still appear in the "Other changes" chapter
  • Verified no behavior change when .stageignore is absent

Open in Stage

Summary by cubic

Adds .stageignore support to exclude files from diff analysis using .gitignore-style patterns. Both stage prep and stage show load patterns from the repo root, and matching follows gitignore semantics.

  • New Features

    • Read .stageignore with gitignore semantics: comments, blank lines, negation, root anchoring, directory patterns; slashless globs match nested files; last match wins.
    • Merges with the built-in denylist; excluded files still appear under "Other changes".
    • Added loadStageIgnore() and integrated into both commands. README and tests updated (including empty-file case).
  • Dependencies

    • Added ignore.
    • Removed picomatch and @types/picomatch.

Written for commit 08296dd. Summary will update on new commits.

Review in cubic

@stage-review

stage-review Bot commented May 23, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 5 individual chapters for you:

Title
1 Add ignore dependency and documentation
2 Implement .stageignore loading and filtering logic
3 Wire ignore logic into prep and show commands
4 Test pattern matching and ignore file loading
5 Other changes
Open in Stage

Chapters generated by Stage for commit 08296dd on Jun 2, 2026 12:15am UTC.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for a .stageignore file, allowing users to exclude specific files or directories from the diff analysis using glob patterns. The implementation includes a new utility to load patterns from the repository root and updates to the file filtering logic using the picomatch library. A review comment identifies a potential issue with the current filtering logic where splitting patterns into slash-containing and slash-less groups breaks negation support; it suggests using a single picomatch call with matchBase: true to preserve correct behavior.

Comment thread packages/cli/src/filter-files.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c42cfac87c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/cli/src/filter-files.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b2fbb7abed

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/cli/src/filter-files.ts Outdated

Copy link
Copy Markdown
Contributor

sweet!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 29844d11ef

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/cli/src/filter-files.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 57f1f0a2ac

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/cli/src/filter-files.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1500e1b15c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/cli/src/filter-files.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b882f93af1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/cli/src/filter-files.ts Outdated
@dastratakos dastratakos enabled auto-merge (squash) May 26, 2026 23:10
@dastratakos dastratakos disabled auto-merge May 26, 2026 23:11

@dastratakos dastratakos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

see comment about ignore package, which I think is more standard.

Comment thread packages/cli/src/filter-files.ts Outdated
Justin08 and others added 6 commits June 1, 2026 16:52
Allow users to place a .stageignore file in the repo root with glob
patterns to exclude files from diff analysis. Uses picomatch for
matching. Excluded files still appear in the "Other changes" chapter.
Patterns without slashes (e.g. *.generated.ts) now match files in
subdirectories, aligning with .gitignore behavior. Patterns with
slashes keep the default picomatch behavior.
Patterns prefixed with ! re-include previously excluded files,
following .gitignore semantics (last matching pattern wins). Each
pattern is compiled individually so matchBase is applied per-pattern
based on whether it contains a slash.
Per review feedback: the ignore package implements gitignore semantics
natively (comments, blank lines, negation, anchoring), so the hand-rolled
compile/match layer is no longer needed.

- Replace picomatch + @types/picomatch with ignore@^7.0.5
- Rename loadStageIgnorePatterns -> loadStageIgnore (returns Ignore | null)
- Drop CompiledPattern, compileIgnorePatterns, isIgnoredByPatterns
- Update prep.ts and show.ts callers
- Update tests to construct Ignore instances directly; add empty-file test
- README: clarify ".gitignore-style patterns" instead of "glob patterns"

Minor behavior change: leading whitespace on a pattern is no longer
stripped (the previous code did line.trim()). This aligns with the
gitignore spec, which strips only trailing whitespace.
@dastratakos dastratakos enabled auto-merge (squash) June 1, 2026 21:43
@dastratakos dastratakos merged commit 59a8c9a into ReviewStage:main Jun 1, 2026
2 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