Skip to content

Fix/dx 4439 v2 dev interactive mode messages#2446

Open
harshithad0703 wants to merge 4 commits intov2-devfrom
fix/dx-4439-v2-dev-interactive-mode-messages
Open

Fix/dx 4439 v2 dev interactive mode messages#2446
harshithad0703 wants to merge 4 commits intov2-devfrom
fix/dx-4439-v2-dev-interactive-mode-messages

Conversation

@harshithad0703
Copy link
Contributor

Problem

  1. Interactive prompts after command correction: When an invalid command is corrected (e.g. csdx loginasda → "Did you mean login?" → Yes), the CLI shows i18n keys (e.g. CLI_AUTH_LOGIN_ENTER_EMAIL_ADDRESS) instead of user-friendly text (e.g. "Enter your email address").

  2. Logout confirmation message: When the user answers No to "Are you sure you want to log out?", the CLI still shows "SUCCESS: You're already logged out", which is incorrect—the user chose not to log out and remains logged in.

Solution

1. Human-readable prompts after command correction

  • New prerun hook init-context-for-command: When context.messageFilePath is missing and the current command id is available (e.g. after correction), re-build CsdxContext for that command and re-initialize messageHandler, cliux, and SDK initiators so the correct plugin message file is loaded.
  • Hook is registered as the first prerun hook.

2. Correct message when user cancels logout

  • Added message key CLI_AUTH_LOGOUT_CANCELLED: "Log out cancelled".
  • In auth:logout, when the user answers No to the confirmation and is still authenticated, show "Log out cancelled" instead of "You're already logged out". "You're already logged out" is now only shown when the user is actually not authenticated.

Testing

Interactive prompts (command correction):

  1. Run csdx loginasda (or node bin/run.js loginasda from packages/contentstack).
  2. At "Did you mean login?", answer Yes.
  3. Expected: Prompt shows "Enter your email address" (not the key).

Logout cancel:

  1. Run csdx auth:login and log in.
  2. Run csdx auth:logout, answer No to the confirmation.
  3. Expected: Message shows "Log out cancelled" (not "You're already logged out").
  4. Run csdx whoami to confirm you are still logged in.

@harshithad0703 harshithad0703 requested a review from a team as a code owner March 4, 2026 06:49
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.

1 participant