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
| Command | Description |
|---|---|
init | Initialize a new OMG project |
build | Compile OMG to OpenAPI |
parse | Parse and inspect AST |
lint | Lint OMG files |
fmt | Format OMG files |
diff | Compare two API specifications |
breaking | Detect breaking changes |
changelog | Generate 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
| Option | Description |
|---|---|
--help | Show help |
--version | Show version |