This document covers the public classes and types exported from @savvy-web/changesets.
The package provides two API surfaces:
- Class-based API -- Static classes for consumers who do not use Effect
- Effect services -- Services, layers, schemas, and tagged errors for Effect-native consumers
Import from the main entry point:
import {
ChangelogTransformer,
ChangesetLinter,
Categories,
Changelog,
} from "@savvy-web/changesets";Runs all seven remark transform plugins against CHANGELOG markdown content.
Transform a markdown string by running all transform plugins.
- Parameters:
content(string) -- Raw CHANGELOG markdown
- Returns:
string-- The transformed markdown
const result =
ChangelogTransformer.transformContent(rawMarkdown);Transform a CHANGELOG file in-place. Reads the file, runs all plugins, and writes the result back.
- Parameters:
filePath(string) -- Path to the file
- Returns:
void
ChangelogTransformer.transformFile("CHANGELOG.md");Runs the five remark-lint rules against changeset markdown and returns structured diagnostic messages.
Validate all .md files in a directory (excluding README.md).
- Parameters:
dir(string) -- Directory path to scan
- Returns:
LintMessage[]-- Aggregated messages
const messages =
ChangesetLinter.validate(".changeset");Validate a single changeset file.
- Parameters:
filePath(string) -- Path to the.mdfile
- Returns:
LintMessage[]-- Lint messages
const messages =
ChangesetLinter.validateFile(".changeset/foo.md");Validate a markdown string directly. Strips YAML frontmatter before running lint rules.
- Parameters:
content(string) -- Raw markdown contentfilePath(string, optional) -- For error reporting, defaults to"<input>"
- Returns:
LintMessage[]-- Lint messages
const messages =
ChangesetLinter.validateContent(markdown);A single lint diagnostic returned by ChangesetLinter.
interface LintMessage {
/** File path that was validated. */
file: string;
/** Rule name that produced the message. */
rule: string;
/** Line number (1-based). */
line: number;
/** Column number (1-based). */
column: number;
/** Human-readable message. */
message: string;
}Static class for category operations. Maps conventional commit types to changelog section categories and validates section headings.
Resolve a conventional commit type to its category.
- Parameters:
type(string) -- Commit type (e.g.,"feat")scope(string, optional) -- Scope (e.g.,"deps")breaking(boolean, optional) -- Breaking flag
- Returns:
SectionCategory
const cat = Categories.fromCommitType("feat");
// { heading: "Features", priority: 2, ... }
const deps = Categories.fromCommitType(
"chore",
"deps",
);
// { heading: "Dependencies", priority: 10, ... }
const bc = Categories.fromCommitType(
"feat",
undefined,
true,
);
// { heading: "Breaking Changes", priority: 1, ... }Look up a category by its section heading text. Case-insensitive.
- Parameters:
heading(string) -- The heading text
- Returns:
SectionCategory | undefined
const cat = Categories.fromHeading("Bug Fixes");
// { heading: "Bug Fixes", priority: 3, ... }Check whether a heading matches a known category. Case-insensitive.
- Parameters:
heading(string) -- The heading text
- Returns:
boolean
Get all valid section heading strings in priority order.
- Returns:
readonly string[]
All 13 categories ordered by priority (ascending).
- Type:
readonly SectionCategory[]
Static class for parsing, serializing, and manipulating dependency tables in changeset files.
Import from the main entry point:
import { DependencyTable } from "@savvy-web/changesets";Parse a GFM table AST node into structured dependency rows.
- Parameters:
tableNode-- A mdastTablenode
- Returns:
DependencyTableRow[]
Serialize structured dependency rows back into a mdast Table node.
- Parameters:
rows(DependencyTableRow[]) -- The rows to serialize
- Returns: mdast
Tablenode
Convert structured dependency rows to a markdown string.
- Parameters:
rows(DependencyTableRow[]) -- The rows to convert
- Returns:
string
Collapse multiple rows for the same dependency into a single row (e.g., when a dependency is added and then updated across changesets).
- Parameters:
rows(DependencyTableRow[]) -- The rows to collapse
- Returns:
DependencyTableRow[]
Sort dependency rows alphabetically by dependency name.
- Parameters:
rows(DependencyTableRow[]) -- The rows to sort
- Returns:
DependencyTableRow[]
Aggregate dependency rows by collapsing duplicates and sorting the result.
- Parameters:
rows(DependencyTableRow[]) -- The rows to aggregate
- Returns:
DependencyTableRow[]
Static class wrapper for changelog formatting. Delegates to the Changesets-compatible functions with Effect-based internals.
Format a single changeset into a changelog release line.
- Parameters:
changeset-- The changeset objectversionType--"major","minor", or"patch"options-- Config withrepoinowner/repoformat
- Returns:
Promise<string>
Format dependency update release lines.
- Parameters:
changesets-- Array of changesetsdependenciesUpdated-- Dependencies that changedoptions-- Config withrepo
- Returns:
Promise<string>
Defines how changes are grouped in release notes.
interface SectionCategory {
/** Display heading (e.g., "Features"). */
heading: string;
/** Priority for ordering (lower = first). */
priority: number;
/** Conventional commit types for this category. */
commitTypes: string[];
/** Brief description. */
description: string;
}Configuration options for the changelog formatter.
interface ChangesetOptions {
/** GitHub repo in owner/repo format. */
repo: string;
/** Include commit hash links. */
commitLinks?: boolean;
/** Include pull request links. */
prLinks?: boolean;
/** Include issue reference links. */
issueLinks?: boolean;
/** Custom issue prefixes (e.g., ["#", "GH-"]). */
issuePrefixes?: string[];
/** Additional JSON files to update with version numbers. */
versionFiles?: VersionFileConfig[];
}Configuration for a single version file entry. Used inside the versionFiles array. See Configuration: Version Files for full usage details.
interface VersionFileConfig {
/** Glob pattern to match JSON files. */
glob: string;
/** JSONPath expressions to locate version fields. Defaults to ["$.version"]. */
paths?: string[];
/** Workspace package name to source the version from, bypassing path-based resolution. */
package?: string;
}A single row in a dependency table.
interface DependencyTableRow {
/** Package name. */
dependency: string;
/** Dependency type. */
type: "dependency" | "devDependency" | "peerDependency" | "optionalDependency" | "workspace" | "config";
/** What happened to the dependency. */
action: DependencyAction;
/** Previous version (em dash for added). */
from: string;
/** New version (em dash for removed). */
to: string;
}The action performed on a dependency.
type DependencyAction = "added" | "updated" | "removed";For Effect-native consumers, the package exports services, layers, and tagged errors.
ChangelogService-- Changelog formattingGitHubService-- GitHub API integrationMarkdownService-- Markdown parsing
GitHubLive-- Production GitHub API layermakeGitHubTest-- Test layer factoryMarkdownLive-- Production markdown layer
ConfigurationError-- Invalid or missing configGitHubApiError-- GitHub API failuresMarkdownParseError-- Markdown parsing failuresChangesetValidationError-- Validation failuresVersionFileError-- Version file update failures (file read/parse/JSONPath errors)
ChangesetOptionsSchema-- Options validationSectionCategorySchema-- Category validationCommitHashSchema-- Commit hash validationRepoSchema-- Repository format validationJsonPathSchema-- JSONPath expression validation (must start with$.)VersionFileConfigSchema-- Single version file entry validationVersionFilesSchema-- Array of version file configs validationDependencyActionSchema-- Dependency action validation (added,updated,removed)DependencyTableRowSchema-- Single dependency table row validationDependencyTableSchema-- Array of dependency table rows validationDependencyTableTypeSchema-- Dependency type validation (dependency,devDependency, etc.)VersionOrEmptySchema-- Semver version or em dash validation
All lint rules and transform plugins are exported from a single entry point:
import {
// Lint rules
SilkChangesetPreset,
HeadingHierarchyRule,
RequiredSectionsRule,
ContentStructureRule,
UncategorizedContentRule,
DependencyTableFormatRule,
// Transform plugins
SilkChangesetTransformPreset,
MergeSectionsPlugin,
ReorderSectionsPlugin,
DeduplicateItemsPlugin,
ContributorFootnotesPlugin,
IssueLinkRefsPlugin,
NormalizeFormatPlugin,
AggregateDependencyTablesPlugin,
} from "@savvy-web/changesets/remark";SilkChangesetPreset-- Array of all five rulesHeadingHierarchyRule-- h2 start, no h1, no skipsRequiredSectionsRule-- Known category headingsContentStructureRule-- Non-empty contentUncategorizedContentRule-- Content must be under a category headingDependencyTableFormatRule-- Dependency table structure validation
SilkChangesetTransformPreset-- All seven in orderAggregateDependencyTablesPlugin-- Consolidate dependency tablesMergeSectionsPlugin-- Combine duplicate headingsReorderSectionsPlugin-- Sort by category priorityDeduplicateItemsPlugin-- Remove duplicate list itemsContributorFootnotesPlugin-- Aggregate attributionsIssueLinkRefsPlugin-- Consolidate reference linksNormalizeFormatPlugin-- Remove empties, clean up