requestshield 0.1.2 → 0.1.3
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.
- package/README.md +75 -181
- package/package.json +13 -11
- package/skills/requestshield/SKILL.md +302 -39
- package/skills/requestshield/assets/AGENTS.codex.md +62 -0
- package/skills/requestshield/references/backend-java-core.md +128 -0
- package/skills/requestshield/references/backend-spring-boot.md +145 -0
- package/skills/requestshield/references/browser-manual.md +210 -0
- package/skills/requestshield/references/browser-seamless.md +164 -0
- package/skills/requestshield/references/cli.md +182 -0
- package/skills/requestshield/references/integration-planning.md +389 -0
- package/skills/requestshield/references/troubleshooting.md +118 -0
- package/src/agent-detector.mjs +74 -0
- package/src/args.mjs +23 -66
- package/src/cli.mjs +2 -13
- package/src/commands/agent-setup.mjs +109 -15
- package/src/main.mjs +24 -24
- package/src/commands/update-check.mjs +0 -139
package/README.md
CHANGED
|
@@ -1,233 +1,127 @@
|
|
|
1
1
|
# RequestShield CLI
|
|
2
2
|
|
|
3
|
-
Customer-facing
|
|
4
|
-
|
|
5
|
-
Codex, and check for a newer npm release.
|
|
6
|
-
|
|
7
|
-
Current package version: `0.1.2`.
|
|
3
|
+
Customer-facing CLI for signing in, rotating RequestShield application keys,
|
|
4
|
+
and installing the RequestShield skill for Codex or Claude.
|
|
8
5
|
|
|
9
6
|
## Requirements
|
|
10
7
|
|
|
11
|
-
- Node.js 22.13 or newer
|
|
12
|
-
-
|
|
13
|
-
- A RequestShield customer management API.
|
|
14
|
-
- Windows x64 and Inno Setup 6 when building the Windows installer.
|
|
15
|
-
|
|
16
|
-
The management API defaults to `https://api.intellifend.ai`. During local
|
|
17
|
-
development, set `REQUESTSHIELD_API_URL` to another API origin when needed.
|
|
18
|
-
|
|
19
|
-
## Implemented commands
|
|
20
|
-
|
|
21
|
-
```console
|
|
22
|
-
requestshield signin
|
|
23
|
-
requestshield keys create [--yes]
|
|
24
|
-
requestshield agent setup --agent codex [--force]
|
|
25
|
-
requestshield update check
|
|
26
|
-
requestshield --help
|
|
27
|
-
requestshield --version
|
|
28
|
-
```
|
|
8
|
+
- Node.js 22.13 or newer.
|
|
9
|
+
- A customer management API implementing the contract below.
|
|
29
10
|
|
|
30
|
-
The
|
|
31
|
-
|
|
11
|
+
The API defaults to `https://api.intellifend.ai`. For development, set
|
|
12
|
+
`REQUESTSHIELD_API_URL` to the management API origin.
|
|
32
13
|
|
|
33
|
-
|
|
14
|
+
## Commands
|
|
34
15
|
|
|
35
16
|
```console
|
|
36
17
|
requestshield signin
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
Starts the device authorization flow. The CLI prints the verification URL and
|
|
40
|
-
user code but does not open a browser automatically. After authorization, the
|
|
41
|
-
session is saved in the current user's application-data directory.
|
|
42
|
-
|
|
43
|
-
For CI or automation, `REQUESTSHIELD_ACCESS_TOKEN` may provide the access token.
|
|
44
|
-
An environment token is never persisted by the CLI.
|
|
45
|
-
|
|
46
|
-
### Create new keys
|
|
47
|
-
|
|
48
|
-
```console
|
|
49
18
|
requestshield keys create
|
|
19
|
+
requestshield agent setup
|
|
20
|
+
requestshield agent setup --codex
|
|
21
|
+
requestshield agent setup --claude
|
|
50
22
|
```
|
|
51
23
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
the CLI.
|
|
58
|
-
- `--yes` skips the interactive confirmation and is intended for automation.
|
|
59
|
-
|
|
60
|
-
Store the Secret Key in a backend secret manager immediately after creation.
|
|
24
|
+
`signin` starts a device authorization flow and prints the verification URL and
|
|
25
|
+
code for the customer to open manually. The returned session is stored under the user's standard
|
|
26
|
+
application-data directory with permissions restricted to that user. CI may
|
|
27
|
+
instead provide `REQUESTSHIELD_ACCESS_TOKEN`; environment tokens are never
|
|
28
|
+
persisted.
|
|
61
29
|
|
|
62
|
-
|
|
30
|
+
`keys create` asks for confirmation, then atomically deactivates the previous
|
|
31
|
+
application credentials and creates a new `appKey` + `apiSecret`. The public
|
|
32
|
+
app key and the backend-only secret are printed after success. The secret is
|
|
33
|
+
not stored by the CLI and cannot be retrieved again.
|
|
63
34
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
`CODEX_HOME` is not set. Restart Codex or start a new task after installation.
|
|
35
|
+
`agent setup` detects Codex or Claude and installs the bundled `requestshield`
|
|
36
|
+
skill into `~/.agents/skills` for Codex or `~/.claude/skills` for Claude. Use
|
|
37
|
+
`--codex` or `--claude` to select one directly. When both agents are detected,
|
|
38
|
+
an interactive terminal asks which one to use; non-interactive callers must
|
|
39
|
+
provide one of the flags. Existing content is preserved unless `--force` is
|
|
40
|
+
supplied.
|
|
71
41
|
|
|
72
|
-
|
|
73
|
-
replace the existing copy:
|
|
42
|
+
## Management API contract
|
|
74
43
|
|
|
75
|
-
|
|
76
|
-
requestshield agent setup --agent codex --force
|
|
77
|
-
```
|
|
44
|
+
### Start sign-in
|
|
78
45
|
|
|
79
|
-
|
|
46
|
+
`POST /v1/cli/signin`
|
|
80
47
|
|
|
81
|
-
```
|
|
82
|
-
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"client": "requestshield-cli"
|
|
51
|
+
}
|
|
83
52
|
```
|
|
84
53
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
to confirm with `y`, then runs:
|
|
54
|
+
The response contains `deviceCode`, `userCode`, `verificationUri`,
|
|
55
|
+
`expiresIn`, and `interval`.
|
|
88
56
|
|
|
89
|
-
|
|
90
|
-
npm install --global requestshield@<latest-version>
|
|
91
|
-
```
|
|
57
|
+
### Poll sign-in
|
|
92
58
|
|
|
93
|
-
|
|
94
|
-
the customer's machine. It does not replace an executable installed by the
|
|
95
|
-
Windows Inno Setup installer.
|
|
59
|
+
`POST /v1/cli/signin/token` with `{ "deviceCode": "..." }`.
|
|
96
60
|
|
|
97
|
-
|
|
61
|
+
Pending responses use HTTP 400 with `code` set to `authorization_pending` or
|
|
62
|
+
`slow_down`. A successful response contains `accessToken` and optional account
|
|
63
|
+
metadata.
|
|
98
64
|
|
|
99
|
-
|
|
65
|
+
### Rotate keys
|
|
100
66
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
requestshield --help
|
|
104
|
-
```
|
|
67
|
+
`POST /v1/cli/keys/rotate` with Bearer authentication and an empty JSON body.
|
|
68
|
+
The response contains `appKey` and one-time `apiSecret`.
|
|
105
69
|
|
|
106
|
-
|
|
70
|
+
## Development
|
|
107
71
|
|
|
108
72
|
```console
|
|
109
|
-
|
|
110
|
-
|
|
73
|
+
pnpm --filter requestshield lint
|
|
74
|
+
pnpm --filter requestshield typecheck
|
|
75
|
+
pnpm --filter requestshield test
|
|
76
|
+
pnpm --filter requestshield build
|
|
111
77
|
```
|
|
78
|
+
## Quick start
|
|
112
79
|
|
|
113
|
-
|
|
80
|
+
RequestShield requires Node.js 22.13 or newer.
|
|
114
81
|
|
|
115
|
-
|
|
82
|
+
Run without installing globally:
|
|
116
83
|
|
|
117
84
|
```console
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
node src/main.mjs --version
|
|
85
|
+
npx requestshield --help
|
|
86
|
+
npx requestshield signin
|
|
87
|
+
npx requestshield keys create
|
|
88
|
+
npx requestshield agent setup
|
|
89
|
+
npx requestshield agent setup --codex
|
|
90
|
+
npx requestshield agent setup --claude
|
|
125
91
|
```
|
|
126
92
|
|
|
127
|
-
|
|
128
|
-
the standalone Windows executable.
|
|
93
|
+
Pin a specific version for reproducible usage:
|
|
129
94
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
```powershell
|
|
133
|
-
$env:REQUESTSHIELD_MOCK_LATEST_VERSION = "0.1.3"
|
|
134
|
-
pnpm test:update-check:manual
|
|
135
|
-
Remove-Item Env:REQUESTSHIELD_MOCK_LATEST_VERSION
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
The manual test prints `[MOCK] Would install ...`; it intentionally does not
|
|
139
|
-
change the installed CLI version.
|
|
140
|
-
|
|
141
|
-
## Build the standalone Windows executable
|
|
142
|
-
|
|
143
|
-
The project uses Node.js Single Executable Applications (SEA). Run these steps
|
|
144
|
-
from the `requestshield-cli` directory in PowerShell:
|
|
145
|
-
|
|
146
|
-
```powershell
|
|
147
|
-
New-Item -ItemType Directory -Force -Path .\dist | Out-Null
|
|
148
|
-
pnpm exec esbuild .\src\main.mjs --bundle --platform=node --format=cjs --target=node22 --outfile=.\dist\requestshield.cjs
|
|
149
|
-
node --experimental-sea-config .\sea-config.json
|
|
150
|
-
Copy-Item (Get-Command node.exe).Source .\dist\requestshield.exe -Force
|
|
151
|
-
pnpm exec postject .\dist\requestshield.exe NODE_SEA_BLOB .\dist\requestshield.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
|
|
152
|
-
.\dist\requestshield.exe --help
|
|
95
|
+
```console
|
|
96
|
+
npx requestshield@0.1.0 --help
|
|
153
97
|
```
|
|
154
98
|
|
|
155
|
-
|
|
156
|
-
not require Node.js to be installed on the customer's machine.
|
|
157
|
-
|
|
158
|
-
## Build the Windows installer
|
|
99
|
+
## Packaging the bundled skill
|
|
159
100
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
New-Item -ItemType Directory -Force -Path .\release | Out-Null
|
|
165
|
-
& "$env:LOCALAPPDATA\Programs\Inno Setup 6\ISCC.exe" "/DAppVersion=0.1.2" "/FRequestShieldSetup-0.1.2-windows-x64" ".\installer\requestshield.iss"
|
|
166
|
-
```
|
|
101
|
+
The canonical RequestShield skill lives at `../skills/requestshield`, outside
|
|
102
|
+
this npm package directory. The `prepack` hook temporarily copies the complete
|
|
103
|
+
skill into `skills/requestshield`, and `postpack` removes that generated copy
|
|
104
|
+
after npm creates the tarball. Do not edit the generated copy.
|
|
167
105
|
|
|
168
|
-
|
|
169
|
-
It installs `requestshield.exe` under the current user's local application-data
|
|
170
|
-
directory and adds that directory to the user `PATH`. The customer must open a
|
|
171
|
-
new terminal before running:
|
|
106
|
+
Build and inspect a local package from this directory:
|
|
172
107
|
|
|
173
108
|
```console
|
|
174
|
-
|
|
109
|
+
npm test
|
|
110
|
+
npm run typecheck
|
|
111
|
+
npm run lint
|
|
112
|
+
npm pack --dry-run
|
|
175
113
|
```
|
|
176
114
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
Before publishing, update `version` in `package.json`, run the checks, and
|
|
180
|
-
inspect the package contents:
|
|
115
|
+
To exercise the package entry point and bundled skill, create a tarball and run
|
|
116
|
+
the command through that tarball:
|
|
181
117
|
|
|
182
118
|
```console
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
pnpm test
|
|
186
|
-
pnpm pack --dry-run
|
|
187
|
-
pnpm publish --access public --no-git-checks
|
|
119
|
+
npm pack
|
|
120
|
+
npx --yes --package=./requestshield-0.1.0.tgz requestshield agent setup --codex
|
|
188
121
|
```
|
|
189
122
|
|
|
190
|
-
|
|
191
|
-
publishing, verify the registry state:
|
|
123
|
+
To automatically accept npm's installation prompt:
|
|
192
124
|
|
|
193
125
|
```console
|
|
194
|
-
|
|
195
|
-
npm dist-tag ls requestshield
|
|
196
|
-
npx --yes requestshield@0.1.2 --version
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
## Management API contract
|
|
200
|
-
|
|
201
|
-
### Start sign-in
|
|
202
|
-
|
|
203
|
-
`POST /v1/cli/signin`
|
|
204
|
-
|
|
205
|
-
```json
|
|
206
|
-
{
|
|
207
|
-
"client": "requestshield-cli"
|
|
208
|
-
}
|
|
126
|
+
npx --yes requestshield@0.1.0 --help
|
|
209
127
|
```
|
|
210
|
-
|
|
211
|
-
The response contains `deviceCode`, `userCode`, `verificationUri`, `expiresIn`,
|
|
212
|
-
and `interval`.
|
|
213
|
-
|
|
214
|
-
### Poll sign-in
|
|
215
|
-
|
|
216
|
-
`POST /v1/cli/signin/token` with `{ "deviceCode": "..." }`.
|
|
217
|
-
|
|
218
|
-
Pending responses use HTTP 400 with `code` set to `authorization_pending` or
|
|
219
|
-
`slow_down`. A successful response contains `accessToken` and optional account
|
|
220
|
-
metadata.
|
|
221
|
-
|
|
222
|
-
### Rotate keys
|
|
223
|
-
|
|
224
|
-
`POST /v1/cli/keys/rotate` with Bearer authentication and an empty JSON body.
|
|
225
|
-
The response contains `appKey` and the one-time `apiSecret`.
|
|
226
|
-
|
|
227
|
-
## Security notes
|
|
228
|
-
|
|
229
|
-
- Never place an access token or Secret Key in URLs, command arguments, logs,
|
|
230
|
-
fixtures, or committed files.
|
|
231
|
-
- The CLI does not persist the Secret Key returned by `keys create`.
|
|
232
|
-
- Sign the Windows executable and installer before distributing them to
|
|
233
|
-
customers, and publish a checksum through a trusted release channel.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "requestshield",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Customer CLI for RequestShield.",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "Customer CLI for IntelliFend RequestShield.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"requestshield": "src/main.mjs"
|
|
@@ -14,18 +14,20 @@
|
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">=22.13"
|
|
16
16
|
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "node scripts/check-package.mjs",
|
|
19
|
+
"lint": "node scripts/check-package.mjs",
|
|
20
|
+
"test": "node --test",
|
|
21
|
+
"typecheck": "tsc -p jsconfig.json --noEmit",
|
|
22
|
+
"prepack": "node scripts/package-skill.mjs stage",
|
|
23
|
+
"postpack": "node scripts/package-skill.mjs clean",
|
|
24
|
+
"prepublishOnly": "npm run lint && npm run typecheck && npm test"
|
|
25
|
+
},
|
|
17
26
|
"devDependencies": {
|
|
18
27
|
"@types/node": "26.1.1",
|
|
19
28
|
"esbuild": "^0.28.1",
|
|
20
29
|
"postject": "1.0.0-alpha.6",
|
|
21
30
|
"typescript": "^6.0.3"
|
|
22
31
|
},
|
|
23
|
-
"license": "UNLICENSED"
|
|
24
|
-
|
|
25
|
-
"build": "node scripts/check-package.mjs",
|
|
26
|
-
"lint": "node scripts/check-package.mjs",
|
|
27
|
-
"test": "node --test",
|
|
28
|
-
"test:update-check:manual": "node scripts/manual-update-check.mjs",
|
|
29
|
-
"typecheck": "tsc -p jsconfig.json --noEmit"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
+
"license": "UNLICENSED"
|
|
33
|
+
}
|