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 CHANGED
@@ -1,233 +1,127 @@
1
1
  # RequestShield CLI
2
2
 
3
- Customer-facing command-line tool for RequestShield. The CLI lets a customer
4
- sign in, rotate application credentials, install the RequestShield Skill for
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 when running from source, npm, or npx.
12
- - pnpm for local development and release builds.
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 full command catalog shown by `requestshield --help` includes planned
31
- commands. Only the commands listed above are currently implemented.
11
+ The API defaults to `https://api.intellifend.ai`. For development, set
12
+ `REQUESTSHIELD_API_URL` to the management API origin.
32
13
 
33
- ### Sign in
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
- Asks the customer to type `ROTATE`, then atomically deactivates the previous
53
- credentials and creates a new `appKey` and `apiSecret`.
54
-
55
- - `appKey` identifies the application and may be used by the client integration.
56
- - `apiSecret` is a backend-only secret, is displayed once, and is not saved by
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
- ### Install the Codex Skill
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
- ```console
65
- requestshield agent setup --agent codex
66
- ```
67
-
68
- Installs the bundled RequestShield Skill into
69
- `$CODEX_HOME/skills/requestshield`, or `~/.codex/skills/requestshield` when
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
- If that Skill already exists, the command preserves it. Use `--force` to
73
- replace the existing copy:
42
+ ## Management API contract
74
43
 
75
- ```console
76
- requestshield agent setup --agent codex --force
77
- ```
44
+ ### Start sign-in
78
45
 
79
- ### Check for updates
46
+ `POST /v1/cli/signin`
80
47
 
81
- ```console
82
- requestshield update check
48
+ ```json
49
+ {
50
+ "client": "requestshield-cli"
51
+ }
83
52
  ```
84
53
 
85
- Reads the latest `requestshield` version from the npm registry. If a newer
86
- version exists, the CLI displays the current and latest versions, asks the user
87
- to confirm with `y`, then runs:
54
+ The response contains `deviceCode`, `userCode`, `verificationUri`,
55
+ `expiresIn`, and `interval`.
88
56
 
89
- ```console
90
- npm install --global requestshield@<latest-version>
91
- ```
57
+ ### Poll sign-in
92
58
 
93
- This updater is for npm global installations and requires `node` and `npm` on
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
- ## Install and run with npm
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
- Install globally so `requestshield` is available from any directory:
65
+ ### Rotate keys
100
66
 
101
- ```console
102
- npm install --global requestshield
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
- Run without a global installation:
70
+ ## Development
107
71
 
108
72
  ```console
109
- npx --yes requestshield@0.1.2 --help
110
- npx --yes requestshield@0.1.2 signin
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
- ## Local development
80
+ RequestShield requires Node.js 22.13 or newer.
114
81
 
115
- From the `requestshield-cli` directory:
82
+ Run without installing globally:
116
83
 
117
84
  ```console
118
- pnpm install
119
- pnpm lint
120
- pnpm typecheck
121
- pnpm test
122
- pnpm build
123
- node src/main.mjs --help
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
- `build` currently validates the syntax of all `.mjs` files. It does not create
128
- the standalone Windows executable.
93
+ Pin a specific version for reproducible usage:
129
94
 
130
- To test the update interaction without publishing or installing anything:
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
- The generated file is `dist\requestshield.exe`. It contains Node.js and does
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
- Install Inno Setup 6, then compile the installer and pass the current package
161
- version explicitly:
162
-
163
- ```powershell
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
- The installer is written to `release\RequestShieldSetup-0.1.2-windows-x64.exe`.
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
- requestshield --help
109
+ npm test
110
+ npm run typecheck
111
+ npm run lint
112
+ npm pack --dry-run
175
113
  ```
176
114
 
177
- ## Publish to npm
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
- pnpm lint
184
- pnpm typecheck
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
- npm may ask for a one-time password in the interactive terminal. After
191
- publishing, verify the registry state:
123
+ To automatically accept npm's installation prompt:
192
124
 
193
125
  ```console
194
- npm view requestshield version
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.2",
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
- "scripts": {
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
+ }