Skip to content

refactor(npm): share the allowed tokenEnv names message - #3905

Merged
dyoshikawa merged 3 commits into
mainfrom
resolve-issue-3568-token-env-message
Nov 20, 2026
Merged

dyoshikawa merged 3 commits into
mainfrom
resolve-issue-3568-token-env-message

Conversation

@dyoshikawa

Copy link
Copy Markdown
Owner

Refs #3568

Summary

Resolves item 6, second bullet, of #3568: the text listing which names tokenEnv may use was written out separately in resolveNpmToken (install), add --token-env and the doctor hint.

  • Add ALLOWED_NPM_TOKEN_ENV_NAMES_HINT in src/lib/npm-client.ts, next to isAllowedNpmTokenEnvName.
  • Use it in src/lib/npm-client.ts, src/lib/add.ts and src/lib/doctor.ts.

The install and add error messages stay word for word the same. The doctor hint for config/token-env-not-allowed now uses the same wording as the other two (It must be "NPM_TOKEN", "NODE_AUTH_TOKEN", or end with "_NPM_TOKEN" ...).

Remaining items in #3568 (not in this PR)

  • 4 and 5: the js-yaml override range in pnpm-workspace.yaml, and gray-matter's js-yaml 3 for npm consumers. These touch workspace/dependency config.
  • 6, third bullet: reportIntegrityMismatch (sources) and assertFrozenSkillIntegrity (gh) use different policies today. The gh one skips hashes not written by rulesync and only checks under --frozen, so merging them needs a design decision.
  • 10: binding the token variable to a registry origin is a design choice.
  • 11: a doctor test for the NPM_TOKEN fallback needs a new doctor diagnostic first.

Tests

  • doctor.test.ts: the config/token-env-not-allowed case now also checks the hint.
  • The existing add / npm-client / install-npm tests that match is not allowed still pass.
  • pnpm cicheck: everything passed except a timeout in src/utils/glob.test.ts, which happens under load. That file passed when run alone.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4

dyoshikawa and others added 3 commits November 20, 2026 08:49
install, add and doctor each spelled out which names tokenEnv may use.
Move the text into one ALLOWED_NPM_TOKEN_ENV_NAMES_HINT constant next to
isAllowedNpmTokenEnvName so the three cannot drift apart.

Refs #3568

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
The add, npm-client and install-npm tests only matched "is not allowed".
Check that the message also carries ALLOWED_NPM_TOKEN_ENV_NAMES_HINT.

Refs #3568

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
@dyoshikawa
dyoshikawa merged commit a622c48 into main Nov 20, 2026
10 checks passed
@dyoshikawa
dyoshikawa deleted the resolve-issue-3568-token-env-message branch November 20, 2026 00:24
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