Skip to content
View as Markdown

tailor

Tailor Platform SDK - The SDK to work with Tailor Platform

Usage

bash
tailor <command> [options]

Global Options

OptionAliasDescriptionRequiredDefault
--env-file <ENV_FILE>-ePath to the environment file (error if not found)No-
--env-file-if-exists <ENV_FILE_IF_EXISTS>-Path to the environment file (ignored if not found)No-
--verbose-Enable verbose loggingNofalse
--json-jOutput as JSONNofalse

JSON Output

For commands that return structured results, passing --json writes one parseable JSON document to stdout on success. Empty successful result sets are emitted as JSON values such as [], not as human-readable text or empty stdout.

Commands that only perform side effects and do not define a structured result may leave stdout empty even when --json is passed.

Errors, warnings, progress, and diagnostic messages are written to stderr. After argument parsing, a command failure under --json emits a JSON error envelope to stderr. CLI errors include a stable error.code and may include structured error.next and error.context fields for automated recovery. Diagnostic lines may precede the error envelope, and stdout is not guaranteed to contain an error object.

Common Options

The following options are available for most commands:

OptionShortDescription
--workspace-id-wWorkspace ID (for deployment commands)
--profile-pWorkspace profile
--config-cPath to Tailor config file
--yes-ySkip confirmation prompts

Environment File Loading

Both --env-file and --env-file-if-exists can be specified multiple times and follow Node.js --env-file behavior:

  • Variables already set in the environment are not overwritten
  • Later files override earlier files
  • --env-file files are loaded first, then --env-file-if-exists files
bash
# Load .env (required) and .env.local (optional, if exists)
tailor deploy --env-file .env --env-file-if-exists .env.local

# Load multiple files
tailor deploy --env-file .env --env-file .env.production

Environment Variables

You can use environment variables to configure workspace and authentication:

VariableDescription
TAILOR_PLATFORM_WORKSPACE_IDWorkspace ID for deployment commands
TAILOR_PLATFORM_ORGANIZATION_IDOrganization ID for organization commands
TAILOR_PLATFORM_FOLDER_IDFolder ID for folder commands
TAILOR_PLATFORM_TOKENAuthentication token (alternative to login)
TAILOR_PLATFORM_PROFILEWorkspace profile name
TAILOR_CONFIG_PATHPath to Tailor config file
TAILOR_DTS_PATHOutput path for generated tailor.d.ts type definition file
TAILOR_PLATFORM_MACHINE_USER_CLIENT_IDClient ID for login --machine-user
TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRETClient secret for login --machine-user
TAILOR_PLATFORM_MACHINE_USER_NAMEDefault machine user name for query, workflow start, function test-run, machineuser token
TAILOR_PLATFORM_URLPlatform API base URL. Saved into profiles created with profile create --platform-url
TAILOR_PLATFORM_OAUTH2_CLIENT_IDOAuth2 client ID for user login. Saved into profiles created with profile create --oauth2-client-id
TAILOR_PLATFORM_CONSOLE_URLConsole base URL. Saved into profiles created with profile create --console-url
TAILOR_BUNDLE_CONCURRENCYMax concurrent bundle workers for deploy (resolvers/executors/workflows). Defaults to CPU count
TAILOR_APPLY_CONCURRENCYMax concurrent platform RPCs during apply/deploy. Defaults to 16
VISUAL / EDITORPreferred editor for commands that open files (e.g., vim, code, nano)
TAILOR_CRASH_REPORTS_LOCALLocal crash log writing: on (default) or off
TAILOR_CRASH_REPORTS_REMOTEAutomatic crash report submission: off (default) or on

Authentication Token Priority

Token resolution follows this priority order:

  1. TAILOR_PLATFORM_TOKEN environment variable
  2. Profile specified via --profile option or TAILOR_PLATFORM_PROFILE
  3. Current user from platform config (~/.config/tailor-platform/config.yaml)

