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

Open
#650 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
74/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
elasticsearch, typescript
Domain
cli, cloud

Research direction

Start in src/cloud/credentials.ts at buildProjectContext and trace how --save-as and --use-context build context data. Check the create and reset-credentials command paths, then run the relevant tests for create and reset. Done means the saved context retains cloud, project_id, project_type, and region_id, and the stated observability get command works without --id.

Written by the indexing model from the issue text.

Description

cloud enhancement

--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.

Dominant language
TypeScript
Stars
43
Forks
24
Avg merge
1d 6h
Merged PRs (30d)
59

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from elastic/cli

All issues in elastic/cli

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.