feat: support PRISMIC_TOKEN env var to override stored token#191
Open
angeloashmore wants to merge 4 commits into
Open
feat: support PRISMIC_TOKEN env var to override stored token#191angeloashmore wants to merge 4 commits into
angeloashmore wants to merge 4 commits into
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c3e2a17. Configure here.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Resolves:
Description
Adds a
PRISMIC_TOKENenvironment variable that takes priority over the token stored in the credentials file. Useful for CI, scripted use, and ephemeral environments where persisting a token to disk is undesirable.The env value is kept in memory only —
refreshToken()early-returns whenPRISMIC_TOKENis set so the value is never written to the credentials file.Mirrors the existing
PRISMIC_HOSTpattern insrc/auth.ts.Checklist
Preview
How to QA
node --run buildPRISMIC_TOKEN=<valid-token> ./dist/index.mjs whoami— should print the email associated with that token.PRISMIC_TOKENset, run any authenticated command and confirm the credentials file'stokenfield is unchanged afterward.Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Note
Medium Risk
Changes how all authenticated commands resolve tokens and refresh behavior; mistakes could affect CI/scripts or leave users stuck on bad env tokens, but scope is small and mirrors PRISMIC_HOST.
Overview
Adds optional
PRISMIC_TOKENenv support so authentication can use an in-memory token instead of the on-disk credentials file—aligned with the existingPRISMIC_HOSToverride pattern.getToken()returns the env value when set;refreshToken()no-ops in that case so refreshed tokens are never persisted to the credentials file.prismic initsurfaces a clear error whenPRISMIC_TOKENis set but invalid, instead of falling through to browser login. Coverage includes awhoamitest that runs withPRISMIC_TOKENafter logout.Reviewed by Cursor Bugbot for commit e8920ef. Bugbot is set up for automated code reviews on this repo. Configure here.