Skip to Content
CLIGlobal Options

Global Options and Auth

Global options are available for all Flexkit CLI commands.

Global Options

OptionDescription
-h, --helpOutput usage information.
-v, --versionOutput the CLI version.
--cwd <DIR>Set the working directory for this command invocation.
-A, --local-config <FILE>Path to a local flexkit.config.[js|ts] project config file. .tsx is not accepted.
-Q, --global-config <DIR>Path to the global configuration directory.
-d, --debugEnable debug output, including every API request and its response status.
--no-colorDisable colored output.
-S, --scope <SCOPE>Set a custom scope (used by commands that support scoped operations, such as project).
-t, --token <TOKEN>Use a token for this run instead of persisted credentials.
--api <URL>Send requests to another API host than https://api.flexkit.io.

Options shared by project commands

Commands that act on a project’s data (automations, records, skills, query and the others) also accept these options:

OptionDescription
-p, --project <ID>The project to act on. See how commands choose a project.
--jsonPrint machine-readable JSON on stdout instead of tables.
-y, --yesSkip confirmation prompts for destructive actions, such as rm.

Choosing a project

Commands resolve the project they act on in this order:

  1. The --project option.
  2. The FLEXKIT_PROJECT_ID environment variable.
  3. The nearest .flexkit/project.json, written by flexkit link, searched from the current folder upwards.
  4. The project in the local flexkit.config.ts, when it defines exactly one.

Environment variables

VariableDescription
FLEXKIT_TOKENAPI token to use instead of the stored login. --token takes precedence.
FLEXKIT_PROJECT_IDProject to act on when --project is not given.
FLEXKIT_API_URLAPI host to use, like --api.

Authentication Behavior

  • Commands that require auth prompt for login in TTY mode if no credentials exist.
  • In non-interactive environments, set FLEXKIT_TOKEN or pass --token. Create tokens in the dashboard; see API tokens.
  • Token format must be flk- followed by 32 hexadecimal characters.
  • login, logout, whoami, unlink and help can run without an existing token.
  • Every command acts with your own role and space memberships. Commands that need a person (for example chat) say so on their page; with a token they fail with a clear error.

Output and exit codes

  • Tables, progress and messages are written to stderr. Data requested with --json is written to stdout, so flexkit automations ls --json | jq always receives clean JSON.
  • Commands exit with 0 on success, 1 on errors, and 2 after printing help.
  • Destructive commands ask for confirmation. Without a terminal they refuse to run unless you pass --yes, so a script never hangs on a prompt.

Common Examples

# Show CLI version
flexkit --version
 
# Use a specific project config file
flexkit --local-config ./config/flexkit.config.ts deploy
 
# Run in CI with a token and a project from the environment
FLEXKIT_TOKEN=flk-... FLEXKIT_PROJECT_ID=abcdefghij flexkit automations ls --json
 
# Act on another project than the linked one for a single command
flexkit records ls product --project abcdefghij
 
# Delete without a prompt in a script
flexkit skills rm skl_123 --yes
 
# See every API request a command makes
flexkit automations ls --debug
Last updated on