Config-backed login tokens are scoped to the Platform API URL. Profiles with --platform-url use the token saved for that URL, so switching profiles can also switch between Platform API environments.

Workspace ID Priority

Workspace ID resolution follows this priority order:

  1. --workspace-id command option
  2. TAILOR_PLATFORM_WORKSPACE_ID environment variable
  3. Profile specified via --profile option or TAILOR_PLATFORM_PROFILE

CLI Plugins

WARNING

CLI plugins are a beta feature. The dispatch behavior and the set of injected environment variables may change in a future release.

You can extend the CLI with external plugins, similar to gh extensions. When you run a command that is not a built-in, the CLI looks for an executable named tailor-<name> and runs it, forwarding the remaining arguments:

bash
# Runs the `tailor-hello` executable with: world --loud
tailor hello world --loud

This is how the @tailor-platform/sdk-plugin-seed package provides the seed commands:

bash
# Runs `tailor-seed` with: apply
tailor seed apply

This also works under a built-in command group. The command path is joined with hyphens, so a plugin nested under tailordb is named tailor-tailordb-erd. This is how the @tailor-platform/sdk-plugin-tailordb-erd package provides the tailordb erd commands:

bash
# Runs `tailor-tailordb-erd` with: export
tailor tailordb erd export

Resolution rules:

  • Built-ins always win. A plugin is only used when no built-in command matches.
  • A command that takes its own arguments is never replaced. Plugin dispatch applies only to command groups (commands that just route to subcommands). A command that performs its own action — including one that accepts a positional argument — always runs itself, so a plugin can never shadow an argument value.
  • Lookup order: the project's node_modules/.bin (nearest first, walking up from the current directory), then your PATH. So a plugin installed as a project dev-dependency takes precedence over a globally installed one.
  • Place global flags after the plugin command. Only the arguments following the plugin name are forwarded; a global flag placed before it (e.g. tailor --json tailordb erd export) is consumed by the host CLI and does not reach the plugin. Write tailor tailordb erd export --json instead.

Because resolution is based on node_modules/.bin and PATH, any package manager that populates node_modules/.bin works for project-local plugins — npm, pnpm (its content-addressable store is transparent here), Bun, and Yarn Classic. The exception is Yarn Plug'n'Play, which does not create a node_modules directory: install such plugins globally so they resolve via PATH, or use Yarn's nodeLinker: node-modules setting.

Run tailor plugin list to see which plugins are discovered and where they resolve from.

Context passed to plugins

Before running a plugin, the CLI injects the current Tailor Platform context as environment variables so the plugin does not need to re-implement authentication or re-resolve the active workspace:

VariableDescription
TAILOR_PLATFORM_TOKENA valid access token (refreshed if needed). Omitted when not logged in.
TAILOR_PLATFORM_URLThe Tailor Platform endpoint in effect
TAILOR_PLATFORM_OAUTH2_CLIENT_IDThe OAuth2 client ID in effect, for plugins that run their own auth flow
TAILOR_PLATFORM_WORKSPACE_IDThe resolved workspace ID, when one can be determined
TAILOR_PLATFORM_USERThe active user (email when known), when logged in
TAILOR_CONFIG_PATHPath to the resolved Tailor config file, when found
TAILOR_VERSIONThe tailor version that invoked the plugin
TAILOR_BINPath to the tailor executable, for calling back into the CLI

The token, workspace ID, and user are best-effort: whatever the current context can resolve is injected, and auth-free plugins still run when you are not logged in. A long-running plugin (or one started on its own) can obtain a fresh token at any time with tailor auth token, which prints a valid access token to stdout, refreshing it first if it has expired.

Commands

Application Commands

Commands for managing Tailor Platform applications (work with tailor.config.ts).

CommandDescription
initInitialize a new project using create-sdk.
generateGenerate files using Tailor configuration.
deployDeploy your application by applying the Tailor configuration.
removeRemove all resources managed by the application from the workspace.
showShow information about the deployed application.
openOpen Tailor Platform Console.
apiCall Tailor Platform API endpoints directly.
api inspectPrint the input message tree of an OperatorService endpoint.
api listList all invocable OperatorService methods.

TailorDB Commands

Commands for managing TailorDB tables, data, and schema migrations.

CommandDescription
tailordbManage TailorDB tables and data.
tailordb truncateTruncate (delete all records from) TailorDB tables.
tailordb migrationManage TailorDB schema migrations.
tailordb migration generateGenerate migration files by detecting schema differences between current local types and the previous migration snapshot.
tailordb migration rebaselineCollapse the full migration history into a new 0000 baseline.
tailordb migration scriptAdd a migration script (migrate.ts) template to an existing migration directory, or record with --no-script that a migration intentionally has none.
tailordb migration setSet migration checkpoint to a specific number.
tailordb migration statusShow the current migration status for TailorDB namespaces, including applied and pending migrations.
tailordb migration syncSync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift).
tailordb migration testTest pending migrations with seed fixtures or cloned data in a temporary workspace.
tailordb migration validateValidate the full migration history, unreviewed generated migration scripts, and schema drift (local types vs. migration snapshot, remote schema vs. migration checkpoint) without deploying. This includes the migration and schema-drift checks used by 'deploy' and exits with a non-zero code when issues are found.

Query Commands

Run ad-hoc SQL/GraphQL queries or enter the interactive REPL.

CommandDescription
queryRun SQL/GraphQL query.

User & Auth Commands

Commands for authentication and user management.

CommandDescription
loginLogin to Tailor Platform.
logoutLogout from Tailor Platform.
authAuthentication helpers for scripts and plugins.
auth tokenPrint a valid Tailor Platform access token to stdout, refreshing it first if expired.
userManage Tailor Platform users.
user currentShow current user.
user listList all users.
user patManage personal access tokens.
user pat createCreate a new personal access token.
user pat deleteDelete a personal access token.
user pat listList all personal access tokens.
user pat updateUpdate a personal access token (delete and recreate).
user switchSet current user.

Organization Commands

Commands for managing organizations and folders.

CommandDescription
organizationManage Tailor Platform organizations.
organization folderManage organization folders.
organization folder createCreate a new folder in an organization.
organization folder deleteDelete a folder from an organization.
organization folder getShow detailed information about a folder.
organization folder listList folders in an organization.
organization folder updateUpdate a folder's name.
organization getShow detailed information about an organization.
organization listList organizations you belong to.
organization treeDisplay organization folder hierarchy as a tree.
organization updateUpdate an organization's name.

Workspace Commands

Commands for managing workspaces and profiles.

CommandDescription
workspaceManage Tailor Platform workspaces.
workspace appManage workspace applications
workspace app healthCheck application schema health
workspace app listList applications in a workspace
workspace createCreate a new Tailor Platform workspace.
workspace deleteDelete a Tailor Platform workspace.
workspace getShow detailed information about a workspace
workspace listList all Tailor Platform workspaces.
workspace restoreRestore a deleted workspace
workspace userManage workspace users
workspace user inviteInvite a user to a workspace
workspace user listList users in a workspace
workspace user removeRemove a user from a workspace
workspace user updateUpdate a user's role in a workspace
profileManage workspace profiles (user + workspace combinations).
profile createCreate a new profile.
profile deleteDelete a profile.
profile listList all profiles.
profile updateUpdate profile properties.

Auth Resource Commands

Commands for managing Auth service resources.

CommandDescription
authconnectionManage auth connections.
authconnection authorizeAuthorize an auth connection via OAuth2 flow.
authconnection deleteDelete an auth connection entirely.
authconnection listList all auth connections.
authconnection openOpen the auth connections page in the Tailor Platform Console.
authconnection revokeRevoke an auth connection's tokens (keeps the connection; use 'delete' to remove it).
machineuserManage machine users in your Tailor Platform application.
machineuser listList all machine users in the application.
machineuser tokenGet an access token for a machine user.
oauth2clientManage OAuth2 clients in your Tailor Platform application.
oauth2client listList all OAuth2 clients in the application.
oauth2client getGet OAuth2 client credentials (including client secret).

