Skip to content

refactor(stack): rename top-level es to stack es#201

Merged
MattDevy merged 2 commits into
mainfrom
claude/youthful-bouman-1ab079
Apr 17, 2026
Merged

refactor(stack): rename top-level es to stack es#201
MattDevy merged 2 commits into
mainfrom
claude/youthful-bouman-1ab079

Conversation

@MattDevy

Copy link
Copy Markdown
Contributor

Closes part of #193. Sibling to #199.

Summary

Renames the top-level elastic es command to elastic stack, with the existing Elasticsearch tree nested underneath as elastic stack es …. This aligns the CLI with how the product is organized around the Elastic Stack (Elasticsearch, Kibana, Fleet) and leaves a clean scaffold for future stack kibana and stack fleet groups.

New tree

elastic stack
└── es <namespace> <command>       (verbatim content from today's `elastic es …`)

The es sub-tree itself is unchanged. Codegen output (src/es/apis/**/*.ts, src/es/apis.ts) is untouched. registerEsCommands() still returns a group named es — the re-parenting happens at registration time in src/cli.ts by wrapping it in a stack group. Adding stack kibana / stack fleet later is a one-liner next to the existing registerEsCommands() call.

Design notes

  • Clean break, no aliases. Project is 0.1.0-alpha.1, so I'm not keeping elastic es … around.
  • Scaffold only for kibana/fleet. The cli distinguishes between elastic "cloud" and "serverless" - and it shouldn't #193 mentions stack kibana and stack fleet as future groups; those APIs don't exist yet, so I only added the top-level stack container and didn't prematurely wire up empty sub-groups.
  • Directory names unchanged. src/es/ and registerEsCommands stay as-is. The content is still ES-specific, and renaming is churn without payoff — the directory name is an implementation detail of a module that composes into the larger tree.

Migration

Before After
elastic es search --index my-index elastic stack es search --index my-index
elastic es indices create --index foo elastic stack es indices create --index foo
elastic es cat health elastic stack es cat health
elastic es helpers scroll-search … elastic stack es helpers scroll-search …

Out of scope

Files changed

  • src/cli.ts — replaced the lazy-load branch for es with one for stack; wraps registerEsCommands() in a stack group. Updated the top-level program description.
  • src/es/register.ts, src/es/types.ts — doc comments updated to show elastic stack es … in examples.
  • README.md### es section renamed to ### stack, examples updated.
  • package.jsondescription updated to match the new top-level tagline.
  • test/cli.test.ts — updated the two ['es', 'info'] preAction-error invocations to ['stack', 'es', 'info']; added three new smoke tests covering top-level help, elastic stack --help, and elastic stack es --help.

Test plan

  • npx tsc --noEmit clean.
  • npm run test:unit — 862/862 passing (includes 3 new stack command-tree smoke tests).
  • npm run test:lint clean.
  • node dist/cli.js --help shows stack and no longer shows es at the top level.
  • node dist/cli.js stack --help lists es as the only sub-group.
  • node dist/cli.js stack es --help shows the full namespace tree (indices, cluster, ml, cat, …) and top-level leaves (search, bulk, reindex, …).
  • node dist/cli.js stack es search --help shows a real leaf command with all its flags.

MattDevy and others added 2 commits April 17, 2026 17:37
Promote `stack` to a top-level command with `es` as its first sub-group,
so `elastic es …` becomes `elastic stack es …`. Future `stack kibana`
and `stack fleet` groups are reserved but not yet implemented.

The `es` sub-tree itself is unchanged: codegen output
(src/es/apis/**/*.ts, src/es/apis.ts) is untouched and registerEsCommands()
still returns a group named `es`. The re-parenting happens at registration
time in src/cli.ts by wrapping it in a `stack` group.

Clean break, no aliases. Project is 0.1.0-alpha.1.

- src/cli.ts: lazily loads `stack` branch, wrapping `registerEsCommands()`.
  Dropped the top-level `es` branch. Updated program description.
- src/es/register.ts, src/es/types.ts: doc comments updated to show
  `elastic stack es …` in examples.
- README.md: `### es` section renamed to `### stack`, examples updated.
- package.json: `description` updated to match the new top-level tagline.
- test/cli.test.ts: updated the two `['es', 'info']` invocations to
  `['stack', 'es', 'info']`; added `stack` command-tree smoke tests
  covering top-level help, `stack --help`, and `stack es --help`.
@MattDevy MattDevy marked this pull request as ready for review April 17, 2026 16:39
@github-actions

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 2.87s
✅ REPOSITORY gitleaks yes no no 9.93s
✅ REPOSITORY git_diff yes no no 0.04s
✅ REPOSITORY secretlint yes no no 2.03s
✅ REPOSITORY trivy yes no no 16.58s
✅ TYPESCRIPT eslint 4 0 0 4.82s

See detailed reports in MegaLinter artifacts
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

@MattDevy MattDevy merged commit 9f5e7db into main Apr 17, 2026
16 of 17 checks passed
@MattDevy MattDevy deleted the claude/youthful-bouman-1ab079 branch April 17, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants