Skip to content

feat: add .understandignore support for user-configurable file exclusion#81

Open
Lum1104 wants to merge 13 commits intomainfrom
feat/understandignore
Open

feat: add .understandignore support for user-configurable file exclusion#81
Lum1104 wants to merge 13 commits intomainfrom
feat/understandignore

Conversation

@Lum1104
Copy link
Copy Markdown
Owner

@Lum1104 Lum1104 commented Apr 10, 2026

Summary

  • New .understandignore file with .gitignore syntax for excluding files/directories from analysis
  • IgnoreFilter module in core that merges hardcoded defaults with user patterns, supporting ! negation to force-include
  • IgnoreGenerator module that auto-generates a commented-out starter file by scanning project structure
  • Phase 0.5 in /understand skill that generates the starter file and pauses for user review before scanning
  • bin/obj exclusions added to hardcoded defaults for .NET project support

Details

Core (packages/core)

  • ignore-filter.ts: Parses .understandignore using the ignore npm package, merges 3 layers (hardcoded defaults → .understand-anything/.understandignore → root .understandignore)
  • ignore-generator.ts: Scans for common directories (tests, docs, fixtures, etc.) and generates a starter file with all suggestions commented out
  • 28 new tests (418 total passing)

Agent (project-scanner.md)

  • Added bin/ and obj/ to hardcoded Build output exclusions
  • New Step 2.5 for deterministic .understandignore filtering after hardcoded filters
  • filteredByIgnore count in scan output schema

Skill (understand/SKILL.md)

  • New Phase 0.5 between Pre-flight and SCAN
  • Generates starter .understandignore on first run via deterministic Node.js script
  • Pauses and asks user to review before proceeding (hard gate)
  • Reports exclusion count after scan

Test plan

  • Core package builds cleanly
  • Skill package builds cleanly
  • 418/418 tests pass (16 ignore-filter + 12 ignore-generator + existing)
  • Run /understand on a project — verify Phase 0.5 generates starter file and pauses
  • Verify .understandignore patterns actually exclude files from scan results
  • Verify !dist/ negation force-includes dist/ files
  • Verify filteredByIgnore count appears in scan output

🤖 Generated with Claude Code

Lum1104 and others added 12 commits April 9, 2026 22:56
…se plugin

New skill that takes markdown knowledge bases (Obsidian, Logseq, Dendron, Foam,
Karpathy-style, Zettelkasten, plain) and produces interactive knowledge graphs
with typed nodes/edges, auto-format detection, and dashboard visualization.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Detailed step-by-step plan covering core type extensions, schema validation,
dashboard changes (CSS, store, sidebar, reading panel, edge styling, layout),
agent definitions, format guides, and skill definition.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move all design docs to docs/superpowers/specs/ and all implementation
plans to docs/superpowers/plans/ for consistent organization.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
User-configurable file exclusion using .gitignore syntax, with hardcoded
defaults, auto-generated starter file, and pre-analysis review pause.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
TDD-driven plan covering IgnoreFilter module, IgnoreGenerator, core exports,
project-scanner agent update, and skill Phase 0.5 integration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…d tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…eation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…project-scanner

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

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

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: 59a6f56bfe

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

".cache/",
".turbo/",
"target/",
"bin/",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Stop excluding all bin/ directories by default

The new default pattern bin/ removes every file under any bin directory, which is broader than “.NET build output” and now hides legitimate source entrypoints in common layouts (for example Node/Ruby CLI launchers committed under bin/). This directly reduces scan accuracy for those projects even when users never configured .understandignore; the exclusion should be narrowed to .NET artifact paths or applied conditionally after detecting a .NET project.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed. Removed bin/ from defaults (Node/Ruby use it for CLI launchers). Fixed negation override by re-filtering from original file list when .understandignore exists.

Comment on lines +68 to +69
4. Filter the remaining file list through these patterns. Files matching any pattern are excluded.
5. `!` negation patterns override the hardcoded exclusions from Step 2 (e.g., `!dist/` force-includes files from dist/).
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Apply ignore negations before default-filter drops files

Step 2.5 currently says to filter the remaining list and also claims ! patterns can override Step 2 exclusions, but those two rules conflict: once Step 2 removes dist/* (or other defaults), a later pass over the remaining files cannot re-include them. In practice, users who add !dist/ will still not get dist files back, so the advertised override behavior is broken unless defaults and user patterns are evaluated in one matcher over the pre-filter candidate set.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed. Updated Step 2.5 — when .understandignore exists, createIgnoreFilter re-filters the original Step 1 file list (not the post-Step-2 remainder), merging defaults and user patterns in a single ignore instance so ! negation works correctly.

…erride flow

- Remove bin/ from DEFAULT_IGNORE_PATTERNS (Node/Ruby CLI launchers use bin/)
- .NET users can add bin/ to .understandignore manually
- Fix project-scanner Step 2.5 to re-filter from original file list when
  .understandignore exists, ensuring ! negation correctly overrides defaults

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Lum1104
Copy link
Copy Markdown
Owner Author

Lum1104 commented Apr 10, 2026

@codex review this

Copy link
Copy Markdown

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

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: d3de6dc1fd

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

1. Check if `$PROJECT_ROOT/.understand-anything/.understandignore` exists. If so, read it.
2. Check if `$PROJECT_ROOT/.understandignore` exists. If so, read it.
3. If neither file exists, skip this step entirely — Step 2's hardcoded filtering is sufficient.
4. If at least one file exists, re-filter the **original file list from Step 1** (not the Step 2 output) using the `createIgnoreFilter` function from `@understand-anything/core`, which merges hardcoded defaults and user patterns into a single `.gitignore`-compatible matcher. This ensures `!` negation in user files can override hardcoded defaults (e.g., `!dist/` force-includes dist/ files).
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid requiring @understand-anything/core in scan scripts

This step makes the generated scanner script depend on @understand-anything/core from the scanned project context, but the script is executed under $PROJECT_ROOT and most target repositories will not have that package installed. In that environment, enabling .understandignore support causes a runtime module-resolution failure (MODULE_NOT_FOUND) and prevents scanning from completing; this is especially likely because Phase 0.5 now creates .understandignore on first run. Please keep Step 2.5 self-contained (or reference a guaranteed-resolvable path) so scans do not fail on ordinary projects.

Useful? React with 👍 / 👎.

# Use ! prefix to force-include something excluded by defaults.
#
# Built-in defaults (always excluded unless negated):
# node_modules/, .git/, dist/, build/, bin/, obj/, *.lock, *.min.js, etc.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fix starter header to match actual default exclusions

The generated .understandignore header says bin/ is a built-in default exclusion, but DEFAULT_IGNORE_PATTERNS does not exclude bin/. This mismatch can mislead users into thinking bin/ is already filtered, so they may not add an explicit rule and end up scanning large build-output trees (notably in .NET repos), increasing scan time and noise. The header should reflect real defaults (or defaults should be aligned to the header).

Useful? React with 👍 / 👎.

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.

1 participant