@vigilbase/cli 0.1.4 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/CLOUDFLARE.md +3 -4
  2. package/COMMANDS.md +158 -83
  3. package/LOCAL.md +721 -0
  4. package/ONE.md +2 -4
  5. package/README.md +341 -123
  6. package/SECURITY.md +2 -2
  7. package/dist/auth/device-auth.d.ts +0 -1
  8. package/dist/auth/device-auth.js +13 -8
  9. package/dist/auth/index.d.ts +4 -2
  10. package/dist/auth/index.js +3 -2
  11. package/dist/auth/provider.d.ts +18 -0
  12. package/dist/auth/provider.js +71 -0
  13. package/dist/auth/refresh.d.ts +29 -0
  14. package/dist/auth/refresh.js +199 -0
  15. package/dist/auth/store.d.ts +103 -4
  16. package/dist/auth/store.js +400 -74
  17. package/dist/auth/token-metadata.d.ts +9 -0
  18. package/dist/auth/token-metadata.js +21 -0
  19. package/dist/auth/types.d.ts +8 -2
  20. package/dist/auth/types.js +0 -1
  21. package/dist/bin.d.ts +0 -1
  22. package/dist/bin.js +0 -1
  23. package/dist/cli.d.ts +4 -2
  24. package/dist/cli.js +45 -15
  25. package/dist/commands/account.d.ts +0 -1
  26. package/dist/commands/account.js +0 -1
  27. package/dist/commands/auth.d.ts +0 -1
  28. package/dist/commands/auth.js +82 -22
  29. package/dist/commands/billing.d.ts +0 -1
  30. package/dist/commands/billing.js +0 -1
  31. package/dist/commands/cloudflare.d.ts +1 -2
  32. package/dist/commands/cloudflare.js +6 -6
  33. package/dist/commands/helpers.d.ts +15 -1
  34. package/dist/commands/helpers.js +2 -3
  35. package/dist/commands/index.d.ts +3 -2
  36. package/dist/commands/index.js +6 -2
  37. package/dist/commands/legacy-validation.d.ts +0 -1
  38. package/dist/commands/legacy-validation.js +0 -1
  39. package/dist/commands/local.d.ts +35 -0
  40. package/dist/commands/local.js +1543 -0
  41. package/dist/commands/one.d.ts +0 -1
  42. package/dist/commands/one.js +6 -7
  43. package/dist/commands/public-tools.d.ts +0 -1
  44. package/dist/commands/public-tools.js +55 -17
  45. package/dist/commands/runs.d.ts +0 -1
  46. package/dist/commands/runs.js +0 -1
  47. package/dist/commands/security.d.ts +1 -2
  48. package/dist/commands/security.js +1 -2
  49. package/dist/commands/watchdog.d.ts +0 -1
  50. package/dist/commands/watchdog.js +0 -1
  51. package/dist/index.d.ts +3 -3
  52. package/dist/index.js +1 -2
  53. package/dist/lib/banner.d.ts +0 -1
  54. package/dist/lib/banner.js +0 -1
  55. package/dist/lib/client.d.ts +4 -2
  56. package/dist/lib/client.js +42 -18
  57. package/dist/lib/cloudflare-client.d.ts +0 -1
  58. package/dist/lib/cloudflare-client.js +0 -1
  59. package/dist/lib/config.d.ts +31 -3
  60. package/dist/lib/config.js +72 -13
  61. package/dist/lib/format.d.ts +2 -1
  62. package/dist/lib/format.js +27 -7
  63. package/dist/lib/help.d.ts +1 -2
  64. package/dist/lib/help.js +37 -17
  65. package/dist/lib/network.d.ts +10 -1
  66. package/dist/lib/network.js +33 -5
  67. package/dist/lib/one-client.d.ts +5 -3
  68. package/dist/lib/one-client.js +49 -3
  69. package/dist/lib/one-operations.d.ts +0 -1
  70. package/dist/lib/one-operations.js +0 -1
  71. package/dist/lib/open-url.d.ts +0 -1
  72. package/dist/lib/open-url.js +0 -1
  73. package/dist/lib/platform.d.ts +2 -0
  74. package/dist/lib/platform.js +4 -0
  75. package/dist/lib/progress.d.ts +0 -1
  76. package/dist/lib/progress.js +0 -1
  77. package/dist/lib/security-client.d.ts +1 -2
  78. package/dist/lib/security-client.js +0 -1
  79. package/dist/lib/skill-fetch.d.ts +0 -1
  80. package/dist/lib/skill-fetch.js +0 -1
  81. package/dist/lib/system-trust.d.ts +0 -1
  82. package/dist/lib/system-trust.js +0 -1
  83. package/dist/lib/tui.d.ts +308 -0
  84. package/dist/lib/tui.js +846 -0
  85. package/dist/local/cloudflare-checkup/cf/allowlist.d.ts +94 -0
  86. package/dist/local/cloudflare-checkup/cf/allowlist.js +183 -0
  87. package/dist/local/cloudflare-checkup/cf/auth-lifecycle.d.ts +112 -0
  88. package/dist/local/cloudflare-checkup/cf/auth-lifecycle.js +312 -0
  89. package/dist/local/cloudflare-checkup/cf/child-env.d.ts +31 -0
  90. package/dist/local/cloudflare-checkup/cf/child-env.js +80 -0
  91. package/dist/local/cloudflare-checkup/cf/install.d.ts +105 -0
  92. package/dist/local/cloudflare-checkup/cf/install.js +308 -0
  93. package/dist/local/cloudflare-checkup/cf/locate.d.ts +43 -0
  94. package/dist/local/cloudflare-checkup/cf/locate.js +227 -0
  95. package/dist/local/cloudflare-checkup/cf/run-cf.d.ts +88 -0
  96. package/dist/local/cloudflare-checkup/cf/run-cf.js +274 -0
  97. package/dist/local/cloudflare-checkup/collector.d.ts +47 -0
  98. package/dist/local/cloudflare-checkup/collector.js +295 -0
  99. package/dist/local/cloudflare-checkup/contract.d.ts +2804 -0
  100. package/dist/local/cloudflare-checkup/contract.js +1620 -0
  101. package/dist/local/cloudflare-checkup/email-verification.d.ts +124 -0
  102. package/dist/local/cloudflare-checkup/email-verification.js +211 -0
  103. package/dist/local/cloudflare-checkup/errors.d.ts +29 -0
  104. package/dist/local/cloudflare-checkup/errors.js +103 -0
  105. package/dist/local/cloudflare-checkup/output.d.ts +23 -0
  106. package/dist/local/cloudflare-checkup/output.js +88 -0
  107. package/dist/local/cloudflare-checkup/prompts.d.ts +40 -0
  108. package/dist/local/cloudflare-checkup/prompts.js +139 -0
  109. package/dist/local/cloudflare-checkup/rate-budget.d.ts +41 -0
  110. package/dist/local/cloudflare-checkup/rate-budget.js +79 -0
  111. package/dist/local/cloudflare-checkup/snapshot-file.d.ts +52 -0
  112. package/dist/local/cloudflare-checkup/snapshot-file.js +185 -0
  113. package/dist/local/cloudflare-checkup/submit-client.d.ts +112 -0
  114. package/dist/local/cloudflare-checkup/submit-client.js +395 -0
  115. package/dist/local/cloudflare-checkup/terminal-ui.d.ts +170 -0
  116. package/dist/local/cloudflare-checkup/terminal-ui.js +403 -0
  117. package/dist/types.d.ts +25 -3
  118. package/dist/types.js +16 -1
  119. package/dist/version.d.ts +0 -1
  120. package/dist/version.js +0 -1
  121. package/package.json +12 -12
  122. package/dist/auth/device-auth.d.ts.map +0 -1
  123. package/dist/auth/device-auth.js.map +0 -1
  124. package/dist/auth/index.d.ts.map +0 -1
  125. package/dist/auth/index.js.map +0 -1
  126. package/dist/auth/store.d.ts.map +0 -1
  127. package/dist/auth/store.js.map +0 -1
  128. package/dist/auth/types.d.ts.map +0 -1
  129. package/dist/auth/types.js.map +0 -1
  130. package/dist/bin.d.ts.map +0 -1
  131. package/dist/bin.js.map +0 -1
  132. package/dist/cli.d.ts.map +0 -1
  133. package/dist/cli.js.map +0 -1
  134. package/dist/commands/account.d.ts.map +0 -1
  135. package/dist/commands/account.js.map +0 -1
  136. package/dist/commands/auth.d.ts.map +0 -1
  137. package/dist/commands/auth.js.map +0 -1
  138. package/dist/commands/billing.d.ts.map +0 -1
  139. package/dist/commands/billing.js.map +0 -1
  140. package/dist/commands/cloudflare.d.ts.map +0 -1
  141. package/dist/commands/cloudflare.js.map +0 -1
  142. package/dist/commands/helpers.d.ts.map +0 -1
  143. package/dist/commands/helpers.js.map +0 -1
  144. package/dist/commands/index.d.ts.map +0 -1
  145. package/dist/commands/index.js.map +0 -1
  146. package/dist/commands/legacy-validation.d.ts.map +0 -1
  147. package/dist/commands/legacy-validation.js.map +0 -1
  148. package/dist/commands/one.d.ts.map +0 -1
  149. package/dist/commands/one.js.map +0 -1
  150. package/dist/commands/public-tools.d.ts.map +0 -1
  151. package/dist/commands/public-tools.js.map +0 -1
  152. package/dist/commands/runs.d.ts.map +0 -1
  153. package/dist/commands/runs.js.map +0 -1
  154. package/dist/commands/security.d.ts.map +0 -1
  155. package/dist/commands/security.js.map +0 -1
  156. package/dist/commands/watchdog.d.ts.map +0 -1
  157. package/dist/commands/watchdog.js.map +0 -1
  158. package/dist/index.d.ts.map +0 -1
  159. package/dist/index.js.map +0 -1
  160. package/dist/lib/banner.d.ts.map +0 -1
  161. package/dist/lib/banner.js.map +0 -1
  162. package/dist/lib/client.d.ts.map +0 -1
  163. package/dist/lib/client.js.map +0 -1
  164. package/dist/lib/cloudflare-client.d.ts.map +0 -1
  165. package/dist/lib/cloudflare-client.js.map +0 -1
  166. package/dist/lib/config.d.ts.map +0 -1
  167. package/dist/lib/config.js.map +0 -1
  168. package/dist/lib/format.d.ts.map +0 -1
  169. package/dist/lib/format.js.map +0 -1
  170. package/dist/lib/help.d.ts.map +0 -1
  171. package/dist/lib/help.js.map +0 -1
  172. package/dist/lib/network.d.ts.map +0 -1
  173. package/dist/lib/network.js.map +0 -1
  174. package/dist/lib/one-client.d.ts.map +0 -1
  175. package/dist/lib/one-client.js.map +0 -1
  176. package/dist/lib/one-operations.d.ts.map +0 -1
  177. package/dist/lib/one-operations.js.map +0 -1
  178. package/dist/lib/open-url.d.ts.map +0 -1
  179. package/dist/lib/open-url.js.map +0 -1
  180. package/dist/lib/progress.d.ts.map +0 -1
  181. package/dist/lib/progress.js.map +0 -1
  182. package/dist/lib/security-client.d.ts.map +0 -1
  183. package/dist/lib/security-client.js.map +0 -1
  184. package/dist/lib/skill-fetch.d.ts.map +0 -1
  185. package/dist/lib/skill-fetch.js.map +0 -1
  186. package/dist/lib/system-trust.d.ts.map +0 -1
  187. package/dist/lib/system-trust.js.map +0 -1
  188. package/dist/types.d.ts.map +0 -1
  189. package/dist/types.js.map +0 -1
  190. package/dist/version.d.ts.map +0 -1
  191. package/dist/version.js.map +0 -1
