Services CLI Commands
Manage services in your EventCatalog from the command line.
getService​
Returns a service from EventCatalog by its ID
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The ID of the service to retrieve |
| version | string | No | Specific version to retrieve |
Examples:
# Get the latest service
npx @eventcatalog/sdk getService "OrderService"
# Get a specific version
npx @eventcatalog/sdk getService "OrderService" "1.0.0"
getServices​
Returns all services from EventCatalog
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| options | json | No | Options: {latestOnly?} |
Examples:
# Get all services
npx @eventcatalog/sdk getServices
writeService​
Writes a service to EventCatalog
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| service | json | Yes | Service object with id, name, version, and markdown |
| options | json | No | Options: {path?, override?, versionExistingContent?} |
writeServiceToDomain​
Writes a service to a specific domain
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| service | json | Yes | Service object |
| domain | json | Yes | Domain reference: {id, version?} |
| options | json | No | Options |
rmService​
Removes a service by its path
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| path | string | Yes | Path to the service |
Examples:
# Remove a service
npx @eventcatalog/sdk rmService "/OrderService"
rmServiceById​
Removes a service by its ID
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The ID of the service to remove |
| version | string | No | Specific version to remove |
Examples:
# Remove a service
npx @eventcatalog/sdk rmServiceById "OrderService"
versionService​
Moves the current service to a versioned directory
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The ID of the service to version |
Examples:
# Version a service
npx @eventcatalog/sdk versionService "OrderService"
addFileToService​
Adds a file to a service
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The ID of the service |
| file | json | Yes | File object: {content, fileName} |
| version | string | No | Specific version |
addEventToService​
Adds an event relationship to a service
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| serviceId | string | Yes | The ID of the service |
| direction | string | Yes | Direction: "sends" or "receives" |
| event | json | Yes | Event reference: {id, version} |
| serviceVersion | string | No | Specific service version |
addCommandToService​
Adds a command relationship to a service
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| serviceId | string | Yes | The ID of the service |
| direction | string | Yes | Direction: "sends" or "receives" |
| command | json | Yes | Command reference: {id, version} |
| serviceVersion | string | No | Specific service version |
addQueryToService​
Adds a query relationship to a service
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| serviceId | string | Yes | The ID of the service |
| direction | string | Yes | Direction: "sends" or "receives" |
| query | json | Yes | Query reference: {id, version} |
| serviceVersion | string | No | Specific service version |
addEntityToService​
Adds an entity to a service
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| serviceId | string | Yes | The ID of the service |
| entity | json | Yes | Entity reference: {id, version} |
| serviceVersion | string | No | Specific service version |
addDataStoreToService​
Adds a data store relationship to a service
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| serviceId | string | Yes | The ID of the service |
| relationship | string | Yes | Relationship: "writesTo" or "readsFrom" |
| dataStore | json | Yes | Data store reference: {id, version} |
| serviceVersion | string | No | Specific service version |
serviceHasVersion​
Checks if a specific version of a service exists
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The ID of the service |
| version | string | Yes | Version to check |
Examples:
# Check if version exists
npx @eventcatalog/sdk serviceHasVersion "OrderService" "1.0.0"
getSpecificationFilesForService​
Returns specification files (OpenAPI, AsyncAPI) for a service
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The ID of the service |
| version | string | No | Specific version |
Examples:
# Get spec files
npx @eventcatalog/sdk getSpecificationFilesForService "OrderService"