requestshield 0.0.0-stage → 1.1.0-qat.281

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 +295 -2
  2. package/config/.env.qat +7 -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 +317 -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
package/README.md CHANGED
@@ -1,3 +1,296 @@
1
- # Temporary Holding Version
1
+ # RequestShield CLI
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Manage RequestShield applications and secrets, inspect account billing estimates,
4
+ discover SDK integration settings, and install integration guidance for Codex or Claude.
5
+
6
+ Requires Node.js 22.13 or newer and npm. Run `npx requestshield --version` to see
7
+ the CLI version.
8
+
9
+ ## Install and get started
10
+
11
+ ```console
12
+ npx requestshield login
13
+ npx requestshield app list
14
+ npx requestshield contract
15
+ npx requestshield agent setup --codex
16
+ ```
17
+
18
+ To install globally, run `npm install --global requestshield`, then use
19
+ `requestshield` in place of `npx requestshield`.
20
+
21
+ Use an existing App Key or create an application with
22
+ `requestshield app create "Checkout API"`. Store its returned API Secret in your
23
+ backend secret manager. Never put API Secrets or tokens in frontend code, URLs,
24
+ logs, command arguments or committed files.
25
+
26
+ To run a pinned CLI version without a global installation:
27
+
28
+ ```console
29
+ npx requestshield@1.0.0 --help
30
+ ```
31
+
32
+ ## Commands
33
+
34
+ Run `requestshield --help`, `requestshield app --help` or
35
+ `requestshield app create --help` for help at each level. Names containing spaces
36
+ must be quoted. Commands for existing applications require an exact App Key.
37
+
38
+ | Command after `requestshield` | Purpose |
39
+ | --- | --- |
40
+ | `--help`, `-h` | Show help. |
41
+ | `--version`, `-v` | Show the CLI version. |
42
+ | `login [--no-open]` | Sign in through your browser. |
43
+ | `logout` | Remove your saved local session. |
44
+ | `auth status` | Inspect local session status. |
45
+ | `app create <name>` | Create an application and its initial secret. |
46
+ | `app list` | List applications. |
47
+ | `app get <app-key>` | Inspect an application. |
48
+ | `app rename <app-key> <name>` | Rename an application. |
49
+ | `app enable <app-key>` | Enable an application. |
50
+ | `app disable <app-key>` | Disable an application while keeping its secret. |
51
+ | `secret rotate <app-key>` | Replace the current secret. |
52
+ | `secret reveal <app-key>` | Retrieve the current active secret. |
53
+ | `secret revoke <app-key>` | Revoke the current secret. |
54
+ | `agent setup [--codex \| --claude] [--force]` | Install integration guidance. |
55
+ | `agent status [--codex \| --claude]` | Inspect installed Skill files. |
56
+ | `update check` | Check for a newer CLI version. |
57
+ | `update apply [--yes]` | Install the available version globally. |
58
+ | `contract` | Read the SDK integration contract. |
59
+ | `service status` | Check service availability. |
60
+ | `usage <app-key>` | Read approximate recent request counts. |
61
+ | `billing get <app-key>` | Read account usage, quota and estimated cost. |
62
+
63
+ Use `login`, `logout`, `app`, `secret` and `contract` exactly as shown;
64
+ `signin`, `signout`, plural group names and `contract get` are not supported.
65
+
66
+ All result commands support `--json`. Stdout contains one JSON document;
67
+ progress, prompts and warnings go to stderr. Help and version are text.
68
+ Most results use `{data: ...}`; `auth status` returns its local status directly.
69
+ Errors use `{error: {code, message}}`. `--json` does not skip confirmation.
70
+ Redirected output is plain text; `NO_COLOR` or `TERM=dumb` disables colors and icons.
71
+
72
+ ## Sign in and inspect your session
73
+
74
+ `requestshield login` opens your browser. Sign in, verify your email if needed,
75
+ and approve the displayed permissions. The browser must be on the same computer
76
+ as the CLI. With `--no-open`, open the printed URL yourself. Press Ctrl+C to cancel.
77
+
78
+ The CLI saves your session securely and renews it when needed. Follow any prompt
79
+ to sign in again; never send passwords, tokens or callback URLs to support.
80
+
81
+ ```console
82
+ requestshield auth status --json
83
+ requestshield logout
84
+ ```
85
+
86
+ Status is a local check and does not contact RequestShield. JSON includes `state`
87
+ and `localOnly: true`, plus `expiresAt` and `scopes` when applicable. States are
88
+ `signed_out`, `valid`, `expired`, `refresh_uncertain`, `config_mismatch`, `invalid`
89
+ and `configuration_error`. Local `valid` status does not confirm online access.
90
+ Logout removes your saved CLI session; your browser stays signed in.
91
+
92
+ ## Applications and secrets
93
+
94
+ Create, rename and enable do not prompt. Disable, rotate, revoke and reveal
95
+ require confirmation; pass `--yes` only when you intend that action.
96
+
97
+ Rotate keeps the App Key and replaces its secret. Reveal retrieves the current
98
+ secret. Revoke invalidates the current secret. Disable keeps the secret; enable
99
+ requires an active secret. Without `--output`, create, rotate and reveal display
100
+ the API Secret without saving it. Store it directly in protected backend configuration.
101
+
102
+ Mutations except reveal accept `--idempotency-key <key>`. The CLI generates and
103
+ prints a key to stderr before sending a request. If its result is uncertain,
104
+ repeat the identical command and arguments with that same key within seven days.
105
+ A new key starts a new operation. After seven days, inspect the application first.
106
+ A repeated create or rotate can return `apiSecret: null`; retrieve it separately
107
+ with `secret reveal` if needed. Requests are never retried automatically.
108
+
109
+ Changes may take a moment. Check `requestshield app get <app-key>` before relying
110
+ on a change. Application status describes your settings, not traffic or proof
111
+ that an endpoint is protected.
112
+
113
+ | Status | Meaning |
114
+ | --- | --- |
115
+ | `pending` | Your latest changes are being applied. |
116
+ | `enabled` | The application and its secret are enabled. |
117
+ | `disabled` | The application is disabled. |
118
+ | `revoked` | The application's secret has been revoked. |
119
+ | `attention_required` | Changes could not be confirmed. Retry later or contact support. |
120
+
121
+ `app list` accepts `--limit <1-100>`, `--cursor <cursor>` or `--all`. `--all`
122
+ cannot be combined with `--cursor`. JSON list output is
123
+ `{data: Application[], nextCursor}`; detail and rename return `{data: Application}`.
124
+ Each Application contains `appKey`, `name`, `status`, `createdAt` and `updatedAt`.
125
+
126
+ ### Save credentials to a file
127
+
128
+ Use `--output <file>` on create, reveal or rotate to save credentials without
129
+ printing the secret, including with `--json`:
130
+
131
+ ```console
132
+ requestshield app create "Checkout API" --output ../requestshield-secrets/checkout.env --json
133
+ requestshield secret reveal YOUR_APP_KEY --output ../requestshield-secrets/recovered.env --yes
134
+ requestshield secret rotate YOUR_APP_KEY --output ../requestshield-secrets/rotated.env --yes
135
+ ```
136
+
137
+ The UTF-8 ENV file contains `INTELLIFEND_REQUESTSHIELD_APP_KEY` and
138
+ `INTELLIFEND_REQUESTSHIELD_API_SECRET`. The CLI restricts file access to the current
139
+ operating-system user. Keep the file outside source control. Configure your backend
140
+ launcher or container to load it; saving the file does not configure the backend.
141
+ An existing backend process must receive the updated configuration after rotation.
142
+
143
+ Supply a new file, using an absolute path or a path relative to your current
144
+ directory. Missing directories are created. Existing files are never overwritten;
145
+ directories, symbolic links, junctions and `-` for stdout are not supported destinations.
146
+ Reveal and rotate still require confirmation or `--yes`.
147
+
148
+ JSON returns `{data: {appKey, outputPath, secretStored: true}}`; create and rotate
149
+ also return the application's `status`. `outputPath` is absolute. Neither the
150
+ JSON nor the text result contains the API Secret when `--output` is used.
151
+
152
+ | Failure | Code | Exit | Recovery |
153
+ | --- | --- | --- | --- |
154
+ | Destination exists | `OUTPUT_EXISTS` | 2 | Choose a new file. No application or secret request was sent. |
155
+ | File cannot be prepared or saved | `OUTPUT_WRITE_FAILED` | 7 | Follow the message: fix the path or permissions before retrying; if the request succeeded, use `secret reveal APP_KEY --output NEW_FILE`. |
156
+ | Replayed create/rotate returned no secret | `OUTPUT_SECRET_UNAVAILABLE` | 7 | Use `secret reveal APP_KEY --output NEW_FILE`; do not create or rotate again. |
157
+
158
+ On failure the CLI attempts to remove its unfinished file and warns if it cannot.
159
+ An interrupted process can leave an unfinished file. Use a new output path when
160
+ retrying, keeping the same application arguments and idempotency key for an
161
+ uncertain mutation. Changing only `--output` does not change the API request.
162
+
163
+ ## SDK integration contract
164
+
165
+ ```console
166
+ requestshield contract
167
+ requestshield contract --json
168
+ ```
169
+
170
+ This public read requires no login and changes no local files. The schema-2 JSON
171
+ has a `{data: ...}` envelope containing `schemaVersion: 2`, `contractVersion`,
172
+ `services`, `browser`, `backend` and `documentation`.
173
+
174
+ - `data.services.challengeUrl`: configure this URL in both SDKs.
175
+ - `data.browser.scriptUrlVersion`: immutable Browser SDK script URL.
176
+ - `data.browser.scriptUrlLatest`: script URL that follows Browser SDK updates.
177
+ - `data.browser.sdkVersion` and `data.browser.integrity`: version and SHA-384 SRI
178
+ for the versioned script only. Latest can serve a different release.
179
+ - `data.browser.availableModes`: supported frontend modes for the pinned release at
180
+ `scriptUrlVersion`. Check current public documentation for latest capabilities.
181
+ - `data.browser.tokenHeader` and `cspAdditions`: shared integration settings.
182
+ Merge CSP additions into your existing policy; they cover both script choices, including `'wasm-unsafe-eval'` and a `blob:` worker source.
183
+ - `data.backend`: SDK version, minimum JDK, Maven repository and core/Spring Boot
184
+ 3 MVC starter coordinates.
185
+ - `data.documentation`: Browser SDK, Java SDK, domains/CSP and optional release notes.
186
+
187
+ Frontend and backend each choose Seamless or Manual independently. For the backend,
188
+ Seamless uses the Spring Boot 3 MVC starter; Manual uses Java core directly.
189
+ The text output labels those backend modes alongside their Maven coordinates.
190
+ For a new integration, prefer Seamless on both sides when supported, otherwise
191
+ Manual on both sides. Mixed pairs are supported; keep an existing integration or
192
+ an explicit supported choice. `BLOCK`/`MONITOR` are separate enforcement policies.
193
+
194
+ Choose versioned when you need controlled upgrades or SRI. Use latest to receive
195
+ updates automatically. Use the URLs exactly as returned. Attach the supplied
196
+ integrity value only to `scriptUrlVersion`; do not attach it to `scriptUrlLatest`.
197
+ The former `browser.scriptUrl` and schema 1 are no longer supported.
198
+
199
+ | Failure | Code | Exit |
200
+ | --- | --- | --- |
201
+ | Contract unavailable (HTTP 404) | `CONTRACT_NOT_PUBLISHED` | 1 |
202
+ | Network, timeout or HTTP failure | `CONTRACT_FETCH_FAILED` | 1 |
203
+ | Invalid or unsupported contract | `CONTRACT_INVALID` | 1 |
204
+ | CLI integration settings unavailable | `CONTRACT_CONFIG_INVALID` | 2 |
205
+
206
+ For an unsupported schema, update the CLI and retry. If the problem continues,
207
+ contact support. Contract metadata does not confirm service availability or
208
+ application protection.
209
+
210
+ ## Service status and usage
211
+
212
+ ```console
213
+ requestshield service status --json
214
+ requestshield usage pk_example --json
215
+ requestshield usage pk_example --from 2026-09-17T08:00:00Z --to 2026-09-17T09:00:00Z
216
+ ```
217
+
218
+ Service status checks Management API and Challenge Service without signing in.
219
+ Each check has a five-second deadline. JSON returns `{data: {checkedAt, checks}}`;
220
+ each check contains `service`, `url`, `status`, `latencyMs`, nullable `httpStatus`
221
+ and nullable `reason`. Reasons are `timeout`, `network_error`, `http_error` and
222
+ `invalid_response`. Exit 0 means both passed; exit 1 includes a failed-check report.
223
+ `SERVICE_CONFIG_INVALID` exits 2. Test a protected request separately to verify
224
+ your application integration.
225
+
226
+ Usage requires sign-in and an owned App Key. It defaults to the last 24 hours;
227
+ provide both `--from` and `--to` for a range within the last 90 days. Use UTC
228
+ times ending in `Z`, with seconds and optionally up to three fractional digits.
229
+ The end must follow the start and cannot be in the future. The range includes
230
+ requests completed at the start and excludes requests completed at the end.
231
+
232
+ Counts are approximate monitoring data, not billing totals. Data may be delayed
233
+ or incomplete. Retries count separately; successful challenge verifications are
234
+ attempts, not unique challenges. Zero means no recorded requests, not proof of no
235
+ traffic. A failed query returns an error. The report preserves your requested
236
+ range and includes only available recorded activity, even if collection began
237
+ after the start. The 90-day query window does not guarantee complete history.
238
+
239
+ Usage reports cover API v2 requests only. API v1 activity is not included.
240
+ If your browser and backend use different API versions, the report may show
241
+ only part of your application's activity.
242
+
243
+ Usage JSON includes `appKey`, `from`, `to`, `approximate: true` and `operations`.
244
+ The operation keys are `challenge_create`, `challenge_verify` and `token_consume`,
245
+ each containing `requests`, `success`, `rejected` and `error` counts.
246
+
247
+ ## Billing
248
+
249
+ ```console
250
+ requestshield billing get pk_example
251
+ requestshield billing get pk_example --json
252
+ ```
253
+
254
+ Sign in and supply an App Key you own. The report covers the **whole account**,
255
+ including its applications; it does not allocate costs to the requested app.
256
+ It shows the current plan and subscription billing period, included allowance,
257
+ approximate usage, remaining quota, overage and estimated cost in its currency.
258
+ The CLI reads billing estimates directly; `usage` monitoring totals are separate.
259
+
260
+ Billing counts authenticated API v2 token verification requests, including
261
+ rejected requests and retries. API v1 activity, unauthenticated requests and
262
+ service errors are excluded.
263
+
264
+ Express includes 10,000 calls per period at no charge. Pro includes 100,000 calls
265
+ for USD 100 per period, plus USD 0.001 per additional call. The estimate includes
266
+ the period's base price and observed overage before taxes; it is not a final
267
+ invoice or a forecast of the rest of the period. Exceeding the allowance does not
268
+ automatically block requests.
269
+
270
+ JSON returns `{data: ...}` with `appKey`, `scope: "account"`, subscription
271
+ `status`, `plan` (`free` for Express, `pro`, or `null`), `billingPeriod`,
272
+ `includedAllowance`, `usage`, `remainingQuota`, `overage`,
273
+ `unit: "token_verification_requests"`, `approximate: true`, `reportedAt`,
274
+ `usageThrough` and `estimatedCost`. `billingPeriod` contains UTC `start` and `end`.
275
+ `estimatedCost` contains `currency` and integer `baseAmountMinor`,
276
+ `overageAmountMinor` and `totalAmountMinor`; USD minor units are cents.
277
+
278
+ Absent or inapplicable data is `null`, displayed as unavailable, never zero.
279
+ Without a current subscription, the plan, period, quantities and cost can be
280
+ unavailable. Failed billing reads return an error. `reportedAt` is the report
281
+ time and `usageThrough` is the usage query cutoff, not a guarantee that all
282
+ activity has arrived. Counts may be delayed or incomplete. Zero means no
283
+ billable requests were recorded for the queried interval.
284
+
285
+ ## Agent setup and updates
286
+
287
+ `agent setup` installs the RequestShield Skill to `~/.agents/skills/requestshield`
288
+ for Codex or `~/.claude/skills/requestshield` for Claude. Select an agent with
289
+ `--codex` or `--claude`; `--force` replaces its existing Skill. Start a new agent
290
+ task after installing. `agent status` checks files for both agents by default and
291
+ reports `installed`, `missing` or `invalid`; it does not prove the agent loaded them.
292
+
293
+ `update check` reads the npm registry without installing. `update apply` asks before
294
+ installing the exact available version globally with npm; `--yes` confirms it.
295
+ A global update does not change a pinned `npx` invocation. Installations without
296
+ automatic update support return `outcome: "unavailable"` and make no changes.
@@ -0,0 +1,7 @@
1
+ # Public QAT settings for the QAT npm release and source runner. Never add secrets.
2
+ API_URL=https://management-api-qat.intellifend.ai
3
+ CHALLENGE_URL=https://challenge-dev.intellifend.ai
4
+ DOCS_URL=https://docs-qat.intellifend.ai
5
+ OAUTH_ISSUER=https://incongruous-cherry-0283.customers.stytch.dev
6
+ OAUTH_AUTHORIZATION_ISSUER=stytch.com/project-test-968146e2-6f34-4936-9d1c-a7e966813c70
7
+ OAUTH_CLIENT_ID=connected-app-test-5ff62ca4-c0eb-48c3-84e5-06ae8f669998
package/package.json CHANGED
@@ -1,6 +1,27 @@
1
1
  {
2
2
  "name": "requestshield",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.1.0-qat.281",
4
+ "description": "Customer CLI for IntelliFend RequestShield.",
5
+ "type": "module",
6
+ "bin": {
7
+ "requestshield": "src/main.mjs"
8
+ },
9
+ "publishConfig": {
10
+ "access": "public",
11
+ "registry": "https://registry.npmjs.org/",
12
+ "tag": "qat"
13
+ },
14
+ "files": [
15
+ "src/",
16
+ "config/.env.qat",
17
+ "skills/",
18
+ "README.md"
19
+ ],
20
+ "engines": {
21
+ "node": ">=22.13"
22
+ },
23
+ "license": "UNLICENSED",
24
+ "requestshield": {
25
+ "profile": "qat"
26
+ }
27
+ }
@@ -0,0 +1,240 @@
1
+ ---
2
+ name: requestshield
3
+ description: Install, verify, troubleshoot, or remove IntelliFend RequestShield bot protection in a customer codebase — the browser SDK in Seamless or Manual mode, plus Java backend enforcement via the Spring Boot 3 starter or the Java core SDK — using the `requestshield` CLI for sign-in, applications and credentials, with SDK documentation and runtime observations for integration checks. Use this skill whenever the user mentions RequestShield, IntelliFend, `X-IntelliFend-Token`, `IntelliFend.getToken()`, `data-protect`, `@RequestShieldProtected`, App Key or API Secret setup, or asks to protect an endpoint such as registration, sign-in, password reset, checkout, or form submission from bots, scripted abuse, or credential stuffing — even when they never name the product. Also use it before hand-editing any file that already contains a RequestShield script tag, `verify()` call, or protection annotation.
4
+ ---
5
+
6
+ # RequestShield integration
7
+
8
+ The browser transports a short-lived token; the backend verifies it before the
9
+ protected business operation runs. Configure both halves independently, land them in
10
+ the same change, and verify both. Protect the mutation itself, not a read-only route
11
+ in front of it.
12
+
13
+ ## Before touching integration files
14
+
15
+ Run `requestshield --version`. If unavailable, explain that CLI operations need a
16
+ compatible installation; do not invent replacement HTTP calls. Read
17
+ [the CLI reference](references/cli.md) before invoking commands.
18
+
19
+ - Run relevant read-only commands automatically.
20
+ - Explain the exact action and target and obtain fresh confirmation under
21
+ **Interactive questions** before `login`, `logout`, `app create`, `app enable`,
22
+ `app disable`, `secret rotate`, `secret reveal`, or `secret revoke`, even when requested.
23
+ - A direct request for the exact `app rename`, `agent setup`, or `update apply` action
24
+ and target needs no additional confirmation; use `--yes` where needed. Read-only
25
+ requests never authorize writes.
26
+
27
+ Endpoint/mode selection, enforcement-mode changes, shared-environment tests, and
28
+ uninstall scope retain their separate approval requirements.
29
+
30
+ ### Interactive questions
31
+
32
+ For choices and confirmations, use the host's native interactive-question tool.
33
+ Discover supported options first; use single-select for one choice, multi-select for
34
+ several, and exactly **Yes**/**No** for binary confirmation. If multi-select is
35
+ unavailable, ask an interactive Yes/No for each candidate. Do not request typed
36
+ selections in chat. If no permitted tool is available, explain and pause that step.
37
+
38
+ Keep pending questions active and continue independent authorized work. When supported,
39
+ wait in 60-second check-in intervals; timeouts, defaults, highlighted options, and
40
+ silence are not answers. Reissue a question only if the host reports it expired.
41
+ Resume dependent work automatically after an explicit answer.
42
+
43
+ ## Classify the request
44
+
45
+ Match the user’s intent and follow its complete sequence and linked sections.
46
+
47
+ | Intent | Sounds like | Do this |
48
+ | --- | --- | --- |
49
+ | **General information** | "what is RequestShield", "what is Seamless mode", "Seamless or Manual", "what version", "how much does it cost", "what quotas or limits apply" | Answer from **General information** below. Use read-only sources only; do not require login or run account-changing commands. |
50
+ | **Integration contract** | "which SDK", "SDK URL", "integration manifest" | Run `requestshield contract --json` without login. Use the returned release metadata and documentation links; it reports no account or service-health information. |
51
+ | **Authentication** | "how can I log in", "sign me in", "sign me out" | For how-to questions, explain the CLI commands without running them. For an explicit sign-in request, follow the [sign-in steps](references/integration-planning.md#sign-in). For an explicit sign-out request, explain the action, obtain confirmation under **Interactive questions**, then run `requestshield logout`. |
52
+ | **Key / secret management** | "create an app key", "I need an API Secret", "rotate the secret", "deactivate a key" | Follow **Key and secret management** below for target selection, confirmation, execution, and result handling. |
53
+ | **Install** | "add RequestShield", "protect /api/register" | Follow **Installing** below (which runs the planning flow in `references/integration-planning.md`) → **Static install verification**. Do not provision credentials or run runtime or negative tests as part of Install. |
54
+ | **Uninstall** | "remove it", "roll it back" | Follow `references/integration-planning.md` (**Detect existing integration** only) → **Uninstalling** → rerun **Detect existing integration** as the static uninstall check. |
55
+ | **Change mode** | "switch to Seamless", "use the annotation instead of `verify()`" | Follow `references/integration-planning.md` **Detect existing integration** → **Contract check** → **Gate** → **Choosing the modes** (the request is the explicit preference for that layer only) → remove the old path and add the new one for that layer in the same change → static **Verifying**. |
56
+ | **Verify / troubleshoot** | "is it set up right?", "why is it not blocking?", a reason code | `references/integration-planning.md` (**Detect existing integration** only) → **Verifying** (static-only; do not exercise the endpoint). For a reason code, also read `references/troubleshooting.md`. |
57
+ | **Test / enforcement test** | "test RequestShield", "is RequestShield working?", "check if it actually blocks", "test protection on this endpoint" | `references/integration-planning.md` (**Detect existing integration** only) → static **Verifying** → control request → **The negative test**. |
58
+ | **Usage** | "how much traffic", "how many challenges", "request volume" | First complete the [sign-in steps](references/integration-planning.md#sign-in). Run `requestshield usage <app-key> --json` for the exact requested app. See [Recent usage](references/cli.md#recent-usage) for query limits and interpretation. |
59
+ | **Billing** | "am I being charged", "what plan", "what are my limits" | For account-specific billing, first complete the [sign-in steps](references/integration-planning.md#sign-in). Run `requestshield billing get <app-key> --json` for an owned App Key. Follow [Account billing](references/cli.md#account-billing): preserve account-wide scope, approximate quantities, unavailable values and the estimate-versus-invoice distinction. |
60
+ | **Service health** | "is the service up", "is it degraded" | Run `requestshield service status --json` without login or an App Key. Interpret results using [Service liveness](references/cli.md#service-liveness). |
61
+ | **Agent setup** | "set this up for Codex too", "install the skill for Claude" | Run `requestshield agent setup` for auto-detection, or pass the requested agent: `--codex` or `--claude`. Follow [Agent setup and updates](references/cli.md#agent-setup-and-updates). |
62
+ | **Anything else** | | Look the command up in `references/cli.md`. If it is not there, run `requestshield --help` rather than guessing at a flag. |
63
+
64
+ ### General information
65
+
66
+ Use the matching browser reference for concepts and modes, `requestshield --version`
67
+ for CLI version, `update check` for available updates, and `contract --json` plus its
68
+ release documentation for SDK capabilities. Apply updates only when requested.
69
+
70
+ Use verified current official sources for pricing, plans, and quotas. Never infer
71
+ allowances or remaining quota from usage, app status, or SDK limitations. If unavailable,
72
+ say so and direct the user to their billing/support channel. Clarify whether “quota”
73
+ means plan allowance, usage, API rate limits, or technical limitations.
74
+
75
+ ## Key and secret management
76
+
77
+ 1. Before any key or secret management action, complete the
78
+ [sign-in steps](references/integration-planning.md#sign-in). For creation, confirm the
79
+ application name. For existing applications, resolve the exact App Key with
80
+ `app list --all --json` and `app get <app-key> --json`; names are not unique.
81
+ 2. Follow [Key and secret management in the CLI reference](references/cli.md#key-and-secret-management)
82
+ for confirmation, execution, delivery, sanitized results, and idempotent retries.
83
+ Create uses a new private file via `--output`; rotate/reveal use a private
84
+ user-visible terminal whose output is unavailable to the agent. Never read either
85
+ destination. Credential delivery does not configure or activate the backend.
86
+ 3. Recommend the deployment's secret manager or protected runtime environment settings,
87
+ using `INTELLIFEND_REQUESTSHIELD_APP_KEY` and `INTELLIFEND_REQUESTSHIELD_API_SECRET`.
88
+ Supply the same public App Key to `data-app-key` or `IntelliFend.init({ appKey })`
89
+ through the browser framework's public configuration; for Vite, recommend
90
+ `VITE_INTELLIFEND_REQUESTSHIELD_APP_KEY`. Configure the runtime only when requested.
91
+
92
+ The API Secret stays backend-only. Never put it in browser code, client-visible
93
+ responses, source files, committed ENV/CI files, image layers, logs, artifacts, or chat.
94
+ Reveal recovers a lost issuance response; exposure requires approved rotation. Deleting
95
+ an exposed value does not make the secret safe again.
96
+
97
+ ## Installing
98
+
99
+ If the user has not already selected an explicit, intentionally narrow endpoint set,
100
+ follow [Discover and select protected endpoints](references/integration-planning.md#discover-and-select-protected-endpoints)
101
+ before continuing.
102
+
103
+ Once the selected endpoint set is explicit, run the remaining planning flow before
104
+ writing integration code: **Detect existing integration** →
105
+ **Contract check** → **Gate** → **Then act on what you found** → **Choosing the modes**.
106
+
107
+ 1. **Browser side** — follow the selected mode's reference:
108
+ [Seamless](references/browser-seamless.md) or [Manual](references/browser-manual.md).
109
+ 2. **Backend side** — follow the selected path's reference:
110
+ [Spring Boot 3 starter](references/backend-spring-boot.md) or
111
+ [Java core SDK](references/backend-java-core.md). Enforce before the mutation.
112
+ 3. **Static install verification** — run **Verifying**, then focused builds/tests
113
+ without starting a credential-dependent runtime. Fix failures before finishing.
114
+
115
+ Install ends here. Report source checks and build/test results separately; runtime
116
+ activation and enforcement remain unverified. Credential configuration, runtime
117
+ requests, and negative testing require a separate request.
118
+
119
+ ## Verifying
120
+
121
+ Run **Detect existing integration** in `references/integration-planning.md`.
122
+ Inspect the existing modes; do not reopen mode selection.
123
+
124
+ Check:
125
+ - One SDK initialization before protected requests; report App Key bindings or placeholders.
126
+ - Seamless matches exact origins and configured paths, including whole-segment `:name`
127
+ parameters; Manual obtains a fresh token for every request/retry.
128
+ - One backend verification path gates each mutation; configuration uses environment references.
129
+ - CORS/CSP support the selected transport.
130
+ - No tokens or secrets in logs, URLs, analytics, or error reporting.
131
+
132
+ Run relevant static checks and report build/test results separately.
133
+ Verify does not exercise endpoints; runtime enforcement remains unverified.
134
+
135
+ If a check fails, report it, follow [Troubleshooting](references/troubleshooting.md),
136
+ apply one correction at a time, and rerun Verify. Changes to `MONITOR`/`BLOCK`
137
+ require explicit approval.
138
+
139
+ ### The negative test — the only proof of enforcement
140
+
141
+ Run only after static Verify passes, using the existing runtime configuration.
142
+ Confirm under **Interactive questions** before testing a shared environment.
143
+ Use an authorized local/staging environment or a reversible test operation;
144
+ do not test production casually or invent data that creates a real account.
145
+
146
+ 1. **Establish enforcement and observability.**
147
+ For Spring Boot, confirm effective `BLOCK`, including method overrides.
148
+ For Java core, confirm `!result.isAllowed()` rejects before the mutation.
149
+ See the corresponding backend reference.
150
+
151
+ Observe decisions for the backend instance and App Key under test:
152
+ - Spring Boot: `intellifend.requestshield.requests`, distinguishing
153
+ `outcome=allowed, reason=ok` from
154
+ `outcome=degraded, reason=service_unavailable`.
155
+ - Java core: safe metrics/logs from `isDegraded()` and `getReason().getCode()`.
156
+
157
+ Service health alone is insufficient. Never record tokens, API Secrets,
158
+ session values, or CSRF values.
159
+
160
+ 2. **Send a control request** through the integrated browser path with a fresh token.
161
+ Confirm success, the intended mutation, and a non-degraded `ok` backend decision.
162
+ Use a new token for every attempt. If the control fails, stop before the
163
+ tokenless comparison and follow [Troubleshooting](references/troubleshooting.md);
164
+ do not start credential management.
165
+
166
+ 3. **Repeat without the token.** Preserve valid authentication, session, CSRF,
167
+ route, method, body, and other headers; remove only `X-IntelliFend-Token`.
168
+ Use a client that bypasses the Browser SDK so it cannot attach another token.
169
+
170
+ 4. **Evaluate the result.**
171
+ - Spring Boot: HTTP 403, `CHALLENGE_FAILED`, reason `missing_token`,
172
+ and no handler side effect.
173
+ - Java core: rejection from `!result.isAllowed()` corresponding to
174
+ `missing_token`, before any mutation.
175
+ - Unrelated or unattributable 4xx: inconclusive.
176
+ - Degraded results, or unavailable degradation evidence: inconclusive.
177
+ Follow [degraded-result guidance](references/troubleshooting.md#degraded-results-are-allowed-by-design)
178
+ and repeat with a fresh control after recovery.
179
+ - A 2xx or mutation confirms a bypass only when degradation is ruled out
180
+ for that request; follow [Troubleshooting](references/troubleshooting.md).
181
+
182
+ Report static checks, browser transport, and backend enforcement separately.
183
+ Usage counts and application status are not enforcement proof.
184
+
185
+ ## Uninstalling
186
+
187
+ Run **Detect existing integration** in `references/integration-planning.md`.
188
+ Present protected operations by exact method/path and current state, without priority.
189
+ Use **Present a multi-select and wait** to obtain the selected scope, then confirm
190
+ the exact removal list under **Interactive questions** before editing.
191
+
192
+ - **All operations selected:** remove RequestShield scripts, token calls/headers,
193
+ backend dependencies and enforcement, configuration references, and its CSP/CORS entries.
194
+ - **Some operations selected:** remove only their browser and backend protection.
195
+ Preserve shared setup and protection for remaining operations.
196
+
197
+ Preserve unrelated code, request logic, and configuration. Rerun detection over the
198
+ same scope. Inspect remaining candidates using the reference's redacted method;
199
+ remove confirmed integration-owned leftovers and repeat detection.
200
+
201
+ Complete only when selected operations have no active integration markers and
202
+ remaining operations retain both protection halves. Report static detection and
203
+ build/test results separately; source removal does not prove deployed removal.
204
+
205
+ Application disable or secret revocation is a separate credential-management action
206
+ requiring its own approval.
207
+
208
+ ## Non-negotiables
209
+
210
+ - Browser code must not interpret a token or decide to allow, block, or retry around
211
+ enforcement. Choose frontend/backend modes independently; supported mixed pairs work.
212
+ - Use one fresh token per request, including retries, and forward non-empty tokens
213
+ unchanged. Do not trim, re-encode, inspect, cache, persist, log, or put them in URLs.
214
+ Reuse returns `token_replayed`. If Manual `getToken()` returns empty, omit the header
215
+ and let the backend apply its configured policy.
216
+ - Verify once per request: never combine `@RequestShieldProtected` and a manual
217
+ `RequestShieldClient.verify()` on the same handler.
218
+ - Explain and obtain explicit approval under **Interactive questions** before changing
219
+ effective `MONITOR`/`BLOCK` mode, including global or method overrides. A diagnosis,
220
+ recommendation, default, or silence is not approval.
221
+ - Follow **Key and secret management** for secret handling and credential actions.
222
+
223
+ ## Reference files
224
+
225
+ | File | Read it when |
226
+ | --- | --- |
227
+ | `references/cli.md` | Any CLI invocation — exact syntax, output shape, auth requirements |
228
+ | `references/integration-planning.md` | Sign-in, ranked endpoint discovery and multi-selection, existing-integration detection, contract check, backend gating, and browser-mode selection |
229
+ | `references/browser-manual.md` | Installing or auditing Manual mode; CSP rules |
230
+ | `references/browser-seamless.md` | Installing or auditing Seamless mode; matching and coverage limits |
231
+ | `references/backend-spring-boot.md` | Backend work on Spring Boot 3 MVC — the annotation path |
232
+ | `references/backend-java-core.md` | Backend Manual on a supported Java 17+ backend — the explicit verify() path |
233
+ | `references/troubleshooting.md` | A block, a degraded result, or a reason code to explain |
234
+
235
+ ## For agent setup
236
+
237
+ Follow [Agent setup and updates](references/cli.md#agent-setup-and-updates).
238
+ Setup installs guidance only; it does not create credentials or change customer code.
239
+ `assets/AGENTS.codex.md` is an optional template for a separately requested repository
240
+ instruction change.