@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/ONE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Vigilbase One CLI reference
2
2
 
3
- Log in with `vigilbase login`. These command groups use the configured One origin (`--one-url`, `VIGILBASE_ONE_URL`, default `https://one.vigilbase.com`) and the saved device-login credential. Every operation in this reference sends GET. Customer, organization, role, and integration access remains enforced by One; selecting an ID never grants access.
3
+ Log in with `vigilbase login` (signing in isn't supported on Windows yet). These command groups use the configured One origin (`--one-url`, `VIGILBASE_ONE_URL`, default `https://one.vigilbase.com`) and your saved sign-in. Every operation in this reference sends GET. Customer, organization, role, and integration access remains enforced by One; selecting an ID never grants access.
4
4
 
5
5
  Use `--json` to retain the complete API response and pagination metadata. Plain/pretty output shows all fields as an indented tree, including null/unknown metrics, degraded status, totals, and cursors. `--timeout <milliseconds>` controls request timeouts. No command automatically follows pagination. Only documented flags are accepted; unrelated flags fail before authentication or network requests.
6
6
 
@@ -94,6 +94,4 @@ vigilbase support tickets [--all] [--limit 1..100] [--json]
94
94
 
95
95
  ## Related commands and validation
96
96
 
97
- See [README.md](README.md) for login, account, billing, public scanners, run history, Watchdog, Cloudflare (`cf`/`cloudflare`), and security command references. The read operations above do not replace the existing explicitly confirmed write commands.
98
-
99
- The test suite validates argument rejection, auth failures, tenant ID encoding, API errors, response rendering, and read transport. `pnpm --filter @vigilbase/cli smoke:commands` builds the actual binary and exercises each named operation against independently authored local HTTP fixtures in `scripts/fixtures/one.mjs`. This verifies the binary, argument parser, credential store, HTTP request, and JSON/text output without writing production data. These fixtures do not assert deployed provider availability or that a particular production user has permissions.
97
+ See [README.md](https://app.unpkg.com/@vigilbase/cli@0.2.1/files/README.md) for sign-in and configuration, [COMMANDS.md](https://app.unpkg.com/@vigilbase/cli@0.2.1/files/COMMANDS.md) for account, billing, public scanners, run history and Watchdog, [CLOUDFLARE.md](https://app.unpkg.com/@vigilbase/cli@0.2.1/files/CLOUDFLARE.md) for `cf`/`cloudflare`, and [SECURITY.md](https://app.unpkg.com/@vigilbase/cli@0.2.1/files/SECURITY.md) for security commands. The read operations above do not replace the existing explicitly confirmed write commands.
package/README.md CHANGED
@@ -1,44 +1,45 @@
1
1
  # @vigilbase/cli
2
2
 
3
- Vigilbase public scanners and Vigilbase One customer, security, Cloudflare,
4
- monitoring, organization, and support operations from the terminal.
3
+ Vigilbase public security scanners, the Cloudflare Checkup, and Vigilbase One
4
+ customer, security, Cloudflare, monitoring, organization and support operations
5
+ from the terminal.
5
6
 
6
- ## Install and sign in
7
+ ## Install
7
8
 
8
- Node 20+ is required. Node 22.19+ or Node 24.5+ enables automatic system
9
- certificate trust.
9
+ Node.js 20 or newer is required. `cloudflare-checkup` needs Node.js 22.18 or
10
+ newer, because it runs Cloudflare's `cf` under the same Node. Node 22.19+ and
11
+ 24.5+ also trust your operating system's certificates automatically (see
12
+ [Troubleshooting](#troubleshooting)).
10
13
 
11
14
  ```bash
12
- npm install -g @vigilbase/cli
13
- # or: pnpm add -g @vigilbase/cli
15
+ npm install -g @vigilbase/cli # or: pnpm add -g @vigilbase/cli
14
16
  vigilbase help
15
- vigilbase login
16
- vigilbase whoami
17
17
  ```
18
18
 
19
- Without global installation: `npx @vigilbase/cli help`. From this monorepo:
20
- `pnpm vigilbase help`; build with `pnpm build:cli` and link with
21
- `pnpm link:vigilbase`.
19
+ Without installing: `npx @vigilbase/cli help`. If you see
20
+ `Unknown command "cloudflare-checkup"`, an older global install is answering
21
+ instead (see [Troubleshooting](#troubleshooting)).
22
22
 
23
- Local link/unlink scripts only recognize symlinks resolving to this checkout's
24
- `dist/bin.js`. Regular binaries, foreign installations, and dangling links are
25
- preserved; resolve a conflicting installation yourself before linking.
23
+ Public tools and the Cloudflare Checkup work without signing in. Vigilbase One
24
+ commands need `vigilbase login` (see [Sign-in](#sign-in)). Signing in isn't
25
+ supported on Windows yet; public tools and `cloudflare-checkup` still work there.
26
26
 
27
- ## Complete command documentation
27
+ ## Documentation
28
28
 
29
- | Reference | Coverage |
29
+ | Reference | Covers |
30
30
  | --- | --- |
31
- | [COMMANDS.md](./COMMANDS.md) | Core commands, aliases, global flags, API mappings, authentication, output, testing |
32
- | [CLOUDFLARE.md](./CLOUDFLARE.md) | Accounts, zones, DNS, WAF, analytics, Zero Trust, Workers/Pages, audit, checkups |
33
- | [SECURITY.md](./SECURITY.md) | Incidents, logs, intelligence, analytics, assets, connections, policies, notifications, reports |
34
- | [ONE.md](./ONE.md) | Customer records/billing/reports/investigations, organizations, monitoring, support |
31
+ | [COMMANDS.md](https://app.unpkg.com/@vigilbase/cli@0.2.1/files/COMMANDS.md) | Core commands, aliases, global options, API mapping, sign-in, output |
32
+ | [CLOUDFLARE.md](https://app.unpkg.com/@vigilbase/cli@0.2.1/files/CLOUDFLARE.md) | Accounts, zones, DNS, WAF, analytics, Zero Trust, Workers/Pages, audit, checkups |
33
+ | [SECURITY.md](https://app.unpkg.com/@vigilbase/cli@0.2.1/files/SECURITY.md) | Incidents, logs, intelligence, analytics, assets, connections, policies, notifications, reports |
34
+ | [ONE.md](https://app.unpkg.com/@vigilbase/cli@0.2.1/files/ONE.md) | Customer records, billing, reports, investigations, organizations, monitoring, support |
35
+ | [LOCAL.md](https://app.unpkg.com/@vigilbase/cli@0.2.1/files/LOCAL.md) | `cloudflare-checkup`: verifies your work email, collects your Cloudflare configuration on your machine with Cloudflare's `cf` and uploads it after you confirm |
35
36
 
36
- These references ship with the npm package. Built-in help is available through
37
- `vigilbase <command> --help` or `vigilbase help <command>`.
37
+ These files ship with the package. Built-in help: `vigilbase <command> --help`
38
+ or `vigilbase help <command>`.
38
39
 
39
40
  ## Examples
40
41
 
41
- Public tools require no login:
42
+ Public tools, no sign-in:
42
43
 
43
44
  ```bash
44
45
  vigilbase list
@@ -48,10 +49,12 @@ vigilbase describe security-headers
48
49
  vigilbase badge vigilbase.com --style compact
49
50
  ```
50
51
 
51
- Public scanners are `security-headers` and `email-security`. Authenticated
52
- scanners are `website-security`, `react2shell`, and `fortibleed-check`:
52
+ The public scanners are `security-headers` and `email-security`.
53
+ `website-security`, `react2shell` and `fortibleed-check` run through Vigilbase
54
+ One and need a sign-in:
53
55
 
54
56
  ```bash
57
+ vigilbase login
55
58
  vigilbase run website-security example.com --json
56
59
  vigilbase account
57
60
  vigilbase customers list --json
@@ -62,7 +65,7 @@ vigilbase support tickets
62
65
  vigilbase runs list
63
66
  ```
64
67
 
65
- Cloudflare IDs come from the accessible inventory:
68
+ Cloudflare IDs come from the inventory you can access:
66
69
 
67
70
  ```bash
68
71
  vigilbase cf accounts
@@ -90,134 +93,349 @@ vigilbase security notifications
90
93
  vigilbase security audit --limit 50
91
94
  ```
92
95
 
93
- Customer users inherit their organization scope. Internal operators must add
94
- `--customer-id <customer-uuid>` for security views. Cloudflare analytics requires
95
- that customer ID as well. Other customer-specific groups use positional customer
96
- UUIDs. Flags select records; One still decides whether the session can access them.
96
+ Customer users inherit their organization's scope. Internal operators add
97
+ `--customer-id <customer-uuid>` for security views; Cloudflare analytics needs
98
+ it too. Other customer-specific commands take the customer UUID as an argument.
99
+ Flags select records; One still decides whether your session can see them.
97
100
 
98
- After reviewing an incident, a status update is available explicitly:
101
+ After reviewing an incident, you can update its status explicitly:
99
102
 
100
103
  ```bash
101
104
  vigilbase security incidents update <incident-uuid> acknowledged \
102
105
  --note 'Investigating with the customer' --confirm
103
106
  ```
104
107
 
105
- Other status updates are `mitigating`, `resolved`, and `false_positive`.
106
- `--confirm` acknowledges the caller's intent; it does not grant permission or
107
- approve provider remediation. API mutations are not automatically retried.
108
- See command references for the other explicit effects (invitation creation,
109
- billing portal sessions, scans, and checkup starts).
108
+ Other statuses are `mitigating`, `resolved` and `false_positive`. `--confirm`
109
+ states your intent; it does not grant permission or approve provider
110
+ remediation. API changes are never retried automatically. The references list
111
+ the other explicit actions (sending invitations, opening a billing portal
112
+ session, running scans and starting checkups).
113
+
114
+ ## Cloudflare Checkup on your machine
115
+
116
+ ```bash
117
+ npx @vigilbase/cli cloudflare-checkup
118
+ ```
119
+
120
+ This one command (also `vigilbase cloudflare-checkup` or
121
+ `vigilbase local cloudflare-checkup`) runs the Vigilbase Cloudflare Checkup
122
+ on your machine with Cloudflare's own `cf` CLI. It needs no Vigilbase sign-in.
123
+ It asks for your work email and vigilbase.com emails you a 6-digit code to
124
+ enter. It then installs cf if needed (it asks first), signs in to Cloudflare
125
+ read-only, lets you choose the account, collects, and uploads the snapshot only
126
+ after you confirm. It prints the results link and opens it in your browser on
127
+ macOS and Linux; the results also go to your verified email.
128
+
129
+ cf owns your Cloudflare login: this CLI never reads, prints, stores or uploads
130
+ it. Your email address goes to vigilbase.com only so it can send the code; the
131
+ CLI never prints, logs or stores it and shows only the masked `j***@acme.com`.
132
+ In a terminal the steps show as an interactive timeline; pipes, CI,
133
+ `TERM=dumb` and `--json` get plain lines.
134
+
135
+ Local checkups work while vigilbase.com has them switched on. The CLI checks
136
+ before it asks for your email. When they are off, it stops with
137
+ `Local checkups aren't available right now.` and points you to the checkup in
138
+ your browser, <https://vigilbase.com/tools/cloudflare-checkup>, which uses a
139
+ read-only Cloudflare API token instead. When you are done:
140
+
141
+ ```bash
142
+ npx @vigilbase/cli cloudflare-checkup logout # removes the read-only cf login and the cf it installed
143
+ ```
144
+
145
+ See [LOCAL.md](https://app.unpkg.com/@vigilbase/cli@0.2.1/files/LOCAL.md) for
146
+ every step, what is uploaded and the error codes.
147
+
148
+ ## Public tools and sign-in
149
+
150
+ - **Public scans never depend on your sign-in.** `headers`, `email` and
151
+ `run security-headers|email-security` call the public API anonymously and
152
+ never read your saved sign-in, so an expired, broken or unreachable sign-in
153
+ cannot make them fail. `--public` and `--via public` force the public API for
154
+ any tool.
155
+ - **One-only scans need a sign-in.** `website-security`, `react2shell`,
156
+ `fortibleed-check` and any run with `--via one` go through Vigilbase One.
157
+ Without a usable sign-in they stop with
158
+ ``This tool needs a Vigilbase One sign-in: run `vigilbase login`.``
159
+ - **`list`** reads your saved sign-in from disk only (no refresh, no network,
160
+ no waiting for another command) to show which tools you can run. If it can't
161
+ use it, it lists the tools as signed out and prints one line on stderr:
162
+ ``Couldn't use your saved sign-in (<reason>); running anonymously. Run `vigilbase login` to fix.``
163
+ When the reason is an unsafe config path or credentials file, the line ends
164
+ with its fix instead (see [Directory checks](#directory-checks)).
165
+ - **`doctor`** reports a sign-in problem as its own failed `signIn` check.
110
166
 
111
167
  ## Automation and output
112
168
 
113
- Every command supports `-j` / `--json`. JSON goes to stdout; progress and browser
114
- instructions go to stderr. Progress animations are disabled for JSON, CI, and
115
- non-TTY output. Preserve JSON pagination fields when fetching subsequent pages;
116
- list commands do not silently fetch every page. New text views display complete
117
- identifiers. All human-readable output removes terminal control sequences and
118
- bidirectional overrides, including identities, tool results, skills, and errors.
119
- JSON preserves successful response data with control characters escaped. Default
120
- errors omit server response bodies and messages, retaining safe status, error
121
- code, and retry metadata.
169
+ Every command supports `-j` / `--json`. JSON goes to stdout; progress and
170
+ browser instructions go to stderr. Progress animations are off for JSON, CI and
171
+ output that isn't a terminal. List commands never fetch every page on their
172
+ own: keep the JSON pagination fields to fetch the next page. Text output shows
173
+ complete identifiers. Human-readable output removes terminal control sequences
174
+ and bidirectional overrides from everything it prints, including names, tool
175
+ results, skills and errors. JSON keeps successful response data, with control
176
+ characters escaped.
177
+
178
+ `vigilbase --version` prints the banner in a terminal and only the version
179
+ number when stdout is a pipe or a file, so `v=$(vigilbase --version)` works in
180
+ scripts. With `--json` it prints `{"name":"@vigilbase/cli","version":"…"}`.
122
181
 
123
182
  | Exit code | Meaning |
124
183
  | --- | --- |
125
184
  | `0` | Success (including a signed-out `whoami`) |
126
- | `1` | Validation, API, network, or unsuccessful scan result |
185
+ | `1` | Validation, API, network or sign-in error, or an unsuccessful scan result |
127
186
  | `2` | Rate limited (`HTTP 429`) |
128
187
 
129
- Commands use named One APIs and existing server authorization. They do not accept
130
- Cloudflare/provider secrets, delegated identity claims, or an arbitrary upstream
131
- URL. Billing records are fetched on demand and not persisted by the CLI.
132
-
133
- ## Login and configuration
134
-
135
- `login` opens a browser and waits for device approval. On remote terminals, run
136
- `vigilbase login --no-open`, then open the displayed URL in a signed-in browser.
137
- For an existing One session token, pipe it from your secret manager into
138
- `vigilbase login --token-stdin`. Input must contain one token and is never echoed.
139
- The older `--token <bearer>` and `VIGILBASE_ONE_TOKEN` inputs remain supported;
140
- command arguments may be visible in process listings or shell history. Do not
141
- combine either with `--token-stdin`. Login validates the token before saving it.
142
-
143
- The credential directory must be an absolute path, owned by the current user,
144
- and mode `0700`; `credentials.json` must be an owned regular file with mode
145
- `0600`. Symlinks, hard links, and unsafe parent directories are rejected. Existing
146
- files with broader permissions require `chmod 700 <config-directory>` and
147
- `chmod 600 <config-directory>/credentials.json`. Only the access token and session
148
- metadata are saved; unused refresh tokens are never persisted.
149
-
150
- Credentials are stored atomically in `~/.config/vigilbase/credentials.json` with
151
- owner-only file permissions. `XDG_CONFIG_HOME` or `VIGILBASE_CONFIG_DIR` can change
152
- the location. Tokens are restricted to their issuing One origin. Legacy credential
153
- files remain valid for production only; re-login for a custom One origin.
154
- `whoami` validates the live session. `logout` removes the local credential file.
188
+ Errors keep a safe status, error code and retry delay. When a public scan
189
+ fails and vigilbase.com explains why, the CLI shows that reason:
190
+ `Error: <message> (<code>)` in text, and `error` plus `code` in JSON. The
191
+ reason is shown only when vigilbase.com sends it as a known error code, and it
192
+ is cleaned to one line of at most 300 characters. Anything else, and every
193
+ Vigilbase One error, prints only `Request failed (HTTP <status>).` without the
194
+ server's text. Hints (`Hint: …`, `hint` in JSON) are always written by the CLI.
195
+
196
+ Commands use named One APIs and One's own authorization. They never take
197
+ Cloudflare or other provider secrets, delegated identity claims or an arbitrary
198
+ upstream URL. Billing records are fetched on demand and never stored by the
199
+ CLI.
200
+
201
+ ## Sign-in
202
+
203
+ ### Logging in
204
+
205
+ `vigilbase login` opens a browser and waits for you to approve the device code.
206
+ On a remote terminal, run `vigilbase login --no-open` and open the printed URL
207
+ in a signed-in browser.
208
+
209
+ The CLI reads One's protected-resource metadata to choose the sign-in:
210
+
211
+ - **Vigilbase Identity** (one.vigilbase.com uses it). You approve at
212
+ <https://auth.vigilbase.com/device> and choose the organization the sign-in
213
+ is for. `whoami` and `doctor` check the session at Identity.
214
+ - **Legacy One sign-in**, for a One that doesn't advertise Identity. You
215
+ approve at that One's `/device` page.
216
+
217
+ The CLI builds the approval URL itself from the issuer (or One) origin; it
218
+ never opens a URL the server sends.
219
+
220
+ To save an existing One session token instead, pipe it from your secret
221
+ manager into `vigilbase login --token-stdin`. The input must hold one token and
222
+ is never echoed. `--token <bearer>` and `VIGILBASE_ONE_TOKEN` also work, but
223
+ command arguments can show up in process listings and shell history; neither
224
+ combines with `--token-stdin`. Login checks the token with One before saving
225
+ it.
226
+
227
+ ### Where credentials are stored
228
+
229
+ Credentials live in the config directory: `VIGILBASE_CONFIG_DIR` if set,
230
+ otherwise `$XDG_CONFIG_HOME/vigilbase`, otherwise `~/.config/vigilbase`.
231
+ `VIGILBASE_CONFIG_DIR` must be an absolute path; a relative `XDG_CONFIG_HOME`
232
+ is ignored.
233
+
234
+ | File | Holds |
235
+ | --- | --- |
236
+ | `identity-credentials.json` | Your Vigilbase Identity sign-in: issuer, client, One origin, organization and the rotating refresh token. CLI 0.1.x never reads it. |
237
+ | `credentials.json` | A legacy One session (version 1), shared with CLI 0.1.x: written by `--token`, `--token-stdin`, `VIGILBASE_ONE_TOKEN` and legacy device sign-in. |
238
+ | `credentials.json.lock` | One lock for both files, also used by CLI 0.2.0. |
239
+
240
+ Files are written atomically with mode `0600`. A saved session is only sent to
241
+ the One origin it was issued for (a legacy file without an origin counts as
242
+ production). With both files present, the Identity sign-in is used, and a
243
+ `credentials.json` that can't be parsed is ignored. Logging in replaces a file
244
+ that passes the [directory checks](#directory-checks) but can't be parsed.
245
+
246
+ ### Using CLI 0.1.x or 0.2.0 too
247
+
248
+ - CLI 0.2.0 kept its Identity sign-in in `credentials.json`, which CLI 0.1.x
249
+ cannot read. The first 0.2.1 command that reads your sign-in moves it to
250
+ `identity-credentials.json` (under the lock), unless that file already
251
+ exists. From then on `credentials.json` is either absent or a legacy session
252
+ that 0.1.x can use.
253
+ - If 0.2.0 later saves a new `credentials.json` while
254
+ `identity-credentials.json` exists, 0.2.1 ignores it. `whoami` notes it
255
+ (`legacyIdentityFileIgnored` in JSON), and `vigilbase logout` revokes and
256
+ removes it.
257
+ - An Identity login leaves a legacy `credentials.json` alone. A token login or
258
+ a legacy device login first revokes and removes any Identity sign-in, so the
259
+ new session is the one in use; if that revocation fails, login stops and
260
+ nothing changes.
261
+ - Logging in again with Identity first revokes and removes the sign-in it
262
+ replaces, before asking for a new device code, so cancelling that login
263
+ leaves you signed out. If the revocation fails, the CLI warns that the old
264
+ sign-in will expire on its own and carries on. A sign-in whose last refresh
265
+ had an uncertain result isn't revoked: Identity may have replaced its token
266
+ already, and presenting that token again can end every CLI sign-in of yours.
267
+ It expires on its own.
268
+ - Sign out with 0.2.1 or later: CLI 0.1.x's `logout` only deletes
269
+ `credentials.json` and does not touch your Identity sign-in.
270
+
271
+ ### Logging out
272
+
273
+ `vigilbase logout`:
274
+
275
+ 1. Revokes every saved Identity refresh token, in `identity-credentials.json`
276
+ and in a `credentials.json` left by CLI 0.2.0. A sign-in Identity has
277
+ already ended (after a browser sign-out, for example) counts as revoked. If
278
+ revocation fails otherwise, it keeps every file and stops with
279
+ `Identity revocation failed, so your saved sign-in was kept. Try again later.`
280
+ 2. Signs a legacy session out at the One that issued it. If that fails, it
281
+ warns and goes on; the session expires on its own.
282
+ 3. Deletes the credential files. A file that passes the
283
+ [directory checks](#directory-checks) but can't be parsed is removed with a
284
+ warning, without being revoked; an unsafe file stops logout and stays in
285
+ place.
286
+
287
+ Saved Identity credentials belong to one issuer, client and One. If you signed
288
+ in with `--auth-url`, `--one-url` or `--client-id`, log out with the same
289
+ options; otherwise logout stops, before revoking anything, with
290
+ `Saved credentials belong to a different issuer, resource, or client. Use the matching configuration to log out.`
291
+
292
+ ### Refresh and the credentials lock
293
+
294
+ Identity access tokens last five minutes. The CLI refreshes within 60 seconds
295
+ of expiry, or once after a 401. The lock coordinates CLI processes, and each
296
+ holder rereads the file before rotating the refresh token. If a refresh may
297
+ have been used but its answer was lost, the CLI marks it and asks you to run
298
+ `vigilbase login` again rather than retrying it. A command waits up to 15
299
+ seconds (or `--timeout`, if shorter) for the lock, then stops with
300
+ `Credentials are locked by another command. …`. `login` and `logout` may
301
+ remove a lock left by a process that has exited, but never one held by a
302
+ running process. If a damaged lock can't be recovered, stop every `vigilbase`
303
+ process, delete `credentials.json.lock` and log in again. Never reuse a refresh
304
+ token by hand.
305
+
306
+ ### Directory checks
307
+
308
+ Commands that read or write credentials (`login`, `logout`, `whoami`, every One
309
+ command, `--via one` and the One-only scans) check the whole config path first:
310
+
311
+ - no component of the path may be a symbolic link;
312
+ - every parent directory must be owned by you or root, and not writable by its
313
+ group or by others unless it has the sticky bit;
314
+ - the config directory must be owned by you with mode `0700`;
315
+ - credential files must be regular files owned by you, with one hard link and
316
+ mode `0600`.
317
+
318
+ Each error names the path that failed and how to fix it, for example:
319
+
320
+ ```
321
+ Error: /tmp is a symbolic link. Set VIGILBASE_CONFIG_DIR to a private directory without symbolic links in its path.
322
+ Error: /Users/jane/.config/vigilbase must have mode 0700. Run chmod 700 /Users/jane/.config/vigilbase, or set VIGILBASE_CONFIG_DIR to another directory.
323
+ ```
324
+
325
+ On macOS `/tmp` and `/var` are symbolic links, and dotfiles managers often make
326
+ `~/.config` one. Fix the mode with the `chmod` the error names, or point
327
+ `VIGILBASE_CONFIG_DIR` at a private directory of its own, for example:
328
+
329
+ ```bash
330
+ export VIGILBASE_CONFIG_DIR="$(cd ~ && pwd -P)/.vigilbase"
331
+ ```
332
+
333
+ Don't use a directory inside a dotfiles repository or a synced folder (resolving
334
+ a symlinked `~/.config` with `pwd -P` usually leads there): the credential
335
+ files hold your refresh token.
336
+
337
+ Public commands don't need these checks: public scans, `describe`, `skill` and
338
+ `badge` never open the config directory, and work even when
339
+ `VIGILBASE_CONFIG_DIR` isn't absolute. `list` and `doctor` never create or open
340
+ anything in a directory that fails them, and only treat it as a problem when a
341
+ credentials file may be there: `list` then shows you as signed out with one
342
+ warning, and `doctor` reports it in its `signIn` check. With no saved sign-in,
343
+ both carry on as usual.
344
+
345
+ ### Windows
346
+
347
+ Signing in isn't supported on Windows yet, because the CLI can't yet protect
348
+ credential files there. `login`, `logout`, `whoami`, the One commands,
349
+ `--via one` and the One-only scans stop with
350
+ `Signing in isn't supported on Windows yet; public tools and cloudflare-checkup still work.`
351
+ (code `SIGN_IN_UNSUPPORTED`) before touching the disk or the network. Public
352
+ tools, `list`, `doctor`, `describe`, `skill`, `badge` and `cloudflare-checkup`
353
+ work and ignore any saved credentials.
354
+
355
+ ## Configuration
155
356
 
156
357
  | Option | Environment variable | Default |
157
358
  | --- | --- | --- |
158
359
  | `--base-url <origin>` | `VIGILBASE_BASE_URL` | `https://vigilbase.com` |
159
360
  | `--one-url <origin>` | `VIGILBASE_ONE_URL` | `https://one.vigilbase.com` |
361
+ | `--auth-url <origin>` | `VIGILBASE_AUTH_URL` | `https://auth.vigilbase.com` |
160
362
  | `--client-id <id>` | `VIGILBASE_CLIENT_ID` | `vigilbase-cli` |
161
363
  | `--timeout <ms>` | — | `60000` per request |
162
364
 
163
- Origins must be HTTP(S) URLs without paths, credentials, or queries. Authenticated
164
- One origins require HTTPS. HTTP is allowed only for loopback development
165
- (`localhost`, `127.0.0.0/8`, or `::1`). This applies to device authorization,
166
- explicit tokens, and saved sessions. API redirects are refused.
167
- `VIGILBASE_API_URL` and `VIGILBASE_PUBLIC_URL` are legacy public-origin aliases,
168
- used after `VIGILBASE_BASE_URL` when no explicit flag is supplied.
169
- `VIGILBASE_CLI_NO_OPEN=1` disables automatic browser opening.
170
-
171
- Billing portal URLs must use HTTPS on `billing.stripe.com`. Windows prints URLs
172
- for manual opening; URL data never passes through `cmd /c start`. Device login
173
- always uses the configured One origin's `/device` page.
174
-
175
- Catalog skill downloads are restricted to HTTPS
176
- `vigilbase.com/agent-skills/<name>.md` (also `www.vigilbase.com`). Custom API
177
- origins cannot expand this allowlist. DNS results must all be public; the TLS
178
- connection is pinned to a checked address. Redirects are refused. Skill documents
179
- are limited to 256 KiB; API response bodies are limited to 8 MiB, with timeouts
180
- covering body reads.
365
+ Origins are HTTP(S) URLs without credentials, paths, queries or fragments. One
366
+ needs HTTPS; HTTP is allowed only for loopback development (`localhost`,
367
+ `127.0.0.0/8` or `[::1]`). This applies to device sign-in, tokens and saved
368
+ sessions. `VIGILBASE_API_URL` and `VIGILBASE_PUBLIC_URL` are older names for
369
+ the public origin, used after `VIGILBASE_BASE_URL` when no flag is given.
370
+ `VIGILBASE_CLI_NO_OPEN=1` stops the CLI from opening a browser, and
371
+ `VIGILBASE_CLI_NO_BANNER=1` hides the banner.
372
+
373
+ **Identity issuer.** The CLI trusts one Identity issuer: `--auth-url` /
374
+ `VIGILBASE_AUTH_URL` when set, otherwise `https://auth.vigilbase.com`. The
375
+ issuer One names must be exactly that origin, or sign-in stops before any
376
+ request to it. `--auth-url` accepts `https://auth.vigilbase.com`,
377
+ `https://identity-staging.vigilbase.com`, or a loopback origin when `--one-url`
378
+ is loopback too; staging is trusted only when you pass it. Saved Identity
379
+ credentials from another issuer count as signed out.
380
+
381
+ Billing portal URLs must use HTTPS on `billing.stripe.com`. Skill downloads are
382
+ limited to HTTPS `vigilbase.com/agent-skills/<name>.md` (or
383
+ `www.vigilbase.com`), whatever origin you configure. Every DNS answer must be a
384
+ public address, the TLS connection is pinned to a checked address, and
385
+ redirects are refused. Skill documents are limited to 256 KiB and API responses
386
+ to 8 MiB; timeouts cover reading the body.
181
387
 
182
388
  ## Troubleshooting
183
389
 
184
- `vigilbase doctor --json` independently checks the public catalog and One session
185
- endpoint. A signed-out One response counts as reachable; failed checks identify
186
- the endpoint and cause a nonzero exit. DNS, TLS, connection, and timeout failures
187
- include actionable diagnostics.
188
-
189
- The executable automatically adds OS-trusted certificates on Node 22.19+ and
190
- Node 24.5+ while preserving bundled roots and `NODE_EXTRA_CA_CERTS`. This supports
191
- private CAs trusted in macOS Keychain or the system trust store. See
390
+ **Check connectivity.** `vigilbase doctor` (add `--json` for details) runs
391
+ three checks on their own and exits 1 if any fails:
392
+
393
+ - `publicApi`: `GET https://vigilbase.com/api/agent/tools`.
394
+ - `one`: your session. Signed out or with a legacy session,
395
+ `GET https://one.vigilbase.com/api/auth/get-session`; a signed-out answer
396
+ counts as reachable. With an Identity sign-in, the issuer's
397
+ `/.well-known/openid-configuration` and then the userinfo endpoint it names
398
+ (`https://auth.vigilbase.com/api/auth/oauth2/userinfo`).
399
+ - `signIn`: whether your saved sign-in works, including a refresh if one is
400
+ due.
401
+
402
+ DNS, TLS, connection and timeout failures name the endpoint and the cause.
403
+ Use `--base-url`, `--one-url`, `--auth-url` and `--timeout` to check other
404
+ environments.
405
+
406
+ **`Unknown command "cloudflare-checkup"`.** An older global install (0.1.x)
407
+ takes priority over a bare `npx @vigilbase/cli`. Update it with
408
+ `npm install -g @vigilbase/cli@latest`, or run the latest release once with
409
+ `npx @vigilbase/cli@latest cloudflare-checkup`. `vigilbase --version` shows
410
+ which version answers.
411
+
412
+ **`Device sign-in isn't available at <origin> right now.`** Login got a 404
413
+ from that origin. If you set `--one-url` or `--auth-url`, check it; otherwise
414
+ try again later or email help@vigilbase.com. Public tools work without signing
415
+ in.
416
+
417
+ **`… is a symbolic link`, `… must have mode 0700` and similar.** See
418
+ [Directory checks](#directory-checks).
419
+
420
+ **`A previous refresh has an uncertain result.`** Run `vigilbase login` again.
421
+
422
+ **Certificates.** On Node 22.19+ and 24.5+ the CLI adds your operating
423
+ system's trusted certificates, keeping Node's bundled roots and
424
+ `NODE_EXTRA_CA_CERTS`. This covers private CAs trusted in the macOS Keychain or
425
+ the system trust store. See
192
426
  [Node's TLS documentation](https://nodejs.org/docs/latest-v22.x/api/tls.html#tlssetdefaultcacertificatescerts).
193
-
194
- For an older installed CLI reporting `fetch failed` / `SELF_SIGNED_CERT_IN_CHAIN`,
195
- a recent Node 22 runtime supports this workaround:
427
+ On an older Node 22, `fetch failed` or `SELF_SIGNED_CERT_IN_CHAIN` can be
428
+ worked around with:
196
429
 
197
430
  ```bash
198
431
  NODE_OPTIONS="${NODE_OPTIONS:+$NODE_OPTIONS }--use-system-ca" vigilbase login
199
432
  ```
200
433
 
201
- For a private CA outside the system store, configure
202
- `NODE_EXTRA_CA_CERTS=/path/to/trusted-ca.pem` before launch. Certificate validation
203
- remains enabled. Use `--timeout` for slower queries; some security analytics APIs
204
- have a longer server budget than the default CLI timeout.
205
-
206
- ## Development and verification
434
+ For a private CA outside the system store, set
435
+ `NODE_EXTRA_CA_CERTS=/path/to/trusted-ca.pem` before starting the CLI.
436
+ Certificate checks always stay on.
207
437
 
208
- ```bash
209
- pnpm --filter @vigilbase/cli check
210
- pnpm --filter @vigilbase/cli smoke:commands
211
- ```
438
+ **Timeouts.** Use `--timeout` for slower queries; some security analytics APIs
439
+ take longer than the default.
212
440
 
213
- `check` runs typecheck, unit tests, production build, the device-login lifecycle
214
- suite, the compiled-command HTTP suite, and security subprocess regressions. Fixtures cover every supported
215
- operation in both JSON and text, with exact methods, paths, query filters, bearer
216
- headers, bodies, error exits, and included documentation. Fixtures use temporary
217
- credentials and a loopback server; simulated mutations never touch production.
218
-
219
- The separate `smoke:e2e` script runs real public scanners. Configure
220
- `VIGILBASE_BASE_URL` and `VIGILBASE_SMOKE_ARTIFACTS` as shown in COMMANDS.md.
221
- Authenticated production verification requires a valid One session and appropriate
222
- permissions. A passing local fixture does not establish provider availability or
223
- production customer-data health.
441
+ **Help.** Email help@vigilbase.com or visit <https://vigilbase.com/help>.
package/SECURITY.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Security command reference
2
2
 
3
- All commands start with `vigilbase security`. Sign in with `vigilbase login` first. Commands use the configured One origin and its authenticated `/api/flarehawk` boundary. One independently checks permissions and maps the current organization to its security tenant. Internal operators can supply `--customer-id <One customer UUID>` for validated View-as access; this never supplies an upstream organization identity.
3
+ All commands start with `vigilbase security`. Sign in with `vigilbase login` first (signing in isn't supported on Windows yet). Commands use the configured One origin and its authenticated `/api/flarehawk` boundary. One independently checks permissions and maps the current organization to its security tenant. Internal operators can supply `--customer-id <One customer UUID>` for validated View-as access; this never supplies an upstream organization identity.
4
4
 
5
5
  Every operation below is **GET/read-only**, except `incidents update`, which is **PATCH/write** and requires `--confirm` plus server service-write permission. Reads require server service-read permission. No command directly accesses the retained service, runs archived chat, changes remediation authority, or approves provider effects.
6
6
 
@@ -131,4 +131,4 @@ vigilbase security connections logpush-status <connection-uuid> <job-uuid>
131
131
  vigilbase security intel ip 1.1.1.1
132
132
  ```
133
133
 
134
- The API contract sources are One's `flarehawk/policy.ts`, `flarehawk-ui/client.ts`, `flarehawk-ui/normalizers.ts`, specialized analytics request/normalizer modules, personal-controls schemas, and incident-share schemas. Binary log downloads and routes without a verified JSON consumer are not exposed. The standalone `scripts/fixtures/security.mjs` catalog covers every named wire operation for compiled CLI end-to-end verification.
134
+ Binary log downloads and routes without a verified JSON consumer are not exposed.
@@ -55,4 +55,3 @@ export declare function waitForDeviceAuthorization(config: CliConfig, device: De
55
55
  signal?: AbortSignal;
56
56
  maxConsecutiveTransient?: number;
57
57
  }): Promise<DeviceTokenSuccess>;
58
- //# sourceMappingURL=device-auth.d.ts.map