Skip to content

Include/Exclude glob patterns for diff scanning #15

@LeeSinLiang

Description

@LeeSinLiang

Include/Exclude glob patterns for diff scanning

Summary
Add include / exclude glob arrays in .commitlm-config.json to filter which files influence commit message & doc generation.

Motivation
Ignoring docs/**, lockfiles, binaries, or vendor folders reduces token usage and noise.

Proposed config shape

{
  "include": ["src/**", "app/**"],
  "exclude": ["docs/**", "**/*.lock", "**/*.min.*", "node_modules/**", "*.png", "*.jpg"]
}

Scope

  • Apply patterns to both commit message and documentation generation paths.
  • Precedence: evaluate include first, then apply exclude.
  • Cross-platform support (Windows path separators).

Tasks

  • Parse arrays from config; implement precedence.
  • Use robust matching (e.g., pathspec or fnmatch) with repository root context.
  • Unit tests for common patterns and nested repos.
  • README section with examples.

Acceptance criteria

  • Files matching exclude never influence prompts.
  • Patterns work on Linux/macOS/Windows.
  • Tests cover at least 6 representative patterns.

Test plan
Create a temp repo with mixed files; assert only expected files feed the generator.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthacktoberfestFor Hacktoberfest Participants!help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions