@vigilbase/cli 0.1.3 → 0.2.0

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