@http-forge/cli 0.2.5 → 0.2.11

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,596 +1,141 @@
1
1
  # HTTP Forge CLI
2
2
 
3
- Command-line interface for executing HTTP Forge collections, test suites, and MCP server operations — with built-in CI/CD support including JUnit and HTML reports.
4
-
5
- ## Table of Contents
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
+ [![npm version](https://img.shields.io/npm/v/%40http-forge%2Fcli)](https://www.npmjs.com/package/@http-forge/cli)
4
+ [![npm downloads](https://img.shields.io/npm/dm/%40http-forge%2Fcli)](https://www.npmjs.com/package/@http-forge/cli)
5
+ [![license](https://img.shields.io/npm/l/%40http-forge%2Fcli)](LICENSE)
6
+ [![node](https://img.shields.io/node/v/%40http-forge%2Fcli)](https://www.npmjs.com/package/@http-forge/cli)
27
7
 
28
- ```bash
29
- npm install --global @http-forge/cli
30
- ```
8
+ The standalone launcher, terminal, and automation CLI for HTTP Forge.
31
9
 
32
- Or use directly from the monorepo:
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.
33
11
 
34
- ```bash
35
- cd http-forge.cli
36
- npm install
37
- npm run build
38
- ```
12
+ Postman alternative for local-first, Git-friendly API workflows in both UI and CLI modes.
39
13
 
40
- ---
14
+ ## Who It Is For
41
15
 
42
- ## Commands
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.
43
21
 
44
- ### `run` command
22
+ ## Why HTTP Forge CLI
45
23
 
46
- Execute requests using the positional form `http-forge run <type> <name>`:
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.
47
30
 
48
- ```bash
49
- # Run a collection by name
50
- http-forge run collection "Auth Flow" --env staging
31
+ ## Works With
51
32
 
52
- # Run a test suite by name or id
53
- http-forge run suite "Regression" --env prod --stop-on-error --exit-code
33
+ - HTTP Forge workspaces and collections
34
+ - OpenAPI specs
35
+ - Postman imports
36
+ - GitHub Actions, Jenkins, GitLab CI, and other pipelines
54
37
 
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.
63
-
64
- #### Path-based dispatch
65
-
66
- You can also pass a workspace-relative **file path** instead of a type + name pair. HTTP Forge detects the run type from the target file:
38
+ ## 1-Minute Quickstart
67
39
 
68
40
  ```bash
69
- # Run by pointing at the collection directory (contains collection.json)
70
- http-forge run collections/auth-flow --env staging
71
-
72
- # Run a specific suite file
73
- http-forge run suites/regression.json --env prod --exit-code
74
-
75
- # Run a folder — collection is resolved automatically from the ancestor collection.json
76
- http-forge run collections/auth-flow/Login --env dev
77
-
78
- # Run a single request — collection is resolved automatically
79
- http-forge run collections/auth-flow/Login/get-token --env dev
80
- ```
81
-
82
- | Target file found | Equivalent command |
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
- ```
100
-
101
- **Required:**
102
- - `--collection <ref>` — Collection id, slug, or display name
103
- - First positional arg — Request id, slug, or display name
104
-
105
- **Optional:**
106
- - `--folder <path>` — Scope resolution to a sub-folder (slash-separated)
107
- - `--workspace <path>` — Workspace folder (default: current directory)
108
- - `--environment <name>` — Environment to activate
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`
114
-
115
- ### 2. `run collection`
116
-
117
- ```bash
118
- http-forge run collection my-api \
119
- --environment dev \
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`
139
-
140
- ### 3. `run folder`
141
-
142
- Run all requests under a specific folder within a collection.
143
-
144
- ```bash
145
- http-forge run folder "Auth/Login" \
146
- --collection my-api \
147
- --environment staging
148
- ```
149
-
150
- **Required:**
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
- ---
41
+ # 1) Install
42
+ npm install --global @http-forge/cli
194
43
 
195
- ### `generate-collection`
44
+ # 2) Launch standalone HTTP Forge UI
45
+ http-forge launch
196
46
 
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.
47
+ # 3) Run a collection
48
+ http-forge run collection "my-api" --env dev --exit-code
198
49
 
199
- ```bash
200
- # From a curl command
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
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
216
53
  ```
217
54
 
218
- **Sources (exactly one required):**
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.
55
+ ## Install
237
56
 
238
57
  ```bash
239
- # Dry-run (heuristic rules) — see what would be replaced
240
- http-forge suggest-env --collection my-api --output table
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
253
- ```
254
-
255
- **Required:**
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`)
266
-
267
- ---
268
-
269
- ### `schedule`
270
-
271
- Generate a CI schedule configuration for running an HTTP Forge suite automatically. Outputs a **GitHub Actions workflow** file, a **cron entry**, or both — no daemon required.
272
-
273
- ```bash
274
- # GitHub Actions workflow (default) — runs on push + every 6 hours
275
- http-forge schedule --suite smoke-tests --env staging
276
-
277
- # Custom cron schedule and output path
278
- http-forge schedule --suite regression --env prod \
279
- --cron "0 2 * * *" --output .github/workflows/nightly.yml
280
-
281
- # Generate both a GitHub Actions workflow and a cron entry
282
- http-forge schedule --suite smoke-tests --env staging --format both
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"
58
+ npm install --global @http-forge/cli
289
59
  ```
290
60
 
291
- **Required:**
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.
305
-
306
- ---
307
-
308
- ### 5. Manage MCP Server
309
-
310
- Start, stop, or check the status of an embedded MCP (Model Context Protocol) server for AI agent integration:
61
+ From monorepo:
311
62
 
312
63
  ```bash
313
- http-forge mcp start --port 3100
314
- http-forge mcp status
315
- http-forge mcp stop
64
+ cd http-forge.cli
65
+ npm install
66
+ npm run build
316
67
  ```
317
68
 
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
- ---
69
+ ## Core Commands
326
70
 
327
- ### 6. Copy-as Code Snippet
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-collection ...` | Create collection from curl, Postman, or OpenAPI |
79
+ | `http-forge suggest-env ...` | Detect hardcoded values and suggest env vars |
80
+ | `http-forge schedule ...` | Generate scheduled CI workflow/cron config |
81
+ | `http-forge copy-as ...` | Export request as curl/fetch/python snippet |
328
82
 
329
- Generate a ready-to-run code snippet for a request in cURL, JavaScript fetch, or Python:
83
+ ## Launch Modes
330
84
 
331
85
  ```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`
348
-
349
- **Optional:**
350
- - `--folder <path>` — Scope resolution to a sub-folder
351
- - `--workspace <path>` — Workspace folder (default: current directory)
352
- - `--environment <name>` — Environment to resolve variables against
86
+ # Default: standalone HTTP Forge profile
87
+ http-forge launch
353
88
 
354
- ---
89
+ # Use your normal VS Code profile
90
+ http-forge launch --dev
355
91
 
356
- ### 7. List Workspace Resources
92
+ # Open both test and dev profiles
93
+ http-forge launch --both
357
94
 
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
95
+ # Open a workspace path
96
+ http-forge launch --dev /path/to/workspace
368
97
  ```
369
98
 
370
- **Subcommands:** `collections` | `suites` | `environments` | `requests` | `folders`
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`
377
-
378
- ---
99
+ Use `http-forge launch` when you want the standalone HTTP Forge UI from terminal.
379
100
 
380
- ### 8. Manage Environment Variables
101
+ The launcher auto-detects OS/shell and uses the matching script:
102
+ - Linux/macOS: `scripts/http-forge.sh`
103
+ - Windows: `scripts/http-forge.bat`
381
104
 
382
- Read and write environment variables stored in the workspace config files:
105
+ ## Common Run Patterns
383
106
 
384
107
  ```bash
385
- # List all environments
386
- http-forge env list
108
+ # Collection
109
+ http-forge run collection "my-api" --env dev --include perRequest
387
110
 
388
- # Inspect a specific environment
389
- http-forge env get staging
390
- http-forge env env get staging --output table
391
- http-forge env get staging --no-values # show keys only
111
+ # Suite
112
+ http-forge run suite "smoke-tests" --env staging --exit-code
392
113
 
393
- # Set a variable permanently (writes to the JSON env file)
394
- http-forge env set staging BASE_URL https://staging.example.com
395
- http-forge env set staging API_KEY=my-secret-key # key=value syntax
114
+ # Request
115
+ http-forge run request "Get Users" --collection "my-api" --env dev
396
116
 
397
- # Remove a variable
398
- http-forge env unset staging OLD_VAR
117
+ # Folder
118
+ http-forge run folder "Auth/Login" --collection "my-api" --env dev
399
119
  ```
400
120
 
401
- **Subcommands:** `list` | `get <name>` | `set <env> <key> <value>` | `unset <env> <key>`
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:
121
+ ## CI/CD Example
426
122
 
427
123
  ```bash
428
- http-forge run suite smoke-tests \
429
- --reporter html:reports/run.html \
124
+ http-forge run suite "smoke-tests" \
125
+ --env staging \
430
126
  --reporter junit:results/junit.xml \
431
127
  --exit-code
432
128
  ```
433
129
 
434
- **Notes:**
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
- ---
130
+ Use this in CI to fail the pipeline on assertion failures and publish JUnit artifacts.
590
131
 
591
- ## Architecture
132
+ ## Detailed Docs
592
133
 
593
- The CLI delegates to `@http-forge/core` direct execution APIs. The service container bootstraps Node.js-specific adapters (file I/O, secrets). Output is formatted to JSON or table. All errors go to stderr; the machine-readable result goes to stdout only.
134
+ - Full CLI reference: `docs/cli-reference.md`
135
+ - CI guide: `docs/ci-guide.md`
136
+ - Example workflow: `docs/ci-example.yml`
137
+ - HTTP Forge docs: https://github.com/hsl1230/http-forge/tree/main/docs/user-guide
594
138
 
595
- See [@http-forge/core README](../http-forge.core/README.md) for the full API reference.
139
+ ## License
596
140
 
141
+ MIT
@@ -0,0 +1,2 @@
1
+ export declare function handleLaunch(args: string[]): Promise<void>;
2
+ //# sourceMappingURL=launch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"launch.d.ts","sourceRoot":"","sources":["../../src/commands/launch.ts"],"names":[],"mappings":"AA0CA,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAqDhE"}
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.handleLaunch = handleLaunch;
7
+ const node_child_process_1 = require("node:child_process");
8
+ const node_fs_1 = require("node:fs");
9
+ const node_path_1 = __importDefault(require("node:path"));
10
+ function parseShellKind() {
11
+ if (process.platform === 'win32') {
12
+ const comspec = (process.env.ComSpec || process.env.COMSPEC || '').toLowerCase();
13
+ const ps = (process.env.PSModulePath || '').toLowerCase();
14
+ if (comspec.includes('powershell') || ps.length > 0)
15
+ return 'powershell';
16
+ return 'cmd';
17
+ }
18
+ const shell = (process.env.SHELL || '').toLowerCase();
19
+ if (shell.includes('bash'))
20
+ return 'bash';
21
+ if (shell.includes('zsh') || shell.includes('ksh') || shell.includes('dash'))
22
+ return 'sh';
23
+ if (shell.includes('/sh'))
24
+ return 'sh';
25
+ return 'unknown';
26
+ }
27
+ function resolveLauncherScript() {
28
+ const root = node_path_1.default.resolve(__dirname, '..', '..');
29
+ const isWindows = process.platform === 'win32';
30
+ const scriptPath = isWindows
31
+ ? node_path_1.default.join(root, 'scripts', 'http-forge.bat')
32
+ : node_path_1.default.join(root, 'scripts', 'http-forge.sh');
33
+ if (!(0, node_fs_1.existsSync)(scriptPath)) {
34
+ throw new Error(`Launcher script not found: ${scriptPath}. Reinstall @http-forge/cli or ensure scripts are packaged.`);
35
+ }
36
+ return { scriptPath, platform: isWindows ? 'win32' : 'unix' };
37
+ }
38
+ function quoteForCmdArg(arg) {
39
+ if (arg.length === 0)
40
+ return '""';
41
+ const needsQuotes = /[\s"^&|<>()%!]/.test(arg);
42
+ const escaped = arg.replace(/"/g, '""');
43
+ return needsQuotes ? `"${escaped}"` : escaped;
44
+ }
45
+ async function handleLaunch(args) {
46
+ const { scriptPath, platform } = resolveLauncherScript();
47
+ const shellKind = parseShellKind();
48
+ if (args.includes('--help') || args.includes('-h')) {
49
+ console.log(`
50
+ HTTP Forge Launcher (from CLI)
51
+
52
+ USAGE:
53
+ http-forge launch [options] [workspace-path]
54
+
55
+ OPTIONS:
56
+ --test Launch HTTP Forge profile (isolated, default)
57
+ --dev Launch Default profile (all VS Code extensions)
58
+ --both Launch two instances: test + dev
59
+ --help Show this help
60
+
61
+ NOTES:
62
+ - Detects your shell/OS and picks the matching launcher automatically.
63
+ - On Windows this runs scripts/http-forge.bat.
64
+ - On Linux/macOS this runs scripts/http-forge.sh.
65
+ `);
66
+ return;
67
+ }
68
+ const modeArgs = args.length === 0 ? ['--test'] : args;
69
+ await new Promise((resolve, reject) => {
70
+ let child;
71
+ if (platform === 'win32') {
72
+ const cmdExe = process.env.ComSpec || process.env.COMSPEC || 'cmd.exe';
73
+ const commandLine = `"${scriptPath}" ${modeArgs.map(quoteForCmdArg).join(' ')}`.trim();
74
+ child = (0, node_child_process_1.spawn)(cmdExe, ['/d', '/s', '/c', commandLine], {
75
+ stdio: 'inherit',
76
+ windowsHide: false,
77
+ });
78
+ }
79
+ else {
80
+ const preferredShell = shellKind === 'bash' ? '/bin/bash' : '/bin/sh';
81
+ child = (0, node_child_process_1.spawn)(preferredShell, [scriptPath, ...modeArgs], {
82
+ stdio: 'inherit',
83
+ });
84
+ }
85
+ child.on('error', (err) => reject(err));
86
+ child.on('close', (code) => {
87
+ if (code === 0 || code === null) {
88
+ resolve();
89
+ }
90
+ else {
91
+ reject(new Error(`Launcher exited with code ${code}`));
92
+ }
93
+ });
94
+ });
95
+ }
96
+ //# sourceMappingURL=launch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"launch.js","sourceRoot":"","sources":["../../src/commands/launch.ts"],"names":[],"mappings":";;;;;AA0CA,oCAqDC;AA/FD,2DAA2C;AAC3C,qCAAqC;AACrC,0DAA6B;AAE7B,SAAS,cAAc;IACrB,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,MAAM,OAAO,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;QACjF,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;QAC1D,IAAI,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,YAAY,CAAC;QACzE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,KAAK,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IACtD,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC;IAC1C,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,O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,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACxC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YACzB,IAAI,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;gBAChC,OAAO,EAAE,CAAC;YACZ,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,IAAI,KAAK,CAAC,6BAA6B,IAAI,EAAE,CAAC,CAAC,CAAC;YACzD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -10,6 +10,7 @@
10
10
  */
11
11
  export { handleEnv } from './commands/env';
12
12
  export { handleGenerateCollection } from './commands/generate-collection';
13
+ export { handleLaunch } from './commands/launch';
13
14
  export { handleList } from './commands/list';
14
15
  export { handleMcpGroup, handleMcpServer } from './commands/mcp';
15
16
  export { handleCopyAs, handleRunCollection, handleRunFolder, handleRunGroup, handleRunRequest, handleRunSuite } from './commands/run';
@@ -1 +1 @@
1
- {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EACH,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,cAAc,EACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EACH,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,cAAc,EACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
package/dist/commands.js CHANGED
@@ -10,11 +10,13 @@
10
10
  * src/output/format.ts — ParsedArgs, parseArgs, outputResult, finalizeCiReports, ...
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.handleSuggestEnv = exports.handleSchedule = exports.handleRunSuite = exports.handleRunRequest = exports.handleRunGroup = exports.handleRunFolder = exports.handleRunCollection = exports.handleCopyAs = exports.handleMcpServer = exports.handleMcpGroup = exports.handleList = exports.handleGenerateCollection = exports.handleEnv = void 0;
13
+ exports.handleSuggestEnv = exports.handleSchedule = exports.handleRunSuite = exports.handleRunRequest = exports.handleRunGroup = exports.handleRunFolder = exports.handleRunCollection = exports.handleCopyAs = exports.handleMcpServer = exports.handleMcpGroup = exports.handleList = exports.handleLaunch = exports.handleGenerateCollection = exports.handleEnv = void 0;
14
14
  var env_1 = require("./commands/env");
15
15
  Object.defineProperty(exports, "handleEnv", { enumerable: true, get: function () { return env_1.handleEnv; } });
16
16
  var generate_collection_1 = require("./commands/generate-collection");
17
17
  Object.defineProperty(exports, "handleGenerateCollection", { enumerable: true, get: function () { return generate_collection_1.handleGenerateCollection; } });
18
+ var launch_1 = require("./commands/launch");
19
+ Object.defineProperty(exports, "handleLaunch", { enumerable: true, get: function () { return launch_1.handleLaunch; } });
18
20
  var list_1 = require("./commands/list");
19
21
  Object.defineProperty(exports, "handleList", { enumerable: true, get: function () { return list_1.handleList; } });
20
22
  var mcp_1 = require("./commands/mcp");
@@ -1 +1 @@
1
- {"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,sCAA2C;AAAlC,gGAAA,SAAS,OAAA;AAClB,sEAA0E;AAAjE,+HAAA,wBAAwB,OAAA;AACjC,wCAA6C;AAApC,kGAAA,UAAU,OAAA;AACnB,sCAAiE;AAAxD,qGAAA,cAAc,OAAA;AAAE,sGAAA,eAAe,OAAA;AACxC,sCAOwB;AANpB,mGAAA,YAAY,OAAA;AACZ,0GAAA,mBAAmB,OAAA;AACnB,sGAAA,eAAe,OAAA;AACf,qGAAA,cAAc,OAAA;AACd,uGAAA,gBAAgB,OAAA;AAChB,qGAAA,cAAc,OAAA;AAElB,gDAAqD;AAA5C,0GAAA,cAAc,OAAA;AACvB,sDAA0D;AAAjD,+GAAA,gBAAgB,OAAA"}
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,sCAA2C;AAAlC,gGAAA,SAAS,OAAA;AAClB,sEAA0E;AAAjE,+HAAA,wBAAwB,OAAA;AACjC,4CAAiD;AAAxC,sGAAA,YAAY,OAAA;AACrB,wCAA6C;AAApC,kGAAA,UAAU,OAAA;AACnB,sCAAiE;AAAxD,qGAAA,cAAc,OAAA;AAAE,sGAAA,eAAe,OAAA;AACxC,sCAOwB;AANpB,mGAAA,YAAY,OAAA;AACZ,0GAAA,mBAAmB,OAAA;AACnB,sGAAA,eAAe,OAAA;AACf,qGAAA,cAAc,OAAA;AACd,uGAAA,gBAAgB,OAAA;AAChB,qGAAA,cAAc,OAAA;AAElB,gDAAqD;AAA5C,0GAAA,cAAc,OAAA;AACvB,sDAA0D;AAAjD,+GAAA,gBAAgB,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAaH,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CA0D1C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAcH,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CA8D1C"}
package/dist/index.js CHANGED
@@ -46,6 +46,9 @@ async function main() {
46
46
  case 'schedule':
47
47
  await (0, commands_1.handleSchedule)(args.slice(1));
48
48
  break;
49
+ case 'launch':
50
+ await (0, commands_1.handleLaunch)(args.slice(1));
51
+ break;
49
52
  case '-h':
50
53
  printUsage();
51
54
  process.exit(0);
@@ -107,6 +110,13 @@ COMMANDS:
107
110
  --host <addr> Host to bind to (default: 127.0.0.1)
108
111
  --workspace <path> Workspace folder (default: $HTTP_FORGE_WORKSPACE or cwd)
109
112
 
113
+ launch [options] [path] Launch HTTP Forge in VS Code
114
+ Options:
115
+ --test Launch with isolated "HTTP Forge" profile (default)
116
+ --dev Launch with "Default" profile (all extensions)
117
+ --both Launch both profiles side by side
118
+ --help Show launcher help
119
+
110
120
  copy-as Print a request as a code snippet
111
121
  Required:
112
122
  --collection <ref> Collection (id, slug, or name)
@@ -182,6 +192,9 @@ EXAMPLES:
182
192
  http-forge mcp start --port 3100
183
193
  http-forge mcp status
184
194
  http-forge mcp stop
195
+ http-forge launch
196
+ http-forge launch --dev
197
+ http-forge launch --both /path/to/workspace
185
198
  http-forge run collection "my-api" --env dev
186
199
  http-forge run request "Get Users" --collection "my-api" --env production
187
200
  http-forge run request "Get Users" --collection "my-api" --folder Auth --include tests
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/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AAC,CAAC,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAG,KAAe,CAAC,OAAO,CAAC,CAAC;QAClD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,SAAS,UAAU;IACjB,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgLb,CAAC,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@http-forge/cli",
3
- "version": "0.2.5",
4
- "description": "HTTP Forge CLI — terminal interface for collections, test suites, and MCP server",
3
+ "version": "0.2.11",
4
+ "description": "Standalone HTTP Forge launcher and Postman alternative for UI mode, API testing, CI/CD, and MCP server automation",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
7
7
  "http-forge": "dist/cli.js"
8
8
  },
9
9
  "files": [
10
10
  "dist/**",
11
+ "scripts/**",
11
12
  "README.md",
12
13
  "LICENSE"
13
14
  ],
@@ -18,10 +19,33 @@
18
19
  },
19
20
  "keywords": [
20
21
  "http-forge",
22
+ "http forge",
23
+ "standalone api client",
24
+ "api client ui",
25
+ "desktop api client",
26
+ "standalone launcher",
27
+ "postman cli",
28
+ "postman cli alternative",
29
+ "postman alternative",
21
30
  "api",
31
+ "api cli",
22
32
  "testing",
33
+ "api testing",
34
+ "api testing cli",
23
35
  "postman",
24
- "cli"
36
+ "openapi",
37
+ "openapi cli",
38
+ "openapi testing",
39
+ "rest client",
40
+ "graphql",
41
+ "cli",
42
+ "ci",
43
+ "cd",
44
+ "junit",
45
+ "mcp",
46
+ "mcp server",
47
+ "launcher",
48
+ "vscode"
25
49
  ],
26
50
  "author": "Henry Huang",
27
51
  "license": "MIT",
@@ -32,7 +56,7 @@
32
56
  "node": ">=20.0.0"
33
57
  },
34
58
  "dependencies": {
35
- "@http-forge/core": "^0.6.5"
59
+ "@http-forge/core": "^0.6.11"
36
60
  },
37
61
  "optionalDependencies": {
38
62
  "@aws-sdk/client-secrets-manager": "^3.0.0",
@@ -0,0 +1,157 @@
1
+ @echo off
2
+ REM HTTP Forge Launcher — Windows
3
+ REM Detects VS Code, downloads if missing, installs extension, launches in isolated profile.
4
+ REM
5
+ REM Usage:
6
+ REM http-forge.bat [path] Launch in "HTTP Forge" profile (test mode)
7
+ REM http-forge.bat --dev [path] Launch in "Default" profile (all extensions)
8
+ REM http-forge.bat --both [path] Launch BOTH profiles side by side
9
+
10
+ set PROFILE_TEST=HTTP Forge
11
+ set PROFILE_DEV=Default
12
+ set EXTENSION=henry-huang.http-forge
13
+ set INSTALL_DIR=%USERPROFILE%\.http-forge-launcher\vscode
14
+ set TEST_DATA_DIR=%USERPROFILE%\.http-forge-launcher\vscode-data
15
+
16
+ REM ─── Parse Arguments ───────────────────────────────────────────
17
+ set MODE=test
18
+ set WORKSPACE_ARGS=
19
+
20
+ :parse_args
21
+ if "%~1"=="" goto :end_parse
22
+ if "%~1"=="--dev" (
23
+ set MODE=dev
24
+ shift
25
+ goto :parse_args
26
+ )
27
+ if "%~1"=="--test" (
28
+ set MODE=test
29
+ shift
30
+ goto :parse_args
31
+ )
32
+ if "%~1"=="--both" (
33
+ set MODE=both
34
+ shift
35
+ goto :parse_args
36
+ )
37
+ if "%~1"=="--help" goto :show_help
38
+ if "%~1"=="-h" goto :show_help
39
+ set WORKSPACE_ARGS=%WORKSPACE_ARGS% %1
40
+ shift
41
+ goto :parse_args
42
+ :end_parse
43
+
44
+ REM ─── Detect VS Code ───────────────────────────────────────────
45
+ set CODE_BIN=
46
+
47
+ REM Check known install locations first (more reliable than PATH)
48
+ if exist "%LOCALAPPDATA%\Programs\Microsoft VS Code\bin\code.cmd" (
49
+ set "CODE_BIN=%LOCALAPPDATA%\Programs\Microsoft VS Code\bin\code.cmd"
50
+ goto :found
51
+ )
52
+
53
+ if exist "%ProgramFiles%\Microsoft VS Code\bin\code.cmd" (
54
+ set "CODE_BIN=%ProgramFiles%\Microsoft VS Code\bin\code.cmd"
55
+ goto :found
56
+ )
57
+
58
+ if exist "%ProgramFiles(x86)%\Microsoft VS Code\bin\code.cmd" (
59
+ set "CODE_BIN=%ProgramFiles(x86)%\Microsoft VS Code\bin\code.cmd"
60
+ goto :found
61
+ )
62
+
63
+ REM Check our own install
64
+ if exist "%INSTALL_DIR%\bin\code.cmd" (
65
+ set "CODE_BIN=%INSTALL_DIR%\bin\code.cmd"
66
+ goto :found
67
+ )
68
+
69
+ REM Fallback: resolve full path from PATH
70
+ for /f "delims=" %%i in ('where code.cmd 2^>nul') do (
71
+ set "CODE_BIN=%%i"
72
+ goto :found
73
+ )
74
+
75
+ REM ─── Install VS Code ──────────────────────────────────────────
76
+ echo [http-forge] VS Code not found. Downloading...
77
+
78
+ set "INSTALLER=%TEMP%\VSCodeUserSetup-x64.exe"
79
+ curl -L --progress-bar "https://update.code.visualstudio.com/latest/win32-x64-user/stable" -o "%INSTALLER%"
80
+
81
+ if not exist "%INSTALLER%" (
82
+ echo [http-forge] ERROR: Download failed. Please install VS Code manually.
83
+ exit /b 1
84
+ )
85
+
86
+ echo [http-forge] Installing VS Code (silent, user-mode)...
87
+ "%INSTALLER%" /verysilent /mergetasks=!runcode,addtopath /dir="%INSTALL_DIR%"
88
+ del "%INSTALLER%" 2>nul
89
+
90
+ if exist "%INSTALL_DIR%\bin\code.cmd" (
91
+ set "CODE_BIN=%INSTALL_DIR%\bin\code.cmd"
92
+ ) else if exist "%LOCALAPPDATA%\Programs\Microsoft VS Code\bin\code.cmd" (
93
+ set "CODE_BIN=%LOCALAPPDATA%\Programs\Microsoft VS Code\bin\code.cmd"
94
+ ) else (
95
+ echo [http-forge] ERROR: Failed to install VS Code.
96
+ exit /b 1
97
+ )
98
+
99
+ :found
100
+ echo [http-forge] Using: %CODE_BIN%
101
+
102
+ REM Install extension only where it will actually be launched
103
+ echo [http-forge] Ensuring extension is installed...
104
+ if "%MODE%"=="test" call "%CODE_BIN%" --profile "%PROFILE_TEST%" --install-extension %EXTENSION% --force 2>nul
105
+ if "%MODE%"=="dev" call "%CODE_BIN%" --profile "%PROFILE_DEV%" --install-extension %EXTENSION% --force 2>nul
106
+ if "%MODE%"=="both" (
107
+ if not exist "%TEST_DATA_DIR%\User" mkdir "%TEST_DATA_DIR%\User"
108
+ if not exist "%TEST_DATA_DIR%\User\settings.json" (
109
+ echo {"debug.showInActivityBar": false, "debug.showInStatusBar": "never", "workbench.startupEditor": "none"} > "%TEST_DATA_DIR%\User\settings.json"
110
+ )
111
+ call "%CODE_BIN%" --profile "%PROFILE_TEST%" --user-data-dir "%TEST_DATA_DIR%" --install-extension %EXTENSION% --force 2>nul
112
+ call "%CODE_BIN%" --profile "%PROFILE_DEV%" --install-extension %EXTENSION% --force 2>nul
113
+ )
114
+
115
+ REM Built-in extensions to disable in test mode (not needed, saves RAM)
116
+ set DISABLE_EXT=--disable-extension ms-vscode.js-debug --disable-extension ms-vscode.js-debug-companion --disable-extension vscode.debug-auto-launch --disable-extension vscode.debug-server-ready
117
+
118
+ if "%MODE%"=="dev" goto :launch_dev
119
+ if "%MODE%"=="both" goto :launch_both
120
+
121
+ REM ─── Launch: test mode (default) ─────────────────────────────
122
+ echo [http-forge] Launching VS Code (profile: %PROFILE_TEST%)...
123
+ call "%CODE_BIN%" --new-window --profile "%PROFILE_TEST%" %DISABLE_EXT% %WORKSPACE_ARGS%
124
+ call "%CODE_BIN%" --profile "%PROFILE_TEST%" --open-url "vscode:extension/%EXTENSION%"
125
+ goto :eof
126
+
127
+ :launch_dev
128
+ echo [http-forge] Launching VS Code (profile: %PROFILE_DEV%)...
129
+ call "%CODE_BIN%" --new-window --profile "%PROFILE_DEV%" %WORKSPACE_ARGS%
130
+ call "%CODE_BIN%" --profile "%PROFILE_DEV%" --open-url "vscode:extension/%EXTENSION%"
131
+ goto :eof
132
+
133
+ :launch_both
134
+ echo [http-forge] Launching two separate instances...
135
+ echo - Test: isolated instance (separate user-data-dir)
136
+ echo - Dev: profile "%PROFILE_DEV%"
137
+ REM Test instance
138
+ call "%CODE_BIN%" --new-window --profile "%PROFILE_TEST%" --user-data-dir "%TEST_DATA_DIR%" %DISABLE_EXT% %WORKSPACE_ARGS%
139
+ call "%CODE_BIN%" --profile "%PROFILE_TEST%" --user-data-dir "%TEST_DATA_DIR%" --open-url "vscode:extension/%EXTENSION%"
140
+ REM Dev instance
141
+ call "%CODE_BIN%" --new-window --profile "%PROFILE_DEV%" %WORKSPACE_ARGS%
142
+ call "%CODE_BIN%" --profile "%PROFILE_DEV%" --open-url "vscode:extension/%EXTENSION%"
143
+ goto :eof
144
+
145
+ :show_help
146
+ echo HTTP Forge Launcher
147
+ echo.
148
+ echo Usage: http-forge.bat [options] [workspace-path]
149
+ echo.
150
+ echo Options:
151
+ echo --test Launch with HTTP Forge profile (isolated, default)
152
+ echo --dev Launch with Default profile (all your extensions)
153
+ echo --both Launch two instances: Default + HTTP Forge (test)
154
+ echo --help Show this help
155
+ echo.
156
+ echo Default: Launch with "HTTP Forge" profile (isolated, test-only)
157
+ goto :eof
@@ -0,0 +1,167 @@
1
+ #!/bin/bash
2
+ # HTTP Forge Launcher — Linux/macOS
3
+ # Detects VS Code, downloads if missing, installs extension, launches in isolated profile.
4
+ #
5
+ # Usage:
6
+ # ./http-forge.sh [path] # Launch in "HTTP Forge" profile (test mode)
7
+ # ./http-forge.sh --dev [path] # Launch in "Default" profile (all extensions)
8
+ # ./http-forge.sh --both [path] # Launch BOTH profiles side by side
9
+
10
+ PROFILE_TEST="HTTP Forge"
11
+ PROFILE_DEV="Default"
12
+ EXTENSION="henry-huang.http-forge"
13
+ INSTALL_DIR="$HOME/.http-forge-launcher/vscode"
14
+ TEST_DATA_DIR="$HOME/.http-forge-launcher/vscode-data"
15
+
16
+ # ─── Parse Arguments ───────────────────────────────────────────
17
+ MODE="test"
18
+ WORKSPACE_ARGS=()
19
+
20
+ for arg in "$@"; do
21
+ case "$arg" in
22
+ --dev) MODE="dev" ;;
23
+ --test) MODE="test" ;;
24
+ --both) MODE="both" ;;
25
+ --help|-h)
26
+ echo "HTTP Forge Launcher"
27
+ echo ""
28
+ echo "Usage: ./http-forge.sh [options] [workspace-path]"
29
+ echo ""
30
+ echo "Options:"
31
+ echo " --test Launch with HTTP Forge profile (isolated, default)"
32
+ echo " --dev Launch with Default profile (all your extensions)"
33
+ echo " --both Launch two instances: Default + HTTP Forge (test)"
34
+ echo " --help Show this help"
35
+ echo ""
36
+ echo "Default: Launch with \"HTTP Forge\" profile (isolated, test-only)"
37
+ exit 0
38
+ ;;
39
+ *) WORKSPACE_ARGS+=("$arg") ;;
40
+ esac
41
+ done
42
+
43
+ # ─── Detect VS Code ───────────────────────────────────────────
44
+ find_code() {
45
+ # Check PATH first
46
+ if command -v code &>/dev/null; then
47
+ echo "code"
48
+ return
49
+ fi
50
+
51
+ # Check common Linux locations
52
+ for bin in /usr/bin/code /snap/bin/code /usr/share/code/bin/code; do
53
+ if [[ -x "$bin" ]]; then
54
+ echo "$bin"
55
+ return
56
+ fi
57
+ done
58
+
59
+ # Check macOS locations
60
+ for bin in "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code" \
61
+ "$HOME/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code"; do
62
+ if [[ -x "$bin" ]]; then
63
+ echo "$bin"
64
+ return
65
+ fi
66
+ done
67
+
68
+ # Check our own install
69
+ if [[ -x "$INSTALL_DIR/bin/code" ]]; then
70
+ echo "$INSTALL_DIR/bin/code"
71
+ return
72
+ fi
73
+
74
+ return 1
75
+ }
76
+
77
+ # ─── Install VS Code ──────────────────────────────────────────
78
+ install_code() {
79
+ echo "[http-forge] VS Code not found. Downloading..."
80
+ mkdir -p "$INSTALL_DIR"
81
+
82
+ local url
83
+ case "$(uname -s)" in
84
+ Linux) url="https://update.code.visualstudio.com/latest/linux-x64/stable" ;;
85
+ Darwin) url="https://update.code.visualstudio.com/latest/darwin-universal/stable" ;;
86
+ *) echo "[http-forge] ERROR: Unsupported OS. Please install VS Code manually."; exit 1 ;;
87
+ esac
88
+
89
+ local tmp
90
+ tmp="$(mktemp -d)/vscode-download"
91
+
92
+ if [[ "$(uname -s)" == "Linux" ]]; then
93
+ curl -L --progress-bar "$url" -o "$tmp.tar.gz"
94
+ echo "[http-forge] Extracting..."
95
+ rm -rf "$INSTALL_DIR"
96
+ mkdir -p "$INSTALL_DIR"
97
+ tar -xzf "$tmp.tar.gz" -C "$INSTALL_DIR" --strip-components=1
98
+ rm -f "$tmp.tar.gz"
99
+ else
100
+ curl -L --progress-bar "$url" -o "$tmp.zip"
101
+ echo "[http-forge] Extracting..."
102
+ unzip -qo "$tmp.zip" -d "$HOME/Applications"
103
+ rm -f "$tmp.zip"
104
+ fi
105
+
106
+ echo "[http-forge] VS Code installed."
107
+ }
108
+
109
+ # ─── Main Flow ─────────────────────────────────────────────────
110
+ CODE_BIN=$(find_code)
111
+
112
+ if [[ -z "$CODE_BIN" ]]; then
113
+ install_code
114
+ CODE_BIN=$(find_code)
115
+ if [[ -z "$CODE_BIN" ]]; then
116
+ echo "[http-forge] ERROR: Failed to install VS Code."
117
+ exit 1
118
+ fi
119
+ fi
120
+
121
+ echo "[http-forge] Using: $CODE_BIN"
122
+
123
+ # Install extension only where it will actually be launched
124
+ echo "[http-forge] Ensuring extension is installed..."
125
+ case "$MODE" in
126
+ test)
127
+ "$CODE_BIN" --profile "$PROFILE_TEST" --install-extension "$EXTENSION" --force 2>/dev/null
128
+ ;;
129
+ dev)
130
+ "$CODE_BIN" --profile "$PROFILE_DEV" --install-extension "$EXTENSION" --force 2>/dev/null
131
+ ;;
132
+ both)
133
+ mkdir -p "$TEST_DATA_DIR/User"
134
+ if [[ ! -f "$TEST_DATA_DIR/User/settings.json" ]]; then
135
+ echo '{"debug.showInActivityBar": false, "debug.showInStatusBar": "never", "workbench.startupEditor": "none"}' > "$TEST_DATA_DIR/User/settings.json"
136
+ fi
137
+ "$CODE_BIN" --profile "$PROFILE_TEST" --user-data-dir "$TEST_DATA_DIR" --install-extension "$EXTENSION" --force 2>/dev/null
138
+ "$CODE_BIN" --profile "$PROFILE_DEV" --install-extension "$EXTENSION" --force 2>/dev/null
139
+ ;;
140
+ esac
141
+
142
+ # Built-in extensions to disable in test mode (not needed, saves RAM)
143
+ DISABLE_EXTENSIONS=(--disable-extension ms-vscode.js-debug --disable-extension ms-vscode.js-debug-companion --disable-extension vscode.debug-auto-launch --disable-extension vscode.debug-server-ready)
144
+
145
+ case "$MODE" in
146
+ dev)
147
+ echo "[http-forge] Launching VS Code (profile: $PROFILE_DEV)..."
148
+ "$CODE_BIN" --new-window --profile "$PROFILE_DEV" "${WORKSPACE_ARGS[@]}"
149
+ "$CODE_BIN" --profile "$PROFILE_DEV" --open-url "vscode:extension/$EXTENSION" &
150
+ ;;
151
+ test)
152
+ echo "[http-forge] Launching VS Code (profile: $PROFILE_TEST)..."
153
+ "$CODE_BIN" --new-window --profile "$PROFILE_TEST" "${DISABLE_EXTENSIONS[@]}" "${WORKSPACE_ARGS[@]}"
154
+ "$CODE_BIN" --profile "$PROFILE_TEST" --open-url "vscode:extension/$EXTENSION" &
155
+ ;;
156
+ both)
157
+ echo "[http-forge] Launching two separate instances..."
158
+ echo " → Test: isolated instance (--user-data-dir)"
159
+ echo " → Dev: default VS Code"
160
+ # Test instance
161
+ "$CODE_BIN" --new-window --profile "$PROFILE_TEST" --user-data-dir "$TEST_DATA_DIR" "${DISABLE_EXTENSIONS[@]}" "${WORKSPACE_ARGS[@]}"
162
+ "$CODE_BIN" --profile "$PROFILE_TEST" --user-data-dir "$TEST_DATA_DIR" --open-url "vscode:extension/$EXTENSION" &
163
+ # Dev instance
164
+ "$CODE_BIN" --new-window --profile "$PROFILE_DEV" "${WORKSPACE_ARGS[@]}"
165
+ "$CODE_BIN" --profile "$PROFILE_DEV" --open-url "vscode:extension/$EXTENSION" &
166
+ ;;
167
+ esac