Skip to main content

CLI overview

The OMG CLI (omg-md-cli) provides commands for working with OMG files.

Installation

npm install -g omg-md-cli

Or use directly with npx:

npx omg-md-cli <command>

Commands

CommandDescription
initInitialize a new OMG project
buildCompile OMG to OpenAPI
parseParse and inspect AST
lintLint OMG files
fmtFormat OMG files
diffCompare two API specifications
breakingDetect breaking changes
changelogGenerate API changelog

Quick reference

# Initialize a new project
omg init my-api

# Build to OpenAPI YAML
omg build api.omg.md -o openapi.yaml

# Build to JSON
omg build api.omg.md -o openapi.json -f json

# Parse and view AST
omg parse endpoint.omg.md

# Lint files
omg lint my-api/

# Format files
omg fmt my-api/ --write

# Compare API versions (requires oasdiff)
omg diff v1/api.omg.md v2/api.omg.md

# Detect breaking changes
omg breaking old.omg.md new.omg.md --fail-on-diff

# Generate changelog
omg changelog v1/api.omg.md v2/api.omg.md

Global options

OptionDescription
--helpShow help
--versionShow version