requestshield 0.1.4 → 0.1.6

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 (37) hide show
  1. package/README.md +421 -85
  2. package/config/.env.prod +7 -0
  3. package/package.json +21 -12
  4. package/skills/requestshield/SKILL.md +299 -307
  5. package/skills/requestshield/assets/AGENTS.codex.md +62 -62
  6. package/skills/requestshield/references/backend-java-core.md +128 -128
  7. package/skills/requestshield/references/backend-spring-boot.md +145 -145
  8. package/skills/requestshield/references/browser-manual.md +210 -210
  9. package/skills/requestshield/references/browser-seamless.md +156 -164
  10. package/skills/requestshield/references/cli.md +107 -182
  11. package/skills/requestshield/references/integration-planning.md +362 -389
  12. package/skills/requestshield/references/troubleshooting.md +114 -118
  13. package/src/agent-detector.mjs +102 -74
  14. package/src/api-client.mjs +115 -79
  15. package/src/args.mjs +140 -80
  16. package/src/browser-opener.mjs +32 -0
  17. package/src/cli.mjs +277 -51
  18. package/src/commands/agent-setup.mjs +182 -185
  19. package/src/commands/application-mutations.mjs +33 -0
  20. package/src/commands/application-response.mjs +55 -0
  21. package/src/commands/apps-get.mjs +20 -0
  22. package/src/commands/apps-list.mjs +94 -0
  23. package/src/commands/auth-status.mjs +37 -0
  24. package/src/commands/keys-create.mjs +7 -38
  25. package/src/commands/mutation-support.mjs +110 -0
  26. package/src/commands/secret-commands.mjs +45 -0
  27. package/src/commands/signin.mjs +70 -57
  28. package/src/commands/signout.mjs +9 -0
  29. package/src/commands/update-check.mjs +12 -4
  30. package/src/config.mjs +150 -0
  31. package/src/entrypoint.mjs +24 -0
  32. package/src/errors.mjs +3 -1
  33. package/src/main.mjs +5 -24
  34. package/src/oauth-client.mjs +153 -0
  35. package/src/oauth-loopback.mjs +120 -0
  36. package/src/session-files.mjs +213 -0
  37. package/src/session-store.mjs +177 -64
