The CLI should resolve context from one source:
- Command-line inputs
XATA_* env vars
- Initialized local config
Or possibly multiple, but with clear precedence and required or not scope !
Current behavior is inconsistent: some env vars work, some are detected but not used, and clone commands still require local init even when command-line inputs are complete. (and possibly other commands are also problematic, I did not dig into all of them (yet) ).
Confirmed failures:
- Env vars partly work, but
XATA_PROJECT_ID is not used where projectID is required. (and possibly other cases of wrong behavior / discovery on other env vars, did not note down all of the cases).
Works:
XATA_ORGANIZATION_ID="$ORGID" xata-cli project list --json
Fails:
XATA_ORGANIZATION_ID="$ORGID" \
XATA_PROJECT_ID="$PROJECTID" \
xata-cli branch list --json
Actual, with the command name substituted:
Error: Missing required path parameter: projectID
Same projectID failure with:
xata-cli branch metrics --json
xata-cli clone start ...
xata-cli clone stream ...
This still fails after also setting XATA_BRANCH_ID, XATA_BRANCH, and XATA_DATABASE. The CLI prints those env-derived values in its config status, but does not use project_id for the API path.
- Clone commands still require
xata init even when command-line inputs are complete.
xata-cli clone <start|stream> \
--source-url "$SCALEWAY_DB2_URL" \
--target postgres \
--organization "ORGID" \
--project "PROJECTID" \
--branch "BRANCHID" \
--target-url "$XATA_DB1_URL" \
--validation-mode relaxed
Actual:
Error: xata clone <start|stream> command only works when using a config file based project.
Please use xata init command to initialize a new project.
Minimum-context rule:
Only require values used by the command.
xata-cli project list --organization "$ORGID"
xata-cli branch list --organization "$ORGID" --project "$PROJECTID"
xata-cli clone start --organization "$ORGID" --project "$PROJECTID" --branch "$BRANCHID" ...
Expected behavior:
- Precedence: command-line inputs > env vars > local config.
- Do not require duplicate context from another source.
- Do not require unrelated context for the current command.
- If something is missing, report the specific missing value.
Version: confirmed with xata-cli 1.5.4
The CLI should resolve context from one source:
XATA_*env varsOr possibly multiple, but with clear precedence and required or not scope !
Current behavior is inconsistent: some env vars work, some are detected but not used, and clone commands still require local init even when command-line inputs are complete. (and possibly other commands are also problematic, I did not dig into all of them (yet) ).
Confirmed failures:
XATA_PROJECT_IDis not used whereprojectIDis required. (and possibly other cases of wrong behavior / discovery on other env vars, did not note down all of the cases).Works:
XATA_ORGANIZATION_ID="$ORGID" xata-cli project list --jsonFails:
Actual, with the command name substituted:
Same
projectIDfailure with:xata-cli branch metrics --jsonxata-cli clone start ...xata-cli clone stream ...This still fails after also setting
XATA_BRANCH_ID,XATA_BRANCH, andXATA_DATABASE. The CLI prints those env-derived values in its config status, but does not useproject_idfor the API path.xata initeven when command-line inputs are complete.Actual:
Minimum-context rule:
Only require values used by the command.
Expected behavior:
Version: confirmed with
xata-cli1.5.4