MCPcopy
hub / github.com/npmx-dev/npmx.dev / detectAuthFailure

Function detectAuthFailure

cli/src/npm-client.ts:102–122  ·  view source on GitHub ↗
(stderr: string)

Source from the content-addressed store, hash-verified

100}
101
102function detectAuthFailure(stderr: string): boolean {
103 const authPatterns = [
104 'ENEEDAUTH',
105 'You must be logged in',
106 'authentication error',
107 'Unable to authenticate',
108 'code E401',
109 'code E403',
110 '401 Unauthorized',
111 '403 Forbidden',
112 'not logged in',
113 'npm login',
114 'npm adduser',
115 ]
116 const lowerStderr = stderr.toLowerCase()
117 logDebug('Checking for auth failure in stderr:', stderr)
118 logDebug('Auth patterns:', authPatterns)
119 const result = authPatterns.some(pattern => lowerStderr.includes(pattern.toLowerCase()))
120 logDebug('Auth failure:', result)
121 return result
122}
123
124function filterNpmWarnings(stderr: string): string {
125 return stderr

Callers 2

execNpmInteractiveFunction · 0.85
execNpmFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected