or run

npx @tessl/cli init
Log in

Version

Files

tile.json

task.mdevals/scenario-9/

Commit Message Subject Formatter

Build a utility that formats commit message subjects with configurable capitalization rules. The formatter should support three transformation strategies to ensure consistency in commit messages.

Requirements

Implement a subject formatter that:

  1. Accepts a commit message subject string and configuration options
  2. Applies one of three transformation modes based on configuration:
    • Uppercase: Force the first letter to uppercase
    • Lowercase: Force the first letter to lowercase
    • Preserve: Keep the original capitalization unchanged
  3. Handles empty strings gracefully
  4. Returns the transformed subject string

Test Cases

  • Given subject "fix authentication bug" with uppercase mode enabled, returns "Fix authentication bug" @test
  • Given subject "Add new feature" with lowercase mode enabled, returns "add new feature" @test
  • Given subject "Update README" with preserve mode enabled, returns "Update README" unchanged @test
  • Given an empty string with any mode, returns an empty string @test

Implementation

@generates

API

/**
 * Formats a commit message subject according to the specified case transformation mode.
 *
 * @param {string} subject - The raw commit message subject to format
 * @param {object} options - Configuration options
 * @param {boolean|null} options.upperCaseSubject - Transformation mode:
 *   - true: Force uppercase first letter
 *   - false: Force lowercase first letter
 *   - null: Preserve original capitalization
 * @returns {string} The formatted subject string
 */
function formatSubject(subject, options) {
  // IMPLEMENTATION HERE
}

module.exports = {
  formatSubject
};

Dependencies { .dependencies }

czg { .dependency }

Provides commit message generation and formatting capabilities including subject case transformation.

@satisfied-by