@hyperfrontend/versioning§
Nobody picks the version here. The breaking marker in the header is what makes this release a major, and everything on the right is derived from that one line.
Versioning library with changelog parsing, conventional commits, and semver flow orchestration.
• 👉 See roadmap
What is @hyperfrontend/versioning?
@hyperfrontend/versioning provides a comprehensive toolkit for managing software versioning in JavaScript/TypeScript projects. The library is built on a purely functional architecture with factory functions, immutable data structures, and composable operations.
Key Features
Interactive Commit Author (
cz)npx czlaunches a keystroke-live conventional-commit session (type, scope, subject countdown, body, breaking marker, issues, preview, commit) with clipboard-paste support and terminal-resize redrawCommit Validator (
cl)npx cl <path>plugs into anycommit-msggit hook to enforce your rulesetChangelog Parsing
Parse CHANGELOG.md files into structured objects with lossless round-tripping
Conventional Commits
Parse, validate, format, and classify messages following the Conventional Commits specification
Semver Utilities
Parse, compare, increment, and validate semantic versions
Registry Client
Query npm registry for published versions and package metadata
Compare URLs
Generate platform-specific compare URLs for changelog entries (GitHub, GitLab, Bitbucket, Azure DevOps)
Monorepo Scope Filtering
Intelligent commit classification ensures changelogs only include relevant commits
Composable Operations
Build complex versioning workflows from simple, pure functions
Zero External Dependencies
Self-contained implementation with no third-party runtime dependencies
Why Use @hyperfrontend/versioning?
Type-Safe Changelog Manipulation
Working with CHANGELOG.md files programmatically typically involves fragile string manipulation. This library parses changelogs into fully typed data structures with factory functions for creating entries, sections, and items. Modify changelog content with confidence using immutable operations and round-trip safely back to markdown.
Unified Versioning Primitives
Version management requires coordinating semver parsing, commit analysis, changelog generation, and registry queries. This library provides all these primitives in one cohesive package with consistent APIs. Query npm for published versions, parse commit history, calculate version bumps, and generate changelog entries, all composable into custom release workflows.
Zero-Dependency CI Integration
Designed for automated pipelines where minimal attack surface matters. Zero external runtime dependencies and state-machine parsing ensure predictable performance on any input. All parsers enforce input length limits to prevent resource exhaustion.
One-Stop Commit Toolchain
The interactive cz and validator cl bins cover the same ground as commitizen + cz-conventional-changelog + @commitlint/cli, in one package, without patch-package workarounds, with a config-driven session (commit.config.{js,mjs,cjs}), a live 72-char header countdown, and scope choices derived from staged files. Acknowledgment to those projects: they shaped the conventions this library now implements natively.
Installation
npm install @hyperfrontend/versioning
Quick Start
Parsing a Changelog
import { parseChangelog } from '@hyperfrontend/versioning'
import fs from 'fs'
// Parse existing changelog content
const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
const changelog = parseChangelog(content)
// Access entries
for (const entry of changelog.entries) {
console.log(`Version ${entry.version} - ${entry.date}`)
for (const section of entry.sections) {
console.log(` ${section.heading}: ${section.items.length} changes`)
}
}
// Access metadata
// Formats: 'keep-a-changelog' (https://keepachangelog.com), 'conventional', etc.
console.log(changelog.metadata.format)
Parsing Conventional Commits
import { parseConventionalCommit } from '@hyperfrontend/versioning'
const commit = parseConventionalCommit('feat(api): add user authentication')
console.log(commit.type) // 'feat'
console.log(commit.scope) // ['api'], an array because `feat(a,b): x` names two
console.log(commit.subject) // 'add user authentication'
console.log(commit.breaking) // false
Checking for Breaking Changes
import { parseConventionalCommit } from '@hyperfrontend/versioning'
// Breaking change via !
const commit1 = parseConventionalCommit('feat(api)!: remove deprecated endpoint')
console.log(commit1.breaking) // true
// Breaking change via footer
const commit2 = parseConventionalCommit(\`fix: update API response format
BREAKING CHANGE: Response structure has changed\`)
console.log(commit2.breaking) // true
console.log(commit2.breakingDescription) // 'Response structure has changed'
API Overview
The package publishes one subpath per concern, and the name of the import is the job it does. commits parses, validates, classifies and authors conventional commit messages. changelog reads and writes CHANGELOG.md. semver parses, compares and increments versions and ranges. git, registry and workspace cover the three things a release has to ask the world outside the process: the repository, the npm registry, and the packages on disk. repository turns a remote URL into the compare links a changelog entry carries. flow composes the rest into a release. The root entry re-exports all of them.
parseConventionalCommit is where most work starts: hand it the raw message and it returns a ConventionalCommit carrying type, subject, breaking, the parsed footers and a scope that is a readonly string[] rather than a string, because feat(a,b): x names two. Its type and breaking go to getSemverBump, which answers major, minor, patch or none, and that answer plus a parsed version goes to increment. All three are pure functions over plain data.
parseChangelog turns a CHANGELOG.md into an addressable tree of entries, sections and items, and serializeChangelog writes that tree back to markdown, so a file read and rewritten unedited comes back as itself. Those parsers, and the commit parsers beside them, are hand-written character state machines rather than regular expressions, and each refuses oversized input before it begins, which is why no pathological changelog can stall a release job.
Two bins ship alongside the API, and neither asks you to import anything: npx cz runs the interactive session that authors a conventional commit, and npx cl <path> validates one message from a commit-msg hook. For unattended releases, createConventionalFlow assembles the ordered steps (fetch the published version, analyse commits, calculate the bump, generate the changelog entry, update package.json, write, commit, tag) and executeFlow runs them against a virtual file system, so a dry run reports the whole diff without touching disk.
Every model, option, step and outcome type is in the API reference.
Compatibility
Runs on
- Node.js>=18.0.0supported
- Browsersnot supported
- Web Workersnot supported
Ships as
- ESMTree-shakeable
- CJSNode and older bundlers
- CLIcz, cl
Security
All parsers use state-machine tokenization with O(n) complexity and enforce input length limits (commit messages: 10KB, changelog files: 1MB) to prevent resource exhaustion. Character-by-character parsing eliminates regex-based vulnerabilities.
Architecture Highlights§
Parsing is bounded and predictable: every parser is a character-by-character state machine rather than a regular expression, so no input pattern can trigger catastrophic backtracking. Each entry point also rejects oversized input before processing it (10,000 characters for a commit message, 1 MB for a changelog file, 256 for a version string, 214 for a package name).
API Reference§
Module Structure
39 modules · 1862 total exports
@hyperfrontend/versioning
Version management toolkit with semver, changelog, git operations, and workspace coordination.
@hyperfrontend/versioning/changelog
Comprehensive Keep-a-Changelog module with parsing, serialization, comparison, and operations.
@hyperfrontend/versioning/changelog/compare
Changelog equality checks and diff utilities for comparing changelogs, entries, and sections.
@hyperfrontend/versioning/changelog/models
Changelog data structures and factory functions for entries, sections, and items.
@hyperfrontend/versioning/changelog/operations
Immutable changelog operations for adding, removing, filtering, merging, and transforming.
@hyperfrontend/versioning/changelog/parse
Tokenizer and parser for converting Keep-a-Changelog markdown into structured objects.
@hyperfrontend/versioning/changelog/serialize
Serializers for converting Changelog objects to markdown strings or JSON.
@hyperfrontend/versioning/commits
Conventional commit parsing and classification with scope derivation and infrastructure matching.
@hyperfrontend/versioning/commits/author
Interactive commit authoring session: prompt-driven step sequence that produces a validated conventional commit message and (by default) runs `git commit`. See `./README.md` for architecture overview.
@hyperfrontend/versioning/commits/classify
Commit classification logic for matching commits to project scopes and infrastructure changes.
@hyperfrontend/versioning/commits/format
Pure formatter rendering a `CommitDraft` into the final message string: the exact text that would land in `.git/COMMIT_EDITMSG`.
@hyperfrontend/versioning/commits/models
Conventional commit types, factories, and semver bump derivation.
@hyperfrontend/versioning/commits/parse
Conventional commit message parsing for headers, bodies, and footers.
@hyperfrontend/versioning/commits/validate
Pure rule engine judging parsed conventional commits against a configurable ruleset, with commitlint's semantics.
@hyperfrontend/versioning/flow
Version flow orchestration with step management, presets, and execution for release workflows.
@hyperfrontend/versioning/flow/executor
Flow execution engine for running version flows with dry-run and validation support.
@hyperfrontend/versioning/flow/models
Flow and step type definitions with factory functions and configuration builders.
@hyperfrontend/versioning/flow/presets
Pre-configured release flows for conventional, independent, and synced release strategies.
@hyperfrontend/versioning/flow/steps
Individual flow step implementations for registry fetch, commit analysis, and changelog generation.
@hyperfrontend/versioning/git
Git operations and models for commits, tags, refs, logging, staging, and diff operations.
@hyperfrontend/versioning/git/models
Git data models for commits, tags, and refs with factory functions and utilities.
@hyperfrontend/versioning/git/operations
Git shell command wrappers for log, tag, commit, staging, status, and diff operations.
@hyperfrontend/versioning/registry
Package registry abstraction with NPM client, caching, and version/package info models.
@hyperfrontend/versioning/registry/models
Registry types and factories for registries, packages, versions, and maintainers.
@hyperfrontend/versioning/registry/npm
NPM registry client with package escaping and in-memory caching.
@hyperfrontend/versioning/repository
Repository configuration with platform detection, URL parsing, and compare URL generation.
@hyperfrontend/versioning/repository/models
Repository types for platforms, resolutions, and configuration with factory functions.
@hyperfrontend/versioning/repository/parse
Repository URL parsing and package.json inference utilities.
@hyperfrontend/versioning/repository/url
Compare URL generation for building diff links between versions on supported platforms.
@hyperfrontend/versioning/semver
Full semver implementation with parsing, comparison, incrementing, and formatting.
@hyperfrontend/versioning/semver/compare
Version comparison functions for equality, ordering, range satisfaction, and sorting.
@hyperfrontend/versioning/semver/format
Version formatting for converting semver objects to strings.
@hyperfrontend/versioning/semver/increment
Version bumping utilities for incrementing versions and calculating diffs.
@hyperfrontend/versioning/semver/models
Semver types for versions, ranges, comparators, and bump types with factory functions.
@hyperfrontend/versioning/semver/parse
Version and range parsing with strict and coercion modes.
@hyperfrontend/versioning/workspace
Workspace management with package discovery, dependency graphs, and versioning coordination.
@hyperfrontend/versioning/workspace/discovery
Package discovery, changelog finding, and dependency graph construction for monorepos.
@hyperfrontend/versioning/workspace/models
Workspace types for configuration, projects, and query utilities.
@hyperfrontend/versioning/workspace/operations
Workspace operations for cascade bumps, batch updates, and dependency reference management.
Related reading§
- Architecture
Architecture
How @hyperfrontend/versioning is put together, and why.
- How-to
How to publish release notes from your CHANGELOG.md
My release job has a version and a CHANGELOG.md, and every attempt to get one from the other is a regex over markdown headings that breaks the first time an entry carries a compare link, a scope, or a breaking marker.
- How-to
How to replace commitizen and commitlint with one package
Guided commit authoring and commit-message linting take four packages and two config files that have to be kept agreeing with each other, and the prompt still offers types the linter rejects.
- Package
@hyperfrontend/questions
Uses @hyperfrontend/questions to power the interactive cz authoring session
- Package
@hyperfrontend/project-scope
Works seamlessly with @hyperfrontend/project-scope for virtual file system operations
- Package
@hyperfrontend/cryptography
Looking for cryptographic utilities? See @hyperfrontend/cryptography
- Getting started
Getting Started
Set HyperFrontend up and embed a first feature.
- Architecture
Architecture Guide
How the packages fit together.