Add HTTP/HTTPS proxy support via undici ProxyAgent - #1
Merged
Conversation
Co-authored-by: rattalur <145406381+rattalur@users.noreply.github.com>
Co-authored-by: rattalur <145406381+rattalur@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add first-class proxy support to Codacy CLI
Add HTTP/HTTPS proxy support via undici ProxyAgent
Sep 3, 2026
rattalur
marked this pull request as ready for review
September 3, 2026 07:05
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.
Node's built-in
fetch(used by the generated API client) doesn't automatically honorHTTP_PROXY/HTTPS_PROXY/NO_PROXY, so the CLI was unable to reachapp.codacy.com(or a customCODACY_API_BASE_URL) from behind a corporate proxy on any Node version this CLI supports.Proxy resolution helper
src/utils/proxy.ts:resolveProxyUrl(env)— resolvesHTTPS_PROXY/HTTP_PROXY(case-insensitive; uppercase andHTTPS_PROXYtake priority).shouldBypassProxy(env, host)— honorsNO_PROXY/no_proxy(exact match,.suffixmatch,*) against the Codacy API host.configureProxyFromEnv(env)— installs anundici.ProxyAgentviasetGlobalDispatcherwhen applicable; returnsundefined(no-op) when no proxy is configured or it's bypassed.Wiring
src/index.tscallsconfigureProxyFromEnv()beforeOpenAPI.BASE/OpenAPI.HEADERSare set and before any command is registered, so every subsequentfetch()routes through the proxy automatically.undicias a direct dependency rather than relying on the transitive copy or Node 24's experimentalNODE_USE_ENV_PROXY.Docs & changeset
README.md: new "Proxy Support" section.AGENTS.md:HTTPS_PROXY/HTTP_PROXY/NO_PROXYadded to the Environment Variables table.