or run

npx @tessl/cli init
Log in

Version

Files

tile.json

task.mdevals/scenario-7/

Interactive Commit Message Builder

Build a command-line tool that provides an interactive interface for creating standardized Git commit messages following the Conventional Commits specification.

Requirements

Your tool should:

  1. Prompt for commit type: Present the user with standard commit types (feat, fix, docs, style, refactor, test, chore) and allow them to select one interactively.

  2. Prompt for scope: Allow the user to optionally enter a scope for the commit (e.g., "api", "ui", "core"). The scope should be optional and can be skipped.

  3. Prompt for subject: Request a short, descriptive subject line for the commit. The subject should have a maximum length of 72 characters and display real-time character count feedback.

  4. Prompt for body: Allow the user to optionally enter a longer commit message body with support for multiple lines. This should be skippable.

  5. Generate formatted message: Combine all inputs into a properly formatted commit message following this structure:

    <type>(<scope>): <subject>
    
    [body]
  6. Display preview: Show the complete formatted commit message to the user before finalizing.

The tool should validate inputs and provide clear feedback during the interaction process.

Test Cases

  • Given the user selects type "feat", scope "auth", and subject "add login functionality", the tool generates a message: "feat(auth): add login functionality" @test

  • Given the user selects type "fix", no scope, and subject "resolve memory leak", the tool generates a message: "fix: resolve memory leak" @test

  • Given the user enters a subject exceeding 72 characters, the tool provides validation feedback indicating the limit @test

  • Given the user selects type "docs", scope "readme", subject "update installation steps", and body "Added Docker installation instructions", the tool generates a properly formatted multi-line message @test

@generates

API

/**
 * Main function to start the interactive commit message builder
 * Returns a promise that resolves to the formatted commit message
 */
export function buildCommitMessage(): Promise<string>;

/**
 * Configuration options for customizing the commit message builder
 */
export interface CommitMessageConfig {
  types?: Array<{ value: string; name: string }>;
  maxSubjectLength?: number;
  scopes?: string[];
}

/**
 * Start the interactive builder with custom configuration
 */
export function buildCommitMessageWithConfig(
  config: CommitMessageConfig
): Promise<string>;

Dependencies { .dependencies }

cz-git { .dependency }

Provides interactive commit message generation capabilities.