@http-forge/cli 0.2.5 → 0.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Generate command — generate typed TypeScript API clients from HTTP Forge collections.
3
+ *
4
+ * Delegates to @http-forge/codegen so users need only install @http-forge/cli globally.
5
+ *
6
+ * http-forge generate --input ./collections --output ./api-clients
7
+ * http-forge generate --input ./collections --output ./api-clients --collection forgerock-login
8
+ * http-forge generate --input ./collections --output ./api-clients --request forgerock-login/login-request
9
+ * http-forge generate --input ./collections --output ./api-clients --overwrite
10
+ * http-forge generate --input ./collections --output ./api-clients --types-only
11
+ * http-forge generate --input ./collections --output ./api-clients --no-barrel
12
+ */
13
+ export declare function handleGenerate(args: string[]): Promise<void>;
14
+ //# sourceMappingURL=generate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA6ElE"}
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+ /**
3
+ * Generate command — generate typed TypeScript API clients from HTTP Forge collections.
4
+ *
5
+ * Delegates to @http-forge/codegen so users need only install @http-forge/cli globally.
6
+ *
7
+ * http-forge generate --input ./collections --output ./api-clients
8
+ * http-forge generate --input ./collections --output ./api-clients --collection forgerock-login
9
+ * http-forge generate --input ./collections --output ./api-clients --request forgerock-login/login-request
10
+ * http-forge generate --input ./collections --output ./api-clients --overwrite
11
+ * http-forge generate --input ./collections --output ./api-clients --types-only
12
+ * http-forge generate --input ./collections --output ./api-clients --no-barrel
13
+ */
14
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ var desc = Object.getOwnPropertyDescriptor(m, k);
17
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
+ desc = { enumerable: true, get: function() { return m[k]; } };
19
+ }
20
+ Object.defineProperty(o, k2, desc);
21
+ }) : (function(o, m, k, k2) {
22
+ if (k2 === undefined) k2 = k;
23
+ o[k2] = m[k];
24
+ }));
25
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
26
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
27
+ }) : function(o, v) {
28
+ o["default"] = v;
29
+ });
30
+ var __importStar = (this && this.__importStar) || (function () {
31
+ var ownKeys = function(o) {
32
+ ownKeys = Object.getOwnPropertyNames || function (o) {
33
+ var ar = [];
34
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
35
+ return ar;
36
+ };
37
+ return ownKeys(o);
38
+ };
39
+ return function (mod) {
40
+ if (mod && mod.__esModule) return mod;
41
+ var result = {};
42
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
43
+ __setModuleDefault(result, mod);
44
+ return result;
45
+ };
46
+ })();
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.handleGenerate = handleGenerate;
49
+ async function handleGenerate(args) {
50
+ // Parse arguments manually to avoid adding commander as a top-level CLI dep
51
+ let input;
52
+ let output;
53
+ let collection;
54
+ let request;
55
+ let overwrite = false;
56
+ let typesOnly = false;
57
+ let updateBarrel = true;
58
+ for (let i = 0; i < args.length; i++) {
59
+ const arg = args[i];
60
+ switch (arg) {
61
+ case '-i':
62
+ case '--input':
63
+ input = args[++i];
64
+ break;
65
+ case '-o':
66
+ case '--output':
67
+ output = args[++i];
68
+ break;
69
+ case '-c':
70
+ case '--collection':
71
+ collection = args[++i];
72
+ break;
73
+ case '-r':
74
+ case '--request':
75
+ request = args[++i];
76
+ break;
77
+ case '--overwrite':
78
+ overwrite = true;
79
+ break;
80
+ case '--types-only':
81
+ typesOnly = true;
82
+ break;
83
+ case '--no-barrel':
84
+ updateBarrel = false;
85
+ break;
86
+ case '-h':
87
+ case '--help':
88
+ printGenerateUsage();
89
+ return;
90
+ default:
91
+ console.error(`Unknown option: ${arg}`);
92
+ printGenerateUsage();
93
+ process.exit(2);
94
+ }
95
+ }
96
+ if (!input || !output) {
97
+ console.error('Error: --input and --output are required');
98
+ printGenerateUsage();
99
+ process.exit(2);
100
+ }
101
+ // Dynamically require @http-forge/codegen so missing install gives a clear error
102
+ let codegen;
103
+ try {
104
+ codegen = await Promise.resolve().then(() => __importStar(require('@http-forge/codegen')));
105
+ }
106
+ catch {
107
+ console.error('Error: @http-forge/codegen is not installed.\n' +
108
+ 'Run: npm install --global @http-forge/codegen');
109
+ process.exit(1);
110
+ }
111
+ if (request) {
112
+ await codegen.generateSingleRequest({ input, output, request, overwrite, updateBarrel });
113
+ console.log(`Generated: ${request}`);
114
+ }
115
+ else if (collection) {
116
+ await codegen.generateCollection({ input, output, collection, overwrite, updateBarrel });
117
+ console.log(`Generated collection: ${collection}`);
118
+ }
119
+ else {
120
+ await codegen.generateClients({ input, output, overwrite, typesOnly });
121
+ console.log(`Generated all collections → ${output}`);
122
+ }
123
+ }
124
+ function printGenerateUsage() {
125
+ console.log(`
126
+ USAGE:
127
+ http-forge generate --input <path> --output <path> [options]
128
+
129
+ OPTIONS:
130
+ -i, --input <path> HTTP Forge collections folder (required)
131
+ -o, --output <path> Output folder for generated clients (required)
132
+ -c, --collection <name> Generate a single collection only
133
+ -r, --request <path> Generate a single request (e.g. my-api/get-user)
134
+ --overwrite Overwrite existing generated files
135
+ --types-only Emit only TypeScript type definitions, no runtime functions
136
+ --no-barrel Skip index.ts barrel file generation
137
+ -h, --help Show this help
138
+
139
+ EXAMPLES:
140
+ http-forge generate -i ./collections -o ./api-clients
141
+ http-forge generate -i ./collections -o ./api-clients -c forgerock-login
142
+ http-forge generate -i ./collections -o ./api-clients -r forgerock-login/login-request
143
+ http-forge generate -i ./collections -o ./api-clients --overwrite --types-only
144
+ `);
145
+ }
146
+ //# sourceMappingURL=generate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,wCA6EC;AA7EM,KAAK,UAAU,cAAc,CAAC,IAAc;IAC/C,4EAA4E;IAC5E,IAAI,KAAyB,CAAC;IAC9B,IAAI,MAA0B,CAAC;IAC/B,IAAI,UAA8B,CAAC;IACnC,IAAI,OAA2B,CAAC;IAChC,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,IAAI,YAAY,GAAG,IAAI,CAAC;IAExB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,QAAQ,GAAG,EAAE,CAAC;YACV,KAAK,IAAI,CAAC;YACV,KAAK,SAAS;gBACV,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;gBAClB,MAAM;YACV,KAAK,IAAI,CAAC;YACV,KAAK,UAAU;gBACX,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;gBACnB,MAAM;YACV,KAAK,IAAI,CAAC;YACV,KAAK,cAAc;gBACf,UAAU,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;gBACvB,MAAM;YACV,KAAK,IAAI,CAAC;YACV,KAAK,WAAW;gBACZ,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;gBACpB,MAAM;YACV,KAAK,aAAa;gBACd,SAAS,GAAG,IAAI,CAAC;gBACjB,MAAM;YACV,KAAK,cAAc;gBACf,SAAS,GAAG,IAAI,CAAC;gBACjB,MAAM;YACV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C,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC;QACvE,OAAO,CAAC,GAAG,CAAC,+BAA+B,MAAM,EAAE,CAAC,CAAC;IACzD,CAAC;AACL,CAAC;AAED,SAAS,kBAAkB;IACvB,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;CAmBf,CAAC,CAAC;AACH,CAAC"}
@@ -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,OAAO,IAAI,CAAC;IAC1F,IA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AAC,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"}
@@ -9,7 +9,9 @@
9
9
  * src/output/format.ts — ParsedArgs, parseArgs, outputResult, finalizeCiReports, ...
10
10
  */
11
11
  export { handleEnv } from './commands/env';
12
+ export { handleGenerate } from './commands/generate';
12
13
  export { handleGenerateCollection } from './commands/generate-collection';
14
+ export { handleLaunch } from './commands/launch';
13
15
  export { handleList } from './commands/list';
14
16
  export { handleMcpGroup, handleMcpServer } from './commands/mcp';
15
17
  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,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,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,15 @@
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.handleGenerate = 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
+ var generate_1 = require("./commands/generate");
17
+ Object.defineProperty(exports, "handleGenerate", { enumerable: true, get: function () { return generate_1.handleGenerate; } });
16
18
  var generate_collection_1 = require("./commands/generate-collection");
17
19
  Object.defineProperty(exports, "handleGenerateCollection", { enumerable: true, get: function () { return generate_collection_1.handleGenerateCollection; } });
20
+ var launch_1 = require("./commands/launch");
21
+ Object.defineProperty(exports, "handleLaunch", { enumerable: true, get: function () { return launch_1.handleLaunch; } });
18
22
  var list_1 = require("./commands/list");
19
23
  Object.defineProperty(exports, "handleList", { enumerable: true, get: function () { return list_1.handleList; } });
20
24
  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,gDAAqD;AAA5C,0GAAA,cAAc,OAAA;AACvB,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;AAeH,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAkE1C"}
