@http-forge/cli 0.1.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Henry Huang
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,316 @@
1
+ # HTTP Forge CLI
2
+
3
+ Command-line interface for executing HTTP Forge collections, test suites, and MCP server operations.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ cd http-forge.cli
9
+ npm install
10
+ npm run build
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ### 1. Show Help
16
+
17
+ ```bash
18
+ http-forge --help
19
+ http-forge -h
20
+ ```
21
+
22
+ ### 2. Run a Single Request
23
+
24
+ ```bash
25
+ http-forge run-request \
26
+ --collection my-api \
27
+ --request get-users \
28
+ --environment production \
29
+ --output json
30
+ ```
31
+
32
+ ```bash
33
+ http-forge run-request --collection my-api --request get-users --include tests --include report
34
+ ```
35
+
36
+ **Required:**
37
+ - `--collection <id>` — Collection ID
38
+ - `--request <id>` — Request ID
39
+
40
+ **Optional:**
41
+ - `--workspace <path>` — Workspace folder (default: current directory)
42
+ - `--environment <name>` — Environment to use
43
+ - `--include <field>` — Include extra fields (repeatable): `headers`, `cookies`, `tests`, `consoleOutput`, `report`
44
+ - `--output <fmt>` — Output format: `json` or `table` (default: `json`)
45
+
46
+ ### 3. Run a Collection
47
+
48
+ ```bash
49
+ http-forge run-collection \
50
+ --collection my-api \
51
+ --environment dev \
52
+ --include perRequest \
53
+ --output json
54
+ ```
55
+
56
+ **Required:**
57
+ - `--collection <id>` — Collection ID
58
+
59
+ **Optional:**
60
+ - `--workspace <path>` — Workspace folder (default: current directory)
61
+ - `--environment <name>` — Environment to use
62
+ - `--iterations <num>` — Number of iterations (default: 1)
63
+ - `--stop-on-error` — Stop on first failure
64
+ - `--delay <ms>` — Delay between requests (milliseconds)
65
+ - `--include <field>` — Include extra fields (repeatable): `perRequest`, `failedOnly`, `consoleOutput`, `report`
66
+ - `--output <fmt>` — Output format: `json` or `table` (default: `json`)
67
+
68
+ ### 4. Run a Test Suite
69
+
70
+ ```bash
71
+ http-forge run-suite \
72
+ --suite smoke-tests \
73
+ --iterations 3 \
74
+ --include failedOnly \
75
+ --include report \
76
+ --output json
77
+ ```
78
+
79
+ **Required:**
80
+ - `--suite <id>` — Suite ID
81
+
82
+ **Optional:**
83
+ - `--workspace <path>` — Workspace folder (default: current directory)
84
+ - `--environment <name>` — Environment to use
85
+ - `--iterations <num>` — Number of iterations
86
+ - `--stop-on-error` — Stop on first failure
87
+ - `--delay <ms>` — Delay between requests (milliseconds)
88
+ - `--include <field>` — Include extra fields (repeatable): `perRequest`, `failedOnly`, `consoleOutput`, `report`
89
+ - `--output <fmt>` — Output format: `json` or `table` (default: `json`)
90
+
91
+ ### 5. Manage MCP Server
92
+
93
+ Start, stop, or check the status of an embedded MCP (Model Context Protocol) server for AI agent integration:
94
+
95
+ ```bash
96
+ http-forge mcp-server start --port 3100
97
+ http-forge mcp-server status --workspace .
98
+ http-forge mcp-server stop --workspace .
99
+ ```
100
+
101
+ **Actions:**
102
+ - `start` — Start MCP server (default)
103
+ - `stop` — Stop MCP server for the workspace
104
+ - `status` — Show MCP server status for the workspace
105
+
106
+ **Options:**
107
+ - `--port <num>` — Port to listen on (default: 3100)
108
+ - `--host <addr>` — Host to bind to (default: 127.0.0.1)
109
+ - `--workspace <path>` — Workspace folder (default: current directory)
110
+
111
+ ### MCP JSON-RPC Usage
112
+
113
+ After starting the server with `http-forge mcp-server start`, call the MCP endpoint at `POST /`.
114
+
115
+ JSON-RPC request shape:
116
+
117
+ ```typescript
118
+ interface JsonRpcRequest {
119
+ jsonrpc: '2.0';
120
+ id: string | number | null;
121
+ method: string;
122
+ params?: Record<string, unknown>;
123
+ }
124
+ ```
125
+
126
+ #### Initialize
127
+
128
+ ```bash
129
+ curl -X POST http://127.0.0.1:3100 \
130
+ -H "Content-Type: application/json" \
131
+ -d '{
132
+ "jsonrpc": "2.0",
133
+ "id": 1,
134
+ "method": "initialize",
135
+ "params": {}
136
+ }'
137
+ ```
138
+
139
+ #### List tools
140
+
141
+ ```bash
142
+ curl -X POST http://127.0.0.1:3100 \
143
+ -H "Content-Type: application/json" \
144
+ -d '{
145
+ "jsonrpc": "2.0",
146
+ "id": 2,
147
+ "method": "tools/list"
148
+ }'
149
+ ```
150
+
151
+ #### Call a tool
152
+
153
+ ```bash
154
+ curl -X POST http://127.0.0.1:3100 \
155
+ -H "Content-Type: application/json" \
156
+ -d '{
157
+ "jsonrpc": "2.0",
158
+ "id": 3,
159
+ "method": "tools/call",
160
+ "params": {
161
+ "name": "request__my-api__get-users",
162
+ "arguments": {
163
+ "environment": "dev",
164
+ "include": ["tests", "report"]
165
+ }
166
+ }
167
+ }'
168
+ ```
169
+
170
+ #### Health check
171
+
172
+ ```bash
173
+ curl http://127.0.0.1:3100/health
174
+ ```
175
+
176
+ #### Legacy compatibility endpoint
177
+
178
+ For non-MCP clients, a compatibility endpoint is also available:
179
+
180
+ ```bash
181
+ curl -X POST http://127.0.0.1:3100/tools/execute \
182
+ -H "Content-Type: application/json" \
183
+ -d '{
184
+ "name": "request__my-api__get-users",
185
+ "args": { "environment": "dev" }
186
+ }'
187
+ ```
188
+
189
+ Common JSON-RPC error codes:
190
+ - `-32700` Parse error (invalid JSON)
191
+ - `-32603` Internal error (dispatch/runtime failures, including unknown method)
192
+
193
+ ## Exit Codes
194
+
195
+ - `0` — Success
196
+ - `1` — Execution error (request failed, assertions failed, etc.)
197
+ - `2` — Invalid arguments or missing required options
198
+
199
+ ## Environment Variables
200
+
201
+ - `HTTP_FORGE_WORKSPACE` — Override default workspace folder
202
+
203
+ ## Examples
204
+
205
+ ### Run smoke tests on staging
206
+
207
+ ```bash
208
+ http-forge run-suite \
209
+ --suite smoke-tests \
210
+ --environment staging \
211
+ --stop-on-error
212
+ ```
213
+
214
+ ### Execute collection with custom variables
215
+
216
+ ```bash
217
+ http-forge run-collection \
218
+ --collection my-api \
219
+ --environment dev
220
+ ```
221
+
222
+ ### Run same test 5 times with delays
223
+
224
+ ```bash
225
+ http-forge run-collection \
226
+ --collection my-api \
227
+ --iterations 5 \
228
+ --delay 1000 \
229
+ --stop-on-error
230
+ ```
231
+
232
+ ### Get JSON output for scripting
233
+
234
+ ```bash
235
+ http-forge run-request \
236
+ --collection api \
237
+ --request login \
238
+ --output json | jq '.allPassed'
239
+ ```
240
+
241
+ ## Output Format
242
+
243
+ ### JSON Format (default)
244
+
245
+ ```json
246
+ {
247
+ "request": "Get Users",
248
+ "status": 200,
249
+ "ok": true,
250
+ "duration": "145ms",
251
+ "allPassed": true,
252
+ "assertions": [
253
+ {
254
+ "name": "Status is 200",
255
+ "passed": true
256
+ }
257
+ ]
258
+ }
259
+ ```
260
+
261
+ ### Table Format
262
+
263
+ ```
264
+ Request: Get Users
265
+ Status: 200
266
+ OK: true
267
+ Time: 145ms
268
+ Tests: ✅ All passed
269
+ ```
270
+
271
+ ## Error Handling
272
+
273
+ All errors are written to stderr with detailed messages:
274
+
275
+ ```bash
276
+ $ http-forge run-request --collection missing --request test 2>&1
277
+ Error: Collection "missing" not found
278
+ ```
279
+
280
+ ## Testing
281
+
282
+ Run tests to verify CLI functionality:
283
+
284
+ ```bash
285
+ npm test
286
+ ```
287
+
288
+ ## Development
289
+
290
+ ### Build
291
+
292
+ ```bash
293
+ npm run build
294
+ ```
295
+
296
+ ### Watch Mode
297
+
298
+ ```bash
299
+ npm run dev
300
+ ```
301
+
302
+ ### Clean
303
+
304
+ ```bash
305
+ npm run clean
306
+ ```
307
+
308
+ ## Architecture
309
+
310
+ The CLI delegates to HTTP Forge Core APIs:
311
+ - **Direct Execution**: Uses `@http-forge/core` direct execution APIs
312
+ - **Service Container**: Bootstraps Node.js-specific adapters (file I/O, secrets, etc.)
313
+ - **Output Formatting**: Converts execution results to JSON or human-readable format
314
+ - **Error Handling**: Consistent exit codes and error messages
315
+
316
+ See [@http-forge/core README](../http-forge.core/README.md) for API documentation.
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const index_1 = require("./index");
5
+ (0, index_1.main)().catch((err) => {
6
+ console.error(err.message);
7
+ process.exit(1);
8
+ });
9
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AAEA,mCAA+B;AAE/B,IAAA,YAAI,GAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC3B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * CLI Command Handlers
3
+ *
4
+ * Implementations of CLI commands that use the runtime APIs.
5
+ */
6
+ export declare function handleMcpServer(args: string[]): Promise<void>;
7
+ export declare function handleRunRequest(args: string[]): Promise<void>;
8
+ export declare function handleRunCollection(args: string[]): Promise<void>;
9
+ export declare function handleRunSuite(args: string[]): Promise<void>;
10
+ //# sourceMappingURL=commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAuFH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAgGnE;AAMD,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBpE;AAMD,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBvE;AAMD,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBlE"}
@@ -0,0 +1,306 @@
1
+ "use strict";
2
+ /**
3
+ * CLI Command Handlers
4
+ *
5
+ * Implementations of CLI commands that use the runtime APIs.
6
+ */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
20
+ }) : function(o, v) {
21
+ o["default"] = v;
22
+ });
23
+ var __importStar = (this && this.__importStar) || (function () {
24
+ var ownKeys = function(o) {
25
+ ownKeys = Object.getOwnPropertyNames || function (o) {
26
+ var ar = [];
27
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
28
+ return ar;
29
+ };
30
+ return ownKeys(o);
31
+ };
32
+ return function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ })();
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.handleMcpServer = handleMcpServer;
42
+ exports.handleRunRequest = handleRunRequest;
43
+ exports.handleRunCollection = handleRunCollection;
44
+ exports.handleRunSuite = handleRunSuite;
45
+ const core_1 = require("@http-forge/core");
46
+ const fs = __importStar(require("fs"));
47
+ const path = __importStar(require("path"));
48
+ const MCP_STATE_FILENAME = 'mcp-server.json';
49
+ function getMcpStateFile(workspace) {
50
+ return path.join(workspace, '.http-forge-cache', MCP_STATE_FILENAME);
51
+ }
52
+ function writeMcpState(filePath, state) {
53
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
54
+ fs.writeFileSync(filePath, JSON.stringify(state, null, 2), 'utf-8');
55
+ }
56
+ function readMcpState(filePath) {
57
+ if (!fs.existsSync(filePath)) {
58
+ return null;
59
+ }
60
+ try {
61
+ const raw = fs.readFileSync(filePath, 'utf-8');
62
+ return JSON.parse(raw);
63
+ }
64
+ catch {
65
+ return null;
66
+ }
67
+ }
68
+ function removeMcpState(filePath) {
69
+ if (fs.existsSync(filePath)) {
70
+ fs.rmSync(filePath, { force: true });
71
+ }
72
+ }
73
+ function isPidAlive(pid) {
74
+ try {
75
+ process.kill(pid, 0);
76
+ return true;
77
+ }
78
+ catch {
79
+ return false;
80
+ }
81
+ }
82
+ function parseMcpServerArgs(args) {
83
+ let action = 'start';
84
+ let port = 3100;
85
+ let host = '127.0.0.1';
86
+ let workspace = process.cwd();
87
+ let i = 0;
88
+ if (args[0] === 'start' || args[0] === 'stop' || args[0] === 'status') {
89
+ action = args[0];
90
+ i = 1;
91
+ }
92
+ for (; i < args.length; i++) {
93
+ if (args[i] === '--port' && i + 1 < args.length) {
94
+ port = parseInt(args[++i], 10);
95
+ }
96
+ else if (args[i] === '--host' && i + 1 < args.length) {
97
+ host = args[++i];
98
+ }
99
+ else if (args[i] === '--workspace' && i + 1 < args.length) {
100
+ workspace = args[++i];
101
+ }
102
+ }
103
+ return { action, port, host, workspace };
104
+ }
105
+ // ────────────────────────────────────────────────────────
106
+ // MCP Server Command
107
+ // ────────────────────────────────────────────────────────
108
+ async function handleMcpServer(args) {
109
+ const { action, port, host, workspace } = parseMcpServerArgs(args);
110
+ const stateFile = getMcpStateFile(workspace);
111
+ if (action === 'status') {
112
+ const state = readMcpState(stateFile);
113
+ if (!state) {
114
+ console.log('MCP server is not running (no state file found).');
115
+ return;
116
+ }
117
+ if (!isPidAlive(state.pid)) {
118
+ console.log(`MCP server state exists but process ${state.pid} is not running (stale state).`);
119
+ return;
120
+ }
121
+ console.log(`MCP server is running:\n PID: ${state.pid}\n Host: ${state.host}\n Port: ${state.port}\n Workspace: ${state.workspace}\n Started: ${state.startedAt}`);
122
+ return;
123
+ }
124
+ if (action === 'stop') {
125
+ const state = readMcpState(stateFile);
126
+ if (!state) {
127
+ console.log('MCP server is not running (no state file found).');
128
+ return;
129
+ }
130
+ if (!isPidAlive(state.pid)) {
131
+ console.log(`MCP server process ${state.pid} is not running; removing stale state file.`);
132
+ removeMcpState(stateFile);
133
+ return;
134
+ }
135
+ process.kill(state.pid, 'SIGTERM');
136
+ const deadline = Date.now() + 3000;
137
+ while (Date.now() < deadline) {
138
+ if (!isPidAlive(state.pid))
139
+ break;
140
+ }
141
+ if (isPidAlive(state.pid)) {
142
+ process.kill(state.pid, 'SIGKILL');
143
+ }
144
+ removeMcpState(stateFile);
145
+ console.log(`MCP server stopped (PID ${state.pid}).`);
146
+ return;
147
+ }
148
+ const existingState = readMcpState(stateFile);
149
+ if (existingState && isPidAlive(existingState.pid)) {
150
+ console.error(`MCP server already running on ${existingState.host}:${existingState.port} (PID ${existingState.pid}).`);
151
+ process.exit(2);
152
+ }
153
+ if (existingState && !isPidAlive(existingState.pid)) {
154
+ removeMcpState(stateFile);
155
+ }
156
+ const runtime = await (0, core_1.createMcpRuntime)({ workspaceFolder: workspace, port, host });
157
+ await runtime.start();
158
+ writeMcpState(stateFile, {
159
+ pid: process.pid,
160
+ host,
161
+ port,
162
+ workspace,
163
+ startedAt: new Date().toISOString()
164
+ });
165
+ const shutdown = async () => {
166
+ try {
167
+ await runtime.stop();
168
+ }
169
+ finally {
170
+ removeMcpState(stateFile);
171
+ }
172
+ };
173
+ process.on('SIGINT', async () => {
174
+ await shutdown();
175
+ process.exit(0);
176
+ });
177
+ process.on('SIGTERM', async () => {
178
+ await shutdown();
179
+ process.exit(0);
180
+ });
181
+ process.on('exit', () => {
182
+ removeMcpState(stateFile);
183
+ });
184
+ console.log(`MCP server is running on ${host}:${port}`);
185
+ console.log('Press Ctrl+C to stop');
186
+ // Keep running until interrupted
187
+ await new Promise(() => { });
188
+ }
189
+ // ────────────────────────────────────────────────────────
190
+ // Run Request Command
191
+ // ────────────────────────────────────────────────────────
192
+ async function handleRunRequest(args) {
193
+ const opts = parseArgs(args);
194
+ if (!opts.collection || !opts.request) {
195
+ console.error('Error: --collection and --request are required');
196
+ process.exit(2);
197
+ }
198
+ const result = await (0, core_1.runRequest)({
199
+ workspaceFolder: opts.workspace,
200
+ collectionId: opts.collection,
201
+ requestId: opts.request,
202
+ environment: opts.environment,
203
+ variables: opts.variables,
204
+ include: opts.include
205
+ });
206
+ outputResult(result, opts.output);
207
+ }
208
+ // ────────────────────────────────────────────────────────
209
+ // Run Collection Command
210
+ // ────────────────────────────────────────────────────────
211
+ async function handleRunCollection(args) {
212
+ const opts = parseArgs(args);
213
+ if (!opts.collection) {
214
+ console.error('Error: --collection is required');
215
+ process.exit(2);
216
+ }
217
+ const result = await (0, core_1.runCollection)({
218
+ workspaceFolder: opts.workspace,
219
+ collectionId: opts.collection,
220
+ environment: opts.environment,
221
+ variables: opts.variables,
222
+ iterations: opts.iterations,
223
+ stopOnError: opts.stopOnError,
224
+ delay: opts.delay,
225
+ include: opts.include
226
+ });
227
+ outputResult(result, opts.output);
228
+ }
229
+ // ────────────────────────────────────────────────────────
230
+ // Run Suite Command
231
+ // ────────────────────────────────────────────────────────
232
+ async function handleRunSuite(args) {
233
+ const opts = parseArgs(args);
234
+ if (!opts.suite) {
235
+ console.error('Error: --suite is required');
236
+ process.exit(2);
237
+ }
238
+ const result = await (0, core_1.runSuite)({
239
+ workspaceFolder: opts.workspace,
240
+ suiteId: opts.suite,
241
+ environment: opts.environment,
242
+ variables: opts.variables,
243
+ iterations: opts.iterations,
244
+ stopOnError: opts.stopOnError,
245
+ delay: opts.delay,
246
+ requestFilter: opts.requestFilter,
247
+ include: opts.include
248
+ });
249
+ outputResult(result, opts.output);
250
+ }
251
+ function parseArgs(args) {
252
+ const opts = {
253
+ workspace: process.cwd(),
254
+ variables: {},
255
+ stopOnError: false,
256
+ include: [],
257
+ output: 'json'
258
+ };
259
+ for (let i = 0; i < args.length; i++) {
260
+ const arg = args[i];
261
+ if (arg === '--workspace' && i + 1 < args.length) {
262
+ opts.workspace = args[++i];
263
+ }
264
+ else if (arg === '--collection' && i + 1 < args.length) {
265
+ opts.collection = args[++i];
266
+ }
267
+ else if (arg === '--request' && i + 1 < args.length) {
268
+ opts.request = args[++i];
269
+ }
270
+ else if (arg === '--suite' && i + 1 < args.length) {
271
+ opts.suite = args[++i];
272
+ }
273
+ else if (arg === '--environment' && i + 1 < args.length) {
274
+ opts.environment = args[++i];
275
+ }
276
+ else if (arg === '--iterations' && i + 1 < args.length) {
277
+ opts.iterations = parseInt(args[++i], 10);
278
+ }
279
+ else if (arg === '--stop-on-error') {
280
+ opts.stopOnError = true;
281
+ }
282
+ else if (arg === '--delay' && i + 1 < args.length) {
283
+ opts.delay = parseInt(args[++i], 10);
284
+ }
285
+ else if (arg === '--include' && i + 1 < args.length) {
286
+ opts.include.push(args[++i]);
287
+ }
288
+ else if (arg === '--output' && i + 1 < args.length) {
289
+ const out = args[++i];
290
+ if (out === 'json' || out === 'table') {
291
+ opts.output = out;
292
+ }
293
+ }
294
+ }
295
+ return opts;
296
+ }
297
+ function outputResult(result, format) {
298
+ if (format === 'json') {
299
+ console.log(JSON.stringify(result, null, 2));
300
+ }
301
+ else {
302
+ // Table format for human readability
303
+ console.log('Result:', result);
304
+ }
305
+ }
306
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuFH,0CAgGC;AAMD,4CAkBC;AAMD,kDAoBC;AAMD,wCAqBC;AAlQD,2CAAyF;AACzF,uCAAyB;AACzB,2CAA6B;AAU7B,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AAE7C,SAAS,eAAe,CAAC,SAAiB;IACxC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,mBAAmB,EAAE,kBAAkB,CAAC,CAAC;AACvE,CAAC;AAED,SAAS,aAAa,CAAC,QAAgB,EAAE,KAAqB;IAC5D,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1D,EAAE,CAAC,aAAa,CAAC,QA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AAI,CAAC;AACd,CAAC;AAED,SAAS,YAAY,CAAC,MAAe,EAAE,MAAwB;IAC7D,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;SAAM,CAAC;QACN,qCAAqC;QACrC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACjC,CAAC;AACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * HTTP Forge CLI
3
+ *
4
+ * Command-line interface for HTTP Forge runtime operations:
5
+ * - mcp-server: Start MCP server
6
+ * - run-request: Execute a single request
7
+ * - run-collection: Execute a collection
8
+ * - run-suite: Execute a test suite
9
+ */
10
+ export declare function main(): Promise<void>;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CA2C1C"}
package/dist/index.js ADDED
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ /**
3
+ * HTTP Forge CLI
4
+ *
5
+ * Command-line interface for HTTP Forge runtime operations:
6
+ * - mcp-server: Start MCP server
7
+ * - run-request: Execute a single request
8
+ * - run-collection: Execute a collection
9
+ * - run-suite: Execute a test suite
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.main = main;
13
+ const commands_1 = require("./commands");
14
+ async function main() {
15
+ const args = process.argv.slice(2);
16
+ if (args.length === 0) {
17
+ printUsage();
18
+ process.exit(0);
19
+ }
20
+ const command = args[0];
21
+ try {
22
+ switch (command) {
23
+ case 'mcp-server':
24
+ await (0, commands_1.handleMcpServer)(args.slice(1));
25
+ break;
26
+ case 'run-request':
27
+ await (0, commands_1.handleRunRequest)(args.slice(1));
28
+ break;
29
+ case 'run-collection':
30
+ await (0, commands_1.handleRunCollection)(args.slice(1));
31
+ break;
32
+ case 'run-suite':
33
+ await (0, commands_1.handleRunSuite)(args.slice(1));
34
+ break;
35
+ case '--help':
36
+ case '-h':
37
+ printUsage();
38
+ process.exit(0);
39
+ break;
40
+ default:
41
+ console.error(`Unknown command: ${command}`);
42
+ printUsage();
43
+ process.exit(2);
44
+ }
45
+ }
46
+ catch (error) {
47
+ console.error('Error:', error.message);
48
+ process.exit(1);
49
+ }
50
+ }
51
+ function printUsage() {
52
+ console.log(`
53
+ HTTP Forge CLI
54
+
55
+ USAGE:
56
+ http-forge <command> [options]
57
+
58
+ COMMANDS:
59
+ mcp-server <action> Manage MCP server lifecycle
60
+ Actions:
61
+ start Start MCP server (default action)
62
+ stop Stop MCP server for the workspace
63
+ status Show MCP server status for the workspace
64
+ Options (for start/status/stop workspace scope):
65
+ --port <num> Port to listen on (default: 3100)
66
+ --host <addr> Host to bind to (default: 127.0.0.1)
67
+ --workspace <path> Workspace folder (default: current directory)
68
+
69
+ run-request Execute a single request
70
+ Required:
71
+ --collection <id> Collection ID
72
+ --request <id> Request ID
73
+ Optional:
74
+ --workspace <path> Workspace folder (default: current directory)
75
+ --environment <name> Environment to use
76
+ --include <field> Include extra fields (repeatable):
77
+ headers, cookies, tests, consoleOutput, report
78
+ --output <fmt> Output format: json or table (default: json)
79
+
80
+ run-collection Execute a collection
81
+ Required:
82
+ --collection <id> Collection ID
83
+ Optional:
84
+ --workspace <path> Workspace folder (default: current directory)
85
+ --environment <name> Environment to use
86
+ --iterations <num> Number of iterations (default: 1)
87
+ --stop-on-error Stop on first failure
88
+ --delay <ms> Delay between requests
89
+ --include <field> Include extra fields (repeatable):
90
+ perRequest, failedOnly, consoleOutput, report
91
+ --output <fmt> Output format: json or table (default: json)
92
+
93
+ run-suite Execute a test suite
94
+ Required:
95
+ --suite <id> Suite ID
96
+ Optional:
97
+ --workspace <path> Workspace folder (default: current directory)
98
+ --environment <name> Environment to use
99
+ --iterations <num> Number of iterations
100
+ --stop-on-error Stop on first failure
101
+ --delay <ms> Delay between requests
102
+ --include <field> Include extra fields (repeatable):
103
+ perRequest, failedOnly, consoleOutput, report
104
+ --output <fmt> Output format: json or table (default: json)
105
+
106
+ EXAMPLES:
107
+ http-forge mcp-server start --port 3100
108
+ http-forge mcp-server status --workspace .
109
+ http-forge mcp-server stop --workspace .
110
+ http-forge run-request --collection my-api --request get-users
111
+ http-forge run-request --collection my-api --request get-users --include tests --include report
112
+ http-forge run-collection --collection my-api --environment dev --include perRequest
113
+ http-forge run-suite --suite smoke-tests --iterations 3 --include failedOnly --include report --output json
114
+
115
+ OPTIONS:
116
+ --help, -h Show this help message
117
+ `);
118
+ }
119
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AASH,oBA2CC;AAlDD,yCAKoB;AAEb,KAAK,UAAU,IAAI;IACxB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAEnC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,UAAU,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAExB,IAAI,CAAC;QACH,QAAQ,OAAO,EAAE,CAAC;YAChB,KAAK,YAAY;gBACf,MAAM,IAAA,0BAAe,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBACrC,MAAM;YAER,KAAK,aAAa;gBAChB,MAAM,IAAA,2BAAgB,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBACtC,MAAM;YAER,KAAK,gBAAgB;gBACnB,MAAM,IAAA,8BAAmB,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBACzC,MAAM;YAER,KAAK,WAAW;gBACd,MAAM,IAAA,yBAAc,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBACpC,MAAM;YAER,KAAK,QAAQ,CAAC;YACd,KAAK,IAAI;gBACP,UAAU,EAAE,CAAC;gBACb,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAChB,MAAM;YAER;gBACE,OAAO,CAAC,KAAK,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;gBAC7C,UAAU,EAAE,CAAC;gBACb,OAAO,CAAC,IAAI,CAAC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiEb,CAAC,CAAC;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@http-forge/cli",
3
+ "version": "0.1.1",
4
+ "description": "HTTP Forge CLI — terminal interface for collections, test suites, and MCP server",
5
+ "main": "dist/index.js",
6
+ "bin": {
7
+ "http-forge": "dist/cli.js"
8
+ },
9
+ "files": [
10
+ "dist/**",
11
+ "README.md",
12
+ "LICENSE"
13
+ ],
14
+ "scripts": {
15
+ "build": "tsc",
16
+ "dev": "tsc --watch",
17
+ "clean": "rm -rf dist"
18
+ },
19
+ "keywords": [
20
+ "http-forge",
21
+ "api",
22
+ "testing",
23
+ "postman",
24
+ "cli"
25
+ ],
26
+ "author": "Henry Huang",
27
+ "license": "MIT",
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "engines": {
32
+ "node": ">=20.0.0"
33
+ },
34
+ "dependencies": {
35
+ "@http-forge/core": "file:../http-forge.core"
36
+ },
37
+ "devDependencies": {
38
+ "@types/node": "^20.10.0",
39
+ "typescript": "^5.3.0"
40
+ }
41
+ }