# Hook diagnostics

`--doctor` explains what the installer hook would do on this computer, without sending anything. Run it as the same user who visited your website.

```sh
sh clitrail.sh --doctor
# or, without downloading the script first:
curl -fsS https://YOUR_SERVICE/v1/projects/YOUR_WEBSITE_ID/report.sh \
  | sh -s -- --doctor
```

```
CLItrail installer hook diagnostics. Nothing was sent; folder paths and receipts are never shown.
  System      macOS
  Arch        arm64
  Timezone    Europe/Berlin
  Language    en-US
  Default     chrome (the https handler in LaunchServices)
  Project     p_04de14934e8005ed97dd
  Path        ip_4c1f0a9e3b7d2c6e8f10 (set in this hook)
  Service     https://YOUR_SERVICE
  Transport   curl
  Opt-out     none (DO_NOT_TRACK=1 or CLITRAIL_DISABLE=1 turns the hook off)
  CI          not detected
  Notice      one line on stderr when it is a terminal (CLITRAIL_QUIET=1 hides it)
  Browsers    Google Chrome: Default (1 marker), Profile 1 (0 markers)
              Firefox: abcd1234.default-release (0 markers)
  Families    chrome, firefox
  Scanned     3 of 3 folders, 1 file
  Markers     1 for this project
  Status      on: an install would send 1 receipt
```

It never prints folder paths, site folder names or receipts: only browser and profile names, counts and settings. Unlike a normal run, it also works with an opt-out set or in CI, so you can see why reporting is off.

## Reading the output

| Line | What to look for |
| --- | --- |
| System | `macOS` or `Linux`. On other systems, installs report nothing. |
| Arch, Timezone, Language, Default | What an install would report about this machine, or `not sent` with the reason. The default browser says where it was read. |
| Project, Path, Service | Your website ID, the install path ID and where it came from (written in, `--install-path` or `CLITRAIL_INSTALL_PATH`), and an https service address. |
| Transport | `curl` or `wget`. Without either, installs report nothing. |
| Opt-out, CI | Whether `DO_NOT_TRACK`, `CLITRAIL_DISABLE` or a CI variable turns reporting off. |
| Browsers | Each supported browser found, with the markers for your website in each profile. A profile marked `not scanned` was skipped at the time or file limit. |
| Families | The browser families an install would report as present. |
| Markers | The receipts an install would send now. |
| Status | `on` with what would be sent, or `off` with the reason. |

## Machine-readable check

`--dry-run` runs the same scan and prints one line of JSON, for scripts and CI of your own integration (with `CLITRAIL_ALLOW_CI=1`):

```json
{"roots":3,"markers":1,"files_checked":1,"truncated":false}
```

`roots` counts the storage folders scanned, `markers` the receipts found for your website, and `truncated` is `true` when the time or file limit stopped the scan.