@@ -1,164 +1,156 @@
1
- # Browser SDK — Seamless mode
2
-
3
- Seamless mode is the recommended browser integration for applications that use `fetch`
4
- or asynchronous `XMLHttpRequest`. Browser SDK 1.1 matches configured application
5
- endpoints and adds `X-IntelliFend-Token` automatically, so no call site changes.
6
-
7
- Prerequisites: a public App Key, the **exact** application API endpoints to protect, and
8
- backend protection configured for the corresponding operations.
9
-
10
- ## 1. Load the hosted SDK
11
-
12
- Place the script before any application bundle that can issue a protected request —
13
- otherwise an early request leaves the page before interception is installed:
14
-
15
- ```html
16
- <script
17
- src="SCRIPT_URL_FROM_CONTRACT"
18
- data-app-key="YOUR_APP_KEY"
19
- data-protect='["/api/register"]'
20
- defer
21
- ></script>
22
- ```
23
-
24
- `data-protect` is a **JSON array** — note the single quotes around the attribute so the
25
- inner double quotes survive. Each entry is either a root-relative pathname beginning
26
- with `/`, or an absolute URL without embedded credentials. Malformed JSON is a configuration
27
- error — validate the attribute before shipping rather than assuming a parse failure will
28
- announce itself.
29
-
30
- Applications with a custom script loader can configure the same behaviour after the
31
- hosted script loads:
32
-
33
- ```javascript
34
- IntelliFend.init({
35
- appKey: 'YOUR_APP_KEY',
36
- protect: ['/api/register'],
37
- });
38
- ```
39
-
40
- Use script attributes *or* explicit initialization for initial setup, not both.
41
-
42
- ## 2. Match application endpoints exactly
43
-
44
- RequestShield compares the **exact origin and exact pathname**. This is where a Seamless
45
- install either works or quietly does nothing, so resolve it before writing the attribute:
46
-
47
- - Query strings and fragments are ignored on both sides.
48
- - **Pathname case and trailing slash are significant.**
49
- - Root-relative entries resolve against the page origin.
50
- - Cross-origin entries use HTTPS, except for loopback development.
51
- - The same endpoint rule applies to every HTTP method.
52
-
53
- So `/api/register` matches `/api/register?source=campaign`, but it does **not** match
54
- `/api/Register` or `/api/register/`.
55
-
56
- The practical consequence: **list the URL the application passes to `fetch` or
57
- asynchronous `XMLHttpRequest`.** With a normal development proxy, the application
58
- requests `/api/register` on the frontend origin. The proxy then rewrites and forwards
59
- that request to an upstream route such as `https://api.example.com/register`. The
60
- rewrite happens outside the browser and does not change the URL matched by Seamless.
61
- Configure `/api/register`, and ensure the proxy forwards `X-IntelliFend-Token`
62
- unchanged.
63
-
64
- If the application directly requests `https://api.example.com/register`, configure
65
- that absolute URL instead and configure CORS to allow the page origin, request method,
66
- and `X-IntelliFend-Token`.
67
-
68
- A redirect is different from a proxy rewrite. With an HTTP redirect, the server returns
69
- a `3xx` response and the browser follows its `Location`. Seamless matches the original
70
- URL passed by application code; it does not separately match the browser's internal
71
- redirect request. Do not configure only the redirect destination when the application
72
- initially requests `/api/register`. Avoid redirects for protected mutation endpoints
73
- when possible, or verify the method, header, and CORS behavior end to end.
74
-
75
- A path built with an ID or slug (`/api/orders/42`) has no wildcard support — list every
76
- concrete path, or use Manual mode for that operation.
77
-
78
- ## 3. Send requests normally
79
-
80
- Application code does not call `getToken()` or construct the header for a
81
- Seamless-mode endpoint:
82
-
83
- ```javascript
84
- const response = await fetch('/api/register', {
85
- method: 'POST',
86
- headers: {'Content-Type': 'application/json'},
87
- body: JSON.stringify({email, password}),
88
- });
89
- ```
90
-
91
- Browser configuration controls token attachment only. Configure the corresponding
92
- backend operation independently — `data-protect` creates no backend protection.
93
-
94
- ## What Seamless covers
95
-
96
- Supported: `fetch` (string, `URL`, and `Request` inputs) and asynchronous
97
- `XMLHttpRequest`.
98
-
99
- Do not rely on Seamless and a Manual call site coexisting on the same endpoint. One
100
- protected operation uses one mode — see the prerequisites in `browser-manual.md`.
101
-
102
- ## What Seamless does not cover
103
-
104
- Any of these means the request leaves without a token, with no error — which is why
105
- they are worth checking *before* choosing the mode:
106
-
107
- - Synchronous XHR.
108
- - Native form navigation (a plain `<form>` submit).
109
- - `navigator.sendBeacon`.
110
- - WebSocket and EventSource.
111
- - Service-worker-owned requests. Web workers and server-side rendering have their own
112
- global scope too — in Next.js, Nuxt, Remix and similar, confirm the protected call
113
- runs in the browser.
114
- - A `fetch` using `no-cors`, which cannot carry a custom header at all.
115
-
116
- For an operation on this list, use Manual mode **only if** the application can carry the
117
- token in a supported header or request-body field. Otherwise the right answer is an
118
- application-specific integration agreed with IntelliFend — say that plainly rather than
119
- improvising a carrier.
120
-
121
- ## Cross-origin APIs
122
-
123
- When the protected endpoint is on another origin, its CORS response must allow the page
124
- origin, the intended methods, and the `X-IntelliFend-Token` header. Missing that header
125
- in `Access-Control-Allow-Headers` means the browser strips it and every request reads as
126
- missing a token.
127
-
128
- ## Verifying Seamless
129
-
130
- Static checks:
131
-
132
- 1. Exactly one script tag, loaded before application bundles, with valid JSON in
133
- `data-protect`.
134
- 2. Every listed entry matches a URL the browser actually requests — origin, case, and
135
- trailing slash included.
136
- 3. Every protected endpoint reaches the network via `fetch` or async XHR from page
137
- scope.
138
-
139
- Runtime check: exercise the endpoint, confirm the network request carries a non-empty
140
- `X-IntelliFend-Token`, then confirm the platform saw it. This proves the browser half is
141
- firing; the negative test in `SKILL.md` proves backend enforcement.
142
-
143
- ```bash
144
- requestshield challenge volume <app-key> \
145
- --from <start> \
146
- --to <end> \
147
- --granularity hour
148
- ```
149
-
150
- Zero volume with a correct-looking `data-protect` is nearly always a path mismatch
151
- (trailing slash, case, a different origin than assumed) or one of the uncovered
152
- transports above. Re-read the actual request URL before changing anything else.
153
-
154
- ## Expected result
155
-
156
- Matching requests carry one non-empty `X-IntelliFend-Token` header; requests outside the
157
- configured list are unchanged.
158
-
159
- ## CSP and token handling
160
-
161
- Identical to Manual mode — see the CSP and token-handling sections of
162
- `browser-manual.md`. The `worker-src 'self' blob:` directive matters just as much here:
163
- without it, every intercepted request attaches an empty token and the backend blocks
164
- traffic that looks correctly integrated.
1
+ # Browser SDK — Seamless mode
2
+
3
+ Seamless mode is the recommended browser integration for applications that use `fetch`
4
+ or asynchronous `XMLHttpRequest`. Browser SDK 1.1 matches configured application
5
+ endpoints and adds `X-IntelliFend-Token` automatically, so no call site changes.
6
+
7
+ Prerequisites: a public App Key, the **exact** application API endpoints to protect, and
8
+ backend protection configured for the corresponding operations.
9
+
10
+ ## 1. Load the hosted SDK
11
+
12
+ Place the script before any application bundle that can issue a protected request —
13
+ otherwise an early request leaves the page before interception is installed:
14
+
15
+ ```html
16
+ <script
17
+ src="SDK_SCRIPT_URL_FROM_RELEASE_DOCS"
18
+ data-app-key="YOUR_APP_KEY"
19
+ data-protect='["/api/register"]'
20
+ defer
21
+ ></script>
22
+ ```
23
+
24
+ `data-protect` is a **JSON array** — note the single quotes around the attribute so the
25
+ inner double quotes survive. Each entry is either a root-relative pathname beginning
26
+ with `/`, or an absolute URL without embedded credentials. Malformed JSON is a configuration
27
+ error — validate the attribute before shipping rather than assuming a parse failure will
28
+ announce itself.
29
+
30
+ Applications with a custom script loader can configure the same behaviour after the
31
+ hosted script loads:
32
+
33
+ ```javascript
34
+ IntelliFend.init({
35
+ appKey: 'YOUR_APP_KEY',
36
+ protect: ['/api/register'],
37
+ });
38
+ ```
39
+
40
+ Use script attributes *or* explicit initialization for initial setup, not both.
41
+
42
+ ## 2. Match application endpoints exactly
43
+
44
+ RequestShield compares the **exact origin and exact pathname**. This is where a Seamless
45
+ install either works or quietly does nothing, so resolve it before writing the attribute:
46
+
47
+ - Query strings and fragments are ignored on both sides.
48
+ - **Pathname case and trailing slash are significant.**
49
+ - Root-relative entries resolve against the page origin.
50
+ - Cross-origin entries use HTTPS, except for loopback development.
51
+ - The same endpoint rule applies to every HTTP method.
52
+
53
+ So `/api/register` matches `/api/register?source=campaign`, but it does **not** match
54
+ `/api/Register` or `/api/register/`.
55
+
56
+ The practical consequence: **list the URL the application passes to `fetch` or
57
+ asynchronous `XMLHttpRequest`.** With a normal development proxy, the application
58
+ requests `/api/register` on the frontend origin. The proxy then rewrites and forwards
59
+ that request to an upstream route such as `https://api.example.com/register`. The
60
+ rewrite happens outside the browser and does not change the URL matched by Seamless.
61
+ Configure `/api/register`, and ensure the proxy forwards `X-IntelliFend-Token`
62
+ unchanged.
63
+
64
+ If the application directly requests `https://api.example.com/register`, configure
65
+ that absolute URL instead and configure CORS to allow the page origin, request method,
66
+ and `X-IntelliFend-Token`.
67
+
68
+ A redirect is different from a proxy rewrite. With an HTTP redirect, the server returns
69
+ a `3xx` response and the browser follows its `Location`. Seamless matches the original
70
+ URL passed by application code; it does not separately match the browser's internal
71
+ redirect request. Do not configure only the redirect destination when the application
72
+ initially requests `/api/register`. Avoid redirects for protected mutation endpoints
73
+ when possible, or verify the method, header, and CORS behavior end to end.
74
+
75
+ A path built with an ID or slug (`/api/orders/42`) has no wildcard support — list every
76
+ concrete path, or use Manual mode for that operation.
77
+
78
+ ## 3. Send requests normally
79
+
80
+ Application code does not call `getToken()` or construct the header for a
81
+ Seamless-mode endpoint:
82
+
83
+ ```javascript
84
+ const response = await fetch('/api/register', {
85
+ method: 'POST',
86
+ headers: {'Content-Type': 'application/json'},
87
+ body: JSON.stringify({email, password}),
88
+ });
89
+ ```
90
+
91
+ Browser configuration controls token attachment only. Configure the corresponding
92
+ backend operation independently — `data-protect` creates no backend protection.
93
+
94
+ ## What Seamless covers
95
+
96
+ Supported: `fetch` (string, `URL`, and `Request` inputs) and asynchronous
97
+ `XMLHttpRequest`.
98
+
99
+ Do not rely on Seamless and a Manual call site coexisting on the same endpoint. One
100
+ protected operation uses one mode — see the prerequisites in `browser-manual.md`.
101
+
102
+ ## What Seamless does not cover
103
+
104
+ Any of these means the request leaves without a token, with no error — which is why
105
+ they are worth checking *before* choosing the mode:
106
+
107
+ - Synchronous XHR.
108
+ - Native form navigation (a plain `<form>` submit).
109
+ - `navigator.sendBeacon`.
110
+ - WebSocket and EventSource.
111
+ - Service-worker-owned requests. Web workers and server-side rendering have their own
112
+ global scope too — in Next.js, Nuxt, Remix and similar, confirm the protected call
113
+ runs in the browser.
114
+ - A `fetch` using `no-cors`, which cannot carry a custom header at all.
115
+
116
+ For an operation on this list, use Manual mode **only if** the application can carry the
117
+ token in a supported header or request-body field. Otherwise the right answer is an
118
+ application-specific integration agreed with IntelliFend — say that plainly rather than
119
+ improvising a carrier.
120
+
121
+ ## Cross-origin APIs
122
+
123
+ When the protected endpoint is on another origin, its CORS response must allow the page
124
+ origin, the intended methods, and the `X-IntelliFend-Token` header. Missing that header
125
+ in `Access-Control-Allow-Headers` means the browser strips it and every request reads as
126
+ missing a token.
127
+
128
+ ## Verifying Seamless
129
+
130
+ Static checks:
131
+
132
+ 1. Exactly one script tag, loaded before application bundles, with valid JSON in
133
+ `data-protect`.
134
+ 2. Every listed entry matches a URL the browser actually requests — origin, case, and
135
+ trailing slash included.
136
+ 3. Every protected endpoint reaches the network via `fetch` or async XHR from page
137
+ scope.
138
+
139
+ Runtime check: exercise the endpoint in an authorized environment and confirm its
140
+ request carries a non-empty `X-IntelliFend-Token` without recording the token value.
141
+ Inspect safe backend decision metrics separately; the negative test in `SKILL.md`
142
+ provides enforcement evidence. The CLI challenge-volume command is unavailable.
143
+ A missing header can indicate a path mismatch or an uncovered transport; compare
144
+ the actual request URL and transport before changing backend code.
145
+
146
+ ## Expected result
147
+
148
+ Matching requests carry one non-empty `X-IntelliFend-Token` header; requests outside the
149
+ configured list are unchanged.
150
+
151
+ ## CSP and token handling
152
+
153
+ Identical to Manual mode — see the CSP and token-handling sections of
154
+ `browser-manual.md`. The `worker-src 'self' blob:` directive matters just as much here:
155
+ without it, every intercepted request attaches an empty token and the backend blocks
156
+ traffic that looks correctly integrated.
@@ -1,182 +1,107 @@
1
- # `requestshield` CLI reference
2
-
3
- Every RequestShield platform action goes through this CLI. There is no supported way
4
- to create keys, read the contract, or check traffic by hand-crafting HTTP calls, so if
5
- a task needs one of these values, run the command rather than guessing.
6
-
7
- Commands marked **auth** require a signed-in session (`requestshield signin`). The CLI
8
- also exposes local commands that do not need platform API access, such as `--help`,
9
- `--version`, and agent setup. Check once with `auth status` before a multi-step
10
- platform task instead of discovering it halfway through an edit.
11
-
12
- Most commands print JSON shaped `{"ok": true, "data": {...}}`. Parse `data`; treat
13
- `ok: false` as a hard stop and surface the message rather than continuing with edits.
14
-
15
- ## Contents
16
-
17
- - [General](#general)
18
- - [Authentication](#authentication)
19
- - [Key management](#key-management)
20
- - [Integration contract](#integration-contract)
21
- - [Applications](#applications)
22
- - [Credentials](#credentials)
23
- - [Service and monitoring](#service-and-monitoring)
24
- - [Billing](#billing)
25
- - [Agent integration](#agent-integration)
26
-
27
- ## General
28
-
29
- | Command | Purpose |
30
- | --- | --- |
31
- | `requestshield --help` | Usage and the full command list. Run this if a command below is rejected — the installed CLI may be older or newer than this file. |
32
- | `requestshield --version` | Installed CLI version, e.g. `requestshield 1.0.0`. |
33
- | `requestshield update check` | Latest available version. Use it when behaviour disagrees with this reference. |
34
-
35
- ## Authentication
36
-
37
- ```bash
38
- requestshield signin
39
- requestshield auth status
40
- ```
41
-
42
- **auth/API.**
43
-
44
- `signin` is interactive and stores a session on the machine. **Never try to automate
45
- it or ask for the user's credentials** — if the user is signed out, tell them to run it
46
- themselves and wait.
47
-
48
- `auth status` returns `{"ok":true,"data":{"authenticated":true,"customer_id":"customer_456"}}`.
49
- The `customer_id` is useful context to echo back so the user can confirm they are
50
- operating on the right account before you create or deactivate anything.
51
-
52
- ## Key management
53
-
54
- **The user runs these, not you.** They print the API Secret or change state for a live
55
- App Key, so hand over the exact command and let them run it in their own terminal. See
56
- "Key and secret management" in `SKILL.md` for the hand-off and the follow-up
57
- presence check.
58
-
59
- ```bash
60
- requestshield keys create --app-name <name>
61
- requestshield keys deactive --app-key <app-key> # or --app-name <name>
62
- requestshield app key rotate --app-key <app-key> # or --app-name <name>
63
- ```
64
-
65
- `keys create` returns both halves:
66
-
67
- ```
68
- App Key: app_123
69
- Secret Key: rs_sk_xxxxx
70
- Save this Secret Key now. It will not be shown again.
71
- ```
72
-
73
- The Secret Key appears exactly once. Warn the user *before* they run the command that
74
- they need somewhere to put it, and afterwards point them at the environment variable
75
- rather than repeating the value. Never ask them to paste the secret back — confirm it
76
- only by presence. See the secret-handling rules in `SKILL.md`.
77
-
78
- `keys deactive` (spelled that way in the CLI) needs at least one of `--app-key` or
79
- `--app-name`; if both are given, `--app-key` wins. Deactivation stops traffic being
80
- verified for that key, so name the affected app explicitly when you hand the command
81
- over and make sure the user means that key.
82
-
83
- `app key rotate` issues a new Secret Key for an existing App Key and deactivates the
84
- previous one. This is the correct response to a leaked or lost secret — it keeps the
85
- App Key stable, so no browser or config change is needed beyond the new secret. Like
86
- `keys create`, the user runs it.
87
-
88
- ## Integration contract
89
-
90
- ```bash
91
- requestshield contract
92
- ```
93
-
94
- **auth.** The authoritative integration surface run this before writing any
95
- integration code. The block below is an **illustration of the shape only**; never read
96
- values out of it, and in particular do not treat its `available_modes` as the modes your
97
- customer has:
98
-
99
- ```json
100
- {"ok":true,"data":{
101
- "contract_version":"2026-08-27",
102
- "browser":{"script_url":"https://.../intellifend.js","token_header":"X-IntelliFend-Token",
103
- "available_modes":["manual"]},
104
- "backend":{"supported_languages":["java"],"min_jdk":17},
105
- "release_state":"..."}}
106
- ```
107
-
108
- Use `script_url` and `token_header` verbatim. Check `available_modes` before committing
109
- to seamless or manual — a mode absent from that list is not released, and writing an
110
- integration against it produces code that will not work. Check `supported_languages`
111
- before promising a backend integration for a stack that is not listed; the browser side
112
- alone provides no protection, so an unsupported backend means the honest answer is
113
- "not yet supported here".
114
-
115
- ## Applications
116
-
117
- ```bash
118
- requestshield apps list
119
- requestshield apps get <app-key>
120
- ```
121
-
122
- **auth.** `apps list` returns the applications the current user can access, each with
123
- `app_key`, `name`, and `status`. Use it to resolve a human-supplied app name to a key
124
- rather than asking the user to retype one.
125
-
126
- `apps get <app-key>` returns `app_id`, `app_name`, and `status`. Status distinguishes a
127
- key that has never seen traffic (`ready`) from one in normal service (`active`) — which
128
- is exactly the difference between "the integration is not wired up yet" and "it is
129
- working", so check it before spending time debugging code.
130
-
131
- ## Credentials
132
-
133
- ```bash
134
- requestshield credentials status <app-key>
135
- ```
136
-
137
- **auth.** Returns metadata only — `provisioned`, `active`, `shared` — and never the
138
- secret value. Use it to answer "is the secret configured?" without anyone having to
139
- paste a credential. A key that is `provisioned: false` explains backend failures far
140
- faster than reading code.
141
-
142
- ## Service and monitoring
143
-
144
- ```bash
145
- requestshield server
146
- requestshield challenge volume <app-key> [--from <time>] [--to <time>] [--granularity <value>]
147
- ```
148
-
149
- **auth.** `server` reports `healthy` or `degraded`. Check it first when an integration
150
- that was working starts behaving oddly — a degraded platform explains fail-open
151
- behaviour on the backend without anything being wrong in the customer's code.
152
-
153
- `challenge volume` is runtime evidence that the browser/platform half is active. It is
154
- not proof that the protected backend enforces a blocking decision; the controlled
155
- negative test in `SKILL.md` provides that evidence. Times are ISO-8601
156
- (`2026-08-01T00:00:00Z`); `--granularity` takes values such as `hour` or `day`. A
157
- `challenge_count` of zero after the user has exercised the endpoint means the browser
158
- half is not firing — that is a browser-side bug, not a backend one, so start with the
159
- mode's reference file.
160
-
161
- ## Billing
162
-
163
- ```bash
164
- requestshield get billing
165
- ```
166
-
167
- **auth.** Current plan and usage for the application. Read-only; surface it when the
168
- user asks about cost or limits.
169
-
170
- ## Agent integration
171
-
172
- ```bash
173
- requestshield agent setup
174
- requestshield agent setup --agent claude
175
- requestshield agent setup --agent codex
176
- ```
177
-
178
- Local setup. Installs this skill for the named agent. With no `--agent`, the CLI detects
179
- which agent is in use. Run it when the user wants the skill available in another repo or
180
- for the other agent; it is the supported alternative to copying files by hand. It should
181
- not require a RequestShield App Key or API Secret, and it must not create, rotate, or
182
- deactivate customer credentials.
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.
7
+
8
+ ## Authentication and local commands
9
+
10
+ ```console
11
+ requestshield signin [--no-open]
12
+ requestshield auth status [--json]
13
+ requestshield signout
14
+ requestshield --help
15
+ requestshield --version
16
+ ```
17
+
18
+ Sign-in uses the user's browser on the same computer. Let the user complete it;
19
+ never ask for their password, tokens or callback URL. `auth status --json` reads
20
+ local metadata only and does not contact the provider or refresh credentials.
21
+ It returns `profile`, `apiUrl`, `issuer`, `clientId`, `state`, `localOnly: true`
22
+ and applicable `expiresAt`/`scopes`, never tokens or a customer/account identity.
23
+ States are `signed_out`, `valid`, `expired`, `refresh_uncertain`, `config_mismatch`,
24
+ `invalid` and `configuration_error`. Local validity is not provider acceptance.
25
+ Sign-out removes only the selected local session, not the browser session or
26
+ provider grant.
27
+
28
+ ## Applications
29
+
30
+ ```console
31
+ requestshield apps list [--json] [--limit <1-100>] [--cursor <cursor> | --all]
32
+ requestshield apps get <app-key>
33
+ requestshield apps rename <app-key> --name <name> [--idempotency-key <key>]
34
+ requestshield apps enable <app-key> [--idempotency-key <key>]
35
+ requestshield apps disable <app-key> [--idempotency-key <key>] [--yes]
36
+ ```
37
+
38
+ These commands require sign-in. Existing-app commands use exact App Keys; names
39
+ are not unique. List defaults to one page. `--all` follows at most 100 pages and
40
+ fails for repeated cursors or unfinished traversal at that bound. It cannot be
41
+ combined with `--cursor`. For name discovery, inspect all necessary pages and
42
+ resolve ambiguity with the user before choosing an App Key.
43
+
44
+ JSON list output is `{data:Application[],nextCursor}`. Detail and rename output
45
+ is `{data:Application}`. Application has exactly `appKey`, `name`, `status`,
46
+ `createdAt`, `updatedAt`. Status is `pending`, `enabled`, `disabled`, `revoked`
47
+ or `attention_required`; it describes configuration, not traffic or enforcement.
48
+ Pending, attention and disabled states do not expose the exact credential state.
49
+ Disable retains the secret; enable requires an active one.
50
+
51
+ ## Key and secret management
52
+
53
+ Have the user run commands that print secrets in their own terminal so secret
54
+ values stay out of tool output and transcripts. Give the exact command and
55
+ confirm storage by presence only.
56
+
57
+ ```console
58
+ requestshield keys create --app-name <name> [--idempotency-key <key>]
59
+ requestshield keys rotate <app-key> [--idempotency-key <key>] [--yes]
60
+ requestshield keys reveal <app-key> [--yes]
61
+ requestshield keys revoke <app-key> [--idempotency-key <key>] [--yes]
62
+ ```
63
+
64
+ Create makes a new application and initial secret. Rotate preserves the App Key
65
+ and replaces the secret. Reveal retrieves the current active secret; use it to
66
+ recover a lost issuance response. Exposure requires rotation, not reveal.
67
+ Revoke invalidates the current secret. Create, rotate and reveal can display an
68
+ API secret; the CLI never persists it. Store it in backend secret storage.
69
+
70
+ Create, rename and enable have no prompt. Disable, rotate, revoke and reveal
71
+ require confirmation; `--yes` skips it. These commands can change live state or
72
+ disclose secrets, so ensure the target and action match the user's request.
73
+
74
+ All mutations except reveal accept an idempotency key. A fresh key is generated
75
+ per invocation when omitted and printed to stderr before dispatch so interrupted
76
+ commands can reuse it; JSON stdout is unchanged. There is no automatic mutation retry. On uncertainty,
77
+ repeat the identical request and key printed in the error within seven days.
78
+ A new key is a new operation. After seven days inspect state before acting.
79
+ Create/rotate replay can have `apiSecret: null`; the CLI directs explicit reveal
80
+ without running it. HTTP 202 and `enabled` do not prove global propagation.
81
+
82
+ ## Agent setup and updates
83
+
84
+ ```console
85
+ requestshield agent setup [--codex | --claude] [--force]
86
+ requestshield update check
87
+ ```
88
+
89
+ Agent setup copies the skill to `~/.agents/skills/requestshield` for Codex or
90
+ `~/.claude/skills/requestshield` for Claude. With neither flag, it detects the
91
+ agent or asks if both are available. `--force` replaces an existing installation.
92
+ It does not edit repository `AGENTS.md` or customer application code.
93
+
94
+ Production update check queries npm and asks before a global installation.
95
+ Explain that target before accepting an update; it does not update a pinned
96
+ invocation or source checkout. Repository-only QAT/STG runners return local
97
+ source-update guidance without registry access or installation.
98
+
99
+ ## Unavailable commands
100
+
101
+ Integration contract, service health, credential-status metadata, challenge
102
+ volume and billing are not implemented CLI capabilities. `contract`,
103
+ `challenge volume` and `get billing` fail with `COMMAND_UNAVAILABLE` before
104
+ configuration, authentication or network access. `server` and
105
+ `credentials status` are unsupported. Use the published SDK documentation for
106
+ the chosen release and safe browser/backend observations for integration checks.
107
+ Do not infer traffic or enforcement from `apps get` status.