@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/CLOUDFLARE.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  `vigilbase cf` and `vigilbase cloudflare` use the authenticated Vigilbase One API. Run `vigilbase login` first. Your organization, permissions, customer links, and allowed zones determine access. The CLI never requires a Cloudflare API key.
4
4
 
5
+ `cf checkup` runs on One's servers. `cloudflare-checkup` (also `local cloudflare-checkup`) runs on your machine with Cloudflare's own `cf` CLI and needs no Vigilbase login: one command, `npx @vigilbase/cli cloudflare-checkup` (also shown at https://vigilbase.com/tools/cloudflare-checkup?mode=local), verifies your work email with a code, installs cf if needed, signs in read-only, collects and uploads after you confirm (see [LOCAL.md](./LOCAL.md)).
6
+
5
7
  Customer provider access requires an `active` or `trialing` Cloudflare service
6
8
  entitlement for the selected account. Historical/inactive rows and legacy account
7
9
  pointers cannot grant live access. Historical restrictions on the same customer
package/COMMANDS.md CHANGED
@@ -12,6 +12,7 @@ The CLI uses public scanner APIs on `vigilbase.com` and authenticated APIs on
12
12
  | Cloudflare | [CLOUDFLARE.md](./CLOUDFLARE.md) |
13
13
  | Security | [SECURITY.md](./SECURITY.md) |
14
14
  | Customers, organizations, monitoring, support | [ONE.md](./ONE.md) |
15
+ | Local Cloudflare Checkup (cf on your machine) | [LOCAL.md](./LOCAL.md) |
15
16
  | Authentication, setup, network troubleshooting | [README.md](./README.md) |
16
17
 
17
18
  The references identify supported operations, filters, response/pagination
@@ -26,6 +27,7 @@ supported API surface, not every internal endpoint in the monorepo.
26
27
  | `--help`, `-h` | Help for the named command; makes no API request |
27
28
  | `--version`, `-V` | Package version |
28
29
  | `--one-url <origin>` | One origin; default `https://one.vigilbase.com` |
30
+ | `--auth-url <origin>` | Explicit registered issuer or loopback development issuer; One discovery chooses the active provider |
29
31
  | `--base-url <origin>` | Public origin; default `https://vigilbase.com` |
30
32
  | `--timeout <ms>` | Per-request timeout, integer 1–2147483647; default 60000 |
31
33
  | `--client-id <id>` | Device authorization client; default `vigilbase-cli` |
@@ -41,15 +43,16 @@ signed-in role lacks access. Unknown flags, unsupported command-specific flags
41
43
 
42
44
  | Command | Options and behavior | One API |
43
45
  | --- | --- | --- |
44
- | `login` | Device authorization; `--no-open` for remote terminals | POST `/api/auth/device/code`, POST `/api/auth/device/token` |
46
+ | `login` | Device authorization; `--no-open` for remote terminals | One protected-resource discovery; legacy device endpoints or Identity device code + form token exchange |
45
47
  | `login --token-stdin` | Validate and save a token piped from a secret manager; input is bounded and never echoed | GET `/api/auth/get-session` |
46
48
  | `login --token <bearer>` | Legacy input; discouraged because arguments can appear in process lists/history. `VIGILBASE_ONE_TOKEN` is also supported; neither combines with `--token-stdin` | GET `/api/auth/get-session` |
47
- | `whoami` | Verify the saved session; signed-out is a successful status query | GET `/api/auth/get-session` when a usable token exists |
48
- | `logout` | Remove local credentials; does not revoke the server session | Local only |
49
+ | `whoami` | Verify the saved session; signed-out is a successful status query | Legacy session or Identity userinfo when a usable grant exists |
50
+ | `logout` | Revoke Identity refresh grant, then remove local credentials; legacy logout stays local | Identity revocation, when using v2 credentials |
49
51
  | `doctor` | Independently check public catalog and One session connectivity | GET `/api/agent/tools`, GET `/api/auth/get-session` |
50
52
 
51
53
  Tokens are saved atomically with owner-only file permissions and tied to their
52
- issuing One origin. See README for config directory overrides and certificate
54
+ issuing One origin and, for Identity grants, issuer/client/resource. Rotating
55
+ refresh tokens are coordinated across CLI processes. See README for config directory overrides and certificate
53
56
  trust. Login polling handles pending approval, denial, expiry, and transient
54
57
  transport failures. Access tokens are never included in successful CLI output.
55
58
 
@@ -109,6 +112,31 @@ output, printing, or opening; Windows requires manual opening.
109
112
 
110
113
  Customer-specific Watchdog and monitoring views are documented in ONE.md.
111
114
 
115
+ ## Local Cloudflare Checkup (no login)
116
+
117
+ | Command | Options | Requests |
118
+ | --- | --- | --- |
119
+ | `cloudflare-checkup` (≡ `local cloudflare-checkup [run]`) | `--email`, `--account-id`, `--out`, `--overwrite`, `--yes`, `--confirm`, `--no-open`, `--cf-auth auto\|profile\|env\|default` (default `auto`), `--profile`, `--cf-bin`, `--max-requests-per-5min`, `--base-url` (vigilbase.com or loopback), `--timeout` | POST `/api/v1/tools/cloudflare-checkup/local-session/request` and `…/verify` (email verification), GET `…/local-session` (before cf runs and again before the upload), allowlisted read-only cf commands, POST `…/local-session/snapshot` after an explicit confirmation; npm only to install the pinned cf when none is usable (asks first) |
120
+ | `cloudflare-checkup login` | `--profile`, `--no-open`, `--dry-run`, `--cf-bin` | Runs `cf auth create <profile> --scopes …` interactively |
121
+ | `cloudflare-checkup doctor` | `--cf-auth`, `--profile`, `--cf-bin` | Offline cf mapping check, one `cf auth whoami` |
122
+ | `cloudflare-checkup accounts` | `--cf-auth`, `--profile`, `--cf-bin` | `cf accounts list` (all pages) |
123
+ | `cloudflare-checkup collect` | `--out` (required), `--account-id`, `--overwrite`, `--dry-run`, `--max-requests-per-5min`, cf options | Allowlisted read-only cf commands; writes the snapshot |
124
+ | `cloudflare-checkup inspect <file>` | — | None |
125
+ | `cloudflare-checkup submit <file>` | `--email`, `--yes`/`--confirm`, `--no-open`, `--base-url`, `--timeout` | POST `…/local-session/request` and `…/verify`, GET `…/local-session`, POST `…/local-session/snapshot` |
126
+ | `cloudflare-checkup logout` | `--profile`, `--cf-bin` | Runs `cf auth delete <profile>` interactively, then removes the cf Vigilbase installed |
127
+
128
+ Each subcommand also works as `local cloudflare-checkup <subcommand>`. The one
129
+ command and `submit` verify your work email first: the CLI asks for it (or
130
+ takes `--email`), vigilbase.com emails a 6-digit code, and the CLI asks for the
131
+ code (without a terminal, both are read from stdin, one line each; add
132
+ `--yes`). In a terminal both show an interactive timeline on stderr (inputs,
133
+ arrow-key questions, spinners, a collection progress bar); pipes, CI,
134
+ `TERM=dumb` and `--json` keep the plain lines and prompts. Ctrl-C exits 130. The address, the code and the session code are never echoed, logged,
135
+ stored or passed to cf or npm. cf output and stderr are never echoed; failures
136
+ carry a stable `code` and `hint` that point at running the same command again.
137
+ See [LOCAL.md](./LOCAL.md) for the email verification, the managed cf install,
138
+ the allowlist, environment policy, uploaded data and error codes.
139
+
112
140
  ## Output, effects, and testing
113
141
 
114
142
  Exit codes: **0** success, **1** validation/API/network failure, **2** HTTP 429
@@ -124,7 +152,14 @@ JSON for automation and evidence export.
124
152
 
125
153
  Provider credentials, signed delegation claims, internal bearer tokens, and
126
154
  organization-authority overrides are never CLI inputs. New commands use named
127
- One routes. Webhooks, cron/admin repair endpoints, interactive OAuth handoffs,
155
+ One routes. Exceptions: local provider reads and the two named vigilbase.com
156
+ local-session routes. `vigilbase cloudflare-checkup` runs Cloudflare's own
157
+ `cf` CLI on your machine with a fixed allowlist of read-only commands; cf owns
158
+ your Cloudflare login, and the Vigilbase CLI never reads, prints, stores or
159
+ uploads it. Its only Vigilbase requests are `GET /api/v1/tools/cloudflare-checkup/local-session`
160
+ and, after you confirm, `POST /api/v1/tools/cloudflare-checkup/local-session/snapshot`
161
+ with the exact snapshot file, authorised by the code the page minted for your
162
+ verified email (see [LOCAL.md](./LOCAL.md)). Webhooks, cron/admin repair endpoints, interactive OAuth handoffs,
128
163
  streaming/binary downloads, and endpoints that auto-provision on GET are outside
129
164
  this expansion. Remediation effects requiring durable approval/receipt workflows
130
165
  remain in their existing supported One/Vigil flows.
@@ -132,7 +167,9 @@ remain in their existing supported One/Vigil flows.
132
167
  ```bash
133
168
  pnpm --filter @vigilbase/cli check
134
169
  # Includes typecheck, unit tests, production build, login lifecycle smoke,
135
- # and every fixture-listed command over HTTP in both JSON and text modes.
170
+ # every fixture-listed command over HTTP in both JSON and text modes, and the
171
+ # local checkup smoke (fake cf on a restricted PATH, a fake npm for the managed
172
+ # cf install, loopback local-session routes).
136
173
 
137
174
  VIGILBASE_BASE_URL=https://vigilbase.com \
138
175
  VIGILBASE_SMOKE_ARTIFACTS="$PWD/.context/cli-live-smoke" \