Skip to content

feat(cz): add conditional scope requirements based on file patterns #65

@vabatta

Description

@vabatta

Problem

Currently require-scope is a binary setting - scopes are either always required or always optional. This doesn't accommodate workflows where:

  • Service/package changes should require a scope (for changelog generation)
  • Root config files or CI changes could be scopeless (trivial maintenance)

Use Case

In a monorepo with release-please generating per-service changelogs, we want:

feat(teams-mcp): add feature    # Required - goes to teams-mcp changelog
chore: update deps              # Allowed - root files only, no changelog impact
chore: fix workflow             # Allowed - .github/** only, no changelog impact
feat: new feature               # BLOCKED - touching services without scope corrupts changelogs

Proposed Solution

Add a new setting like require-scope-unless-patterns:

[settings]
require-scope = true
require-scope-unless-patterns = *, .*, .github/**

Behavior:

  • Scope is required by default (require-scope = true)
  • BUT if ALL files match require-scope-unless-patterns, scope becomes optional
  • If ANY file doesn't match the exception patterns, scope is required

Alternative Syntax Options

# Option A: Explicit exception patterns
require-scope-unless-patterns = *, .*, .github/**

# Option B: Reference existing scopes
require-scope-unless-scopes = main, ci

# Option C: Invert - define which patterns require scope
require-scope-for-patterns = services/**, packages/**

Current Workaround

Set require-scope = false and rely on team discipline + code review. This is error-prone for changelog-sensitive repositories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions