Hyphen CLI
Work seamlessly with Hyphen from the command line
Hyphen CLI can be installed in macOS, Windows and Linux environments. In this guide, you will learn how to install and update command-line interface (CLI).
Installation
sh -c "$(curl -fsSL https://cdn.hyphen.ai/install/install.sh)"powershell -c "irm https://cdn.hyphen.ai/install/install.ps1 | iex"Commands
hyphen
The root command for the Hyphen CLI. For convience, the alias hx can be used in place of hyphen for all commands.
For convenience, the aliashxcan be used in place ofhyphenfor all commands.
Usage:
hyphen [command]
hx [command]
Core Commands
app: Manage applicationsauth: Authenticate with Hyphenbuild: Build and upload a Docker image without deployingdeploy: Run a deploymententrypoint: Generate or update the hyphen-entrypoint.sh scriptenv: Manage environmentshelp: List available commands, flags, and their descriptionsinit: Initialize an applink: Shorten a URL and optionally generate a QR codeproject: Manage projectspull: Retrieve and decrypt environment variables for a specific environmentpush: Upload and encrypt environment variables for a specific environmentset-org: Set the organization IDset-project: Set the project IDupdate: Update the Hyphen CLIversion: Display the version of the Hyphen CLI
Global Flags
--org: Organization ID (e.g., org_123)--proj: Project ID (e.g., proj_123)--env: Environment ID (e.g., env_12345)--yes, -y: Automatically answer yes for prompts--no: Automatically answer no for prompts
Authentication
Authenticate with Hyphen by entering the hyphen auth command. This will start the OAuth flow (opens a browser window and ask you to sign in with username and password) and save the credentials to your session.
hyphen auth
API Key Authentication
If you are authenticating in a CI/CD environment and need to authenticate using an API key, you can do so in 2 ways:
- Use API Key
--use-api-keywill look for the HYPHEN_API_KEY environment variable first and if not found it will prompt for the key.hyphen auth -- use-api-key - Set API Key
--set-api-key VALUEwill expect an inline value. The risk in using this method is just in exposing the secret in your terminal output, but it's provided for convenience.hyphen auth --set-api-key VALUE
Commands
app
appManage applications.
Subcommands
create: Create a new application in Hyphenget: Get an applist: List applications in your organization and project
app create
app createThis command allows you to:
- Create a new application with a specified name
- Optionally provide a custom app ID or use an automatically generated one
- Associate the new app with your current organization and project
hyphen app create <app-name> [flags]
Flags
-h, --helpHelp forapp createcommand--id, i: App ID (optional)
app get
app getThis command allows you to:
- Fetch detailed information about a specific application
- Use either the application name or ID as the identifier
The command will display various details about the application, including:
- Project information (ID and name)
- Application details (name, alternate ID, and ID)
- Organization information (ID and name)
hyphen app get <app-name or app-id> [flags]
Flags
-h, --helpHelp forapp createcommand
app list
app listList applications in your organization and project
hyphen app list [flags]
Flags
-h, --helpHelp forapp list--page: Page number (default 1)--page-size: Number of results per page (default 10)--table: Display results in a table format
auth
authStarts the OAuth flow, opens a browser window for you to sign in with a username and password and saves the credentials to your session.
hyphen auth
build
buildBuild and upload a Docker image to your project's container registry without deploying it.
This command is useful for:
- Testing your build process without triggering a deployment
- Pre-building artifacts that can be deployed later
- Verifying your Dockerfile and container registry configuration
The build command performs the same build process as hx deploy, but stops after uploading the image to your container registry.
hyphen build [flags]
Flags
--help, -h: Help forbuildcommand
Examples
hyphen build
hx build
For more details about the build process, see Builds.
deploy
deployRun a deployment by executing a deployment policy.
This command builds your Docker image (unless --no-build is specified), pushes it to your container registry, and deploys your application according to the deployment policy configuration.
hyphen deploy <deployment-policy-name-or-id> [flags]
Flags
--no-build: Skip the build step and use the most recent build--help, -h: Help fordeploycommand
Examples
hyphen deploy my-deployment-policy
hyphen deploy dpol_123456789
hx deploy production --no-build
For more information about deployments, see Deployment Run Methods.
entrypoint
entrypointGenerate or update the hyphen-entrypoint.sh script for Docker deployments.
This script is normally created automatically when you run hx init, but this command allows you to:
- Create the entrypoint script if it's missing (e.g., from having used an older version of
hx init) - Update the script to the latest version
- Regenerate the script if it was accidentally deleted or modified
hyphen entrypoint [flags]
Flags
--force: Overwrite existing entrypoint file--help, -h: Help forentrypointcommand
env
envManage environment .env secrets.
Subcommands
list: List environment variables in Hyphenlist-versions:List versions of an environment in Hyphenpull: Pull and decrypt environment variables from Hyphenpush: Push local environment variables to Hyphenrotate-key: Rotate the encryption key and update all environmentsrun: Run your app with the specified environment
Flags
--enivoronment, -e: Project Environment ID (e.g., pevr_12345)-h, --helpHelp forproject list
env list
env listThe env list command displays environment variables stored in Hyphen for your current project.
This command allows you to:
- View all environments associated with your project
- See key details about each environment, including ID, version, secret count, size, and publish date
- Display results in either a detailed list format or a concise table format
The information displayed for each environment includes:
- ID: The unique identifier for the environment (default for the main environment)
- Version: The current version number of the environment
- Secrets Count: The number of secret variables stored in the environment
- Size: The total size of the environment data
- Published: The date and time when the environment was last published
hyphen env list [flags]
Flags
-h, --help: help forenv list--page: Page number (default 1)--page-size: Number of results per page (default 10)--table: Display results in a table format
env list-versions
env list-versionsThe env list-versions command displays different versions of a specific environment stored in Hyphen for your current project.
This command allows you to:
- View all versions of a specific environment
- See key details about each version, including ID, version number, secret count, size, and publish date
- Display results in either a detailed list format or a concise table format
The information displayed for each version includes:
- ID: The unique identifier for the environment
- Version: The version number of the environment
- Secrets Count: The number of secret variables stored in this version
- Size: The total size of the environment data for this version
- Published: The date and time when this version was published
hyphen env list-versions <environment-id> [flags]
Flags
-h, --help: help forenv list--page: Page number (default 1)--page-size: Number of results per page (default 10)--table: Display results in a table format
env push
env pushEncrypt and uploads local environment variables to Hyphen.
This command allows you to:
- Push all environments found in local .env files when no environment is specified
- Push a specific environment by name
- Encrypt and securely store your environment variables in Hyphen
The command looks for .env files in the current directory with the naming convention .env.[environment_name].
hyphen env push [flags]
Flags
--environment, -e: Specific environment(s) to push to (e.g. development, production, default)--help, -h: Help forpushcommand
env pull
env pullRetrieves environment variables from Hyphen and decrypts them into local .env files.
This command allows you to:
- Pull a specific environment by name
- Pull all environments for the application
The pulled environments will be decrypted and saved as .env.[environment_name] files in your current directory.
hyphen env pull [flags]
Flags
--environment, -e: Specific environment(s) to pull from (e.g. development, production, default)--force: Force overwrite of locally modified environment files--version: Specify a version to pull--help, -h: Help forpullcommand
env rotate-key
env rotate-keyRotates the encryption key and updates all environments with the new key.
hyphen env rotate-key [flags]
Flags
--force: Force overwrite of locally modified environment files-h, --help: help forenv list
env run
env runExecutes your application with the specified environment variables.
hyphen env run [environment] -- [command]
Flags
-h, --help: help for `env list
help
helpList available commands, flags, and their descriptions
hyphen help
init
initInitialize an app, which creates the .hx, .hxkey, and hyphen-entrypoint.sh files
The hyphen-entrypoint.sh script is designed for use in Docker containers and automates the process of downloading the Hyphen CLI, authenticating with an API key, pulling environment variables, and running your application with those variables loaded.
Note: If the
hyphen-entrypoint.shis missing (e.g. because you raninitwith an older version of hx) or needs to be updated, you can re-create it withhx entrypoint(and use--forceif needed to overwrite it).
hyphen init <app-name> [flags]
Flags
--id, i: APP ID (optional)--help, -h: Help forinitcommand
Examples
hyphen init
hyphen init "My New App"
hyphen init "My New App" --id my-custom-app-id
link
linkShorten a URL and optionally generate a QR code.
hyphen link <long_url> [flags]
Flags
--code: Custom short code--domain: The domain to use when shortening--qr: Generate a QR code--tag: Tag the shortened URL.--title: The title for the shortened URL--help, -h: Help forlinkcommand
project
projectManage projects within your organization.
Subcommands
create: Create a new projectget: Get a projectlist: List projects in your organization
project create
project createThis command allows you to:
- Create a new project with a specified name
- Automatically generate an alternate ID based on the project name
The project name:
- Can include spaces and special characters
- Will be trimmed of leading/trailing spaces and quotes
The alternate ID:
- Is automatically generated from the project name
- Contains only alphanumeric characters and hyphens
- Replaces spaces with hyphens and removes other special characters
After creation, you'll receive a summary of the new project, including its:
- Name
- ID (assigned by Hyphen)
- Alternate ID (generated from the name)
hyphen project create <project-name> [flags]
Flags
-h, --helpHelp forapp createcommand
project get
project getThis command allows you to:
- Fetch detailed information about a specific project
- Use either the project name or ID as the identifier
The command will display the following details about the project:
- Name: The project's full name
- ID: The unique identifier assigned by Hyphen
- AlternateID: The human-readable identifier generated from the project name
hyphen project get <project-name or project-id> [flags]
Flags
-h, --helpHelp forproject getcommand
project list
project listThis command allows you to:
- View all projects in your current organization
- See key details of each project at a glance
For each project, the command will display:
- Name: The project's full name
- ID: The unique identifier assigned by Hyphen
- AlternateID: The human-readable identifier generated from the project name
If no projects are found in your organization, you'll be informed accordingly.
The projects are displayed in a list format, with each project's details separated by an empty line for better readability.
Note: The list is fetched based on your current organization context. Ensure you're in the correct organization before running this command.
hyphen project list [flags]
Flags
-h, --helpHelp forproject list
pull
pullRetrieves environment variables from Hyphen and decrypts them into local .env files.
This command allows you to:
- Pull a specific environment by name
- Pull all environments for the application
The pulled environments will be decrypted and saved as .env.[environment_name] files in your current directory.
hyphen pull [flags]
Flags
--environment, -e: Specific environment(s) to pull from (e.g. development, production, default)--force: Force overwrite of locally modified environment files--version: Specify a version to pull--help, -h: Help forpullcommand
push
pushEncrypt and uploads local environment variables to Hyphen.
This command allows you to:
- Push all environments found in local .env files when no environment is specified
- Push a specific environment by name
- Encrypt and securely store your environment variables in Hyphen
The command looks for .env files in the current directory with the naming convention .env.[environment_name].
hyphen push [flags]
Flags
--environment, -e: Specific environment(s) to push to (e.g. development, production, default)--help, -h: Help forpushcommand
set-org
set-orgSet the organization ID in .hx.
hyphen set-org <id>
Flags
--global: Set the org ID globally--help, -h: Help forset-orgcommand
set-project
set-projectSet the project ID in .hx.
hyphen set-project <id>
Flags
--global: Set the project ID globally--help, -h: Help forset-projectcommand
update
updateUse update to get the latest version of the Hyphen CLI
hyphen update
version
versionDisplay the current version of the Hyphen CLI
hyphen version
Updated 19 days ago
