CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-standard-changelog

Generate a changelog from git metadata with Angular commit convention.

Pending
Overview
Eval results
Files

cli-interface.mddocs/

CLI Interface

Command-line interface for generating changelogs with extensive configuration options and flexible output control.

Capabilities

CLI Command

The main command-line interface for standard-changelog.

standard-changelog [options]

Basic Usage Examples:

# Generate changelog for current release
standard-changelog

# Generate changelog for first release (includes all commits)
standard-changelog --first-release

# Output to stdout instead of file
standard-changelog --stdout

# Append to existing changelog instead of prepending
standard-changelog --append

# Generate changelog with verbose output
standard-changelog --verbose

# Generate changelog for specific number of releases
standard-changelog --release-count 3

# Use custom input/output files
standard-changelog --infile HISTORY.md --outfile CHANGELOG.md

CLI Flags

Complete set of command-line flags for configuring changelog generation.

interface Flags {
  /** Input file path (default: CHANGELOG.md) */
  infile?: string;
  /** Output file path (default: same as infile) */
  outfile?: string;
  /** Output to stdout instead of file */
  stdout?: boolean;
  /** Preset name to use (default: angular) */
  preset?: string;
  /** Path to package.json file */
  pkg?: string;
  /** Append newer release to older release (default: false) */
  append?: boolean;
  /** Number of releases to generate (default: 1, 0 = all) */
  releaseCount?: number;
  /** Skip unstable tags (alpha, beta, rc) */
  skipUnstable?: boolean;
  /** Output unreleased changelog */
  outputUnreleased?: boolean;
  /** Verbose output for debugging */
  verbose?: boolean;
  /** Path to configuration file */
  config?: string;
  /** Path to context JSON file */
  context?: string;
  /** Generate changelog for first release */
  firstRelease?: boolean;
  /** Generate changelog for specific lerna package */
  lernaPackage?: string;
  /** Tag prefix to consider when reading tags */
  tagPrefix?: string;
  /** Generate changelog scoped to specific directory */
  commitPath?: string;
}

Flag Details

Input/Output Control

# -i, --infile <path>
# Read the CHANGELOG from this file (default: CHANGELOG.md)
standard-changelog -i HISTORY.md

# -o, --outfile <path>  
# Write the CHANGELOG to this file (default: same as infile)
standard-changelog -o CHANGELOG.md

# --stdout
# Output the result to stdout
standard-changelog --stdout

Release Configuration

# -f, --first-release
# Generate the CHANGELOG for the first time (includes all commits)
standard-changelog --first-release

# -r, --release-count <number>
# How many releases to generate (default: 1, 0 = regenerate all)
standard-changelog --release-count 3

# --skip-unstable
# Skip unstable tags like x.x.x-alpha.1, x.x.x-rc.2
standard-changelog --skip-unstable

# -u, --output-unreleased
# Output unreleased changelog
standard-changelog --output-unreleased

Behavior Control

# -a, --append
# Append newer release to older release (default: false)
standard-changelog --append

# -v, --verbose
# Verbose output for debugging
standard-changelog --verbose

# -t, --tag-prefix <prefix>
# Tag prefix to consider when reading tags
standard-changelog --tag-prefix v

# --commit-path <path>
# Generate changelog scoped to specific directory
standard-changelog --commit-path packages/core

Advanced Configuration

# -p, --preset <name>
# Name of preset to use (default: angular)
standard-changelog --preset conventionalcommits

# -k, --pkg <path>
# Path to package.json file
standard-changelog --pkg ./packages/core/package.json

# -n, --config <path>
# Path to configuration script
standard-changelog --config ./changelog.config.js

# -c, --context <path>
# Path to JSON file with template variables
standard-changelog --context ./changelog-context.json

# -l, --lerna-package <package>
# Generate changelog for specific lerna package
standard-changelog --lerna-package my-package@1.0.0

runProgram Function

The main function that processes CLI flags and executes changelog generation.

/**
 * Main CLI program runner that processes flags and generates changelog
 * @param generator - StandardChangelog or ConventionalChangelog instance
 * @param flags - Parsed CLI flags
 */
async function runProgram(
  generator: ConventionalChangelog,
  flags: Flags
): Promise<void>;

Usage Example:

import { StandardChangelog, runProgram } from "standard-changelog";

// Programmatic CLI usage
const generator = new StandardChangelog(process.cwd());
const flags = {
  infile: "CHANGELOG.md",
  outfile: "CHANGELOG.md",
  releaseCount: 1,
  verbose: true
};

await runProgram(generator, flags);

Flag Definitions

The exported flags object defines all available CLI options with their configurations.

const flags = {
  infile: { shortFlag: 'i', default: 'CHANGELOG.md', type: 'string' },
  outfile: { shortFlag: 'o', type: 'string' },
  stdout: { type: 'boolean' },
  preset: { shortFlag: 'p', type: 'string' },
  pkg: { shortFlag: 'k', type: 'string' },
  append: { shortFlag: 'a', type: 'boolean' },
  releaseCount: { shortFlag: 'r', type: 'number' },
  skipUnstable: { type: 'boolean' },
  outputUnreleased: { shortFlag: 'u', type: 'boolean' },
  verbose: { shortFlag: 'v', type: 'boolean' },
  config: { shortFlag: 'n', type: 'string' },
  context: { shortFlag: 'c', type: 'string' },
  firstRelease: { shortFlag: 'f', type: 'boolean' },
  lernaPackage: { shortFlag: 'l', type: 'string' },
  tagPrefix: { shortFlag: 't', type: 'string' }
} as const;

Common CLI Workflows

First Release

# Generate initial changelog including all commits
standard-changelog --first-release

Regular Release

# Generate changelog for latest release only
standard-changelog

# Or explicitly specify single release
standard-changelog --release-count 1

Multi-Release Update

# Generate changelog for last 3 releases
standard-changelog --release-count 3

# Regenerate entire changelog
standard-changelog --release-count 0

Custom File Handling

# Use different input/output files
standard-changelog --infile HISTORY.md --outfile CHANGELOG.md

# Append to existing changelog
standard-changelog --append

# Output to terminal only
standard-changelog --stdout

Debugging and Development

# Verbose output for troubleshooting
standard-changelog --verbose

# Generate unreleased changes
standard-changelog --output-unreleased

# Skip pre-release tags
standard-changelog --skip-unstable

Install with Tessl CLI

npx tessl i tessl/npm-standard-changelog

docs

cli-interface.md

index.md

standard-changelog-api.md

tile.json