requestshield 0.0.0-stage → 1.0.0-stg.276

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 (54) hide show
  1. package/README.md +292 -2
  2. package/config/.env.stg +8 -0
  3. package/package.json +25 -4
  4. package/skills/requestshield/SKILL.md +240 -0
  5. package/skills/requestshield/assets/AGENTS.codex.md +107 -0
  6. package/skills/requestshield/references/backend-java-core.md +152 -0
  7. package/skills/requestshield/references/backend-spring-boot.md +158 -0
  8. package/skills/requestshield/references/browser-manual.md +244 -0
  9. package/skills/requestshield/references/browser-seamless.md +213 -0
  10. package/skills/requestshield/references/cli.md +314 -0
  11. package/skills/requestshield/references/integration-planning.md +357 -0
  12. package/skills/requestshield/references/troubleshooting.md +131 -0
  13. package/src/agent-detector.mjs +102 -0
  14. package/src/api-client.mjs +155 -0
  15. package/src/args.mjs +147 -0
  16. package/src/browser-opener.mjs +32 -0
  17. package/src/cli.mjs +115 -0
  18. package/src/command-completion.mjs +10 -0
  19. package/src/command-registry.mjs +151 -0
  20. package/src/commands/agent-setup.mjs +195 -0
  21. package/src/commands/agent-status.mjs +65 -0
  22. package/src/commands/application-mutations.mjs +37 -0
  23. package/src/commands/application-response.mjs +55 -0
  24. package/src/commands/apps-get.mjs +28 -0
  25. package/src/commands/apps-list.mjs +93 -0
  26. package/src/commands/auth-status.mjs +42 -0
  27. package/src/commands/billing.mjs +106 -0
  28. package/src/commands/contract.mjs +59 -0
  29. package/src/commands/keys-create.mjs +22 -0
  30. package/src/commands/mutation-support.mjs +135 -0
  31. package/src/commands/output.mjs +26 -0
  32. package/src/commands/secret-commands.mjs +66 -0
  33. package/src/commands/secret-output.mjs +52 -0
  34. package/src/commands/service-status.mjs +34 -0
  35. package/src/commands/signin.mjs +95 -0
  36. package/src/commands/signout.mjs +14 -0
  37. package/src/commands/update-check.mjs +205 -0
  38. package/src/commands/usage.mjs +72 -0
  39. package/src/config.mjs +200 -0
  40. package/src/entrypoint.mjs +44 -0
  41. package/src/errors.mjs +16 -0
  42. package/src/integration-contract-client.mjs +85 -0
  43. package/src/integration-contract.mjs +114 -0
  44. package/src/main.mjs +6 -0
  45. package/src/oauth-client.mjs +153 -0
  46. package/src/oauth-loopback.mjs +120 -0
  47. package/src/package-profile.mjs +24 -0
  48. package/src/private-path.mjs +33 -0
  49. package/src/secret-output.mjs +121 -0
  50. package/src/service-status-client.mjs +87 -0
  51. package/src/session-files.mjs +192 -0
  52. package/src/session-store.mjs +204 -0
  53. package/src/terminal.mjs +143 -0
  54. package/src/usage-time.mjs +26 -0