Workflow Commands

Commands for managing workflows and executions.

CommandDescription
workflowManage workflows and workflow executions.
workflow listList all workflows in the workspace.
workflow getGet workflow details.
workflow startStart a workflow execution.
workflow waitWait for a workflow execution.
workflow executionsList or get workflow executions.
workflow resumeResume a failed or pending workflow execution.

Function Commands

Commands for managing function registries and viewing function execution logs.

CommandDescription
functionManage functions
function getGet a function registry by name
function listList function registries in a workspace
function logsList or get function execution logs.
function test-runRun a function on the Tailor Platform server without deploying.

Executor Commands

Commands for managing executors and executor jobs.

CommandDescription
executorManage executors
executor listList all executors
executor getGet executor details
executor jobsList or get executor jobs.
executor triggerTrigger an executor manually.
executor webhookManage executor webhooks
executor webhook listList executors with incoming webhook triggers

Secret Commands

Commands for managing secrets and vaults.

CommandDescription
secretManage Secret Manager vaults and secrets.
secret createCreate a secret in a vault.
secret deleteDelete a secret in a vault.
secret listList all secrets in a vault.
secret updateUpdate a secret in a vault.
secret vaultManage Secret Manager vaults.
secret vault createCreate a new Secret Manager vault.
secret vault deleteDelete a Secret Manager vault.
secret vault listList all Secret Manager vaults in the workspace.

Static Website Commands

Commands for managing and deploying static websites.

CommandDescription
staticwebsiteManage static websites in your workspace.
staticwebsite deployDeploy a static website from a local build directory.
staticwebsite listList all static websites in a workspace.
staticwebsite domainManage custom domains for static websites.
staticwebsite domain getGet details of a custom domain.
staticwebsite domain listList custom domains for a static website.
staticwebsite getGet details of a specific static website.

Crash Report Commands

Commands for managing crash reports.

CommandDescription
crashreportManage crash reports.
crashreport listList local crash report files.
crashreport sendSubmit a crash report to help improve the SDK.

Setup Commands

Commands for setting up project infrastructure.

CommandDescription
setupGenerate CI deploy workflows for your project. (beta)
setup actionGenerate a per-app composite action for use with setup coordinate (monorepo multi-app deploys).
setup branchGenerate a branch-target deploy workflow (push to branch triggers deploy).
setup checkAudit generated workflows for drift against the current config/repo (read-only).
setup coordinateGenerate a coordinator workflow that orchestrates multiple --action-generated composite actions.
setup deleteDelete managed workflow/action file(s) and their .github/tailor.lock entries.
setup previewGenerate a preview workflow (PR open/sync triggers deploy to a per-PR workspace).
setup tagGenerate a tag-target deploy workflow (tag push triggers deploy).

Upgrade Commands

Commands for upgrading SDK versions with automated code migration.

CommandDescription
upgradeRun codemods to upgrade your project to a newer SDK version.

Skills Commands

Commands for managing Tailor SDK agent skills.

CommandDescription
skillsManage Tailor SDK agent skills.
skills addInstall Tailor SDK agent skills.
skills listList Tailor SDK agent skills.
skills removeRemove installed Tailor SDK agent skills.
skills syncRemove and reinstall Tailor SDK agent skills.

Plugin Commands

Discover and inspect CLI plugins (external tailor-<name> executables).

CommandDescription
pluginManage and inspect CLI plugins (beta).
plugin listList discovered plugins (executables named <cli>-<name> on PATH or node_modules/.bin).

Completion

Generate shell completion scripts for bash, zsh, and fish.

CommandDescription
completionGenerate shell completion script