CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-conventional-changelog-writer

Write logs based on conventional commits and templates.

85

1.00x
Overview
Eval results
Files

task.mdevals/scenario-1/

Changelog Generator with Filtered Commits

Overview { .overview }

Build a changelog generator that filters commits before generating formatted changelog entries. The system should accept a collection of commit objects, apply filtering rules to remove unwanted commits, and then generate a properly formatted changelog string.

Requirements { .requirements }

Commit Filtering { .requirement }

Create a system that filters out commits based on specific criteria before changelog generation. The filtering should:

  • Remove commits that have been reverted (identified by revert patterns)
  • Exclude commits with invalid or missing type information
  • Only include commits that are marked as relevant for changelog inclusion

Changelog Generation { .requirement }

After filtering, generate a complete changelog string from the filtered commits:

  • Process commits in the appropriate order
  • Format commits according to conventional changelog standards
  • Include version information (use "1.0.0" as the version)
  • Group commits by their type (feat, fix, etc.)
  • Generate output as a single string containing the full changelog

Data Flow { .requirement }

The complete workflow should:

  1. Start with a collection of raw commit objects
  2. Apply filtering to remove unwanted commits
  3. Pass the filtered commits to the changelog writer
  4. Return the formatted changelog as a string

Input Format { .requirement }

Commit objects should follow this structure:

{
  hash: string,
  header: string,
  type: string,
  scope: string | null,
  subject: string,
  body: string | null,
  footer: string | null,
  notes: Array,
  references: Array
}

Dependencies { .dependencies }

conventional-changelog-writer { .dependency }

Provides changelog generation capabilities from structured commit data.

conventional-commits-filter { .dependency }

Provides commit filtering functionality to clean up commit data before changelog generation.

Test Cases { .test-cases }

Test 1: Filter and generate changelog from mixed commits { .test-case @test }

Input:

const commits = [
  {
    hash: 'abc123',
    header: 'feat: add new feature',
    type: 'feat',
    scope: null,
    subject: 'add new feature',
    body: null,
    footer: null,
    notes: [],
    references: []
  },
  {
    hash: 'def456',
    header: 'fix: fix bug',
    type: 'fix',
    scope: null,
    subject: 'fix bug',
    body: null,
    footer: null,
    notes: [],
    references: []
  },
  {
    hash: 'ghi789',
    header: 'revert: feat: add new feature',
    type: 'revert',
    scope: null,
    subject: 'feat: add new feature',
    body: 'This reverts commit abc123',
    footer: null,
    notes: [],
    references: [],
    revert: { hash: 'abc123' }
  }
];

Expected Behavior:

  • The revert commit and the reverted commit should both be filtered out
  • Only the fix commit should appear in the changelog
  • Output should contain the fix commit formatted in changelog style
  • Output should include version "1.0.0"

Test 2: Generate changelog from valid commits only { .test-case @test }

Input:

const commits = [
  {
    hash: 'aaa111',
    header: 'feat(parser): add parser support',
    type: 'feat',
    scope: 'parser',
    subject: 'add parser support',
    body: null,
    footer: null,
    notes: [],
    references: []
  },
  {
    hash: 'bbb222',
    header: 'docs: update readme',
    type: 'docs',
    scope: null,
    subject: 'update readme',
    body: null,
    footer: null,
    notes: [],
    references: []
  }
];

Expected Behavior:

  • Both commits should pass filtering
  • Changelog should contain both commits grouped by type
  • Features section should appear before docs section
  • Output should be a non-empty string with version "1.0.0"

Implementation Files { .implementation-files }

  • src/changelog-generator.js or src/changelog-generator.ts: Main implementation with filtering and generation logic
  • src/changelog-generator.test.js or src/changelog-generator.test.ts: Test file containing the test cases

Constraints { .constraints }

  • Use the filtering package to pre-process commits before passing them to the changelog writer
  • Ensure filtered commits are in the correct format expected by the changelog writer
  • Handle both sync and async data flows appropriately

Install with Tessl CLI

npx tessl i tessl/npm-conventional-changelog-writer

tile.json