Commands CLI Commands
Manage commands in your EventCatalog from the command line.
getCommand​
Returns a command from EventCatalog by its ID
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The ID of the command to retrieve |
| version | string | No | Specific version to retrieve (supports semver) |
Examples:
# Get the latest command
npx @eventcatalog/sdk getCommand "CreateOrder"
# Get a specific version
npx @eventcatalog/sdk getCommand "CreateOrder" "1.0.0"
getCommands​
Returns all commands from EventCatalog
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| options | json | No | Options: {latestOnly?, attachSchema?} |
Examples:
# Get all commands
npx @eventcatalog/sdk getCommands
writeCommand​
Writes a command to EventCatalog
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| command | json | Yes | Command object with id, name, version, and markdown |
| options | json | No | Options: {path?, override?, versionExistingContent?} |
writeCommandToService​
Writes a command to a specific service
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| command | json | Yes | Command object |
| service | json | Yes | Service reference: {id, version?} |
| options | json | No | Options: {path?, format?, override?} |
rmCommand​
Removes a command by its path
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| path | string | Yes | Path to the command |
Examples:
# Remove a command
npx @eventcatalog/sdk rmCommand "/CreateOrder"
rmCommandById​
Removes a command by its ID
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The ID of the command to remove |
| version | string | No | Specific version to remove |
Examples:
# Remove a command
npx @eventcatalog/sdk rmCommandById "CreateOrder"
versionCommand​
Moves the current command to a versioned directory
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The ID of the command to version |
Examples:
# Version a command
npx @eventcatalog/sdk versionCommand "CreateOrder"
addFileToCommand​
Adds a file to a command
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The ID of the command |
| file | json | Yes | File object: {content, fileName} |
| version | string | No | Specific version |
addSchemaToCommand​
Adds a schema to a command
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The ID of the command |
| schema | json | Yes | Schema object: {schema, fileName} |
| version | string | No | Specific version |
commandHasVersion​
Checks if a specific version of a command exists
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The ID of the command |
| version | string | Yes | Version to check |
Examples:
# Check if version exists
npx @eventcatalog/sdk commandHasVersion "CreateOrder" "1.0.0"