Installation

Usage Guides

Reference

Commands

Language Server

MCP Server

Breaking

TL;DR: Run cem breaking to detect breaking API changes between manifest versions. Use --fail-on breaking in CI to block breaking changes, --format markdown for PR comments.

The cem breaking command compares two custom-elements.json manifests and detects breaking changes in component APIs. Changes are classified as breaking, dangerous, or safe.

cem breaking [old-manifest.json new-manifest.json] [flags]

Options

FlagTypeDescription
--basestringGit ref for baseline (default: latest semver tag)
--headstringGit ref for head (default: working tree manifest)
--formatstringOutput format: text (default), json, or markdown
--fail-onstringExit 1 if changes at this severity or above: breaking or dangerous
--disablestring (repeatable)Disable specific breaking change rules
--package, -pstringPath to a package directory

Severity Classification

SeverityMeaningExamples
BreakingDownstream consumers will breakRemoved element, removed attribute, changed type
DangerousMay break depending on usageChanged default value, narrowed type
SafeNon-breaking additionsNew element, new attribute, new slot

Detection Rules

Rule IDSeverityDetects
element-removedBreakingTag name removed from manifest
element-addedSafeNew tag name added
attribute-removedBreakingAttribute removed from element
attribute-addedSafeNew attribute added
attribute-type-changedBreakingAttribute type changed
attribute-default-changedDangerousAttribute default value changed
slot-removedBreakingNamed slot removed
slot-addedSafeNew slot added
css-custom-property-removedBreakingCSS custom property removed
css-custom-property-addedSafeNew CSS custom property
css-custom-property-default-changedDangerousCSS property default changed
css-part-removedBreakingCSS part removed
css-part-addedSafeNew CSS part added
css-state-removedBreakingCSS state removed
css-state-addedSafeNew CSS state added
event-removedBreakingEvent removed
event-addedSafeNew event added
event-type-changedBreakingEvent type changed
method-removedBreakingPublic method removed
method-addedSafeNew public method
method-return-type-changedBreakingMethod return type changed
method-parameter-changedBreakingMethod parameters changed
field-removedBreakingPublic field removed
field-type-changedDangerousPublic field type changed

Examples

Compare against latest git tag

cem breaking

Compare against specific git ref

cem breaking --base v1.0.0

Compare two manifest files directly

cem breaking old-manifest.json new-manifest.json

CI mode: fail on breaking changes

cem breaking --base v1.0.0 --fail-on breaking

Machine-readable output

cem breaking --base v1.0.0 --format json

Markdown for PR comments

cem breaking --base v1.0.0 --format markdown

Disable specific rules

cem breaking --disable css-custom-property-removed --disable slot-removed

Exit Codes

CodeMeaning
0No breaking changes (or --fail-on threshold not reached)
1Changes detected at or above --fail-on severity (breaking or dangerous)
2Input error (missing files, invalid manifests, etc.)

Configuration

Rules can be disabled via .cem.yaml:

breaking:
  disable:
    - css-custom-property-removed
    - slot-removed

CLI --disable flags are merged with config-file rules.