@@ -0,0 +1,213 @@
1
+ # Frontend Seamless — Browser SDK
2
+
3
+ Frontend Seamless supports applications that use page-scope `fetch` or asynchronous
4
+ `XMLHttpRequest`, when the selected Browser SDK release supports it. The SDK matches configured
5
+ application endpoints and adds `X-IntelliFend-Token` automatically, so no call site
6
+ changes are needed.
7
+
8
+ It works with backend Seamless (Spring Boot 3 MVC starter) or backend Manual (Java core
9
+ SDK). Follow `integration-planning.md` for the default pairing recommendation; preserve
10
+ explicit valid preferences and existing supported integrations.
11
+
12
+ Prerequisites: a public App Key, the **exact** application API endpoints to protect, and
13
+ backend protection configured for the corresponding operations.
14
+
15
+ The Install flow may wire this integration before credentials are created. Use the
16
+ application's public configuration mechanism for the App Key when possible. Otherwise
17
+ leave the explicit `YOUR_APP_KEY` placeholder and report its exact location. Do not run
18
+ runtime checks until the user has supplied the real App Key; they belong to the
19
+ explicit Test flow, never Verify.
20
+ After static installation, recommend supplying the real App Key at the reported
21
+ binding or placeholder, configuring the backend variables in its reference, restarting
22
+ or redeploying, and testing the selected endpoint. Perform these steps only when
23
+ separately requested.
24
+
25
+ ## 1. Load the hosted SDK
26
+
27
+ Place the hosted SDK once in `<head>` before any application bundle that can issue a
28
+ protected request. Use the selected contract URL (`data.browser.scriptUrlVersion` or
29
+ `data.browser.scriptUrlLatest`) and only its matching integrity when provided.
30
+ Bind `data-app-key` or `init()`'s `appKey` through public application configuration when
31
+ it can be wired without a value; otherwise keep `YOUR_APP_KEY` and report its location.
32
+
33
+ ```html
34
+ <script
35
+ src="SDK_SCRIPT_URL_FROM_RELEASE_DOCS"
36
+ data-app-key="YOUR_APP_KEY"
37
+ data-protect='["/api/register"]'
38
+ defer
39
+ ></script>
40
+ ```
41
+
42
+ `defer` keeps order only relative to other `defer` and module scripts. If a bundle that
43
+ can issue a protected request is a classic script with no `defer`, or is `async`, add
44
+ `defer` to that bundle or remove `defer` from the SDK tag.
45
+
46
+ `data-protect` is a **JSON array** — note the single quotes around the attribute so the
47
+ inner double quotes survive. Each entry is either a root-relative pathname beginning
48
+ with `/`, or an absolute URL without embedded credentials. Malformed JSON is a configuration
49
+ error — validate the attribute before shipping rather than assuming a parse failure will
50
+ announce itself.
51
+
52
+ Applications with a custom script loader can configure the same behaviour after the
53
+ hosted script loads:
54
+
55
+ ```javascript
56
+ IntelliFend.init({
57
+ appKey: 'YOUR_APP_KEY',
58
+ protect: ['/api/register'],
59
+ });
60
+ ```
61
+
62
+ Use script attributes *or* explicit initialization for initial setup, not both.
63
+
64
+ Browser SDK 2.0.0 accepts `apiVersion: 'v1' | 'v2'` or
65
+ `data-api-version="v1" | "v2"` and defaults to v2. Existing Browser 1.0.0
66
+ integrations use v1 without this option. Preserve existing pins and API choices.
67
+ API selection is independent of Seamless/Manual mode and does not change the
68
+ 2.0.0 WebAssembly or CSP requirements. See `integration-planning.md` for
69
+ mixed-version limits.
70
+
71
+ ## 2. Match application endpoints
72
+
73
+ RequestShield compares the **exact origin** and the configured pathname. Ordinary paths
74
+ match exactly; named parameters match one non-empty path segment:
75
+
76
+ - Query strings and fragments are ignored on both sides.
77
+ - **Pathname case and trailing slash are significant.**
78
+ - Root-relative entries resolve against the page origin.
79
+ - Cross-origin entries use HTTPS, except for loopback development.
80
+ - The same endpoint rule applies to every HTTP method.
81
+ - A whole segment such as `:orderId` matches one non-empty segment, never across `/`.
82
+ Names use `[A-Za-z_][A-Za-z0-9_]*`. Multiple parameters are supported.
83
+
84
+ So `/api/register` matches `/api/register?source=campaign`, but it does **not** match
85
+ `/api/Register` or `/api/register/`.
86
+
87
+ The practical consequence: **list the URL the application passes to `fetch` or
88
+ asynchronous `XMLHttpRequest`.** With a normal development proxy, the application
89
+ requests `/api/register` on the frontend origin. The proxy then rewrites and forwards
90
+ that request to an upstream route such as `https://api.example.com/register`. The
91
+ rewrite happens outside the browser and does not change the URL matched by Seamless.
92
+ Configure `/api/register`, and ensure the proxy forwards `X-IntelliFend-Token`
93
+ unchanged.
94
+
95
+ If the application directly requests `https://api.example.com/register`, configure
96
+ that absolute URL instead and configure CORS to allow the page origin, request method,
97
+ and `X-IntelliFend-Token`.
98
+
99
+ A redirect is different from a proxy rewrite. With an HTTP redirect, the server returns
100
+ a `3xx` response and the browser follows its `Location`. Seamless matches the original
101
+ URL passed by application code; it does not separately match the browser's internal
102
+ redirect request. Do not configure only the redirect destination when the application
103
+ initially requests `/api/register`. Avoid redirects for protected mutation endpoints
104
+ when possible, or verify the method, header, and CORS behavior end to end.
105
+
106
+ For an ID or slug, configure the path once:
107
+
108
+ ```javascript
109
+ IntelliFend.init({
110
+ appKey: 'YOUR_APP_KEY',
111
+ protect: ['/api/orders/:orderId/items'],
112
+ });
113
+ ```
114
+
115
+ The script-tag equivalent is
116
+ `data-protect='["/api/orders/:orderId/items"]'`.
117
+ This rule matches `/api/orders/42/items?include=details`
118
+ and `/api/orders/abc-123/items`. It does not match an empty ID,
119
+ an extra path segment, a trailing slash, different pathname case, or another origin.
120
+ Absolute rules such as `https://api.example.com/api/orders/:orderId/items` use the
121
+ same path syntax and match only that origin.
122
+
123
+ Use `::name` to match a literal `:name` segment. When updating an existing rule
124
+ that contains a literal leading colon, add one colon to preserve its meaning:
125
+ `/orders/:fixed` becomes `/orders/::fixed`. Percent-encoded spelling stays distinct:
126
+ `%3Aname` matches that encoded segment, not `:name`. Browser URL normalization
127
+ applies, including dot segments, but the matcher does not decode the pathname;
128
+ `a%2Fb` is one serialized segment and `a/b` is two. Malformed parameters cause
129
+ `invalid_config`. Wildcards, arbitrary regex, catch-all parameters and method
130
+ filtering are not supported.
131
+
132
+ ## 3. Send requests normally
133
+
134
+ Application code does not call `getToken()` or construct the header for a
135
+ frontend Seamless endpoint:
136
+
137
+ ```javascript
138
+ const response = await fetch('/api/register', {
139
+ method: 'POST',
140
+ headers: {'Content-Type': 'application/json'},
141
+ body: JSON.stringify({email, password}),
142
+ });
143
+ ```
144
+
145
+ Browser configuration controls token attachment only. Configure the corresponding
146
+ backend operation independently — `data-protect` creates no backend protection.
147
+
148
+ ## What Seamless covers
149
+
150
+ Supported: `fetch` (string, `URL`, and `Request` inputs) and asynchronous
151
+ `XMLHttpRequest`.
152
+
153
+ Do not combine frontend Seamless and a frontend Manual call site on the same endpoint.
154
+ One protected operation uses one frontend mode; either may pair with either supported
155
+ backend mode. See the prerequisites in `browser-manual.md`.
156
+
157
+ ## What Seamless does not cover
158
+
159
+ Any of these means the request leaves without a token, with no error — which is why
160
+ they are worth checking *before* choosing the mode:
161
+
162
+ - Synchronous XHR.
163
+ - Native form navigation (a plain `<form>` submit).
164
+ - `navigator.sendBeacon`.
165
+ - WebSocket and EventSource.
166
+ - Service-worker-owned requests. Web workers and server-side rendering have their own
167
+ global scope too — in Next.js, Nuxt, Remix and similar, confirm the protected call
168
+ runs in the browser.
169
+ - A `fetch` using `no-cors`, which cannot carry a custom header at all.
170
+
171
+ For an operation on this list, use Manual mode **only if** the application can carry the
172
+ token in a supported header or request-body field. Otherwise the right answer is an
173
+ application-specific integration agreed with IntelliFend — say that plainly rather than
174
+ improvising a carrier.
175
+
176
+ ## Cross-origin APIs
177
+
178
+ When the protected endpoint is on another origin, its CORS response must allow the page
179
+ origin, the intended methods, and the `X-IntelliFend-Token` header. Missing that header
180
+ in `Access-Control-Allow-Headers` means the browser strips it and every request reads as
181
+ missing a token.
182
+
183
+ ## Verifying Seamless
184
+
185
+ Static checks:
186
+
187
+ 1. Exactly one SDK initialization — one script tag with its attributes, **or** one
188
+ `IntelliFend.init()` call — loaded before application bundles, with valid JSON in
189
+ `data-protect` (or a valid `protect` array).
190
+ 2. Every listed entry matches a URL the browser actually requests — origin, case, and
191
+ trailing slash included.
192
+ 3. Every protected endpoint reaches the network via `fetch` or async XHR from page
193
+ scope.
194
+
195
+ Runtime check (Test flow only, not Verify): during the control request of the
196
+ negative test in `SKILL.md`, confirm the request carries a non-empty
197
+ `X-IntelliFend-Token` without recording the token value. Inspect safe backend decision
198
+ metrics separately; the negative test provides enforcement evidence. `requestshield usage <app-key>` can show approximate
199
+ recent request counts, but does not prove backend enforcement.
200
+ A missing header can indicate a path mismatch or an uncovered transport; compare
201
+ the actual request URL and transport before changing backend code.
202
+
203
+ ## Expected result
204
+
205
+ Matching requests carry one non-empty `X-IntelliFend-Token` header; requests outside the
206
+ configured list are unchanged.
207
+
208
+ ## CSP and token handling
209
+
210
+ Identical to Manual mode — see the CSP and token-handling sections of
211
+ `browser-manual.md`. The contract's `cspAdditions` entries, including `workerSrc` and
212
+ `scriptSrc`, matter just as much here: without them, every intercepted request attaches an empty token and the backend blocks
213
+ traffic that looks correctly integrated.
@@ -0,0 +1,314 @@
1
+ # `requestshield` CLI reference
2
+
3
+ Check `requestshield --version` and `requestshield --help` against this guide.
4
+ An older published version may not contain these commands. Use the CLI for its
5
+ supported application and credential operations; do not invent endpoints for
6
+ unavailable commands. Command/group help comes from the same registry as parsing.
7
+ Legacy aliases are removed; use singular app/secret groups and positional names.
8
+ All result commands support --json, with one document on stdout and diagnostics
9
+ on stderr. Human output is the default; help/version remain text. JSON does not
10
+ skip confirmation: supply --yes only when the action is authorized. Credential-producing
11
+ commands without `--output` display the API Secret, including in JSON, so that output
12
+ must never enter the agent terminal or tool transcript. The skill uses `--output` for
13
+ create and a private user-visible terminal for rotate/reveal.
14
+
15
+ Every option question, approval, or confirmation in this reference follows
16
+ [Interactive questions](../SKILL.md#interactive-questions): use selectable options
17
+ and resume automatically after the submitted answer. Do not request typed selections.
18
+
19
+ ## Public integration contract
20
+
21
+ ```console
22
+ requestshield contract
23
+ requestshield contract --json
24
+ ```
25
+
26
+ This public read fetches the integration contract without
27
+ login, local session access or file writes. It returns the versioned and latest
28
+ browser URLs; the CLI does not accept a version flag.
29
+ JSON returns `{data: ...}` with `schemaVersion: 2`, `contractVersion`,
30
+ `services.challengeUrl`, `browser`, `backend` and `documentation`.
31
+ Use `data.browser.scriptUrlVersion` or `data.browser.scriptUrlLatest` as selected by the
32
+ integration flow. Use the matching `data.browser.integrity` only with the immutable
33
+ versioned URL. Prefer versioned when controlled upgrades or SRI are needed; latest
34
+ updates automatically and may serve a different version. `data.browser.sdkVersion`
35
+ and `data.browser.availableModes` describe the pinned release only. Before using
36
+ versioned, check its SDK version and modes against release-specific documentation;
37
+ a Browser SDK 2.x guide may not apply to a pinned 1.x release. For latest, establish
38
+ capabilities from current public documentation and release notes, never from pinned
39
+ metadata. Use `tokenHeader` and merge shared `browser.cspAdditions` into the
40
+ application's existing CSP.
41
+ Use `backend.sdkVersion`, `minJdk`, `mavenRepository`, `core` and `springBoot3`
42
+ coordinates for the selected backend integration. Backend Seamless uses `springBoot3`
43
+ (Spring Boot 3 MVC starter); backend Manual uses `core` (explicit Java core SDK
44
+ verification). These are integration labels, not new JSON fields or configuration
45
+ values. `browser.availableModes` describes frontend capabilities only; the starter's
46
+ `BLOCK`/`MONITOR` enforcement setting is separate from integration modes.
47
+ Configure the same returned challenge
48
+ URL in both SDKs. Metadata describes a selected release, not service health or
49
+ application protection.
50
+
51
+ `CONTRACT_NOT_PUBLISHED` means the docs host returned 404; `CONTRACT_FETCH_FAILED`
52
+ means network/HTTP failure; `CONTRACT_INVALID` means the response failed validation.
53
+ These exit 1. Schema 1 and the old `scriptUrl` field are unsupported; update the
54
+ CLI and retry, then contact support if the error continues. Do not invent a manifest or silently substitute another environment
55
+ or SDK version. An older CLI may not implement this command: use verified release
56
+ documentation for a manual integration and report the missing command or manifest.
57
+
58
+ ## Authentication and local commands
59
+
60
+ ```console
61
+ requestshield login [--no-open]
62
+ requestshield auth status [--json]
63
+ requestshield logout
64
+ requestshield --help
65
+ requestshield --version
66
+ ```
67
+
68
+ Sign-in uses the user's browser on the same computer. Let the user complete it;
69
+ never ask for their password, tokens or callback URL. `auth status --json` reads
70
+ local metadata only and does not check online access or renew credentials.
71
+ It returns `state`, `localOnly: true`
72
+ and applicable `expiresAt`/`scopes`, never tokens or a customer/account identity.
73
+ States are `signed_out`, `valid`, `expired`, `refresh_uncertain`, `config_mismatch`,
74
+ `invalid` and `configuration_error`. Local validity does not confirm online access.
75
+ Before login or logout, explain the exact
76
+ local-session action and obtain a fresh confirmation under **Interactive questions**; a
77
+ direct request does not replace that confirmation. Sign-out removes the saved CLI
78
+ session; the browser stays signed in.
79
+
80
+ ## Applications
81
+
82
+ ```console
83
+ requestshield app list [--json] [--limit <1-100>] [--cursor <cursor> | --all]
84
+ requestshield app get <app-key>
85
+ requestshield app rename <app-key> <name> [--idempotency-key <key>]
86
+ requestshield app enable <app-key> [--idempotency-key <key>]
87
+ requestshield app disable <app-key> [--idempotency-key <key>] [--yes]
88
+ ```
89
+
90
+ These commands use an authenticated CLI session. Existing-app commands use exact App Keys; names
91
+ are not unique. List defaults to one page. `--all` follows at most 100 pages and
92
+ fails for repeated cursors or unfinished traversal at that bound. It cannot be
93
+ combined with `--cursor`. For name discovery, inspect all necessary pages and
94
+ resolve ambiguity with the user before choosing an App Key.
95
+
96
+ Run list and get automatically. Create, enable, and disable require the skill's fresh
97
+ confirmation under **Interactive questions** because they create or change credential
98
+ validity. A direct request for an exact App Key and new name authorizes rename without
99
+ another confirmation.
100
+
101
+ JSON list output is `{data:Application[],nextCursor}`. Detail and rename with
102
+ `--json` return `{data:Application}`. Application has exactly `appKey`, `name`, `status`,
103
+ `createdAt`, `updatedAt`. Status is `pending`, `enabled`, `disabled`, `revoked`
104
+ or `attention_required`; it describes configuration, not traffic or enforcement.
105
+ Pending, attention and disabled states do not expose the exact credential state.
106
+ Disable retains the secret; enable requires an active one.
107
+
108
+ ## Key and secret management
109
+
110
+ For create, first complete the [sign-in steps](integration-planning.md#sign-in), then
111
+ check installed `app create --help` for `--output` support. Choose a new
112
+ absolute file path in a private directory outside the repository, explain the name and
113
+ path, and obtain confirmation under **Interactive questions**. Run create with
114
+ `--output <absolute-private-file> --json` in the agent terminal. The CLI saves both
115
+ credentials as ENV entries with owner-only permissions and refuses existing files.
116
+ Confirm only the returned `appKey`, `outputPath`, and `secretStored: true`; never read
117
+ the file. Tell the user its path and that their backend must be configured to load it.
118
+ Do not ask whether they saved the secret or open another terminal. If the installed CLI
119
+ lacks `--output`, stop and report that a compatible CLI is required.
120
+
121
+ Rotate and reveal use the private-terminal workflow. Before running one, explain the
122
+ exact action and target, warn the user that the API Secret is shown only once by that
123
+ command and must be stored immediately, and obtain confirmation under **Interactive
124
+ questions**.
125
+
126
+ After approval, run the command only in a private user-visible terminal whose stdout
127
+ and stderr are unavailable to the agent. A second agent-controlled shell or PTY does
128
+ not qualify. If the host cannot provide a private terminal, give the user the exact
129
+ command to run in their own terminal. Never capture, redirect, read, copy, or request
130
+ the output. Afterwards ask only whether the command succeeded and the secret was
131
+ stored securely.
132
+
133
+ ```console
134
+ requestshield app create <name> --idempotency-key <key> --output <absolute-private-file> --json
135
+ requestshield secret rotate <app-key> [--idempotency-key <key>] --yes
136
+ requestshield secret reveal <app-key> --yes
137
+ requestshield secret revoke <app-key> [--idempotency-key <key>] [--yes]
138
+ ```
139
+
140
+ Create makes a new application and initial secret. Rotate preserves the App Key
141
+ and replaces the secret. Reveal retrieves the current active secret; use it to
142
+ recover a lost issuance response. Exposure requires rotation, not reveal.
143
+ Revoke invalidates the current secret. Saving an ENV file does not configure the
144
+ application. For rotate/reveal, the user must save the displayed values securely.
145
+ If create cannot save a file, or the user did not store a displayed secret, explain the
146
+ supported recovery choice. Never create, reveal, or rotate automatically.
147
+
148
+ Create and enable have no CLI prompt. Disable, rotate, revoke and reveal require CLI
149
+ confirmation; `--yes` skips it. The skill's fresh **Interactive questions** approval is
150
+ required before create, enable, disable, rotate, reveal, or revoke; a direct request or
151
+ missing CLI prompt is not authorization. Rename is not a credential-validity action and
152
+ follows the direct-request rule above.
153
+
154
+ All mutations except reveal accept an idempotency key. A fresh key is generated
155
+ per invocation when omitted and printed to stderr before dispatch so interrupted
156
+ commands can reuse it. There is no automatic mutation retry. On uncertainty,
157
+ repeat the identical request and key printed in the error within seven days. For
158
+ create and rotate, the agent generates the key and includes it in the command so it
159
+ can repeat the same request key. A create retry must never overwrite an existing
160
+ output file; choose a new private path if needed. A replay with no secret does not
161
+ confirm a saved file; report the CLI's recovery guidance without automatically revealing.
162
+ A new key is a new operation. After seven days inspect state before acting.
163
+ Create/rotate replay can have `apiSecret: null`; the CLI directs explicit reveal
164
+ without running it. Changes may take a moment. Check application status and test your integration.
165
+
166
+ ## Agent setup and updates
167
+
168
+ ```console
169
+ requestshield agent setup [--codex | --claude] [--force]
170
+ requestshield agent status [--codex | --claude]
171
+ requestshield update check
172
+ requestshield update apply [--yes]
173
+ ```
174
+
175
+ Agent setup copies the skill to `~/.agents/skills/requestshield` for Codex or
176
+ `~/.claude/skills/requestshield` for Claude. With neither flag, it detects the
177
+ agent or asks if both are available. `--force` replaces an existing installation.
178
+ It does not edit repository `AGENTS.md` or customer application code. A direct request
179
+ to set up the exact target agent authorizes this command without another confirmation.
180
+
181
+ Agent status inspects both agents by default and returns `installed`, `missing`
182
+ or `invalid` file state. It does not establish that an agent has loaded the Skill.
183
+
184
+ Update check runs automatically without prompting or installing. When the user
185
+ directly requests a CLI update, run `update apply --yes` without asking for another
186
+ confirmation. A request to check for an update does not authorize installation. A
187
+ global update does not change a pinned invocation. If automatic updates are unavailable
188
+ for the installation, JSON returns `outcome: "unavailable"` without installing.
189
+
190
+ ## Complete command catalog
191
+
192
+ All result commands support --json. See command help for additional flags.
193
+
194
+ | Command after `requestshield` | Purpose |
195
+ | --- | --- |
196
+ | `--help`, `-h` | Show help. |
197
+ | `--version`, `-v` | Show the CLI version. |
198
+ | `login [--no-open]` | Sign in through your browser. |
199
+ | `logout` | Remove your saved local session. |
200
+ | `auth status` | Inspect local session status. |
201
+ | `app create <name>` | Create an application and its initial secret. |
202
+ | `app list` | List applications. |
203
+ | `app get <app-key>` | Inspect an application. |
204
+ | `app rename <app-key> <name>` | Rename an application. |
205
+ | `app enable <app-key>` | Enable an application. |
206
+ | `app disable <app-key>` | Disable an application while keeping its secret. |
207
+ | `secret rotate <app-key>` | Replace the current secret. |
208
+ | `secret reveal <app-key>` | Retrieve the current active secret. |
209
+ | `secret revoke <app-key>` | Revoke the current secret. |
210
+ | `agent setup [--codex \| --claude] [--force]` | Install integration guidance. |
211
+ | `agent status [--codex \| --claude]` | Inspect installed Skill files. |
212
+ | `update check` | Check for a newer CLI version. |
213
+ | `update apply [--yes]` | Install the available version globally. |
214
+ | `contract` | Read the SDK integration contract. |
215
+ | `service status` | Check service availability. |
216
+ | `usage <app-key>` | Read approximate recent request counts. |
217
+ | `billing get <app-key>` | Read account usage, quota and estimated cost. |
218
+
219
+ Never infer secret state from application status or call reveal as a status probe.
220
+ Doctor and app watch are not commands.
221
+
222
+ Use published SDK documentation for the selected release and safe browser/backend
223
+ observations for integration checks. App status is not traffic or enforcement.
224
+
225
+ ## Account billing
226
+
227
+ ```console
228
+ requestshield billing get your-app-key
229
+ requestshield billing get your-app-key --json
230
+ ```
231
+
232
+ Use the existing saved sign-in session and an exact App Key owned by the user.
233
+ The App Key selects an account-wide report across its applications; do not
234
+ allocate the account charge or included allowance to the requested app. The
235
+ command is read-only and uses the existing application-read permission.
236
+
237
+ Billing counts authenticated API v2 token verification requests, including
238
+ rejected requests and retries. API v1 activity, unauthenticated requests and
239
+ service errors are excluded.
240
+
241
+ JSON returns `{data: ...}` with `appKey`, `scope: "account"`, subscription
242
+ `status`, nullable `plan` (`free` for Express or `pro`), nullable
243
+ `billingPeriod: {start,end}`, nullable `includedAllowance`, `usage`,
244
+ `remainingQuota` and `overage`, `unit: "token_verification_requests"`,
245
+ `approximate: true`, `reportedAt`, nullable `usageThrough`, and nullable
246
+ `estimatedCost: {currency,baseAmountMinor,overageAmountMinor,totalAmountMinor}`.
247
+ Dates are UTC; USD amounts use integer cents.
248
+
249
+ Use the returned billing values, never a calculation from `usage` monitoring,
250
+ app status or remembered prices. Preserve null as unavailable, not zero, free
251
+ or unlimited. Failed reads return an error, never usable zero totals. Without
252
+ a current subscription, plan, period, quantities and cost can be unavailable.
253
+
254
+ Always label usage approximate and cost as a pre-tax estimate covering the
255
+ period's base charge plus recorded overage. It is not a final invoice or forecast.
256
+ `reportedAt` is report time and `usageThrough` is the usage query cutoff; neither
257
+ guarantees complete ingestion. Data can be delayed or incomplete. Do not modify
258
+ the subscription or start a checkout as part of this read. If the installed CLI
259
+ does not support billing, report that limitation and use the customer's established
260
+ billing/support channel rather than inventing an endpoint.
261
+
262
+ ## Service liveness
263
+
264
+ ```console
265
+ requestshield service status [--json]
266
+ ```
267
+
268
+ Checks Management API and Challenge Service directly without login, an App Key,
269
+ session access or file writes. `service` alone shows group help.
270
+
271
+ Each check has a five-second deadline and validates the service identity in the
272
+ response. Both results are retained when either check fails. JSON is one
273
+ `{data:{checkedAt,checks}}` document. Each check contains `service`, `url`,
274
+ `status` (`ok` or `failed`), `latencyMs`, nullable `httpStatus`, and nullable
275
+ `reason` (`timeout`, `network_error`, `http_error`, or `invalid_response`). Exit 0
276
+ means both passed; exit 1 means at least one failed and still includes the report.
277
+ `SERVICE_CONFIG_INVALID` exits 2 before network access.
278
+
279
+ Report this as HTTP liveness at the caller's location and time. It does not test
280
+ authentication or customer enforcement, and it is not a
281
+ global outage or maintenance report. A failed check can reflect connectivity or
282
+ temporary service unavailability. Never substitute it for an integration negative test.
283
+
284
+ ## Recent usage
285
+
286
+ ```console
287
+ requestshield usage <app-key> [--from <UTC-time> --to <UTC-time>] [--json]
288
+ ```
289
+
290
+ Before retrieving usage / request volume, complete the
291
+ [sign-in steps](integration-planning.md#sign-in).
292
+ Uses the saved authenticated session and existing application-read permission.
293
+ Requires an exact owned App Key, including disabled or revoked apps. Default:
294
+ last 24 hours. Both optional UTC bounds must end in Z (seconds, optionally one to
295
+ three fractional digits), with from before to, and fall within the last seven days
296
+ according to the server's clock. No future end, buckets, 30-day history or account-wide
297
+ view. `usage challenges` and `--granularity` are not supported.
298
+
299
+ The single JSON document is `{data: {appKey, from, to, approximate: true, operations}}`.
300
+ Operations has three fixed keys: `challenge_create`, `challenge_verify` and
301
+ `token_consume`. Each contains nonnegative `requests`, `success`, `rejected` and
302
+ `error` counts; requests is the sum of the outcomes. Success means a challenge was
303
+ created, verification issued a token, or a token was consumed for the first time.
304
+ Replay is rejected. Retries count separately; verifies are not unique challenges.
305
+ Requests without an identified app are excluded.
306
+
307
+ These are approximate monitoring counts. Data may be delayed or incomplete. Zero means no recorded events,
308
+ not proof of no traffic. Query failures return errors, never zeros. Do not infer
309
+ billing, service health or backend enforcement from usage. Report unavailable-query
310
+ errors without fabricating counts.
311
+
312
+ Usage reports cover API v2 requests only. API v1 activity is not included.
313
+ If the browser and backend use different API versions, the report may show
314
+ only part of the application's activity; zero counts do not prove no traffic.