Knock CLI
npm install @knocklabs/cliA command-line interface for interacting with Knock.
* @knocklabs/cli
* Usage
* Commands
``sh-session`
$ npm install -g @knocklabs/cli
$ knock COMMAND
running command...
$ knock (--version)
@knocklabs/cli/1.0.0 darwin-arm64 node-v20.9.0
$ knock --help [COMMAND]
USAGE
$ knock COMMAND
...
* knock branch create SLUG
* knock branch delete SLUG
* knock branch exit
* knock branch list
* knock branch merge SLUG
* knock branch switch SLUG
* knock channel list
* knock commit
* knock commit get ID
* knock commit list
* knock commit promote
* knock environment list
* knock guide activate GUIDEKEY
* knock guide generate-types
* knock guide get GUIDEKEY
* knock guide list
* knock guide new
* knock guide open GUIDEKEY
* [knock guide pull [GUIDEKEY]](#knock-guide-pull-guidekey)knock guide push [GUIDEKEY]
* [](#knock-guide-push-guidekey)knock guide validate [GUIDEKEY]
* [](#knock-guide-validate-guidekey)knock help [COMMAND]
* [](#knock-help-command)knock init
* knock layout get EMAILLAYOUTKEY
* knock layout list
* knock layout new
* knock layout open LAYOUTKEY
* knock layout pull [EMAILLAYOUTKEY]
* [](#knock-layout-pull-emaillayoutkey)knock layout push [EMAILLAYOUTKEY]
* [](#knock-layout-push-emaillayoutkey)knock layout validate [EMAILLAYOUTKEY]
* [](#knock-layout-validate-emaillayoutkey)knock login
* knock logout
* knock message-type get MESSAGETYPEKEY
* knock message-type list
* knock message-type new
* knock message-type open MESSAGETYPEKEY
* knock message-type pull [MESSAGETYPEKEY]
* [](#knock-message-type-pull-messagetypekey)knock message-type push [MESSAGETYPEKEY]
* [](#knock-message-type-push-messagetypekey)knock message-type validate [MESSAGETYPEKEY]
* [](#knock-message-type-validate-messagetypekey)knock partial get PARTIALKEY
* knock partial list
* knock partial new
* knock partial open PARTIALKEY
* knock partial pull [PARTIALKEY]
* [](#knock-partial-pull-partialkey)knock partial push [PARTIALKEY]
* [](#knock-partial-push-partialkey)knock partial validate [PARTIALKEY]
* [](#knock-partial-validate-partialkey)knock pull
* knock push
* knock translation get TRANSLATIONREF
* knock translation list
* knock translation pull [TRANSLATIONREF]
* [](#knock-translation-pull-translationref)knock translation push [TRANSLATIONREF]
* [](#knock-translation-push-translationref)knock translation validate [TRANSLATIONREF]
* [](#knock-translation-validate-translationref)knock whoami
* knock workflow activate WORKFLOWKEY
* knock workflow generate-types
* knock workflow get WORKFLOWKEY
* knock workflow list
* knock workflow new
* knock workflow open WORKFLOWKEY
* knock workflow pull [WORKFLOWKEY]
* [](#knock-workflow-pull-workflowkey)knock workflow push [WORKFLOWKEY]
* [](#knock-workflow-push-workflowkey)knock workflow run WORKFLOWKEY
* knock workflow validate [WORKFLOWKEY]
* [](#knock-workflow-validate-workflowkey)
Creates a new branch off of the development environment.
`
USAGE
$ knock branch create SLUG [--json] [--service-token
ARGUMENTS
SLUG The slug for the new branch
FLAGS
--service-token=
GLOBAL FLAGS
--json Format output as json.
`
_See code: src/commands/branch/create.ts_
Deletes an existing branch with the given slug.
`
USAGE
$ knock branch delete SLUG [--service-token
ARGUMENTS
SLUG The slug of the branch to delete
FLAGS
--force Remove the confirmation prompt.
--service-token=
`
_See code: src/commands/branch/delete.ts_
Exits the current branch.
`
USAGE
$ knock branch exit [--service-token
FLAGS
--service-token=
`
_See code: src/commands/branch/exit.ts_
Display all existing branches off of the development environment.
`
USAGE
$ knock branch list [--json] [--service-token
FLAGS
--after=
--before=
--limit=
--service-token=
GLOBAL FLAGS
--json Format output as json.
`
_See code: src/commands/branch/list.ts_
Merges a branch into the development environment.
`
USAGE
$ knock branch merge SLUG [--service-token
ARGUMENTS
SLUG The slug of the branch to merge
FLAGS
--[no-]delete Delete the branch after merging.
--force Remove the confirmation prompt.
--service-token=
`
_See code: src/commands/branch/merge.ts_
Switches to an existing branch with the given slug.
`
USAGE
$ knock branch switch SLUG [--service-token
ARGUMENTS
SLUG The slug of the branch to switch to
FLAGS
--create Create the branch if it doesn't yet exist.
--force Remove the confirmation prompt.
--service-token=
`
_See code: src/commands/branch/switch.ts_
Display all channels configured for the account.
`
USAGE
$ knock channel list [--json] [--service-token
FLAGS
--service-token=
GLOBAL FLAGS
--json Format output as json.
`
_See code: src/commands/channel/list.ts_
Commit all changes in development environment.
`
USAGE
$ knock commit [--service-token
[--force]
FLAGS
-m, --commit-message=
--branch=
--environment=
_See code: src/commands/commit/index.ts_
Display a single commit
`
USAGE
$ knock commit get ID [--json] [--service-token
FLAGS
--service-token=
GLOBAL FLAGS
--json Format output as json.
`
_See code: src/commands/commit/get.ts_
Display all commits in an environment
`
USAGE
$ knock commit list [--json] [--service-token
[--resource-type email_layout|guide|message_type|partial|translation|workflow...] [--resource-id
FLAGS
--after=
--before=
--branch=
--environment=
--limit=
--[no-]promoted Show only promoted or unpromoted changes between the given environment and the subsequent
environment.
--resource-id=
resources, this will be the resource key. In the case of translations, this will be the
locale code and namespace, separated by a /. For example, en/courses or en.
--resource-type=
GLOBAL FLAGS
--json Format output as json.
`
_See code: src/commands/commit/list.ts_
Promote one or all commits to the subsequent environment.
`
USAGE
$ knock commit promote [--service-token
FLAGS
--force Remove the confirmation prompt.
--only=
--service-token=
--to=
`
_See code: src/commands/commit/promote.ts_
Display all environments configured for the account.
`
USAGE
$ knock environment list [--json] [--service-token
FLAGS
--service-token=
GLOBAL FLAGS
--json Format output as json.
`
_See code: src/commands/environment/list.ts_
Activate or deactivate a guide in a given environment.
`
USAGE
$ knock guide activate GUIDEKEY --environment
true|false | --from
FLAGS
--branch=
--environment=
--force Remove the confirmation prompt.
--from=
--service-token=
--status=
DESCRIPTION
Activate or deactivate a guide in a given environment.
This enables or disables a guide in a given environment without
needing to go through environment promotion.
You can activate or deactivate a guide immediately or schedule it to be activated
or deactivated at a later time using the --from and --until flags.
`
_See code: src/commands/guide/activate.ts_
Generate types for all guides in an environment and write them to a file.
`
USAGE
$ knock guide generate-types --output-file
FLAGS
--branch=
--environment=
--output-file=
.go, .rb files only. Your file extension will determine the target language for the generated
types.
--service-token=
DESCRIPTION
Generate types for all guides in an environment and write them to a file.
`
_See code: src/commands/guide/generate-types.ts_
Display a single guide from an environment.
`
USAGE
$ knock guide get GUIDEKEY [--json] [--service-token
[--hide-uncommitted-changes]
FLAGS
--branch=
--environment=
--hide-uncommitted-changes Hide any uncommitted changes.
--service-token=
GLOBAL FLAGS
--json Format output as json.
`
_See code: src/commands/guide/get.ts_
Display all guides for an environment.
`
USAGE
$ knock guide list [--json] [--service-token
[--hide-uncommitted-changes] [--after
FLAGS
--after=
--before=
--branch=
--environment=
--hide-uncommitted-changes Hide any uncommitted changes.
--limit=
--service-token=
GLOBAL FLAGS
--json Format output as json.
`
_See code: src/commands/guide/list.ts_
Create a new guide with a minimal configuration.
`
USAGE
$ knock guide new [--service-token
[--branch
FLAGS
-k, --key=
-m, --message-type=
-n, --name=
-p, --push Whether or not to push the guide to Knock after creation.
-t, --template=. You cannot use this flag`
with --message-type.
--branch=
--environment=
--force Force the creation of the guide directory without confirmation.
--service-token=
_See code: src/commands/guide/new.ts_
Open a guide in the Knock dashboard.
`
USAGE
$ knock guide open GUIDEKEY [--service-token
FLAGS
--branch=
--environment=
--service-token=
`
_See code: src/commands/guide/open.ts_
Pull one or more guides from an environment into a local file system.
`
USAGE
$ knock guide pull [GUIDEKEY] [--service-token
[--guides-dir
FLAGS
--all Whether to pull all guides from the specified environment.
--branch=
--environment=
--force Remove the confirmation prompt.
--guides-dir=
--hide-uncommitted-changes Hide any uncommitted changes.
--service-token=
`
_See code: src/commands/guide/pull.ts_
Push one or more guides from a local file system to Knock.
`
USAGE
$ knock guide push [GUIDEKEY] [--service-token
[--guides-dir
FLAGS
-m, --commit-message=
--all Whether to push all guides from the target directory.
--branch=
--commit Push and commit the guide(s) at the same time
--environment=
--guides-dir=
--service-token=
`
_See code: src/commands/guide/push.ts_
Validate one or more guides from a local file system.
`
USAGE
$ knock guide validate [GUIDEKEY] [--service-token
[--guides-dir
FLAGS
--all Whether to validate all guides from the target directory.
--branch=
--environment=
--guides-dir=
--service-token=
`
_See code: src/commands/guide/validate.ts_
Display help for knock.
`
USAGE
$ knock help [COMMAND...] [-n]
ARGUMENTS
[COMMAND...] Command to show help for.
FLAGS
-n, --nested-commands Include all nested commands in the output.
DESCRIPTION
Display help for knock.
`
_See code: @oclif/plugin-help_
Initialize a new Knock project with a knock.json configuration file.
`
USAGE
$ knock init [--service-token
FLAGS
--service-token=
DESCRIPTION
Initialize a new Knock project with a knock.json configuration file.
Creates a knock.json configuration file in the current directory to store project-level settings like the knock
resources directory.
`
_See code: src/commands/init.ts_
Display a single email layout from an environment.
`
USAGE
$ knock layout get EMAILLAYOUTKEY [--json] [--service-token
FLAGS
--branch=
--environment=
--hide-uncommitted-changes Hide any uncommitted changes.
--service-token=
GLOBAL FLAGS
--json Format output as json.
`
_See code: src/commands/layout/get.ts_
Display all email layouts for an environment.
`
USAGE
$ knock layout list [--json] [--service-token
[--hide-uncommitted-changes] [--after
FLAGS
--after=
--before=
--branch=
--environment=
--hide-uncommitted-changes Hide any uncommitted changes.
--limit=
--service-token=
GLOBAL FLAGS
--json Format output as json.
`
_See code: src/commands/layout/list.ts_
Create a new email layout with a minimal configuration.
`
USAGE
$ knock layout new [--service-token
FLAGS
-k, --key=
-n, --name=
-p, --push Whether or not to push the email layout to Knock after creation.
--branch=
--environment=
development.
--force Force the creation of the email layout directory without confirmation.
--service-token=
--template=.`
_See code: src/commands/layout/new.ts_
Open a layout in the Knock dashboard.
`
USAGE
$ knock layout open LAYOUTKEY [--service-token
FLAGS
--branch=
--environment=
--service-token=
`
_See code: src/commands/layout/open.ts_
Pull one or more email layouts from an environment into a local file system.
`
USAGE
$ knock layout pull [EMAILLAYOUTKEY] [--service-token
[--layouts-dir
FLAGS
--all Whether to pull all email layouts from the specified environment.
--branch=
--environment=
--force Remove the confirmation prompt.
--hide-uncommitted-changes Hide any uncommitted changes.
--layouts-dir=
--service-token=
`
_See code: src/commands/layout/pull.ts_
Push one or more email layouts from a local file system to Knock.
`
USAGE
$ knock layout push [EMAILLAYOUTKEY] [--service-token
[--layouts-dir
FLAGS
-m, --commit-message=
--all Whether to push all layouts from the target directory.
--branch=
--commit Push and commit the layout(s) at the same time
--environment=
_See code: src/commands/layout/push.ts_
Validate one or more layouts from a local file system.
`
USAGE
$ knock layout validate [EMAILLAYOUTKEY] [--service-token
[--layouts-dir
FLAGS
--all Whether to validate all layouts from the target directory.
--branch=
--environment=
_See code: src/commands/layout/validate.ts_
Log in with a Knock user account.
`
USAGE
$ knock login [--service-token
FLAGS
--service-token=
`
_See code: src/commands/login.ts_
Log out of a Knock user account.
`
USAGE
$ knock logout [--service-token
FLAGS
--service-token=
`
_See code: src/commands/logout.ts_
Display a single in-app message type from an environment.
`
USAGE
$ knock message-type get MESSAGETYPEKEY [--json] [--service-token
FLAGS
--branch=
--environment=
--hide-uncommitted-changes Hide any uncommitted changes.
--service-token=
GLOBAL FLAGS
--json Format output as json.
`
_See code: src/commands/message-type/get.ts_
Display all in-app message types for an environment.
`
USAGE
$ knock message-type list [--json] [--service-token
[--hide-uncommitted-changes] [--after
FLAGS
--after=
--before=
--branch=
--environment=
--hide-uncommitted-changes Hide any uncommitted changes.
--limit=
--service-token=
GLOBAL FLAGS
--json Format output as json.
`
_See code: src/commands/message-type/list.ts_
Create a new message type with a minimal configuration.
`
USAGE
$ knock message-type new [--service-token
FLAGS
-k, --key=
-n, --name=
-p, --push Whether or not to push the message type to Knock after creation.
--branch=
--environment=
development.
--force Force the creation of the message type directory without confirmation.
--service-token=
--template=.`
_See code: src/commands/message-type/new.ts_
Open a message type in the Knock dashboard.
`
USAGE
$ knock message-type open MESSAGETYPEKEY [--service-token
FLAGS
--branch=
--environment=
--service-token=
`
_See code: src/commands/message-type/open.ts_
Pull one or more in-app message types from an environment into a local file system.
`
USAGE
$ knock message-type pull [MESSAGETYPEKEY] [--service-token
[--message-types-dir
FLAGS
--all Whether to pull all in-app message types from the specified environment.
--branch=
--environment=
--force Remove the confirmation prompt.
--hide-uncommitted-changes Hide any uncommitted changes.
--message-types-dir=
--service-token=
`
_See code: src/commands/message-type/pull.ts_
Push one or more message types from a local file system to Knock.
`
USAGE
$ knock message-type push [MESSAGETYPEKEY] [--service-token
[--message-types-dir
FLAGS
-m, --commit-message=
--all Whether to push all message types from the target directory.
--branch=
--commit Push and commit the message type(s) at the same time
--environment=
_See code: src/commands/message-type/push.ts_
Validate one or more message types from a local file system.
`
USAGE
$ knock message-type validate [MESSAGETYPEKEY] [--service-token
[--message-types-dir
FLAGS
--all Whether to validate all message types from the target directory.
--branch=
--environment=
_See code: src/commands/message-type/validate.ts_
Display a single partial from an environment.
`
USAGE
$ knock partial get PARTIALKEY [--json] [--service-token
[--hide-uncommitted-changes]
FLAGS
--branch=
--environment=
--hide-uncommitted-changes Hide any uncommitted changes.
--service-token=
GLOBAL FLAGS
--json Format output as json.
`
_See code: src/commands/partial/get.ts_
Display all partials for an environment.
`
USAGE
$ knock partial list [--json] [--service-token
[--hide-uncommitted-changes] [--after
FLAGS
--after=
--before=
--branch=
--environment=
--hide-uncommitted-changes Hide any uncommitted changes.
--limit=
--service-token=
GLOBAL FLAGS
--json Format output as json.
`
_See code: src/commands/partial/list.ts_
Create a new partial with a minimal configuration.
`
USAGE
$ knock partial new [--service-token
[--environment
FLAGS
-k, --key=
-n, --name=
-p, --push Whether or not to push the partial to Knock after creation.
-t, --type=
_See code: src/commands/partial/new.ts_
Open a partial in the Knock dashboard.
`
USAGE
$ knock partial open PARTIALKEY [--service-token
FLAGS
--branch=
--environment=
--service-token=
`
_See code: src/commands/partial/open.ts_
Pull one or more partial from an environment into a local file system.
`
USAGE
$ knock partial pull [PARTIALKEY] [--service-token
[--partials-dir
FLAGS
--all Whether to pull all partials from the specified environment.
--branch=
--environment=
--force Remove the confirmation prompt.
--hide-uncommitted-changes Hide any uncommitted changes.
--partials-dir=
--service-token=
`
_See code: src/commands/partial/pull.ts_
Push one or more partials from a local file system to Knock.
`
USAGE
$ knock partial push [PARTIALKEY] [--service-token
[--partials-dir
FLAGS
-m, --commit-message=
--all Whether to push all partials from the target directory.
--branch=
--commit Push and commit the partial(s) at the same time
--environment=
_See code: src/commands/partial/push.ts_
Validate one or more partials from a local file system.
`
USAGE
$ knock partial validate [PARTIALKEY] [--service-token
[--partials-dir
FLAGS
--all Whether to validate all partials from the target directory.
--branch=
--environment=
_See code: src/commands/partial/validate.ts_
Pull all resources from an environment into a local file system.
`
USAGE
$ knock pull [--service-token
[--hide-uncommitted-changes] [--force]
FLAGS
--branch=
--environment=
--force Remove the confirmation prompt.
--hide-uncommitted-changes Hide any uncommitted changes.
--knock-dir=
--service-token=
`
_See code: src/commands/pull.ts_
Push all resources from a local file system to Knock.
`
USAGE
$ knock push [--service-token
FLAGS
-m, --commit-message=
--branch=
--commit Push and commit the resource(s) at the same time
--environment=
_See code: src/commands/push.ts_
Display a single translation from an environment.
`
USAGE
$ knock translation get TRANSLATIONREF [--json] [--service-token
ARGUMENTS
TRANSLATIONREF Translation ref is a identifier string that refers to a unique translation.
If a translation has no namespace, it is the same as the locale, e.g. en.admin.en
If namespaced, it is formatted as namespace.locale, e.g. .
FLAGS
--branch=
--environment=
--format=
GLOBAL FLAGS
--json Format output as json.
`
_See code: src/commands/translation/get.ts_
Display all translations for an environment.
`
USAGE
$ knock translation list [--json] [--service-token
[--hide-uncommitted-changes] [--after
FLAGS
--after=
--before=
--branch=
--environment=
--hide-uncommitted-changes Hide any uncommitted changes.
--limit=
--service-token=
GLOBAL FLAGS
--json Format output as json.
`
_See code: src/commands/translation/list.ts_
Pull one or more translations from an environment into a local file system.
`
USAGE
$ knock translation pull [TRANSLATIONREF] [--service-token
[--translations-dir
ARGUMENTS
[TRANSLATIONREF] Translation ref is a identifier string that refers to a unique translation.
If a translation has no namespace, it is the same as the locale, e.g. en.admin.en
If namespaced, it is formatted as namespace.locale, e.g. .
FLAGS
--all Whether to pull all translations from the specified environment.
--branch=
--environment=
--force Remove the confirmation prompt.
--format=
_See code: src/commands/translation/pull.ts_
Push one or more translations from a local file system to Knock.
`
USAGE
$ knock translation push [TRANSLATIONREF] [--service-token
[--translations-dir
ARGUMENTS
[TRANSLATIONREF] Translation ref is a identifier string that refers to a unique translation.
If a translation has no namespace, it is the same as the locale, e.g. en.admin.en
If namespaced, it is formatted as namespace.locale, e.g. .
FLAGS
-m, --commit-message=
--all Whether to push all translations from the target directory.
--branch=
--commit Push and commit the translation(s) at the same time
--environment=
_See code: src/commands/translation/push.ts_
Validate one or more translations from a local file system.
`
USAGE
$ knock translation validate [TRANSLATIONREF] [--service-token
[--translations-dir
ARGUMENTS
[TRANSLATIONREF] Translation ref is a identifier string that refers to a unique translation.
If a translation has no namespace, it is the same as the locale, e.g. en.admin.en
If namespaced, it is formatted as namespace.locale, e.g. .
FLAGS
--all Whether to validate all translations from the target directory.
--branch=
--environment=
_See code: src/commands/translation/validate.ts_
Verify the provided service token.
`
USAGE
$ knock whoami [--json] [--service-token
FLAGS
--service-token=
GLOBAL FLAGS
--json Format output as json.
`
_See code: src/commands/whoami.ts_
Activate or deactivate a workflow in a given environment.
`
USAGE
$ knock workflow activate WORKFLOWKEY --environment
true|false] [--force]
FLAGS
--branch=
--environment=
--force Remove the confirmation prompt.
--service-token=
--status=
DESCRIPTION
Activate or deactivate a workflow in a given environment.
This immediately enables or disables a workflow in a given environment without
needing to go through environment promotion.
By default, this command activates a given workflow. Pass in the --status flag
with false in order to deactivate it.`
_See code: src/commands/workflow/activate.ts_
Generate types for all workflows in an environment and write them to a file.
`
USAGE
$ knock workflow generate-types --output-file
FLAGS
--branch=
--environment=
--output-file=
.go, .py files only. Your file extension will determine the target language for the generated
types.
--service-token=
DESCRIPTION
Generate types for all workflows in an environment and write them to a file.
`
_See code: src/commands/workflow/generate-types.ts_
Display a single workflow from an environment.
`
USAGE
$ knock workflow get WORKFLOWKEY [--json] [--service-token
[--hide-uncommitted-changes]
FLAGS
--branch=
--environment=
--hide-uncommitted-changes Hide any uncommitted changes.
--service-token=
GLOBAL FLAGS
--json Format output as json.
`
_See code: src/commands/workflow/get.ts_
Display all workflows for an environment.
`
USAGE
$ knock workflow list [--json] [--service-token
[--hide-uncommitted-changes] [--after
FLAGS
--after=
--before=
--branch=
--environment=
--hide-uncommitted-changes Hide any uncommitted changes.
--limit=
--service-token=
GLOBAL FLAGS
--json Format output as json.
`
_See code: src/commands/workflow/list.ts_
Create a new workflow with a minimal configuration.
`
USAGE
$ knock workflow new [--service-token
[--branch
FLAGS
-k, --key=
-n, --name=
-p, --push Whether or not to push the workflow to Knock after creation.
-s, --steps=
-t, --template=. You cannot`
use this flag with --steps.
--branch=
--environment=
development.
--force Force the creation of the workflow directory without confirmation.
--service-token=
_See code: src/commands/workflow/new.ts_
Open a workflow in the Knock dashboard.
`
USAGE
$ knock workflow open WORKFLOWKEY [--service-token
FLAGS
--branch=
--environment=
--service-token=
`
_See code: src/commands/workflow/open.ts_
Pull one or more workflows from an environment into a local file system.
`
USAGE
$ knock workflow pull [WORKFLOWKEY] [--service-token
[--workflows-dir
FLAGS
--all Whether to pull all workflows from the specified environment.
--branch=
--environment=
--force Remove the confirmation prompt.
--hide-uncommitted-changes Hide any uncommitted changes.
--service-token=
--workflows-dir=
`
_See code: src/commands/workflow/pull.ts_
Push one or more workflows from a local file system to Knock.
`
USAGE
$ knock workflow push [WORKFLOWKEY] [--service-token
[--workflows-dir
FLAGS
-m, --commit-message=
--all Whether to push all workflows from the target directory.
--branch=
--commit Push and commit the workflow(s) at the same time
--environment=
--service-token=
--workflows-dir=
`
_See code: src/commands/workflow/push.ts_
Test run a workflow using the latest version from Knock.
`
USAGE
$ knock workflow run WORKFLOWKEY --recipients
[--branch
FLAGS
--actor=
--branch=
--data=
--environment=
--recipients=
or more recipient object references for this workflow run.
--service-token=
--tenant=
`
_See code: src/commands/workflow/run.ts_
Validate one or more workflows from a local file system.
`
USAGE
$ knock workflow validate [WORKFLOWKEY] [--service-token
[--workflows-dir
FLAGS
--all Whether to validate all workflows from the target directory.
--branch=
--environment=
--service-token=
--workflows-dir=
``
_See code: src/commands/workflow/validate.ts_