@http-forge/cli 0.2.5 → 0.2.12
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 +97 -532
- package/dist/commands/generate.d.ts +14 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/generate.js +146 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/launch.d.ts +2 -0
- package/dist/commands/launch.d.ts.map +1 -0
- package/dist/commands/launch.js +96 -0
- package/dist/commands/launch.js.map +1 -0
- package/dist/commands.d.ts +2 -0
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +5 -1
- package/dist/commands.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -1
- package/package.json +30 -5
- package/scripts/http-forge.bat +157 -0
- package/scripts/http-forge.sh +167 -0
package/README.md
CHANGED
|
@@ -1,596 +1,161 @@
|
|
|
1
1
|
# HTTP Forge CLI
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
- [Installation](#installation)
|
|
8
|
-
- [Commands](#commands)
|
|
9
|
-
- [run](#run-command)
|
|
10
|
-
- [generate-collection](#generate-collection)
|
|
11
|
-
- [suggest-env](#suggest-env)
|
|
12
|
-
- [schedule](#schedule)
|
|
13
|
-
- [mcp](#5-manage-mcp-server)
|
|
14
|
-
- [copy-as](#6-copy-as-code-snippet)
|
|
15
|
-
- [list](#7-list-workspace-resources)
|
|
16
|
-
- [env](#8-manage-environment-variables)
|
|
17
|
-
- [Reporters](#reporters)
|
|
18
|
-
- [CI/CD Integration](#cicd-integration)
|
|
19
|
-
- [Variables & Secrets](#variables--secrets)
|
|
20
|
-
- [Environment Variables](#environment-variables)
|
|
21
|
-
- [Exit Codes](#exit-codes)
|
|
22
|
-
- [Output Format](#output-format)
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
## Installation
|
|
3
|
+
[](https://www.npmjs.com/package/@http-forge/cli)
|
|
4
|
+
[](https://www.npmjs.com/package/@http-forge/cli)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://www.npmjs.com/package/@http-forge/cli)
|
|
27
7
|
|
|
28
|
-
|
|
29
|
-
npm install --global @http-forge/cli
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Or use directly from the monorepo:
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
cd http-forge.cli
|
|
36
|
-
npm install
|
|
37
|
-
npm run build
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## Commands
|
|
43
|
-
|
|
44
|
-
### `run` command
|
|
45
|
-
|
|
46
|
-
Execute requests using the positional form `http-forge run <type> <name>`:
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
# Run a collection by name
|
|
50
|
-
http-forge run collection "Auth Flow" --env staging
|
|
51
|
-
|
|
52
|
-
# Run a test suite by name or id
|
|
53
|
-
http-forge run suite "Regression" --env prod --stop-on-error --exit-code
|
|
54
|
-
|
|
55
|
-
# Run a single request (needs --collection)
|
|
56
|
-
http-forge run request "Login" --collection "Auth" --env dev
|
|
57
|
-
|
|
58
|
-
# Run all requests under a folder (needs --collection)
|
|
59
|
-
http-forge run folder "Auth/Login" --collection "Auth" --env dev
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
`--env` is a short form of `--environment`. Both default to `$HTTP_FORGE_ENV` when not set.
|
|
8
|
+
The standalone launcher, terminal, and automation CLI for HTTP Forge.
|
|
63
9
|
|
|
64
|
-
|
|
10
|
+
Start HTTP Forge in UI mode from terminal, run API collections and suites in CI/CD, manage MCP server lifecycle, and generate JUnit/HTML reports for pipelines.
|
|
65
11
|
|
|
66
|
-
|
|
12
|
+
Postman alternative for local-first, Git-friendly API workflows in both UI and CLI modes.
|
|
67
13
|
|
|
68
|
-
|
|
69
|
-
# Run by pointing at the collection directory (contains collection.json)
|
|
70
|
-
http-forge run collections/auth-flow --env staging
|
|
14
|
+
## Who It Is For
|
|
71
15
|
|
|
72
|
-
|
|
73
|
-
|
|
16
|
+
- Developers who want to launch standalone HTTP Forge from terminal.
|
|
17
|
+
- Developers who want to run API collections from terminal.
|
|
18
|
+
- QA teams who need repeatable suite runs and JUnit reports.
|
|
19
|
+
- CI/CD pipelines that need API test gating without a GUI.
|
|
20
|
+
- Agent workflows that need MCP server lifecycle commands.
|
|
74
21
|
|
|
75
|
-
|
|
76
|
-
http-forge run collections/auth-flow/Login --env dev
|
|
22
|
+
## Why HTTP Forge CLI
|
|
77
23
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
| `suite.json` | `run suite <name>` |
|
|
85
|
-
| `collection.json` | `run collection <name>` |
|
|
86
|
-
| `folder.json` (or directory inside a collection) | `run folder <path>` |
|
|
87
|
-
| `request.json` | `run request <name>` |
|
|
88
|
-
|
|
89
|
-
Path-based dispatch is useful when navigating a workspace in a terminal — `cd` into a folder and pass its relative path directly.
|
|
90
|
-
|
|
91
|
-
---
|
|
92
|
-
|
|
93
|
-
### 1. `run request`
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
http-forge run request "get-users" \
|
|
97
|
-
--collection my-api \
|
|
98
|
-
--environment production
|
|
99
|
-
```
|
|
24
|
+
- Launch HTTP Forge in standalone UI mode with one command.
|
|
25
|
+
- Run API tests in CI/CD without a GUI.
|
|
26
|
+
- Use the same HTTP Forge workspace in editor and terminal.
|
|
27
|
+
- Generate JUnit and HTML reports for team visibility.
|
|
28
|
+
- Manage MCP server lifecycle for agent workflows.
|
|
29
|
+
- Work with OpenAPI, environments, and Postman-style scripts in one toolchain.
|
|
100
30
|
|
|
101
|
-
|
|
102
|
-
- `--collection <ref>` — Collection id, slug, or display name
|
|
103
|
-
- First positional arg — Request id, slug, or display name
|
|
31
|
+
## Works With
|
|
104
32
|
|
|
105
|
-
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
- `--var <KEY=VALUE>` — Override a variable (repeatable; highest priority)
|
|
110
|
-
- `--include <field>` — Extra response fields: `headers`, `cookies`, `tests`, `consoleOutput`
|
|
111
|
-
- `--reporter <spec>` — Generate a report (see [Reporters](#reporters))
|
|
112
|
-
- `--exit-code` — Exit 1 when any assertion fails
|
|
113
|
-
- `--output <fmt>` — `json` (default) or `table`
|
|
33
|
+
- HTTP Forge workspaces and collections
|
|
34
|
+
- OpenAPI specs
|
|
35
|
+
- Postman imports
|
|
36
|
+
- GitHub Actions, Jenkins, GitLab CI, and other pipelines
|
|
114
37
|
|
|
115
|
-
|
|
38
|
+
## 1-Minute Quickstart
|
|
116
39
|
|
|
117
40
|
```bash
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
--include perRequest
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
**Required:**
|
|
124
|
-
- First positional arg — Collection id, slug, or display name
|
|
125
|
-
|
|
126
|
-
**Optional:**
|
|
127
|
-
- `--workspace <path>` — Workspace folder (default: `$HTTP_FORGE_WORKSPACE` or cwd)
|
|
128
|
-
- `--environment <name>` — Environment to activate (default: `$HTTP_FORGE_ENV`)
|
|
129
|
-
- `--env <name>` — Short form of `--environment`
|
|
130
|
-
- `--var <KEY=VALUE>` — Override a variable (repeatable)
|
|
131
|
-
- `--iterations <num>` — Number of iterations (default: 1)
|
|
132
|
-
- `--concurrency <num>` — Parallel virtual users (default: 1)
|
|
133
|
-
- `--stop-on-error` — Stop on first failure
|
|
134
|
-
- `--delay <ms>` — Delay between requests in milliseconds
|
|
135
|
-
- `--include <field>` — Extra fields: `perRequest`, `failedOnly`, `consoleOutput`
|
|
136
|
-
- `--reporter <spec>` — Generate a report (see [Reporters](#reporters))
|
|
137
|
-
- `--exit-code` — Exit 1 when any assertion fails
|
|
138
|
-
- `--output <fmt>` — `json` or `table`
|
|
41
|
+
# 1) Install
|
|
42
|
+
npm install --global @http-forge/cli
|
|
139
43
|
|
|
140
|
-
|
|
44
|
+
# 2) Launch standalone HTTP Forge UI
|
|
45
|
+
http-forge launch
|
|
141
46
|
|
|
142
|
-
|
|
47
|
+
# 3) Run a collection
|
|
48
|
+
http-forge run collection "my-api" --env dev --exit-code
|
|
143
49
|
|
|
144
|
-
|
|
145
|
-
http-forge run
|
|
146
|
-
--
|
|
147
|
-
--environment staging
|
|
50
|
+
# 4) Run a suite with JUnit report for CI
|
|
51
|
+
http-forge run suite "smoke-tests" --env staging \
|
|
52
|
+
--reporter junit:results/junit.xml --exit-code
|
|
148
53
|
```
|
|
149
54
|
|
|
150
|
-
|
|
151
|
-
- First positional arg — Folder path (slash-separated, e.g. `"Auth/Login"`)
|
|
152
|
-
- `--collection <ref>` — Collection id, slug, or display name
|
|
153
|
-
|
|
154
|
-
**Optional:**
|
|
155
|
-
- `--no-recursive` — Run only direct children of the folder (default includes sub-folders)
|
|
156
|
-
- `--workspace <path>` — Workspace folder (default: `$HTTP_FORGE_WORKSPACE` or cwd)
|
|
157
|
-
- `--environment <name>` — Environment to activate (default: `$HTTP_FORGE_ENV`)
|
|
158
|
-
- `--env <name>` — Short form of `--environment`
|
|
159
|
-
- `--var <KEY=VALUE>` — Override a variable (repeatable)
|
|
160
|
-
- `--iterations <num>` — Number of iterations (default: 1)
|
|
161
|
-
- `--concurrency <num>` — Parallel virtual users (default: 1)
|
|
162
|
-
- `--stop-on-error` — Stop on first failure
|
|
163
|
-
- `--delay <ms>` — Delay between requests in milliseconds
|
|
164
|
-
- `--include <field>` — Extra fields: `perRequest`, `failedOnly`, `consoleOutput`
|
|
165
|
-
- `--reporter <spec>` — Generate a report (see [Reporters](#reporters))
|
|
166
|
-
- `--exit-code` — Exit 1 when any assertion fails
|
|
167
|
-
- `--output <fmt>` — `json` or `table`
|
|
168
|
-
|
|
169
|
-
```bash
|
|
170
|
-
http-forge run suite smoke-tests \
|
|
171
|
-
--environment staging \
|
|
172
|
-
--reporter junit:results/junit.xml \
|
|
173
|
-
--exit-code
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
**Required:**
|
|
177
|
-
- First positional arg — Suite name or id (case-insensitive name matching supported)
|
|
178
|
-
|
|
179
|
-
**Optional:**
|
|
180
|
-
- `--workspace <path>` — Workspace folder (default: `$HTTP_FORGE_WORKSPACE` or cwd)
|
|
181
|
-
- `--environment <name>` — Environment to activate (default: `$HTTP_FORGE_ENV`)
|
|
182
|
-
- `--env <name>` — Short form of `--environment`
|
|
183
|
-
- `--var <KEY=VALUE>` — Override a variable (repeatable)
|
|
184
|
-
- `--iterations <num>` — Number of iterations
|
|
185
|
-
- `--concurrency <num>` — Parallel virtual users (default: 1)
|
|
186
|
-
- `--stop-on-error` — Stop on first failure
|
|
187
|
-
- `--delay <ms>` — Delay between requests in milliseconds
|
|
188
|
-
- `--include <field>` — Extra fields: `perRequest`, `failedOnly`, `consoleOutput`
|
|
189
|
-
- `--reporter <spec>` — Generate a report (see [Reporters](#reporters))
|
|
190
|
-
- `--exit-code` — Exit 1 when any assertion fails
|
|
191
|
-
- `--output <fmt>` — `json` or `table`
|
|
192
|
-
|
|
193
|
-
---
|
|
194
|
-
|
|
195
|
-
### `generate-collection`
|
|
196
|
-
|
|
197
|
-
Create an HTTP Forge collection from a **curl command**, a **Postman Collection** export, or an **OpenAPI spec**. Optionally enhance the resulting collection with AI.
|
|
55
|
+
## Install
|
|
198
56
|
|
|
199
57
|
```bash
|
|
200
|
-
|
|
201
|
-
http-forge generate-collection --curl "curl -X POST https://api.example.com/users \
|
|
202
|
-
-H 'Authorization: Bearer sk-abc123' \
|
|
203
|
-
-d '{\"name\":\"Alice\"}'" \
|
|
204
|
-
--env dev
|
|
205
|
-
|
|
206
|
-
# From a Postman Collection v2.x export
|
|
207
|
-
http-forge generate-collection --postman ./MyApi.postman_collection.json
|
|
208
|
-
|
|
209
|
-
# From an OpenAPI spec — creates a collection and an environment from server URLs
|
|
210
|
-
http-forge generate-collection --openapi ./openapi.yaml \
|
|
211
|
-
--name "Payments API" --create-envs --env staging
|
|
212
|
-
|
|
213
|
-
# Any source + AI enhancement (requires OPENAI_API_KEY or ANTHROPIC_API_KEY)
|
|
214
|
-
http-forge generate-collection --postman ./MyApi.postman_collection.json --ai
|
|
215
|
-
http-forge generate-collection --openapi ./openapi.yaml --create-envs --ai
|
|
58
|
+
npm install --global @http-forge/cli
|
|
216
59
|
```
|
|
217
60
|
|
|
218
|
-
|
|
219
|
-
- `--curl <cmd>` — curl command string (quote the whole thing)
|
|
220
|
-
- `--postman <file>` — Postman Collection v2.x JSON file
|
|
221
|
-
- `--openapi <file>` — OpenAPI 3.0 spec (`.json`, `.yaml`, `.yml`)
|
|
222
|
-
|
|
223
|
-
**Options:**
|
|
224
|
-
- `--name <name>` — Collection name (default: derived from source)
|
|
225
|
-
- `--env <name>` — `curl`: write detected vars to this env · `openapi`: create env from server URLs
|
|
226
|
-
- `--create-envs` — `openapi`: create environments from all server URLs
|
|
227
|
-
- `--ai` — Enhance the collection with AI after import (writes realistic example bodies and `pm.test()` assertions).
|
|
228
|
-
Requires `OPENAI_API_KEY` or `ANTHROPIC_API_KEY`. Override model via `OPENAI_MODEL` / `ANTHROPIC_MODEL`. Force provider with `HTTP_FORGE_AI_PROVIDER=openai|anthropic`.
|
|
229
|
-
- `--workspace <path>` — Workspace folder (default: `$HTTP_FORGE_WORKSPACE` or cwd)
|
|
230
|
-
- `--output json|table` — Output format (default: `json`)
|
|
231
|
-
|
|
232
|
-
---
|
|
233
|
-
|
|
234
|
-
### `suggest-env`
|
|
235
|
-
|
|
236
|
-
Scan a collection for hardcoded values (API keys, base URLs, tokens, IDs) and suggest replacing them with `{{ENV_VAR}}` placeholders. Runs dry-run by default; add `--apply` to write changes.
|
|
61
|
+
From monorepo:
|
|
237
62
|
|
|
238
63
|
```bash
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
# Dry-run with AI detection (better recall for complex collections)
|
|
243
|
-
OPENAI_API_KEY=sk-... http-forge suggest-env --collection my-api --ai --output table
|
|
244
|
-
|
|
245
|
-
# Apply: replace in collection and write original values to "staging" env
|
|
246
|
-
http-forge suggest-env --collection my-api --apply --env staging
|
|
247
|
-
|
|
248
|
-
# Apply with AI detection
|
|
249
|
-
http-forge suggest-env --collection my-api --ai --apply --env staging
|
|
250
|
-
|
|
251
|
-
# Only flag values appearing in 3+ requests
|
|
252
|
-
http-forge suggest-env --collection my-api --min-occurrences 3 --output table
|
|
64
|
+
cd http-forge.cli
|
|
65
|
+
npm install
|
|
66
|
+
npm run build
|
|
253
67
|
```
|
|
254
68
|
|
|
255
|
-
|
|
256
|
-
- `--collection <ref>` — Collection name, slug, or id
|
|
257
|
-
|
|
258
|
-
**Options:**
|
|
259
|
-
- `--apply` — Replace hardcoded values in the collection and write originals to the target env
|
|
260
|
-
- `--env <name>` — Target environment for `--apply` (default: active env)
|
|
261
|
-
- `--ai` — Use AI for detection instead of heuristic rules.
|
|
262
|
-
Requires `OPENAI_API_KEY` or `ANTHROPIC_API_KEY`. Ignores `--min-occurrences` (AI determines relevance).
|
|
263
|
-
- `--min-occurrences <n>` — Only suggest values appearing in ≥ N request locations (default: 1; heuristic mode only)
|
|
264
|
-
- `--workspace <path>` — Workspace folder (default: `$HTTP_FORGE_WORKSPACE` or cwd)
|
|
265
|
-
- `--output json|table` — Output format (default: `json`)
|
|
69
|
+
## Core Commands
|
|
266
70
|
|
|
267
|
-
|
|
71
|
+
| Command | Purpose |
|
|
72
|
+
|---|---|
|
|
73
|
+
| `http-forge launch` | Launch standalone HTTP Forge UI (`--test`, `--dev`, `--both`) |
|
|
74
|
+
| `http-forge run ...` | Run a request, folder, collection, or suite |
|
|
75
|
+
| `http-forge mcp ...` | Start/stop/status for MCP server |
|
|
76
|
+
| `http-forge list ...` | List collections, suites, requests, folders, environments |
|
|
77
|
+
| `http-forge env ...` | Get/set/unset environment variables |
|
|
78
|
+
| `http-forge generate ...` | Generate typed TypeScript API clients from collections |
|
|
79
|
+
| `http-forge generate-collection ...` | Create collection from curl, Postman, or OpenAPI |
|
|
80
|
+
| `http-forge suggest-env ...` | Detect hardcoded values and suggest env vars |
|
|
81
|
+
| `http-forge schedule ...` | Generate scheduled CI workflow/cron config |
|
|
82
|
+
| `http-forge copy-as ...` | Export request as curl/fetch/python snippet |
|
|
268
83
|
|
|
269
|
-
|
|
84
|
+
## Generate Typed Clients
|
|
270
85
|
|
|
271
|
-
|
|
86
|
+
Use one consistent command for code generation in the HTTP Forge family:
|
|
272
87
|
|
|
273
88
|
```bash
|
|
274
|
-
#
|
|
275
|
-
http-forge
|
|
89
|
+
# Generate all collections
|
|
90
|
+
http-forge generate --input ./collections --output ./api-clients
|
|
276
91
|
|
|
277
|
-
#
|
|
278
|
-
http-forge
|
|
279
|
-
--cron "0 2 * * *" --output .github/workflows/nightly.yml
|
|
92
|
+
# Generate one collection
|
|
93
|
+
http-forge generate --input ./collections --output ./api-clients --collection forgerock-login
|
|
280
94
|
|
|
281
|
-
# Generate
|
|
282
|
-
http-forge
|
|
283
|
-
|
|
284
|
-
# Print a cron entry only (no file written)
|
|
285
|
-
http-forge schedule --suite smoke-tests --print-cron
|
|
286
|
-
|
|
287
|
-
# Custom reporter path
|
|
288
|
-
http-forge schedule --suite e2e --reporter "junit:test-results/e2e.xml"
|
|
95
|
+
# Generate one request
|
|
96
|
+
http-forge generate --input ./collections --output ./api-clients --request forgerock-login/login-request
|
|
289
97
|
```
|
|
290
98
|
|
|
291
|
-
|
|
292
|
-
- `--suite <name>` — Test suite name, slug, or id
|
|
293
|
-
|
|
294
|
-
**Options:**
|
|
295
|
-
- `--env <name>` — Environment to pass to the suite run
|
|
296
|
-
- `--cron <expr>` — Cron schedule expression (default: `"0 */6 * * *"` — every 6 hours)
|
|
297
|
-
- `--output <path>` — Output file path (default: `.github/workflows/http-forge-<suite>.yml`)
|
|
298
|
-
- `--reporter <spec>` — Reporter spec, e.g. `junit:results/junit.xml` (default: `junit`)
|
|
299
|
-
- `--no-exit-code` — Do not fail the CI job on assertion failures
|
|
300
|
-
- `--format github-actions|cron|both` — Output format (default: `github-actions`)
|
|
301
|
-
- `--print-cron` — Print a cron entry to stdout (alias for `--format cron`)
|
|
302
|
-
- `--workspace <path>` — Workspace folder (default: `$HTTP_FORGE_WORKSPACE` or cwd)
|
|
303
|
-
|
|
304
|
-
The generated GitHub Actions workflow includes: Node 20 setup, `npm install -g @http-forge/cli`, the run step with configurable reporter and exit-code gate, artifact upload (30-day retention), and an optional JUnit publish step.
|
|
99
|
+
This command delegates to `@http-forge/codegen` under the hood.
|
|
305
100
|
|
|
306
|
-
|
|
101
|
+
Migration notes from `http-forge-codegen` are in [docs/cli-reference.md](docs/cli-reference.md#migration-from-http-forge-codegen).
|
|
307
102
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
Start, stop, or check the status of an embedded MCP (Model Context Protocol) server for AI agent integration:
|
|
103
|
+
## Launch Modes
|
|
311
104
|
|
|
312
105
|
```bash
|
|
313
|
-
|
|
314
|
-
http-forge
|
|
315
|
-
http-forge mcp stop
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
**Actions:** `start` | `stop` | `status`
|
|
319
|
-
|
|
320
|
-
**Options:**
|
|
321
|
-
- `--port <num>` — Port to listen on (default: 3100)
|
|
322
|
-
- `--host <addr>` — Host to bind to (default: 127.0.0.1)
|
|
323
|
-
- `--workspace <path>` — Workspace folder (default: `$HTTP_FORGE_WORKSPACE` or cwd)
|
|
324
|
-
|
|
325
|
-
---
|
|
326
|
-
|
|
327
|
-
### 6. Copy-as Code Snippet
|
|
328
|
-
|
|
329
|
-
Generate a ready-to-run code snippet for a request in cURL, JavaScript fetch, or Python:
|
|
330
|
-
|
|
331
|
-
```bash
|
|
332
|
-
http-forge copy-as \
|
|
333
|
-
--collection my-api \
|
|
334
|
-
--request get-users \
|
|
335
|
-
--lang curl
|
|
336
|
-
|
|
337
|
-
http-forge copy-as \
|
|
338
|
-
--collection my-api \
|
|
339
|
-
--request "Create User" \
|
|
340
|
-
--lang python \
|
|
341
|
-
--environment staging
|
|
342
|
-
```
|
|
343
|
-
|
|
344
|
-
**Required:**
|
|
345
|
-
- `--collection <ref>` — Collection id, slug, or display name
|
|
346
|
-
- `--request <ref>` — Request id, slug, or display name
|
|
347
|
-
- `--lang <name>` — Target language: `curl`, `fetch`, `python`
|
|
106
|
+
# Default: standalone HTTP Forge profile
|
|
107
|
+
http-forge launch
|
|
348
108
|
|
|
349
|
-
|
|
350
|
-
-
|
|
351
|
-
- `--workspace <path>` — Workspace folder (default: current directory)
|
|
352
|
-
- `--environment <name>` — Environment to resolve variables against
|
|
109
|
+
# Use your normal VS Code profile
|
|
110
|
+
http-forge launch --dev
|
|
353
111
|
|
|
354
|
-
|
|
112
|
+
# Open both test and dev profiles
|
|
113
|
+
http-forge launch --both
|
|
355
114
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
Inspect collections, suites, environments, and requests without starting a run:
|
|
359
|
-
|
|
360
|
-
```bash
|
|
361
|
-
http-forge list collections
|
|
362
|
-
http-forge list suites --output table
|
|
363
|
-
http-forge list environments --workspace /path/to/project
|
|
364
|
-
http-forge list requests --collection my-api
|
|
365
|
-
http-forge list requests --collection my-api --folder Auth --output table
|
|
366
|
-
http-forge list folders --collection my-api
|
|
367
|
-
http-forge list folders --collection my-api --folder Auth
|
|
115
|
+
# Open a workspace path
|
|
116
|
+
http-forge launch --dev /path/to/workspace
|
|
368
117
|
```
|
|
369
118
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
**Options:**
|
|
373
|
-
- `--workspace <path>` — Workspace folder (default: `$HTTP_FORGE_WORKSPACE` or cwd)
|
|
374
|
-
- `--collection <ref>` — Required for `requests` and `folders` subcommands
|
|
375
|
-
- `--folder <path>` — Scope to a sub-folder (for `requests` and `folders`)
|
|
376
|
-
- `--output <fmt>` — `json` (default) or `table`
|
|
119
|
+
Use `http-forge launch` when you want the standalone HTTP Forge UI from terminal.
|
|
377
120
|
|
|
378
|
-
|
|
121
|
+
The launcher auto-detects OS/shell and uses the matching script:
|
|
122
|
+
- Linux/macOS: `scripts/http-forge.sh`
|
|
123
|
+
- Windows: `scripts/http-forge.bat`
|
|
379
124
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
Read and write environment variables stored in the workspace config files:
|
|
125
|
+
## Common Run Patterns
|
|
383
126
|
|
|
384
127
|
```bash
|
|
385
|
-
#
|
|
386
|
-
http-forge env
|
|
128
|
+
# Collection
|
|
129
|
+
http-forge run collection "my-api" --env dev --include perRequest
|
|
387
130
|
|
|
388
|
-
#
|
|
389
|
-
http-forge env
|
|
390
|
-
http-forge env env get staging --output table
|
|
391
|
-
http-forge env get staging --no-values # show keys only
|
|
131
|
+
# Suite
|
|
132
|
+
http-forge run suite "smoke-tests" --env staging --exit-code
|
|
392
133
|
|
|
393
|
-
#
|
|
394
|
-
http-forge
|
|
395
|
-
http-forge env set staging API_KEY=my-secret-key # key=value syntax
|
|
134
|
+
# Request
|
|
135
|
+
http-forge run request "Get Users" --collection "my-api" --env dev
|
|
396
136
|
|
|
397
|
-
#
|
|
398
|
-
http-forge
|
|
137
|
+
# Folder
|
|
138
|
+
http-forge run folder "Auth/Login" --collection "my-api" --env dev
|
|
399
139
|
```
|
|
400
140
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
**Options:**
|
|
404
|
-
- `--workspace <path>` — Workspace folder (default: `$HTTP_FORGE_WORKSPACE` or cwd)
|
|
405
|
-
- `--output <fmt>` — `json` (default) or `table` (for `list` and `get`)
|
|
406
|
-
- `--no-values` — Show only key names, not values (for `get`)
|
|
407
|
-
|
|
408
|
-
> **Note:** `env set` writes permanently to the env JSON file on disk. Changes are picked up immediately by subsequent CLI runs in the same workspace.
|
|
409
|
-
>
|
|
410
|
-
> To set the active environment for a session, use the `HTTP_FORGE_ENV` environment variable instead of a CLI subcommand (e.g. `export HTTP_FORGE_ENV=staging`).
|
|
411
|
-
|
|
412
|
-
---
|
|
413
|
-
|
|
414
|
-
## Reporters
|
|
415
|
-
|
|
416
|
-
Reporters generate machine-readable or human-readable files from a run. Pass `--reporter` once per format; use the `name:path` syntax to set an explicit output path.
|
|
417
|
-
|
|
418
|
-
| Spec | Effect |
|
|
419
|
-
|---|---|
|
|
420
|
-
| `--reporter html` | HTML report to the default cache location |
|
|
421
|
-
| `--reporter html:reports/run.html` | HTML report copied to `reports/run.html` |
|
|
422
|
-
| `--reporter junit` | JUnit XML to the default cache location |
|
|
423
|
-
| `--reporter junit:results/junit.xml` | JUnit XML copied to `results/junit.xml` |
|
|
424
|
-
|
|
425
|
-
Reporters are **composable** — pass multiple to produce all formats in one run:
|
|
141
|
+
## CI/CD Example
|
|
426
142
|
|
|
427
143
|
```bash
|
|
428
|
-
http-forge run suite smoke-tests \
|
|
429
|
-
--
|
|
144
|
+
http-forge run suite "smoke-tests" \
|
|
145
|
+
--env staging \
|
|
430
146
|
--reporter junit:results/junit.xml \
|
|
431
147
|
--exit-code
|
|
432
148
|
```
|
|
433
149
|
|
|
434
|
-
|
|
435
|
-
- HTML reports require successful requests to produce content. Use `--reporter html` or the legacy `--include report` / `HTTP_FORGE_GENERATE_REPORTS=true` env var.
|
|
436
|
-
- JUnit XML is always produced when `--reporter junit` is set, even for runs with all failures (so CI tools can parse and display the failures).
|
|
437
|
-
- `--out <path>` is a deprecated alias for `--reporter junit:<path>` and still works but prints a warning.
|
|
438
|
-
|
|
439
|
-
---
|
|
440
|
-
|
|
441
|
-
## CI/CD Integration
|
|
442
|
-
|
|
443
|
-
> For a complete step-by-step guide with examples for GitHub Actions, Docker, and bare npm, see **[docs/ci-guide.md](docs/ci-guide.md)**.
|
|
444
|
-
>
|
|
445
|
-
> For **AI-driven failure analysis** (Claude automatically diagnoses failures and posts results as a PR comment), see [Option E — AI-driven analysis](docs/ci-guide.md#option-e--ai-driven-analysis-mcp--claude) in the CI guide.
|
|
446
|
-
|
|
447
|
-
### Quick start — GitHub Actions
|
|
448
|
-
|
|
449
|
-
```yaml
|
|
450
|
-
- name: Run API tests
|
|
451
|
-
run: |
|
|
452
|
-
http-forge run suite smoke-tests \
|
|
453
|
-
--workspace ./http-forge-assets \
|
|
454
|
-
--environment staging \
|
|
455
|
-
--reporter junit:test-results/junit.xml \
|
|
456
|
-
--exit-code
|
|
457
|
-
env:
|
|
458
|
-
API_KEY: ${{ secrets.API_KEY }}
|
|
459
|
-
|
|
460
|
-
- name: Upload results
|
|
461
|
-
if: always()
|
|
462
|
-
uses: actions/upload-artifact@v4
|
|
463
|
-
with:
|
|
464
|
-
name: api-test-results
|
|
465
|
-
path: test-results/junit.xml
|
|
466
|
-
```
|
|
467
|
-
|
|
468
|
-
### Using the composite action
|
|
469
|
-
|
|
470
|
-
```yaml
|
|
471
|
-
- uses: http-forge/http-forge.cli@main
|
|
472
|
-
with:
|
|
473
|
-
suite: smoke-tests
|
|
474
|
-
workspace: ./http-forge-assets
|
|
475
|
-
environment: staging
|
|
476
|
-
reporters: 'junit:test-results/junit.xml'
|
|
477
|
-
extra_args: '--var API_KEY=${{ secrets.API_KEY }}'
|
|
478
|
-
```
|
|
479
|
-
|
|
480
|
-
### Using Docker
|
|
481
|
-
|
|
482
|
-
```bash
|
|
483
|
-
docker run --rm \
|
|
484
|
-
-v "$PWD/http-forge-assets:/workspace" \
|
|
485
|
-
-v "$PWD/results:/results" \
|
|
486
|
-
ghcr.io/http-forge/cli:latest \
|
|
487
|
-
run suite smoke-tests \
|
|
488
|
-
--reporter junit:/results/junit.xml \
|
|
489
|
-
--exit-code
|
|
490
|
-
```
|
|
491
|
-
|
|
492
|
-
---
|
|
493
|
-
|
|
494
|
-
## Variables & Secrets
|
|
495
|
-
|
|
496
|
-
**Priority (highest → lowest):**
|
|
497
|
-
1. `--var KEY=VALUE` CLI flags
|
|
498
|
-
2. `process.env` (CI env vars, shell exports)
|
|
499
|
-
3. `<env>.local.json` credential overrides (gitignored)
|
|
500
|
-
4. `<env>.json` environment file
|
|
501
|
-
5. `_global.json` / `_global.local.json` globals
|
|
502
|
-
|
|
503
|
-
**Injecting secrets at runtime:**
|
|
504
|
-
|
|
505
|
-
```bash
|
|
506
|
-
http-forge run suite smoke-tests \
|
|
507
|
-
--var API_KEY=$CI_API_KEY \
|
|
508
|
-
--var BASE_URL=https://staging.example.com
|
|
509
|
-
```
|
|
510
|
-
|
|
511
|
-
**Secret providers** — reference secrets from AWS Secrets Manager, Azure Key Vault, GCP Secret Manager, HashiCorp Vault, 1Password, or Doppler using `{{secret:alias/path}}`. Credentials come from the environment (env vars, cloud identity, CLI session) — never hardcoded.
|
|
512
|
-
|
|
513
|
-
---
|
|
514
|
-
|
|
515
|
-
## Exit Codes
|
|
516
|
-
|
|
517
|
-
| Code | Meaning |
|
|
518
|
-
|---|---|
|
|
519
|
-
| `0` | Success — all assertions passed (or `--exit-code` not set) |
|
|
520
|
-
| `1` | Test failures — one or more assertions failed (only when `--exit-code` is set) |
|
|
521
|
-
| `2` | Invalid arguments, missing required options, or runtime error |
|
|
522
|
-
|
|
523
|
-
---
|
|
524
|
-
|
|
525
|
-
## Output Format
|
|
526
|
-
|
|
527
|
-
### JSON (default)
|
|
528
|
-
|
|
529
|
-
```json
|
|
530
|
-
{
|
|
531
|
-
"suite": "Smoke Tests",
|
|
532
|
-
"environment": "staging",
|
|
533
|
-
"summary": {
|
|
534
|
-
"total": 12,
|
|
535
|
-
"passed": 11,
|
|
536
|
-
"failed": 1,
|
|
537
|
-
"allPassed": false
|
|
538
|
-
},
|
|
539
|
-
"failedRequests": [
|
|
540
|
-
{
|
|
541
|
-
"name": "Create Order",
|
|
542
|
-
"status": 500,
|
|
543
|
-
"duration": "312ms",
|
|
544
|
-
"failedTests": [{ "name": "Status is 201", "message": "expected 500 to equal 201" }]
|
|
545
|
-
}
|
|
546
|
-
],
|
|
547
|
-
"junitReport": { "path": "/tmp/.http-forge-cache/results/smoke-tests/run-20260626-141501/junit.xml" }
|
|
548
|
-
}
|
|
549
|
-
```
|
|
550
|
-
|
|
551
|
-
### Table
|
|
552
|
-
|
|
553
|
-
```
|
|
554
|
-
Result: { suite: 'Smoke Tests', summary: { total: 12, passed: 11, failed: 1 } }
|
|
555
|
-
```
|
|
556
|
-
|
|
557
|
-
---
|
|
558
|
-
|
|
559
|
-
## MCP Server — JSON-RPC Usage
|
|
560
|
-
|
|
561
|
-
After starting the server with `http-forge mcp start`, call `POST /`.
|
|
562
|
-
|
|
563
|
-
```bash
|
|
564
|
-
# Initialize
|
|
565
|
-
curl -X POST http://127.0.0.1:3100 \
|
|
566
|
-
-H "Content-Type: application/json" \
|
|
567
|
-
-d '{ "jsonrpc":"2.0","id":1,"method":"initialize" }'
|
|
568
|
-
|
|
569
|
-
# List tools
|
|
570
|
-
curl -X POST http://127.0.0.1:3100 \
|
|
571
|
-
-H "Content-Type: application/json" \
|
|
572
|
-
-d '{ "jsonrpc":"2.0","id":2,"method":"tools/list" }'
|
|
573
|
-
|
|
574
|
-
# Call a tool
|
|
575
|
-
curl -X POST http://127.0.0.1:3100 \
|
|
576
|
-
-H "Content-Type: application/json" \
|
|
577
|
-
-d '{
|
|
578
|
-
"jsonrpc":"2.0","id":3,"method":"tools/call",
|
|
579
|
-
"params":{
|
|
580
|
-
"name":"run_request",
|
|
581
|
-
"arguments":{ "collection":"my-api","request":"get-users","environment":"dev" }
|
|
582
|
-
}
|
|
583
|
-
}'
|
|
584
|
-
|
|
585
|
-
# Health check
|
|
586
|
-
curl http://127.0.0.1:3100/health
|
|
587
|
-
```
|
|
588
|
-
|
|
589
|
-
---
|
|
150
|
+
Use this in CI to fail the pipeline on assertion failures and publish JUnit artifacts.
|
|
590
151
|
|
|
591
|
-
##
|
|
152
|
+
## Detailed Docs
|
|
592
153
|
|
|
593
|
-
|
|
154
|
+
- Full CLI reference: `docs/cli-reference.md`
|
|
155
|
+
- CI guide: `docs/ci-guide.md`
|
|
156
|
+
- Example workflow: `docs/ci-example.yml`
|
|
157
|
+
- HTTP Forge docs: https://github.com/hsl1230/http-forge/tree/main/docs/user-guide
|
|
594
158
|
|
|
595
|
-
|
|
159
|
+
## License
|
|
596
160
|
|
|
161
|
+
MIT
|