Skip to main content

Global Options

Global options apply to every tcb command, in any order.

Options​

OptionDescription
-h, --helpShow help for the current command
-e, --env-id <envId>Environment ID. Falls back to envId in the config file, then to an interactive picker
-r, --region <region>Region, see Region
--jsonOutput JSON, see JSON Output
-y, --yesSkip all confirmation prompts and take the default answer
--verbosePrint stack traces, API request parameters, and intermediate steps
--cwd <path>/--workdir <path>Project directory, see Project Directory
--config-file <path>Config file path, resolved relative to the current directory
--mode <mode>Environment mode for loading .env, such as development or production

Region​

-r / --region requires the full region identifier; abbreviations are not supported.

RegionIdentifierDescription
Shanghaiap-shanghaiDefault for the China site
Singaporeap-singaporeDefault for the international site
Guangzhouap-guangzhouAvailable with allowlisting

ap-beijing is not available yet.

The default region depends on the site, which the local isIntl setting decides. See International Site Login to switch. If you are unsure which region you are on, run tcb env list; the trailing output shows the current region.

You can also set the region field in cloudbaserc.json to avoid passing the flag every time:

{
"envId": "your-env-id",
"region": "ap-singapore"
}

JSON Output​

StreamContent
stdoutParseable JSON only, ready for JSON.parse / jq
stderrHuman-readable logs (info / success / warn / error / debug, including progress)

Errors are also emitted as JSON on stdout:

{
"error": {
"code": "FUNCTION_NOT_FOUND",
"message": "Function app does not exist",
"exit_code": 4
}
}

Project Directory​

--cwd / --workdir have been available since v3.8.8. They are equivalent; if both are given, --cwd wins.

ItemAffected by the project directory
Config file lookupYes. Only the project directory is searched, with no traversal to parent directories. Candidates are listed in Config File Lookup
Relative paths in the configYes. functionRoot, functions[].dir, app.root, hosting, database.migrations, and @file references in integration configs
.env and --modeYes. Resolved relative to the project directory
Credentials and config write-backYes. Credentials are read from, and cloudbaserc.json written to, the project directory
Paths passed on the command lineNo. --config-file, fn deploy --dir, fn invoke @file, hosting deploy <localPath>, cloudrun --source / --targetPath, db --dir, and config pull --dir are always relative to the current directory

A missing value, a non-existent path, or a path that is not a directory returns INVALID_PARAM (exit code 3). --help performs no validation.

Common Combinations​

# Unattended run with structured output
tcb fn list --yes --json -e my-env-id

# Troubleshoot a failed deployment
tcb fn deploy app --verbose -e my-env-id

# Operate on a monorepo sub-project from the repo root
tcb fn deploy --cwd apps/shop -e my-env-id

Notes​

  • --env-id is equivalent to the legacy --envId; write --env-id in new scripts
  • When the environment is outside the default region (Shanghai), the CLI prompts to switch regions and retries
  • The command signatures in --help come from the CLI itself, so having an AI read them first reduces hallucinated commands