#650·cli

feat: store project id and type on --save-as

Author: margaretjguCreated Sep 14, 2026Updated Sep 14, 2026
Labelsenhancementcloud

--save-as writes elasticsearch and kibana blocks only (src/cloud/credentials.ts buildProjectContext). The Cloud block and the project id are dropped. Later reset-credentials, patch, or delete need --id from memory or from the create JSON.

On --save-as:

  • Keep the active cloud block on the new context (or copy it from --use-context)
  • Store project_id, project_type (search / observability / security), and region_id on the context
  • elastic status --json and elastic config context list --json show those fields

reset-credentials --save-as <same-name> should resolve --id from the context when omitted.

Acceptance: create with --save-as demo, then elastic --use-context demo cloud serverless projects observability get works without --id. Context YAML has cloud plus project metadata. Tests cover create and reset.