@http-forge/core 0.6.6 → 0.6.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,1085 +1,82 @@
1
1
  # @http-forge/core
2
2
 
3
- **Standalone HTTP testing engine with Postman collection support and JavaScript-based automation.**
3
+ The headless API execution engine behind HTTP Forge.
4
4
 
5
- [![npm version](https://img.shields.io/npm/v/@http-forge/core.svg)](https://www.npmjs.com/package/@http-forge/core)
6
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ Run Postman-compatible collections, requests, suites, and OpenAPI-driven workflows in Node.js, CI/CD, and custom tooling.
7
6
 
8
- ## 📦 What is @http-forge/core?
7
+ [![npm version](https://img.shields.io/npm/v/%40http-forge%2Fcore.svg)](https://www.npmjs.com/package/@http-forge/core)
8
+ [![license](https://img.shields.io/npm/l/%40http-forge%2Fcore.svg)](LICENSE)
9
9
 
10
- `@http-forge/core` is a headless, framework-agnostic HTTP execution engine with **full Postman collection compatibility**. Execute complex API workflows, test suites, and automated flows without the overhead of a UI.
10
+ ## Why @http-forge/core
11
11
 
12
- **Core Features:**
13
- - 🚀 **Postman Collections** - Load and execute `.postman_collection.json` and `.forge.json` files
14
- - 📝 **JavaScript Scripting** - Pre-request and post-response scripts with full `pm.*` API (variables, assertions, execution flow, visualizer)
15
- - 🔄 **Dynamic Variables** - Built-in generators: `{{$randomInt}}`, `{{$timestamp}}`, `{{$uuid}}`, `{{$guid}}`, etc.
16
- - 🌍 **Environments** - Full variable scoping (globals, collection, environment, session, iterationData)
17
- - � **Cloud Secret Resolvers** - Resolve `{{secret:alias/path}}` from AWS Secrets Manager, Azure Key Vault, Google Secret Manager, HashiCorp Vault, 1Password, and Doppler; credentials read from the ambient environment, never from config
18
- - �👁️ **File Watching** - Automatic reload on collection/environment file changes with notification callbacks
19
- - 🍪 **Cookie Persistence** - Automatic cookie storage and reuse, `pm.cookies.jar()` and `.toObject()`
20
- - 📊 **Test Assertions** - BDD-style testing with `pm.test()` (sync/async), `pm.test.skip()` / `.fail()` / `.index()`, full Chai `expect()` chains (incl. `.contain()`), and JSON Schema validation via `pm.response.to.have.jsonSchema()`
21
- - 🔐 **CryptoJS** - Full crypto library: hash, HMAC, AES/DES/TripleDES, PBKDF2, encoding helpers
22
- - 🎯 **Execution Flow** - `pm.setNextRequest()`, `pm.execution.skipRequest()` for suite runner flow control
23
- - 📈 **Visualizer** - `pm.visualizer.set(template, data)` for custom Handlebars-based HTML output
24
- - 🔌 **Extensible** - Custom interceptors, HTTP clients, and module loaders
12
+ - Run API tests headlessly in Node.js and CI/CD.
13
+ - Execute Postman-style scripts with `pm.*` APIs.
14
+ - Reuse the same HTTP Forge collections outside the UI.
15
+ - Work with environments, cookies, dynamic variables, and OpenAPI flows.
16
+ - Embed the runtime in your own CLI, automation, or agent workflows.
25
17
 
26
- **Ideal for:**
27
- - CI/CD pipeline integration (GitHub Actions, GitLab CI, Jenkins)
28
- - Headless API testing and contract validation
29
- - Building custom API testing CLIs
30
- - Load testing and performance monitoring
31
- - Automated integration test suites
18
+ ## What It Powers
32
19
 
33
- ## 🎯 Installation
20
+ - HTTP Forge VS Code extension
21
+ - HTTP Forge CLI
22
+ - MCP server runtime
23
+ - OpenAPI import/export and automation flows
24
+ - Custom API testing tools built on top of the engine
34
25
 
35
- Requires Node.js `20+`.
26
+ ## 1-Minute Quickstart
36
27
 
37
28
  ```bash
38
29
  npm install @http-forge/core
39
30
  ```
40
31
 
41
- Or using the tarball:
42
- ```bash
43
- npm install ./http-forge-core-0.1.0.tgz
44
- ```
45
-
46
- ## Runtime APIs (Headless + MCP)
47
-
48
- For current programmatic runtime APIs, see [RUNTIME-API.md](RUNTIME-API.md):
49
- - `runRequest(options)`
50
- - `runCollection(options)`
51
- - `runSuite(options)`
52
- - `createMcpRuntime(options)`
53
-
54
- This covers direct execution, embeddable MCP runtime lifecycle, response include options, and report behavior.
55
-
56
- ---
57
-
58
- ## 🤖 AI & Analysis APIs
59
-
60
- All AI features use the `IAiProvider` abstraction — bring any LLM (GitHub Copilot, OpenAI, Anthropic) without changing the core logic.
61
-
62
- ### `IAiProvider`
63
-
64
- ```typescript
65
- interface IAiProvider {
66
- complete(prompt: string): Promise<string>;
67
- }
68
- ```
69
-
70
- Implement this interface for any LLM backend. The package ships no concrete provider — callers supply one:
71
-
72
- | Package | Provider class |
73
- |---|---|
74
- | `http-forge` (VS Code extension) | `CopilotAiProvider` (wraps `vscode.lm`) |
75
- | `@http-forge/cli` | `OpenAiProvider`, `AnthropicProvider`, `createCliAiProvider()` |
76
-
77
- ### `enhanceCollection`
78
-
79
- Enhance a collection with AI-written example bodies and `pm.test()` assertion scripts.
80
-
81
- ```typescript
82
- import { enhanceCollection } from '@http-forge/core';
83
-
84
- await enhanceCollection(
85
- collection, // Collection to enhance
86
- collectionService, // ICollectionService
87
- aiProvider, // IAiProvider
88
- (msg, increment) => console.log(msg) // optional progress callback
89
- );
90
- ```
91
-
92
- Processes requests in batches of 10. Saves after each batch. Skips requests that already have a body and test script.
93
-
94
- ### `scanCollectionForEnvVarsWithAi`
95
-
96
- AI-powered scan for hardcoded values (API keys, tokens, base URLs, tenant IDs).
97
-
98
- ```typescript
99
- import { scanCollectionForEnvVarsWithAi } from '@http-forge/core';
100
-
101
- const suggestions = await scanCollectionForEnvVarsWithAi(collection, aiProvider);
102
- // Returns EnvSuggestion[] — same shape as detectEnvSuggestions,
103
- // so applyEnvSuggestionsToItems works for both.
104
- ```
105
-
106
- Returns `EnvSuggestion[]` sorted by occurrence count descending.
107
-
108
- ### `detectEnvSuggestions` (heuristic, no LLM)
109
-
110
- Rule-based detection — no AI dependency. Flags `Authorization` headers, common sensitive header/query names, shared base URLs, and long opaque strings.
111
-
112
- ```typescript
113
- import { detectEnvSuggestions, applyEnvSuggestionsToItems } from '@http-forge/core';
114
-
115
- const suggestions = detectEnvSuggestions(collection, /* minOccurrences */ 1);
116
- const counts = applyEnvSuggestionsToItems(collection.items, suggestions);
117
- await collectionService.saveCollection(collection);
118
- ```
119
-
120
- ### `parseCurlCommand`
121
-
122
- Parse a shell curl command string into a `ParsedCurlRequest` object ready to persist as a collection request.
123
-
124
- ```typescript
125
- import { parseCurlCommand } from '@http-forge/core';
126
-
127
- const parsed = parseCurlCommand(
128
- `curl -X POST https://api.example.com/users ` +
129
- `-H 'Authorization: Bearer sk-abc123' ` +
130
- `-d '{"name":"Alice"}'`
131
- );
132
- // parsed.name, .method, .url, .headers, .queryParams, .body, .suggestedVars
133
- ```
134
-
135
- `suggestedVars` contains heuristically-detected values that should become environment variables (e.g. the Bearer token above).
136
-
137
- ---
138
-
139
- ## 🔌 MCP Tools — AI Agent Integration
140
-
141
- When the MCP server is running, AI agents (Claude, Copilot, etc.) can call these tools in addition to the standard run/inspect tools:
142
-
143
- ### Agentic AI tools (no LLM config needed)
144
-
145
- These tools use the **calling AI as the analysis engine** — no API keys required on the server side.
146
-
147
- | Tool | Description |
148
- |---|---|
149
- | `ai_suggest_env_vars` | Returns request data + instructions; AI finds hardcoded values and calls `apply_env_vars`. One-shot. |
150
- | `ai_enhance_collection` | Returns paginated requests + instructions; AI writes bodies and test scripts and calls `apply_request_enhancements`. Self-continues. |
151
- | `ai_analyze_coverage` | Returns coverage gaps + instructions; AI calls `ai_enhance_collection` for unasserted requests and `generate_scenarios` for untested operations. |
152
- | `generate_request_from_intent` | Takes a plain-English intent; AI calls `create_request` + `set_request_script` in one shot. |
153
- | `generate_scenarios` | Returns request list + instructions; AI creates negative/edge-case variants (400/401/403/404/boundary) per request. Self-continues. |
154
- | `heal_assertions` | Returns current script + last run response; AI rewrites stale assertions and calls `set_request_script`. |
155
- | `generate_iteration_data` | Returns request schema + instructions; AI produces N varied test rows as a JSON array. |
156
-
157
- ### Data tools (read → you analyze → write)
158
-
159
- | Tool | Description |
160
- |---|---|
161
- | `suggest_env_vars` | Returns heuristic suggestions + full request summary for manual or AI review |
162
- | `apply_env_vars` | Replaces `{value, varName}[]` throughout the collection; optionally writes originals to env |
163
- | `get_requests_for_enhancement` | Returns paginated request details (body, test script, headers) |
164
- | `apply_request_enhancements` | Applies AI-written bodies and `pm.test()` scripts to the specified requests |
165
- | `analyze_coverage` | Per-request assertion count + collection-level %. Optional OpenAPI spec comparison. No LLM. |
166
- | `validate_against_spec` | Compares collection against an OpenAPI 3.0 spec: untested operations, unasserted requests, extra requests. No LLM. |
167
-
168
- ---
169
-
170
- ### Basic Usage
171
-
172
- ```typescript
32
+ ```ts
173
33
  import { ForgeContainer } from '@http-forge/core';
174
34
 
175
- // Create a container with default settings
176
35
  const forge = new ForgeContainer();
177
-
178
- // Load a collection
179
36
  const collection = await forge.loadCollection('./my-api.forge.json');
180
-
181
- // Execute a request
182
37
  const result = await forge.execute(collection.items[0], collection);
183
38
 
184
- console.log(result.response.status); // 200
185
- console.log(result.response.body); // Response data
186
- console.log(result.postResponseResult?.assertions); // Test results
187
- ```
188
-
189
- ### With Environment Variables
190
-
191
- ```typescript
192
- const forge = new ForgeContainer();
193
-
194
- // Set environment variables
195
- forge.setEnvironment({
196
- baseUrl: 'https://api.example.com',
197
- apiKey: 'your-api-key',
198
- timeout: '5000'
199
- });
200
-
201
- // Variables are automatically interpolated in requests
202
- // URL: {{baseUrl}}/users -> https://api.example.com/users
203
- const result = await forge.execute(request, collection);
204
- ```
205
-
206
- ### With Custom Configuration
207
-
208
- ```typescript
209
- const forge = new ForgeContainer({
210
- // Use native Node.js http/https instead of fetch
211
- useNativeHttp: true,
212
-
213
- // Enable automatic cookie management
214
- enableCookies: true,
215
-
216
- // Set request timeout
217
- requestTimeout: 10000,
218
-
219
- // Enable request history
220
- enableHistory: true,
221
- maxHistoryEntries: 50,
222
-
223
- // Storage format
224
- storageFormat: 'folder' // or 'file'
225
- });
226
- ```
227
-
228
- ## 📚 Core Concepts
229
-
230
- ### ForgeContainer
231
-
232
- The main entry point - a dependency injection container that wires up all components.
233
-
234
- ```typescript
235
- const forge = new ForgeContainer(options);
236
-
237
- // Load collections
238
- const collection = await forge.loadCollection(path);
239
- const folderCollection = await forge.loadFolderCollection(path);
240
-
241
- // Execute requests
242
- const result = await forge.execute(request, collection, options);
243
-
244
- // Manage environments
245
- forge.setEnvironment(variables);
246
- forge.setActiveEnvironment(name);
247
- const resolved = forge.getResolvedEnvironment();
248
-
249
- // Access services
250
- const executor = forge.getRequestExecutor();
251
- const loader = forge.getCollectionLoader();
252
- ```
253
-
254
- ### Request Execution
255
-
256
- Execute requests with full control over the execution pipeline:
257
-
258
- ```typescript
259
- const result = await forge.execute(request, collection, {
260
- environment: 'production',
261
- overrides: {
262
- url: 'https://override.com/api',
263
- headers: { 'X-Custom': 'value' }
264
- },
265
- skipPreRequest: false,
266
- skipPostResponse: false,
267
- timeout: 5000
268
- });
269
-
270
- // Access results
271
- console.log(result.response); // HTTP response
272
- console.log(result.preRequestResult); // Pre-request script output
273
- console.log(result.postResponseResult); // Test results
274
- ```
275
-
276
- ### Dynamic Variables
277
-
278
- Automatic variable generation within request templates:
279
-
280
- ```javascript
281
- // URL with dynamic timestamp
282
- https://api.example.com/events?timestamp={{$timestamp}}
283
-
284
- // Headers with unique ID
285
- X-Request-ID: {{$uuid}}
286
-
287
- // Query parameters with random value
288
- ?page=1&seed={{$randomInt:1:100}}
39
+ console.log(result.response.status);
40
+ console.log(result.response.body);
289
41
  ```
290
42
 
291
- **Supported dynamic variables:**
292
- - `{{$randomInt}}` - Random integer (0-2147483647)
293
- - `{{$randomInt:min:max}}` - Random integer in range
294
- - `{{$timestamp}}` - Current Unix timestamp (seconds)
295
- - `{{$uuid}}` - UUID v4
296
- - `{{$guid}}` - GUID (alias for uuid)
297
- - `{{$randomString}}` - 10-char alphanumeric string
298
- - `{{$randomHexadecimal}}` - Random hex string
299
- - `{{$isoTimestamp}}` - ISO 8601 timestamp
300
-
301
- ### Script Execution
302
-
303
- Run pre-request and post-response scripts with full Postman API compatibility:
304
-
305
- **Pre-request script - Set variables & modify request:**
306
- ```javascript
307
- // Set variables across scopes
308
- pm.variables.set('requestId', pm.variables.randomUUID());
309
- pm.environment.set('token', 'abc-123');
310
- pm.collectionVariables.set('counter', '1');
311
-
312
- // Modify request headers
313
- pm.request.headers.add({
314
- name: 'X-Request-ID',
315
- value: pm.variables.get('requestId')
316
- });
317
- pm.request.headers.update({
318
- name: 'Authorization',
319
- value: 'Bearer ' + pm.environment.get('token')
320
- });
321
-
322
- // Modify URL and body
323
- pm.request.url = 'https://api.example.com' + pm.request.url;
324
- pm.request.body.raw = JSON.stringify({ timestamp: Date.now() });
325
-
326
- // Set cookies for next request
327
- pm.cookies.set('sessionId', 'sess_abc123');
328
- ```
329
-
330
- **Post-response script - Test & extract data:**
331
- ```javascript
332
- // Run assertions
333
- pm.test('Status is 200', () => {
334
- pm.expect(pm.response.code).to.equal(200);
335
- });
336
- pm.test('Response time under 1s', () => {
337
- pm.expect(pm.response.responseTime).to.be.below(1000);
338
- });
339
-
340
- // Extract data for next request
341
- const data = pm.response.json();
342
- pm.environment.set('userId', data.id);
343
- pm.environment.set('authToken', data.token);
344
-
345
- // Store non-string values (auto-serialized with type safety)
346
- pm.environment.set('userList', data.users); // Array → stored with type marker
347
- pm.environment.set('config', { retries: 3 }); // Object → stored with type marker
348
- pm.environment.set('count', 42); // Number → stored with type marker
349
-
350
- // get() auto-deserializes back to the original type
351
- const users = pm.environment.get('userList'); // → Array
352
- const config = pm.environment.get('config'); // → Object
353
- const count = pm.environment.get('count'); // → 42 (number)
354
-
355
- // Strings are never misinterpreted — "true" stays a string, true stays a boolean
356
- pm.environment.set('flag', true); // boolean
357
- pm.environment.set('label', 'true'); // string
358
- pm.environment.get('flag'); // → true (boolean)
359
- pm.environment.get('label'); // → "true" (string)
360
-
361
- // Store cookies from response
362
- if (pm.response.headers.has('Set-Cookie')) {
363
- pm.cookies.set('authCookie', data.authCookie);
364
- }
365
- ```
366
-
367
- #### Response Body Type
368
-
369
- Like Postman, `pm.response.body` is the **raw response string** — it is not eagerly parsed. Parse JSON on demand:
370
-
371
- ```javascript
372
- const data = pm.response.json(); // parsed object (null if not JSON)
373
- const text = pm.response.text(); // raw string
374
- const obj = JSON.parse(pm.response.body); // body is a string
375
- ```
376
-
377
- `json()` tolerates an already-parsed object body for backward compatibility, but new code should treat `pm.response.body` as a string.
378
-
379
- #### Legacy Postman Globals
380
-
381
- Older Postman scripts and many Newman-exported collections rely on bare globals from the pre-`pm.*` sandbox. The core injects these so legacy scripts run unchanged.
382
-
383
- Available in **both** pre-request and test scripts: `request` (`{ id, name, description, url, method, headers, data }`), `environment` (read snapshot), `globals` (read snapshot), `data` (iteration row), `iteration` (index), and `tv4` (`tv4.validate(data, schema)` — when the optional `tv4` module is installed).
384
-
385
- Available in **test** scripts only: `responseBody` (raw string), `responseCode` (`{ code, name, detail }`), `responseHeaders`, `responseTime`, `responseCookies` (cookie objects with `name`, `value`, `domain`, `path`, `expires`, `maxAge`, `httpOnly`, `secure`, `sameSite`), `tests` (`tests['name'] = boolean`), plus `postman.getResponseHeader(name)` and `postman.getResponseCookie(name)` (case-insensitive; `getResponseCookie` returns the full cookie object, both return `null` if absent).
386
-
387
- ```javascript
388
- // Legacy-style test script — runs unmodified
389
- tests['status 200'] = responseCode.code === 200;
390
- tests['has token'] = JSON.parse(responseBody).token !== undefined;
391
- tests['is json'] = /application\/json/.test(postman.getResponseHeader('Content-Type'));
392
- ```
393
-
394
- > `environment` and `globals` are read snapshots — direct assignment was never persisted in legacy Postman either. Use `postman.setEnvironmentVariable()` / `postman.setGlobalVariable()` (or the modern `pm.environment.set()` / `pm.globals.set()`) to persist changes.
395
-
396
- #### Script Scope
397
-
398
- Control how script levels (collection → folder → request) and the pre-request/post-response phases share a JavaScript scope via `scripts.scope` in `http-forge.config.json` (or the `scriptScope` SDK option):
399
-
400
- | Mode | Behavior |
401
- |------|----------|
402
- | `'shared'` *(default)* | All levels and both phases run in one scope. `var`/`function` and global assignments leak across them; lowest overhead. Top-level `let`/`const` are scoped to a single phase. |
403
- | `'isolated'` | Each level runs in its own scope, matching Postman. Declarations cannot collide or leak; pass state through `pm.variables` / `pm.environment` / `pm.globals`. |
404
-
405
- ```typescript
406
- const forge = ForgeContainer.create({ scriptScope: 'isolated' });
407
- ```
408
-
409
- Use `'isolated'` when importing Postman collections whose scripts re-declare the same identifiers at multiple levels, which would otherwise throw `Identifier already declared` in shared mode.
410
-
411
- #### Async Script Execution (Event-Loop Draining)
412
-
413
- Like Postman, scripts do **not** end when their synchronous code returns. After the sync body completes, the core keeps the sandbox alive and drains pending timers (`setTimeout`/`setInterval`) and microtasks (un-awaited `Promise`s), then commits variable scopes — so deferred `pm.globals` / `pm.environment` / `pm.variables` writes are visible to the next request **without** `await`.
414
-
415
- ```typescript
416
- // Post-response script — committed for the next request, no await required
417
- setTimeout(() => pm.globals.set('authToken', generateToken()), 1500);
418
- ```
419
-
420
- The drain is bounded by `scripts.timeout` (the `scriptTimeout` SDK option), default **5000 ms**, which caps **both** synchronous CPU time and the async-drain window:
421
-
422
- ```typescript
423
- const forge = ForgeContainer.create({ scriptTimeout: 10000 });
424
- ```
425
-
426
- | Behavior | Notes |
427
- |----------|-------|
428
- | Sandbox kept alive after sync return | Pending timers/microtasks drained before the request advances |
429
- | Deferred `pm.*` writes committed | Visible to the next request without `await` |
430
- | Errors in timer/Promise callbacks | Reported as a console error, **non-fatal** — the request/test is not failed |
431
- | Runaway timers | A never-clearing `setInterval` or infinite timer loop is force-cancelled at the timeout, with a warning |
432
- | No async work | Returns immediately; draining adds no measurable latency |
433
-
434
- **Divergences from Postman:** uses real Node timers with a poll-based wall-clock drain (no exact pending-promise count, so pathological microtask recursion is bounded by the budget rather than a precise idle signal); a single `scripts.timeout` bounds both CPU time and the async window.
435
-
436
- ### Environment Management
437
-
438
- ```typescript
439
- // Define multiple environments
440
- forge.setEnvironmentConfig({
441
- dev: { baseUrl: 'https://dev.api.com', apiKey: 'dev-key' },
442
- staging: { baseUrl: 'https://staging.api.com', apiKey: 'staging-key' },
443
- prod: { baseUrl: 'https://api.com', apiKey: 'prod-key' }
444
- });
445
-
446
- // Switch environments
447
- forge.setActiveEnvironment('prod');
448
-
449
- // Get resolved variables (with inheritance and overrides)
450
- const vars = forge.getResolvedEnvironment('prod');
451
- ```
452
-
453
- ## 🔧 Advanced Features
454
-
455
- ### Custom HTTP Client
43
+ ## Core Capabilities
456
44
 
457
- Implement your own HTTP client:
45
+ - Postman collection execution
46
+ - JavaScript pre-request and post-response scripting
47
+ - Dynamic variables and environment resolution
48
+ - Cookie persistence and execution flow control
49
+ - Secret resolution from AWS, Azure, Google Cloud, Vault, 1Password, and Doppler
50
+ - AI and MCP runtime integration
51
+ - Headless execution for CI/CD and custom runners
458
52
 
459
- ```typescript
460
- import { IHttpClient, HttpRequest, HttpResponse } from '@http-forge/core';
53
+ ## Key APIs
461
54
 
462
- class CustomHttpClient implements IHttpClient {
463
- async send(request: HttpRequest): Promise<HttpResponse> {
464
- // Your custom HTTP logic
465
- return {
466
- status: 200,
467
- statusText: 'OK',
468
- headers: {},
469
- body: {},
470
- duration: 100,
471
- size: 1024
472
- };
473
- }
474
- }
475
-
476
- const forge = new ForgeContainer({
477
- httpClient: new CustomHttpClient()
478
- });
479
- ```
480
-
481
- ### Request/Response Interceptors
482
-
483
- Add custom interceptors to modify requests and responses:
484
-
485
- ```typescript
486
- import { IRequestInterceptor, IResponseInterceptor } from '@http-forge/core';
487
-
488
- // Request interceptor
489
- class AuthInterceptor implements IRequestInterceptor {
490
- async intercept(request: HttpRequest): Promise<HttpRequest> {
491
- request.headers['Authorization'] = `Bearer ${getToken()}`;
492
- return request;
493
- }
494
- }
495
-
496
- // Response interceptor
497
- class LoggingInterceptor implements IResponseInterceptor {
498
- async intercept(response: HttpResponse, request: HttpRequest): Promise<HttpResponse> {
499
- console.log(`${request.method} ${request.url} -> ${response.status}`);
500
- return response;
501
- }
502
- }
503
-
504
- const forge = new ForgeContainer({
505
- requestInterceptors: [new AuthInterceptor()],
506
- responseInterceptors: [new LoggingInterceptor()]
507
- });
508
- ```
509
-
510
- ### Cookie Management & Persistence
511
-
512
- Automatic cookie storage and reuse across multi-request flows:
513
-
514
- ```typescript
515
- const forge = new ForgeContainer({
516
- enableCookies: true // Cookies persist across requests in session
517
- });
518
-
519
- // Login - response sets Session-ID cookie
520
- const loginResult = await forge.execute(loginRequest, collection);
521
-
522
- // Subsequent requests automatically include Session-ID
523
- // No need to manually extract and re-add cookies
524
- const dataResult = await forge.execute(dataRequest, collection);
525
- const updateResult = await forge.execute(updateRequest, collection);
526
- ```
527
-
528
- **Access cookies in scripts:**
529
- ```javascript
530
- // Pre-request script - read stored cookies
531
- if (pm.cookies.has('sessionId')) {
532
- const sid = pm.cookies.get('sessionId');
533
- pm.request.headers.add({
534
- name: 'Cookie',
535
- value: 'sessionId=' + sid
536
- });
537
- }
538
-
539
- // Post-response script - store new cookies
540
- pm.response.cookies.forEach(cookie => {
541
- pm.cookies.set(cookie.name, cookie.value);
542
- });
543
-
544
- // Read a response cookie (Postman-compatible CookieList)
545
- const sid = pm.response.cookies.get('sessionId'); // value string
546
- const sidCookie = pm.response.cookies.one('sessionId'); // full object
547
- if (sidCookie?.secure && sidCookie.maxAge > 0) { /* ... */ }
548
-
549
- // List all active cookies
550
- const allCookies = pm.cookies.list(); // [{name, value}, ...]
551
-
552
- // Clear cookies
553
- pm.cookies.clear(); // When switching users/sessions
554
- ```
555
-
556
- Cookies are automatically extracted from `Set-Cookie` response headers and reused in subsequent `Cookie` request headers.
557
-
558
- ### Request History
559
-
560
- Track all executed requests:
561
-
562
- ```typescript
563
- const forge = new ForgeContainer({
564
- enableHistory: true,
565
- maxHistoryEntries: 100
566
- });
567
-
568
- // Execute requests
569
- await forge.execute(request1, collection);
570
- await forge.execute(request2, collection);
571
-
572
- // Access history
573
- const history = forge.getRequestHistory();
574
- const entries = history.getAll(); // All requests
575
- const byId = history.getByRequestId(id); // Specific request history
576
- ```
577
-
578
- ## 📖 API Reference
579
-
580
- ### ForgeContainer
581
-
582
- **Constructor Options:**
583
- ```typescript
584
- interface ForgeContainerOptions {
585
- forgeRoot?: string; // Path to http-forge folder
586
- storageFormat?: 'file' | 'folder'; // Collection storage format
587
-
588
- // HTTP Settings
589
- useNativeHttp?: boolean; // Use native http/https
590
- httpClient?: IHttpClient; // Custom HTTP client
591
- httpSettings?: RequestSettings; // Default HTTP settings
592
- requestTimeout?: number; // Request timeout (ms)
593
-
594
- // Cookie Settings
595
- enableCookies?: boolean; // Enable cookie jar
596
- cookieJar?: ICookieJar; // Custom cookie jar
597
-
598
- // Interceptors
599
- requestInterceptors?: IRequestInterceptor[];
600
- responseInterceptors?: IResponseInterceptor[];
601
- errorInterceptors?: IErrorInterceptor[];
602
-
603
- // Script Settings
604
- scriptRunner?: IScriptRunner; // Custom script runner
605
- scriptTimeout?: number; // Script budget (ms); caps CPU time + async-drain window. Default 5000
606
-
607
- // History
608
- enableHistory?: boolean; // Enable request history
609
- maxHistoryEntries?: number; // Max history size
610
-
611
- // File Watching
612
- fileWatcherFactory?: IFileWatcherFactory; // Watch for collection/environment file changes
613
- }
614
- ```
615
-
616
- **Methods:**
617
- ```typescript
618
- // Collection loading
619
- loadCollection(path: string): Promise<UnifiedCollection>
620
- loadFolderCollection(path: string): Promise<UnifiedCollection>
621
-
622
- // Request execution
623
- execute(
624
- request: UnifiedRequest,
625
- collection: UnifiedCollection,
626
- options?: ExecuteOptions
627
- ): Promise<ExecuteResult>
628
-
629
- // Environment management
630
- setEnvironment(variables: Record<string, string>): void
631
- setEnvironmentConfig(config: EnvironmentConfig): void
632
- setActiveEnvironment(name: string): void
633
- getResolvedEnvironment(name?: string): Record<string, string>
634
-
635
- // Service access
636
- getRequestExecutor(): RequestExecutor
637
- getCollectionLoader(): ICollectionLoader
638
- getEnvironmentResolver(): EnvironmentResolver
639
- getRequestHistory(): IRequestHistory
640
- ```
641
-
642
- ### ExecuteResult
643
-
644
- ```typescript
645
- interface ExecuteResult {
646
- response: HttpResponse; // HTTP response
647
- preRequestResult?: ScriptResult; // Pre-request script output
648
- postResponseResult?: ScriptResult; // Test results
649
- requestId: string; // Unique request ID
650
- timestamp: number; // Execution timestamp
651
- }
652
- ```
653
-
654
- ### HttpResponse
655
-
656
- ```typescript
657
- interface HttpResponse {
658
- status: number; // HTTP status code
659
- statusText: string; // Status text
660
- headers: Record<string, string>; // Response headers
661
- body: any; // Parsed response body
662
- cookies?: Cookie[]; // Response cookies
663
- duration: number; // Request duration (ms)
664
- size: number; // Response size (bytes)
665
- redirected?: boolean; // Whether redirected
666
- }
667
- ```
668
-
669
- ### KeyValueEntry
670
-
671
- Used for headers and query parameters in `CollectionRequest`. Supports OpenAPI metadata for generation and validation.
672
-
673
- ```typescript
674
- interface KeyValueEntry {
675
- key: string;
676
- value: string;
677
- enabled?: boolean;
678
- // OpenAPI metadata (all optional, backward-compatible)
679
- type?: 'string' | 'integer' | 'number' | 'boolean' | 'array';
680
- required?: boolean;
681
- description?: string;
682
- format?: string; // Semantic hint (e.g. "uuid", "date-time")
683
- enum?: string[]; // Allowed values
684
- deprecated?: boolean;
685
- // Extended constraint fields for full OpenAPI round-trip
686
- pattern?: string; // Regex validation pattern
687
- minimum?: number;
688
- maximum?: number;
689
- exclusiveMinimum?: number;
690
- exclusiveMaximum?: number;
691
- minLength?: number;
692
- maxLength?: number;
693
- oneOf?: Array<Record<string, any>>; // Merged constraint variants
694
- }
695
- ```
696
-
697
- ### PathParamEntry
698
-
699
- Used for path parameters (`:param` in URLs). Same constraint fields as `KeyValueEntry` minus `key`/`enabled`.
700
-
701
- ```typescript
702
- interface PathParamEntry {
703
- value: string;
704
- type?: 'string' | 'integer' | 'number' | 'boolean';
705
- description?: string;
706
- format?: string;
707
- enum?: string[];
708
- deprecated?: boolean;
709
- pattern?: string;
710
- minimum?: number;
711
- maximum?: number;
712
- exclusiveMinimum?: number;
713
- exclusiveMaximum?: number;
714
- minLength?: number;
715
- maxLength?: number;
716
- oneOf?: Array<Record<string, any>>;
717
- }
718
- ```
719
-
720
- ### Postman Collection Import / Export
721
-
722
- `CollectionService` can import and export Postman Collection v2.1 JSON files, preserving all request body types, auth, scripts, and folder structure.
723
-
724
- **Import** (`importCollection(filePath)`):
725
-
726
- Detects Postman format by `info._postman_id` and converts all five body modes:
727
-
728
- | Postman `mode` | HTTP Forge `type` | Notes |
729
- |---|---|---|
730
- | `raw` | `raw` | `format` inferred from `options.raw.language` (json/xml/html/javascript/text) |
731
- | `urlencoded` | `x-www-form-urlencoded` | Fields mapped to `[{key, value, enabled}]` |
732
- | `formdata` | `form-data` | Fields mapped to `[{key, value, type, enabled}]` |
733
- | `graphql` | `graphql` | `variables` JSON string parsed to object |
734
- | `binary` | `binary` | File path not portable; imported with empty content |
735
-
736
- Auth types `bearer`, `basic`, and `apikey` are converted. Pre-request and test scripts (`prerequest`/`test` events) are imported as `scripts.preRequest`/`scripts.postResponse`. Folder hierarchy and item order are preserved.
737
-
738
- The whole collection is built in memory and persisted with a single `saveCollection()`
739
- call. `FolderCollectionStore.save()` writes sibling items and each request's
740
- independent files (body, docs, scripts, schemas) in parallel and writes each
741
- metadata file once; fresh imports skip stale-body cleanup and schema-existence
742
- probes. Loaders read JSON via a `readJsonFileSafe` helper that silently skips
743
- empty or half-written files, so a watcher reloading mid-import never throws
744
- `Unexpected end of JSON input`.
745
-
746
- **Export** (`exportCollection(collectionId, filePath)`):
747
-
748
- Converts back to Postman v2.1 JSON. All body types round-trip correctly: `x-www-form-urlencoded` exports as `mode: "urlencoded"`, `form-data` as `mode: "formdata"`, `graphql` as `mode: "graphql"`, and `binary` as `mode: "binary"`.
749
-
750
- ```typescript
751
- const service = container.getCollectionService();
752
-
753
- // Import
754
- const collection = await service.importCollection('./my-api.postman_collection.json');
755
-
756
- // Export
757
- await service.exportCollection(collection.id, './exported.postman_collection.json');
758
- ```
759
-
760
- ### OpenAPI Import / Export
761
-
762
- The core library includes full OpenAPI 3.0.3 import and export with constraint preservation.
763
-
764
- **Import** (`OpenApiImporter`):
765
- - Parses OpenAPI 3.0 YAML/JSON specs into `UnifiedCollection`
766
- - Extracts all parameter schema constraints (`pattern`, `minimum`, `maximum`, `exclusiveMinimum`, `exclusiveMaximum`, `minLength`, `maxLength`, `enum`, `format`)
767
- - Preserves `oneOf` schemas from merged parameters, deriving combined enum hints for UI display
768
-
769
- **Export** (`OpenApiExporter`):
770
- - Generates OpenAPI 3.0.3 specs from collections
771
- - **Host-variable server resolution** — Any `{{varName}}` that prefixes a request URL (e.g. `{{dcqHost}}/api/...`) is stripped from the path and resolved to a server URL entry. If the variable resolves in the active environment(s), a concrete `url` is added to `servers`. If unresolvable, an OAS server-variable entry is emitted: `url: '{varName}', variables: { varName: { default: '' } }`. This handles arbitrary host variables beyond `{{baseUrl}}`.
772
- - **Environment variable placeholder sanitization** — `{{varName}}` tokens in parameter examples (path, query, header) and request body examples are replaced with `<varName>` so the exported spec contains readable human placeholders rather than raw template syntax.
773
- - **Collision-aware merging**: When multiple requests normalize to the same path + HTTP method, they are merged into a single operation:
774
- - Descriptions are appended, tags are unioned
775
- - Parameters with the **same constraint kind** (both enum, both pattern, etc.) are merged in-place (union enum values, widen numeric ranges, alternation-join patterns)
776
- - Parameters with **different constraint kinds** are wrapped in `oneOf` — each variant keeps its self-consistent schema
777
- - All constraint fields round-trip without data loss
778
-
779
- ## � Exported Types
780
-
781
- ### Configuration
782
-
783
- `HttpForgeConfig` is the shape of `http-forge.config.json`. Key sub-interfaces:
784
-
785
- | Interface | Description |
786
- |---|---|
787
- | `StorageConfig` | Root/history/results paths |
788
- | `RequestConfig` | Timeout, redirects, SSL |
789
- | `ScriptsConfig` | Module search paths |
790
- | `RunnerConfig` | Retention, index page size |
791
- | `EnvironmentsConfig` | Default environment |
792
- | `RestClientExportConfig` | REST Client export path/merge settings |
793
- | `McpConfig` | MCP server project-level settings (see below) |
794
- | `ProxyConfig` | HTTP/HTTPS proxy URLs |
795
-
796
- **`McpConfig`** — controls what the HTTP Forge MCP server exposes to AI agents. All fields are optional; the service fills defaults automatically via `IConfigService.getMcpConfig()`.
797
-
798
- ```typescript
799
- interface McpConfig {
800
- excludedCollections: string[]; // IDs or names to hide (default: [] = expose all)
801
- excludedSuites: string[]; // IDs or names to hide (default: [] = expose all)
802
- toolPrefix: string; // Prefix for every tool name (default: "")
803
- maxRequestsPerCall: number; // Safety cap per collection/suite call (default: 500; min 1, max 10000)
804
- toolMode: 'flat' | 'drilldown' | 'auto'; // How tools are exposed (default: 'auto')
805
- drilldownThreshold: number; // 'auto' switches to drill-down above this request-tool count (default: 100; min 10, max 500)
806
- toolPageSize: number; // Max tools per tools/list page (default: 200; 0 = no pagination; min 10, max 1000)
807
- cors: {
808
- allowedOrigins: string[]; // CORS origins (default: ["http://localhost","http://127.0.0.1"])
809
- };
810
- }
811
- ```
812
-
813
- **`toolMode`** controls how collections/requests are surfaced as MCP tools:
814
-
815
- - `auto` (**default**) — uses `flat` below `drilldownThreshold` (100 requests), then switches to `drilldown`. Adapts automatically as the workspace grows.
816
- - `drilldown` — a small fixed set of generic tools (`list_collections`, `list_requests`, `run_request`, `run_folder`, `run_collection`, `run_suite`) whose arguments select the target. Keeps the tool list tiny regardless of scale.
817
- - `flat` — one tool per request, folder, collection, and suite. Only suitable for small, stable collections (<100 requests). **Avoid for large workspaces** — the tool list bloats the AI context window and degrades tool-selection accuracy.
818
-
819
- Use `IConfigService.getMcpConfig()` to read the resolved config with all defaults applied.
820
-
821
- ---
822
-
823
- ## �🛠️ Use Cases
824
-
825
- ### CLI Tool
826
-
827
- ```typescript
828
- #!/usr/bin/env node
829
- import { ForgeContainer } from '@http-forge/core';
830
-
831
- async function runTests(collectionPath: string) {
832
- const forge = new ForgeContainer();
833
- const collection = await forge.loadCollection(collectionPath);
834
-
835
- for (const request of collection.items) {
836
- const result = await forge.execute(request, collection);
837
- const tests = result.postResponseResult?.assertions || [];
838
-
839
- console.log(`\n${request.name}: ${result.response.status}`);
840
- tests.forEach(test => {
841
- console.log(` ${test.passed ? '✓' : '✗'} ${test.name}`);
842
- });
843
- }
844
- }
845
-
846
- runTests(process.argv[2]);
847
- ```
848
-
849
- ### CI/CD Integration
850
-
851
- ```typescript
852
- import { ForgeContainer } from '@http-forge/core';
853
-
854
- async function ciTest() {
855
- const forge = new ForgeContainer({
856
- enableCookies: true,
857
- requestTimeout: 30000
858
- });
859
-
860
- forge.setEnvironment({
861
- baseUrl: process.env.API_URL,
862
- apiKey: process.env.API_KEY
863
- });
864
-
865
- const collection = await forge.loadCollection('./api-tests.forge.json');
866
-
867
- let failedTests = 0;
868
- for (const request of collection.items) {
869
- const result = await forge.execute(request, collection);
870
- const failed = result.postResponseResult?.assertions?.filter(t => !t.passed) || [];
871
- failedTests += failed.length;
872
- }
873
-
874
- process.exit(failedTests > 0 ? 1 : 0);
875
- }
876
- ```
877
-
878
- ### Custom Testing Framework
879
-
880
- ```typescript
881
- import { ForgeContainer } from '@http-forge/core';
882
-
883
- class ApiTestRunner {
884
- private forge: ForgeContainer;
885
-
886
- constructor() {
887
- this.forge = new ForgeContainer({
888
- enableCookies: true,
889
- enableHistory: true
890
- });
891
- }
892
-
893
- async runSuite(suites: TestSuite[]) {
894
- for (const suite of suites) {
895
- await this.runTests(suite);
896
- }
897
- }
898
-
899
- async runTests(suite: TestSuite) {
900
- const collection = await this.forge.loadCollection(suite.collection);
901
-
902
- for (const request of collection.items) {
903
- const result = await this.forge.execute(request, collection);
904
- suite.results.push(result);
905
- }
906
- }
907
- }
908
- ```
909
-
910
- ### Multi-Request Workflows
911
-
912
- Execute dependent request chains with automatic cookie and variable management:
913
-
914
- ```typescript
915
- import { ForgeContainer } from '@http-forge/core';
916
-
917
- async function apiAuthWorkflow() {
918
- const forge = new ForgeContainer({
919
- enableCookies: true, // Cookies persist across requests
920
- enableHistory: true
921
- });
922
-
923
- // Request 1: Login (sets session cookie)
924
- const loginReq = {
925
- name: 'Login',
926
- method: 'POST',
927
- url: 'https://api.example.com/auth/login',
928
- body: { type: 'raw', content: JSON.stringify({
929
- username: '{{email}}',
930
- password: '{{password}}'
931
- })},
932
- scripts: {
933
- postResponse: `
934
- const { token, userId } = pm.response.json();
935
- pm.environment.set('authToken', token);
936
- pm.environment.set('userId', userId);
937
- `
938
- }
939
- };
940
-
941
- const loginResult = await forge.execute(loginReq, collection);
942
- console.log('✓ Logged in, token:', forge.getResolvedEnvironment()['authToken']);
943
-
944
- // Request 2: Fetch user profile (uses session cookie automatically)
945
- const profileReq = {
946
- name: 'Get Profile',
947
- method: 'GET',
948
- url: 'https://api.example.com/users/{{userId}}',
949
- headers: {
950
- 'Authorization': 'Bearer {{authToken}}' // Uses token from login
951
- }
952
- };
953
-
954
- const profileResult = await forge.execute(profileReq, collection);
955
- console.log('✓ Profile:', profileResult.response.body);
956
-
957
- // Request 3: Update profile (session cookie still active)
958
- const updateReq = {
959
- name: 'Update Profile',
960
- method: 'PATCH',
961
- url: 'https://api.example.com/users/{{userId}}',
962
- headers: {
963
- 'Authorization': 'Bearer {{authToken}}'
964
- },
965
- body: { type: 'raw', content: JSON.stringify({ status: 'active' })}
966
- };
967
-
968
- const updateResult = await forge.execute(updateReq, collection);
969
- console.log('✓ Updated profile');
970
-
971
- // Session automatically logged out - cookies cleared
972
- forge.getRequestHistory().clear();
973
- }
974
- ```
975
-
976
- ## 📦 Storage Formats
977
-
978
- ### File Format (Single JSON)
979
- ```
980
- my-api.forge.json
981
- ```
982
-
983
- ### Folder Format (Directory Structure)
984
- ```
985
- my-api/
986
- collection.json
987
- requests/
988
- login/
989
- request.json
990
- doc.md # Optional request documentation (Markdown)
991
- users/
992
- get-users/
993
- request.json
994
- doc.md
995
- create-user/
996
- request.json
997
- ```
998
-
999
- ## 🤝 Contributing
1000
-
1001
- Contributions are welcome! Please feel free to submit a Pull Request.
1002
-
1003
- ## 📄 License
1004
-
1005
- MIT © Henry Huang
1006
-
1007
- ## 🔗 Links
1008
-
1009
- - [HTTP Forge Extension](https://marketplace.visualstudio.com/items?itemName=your-publisher.http-forge)
1010
- - [GitHub Repository](https://github.com/hsl1230/http-forge)
1011
- - [Issues](https://github.com/hsl1230/http-forge/issues)
1012
-
1013
- ## 📝 Changelog
1014
-
1015
- ### 0.7.0 (AI & Analysis)
1016
-
1017
- - ✅ **`IAiProvider`** — Platform-agnostic LLM interface; bring Copilot, OpenAI, Anthropic, or any other LLM
1018
- - ✅ **`enhanceCollection`** — Batch-enhances collection requests with AI-written example bodies and `pm.test()` scripts
1019
- - ✅ **`scanCollectionForEnvVarsWithAi`** — AI-powered scan for hardcoded values (keys, tokens, base URLs)
1020
- - ✅ **`detectEnvSuggestions`** / **`applyEnvSuggestionsToItems`** — Heuristic env var detection (no LLM)
1021
- - ✅ **`parseCurlCommand`** — Tokenising shell curl parser producing a ready-to-persist `ParsedCurlRequest`
1022
- - ✅ **MCP agentic tools** — `ai_suggest_env_vars`, `ai_enhance_collection`, `suggest_env_vars`, `apply_env_vars`, `get_requests_for_enhancement`, `apply_request_enhancements`
1023
- - ✅ **MCP gap-closure tools** — `analyze_coverage`, `ai_analyze_coverage`, `validate_against_spec`, `generate_request_from_intent`, `generate_scenarios`, `heal_assertions`, `generate_iteration_data`
1024
-
1025
- ### 0.2.16 (Duplicate Collection & Folder)
1026
-
1027
- - ✅ **`duplicateCollection(sourceId, newName)`** — Duplicates a collection including all nested folders, requests, scripts, and schemas
1028
- - ✅ **`duplicateFolder(collectionId, folderId, newName)`** — Duplicates a folder within a collection, preserving all nested request content
1029
- - ✅ **`getItemPath(collectionId, itemId)`** — Resolves the disk path of a folder or request within a collection
1030
-
1031
- ### 0.2.6 (OpenAPI Export — Environment Variable Handling)
1032
-
1033
- - ✅ **Host-variable URL stripping** — Any leading `{{varName}}` in a request URL (e.g. `{{dcqHost}}/DCQ/templates/GetEpg`) is now correctly stripped from the path. The variable name is resolved via `envConfigService.resolveVariables()` and the resulting URL is added to `servers`. When the variable cannot be resolved, an OAS server-variable entry (`url: '{varName}', variables: { varName: { default: '' } }`) is emitted instead. Previously, unknown host variables were converted to `/{varName}/...` path segments.
1034
- - ✅ **Example sanitization** — `{{varName}}` placeholders in parameter examples (path, query, header) and request body examples are replaced with `<varName>` so they render as readable human placeholders instead of raw template syntax in the exported spec.
1035
-
1036
- ### 0.2.5 (OpenAPI Constraint Round-Trip & Collision Merging)
1037
-
1038
- - ✅ **Full parameter constraint round-trip** — OpenAPI import/export now preserves all schema constraint fields: `pattern`, `minimum`, `maximum`, `exclusiveMinimum`, `exclusiveMaximum`, `minLength`, `maxLength`, and `oneOf` on both `KeyValueEntry` and `PathParamEntry`
1039
- - ✅ **Collision-aware OpenAPI export** — When multiple requests normalize to the same path + HTTP method, the exporter merges them into a single operation with intelligent parameter schema merging (same-kind merge in-place, different-kind wraps in `oneOf`)
1040
- - ✅ **`oneOf` import with UI hints** — `applyOneOfHints()` derives combined enum arrays and type hints from `oneOf` variants for downstream UI rendering (combobox vs strict dropdown)
1041
- - ✅ **`format` vs `pattern` separation** — `format` is a semantic hint (e.g. `"uuid"`), `pattern` is an enforced regex. Both stored and round-tripped independently
55
+ - `ForgeContainer`
56
+ - `runRequest(options)`
57
+ - `runCollection(options)`
58
+ - `runSuite(options)`
59
+ - `createMcpRuntime(options)`
60
+ - `parseCurlCommand()`
61
+ - `enhanceCollection()`
62
+ - `detectEnvSuggestions()`
1042
63
 
1043
- ### 0.2.4 (File Watching & Request Documentation)
64
+ ## Best For
1044
65
 
1045
- - ✅ **File watching for CollectionService** - Automatic reload and `onCollectionsChanged` callback when collection files change on disk
1046
- - ✅ **File watching for EnvironmentConfigService** - Automatic reload and `onEnvironmentsChanged` callback when environment JSON files change on disk
1047
- - ✅ **Request documentation (`doc.md`)** - Persist per-request Markdown documentation as `doc.md` alongside `request.json`
1048
- - ✅ **`doc` field on UnifiedRequest / CollectionRequest** - Optional `doc?: string` field for request documentation content
1049
- - ✅ **`fileWatcherFactory` bootstrap option** - Pass `IFileWatcherFactory` to enable file watching in both collection and environment services
66
+ - Headless API testing
67
+ - CI/CD API validation
68
+ - Postman-compatible automation
69
+ - Custom API CLIs and runners
70
+ - MCP and agent-driven API workflows
1050
71
 
1051
- ### 0.2.0 (Postman API Parity)
72
+ ## Detailed Docs
1052
73
 
1053
- - ✅ **Async `pm.test()` support** - Tests with async callbacks are properly awaited
1054
- - ✅ **Expect chain assertions** - `.a(type)`, `.an(type)`, `.deep.equal()`, `.lengthOf()`, `.exist`, `.members()`, `.keys()`, `.string()`
1055
- - ✅ **`pm.iterationData`** scope - Data-driven testing with iteration variables
1056
- - ✅ **Response status getters** - `response.to.be.ok`, `.error`, `.clientError`, `.serverError` work as getters and functions
1057
- - ✅ **Response headers HeaderList** - `.get()`, `.has()`, `.toObject()`, `.each()` on `pm.response.headers`
1058
- - ✅ **`pm.cookies.toObject()`** - Flat `{name: value}` cookie map
1059
- - ✅ **`replaceIn()` on all scopes** - Available on `pm.variables`, `pm.environment`, `pm.collectionVariables`, `pm.globals`
1060
- - ✅ **Sandbox globals** - `xml2Json()`, `jsonStringify()`, `jsonParse()` available in scripts
1061
- - ✅ **Request headers API** - `.toObject()`, `.each()` on `pm.request.headers`
1062
- - ✅ **`pm.execution.setNextRequest()`** - Runner flow control (jump to named request or stop with `null`)
1063
- - ✅ **`pm.execution.skipRequest()`** - Skip HTTP call from pre-request scripts
1064
- - ✅ **`pm.setNextRequest()`** - Top-level alias for flow control
1065
- - ✅ **`pm.visualizer.set(template, data)`** - Custom HTML visualization with Handlebars templates
1066
- - ✅ **`pm.request.url` as Url object** - Postman SDK-compatible Url with `getHost()`, `getPath()`, `getQueryString()`, `protocol`, `host`, `port`, `path`, `query`, `hash`
1067
- - ✅ **Full CryptoJS** - AES/DES/TripleDES encrypt/decrypt, PBKDF2, all hash algorithms (SHA1/256/384/512/SHA3/MD5/RIPEMD160), HMAC, encoding helpers (Hex/Base64/Utf8/Latin1/Utf16)
74
+ - Full core reference: `docs/core-reference.md`
75
+ - Runtime APIs: `RUNTIME-API.md`
76
+ - Quick reference: `docs/QUICK_REFERENCE.md`
77
+ - Architecture notes: `docs/ARCHITECTURE_IMPLEMENTATION.md`
78
+ - Documentation inventory: `docs/README_DOCUMENTATION.md`
1068
79
 
1069
- ### 0.1.0 (Initial Release)
80
+ ## License
1070
81
 
1071
- - ✅ **Core request execution** with Postman collection support
1072
- - ✅ **Dynamic variables** - 7 generators for on-the-fly value generation
1073
- - ✅ **Postman-compatible scripting** - `pm.*` API with full feature parity
1074
- - ✅ **Variable scoping** - globals, collection, environment, session, flow-level
1075
- - ✅ **Cookie persistence** - automatic storage and reuse across request chains
1076
- - ✅ **Pre-request & post-response scripts** with shared VM context
1077
- - ✅ **Test assertions** with BDD-style `pm.test()` and expect chains
1078
- - ✅ **Environment management** with variable substitution
1079
- - ✅ **Cookie jar** with domain-aware matching
1080
- - ✅ **Request/response interceptors** for customization
1081
- - ✅ **Request history** tracking
1082
- - ✅ **File and folder collection formats** (Postman-compatible)
1083
- - ✅ **Full TypeScript support** with comprehensive types
1084
- - ✅ **Dependency injection** for extensibility
1085
- - ✅ **Comprehensive test coverage**
82
+ MIT