package/LOCAL.md ADDED
@@ -0,0 +1,721 @@
1
+ # Local Cloudflare Checkup reference
2
+
3
+ `vigilbase cloudflare-checkup` runs the Vigilbase Cloudflare Checkup in local
4
+ mode: it collects your Cloudflare configuration **on your own machine** with
5
+ Cloudflare's own CLI, `cf`, writes a minimised snapshot you can inspect, and
6
+ uploads exactly that file to vigilbase.com after you confirm. vigilbase.com
7
+ evaluates it with the same scanner as the checkup in your browser, which uses a
8
+ read-only Cloudflare API token instead. Results are labelled **self-reported**;
9
+ they go to your verified work email, and the results page opens in your
10
+ browser.
11
+
12
+ Local mode is available while vigilbase.com has it switched on. The CLI checks
13
+ before it asks for your email; when local mode is off it stops with
14
+ `Local checkups aren't available right now.` and points you to the checkup in
15
+ your browser at <https://vigilbase.com/tools/cloudflare-checkup>.
16
+
17
+ `vigilbase cf checkup` runs on Vigilbase One's servers with stored credentials
18
+ (see [CLOUDFLARE.md](https://app.unpkg.com/@vigilbase/cli@0.2.1/files/CLOUDFLARE.md));
19
+ `vigilbase cloudflare-checkup` runs on your machine and needs no Vigilbase
20
+ login.
21
+
22
+ ## Quick start: one command
23
+
24
+ Run this in a terminal (while local mode is on, the checkup page at
25
+ <https://vigilbase.com/tools/cloudflare-checkup> shows the same command):
26
+
27
+ ```bash
28
+ npx @vigilbase/cli cloudflare-checkup
29
+ ```
30
+
31
+ If it answers `Unknown command "cloudflare-checkup"`, an older global install
32
+ of the CLI (0.1.x) is running instead: `npx` prefers an installed global
33
+ `@vigilbase/cli`. Run `npx @vigilbase/cli@latest cloudflare-checkup` once, or
34
+ update the global install with `npm install -g @vigilbase/cli@latest`.
35
+
36
+ The command does everything, in this order, and stops at the first problem
37
+ before any slower step:
38
+
39
+ 1. Checks Node.js (22.18 or newer; macOS, Linux or Windows x64).
40
+ 2. Asks vigilbase.com whether local checkups are available and accept this CLI
41
+ version (nothing about you is sent). If not, it stops here, before asking
42
+ for your email.
43
+ 3. Asks for your work email (`Work email for your results:`), and
44
+ vigilbase.com emails you a 6-digit code. You enter it at
45
+ `Code from the email:` (`123456`, `123 456` and `123-456` all work), and
46
+ the CLI prints `✓ Verified j***@acme.com`.
47
+ 4. Finds Cloudflare's `cf`. If none is usable (including a newer cf that
48
+ renamed a command the checkup needs), it offers to install the tested
49
+ release for Vigilbase (asks first; `--yes` answers for you). Your own cf is
50
+ left alone.
51
+ 5. Signs in to Cloudflare with a **read-only** cf login (your browser opens) if
52
+ the cf profile `vigilbase-checkup` is missing or expired. With
53
+ `CLOUDFLARE_API_TOKEN` set in the shell, cf uses that token instead and the
54
+ browser sign-in is not offered: unset the variable, or add
55
+ `--cf-auth profile`, to sign in with your browser.
56
+ 6. Lets you choose the account (one account is used as is; several get a
57
+ list to choose from).
58
+ 7. Collects with read-only cf commands, at most 900 requests per 5 minutes.
59
+ 8. Saves the snapshot to `~/.config/vigilbase/checkups/…` (mode 0600) and
60
+ shows what it contains.
61
+ 9. Asks `Results go to j***@acme.com. Upload 182 KB to https://vigilbase.com? [y/N]`
62
+ and uploads exactly that file only after an explicit `y`.
63
+ 10. Prints the results link and opens it in your browser.
64
+
65
+ In a terminal, the steps show as an interactive timeline (see
66
+ [Terminal UI and plain output](#terminal-ui-and-plain-output)):
67
+
68
+ ```
69
+ $ npx @vigilbase/cli cloudflare-checkup
70
+ ◆ Vigilbase Cloudflare Checkup
71
+ │
72
+ ◇ Work email › j***@acme.com
73
+ ◇ Code sent to j***@acme.com › ●●●●●● ✓ verified
74
+ │
75
+ ◇ cf is not installed. Install it for Vigilbase? › Yes
76
+ ◇ Installed cf 1.0.0-beta.13
77
+ ◇ Cloudflare sign-in ✓ read-only profile "vigilbase-checkup"
78
+ ◇ Account Acme Corp 0123…cdef
79
+ │
80
+ ◇ 610 reads · 580 ok · 30 not collectable
81
+ │ Saved ~/.config/vigilbase/checkups/cloudflare-checkup-0123cdef-20261009T101233Z.json (182 KB) · 12 zones · no credentials
82
+ │ Contains 14 member emails · 22 DNS names · 5 pseudonymised IPs
83
+ │ Inspect it:
84
+ npx @vigilbase/cli cloudflare-checkup inspect ~/.config/vigilbase/checkups/cloudflare-checkup-0123cdef-20261009T101233Z.json
85
+ │
86
+ ◇ Upload 182 KB to vigilbase.com? › Yes
87
+ │
88
+ └ ✓ Done. 31 passed · 6 warnings · 4 failed · 30 reads not collected locally
89
+ Results: https://vigilbase.com/tools/run/0b7f3c1e-1d2a-4c55-9e1a-8d3f2b6c9a10 (opening in your browser)
90
+ A link has also been emailed to j***@acme.com.
91
+ Remove the read-only Cloudflare login and the cf Vigilbase installed later with:
92
+ npx @vigilbase/cli cloudflare-checkup logout
93
+ ```
94
+
95
+ In pipes, scripts and CI (and with `TERM=dumb` or `--json`) the same run prints
96
+ plain lines:
97
+
98
+ ```
99
+ $ npx @vigilbase/cli cloudflare-checkup
100
+ Vigilbase Cloudflare Checkup · collects on this machine with Cloudflare's cf CLI
101
+ Work email for your results: jane@acme.com
102
+ We emailed a 6-digit code to j***@acme.com (valid until 10:42). Check spam if it doesn't arrive.
103
+ Code from the email: 482913
104
+ ✓ Verified j***@acme.com
105
+ Cloudflare's cf CLI (cf@1.0.0-beta.13, about 75 MB) is not installed. Install it for Vigilbase now? [Y/n]
106
+ ✓ Installed cf 1.0.0-beta.13
107
+ Signing in to Cloudflare with a read-only login. Your browser will open…
108
+ ✓ Signed in · cf profile "vigilbase-checkup" · read-only · expires 11:02
109
+ cf can read 2 Cloudflare accounts:
110
+ 1) Acme Corp 0123…cdef
111
+ 2) Acme Labs 4567…89ab
112
+ Account number (1-2): 1
113
+ Account 0123…cdef · 12 zones · ~420 cf requests at ≤900 per 5 min (~3 min)
114
+ ✓ Saved ~/.config/vigilbase/checkups/cloudflare-checkup-0123cdef-20261009T101233Z.json (182 KB)
115
+ 12 zones · 610 reads (580 ok, 30 not collectable with cf) · 14 member emails · 22 DNS names · 5 pseudonymised IPs
116
+ No credentials. Inspect it: npx @vigilbase/cli cloudflare-checkup inspect /home/jane/.config/vigilbase/checkups/cloudflare-checkup-0123cdef-20261009T101233Z.json
117
+ Results go to j***@acme.com. Upload 182 KB to https://vigilbase.com? [y/N] y
118
+ ✓ Uploaded. Free summary: 31 passed · 6 warnings · 4 failed · 30 reads not collected locally
119
+ Results: https://vigilbase.com/tools/run/0b7f3c1e-1d2a-4c55-9e1a-8d3f2b6c9a10
120
+ A link has also been emailed to j***@acme.com.
121
+ Remove the read-only Cloudflare login and the cf Vigilbase installed later with: npx @vigilbase/cli cloudflare-checkup logout
122
+ ```
123
+
124
+ On Windows the saved path is printed in full (cmd and PowerShell do not expand
125
+ `~`), so it can be passed to `submit` as shown.
126
+
127
+ If something fails, fix it and **run the same command again**; each run
128
+ verifies your email and starts a new checkup. When you are done:
129
+
130
+ ```bash
131
+ npx @vigilbase/cli cloudflare-checkup logout # deletes the cf profile and the cf Vigilbase installed
132
+ ```
133
+
134
+ `vigilbase cloudflare-checkup` (top-level), `vigilbase local cloudflare-checkup`
135
+ and `vigilbase local cloudflare-checkup run` are the same command.
136
+
137
+ ### Options
138
+
139
+ | Option | Meaning |
140
+ | --- | --- |
141
+ | `--email <address>` | Your work email; without it, the CLI asks for it. |
142
+ | `--account-id <id>` | Skip the account picker (32 hex characters). |
143
+ | `--out <file>` | Write the snapshot here instead of the default path; `--overwrite` replaces an existing file. |
144
+ | `--yes` | Answer yes to installing cf and to the upload question. |
145
+ | `--confirm` | Answer yes to the upload question only (kept from earlier releases). |
146
+ | `--no-open` | Print the results link without opening a browser. |
147
+ | `--cf-auth auto\|profile\|env\|default` | `auto` (default): `env` when `CLOUDFLARE_API_TOKEN` is set in this shell, otherwise `profile` (an explicit `--profile` also means `profile`). |
148
+ | `--profile <name>` | The cf profile (default `vigilbase-checkup`; letters, digits, `_` and `-`, not starting with `-`). |
149
+ | `--cf-bin <path>` | Absolute path to the cf package directory or its `bin/cf`; never replaced by an install. |
150
+ | `--max-requests-per-5min <100..1100>` | Cloudflare request budget (default 900). |
151
+ | `--base-url <origin>` | Only `https://vigilbase.com` or a loopback origin (local testing). |
152
+ | `--timeout <ms>` | Timeout for each vigilbase.com request. |
153
+ | `--json` | One JSON object on stdout; status lines and prompts go to stderr. |
154
+
155
+ Before anything slow, the command checks every flag (no I/O, and `--email`
156
+ only for its shape), that its questions can be answered (on a terminal, or
157
+ with `--yes` without one; `--confirm` answers only the upload question, not
158
+ installing cf), then Node, then that `--out` is writable, then that
159
+ vigilbase.com has local checkups on and accepts this CLI. So no code is emailed
160
+ for a run that could not install cf, confirm the upload or be accepted. It
161
+ verifies your email before cf runs, and checks that the snapshot location is
162
+ writable before collecting, so a long collection is never wasted.
163
+
164
+ Two problems can show only once cf runs, after the email was verified: without
165
+ a terminal, a missing cf login (`CF_AUTH_REQUIRED`) and several accounts
166
+ without `--account-id` (`ACCOUNT_SELECTION_REQUIRED`). Running the command
167
+ again with the same address then waits for vigilbase.com's 8 minutes per
168
+ address (the hint says so). In scripts, sign in first (run
169
+ `npx @vigilbase/cli cloudflare-checkup login` in a terminal, or set
170
+ `CLOUDFLARE_API_TOKEN`) and pass `--account-id`.
171
+
172
+ **Without a terminal** (scripts, CI), add `--yes`. The prompts still go to
173
+ stderr, and the answers are read from stdin, one line each: the address
174
+ (unless `--email` is given) and then the code. Each prompt reads exactly one
175
+ line and leaves the rest for the next one, so a script can write the code once
176
+ it sees `Code from the email:` (an `expect`-style script), or pipe both lines
177
+ when it already knows them. The account picker and the cf install question are
178
+ never answered from stdin: use `--account-id` and `--yes`.
179
+
180
+ ## Terminal UI and plain output
181
+
182
+ In a terminal, the one command and `submit` show their steps as a timeline on
183
+ stderr (◆ the current step, ◇ a finished one, │ notes, ▲ a warning, ■ the error
184
+ that stopped the run, └ the result). Spinners run while the CLI checks that
185
+ local checkups are available, while vigilbase.com sends or checks the code,
186
+ while the session is checked, while cf is found, checked and installed, and
187
+ while the upload is scored; a progress bar runs while
188
+ collecting (zones done, cf reads done of the estimate, and the time left, from
189
+ the request budget and the pace so far). Everything is redrawn in place and fits
190
+ the terminal width, also after a resize.
191
+
192
+ | Question | Keys |
193
+ | --- | --- |
194
+ | Work email | Type it; Backspace, Ctrl-U (clear) and Ctrl-W (last word) edit; Enter sends it. |
195
+ | Code from the email | Type or paste the 6 digits (spaces and dashes are skipped); it is sent at the sixth digit. |
196
+ | Account | ↑/↓ (or j/k), Home/End, Enter. Every account cf can read is listed. |
197
+ | Install cf, upload | ←/→ choose, Enter answers, `y` or `n` answer at once. The install question starts on **Yes**; the upload question starts on **No**, so Enter alone never uploads. |
198
+
199
+ - Once sent, the typed address is replaced by the masked address vigilbase.com
200
+ returns, and the code by `●●●●●●`.
201
+ - A refused address and a wrong code are asked for again in place, with the
202
+ reason. When vigilbase.com rate-limits the code request, the refusal does not
203
+ say which limit was reached (per address: one checkup every 8 minutes and 3
204
+ codes an hour, `+tag` variants included; per domain: 30 codes an hour; per
205
+ network; overall). The CLI says so, shows when to try
206
+ again (from the response) and asks `Use a different work email?`, which
207
+ starts on **No** (not asked with `--email`).
208
+ - Commands to copy (`inspect`, `submit <saved file>`, `logout`) are printed on
209
+ lines of their own, indented and never wrapped or cut, with the path quoted
210
+ for the shell (a leading `~/` stays outside the quotes).
211
+ - On a narrow terminal, account names in the picker are cut in the middle so
212
+ each masked account ID stays visible, and an input's title is cut before
213
+ what you type.
214
+ - If the Cloudflare sign-in fails or is cancelled, it asks `Try signing in
215
+ again?`, up to twice more. While cf signs in, the terminal belongs to cf, so
216
+ its own messages appear between the steps.
217
+ - The results link is underlined, and clickable (an OSC 8 link) in terminals
218
+ known to support it (`FORCE_HYPERLINK=0` turns that off, `1` turns it on).
219
+ When stdout is not a terminal (`> results.txt`), the plain result lines go to
220
+ stdout as well.
221
+ - Ctrl-C at any point gives the terminal back (raw mode off, cursor shown),
222
+ says what happened (for example `Cancelled. Nothing was uploaded.`) and
223
+ exits 130. Errors and SIGTERM give the terminal back too.
224
+
225
+ The plain output (the second transcript in the quick start: the
226
+ `Work email for your results:`, `Code from the email:` and
227
+ `Account number (1-2):` prompts, the `[Y/n]` and `[y/N]` questions, a one-line
228
+ spinner) is used when any of these holds:
229
+
230
+ - stdin or stderr is not a terminal (pipes, a redirected stderr, scripts);
231
+ - `TERM=dumb`;
232
+ - `CI` is set (to anything but `0` or `false`);
233
+ - `--json`.
234
+
235
+ `NO_COLOR` (any non-empty value) or `FORCE_COLOR=0` keeps the timeline without
236
+ colours or text styles. Legacy Windows consoles (no Windows Terminal and no
237
+ `TERM_PROGRAM`) and the Linux console get ASCII only: the symbols (`*`, `o`,
238
+ `|`, `+`, `!`, `x`), `...` for `…` (also in masked IDs, `0123...cdef`) and `-`
239
+ between the items of a summary line, in every step, spinner and message.
240
+
241
+ ## Email verification and the checkup session
242
+
243
+ The CLI verifies your email itself; there is no browser step and no bot check
244
+ on this path.
245
+
246
+ - **Availability first.** Before asking for your email, the one command and
247
+ `submit` send `GET …/local-session/availability`, with no email, no
248
+ credentials and no body. If local checkups are switched off, the command
249
+ stops with `LOCAL_MODE_DISABLED`: `Local checkups aren't available right now.`
250
+ and the hint
251
+ `Run the Cloudflare Checkup in your browser instead: https://vigilbase.com/tools/cloudflare-checkup`.
252
+ Nothing is emailed and cf is not touched. If vigilbase.com needs a newer CLI
253
+ or doesn't accept this snapshot format, it stops with `CLI_UPGRADE_REQUIRED`.
254
+ If vigilbase.com doesn't answer the check (for example a network error or a
255
+ timeout, after 10 seconds or `--timeout`), the command goes on, and the same
256
+ checks happen when the checkup starts.
257
+ - **What vigilbase.com receives.** Your email address goes to vigilbase.com
258
+ (`POST …/local-session/request`) so it can send you the code, together with
259
+ the email language (`en`, `pt-PT` or `ar`, from `LC_ALL`, `LC_MESSAGES` or
260
+ `LANG`). The code goes back with the verification token
261
+ (`POST …/local-session/verify`). Only business addresses are accepted;
262
+ personal and disposable ones are refused (`EMAIL_INVALID`; the CLI asks for
263
+ another address, up to 3, or stops at once with `--email`).
264
+ - **Codes.** A wrong code is asked for again, up to 5 tries in total (after 5
265
+ wrong codes vigilbase.com closes the checkup: `VERIFICATION_EXPIRED`). An
266
+ expired code stops with `VERIFICATION_EXPIRED`; run the command again for a
267
+ new one. A code check that vigilbase.com does not answer (a network error, a
268
+ timeout or a 503) is sent once more after 2 seconds with the same code; on a
269
+ terminal the CLI then asks for the same code again (twice at most), which
270
+ does not use one of the 5 tries. Otherwise it stops with `SUBMIT_FAILED`.
271
+ vigilbase.com limits code requests per mailbox (3 an hour; `jane+x@` counts
272
+ as `jane@`), per domain (30 an hour), per IP address (an IPv6 /64 counts as
273
+ one) and overall; a limit stops with `VIGILBASE_RATE_LIMITED` and the time
274
+ to wait (exit 2).
275
+ - **The session.** The verification answers with a session code for this one
276
+ checkup. It lives only in the CLI's memory and is sent only as the
277
+ `Authorization` header of `GET …/local-session` and
278
+ `POST …/local-session/snapshot`. If it expires while you collect (a large
279
+ account) or while the upload question waits, the CLI renews it once with
280
+ the token and code it still holds (`✓ Renewed the checkup session, which had
281
+ expired`); vigilbase.com then issues the next session code for the same
282
+ checkup. If the code can no longer renew it, the command stops with
283
+ `SESSION_EXPIRED` and names `submit <saved file>` to upload the saved
284
+ snapshot without collecting again.
285
+ - **Never shown or stored.** The CLI never prints, logs, writes to disk, puts in
286
+ JSON output or a URL, or passes to cf or npm your address, the code, the
287
+ verification token or the session code. It shows only the masked address
288
+ vigilbase.com returns (`j***@acme.com`). A checkup accepts one snapshot; its
289
+ results go to the verified address.
290
+
291
+ Outside the CLI's control: with `--email`, the address is part of the command
292
+ line, so it is in your shell history and in npm's debug log when run through
293
+ npx (`~/.npm/_logs`); omit `--email` and type it at the prompt to avoid that.
294
+ (Any environment variable naming `--email`, a session code or a token is
295
+ removed from npm's environment when the CLI installs cf.)
296
+
297
+ ## Trust model
298
+
299
+ - **cf owns your Cloudflare login.** The Vigilbase CLI never reads, prints,
300
+ stores or uploads a Cloudflare credential. It runs `cf` as a separate process
301
+ (`node <cf entry> …`, no shell) and reads only cf's JSON output.
302
+ - **`CLOUDFLARE_API_TOKEN`** (`--cf-auth env`, or `auto` when it is set): cf
303
+ reads it itself. The vigilbase process holds the variable only as part of its
304
+ own environment and copies it by name to cf's API reads. It never prints,
305
+ stores, inspects or uploads it.
306
+ - **The only Vigilbase requests** go to
307
+ `https://vigilbase.com/api/v1/tools/cloudflare-checkup/local-session`:
308
+ `GET …/availability` (no body, no credential), `POST …/request` and
309
+ `POST …/verify` (the email verification, JSON bodies, no credential), then
310
+ `GET` of the session and `POST …/snapshot`, authorised by the session code
311
+ the verification returned. The upload is the exact bytes
312
+ of the file you can inspect; the CLI re-reads and re-hashes it and checks the
313
+ server's echoed SHA-256.
314
+ - **Installing cf** contacts only the npm registry your npm is configured for,
315
+ with a pinned version and integrity (see below).
316
+ - **The results link.** The upload response names the checkup's results page
317
+ (`https://vigilbase.com/tools/run/<id>`). The CLI prints it, and opens it in
318
+ your browser only when it is on the upload origin (never with `--no-open`,
319
+ `--json`, in CI or without a display). The same link is emailed to the
320
+ verified address.
321
+
322
+ ## Installing cf
323
+
324
+ When no usable cf is found (none at all, a different program named `cf`, an
325
+ unsupported version, or a release whose offline `--dry-run` mapping shows it
326
+ renamed a command the checkup needs) and `--cf-bin` was not given, the command
327
+ asks (after saying why the cf it found cannot be used):
328
+ `Cloudflare's cf CLI (cf@1.0.0-beta.13, about 75 MB) is not installed. Install it for Vigilbase now? [Y/n]`
329
+ (Enter means yes; `--yes` answers yes; without a terminal and without `--yes`
330
+ it stops with `CF_NOT_FOUND`).
331
+
332
+ - **Location:** `<config dir>/cf/1.0.0-beta.13/` (0700), where the config dir is
333
+ `VIGILBASE_CONFIG_DIR`, `$XDG_CONFIG_HOME/vigilbase` or `~/.config/vigilbase`.
334
+ It is used before any cf on `PATH`, and only by Vigilbase.
335
+ - **npm:** the `npm-cli.js` named by `npm_execpath` (as set by npm/npx), or the
336
+ npm bundled beside this Node. It runs as
337
+ `node <npm-cli.js> install --prefix <staging> --no-audit --no-fund --ignore-scripts --omit=optional cf@1.0.0-beta.13`
338
+ without a shell, from a fresh private staging directory, with your
339
+ environment (your npmrc, proxy and CA settings apply) minus every `CF_*` and
340
+ `CLOUDFLARE_*` variable and any variable carrying a session code, a
341
+ verification token or `--email`. npm's output
342
+ is shown only if it fails (the last 20 lines, without lines that could carry
343
+ a registry credential).
344
+ - **Integrity:** the staging lockfile must record `node_modules/cf` at exactly
345
+ version `1.0.0-beta.13` with npm's `dist.integrity`
346
+ `sha512-dCjpzCJvjudIu8IQbXCJfy9diFoyHU84D/30K4lJp7jUaBgvjJypsMFzLqvUFOuwhF1ggR/igsLqXyehAOR2FQ==`,
347
+ and the installed package.json must agree. Otherwise the staging directory is
348
+ deleted (`CF_INSTALL_FAILED`). Only a verified install is renamed into place,
349
+ so a half-finished one is never used; the usual identity checks (below) still
350
+ apply.
351
+ - **`--ignore-scripts`:** cf's `--version`, `--dry-run` and API reads need no
352
+ lifecycle scripts.
353
+ - **`--omit=optional`:** cf's optional dependencies are the workerd and sharp
354
+ platform binaries (about 150 MB of the 225 MB default install). In cf
355
+ 1.0.0-beta.13 the modules that load `miniflare`, `workerd` or `sharp` are
356
+ reachable only from `--local` mode (which the CLI never passes) and from the
357
+ `workers`, `deploy` and `previews` command trees; no module statically
358
+ reachable from cf's entry imports them, and there are no computed imports.
359
+ The checkup runs none of those commands, so the install is about 75 MB.
360
+ - **Failures:** no npm → `CF_INSTALL_FAILED` with the manual
361
+ `npm install --global cf@1.0.0-beta.13` fallback; then run the command again.
362
+ - **Interruptions:** Ctrl-C while npm runs stops npm and deletes the staging
363
+ directory. A staging directory left by a crash or a closed terminal is
364
+ deleted by the next install once it is older than npm's 10-minute timeout,
365
+ and by `logout`.
366
+
367
+ `logout` removes `<config dir>/cf` again.
368
+
369
+ ## Signing in to Cloudflare
370
+
371
+ With a cf profile (the default when `CLOUDFLARE_API_TOKEN` is not set), the
372
+ command first runs one serial `cf auth whoami --profile vigilbase-checkup`. If
373
+ the profile is missing, expired or revoked and a terminal is available, it
374
+ prints `Signing in to Cloudflare with a read-only login. Your browser will open…`
375
+ and runs `cf auth create vigilbase-checkup --scopes …` interactively (the read
376
+ scopes below), then checks `whoami` once more. Without a terminal it stops with
377
+ `CF_AUTH_REQUIRED`. cf keeps the login in its own config directory.
378
+
379
+ OAuth from a datacenter or VPN address may be challenged by Cloudflare; use a
380
+ read-only API token there (servers, CI):
381
+
382
+ ```bash
383
+ read -rs CLOUDFLARE_API_TOKEN && export CLOUDFLARE_API_TOKEN # input hidden
384
+ npx @vigilbase/cli cloudflare-checkup
385
+ # PowerShell 7.1+: $env:CLOUDFLARE_API_TOKEN = Read-Host -MaskInput 'Cloudflare API token'
386
+ ```
387
+
388
+ ## Choosing the account and where the snapshot goes
389
+
390
+ The account is chosen in the CLI: `--account-id` if given; otherwise the
391
+ accounts cf can read: one is used as is, several get a numbered picker (name
392
+ and masked ID, up to 20 shown) on a terminal (an arrow-key list of every
393
+ account in the terminal UI), and without a terminal
394
+ `ACCOUNT_SELECTION_REQUIRED` lists the full IDs for `--account-id`. The
395
+ uploaded snapshot binds the checkup to its account. (A checkup vigilbase.com
396
+ reports as already bound to an account is collected for that account, and an
397
+ `--account-id` that differs stops with `ACCOUNT_MISMATCH` before cf runs.)
398
+
399
+ Without `--out`, the snapshot is written to
400
+ `<config dir>/checkups/cloudflare-checkup-<first 8 of the account ID>-<UTC yyyymmddThhmmssZ>.json`
401
+ (`-2`, `-3`, … if a run in the same second already used the name). The
402
+ directory is created 0700 and never through a symbolic link; the file is 0600,
403
+ written to a hidden temp file first and then given its name, so it never holds
404
+ a partial snapshot. `--out` must name a new file in an existing, writable
405
+ directory (or an existing regular file with `--overwrite`). The file is yours:
406
+ it stays after the upload, and `inspect` shows what it contains.
407
+
408
+ The snapshot is kept whatever happens to the upload: when it cannot go ahead
409
+ (`SESSION_*`, `VERIFICATION_*`, `SUBMIT_FAILED`, `VIGILBASE_*`,
410
+ `LOCAL_MODE_DISABLED`), the command prints, next to the error,
411
+ `npx @vigilbase/cli cloudflare-checkup submit <saved file>` to upload it
412
+ later without collecting again (it verifies your email again). When the run
413
+ used a loopback `--base-url`, that command ends with the same `--base-url`.
414
+
415
+ ## Advanced commands
416
+
417
+ | Command | Flags | Network |
418
+ | --- | --- | --- |
419
+ | `login` | `--profile`, `--cf-bin`, `--no-open`, `--dry-run` | cf OAuth only |
420
+ | `doctor` | `--profile`, `--cf-auth`, `--cf-bin`, `--json` | `cf auth whoami` |
421
+ | `accounts` | `--profile`, `--cf-auth`, `--cf-bin`, `--json` | Cloudflare via cf |
422
+ | `collect` | `--out` (required), `--account-id`, `--overwrite`, `--dry-run`, `--max-requests-per-5min`, `--profile`, `--cf-auth`, `--cf-bin`, `--json` | Cloudflare via cf |
423
+ | `inspect <file>` | `--json` | none |
424
+ | `submit <file>` | `--email`, `--yes`/`--confirm`, `--no-open`, `--base-url`, `--timeout`, `--json` | vigilbase.com |
425
+ | `logout` | `--profile`, `--cf-bin`, `--json` | none from the CLI (cf may revoke its own token) |
426
+
427
+ All are `vigilbase cloudflare-checkup <command>` or
428
+ `vigilbase local cloudflare-checkup <command>`. They keep their own defaults
429
+ (`--cf-auth profile`, no cf install, no sign-in). They find a cf installed by
430
+ the one command. `collect --dry-run` prints every cf command with
431
+ `<ZONE_ID>`/`<RULESET_ID>` placeholders, the child-environment variable names
432
+ (never values), the not-collected list and the request formula; it makes no
433
+ Cloudflare and no Vigilbase requests. `submit` checks the file, checks that
434
+ vigilbase.com has local checkups on, verifies your email like the one command,
435
+ then uploads a snapshot collected earlier (accepted for 24 hours) and prints
436
+ the results link.
437
+
438
+ `logout` runs `cf auth delete <profile>` through the cf it finds (an
439
+ interactive passthrough, so cf's own message is shown; cf 1.0.0-beta.13 takes
440
+ only the profile name, refuses `--profile` and a set `CLOUDFLARE_API_TOKEN`,
441
+ which the CLI never passes to it, and fails for a profile that does not exist),
442
+ then removes `<config dir>/cf`. It prints what it removed; a profile cf
443
+ declines to delete (usually one that does not exist) is reported, not an error,
444
+ so `logout` can be repeated. A cf that cannot run at all is an error (exit 1,
445
+ `success: false`), because the login may still be on disk. The cf Vigilbase
446
+ installed is then kept (`managedCf.kept`), since it is usually the only cf that
447
+ can delete the login, and the hint says how: run `logout` again under Node.js
448
+ 22.18 or newer, or, when the installed cf itself is damaged, install cf with
449
+ `npm install --global cf@1.0.0-beta.13` and run
450
+ `logout --cf-bin "$(npm root -g)/cf"`, which deletes the login and then removes
451
+ the damaged copy. Without any cf, logout says the profile could not be checked
452
+ (it does not claim that there is none).
453
+
454
+ `--base-url` accepts only `https://vigilbase.com` or a loopback origin
455
+ (`http(s)://localhost`, `127.0.0.0/8`, `[::1]`) for local testing.
456
+ `VIGILBASE_BASE_URL`, `VIGILBASE_API_URL`, `VIGILBASE_PUBLIC_URL`,
457
+ `VIGILBASE_ONE_URL` and `VIGILBASE_AUTH_URL` are ignored. A redirect from
458
+ vigilbase.com is never followed; the request fails (`SUBMIT_FAILED`) without a
459
+ retry. `VIGILBASE_CONFIG_DIR` is read only for the managed cf and the default
460
+ snapshot path (`inspect` never reads it).
461
+
462
+ ## Locating cf
463
+
464
+ The CLI looks for `--cf-bin`, then the Vigilbase-managed install
465
+ (`<config dir>/cf/1.0.0-beta.13`, only if its lockfile still matches the pin),
466
+ then absolute `PATH` entries holding `cf` and then `cloudflare`
467
+ (`cf.cmd`/`cloudflare.cmd` on Windows), then pnpm
468
+ (`$PNPM_HOME/global/*/node_modules/cf`) and Volta
469
+ (`$VOLTA_HOME/tools/image/packages/cf/…`) global directories, without running a
470
+ package manager. A candidate is used only if its `package.json` has
471
+ `name: "cf"`, a repository on `github.com/cloudflare/cf` and a `bin.cf` entry
472
+ matching the file found; the Cloud Foundry CLI (also `cf`) is skipped. cf is run
473
+ as `node <bin.cf entry>`, never through a shim or shell, and its `--version`
474
+ output must match its package version.
475
+
476
+ Supported: `cf >= 1.0.0-beta.13` and `< 2.0.0`; `1.0.0-beta.13` is tested.
477
+ Untested versions in range produce a warning and are used only when every
478
+ command template's offline mapping verifies. Fallbacks: `--cf-bin "$(npm root -g)/cf"` (npm),
479
+ `--cf-bin "$(pnpm root -g)/cf"` (pnpm), or Volta's package directory next to
480
+ `volta which cf`.
481
+
482
+ ## The allowlist and what the preflight proves
483
+
484
+ cf runs only these argv (plus `--quiet`, and `--profile <p>` in profile mode),
485
+ with `CLOUDFLARE_ACCOUNT_ID=<account>` set on every account- and zone-scoped
486
+ call (not on `accounts list` or `auth whoami`, which run before an account is
487
+ chosen). Interpolated values are
488
+ re-validated: 32-hex IDs, the 19 fixed zone setting IDs and integer pages. No
489
+ confirmation-skipping, local-mode, project-mode or request-body flag is ever
490
+ passed.
491
+
492
+ | Read | cf argv | Paging |
493
+ | --- | --- | --- |
494
+ | account selection | `accounts list --per-page 50 --page N` | until an empty page |
495
+ | account | `accounts get` | single |
496
+ | zones | `zones list --account-id A --per-page 50 --page N` | until an empty page |
497
+ | members | `accounts members list --per-page 50 --page N` | until an empty page |
498
+ | account rulesets | `rulesets list --per-page 100` | one call |
499
+ | account access rules | `firewall access-rules list --per-page 50 --page N` | until an empty page |
500
+ | Access apps, IdPs, service tokens | `zero-trust access applications list`, `zero-trust identity-providers list`, `zero-trust access service-tokens list` (`--per-page 50 --page N`) | until an empty page |
501
+ | Gateway rules, locations | `zero-trust gateway rules list`, `zero-trust gateway locations list` | single |
502
+ | tunnels | `tunnels list --tun-types cfd_tunnel --is-deleted false --per-page 50 --page N` | until an empty page |
503
+ | zone settings (×19) | `zones settings get S --zone Z` | single |
504
+ | DNSSEC | `dns dnssec get --zone Z` | single |
505
+ | DNS records | `dns records list --zone Z --per-page 100 --page N` | until an empty page (cap 100) |
506
+ | Universal SSL, Total TLS | `ssl universal settings get --zone Z`, `acm total-tls get --zone Z` | single |
507
+ | zone rulesets | `rulesets list --zone Z --per-page 100` | one call |
508
+ | ruleset detail | `rulesets get R --zone Z` | single |
509
+ | zone access rules | `firewall access-rules list --zone Z --per-page 100 --page N` | until an empty page |
510
+ | page rules, bot management, page shield | `page-rules list --zone Z`, `bot-management get --zone Z`, `client-side-security settings get --zone Z` | single |
511
+ | API Shield | `api-security schema-validation settings get --zone Z`, `api-security schema-validation schemas list --zone Z --omit-source --per-page 100 --page N` | single / until an empty page |
512
+
513
+ The only other cf argv are `--version`, `auth whoami`, `auth create <p> --scopes …`
514
+ (sign-in, interactive) and `auth delete <p>` (logout, interactive).
515
+
516
+ Before collecting (the one command, `collect`, `collect --dry-run`) and in `doctor`, every template
517
+ runs once with `--dry-run` and placeholder IDs (no credentials, no network);
518
+ `accounts` checks only the `accounts list` mapping, so use `doctor` to verify
519
+ the full mapping. The printed
520
+ request must be `GET` with exactly the expected path and query. In cf beta.13
521
+ that object is a literal printed by each command, so the preflight is a
522
+ **command-name → API-path mapping check only**: it detects renamed or remapped
523
+ commands, but it does not prove where cf would really send a request. Removing
524
+ base-URL variables from cf's environment is the control for that (below). A
525
+ template that does not map is recorded as `collection_failed/command_unavailable`;
526
+ for `accounts list`, `accounts get` or `zones list` the run stops with
527
+ `CF_ALLOWLIST_MISMATCH`.
528
+
529
+ cf strips pagination metadata, so lists are paged until a page comes back empty
530
+ (one extra call per list, immune to server-side page clamps). A page whose first
531
+ item repeats the previous page's is `invalid_output` (cf ignoring `--page`). The
532
+ rulesets lists are cursor-only and the cursor is not printed: 100 or more items
533
+ are recorded as `possibly_truncated`.
534
+
535
+ ## Process and environment policy
536
+
537
+ - cf runs from a private, empty `0700` temporary directory that is removed
538
+ afterwards (and on Ctrl-C). Your project's `.env`, `.env.local`,
539
+ `cloudflare.config.ts`, directory profile bindings and cf's account cache never
540
+ apply. `CF_DELEGATION=1` stops cf from handing off to a project-local cf.
541
+ - cf's environment is built from an empty object. Copied by name if present:
542
+ `PATH HOME USER LOGNAME USERPROFILE APPDATA LOCALAPPDATA SystemRoot WINDIR`,
543
+ `XDG_CONFIG_HOME XDG_CACHE_HOME XDG_DATA_HOME XDG_STATE_HOME XDG_RUNTIME_DIR`,
544
+ `TMPDIR TMP TEMP LANG LC_ALL LC_CTYPE TZ`, the `HTTP_PROXY`/`HTTPS_PROXY`/`NO_PROXY`
545
+ variables (both cases), `NODE_EXTRA_CA_CERTS SSL_CERT_FILE SSL_CERT_DIR
546
+ DBUS_SESSION_BUS_ADDRESS CLOUDFLARE_AUTH_USE_KEYRING`.
547
+ - Forced: `CI=1 NO_COLOR=1 FORCE_COLOR=0 CF_QUIET=1 CF_SEND_TELEMETRY=false
548
+ DO_NOT_TRACK=1 CF_DELEGATION=1` (telemetry off, no prompts, no update checks).
549
+ - `CLOUDFLARE_API_TOKEN` is passed only with `--cf-auth env`, and only to API
550
+ reads (absent → `CF_AUTH_REQUIRED`). In profile and default modes it is removed,
551
+ because it would override `--profile`; a notice says so.
552
+ - Never passed, by construction: `CLOUDFLARE_API_BASE_URL`, `CF_API_BASE_URL`
553
+ (the primary control against redirecting your token), `CLOUDFLARE_COMPLIANCE_REGION`,
554
+ `CLOUDFLARE_CLIENT_ID`, `CLOUDFLARE_ZONE_ID`, `CLOUDFLARE_ACCESS_CLIENT_ID/SECRET`,
555
+ `CLOUDFLARE_API_KEY`, `CLOUDFLARE_EMAIL`, `WRANGLER_*`, `VIGILBASE_*`,
556
+ `NODE_OPTIONS`, `NODE_PATH`, `NODE_TLS_REJECT_UNAUTHORIZED`, `npm_config_*`,
557
+ `DEBUG` and agent-harness markers (`CLAUDECODE`, `CODEX_*`, `CURSOR_*`).
558
+ FedRAMP and compliance-region accounts are not supported.
559
+ - cf output is capped (stdout 8 MiB, 16 MiB for `rulesets get`; stderr 64 KiB)
560
+ and each call times out after 45 s. stderr is never shown: it is reduced to a
561
+ classification (unknown command, authentication, HTTP status, network).
562
+
563
+ **Requests and pacing.** Four cf processes run at once within a budget of 900
564
+ requests per rolling 5 minutes (Cloudflare allows 1,200 per user, shared with
565
+ your dashboard). A collection needs about 19 + extra pages + zones × (33 +
566
+ rulesets per zone) requests; 100 zones take about 25 minutes. Accounts over 100
567
+ zones or 6,000 requests are refused (`ACCOUNT_TOO_LARGE`). 5xx, network errors
568
+ and timeouts are retried twice (1 s, 3 s). A 401 pauses all calls for one serial
569
+ `cf auth whoami`, then retries once. A 429 pauses all calls for 30 s and retries
570
+ once; a second 429 stops with `CF_RATE_LIMITED` (exit 2) and no file. Before the
571
+ OAuth token expires, dispatch pauses, in-flight calls finish, and one serial
572
+ `whoami` performs cf's single refresh; cf beta.13 prints the pre-refresh expiry
573
+ from that call, so a second serial `whoami` reads the new one. This repeats
574
+ before every expiry in a long run.
575
+
576
+ ## Scopes
577
+
578
+ The sign-in (and `login`) requests these read scopes (names verified against
579
+ cf 1.0.0-beta.13):
580
+
581
+ `account:read account-settings.read memberships.read user:read user-details.read
582
+ zone:read zone.read zone-settings.read dns.read dns_records:read
583
+ ssl-and-certificates.read zone-waf.read account-waf.read account-rulesets.read
584
+ http-ddos-managed-ruleset.read firewall-services.read
585
+ account-firewall-access-rules.read page-rules.read bot-management.read
586
+ page-shield.read domain-page-shield.read api-gateway.read access.read access:read
587
+ access-app.read access-idp.read access-service-token.read teams.read teams:read
588
+ argotunnel.read teams-connector-cloudflared.read`
589
+
590
+ `doctor` lists missing recommended scopes and counts write scopes in profile and
591
+ default modes. API token permissions cannot be introspected, so with
592
+ `--cf-auth env` it reports scopes as unknown. A denied read is recorded as
593
+ `http_error 403` and the affected checks are skipped, never scored as passing.
594
+
595
+ ## What leaves your machine
596
+
597
+ For the email verification, your work email address and the code from the
598
+ email (see "Email verification and the checkup session"). Otherwise only the
599
+ snapshot file, and only after you confirm the upload (the one command or
600
+ `submit`).
601
+ Each cf response is projected immediately and the raw text discarded. The file
602
+ (`vigilbase.cloudflare-checkup.snapshot/1`) keeps only what the scanner reads:
603
+
604
+ - account `id, name, type`, 2FA enforcement; zone `id, name, status, paused,
605
+ type, development_mode, plan name, account`;
606
+ - members: pending or 2FA-off markers, and the e-mail address of at most 8
607
+ pending and 8 2FA-off members;
608
+ - access rules: the first 5 broad rules' `mode, target, value` (later broad
609
+ rules keep only what makes them broad; other rules are counted);
610
+ - counts only for Access apps, Gateway locations, schemas and account rulesets;
611
+ IdP types, service-token expiry, Gateway rule `enabled:false` and filters,
612
+ tunnel status;
613
+ - zone settings' values, DNSSEC status/algorithm, Universal SSL/Total TLS/page
614
+ shield `enabled`;
615
+ - DNS A/AAAA records with **pseudonymised IPs** (the first two IPv4 or three IPv6
616
+ groups are kept, the host part becomes a per-prefix counter); names only for
617
+ non-proxied records;
618
+ - ruleset `id, phase`, `name: 'ddos'` markers, and rules reduced to action,
619
+ `enabled:false`, a `true`/geo-block expression marker, managed-ruleset IDs and
620
+ name keywords; IDs and descriptions only on disabled managed rules and
621
+ block-everything rules; identical rules run-length encoded;
622
+ - legacy page-rule action IDs, bot-management and schema-validation settings.
623
+
624
+ No credentials, scopes, cf profile names, e-mail of the cf user, file paths or
625
+ hostnames of your machine. Collector metadata is the CLI and cf version, the auth
626
+ **kind** (`cf_profile`, `cf_env_token`, `cf_default_profile`), the OS family,
627
+ timestamps and the cf call count. Before writing and again before uploading, the
628
+ file is validated and checked for credential-shaped values (session codes,
629
+ verification tokens, API tokens, JWTs, PEM blocks, bearer strings). `inspect` shows counts of every
630
+ free-text category.
631
+
632
+ **Projection predicates (disclosure).** To minimise uploads, the projections
633
+ encode selection rules that mirror some checks: which rules count as issue
634
+ rules, the geo-block marker, what makes an access rule broad, the legacy
635
+ page-rule actions, the pending/2FA-off member selection, and the public managed
636
+ ruleset IDs and name keywords. These ship in this MIT package. No scoring,
637
+ deductions, severities, report copy or grade logic ship in the CLI.
638
+
639
+ ## Not collected locally
640
+
641
+ cf 1.0.0-beta.13 has no command for five checks per zone: legacy Firewall Rules,
642
+ legacy Filters, previous-version WAF packages, previous-version Rate Limiting,
643
+ and WAF traffic analytics (GraphQL). They are recorded as `not_collected`, shown
644
+ as **Not collected locally** and never scored as passing.
645
+
646
+ The plan and add-on review is not collected either: the snapshot has no entry
647
+ for add-on entitlements or the Smart Shield setting. The PDF report shows each
648
+ zone's plan from the zone list and lists Advanced Bot Management, Advanced Rate
649
+ Limiting, API Shield, Page Shield (advanced) and Smart Shield as **Not
650
+ collected**. Run the token-based checkup in the browser to include them.
651
+
652
+ ## Error codes and exit codes
653
+
654
+ Exit codes: **0** success (any grade, replay, file written, dry run, healthy
655
+ doctor), **1** any other error, **2** `CF_RATE_LIMITED` or a vigilbase.com 429
656
+ (`VIGILBASE_RATE_LIMITED`), **130** cancelled with Ctrl-C. Errors print `code` and a `hint`; JSON errors are
657
+ `{success:false, error, code, status?, retryAfterSec?, hint?}`. Server messages
658
+ are never echoed.
659
+
660
+ | Code | Fix |
661
+ | --- | --- |
662
+ | `NODE_UNSUPPORTED` | Install Node.js 22.18 or newer from https://nodejs.org, then run the same command again. |
663
+ | `CF_NOT_FOUND` | Run the same command again in a terminal and let it install cf (or add `--yes`), or `npm install --global cf@1.0.0-beta.13`. |
664
+ | `CF_WRONG_BINARY` | Another `cf` (Cloud Foundry, or a pnpm/Volta shim) was found; run the command without `--cf-bin` and let it install cf, or pass `--cf-bin`. |
665
+ | `CF_UNSUPPORTED_VERSION` | Run the same command again without `--cf-bin` and let it install the tested cf. |
666
+ | `CF_ALLOWLIST_MISMATCH` | This cf release renamed a required command; run the same command again without `--cf-bin` and let it install the tested cf for Vigilbase (your own cf is left alone). |
667
+ | `CF_INSTALL_FAILED` | npm is missing or failed, or the download did not match the pinned integrity; `npm install --global cf@1.0.0-beta.13`, then run the same command again. |
668
+ | `CF_AUTH_REQUIRED` | Run the same command again in a terminal to sign in (read-only), or set `CLOUDFLARE_API_TOKEN` first. With the token set (env mode), set a valid read-only token, or unset it (or use `--cf-auth profile`) to sign in with your browser. |
669
+ | `CF_PERMISSION_DENIED` | Your Cloudflare login cannot read the zones; check its permissions, then run the same command again. With `CLOUDFLARE_API_TOKEN` set (env mode), add the read permissions to the token, or unset it (or use `--cf-auth profile`) to sign in with your browser. |
670
+ | `CF_RATE_LIMITED` | Wait 5 minutes, then run the same command again; add `--max-requests-per-5min 600` if it repeats. |
671
+ | `CF_ERROR` | Run the same command again in a few minutes. |
672
+ | `ACCOUNT_SELECTION_REQUIRED` | Run the same command again in a terminal to choose, or add `--account-id <ACCOUNT_ID>` (listed in the error). |
673
+ | `ACCOUNT_NOT_VISIBLE` | Check that your Cloudflare user can read the account and its zones. |
674
+ | `ACCOUNT_TOO_LARGE` | Over 100 zones: run the checkup in your browser instead, https://vigilbase.com/tools/cloudflare-checkup. |
675
+ | `ACCOUNT_MISMATCH` | The checkup is bound to another account; run the same command again without `--account-id`. |
676
+ | `OUTPUT_EXISTS` | Choose another `--out`, or pass `--overwrite`. |
677
+ | `SNAPSHOT_INVALID` / `SNAPSHOT_SECRET_LIKE_VALUE` | Run the same command again (remove the credential-like text from the rule or name first). |
678
+ | `SNAPSHOT_TOO_LARGE` | Run the checkup in your browser instead, https://vigilbase.com/tools/cloudflare-checkup. |
679
+ | `SNAPSHOT_STALE` | Snapshots are accepted for 24 hours; run the same command again. |
680
+ | `EMAIL_INVALID` | Use your work email (personal and disposable addresses are refused), then run the same command again. |
681
+ | `EMAIL_CODE_INVALID` | Five codes were wrong or not 6 digits; run the same command again for a new code. |
682
+ | `VERIFICATION_INVALID` / `VERIFICATION_EXPIRED` | The code expired, was tried too often, or the checkup closed; run the same command again for a new code. |
683
+ | `SESSION_INVALID` / `SESSION_EXPIRED` | Run the same command again to verify your email and start a new checkup. An expired session is renewed once first; after collection, upload the saved file with `submit`. |
684
+ | `SESSION_USED` / `SESSION_CLOSED` | Run the same command again to start a new checkup. |
685
+ | `SESSION_BUSY` | A snapshot for this checkup is still being processed; wait for the results email, or run the same command again. |
686
+ | `SUBMIT_ORIGIN_UNTRUSTED` | Upload only to https://vigilbase.com (or loopback for testing). |
687
+ | `CONFIRMATION_REQUIRED` | Run the command in a terminal, or add `--yes` (and, without `--email`, pipe the address and the code to stdin). |
688
+ | `CLI_UPGRADE_REQUIRED` | vigilbase.com needs a newer CLI (checked before your email is asked for). Run `npx @vigilbase/cli@latest cloudflare-checkup`, or `npm install --global @vigilbase/cli@latest`. |
689
+ | `LOCAL_MODE_DISABLED` | Local checkups aren't available right now. Run the Cloudflare Checkup in your browser instead: https://vigilbase.com/tools/cloudflare-checkup. |
690
+ | `VIGILBASE_RATE_LIMITED` | Wait as long as the error says (`retryAfterSec` in JSON), then run the same command again. |
691
+ | `VIGILBASE_CHALLENGED` | vigilbase.com challenged the request; try another network or contact help@vigilbase.com. |
692
+ | `SUBMIT_FAILED` | Run the same command again later. |
693
+
694
+ JSON success payloads (stdout):
695
+
696
+ - `collect`: `{success, snapshot:{path,bytes,sha256,schemaVersion,accountId,zoneCount,entries:{total,ok,httpError,notCollected,collectionFailed}}, cf:{version,authSource}, cfInvocations, durationMs, warnings:[{code,message}]}`
697
+ - `collect --dry-run`: `{success, dryRun:true, cf:{version,path,tested}, plan:{accountSelection,account,perZone,perRuleset,notCollected}, verified:{commands,mismatched}, childEnv, requestFormula, warnings}`
698
+ - `inspect`: `{success, snapshot:{path,bytes,sha256,schemaVersion,accountId,accountName,zoneCount,collectedAt,collector}, entries:{byKind}, dataCategories:{memberEmails,accessRuleValues,dnsHostnames,pseudonymizedIps,ruleDescriptions}}`
699
+ - `submit`: `{success, replayed, snapshotSha256, provenance, report, resultsUrl?}`; `resultsUrl` is the results page when vigilbase.com returned one; never the email address, a code, a token or the session code
700
+ - the one command (`cloudflare-checkup`, `run`): the `submit` fields plus `snapshot` (as in `collect`) and `warnings`
701
+ - `logout`: `{success, profile:{name,removed,problem?}, managedCf:{path,removed,kept?}, warnings, hint?}`; `success` is false (exit 1) when cf could not run (`problem`)
702
+ - `doctor`: `{success, node:{version,supported}, cf:{found,path,version,supported,tested,identityVerified}, auth:{source,profile,authenticated,expiresAt?,scopes,missingRecommendedScopes?,writeScopeCount?}, commands:{verified,mismatched}, warnings, problems}`
703
+ - `accounts`: `{success, accounts:[{id,name}]}`
704
+
705
+ ## Windows, pnpm and Volta
706
+
707
+ Windows x64 is supported as beta without CI coverage: cf runs via
708
+ `process.execPath` with the entry beside `cf.cmd` (npm's global layout), never
709
+ through `cmd.exe`; and the managed install uses the `npm-cli.js` beside
710
+ `node.exe`. The results page is not opened on Windows (the link is printed).
711
+ Windows on ARM is not supported. The checkup needs no Vigilbase sign-in, so it
712
+ works on Windows even though `vigilbase login` doesn't yet. pnpm and Volta
713
+ global installs are found automatically; otherwise pass `--cf-bin` as above.
714
+
715
+ ## Cleanup
716
+
717
+ ```bash
718
+ npx @vigilbase/cli cloudflare-checkup logout # cf auth delete vigilbase-checkup, then removes <config dir>/cf
719
+ rm ~/.config/vigilbase/checkups/cloudflare-checkup-*.json # the snapshots are yours; delete them when done
720
+ ```
721
+