{"name":"@percy/cli-doctor","version":"1.32.12","license":"MIT","_id":"@percy/cli-doctor@1.32.12","maintainers":[{"name":"percy-admin","email":"apps+npm@percy.io"}],"homepage":"https://github.com/percy/cli#readme","bugs":{"url":"https://github.com/percy/cli/issues"},"dist":{"shasum":"8bec8eadfb605ed864370bffdf0a9b5d4e6c9380","tarball":"http://registry-npm.ywwl.com/@percy/cli-doctor/download/@percy/cli-doctor-1.32.12.tgz","fileCount":15,"integrity":"sha512-Bq6sbz+4ZxiDxg1qjKPxURy3diqgd6ATfcZ8mOTIzd+hauTBF6dUhGjGecEZrUggsmscwH/SPjw/ThnlrKAOag==","signatures":[{"sig":"MEQCIEFwKYveZtjFtg5Q0GnhFkIAoBmN+KfjWwbHC1mwFiEWAiA9O/8bfWgOZ0/HFueX/JV3iJuuWmTjfjlrQTVrAivVTg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIHd4o56G1dMYrE2PrwzFDFJ3WkKc6B4/95D7a+UhfPyAAiEAzUiNgxkc9/xx+QBcX3Q7sycMjOCCtVlkQIp0ObZAbu8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":149903,"size":40771,"noattachment":false,"key":"/@percy/cli-doctor/-/@percy/cli-doctor-1.32.12.tgz"},"main":"./dist/index.js","type":"module","engines":{"node":">=14"},"exports":{".":"./dist/index.js"},"gitHead":"376d037c415012691acf5770c6216959fd2aef58","scripts":{"lint":"eslint --ignore-path ../../.gitignore .","test":"node ../../scripts/test","build":"node ../../scripts/build","readme":"percy-cli-readme","test:coverage":"yarn test --coverage"},"_npmUser":{"name":"percy-admin","email":"apps+npm@percy.io"},"@percy/cli":{"commands":["./dist/doctor.js"]},"repository":{"url":"git+https://github.com/percy/cli.git","type":"git","directory":"packages/cli-doctor"},"_npmVersion":"lerna/6.0.1/node@v24.22.0+x64 (linux)","description":"> Percy CLI sub-command that diagnoses network, authentication, configuration, and CI readiness for running Percy builds.","directories":{},"_nodeVersion":"24.22.0","dependencies":{"ws":"^8.17.1","minimatch":"^9.0.0","@percy/env":"1.32.12","@percy/core":"1.32.12","@percy/client":"1.32.12","@percy/config":"1.32.12","@percy/logger":"1.32.12","@percy/monitoring":"1.32.12","@percy/cli-command":"1.32.12"},"publishConfig":{"tag":"latest","access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/cli-doctor_1.32.12_1792591982108_0.5344082432219306","host":"s3://npm-registry-packages-npm-production"},"readme":"# @percy/cli-doctor\n\n> Percy CLI sub-command that diagnoses network, authentication, configuration, and CI readiness for running Percy builds.\n\n---\n\n## Installation\n\n`@percy/cli-doctor` is bundled with `@percy/cli`. If you use the Percy CLI you already have it:\n\n```sh\nnpx percy doctor\n```\n\nTo install standalone:\n\n```sh\nnpm install --save-dev @percy/cli-doctor\n# or\nyarn add --dev @percy/cli-doctor\n```\n\n---\n\n## Usage\n\n```\npercy doctor [options]\n\nOptions:\n  --proxy-server  <url>   Proxy server to test alongside direct connectivity\n                          e.g. http://proxy.corp.example.com:8080\n  --url           <url>   URL to open in Chrome for network activity analysis\n                          (default: https://percy.io)\n  --timeout       <ms>    Per-request timeout in milliseconds\n                          (default: 10000, max: 300000)\n  --quick                 Run only connectivity, SSL, and token auth checks\n                          (~4 seconds instead of a full diagnostic run)\n  --output-json   <path>  Write the full diagnostic report to a JSON file\n  -v, --verbose           Show detailed debug output\n  -h, --help              Show help\n```\n\n---\n\n## What it checks\n\n### 1 · Configuration Validation\n\nDetects and validates Percy configuration files (`.percy.yml`, `.percy.yaml`, `percy.config.js`, etc.) via cosmiconfig:\n\n- Reports file location and format\n- Warns on missing or outdated `version` field (recommends version 2)\n- Detects project-type/config mismatches (e.g., automate-only keys like `fullPage` used with a web token)\n\n| Category | Meaning |\n|---|---|\n| `config_not_found` | No Percy config file detected |\n| `config_found` | Config file located and loaded |\n| `config_parse_error` | Config file has YAML/JSON syntax errors |\n| `config_version_invalid` | `version` field is missing or non-numeric |\n| `config_version_outdated` | Config uses an outdated version (< 2) |\n| `config_key_automate_only` | Config contains Automate-only keys but token is not Automate |\n| `config_key_web_only` | Config contains Web-only keys but token is not a Web token |\n\n### 2 · CI Environment Detection\n\nDetects your CI provider and validates CI-related settings:\n\n- Identifies 10+ CI systems (GitHub Actions, GitLab CI, Jenkins, CircleCI, Travis, etc.)\n- Validates git availability for commit/branch detection\n- Checks parallel build configuration (`PERCY_PARALLEL_TOTAL` + `PERCY_PARALLEL_NONCE`)\n\n| Category | Meaning |\n|---|---|\n| `ci_not_detected` | Not running in a CI environment |\n| `ci_detected` | CI system identified |\n| `ci_commit_missing` | Commit SHA could not be detected |\n| `ci_commit_found` | Commit SHA available |\n| `ci_branch_missing` | Branch name could not be detected |\n| `ci_parallel_nonce_missing` | `PERCY_PARALLEL_TOTAL` set without `PERCY_PARALLEL_NONCE` |\n| `ci_parallel_config_valid` | Both parallel env vars are set correctly |\n| `ci_git_available` | Git repository detected |\n| `ci_git_check_skipped` | Git check suppressed via `PERCY_SKIP_GIT_CHECK=true` |\n| `ci_git_unavailable` | Git not installed or not in a git repository |\n\n### 3 · Environment Variable Audit\n\nInventories all Percy-specific environment variables:\n\n- Lists all set `PERCY_*` vars (names only — values are never exposed)\n- Validates `PERCY_PARALLEL_TOTAL` is a positive integer\n- Flags manual overrides (`PERCY_COMMIT`, `PERCY_BRANCH`, `PERCY_PULL_REQUEST`)\n- Warns when `NODE_TLS_REJECT_UNAUTHORIZED=0` disables SSL validation\n\n| Category | Meaning |\n|---|---|\n| `env_system_info` | OS, Node version, CPU, and RAM summary |\n| `env_no_percy_vars` | No `PERCY_*` environment variables detected |\n| `env_vars_listed` | Lists names of all set `PERCY_*` variables |\n| `env_parallel_total_invalid` | `PERCY_PARALLEL_TOTAL` is not a valid positive integer |\n| `env_manual_overrides` | Manual override vars active (e.g. `PERCY_COMMIT`, `PERCY_BRANCH`) |\n| `env_tls_disabled` | `NODE_TLS_REJECT_UNAUTHORIZED=0` — SSL validation globally disabled |\n\n### 4 · Network Connectivity\n\nProbes each required Percy / BrowserStack domain:\n\n| Domain | Purpose |\n|---|---|\n| `https://percy.io` | Percy API |\n| `https://www.browserstack.com` | BrowserStack API |\n| `https://hub.browserstack.com` | BrowserStack Automate |\n\nFailure modes are classified as:\n\n* **ENOTFOUND** → DNS resolution failure; suggest whitelisting on corporate DNS\n* **ETIMEDOUT / ECONNRESET** → Firewall dropping packets; list CIDRs to whitelist\n* **via proxy only** → Proxy required, suggests setting `HTTPS_PROXY`\n\n### 5 · SSL / TLS\n\n| Scenario | Outcome |\n|---|---|\n| `NODE_TLS_REJECT_UNAUTHORIZED=0` is set | **Warning** – SSL verification is disabled globally |\n| SSL certificate error connecting to percy.io | **Fail** – likely a MITM proxy/VPN; suggests remediation |\n| SSL handshake succeeds | **Pass** |\n\nWhen a certificate error is detected, the command prints actionable suggestions\n(contact network admin, add proxy cert to trust store, set `NODE_EXTRA_CA_CERTS`).\n\n### 6 · Proxy Detection\n\nDetects proxy configuration from (in priority order):\n\n1. **Environment variables**: `HTTPS_PROXY`, `HTTP_PROXY`, `ALL_PROXY`, `NO_PROXY`\n2. **macOS system proxy**: `scutil --proxy`, `networksetup -getautoproxyurl`\n3. **Linux (GNOME)**: `gsettings org.gnome.system.proxy`\n4. **Linux (/etc)**: `/etc/environment`\n5. **Windows registry**: `HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings`\n\nEach discovered proxy is validated by attempting connections to percy.io and\nbrowserstack.com through it.\n\n### 7 · PAC / WPAD Auto-Proxy Configuration\n\nDetects PAC file URLs from:\n\n| Source | Detection method |\n|---|---|\n| macOS system | `networksetup -getautoproxyurl <interface>` |\n| macOS plist | `/Library/Preferences/SystemConfiguration/preferences.plist` |\n| Linux GNOME | `gsettings org.gnome.system.proxy autoconfig-url` |\n| Windows | `HKCU\\…\\Internet Settings\\AutoConfigURL` |\n| Chrome / Chromium | `Default/Preferences` JSON (macOS, Linux, Windows) |\n| Firefox | `~/.mozilla/firefox/*/prefs.js` (network.proxy.autoconfig_url) |\n\nThe PAC script is fetched and evaluated in a sandboxed Node.js `vm` context\nusing shims for all standard PAC helper functions. The result of\n`FindProxyForURL(\"https://percy.io/\", \"percy.io\")` is reported.\n\nIf a PAC file routes percy.io through a proxy the command surfaces the exact\n`HTTPS_PROXY=…` export statement to add to your CI environment.\n\n### 8 · Token Authentication\n\nValidates the `PERCY_TOKEN` environment variable:\n\n- **Presence**: Checks the token is set\n- **Format**: Detects project type from token prefix (`web_`, `auto_`, `app_`, `ss_`, `vmw_`, `res_`) and suggests the correct CLI command\n- **Authentication**: Makes a live API call to `percy.io/api/v1/tokens` to verify the token is valid (uses proxy if one was discovered in earlier checks)\n\nToken values are **never** included in output — only the project type and pass/fail status.\n\n| Category | Meaning |\n|---|---|\n| `token_missing` | `PERCY_TOKEN` is not set or is blank |\n| `token_type_info` | Token prefix decoded — project type and suggested CLI command |\n| `token_auth_pass` | Token authenticated successfully; role shown |\n| `token_auth_fail` | Token rejected (HTTP 401 or 403) |\n| `token_auth_unexpected_status` | Percy API returned an unexpected HTTP status |\n| `token_auth_network_error` | Could not reach Percy API to validate token |\n| `check_skipped` | Token validation skipped because percy.io is unreachable |\n\n### 9 · Browser Network (Chrome CDP)\n\nLaunches headless Chrome to test end-to-end network connectivity through the browser process, including proxy and PAC resolution as Chrome would see it.\n\n---\n\n## Quick Mode\n\nUse `--quick` to run only the essential checks (connectivity, SSL, and token auth) in ~4 seconds:\n\n```sh\nnpx percy doctor --quick\n```\n\nThis is useful for fast triage in CI pipelines or when you just want to verify your token and network are working.\n\n---\n\n## Auto-Doctor on Build Failure\n\nSet `PERCY_AUTO_DOCTOR=true` to automatically run diagnostics when a Percy build fails:\n\n```sh\nexport PERCY_AUTO_DOCTOR=true\nnpx percy exec -- your-test-command\n```\n\nWhen enabled, a build failure triggers a diagnostic run and prints actionable findings inline. This is opt-in and has no effect on successful builds.\n\n---\n\n## Example output\n\n```\n  Percy Doctor — diagnostic check\n\n── Configuration\n  ℹ Configuration file detected: /project/.percy.yml\n  ✔ Config version: 2 (current)\n\n── CI Environment\n  ℹ CI system detected: GitHub Actions\n  ✔ Git is available for commit detection.\n\n── Environment Variables\n  ℹ Percy environment variables set: PERCY_TOKEN, PERCY_PARALLEL_TOTAL\n\n── SSL / TLS\n  ✔ SSL handshake with percy.io succeeded (47ms).\n\n── Network Connectivity\n  ✔ Percy API is reachable directly (HTTP 200, 51ms).\n  ✔ BrowserStack API is reachable directly (HTTP 200, 72ms).\n  ✔ BrowserStack Automate is reachable directly (HTTP 200, 89ms).\n\n── Proxy Configuration\n  ℹ No proxy configuration detected in environment or system settings.\n\n── PAC / Auto-Proxy Configuration\n  ℹ No PAC (Proxy Auto-Configuration) file detected.\n\n── Token Authentication\n  ℹ Token detected (project type: web). Use `percy exec` to run snapshots.\n  ✔ Token authentication successful.\n\n── Browser Network\n  ✔ Chrome loaded percy.io successfully.\n\n  ✔ 8 passed · 0 warnings · 0 failures (4.2s)\n```\n\n---\n\n## License\n\nMIT\n","publish_time":1792591982204,"_cnpm_publish_time":1792591982204,"dist-tags":{"alpha":"1.31.15-alpha.0","beta":"1.33.0-beta.0","latest":"1.33.1"}}