elastic / elastic/cli

fix: missing config errors should name the next command

Open
#631 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
41
Forks
24
Avg merge
1d 3h
Merged PRs (30d)
56

Description

A missing or empty config writes the raw loader error and exits (`src/cli.ts` preAction). A new user or agent that runs `elastic stack es ping` with no `~/.elasticrc.yml` should be told exactly what to run.

On missing file, empty `current_context`, or unresolved credentials:

- Local/TTY: point at `elastic config context add` and `elastic status`
- Non-TTY / CI: name `ELASTIC_CLI_CONFIG_FILE` and the required YAML keys
- 401/403 from a configured context: point at `elastic status --json` and `elastic config context edit`

Do not build the #625 quickstart wizard here. This is the error path only.

Acceptance: wipe config, run `elastic stack es ping`, stderr names `elastic config context add`. Same message under `--json` as `error.code` plus `error.message`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.