Skip to content

feat(cli): add whoami command#2881

Open
matthewvolk wants to merge 1 commit intoalphafrom
CATALYST-1759-whoami
Open

feat(cli): add whoami command#2881
matthewvolk wants to merge 1 commit intoalphafrom
CATALYST-1759-whoami

Conversation

@matthewvolk
Copy link
Contributor

What/Why?

CATALYST-1759: Adds a catalyst whoami command that verifies stored credentials and displays store/project info.

Credential resolution follows the same priority as other CLI commands: CLI flags → env vars (CATALYST_STORE_HASH, CATALYST_ACCESS_TOKEN) → .bigcommerce/project.json config. Calls the V2 Store Information API to verify the token and fetch the store name, and optionally looks up the linked project name if projectUuid is set in config.

Dependency on #2876 (CATALYST-1744): This branch adds storeHash/accessToken to ProjectConfigSchema so it works standalone. The rebase onto alpha after #2876 merges will be a trivial conflict.

Changes

  • packages/catalyst/src/cli/commands/whoami.ts — new whoami command
  • packages/catalyst/src/cli/lib/project-config.ts — add storeHash/accessToken to schema (matches [Catalyst-1744] Write additional variables to project config #2876)
  • packages/catalyst/src/cli/program.ts — register whoami command
  • packages/catalyst/tests/mocks/handlers.ts — add MSW handler for GET /v2/store

Testing

# no credentials — helpful message
catalyst whoami

# with flags — displays store info
catalyst whoami --store-hash <hash> --access-token <token>

# invalid token — reports auth error
catalyst whoami --store-hash <hash> --access-token bad-token

# via env vars
CATALYST_STORE_HASH=xxx CATALYST_ACCESS_TOKEN=yyy catalyst whoami

Build, lint, and all 47 existing tests pass.

Migration

None.

@matthewvolk matthewvolk requested a review from a team as a code owner February 13, 2026 00:54
@vercel
Copy link

vercel bot commented Feb 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
catalyst Ready Ready Preview, Comment Feb 13, 2026 0:55am

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Feb 13, 2026

🦋 Changeset detected

Latest commit: 4e32b56

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@bigcommerce/catalyst Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

});

async function fetchStoreInformation(storeHash: string, accessToken: string, apiHost: string) {
const response = await fetch(`https://${apiHost}/stores/${storeHash}/v2/store`, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm is there another api we could use instead of a V2 endpoint?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need a changeset yet for this stuff

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