package/dist/index.js CHANGED
@@ -37,6 +37,9 @@ async function main() {
37
37
  case 'env':
38
38
  await (0, commands_1.handleEnv)(args.slice(1));
39
39
  break;
40
+ case 'generate':
41
+ await (0, commands_1.handleGenerate)(args.slice(1));
42
+ break;
40
43
  case 'generate-collection':
41
44
  await (0, commands_1.handleGenerateCollection)(args.slice(1));
42
45
  break;
@@ -46,6 +49,9 @@ async function main() {
46
49
  case 'schedule':
47
50
  await (0, commands_1.handleSchedule)(args.slice(1));
48
51
  break;
52
+ case 'launch':
53
+ await (0, commands_1.handleLaunch)(args.slice(1));
54
+ break;
49
55
  case '-h':
50
56
  printUsage();
51
57
  process.exit(0);
@@ -107,6 +113,13 @@ COMMANDS:
107
113
  --host <addr> Host to bind to (default: 127.0.0.1)
108
114
  --workspace <path> Workspace folder (default: $HTTP_FORGE_WORKSPACE or cwd)
109
115
 
116
+ launch [options] [path] Launch HTTP Forge in VS Code
117
+ Options:
118
+ --test Launch with isolated "HTTP Forge" profile (default)
119
+ --dev Launch with "Default" profile (all extensions)
120
+ --both Launch both profiles side by side
121
+ --help Show launcher help
122
+
110
123
  copy-as Print a request as a code snippet
111
124
  Required:
112
125
  --collection <ref> Collection (id, slug, or name)
@@ -141,6 +154,17 @@ COMMANDS:
141
154
  --output <fmt> Output format for list/get: json or table (default: json)
142
155
  --no-values Omit values in 'get' (show only key names)
143
156
 
157
+ generate Generate typed TypeScript API clients from HTTP Forge collections
158
+ Required:
159
+ --input / -i <path> HTTP Forge collections folder
160
+ --output / -o <path> Output folder for generated TypeScript clients
161
+ Options:
162
+ --collection / -c Generate a single collection only
163
+ --request / -r Generate a single request (e.g. my-api/get-user)
164
+ --overwrite Overwrite existing generated files
165
+ --types-only Emit type definitions only, no runtime functions
166
+ --no-barrel Skip index.ts barrel file generation
167
+
144
168
  generate-collection Create a collection from a curl command, Postman file, or OpenAPI spec
145
169
  Sources (one required):
146
170
  --curl <cmd> curl command string (quote the whole thing)
@@ -182,6 +206,9 @@ EXAMPLES:
182
206
  http-forge mcp start --port 3100
183
207
  http-forge mcp status
184
208
  http-forge mcp stop
209
+ http-forge launch
210
+ http-forge launch --dev
211
+ http-forge launch --both /path/to/workspace
185
212
  http-forge run collection "my-api" --env dev
186
213
  http-forge run request "Get Users" --collection "my-api" --env production
187
214
  http-forge run request "Get Users" --collection "my-api" --folder Auth --include tests
@@ -208,6 +235,10 @@ EXAMPLES:
208
235
  http-forge env set staging BASE_URL https://staging.example.com
209
236
  http-forge env set staging API_KEY=my-secret-key
210
237
  http-forge env unset staging OLD_VAR
238
+ http-forge generate -i ./collections -o ./api-clients
239
+ http-forge generate -i ./collections -o ./api-clients -c forgerock-login
240
+ http-forge generate -i ./collections -o ./api-clients -r forgerock-login/login-request
241
+ http-forge generate -i ./collections -o ./api-clients --overwrite --types-only
211
242
  http-forge generate-collection --curl "curl https://api.example.com/users"
212
243
  http-forge generate-collection --curl "curl -X POST -H 'Authorization: Bearer sk-abc' https://api.example.com/v1/users -d '{\"name\":\"Alice\"}'" --env dev
213
244
  http-forge generate-collection --postman ./MyCollection.postman_collection.json
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAaH,oBA0DC;AArED,yCASoB;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,KAAK;gBACR,MAAM,IAAA,yBAAc,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBACpC,MAAM;YAER,KAAK,KAAK;gBACR,MAAM,IAAA,yBAAc,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBACpC,MAAM;YAER,KAAK,SAAS;gBACZ,MAAM,IAAA,uBAAY,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBAClC,MAAM;YAER,KAAK,MAAM;gBACT,MAAM,IAAA,qBAAU,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBAChC,MAAM;YAER,KAAK,KAAK;gBACR,MAAM,IAAA,oBAAS,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC/B,MAAM;YAER,KAAK,qBAAqB;gBACxB,MAAM,IAAA,mCAAwB,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC9C,MAAM;YAER,KAAK,aAAa;gBAChB,MA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;gBAClC,MAAM;YAER,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+Lb,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.12",
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
+ "http",
21
24
  "api",
22
25
  "testing",
26
+ "api testing",
23
27
  "postman",
24
- "cli"
28
+ "postman alternative",
29
+ "openapi",
30
+ "graphql",
31
+ "automation",
32
+ "ci",
33
+ "cd",
34
+ "mcp",
35
+ "mcp server",
36
+ "cli",
37
+ "api cli",
38
+ "postman cli",
39
+ "postman cli alternative",
40
+ "openapi cli",
41
+ "junit",
42
+ "generate",
43
+ "codegen",
44
+ "standalone launcher",
45
+ "api client ui",
46
+ "desktop api client",
47
+ "launcher",
48
+ "vscode"
25
49
  ],
26
50
  "author": "Henry Huang",
27
51
  "license": "MIT",
@@ -32,12 +56,13 @@
32
56
  "node": ">=20.0.0"
33
57
  },
34
58
  "dependencies": {
35
- "@http-forge/core": "^0.6.5"
59
+ "@http-forge/codegen": "^0.1.6",
60
+ "@http-forge/core": "^0.6.11"
36
61
  },
37
62
  "optionalDependencies": {
38
63
  "@aws-sdk/client-secrets-manager": "^3.0.0",
39
- "@azure/keyvault-secrets": "^4.0.0",
40
64
  "@azure/identity": "^4.0.0",
65
+ "@azure/keyvault-secrets": "^4.0.0",
41
66
  "@google-cloud/secret-manager": "^5.0.0"
42
67
  },
43
68
  "devDependencies": {
@@ -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