Skip to content

fix(DX-10057): remove dead --branch flag from auth:tokens:add - #2676

Open
cs-raj wants to merge 1 commit into
v2-devfrom
feat/DX-10057-cleanup-deprecated-flags-aliases
Open

fix(DX-10057): remove dead --branch flag from auth:tokens:add#2676
cs-raj wants to merge 1 commit into
v2-devfrom
feat/DX-10057-cleanup-deprecated-flags-aliases

Conversation

@cs-raj

@cs-raj cs-raj commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Removes the --branch hidden flag from auth:tokens:add — it was defined in the flag schema but never read in run() and never persisted in configHandler.set(). Token objects were always saved as { token, apiKey, type } or { token, apiKey, environment, type }branch was never included. The feature was planned but never completed.
  • Removes two it.skip tests that only existed to cover branch-on-token behaviour.
  • Removes --branch args from the one active test that was passing them vacuously (assert was inside a catch block that never fired, since oclif accepted the flag without error).

Root cause

The --branch flag appears to be an early design for branch-scoped token storage that was never finished. There are zero reads of addTokenFlags.branch anywhere in the command, and no branch field in any configHandler.set call.

Test plan

  • Run npx mocha --require ts-node/register --require tsconfig-paths/register test/unit/commands/tokens-add.test.ts in packages/contentstack-auth — 5 passing, 2 pre-existing failures (unrelated nock.cleanAll issue present on v2-dev before this change)
  • Verify csdx auth:tokens:add --branch main now errors with Unexpected argument: --branch

Related

Part of DX-10057 deprecated flags/aliases cleanup (cli-plugins PR: contentstack/cli-plugins#325)

🤖 Generated with Claude Code

The --branch flag was defined in the flags schema but never read in
run() and never persisted in configHandler.set(). Token objects were
always saved as { token, apiKey, type } or { token, apiKey, environment,
type } — branch was never included. The feature was planned but never
completed.

Removed:
- --branch flag definition in auth/tokens/add.ts
- Two it.skip tests that only existed to test branch-on-token behaviour
- --branch args from the one active test that passed them (test was
  asserting on errorStub which was never called, making it vacuous)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@cs-raj
cs-raj requested a review from a team as a code owner August 3, 2026 06:21
@snyk-io

snyk-io Bot commented Aug 3, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

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