@http-forge/cli 0.2.1 → 0.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -328
- package/dist/ai/providers.d.ts +34 -0
- package/dist/ai/providers.d.ts.map +1 -0
- package/dist/ai/providers.js +98 -0
- package/dist/ai/providers.js.map +1 -0
- package/dist/commands/env.d.ts +14 -0
- package/dist/commands/env.d.ts.map +1 -0
- package/dist/commands/env.js +165 -0
- package/dist/commands/env.js.map +1 -0
- package/dist/commands/generate-collection.d.ts +11 -0
- package/dist/commands/generate-collection.d.ts.map +1 -0
- package/dist/commands/generate-collection.js +301 -0
- package/dist/commands/generate-collection.js.map +1 -0
- package/dist/commands/launch.d.ts +2 -0
- package/dist/commands/launch.d.ts.map +1 -0
- package/dist/commands/launch.js +96 -0
- package/dist/commands/launch.js.map +1 -0
- package/dist/commands/list.d.ts +12 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +170 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/mcp.d.ts +19 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +211 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/run.d.ts +35 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +589 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/schedule.d.ts +11 -0
- package/dist/commands/schedule.d.ts.map +1 -0
- package/dist/commands/schedule.js +237 -0
- package/dist/commands/schedule.js.map +1 -0
- package/dist/commands/suggest-env.d.ts +12 -0
- package/dist/commands/suggest-env.d.ts.map +1 -0
- package/dist/commands/suggest-env.js +205 -0
- package/dist/commands/suggest-env.js.map +1 -0
- package/dist/commands.d.ts +15 -7
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +30 -436
- package/dist/commands.js.map +1 -1
- package/dist/curl-parser.d.ts +51 -0
- package/dist/curl-parser.d.ts.map +1 -0
- package/dist/curl-parser.js +365 -0
- package/dist/curl-parser.js.map +1 -0
- package/dist/index.d.ts +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +175 -87
- package/dist/index.js.map +1 -1
- package/dist/output/format.d.ts +63 -0
- package/dist/output/format.d.ts.map +1 -0
- package/dist/output/format.js +280 -0
- package/dist/output/format.js.map +1 -0
- package/package.json +28 -4
- package/scripts/http-forge.bat +157 -0
- package/scripts/http-forge.sh +167 -0
package/dist/index.js
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* HTTP Forge CLI
|
|
4
4
|
*
|
|
5
|
-
* Command-line interface for HTTP Forge runtime operations
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
5
|
+
* Command-line interface for HTTP Forge runtime operations.
|
|
6
|
+
*
|
|
7
|
+
* http-forge run collection <name>
|
|
8
|
+
* http-forge run suite <name>
|
|
9
|
+
* http-forge run request <name> --collection <ref>
|
|
10
|
+
* http-forge run folder <path> --collection <ref>
|
|
11
|
+
* http-forge mcp start --port 3100
|
|
11
12
|
*/
|
|
12
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
14
|
exports.main = main;
|
|
@@ -21,22 +22,33 @@ async function main() {
|
|
|
21
22
|
const command = args[0];
|
|
22
23
|
try {
|
|
23
24
|
switch (command) {
|
|
24
|
-
case 'mcp
|
|
25
|
-
await (0, commands_1.
|
|
25
|
+
case 'mcp':
|
|
26
|
+
await (0, commands_1.handleMcpGroup)(args.slice(1));
|
|
27
|
+
break;
|
|
28
|
+
case 'run':
|
|
29
|
+
await (0, commands_1.handleRunGroup)(args.slice(1));
|
|
30
|
+
break;
|
|
31
|
+
case 'copy-as':
|
|
32
|
+
await (0, commands_1.handleCopyAs)(args.slice(1));
|
|
33
|
+
break;
|
|
34
|
+
case 'list':
|
|
35
|
+
await (0, commands_1.handleList)(args.slice(1));
|
|
26
36
|
break;
|
|
27
|
-
case '
|
|
28
|
-
await (0, commands_1.
|
|
37
|
+
case 'env':
|
|
38
|
+
await (0, commands_1.handleEnv)(args.slice(1));
|
|
29
39
|
break;
|
|
30
|
-
case '
|
|
31
|
-
await (0, commands_1.
|
|
40
|
+
case 'generate-collection':
|
|
41
|
+
await (0, commands_1.handleGenerateCollection)(args.slice(1));
|
|
32
42
|
break;
|
|
33
|
-
case '
|
|
34
|
-
await (0, commands_1.
|
|
43
|
+
case 'suggest-env':
|
|
44
|
+
await (0, commands_1.handleSuggestEnv)(args.slice(1));
|
|
35
45
|
break;
|
|
36
|
-
case '
|
|
37
|
-
await (0, commands_1.
|
|
46
|
+
case 'schedule':
|
|
47
|
+
await (0, commands_1.handleSchedule)(args.slice(1));
|
|
48
|
+
break;
|
|
49
|
+
case 'launch':
|
|
50
|
+
await (0, commands_1.handleLaunch)(args.slice(1));
|
|
38
51
|
break;
|
|
39
|
-
case '--help':
|
|
40
52
|
case '-h':
|
|
41
53
|
printUsage();
|
|
42
54
|
process.exit(0);
|
|
@@ -60,96 +72,172 @@ USAGE:
|
|
|
60
72
|
http-forge <command> [options]
|
|
61
73
|
|
|
62
74
|
COMMANDS:
|
|
63
|
-
|
|
75
|
+
run <type> [name] Execute requests
|
|
76
|
+
Types:
|
|
77
|
+
collection <name> Run all requests in a collection
|
|
78
|
+
suite <name> Run a test suite (accepts name or id)
|
|
79
|
+
request <name> Run a single request (also needs --collection)
|
|
80
|
+
folder <path> Run requests under a folder (also needs --collection)
|
|
81
|
+
Options:
|
|
82
|
+
--env <name> Environment (default: $HTTP_FORGE_ENV or dev)
|
|
83
|
+
--environment <name> Same as --env (long form)
|
|
84
|
+
--workspace <path> Workspace folder (default: $HTTP_FORGE_WORKSPACE or cwd)
|
|
85
|
+
--collection <ref> Collection for 'request' and 'folder' types
|
|
86
|
+
--folder <path> Scope to a folder (for 'request'); slash-separated
|
|
87
|
+
--no-recursive Run only immediate children (for 'folder' type)
|
|
88
|
+
--var <KEY=VALUE> Override a variable (repeatable; highest priority)
|
|
89
|
+
--iterations <num> Number of iterations (default: 1)
|
|
90
|
+
--concurrency <num> Parallel virtual users (default: 1)
|
|
91
|
+
--stop-on-error Stop on first failure
|
|
92
|
+
--delay <ms> Delay between requests in milliseconds
|
|
93
|
+
--include <field> Extra output fields (repeatable):
|
|
94
|
+
collection/suite/folder: perRequest, failedOnly, consoleOutput
|
|
95
|
+
request: headers, cookies, tests, consoleOutput
|
|
96
|
+
--reporter <spec> Generate a report (repeatable): html, junit, or name:path
|
|
97
|
+
--reporter html
|
|
98
|
+
--reporter junit:results/junit.xml
|
|
99
|
+
--exit-code Exit 1 when any assertion fails (for CI)
|
|
100
|
+
--output <fmt> Output format: json or table (default: json)
|
|
101
|
+
--json Short for --output json
|
|
102
|
+
|
|
103
|
+
mcp <action> Manage MCP server lifecycle
|
|
64
104
|
Actions:
|
|
65
|
-
start Start MCP server
|
|
66
|
-
stop Stop MCP server
|
|
67
|
-
status Show MCP server status
|
|
68
|
-
Options
|
|
105
|
+
start Start MCP server
|
|
106
|
+
stop Stop MCP server
|
|
107
|
+
status Show MCP server status
|
|
108
|
+
Options:
|
|
69
109
|
--port <num> Port to listen on (default: 3100)
|
|
70
110
|
--host <addr> Host to bind to (default: 127.0.0.1)
|
|
71
|
-
--workspace <path> Workspace folder (default:
|
|
111
|
+
--workspace <path> Workspace folder (default: $HTTP_FORGE_WORKSPACE or cwd)
|
|
72
112
|
|
|
73
|
-
|
|
113
|
+
launch [options] [path] Launch HTTP Forge in VS Code
|
|
114
|
+
Options:
|
|
115
|
+
--test Launch with isolated "HTTP Forge" profile (default)
|
|
116
|
+
--dev Launch with "Default" profile (all extensions)
|
|
117
|
+
--both Launch both profiles side by side
|
|
118
|
+
--help Show launcher help
|
|
119
|
+
|
|
120
|
+
copy-as Print a request as a code snippet
|
|
74
121
|
Required:
|
|
75
122
|
--collection <ref> Collection (id, slug, or name)
|
|
76
123
|
--request <ref> Request (id, slug, or name)
|
|
124
|
+
--lang <name> Target language: curl, fetch, python
|
|
77
125
|
Optional:
|
|
78
|
-
--folder <path> Scope
|
|
79
|
-
|
|
80
|
-
--
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
126
|
+
--folder <path> Scope resolution to this folder
|
|
127
|
+
--workspace <path> Workspace folder (default: $HTTP_FORGE_WORKSPACE or cwd)
|
|
128
|
+
--environment <name> Environment to resolve variables against
|
|
129
|
+
|
|
130
|
+
list <subcommand> List workspace resources
|
|
131
|
+
Subcommands:
|
|
132
|
+
collections List all collections (id, name, request count)
|
|
133
|
+
suites List all test suites (id, name, request count)
|
|
134
|
+
environments List all environments (name, active, variable count)
|
|
135
|
+
requests List requests in a collection (requires --collection)
|
|
136
|
+
folders List folders in a collection (requires --collection)
|
|
137
|
+
Options:
|
|
138
|
+
--workspace <path> Workspace folder (default: $HTTP_FORGE_WORKSPACE or cwd)
|
|
139
|
+
--collection <ref> Collection reference (required for 'requests' and 'folders')
|
|
140
|
+
--folder <path> Scope to a sub-folder (for 'requests' and 'folders')
|
|
85
141
|
--output <fmt> Output format: json or table (default: json)
|
|
86
142
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
--
|
|
95
|
-
--
|
|
96
|
-
--
|
|
97
|
-
|
|
98
|
-
|
|
143
|
+
env <subcommand> Manage environment variables
|
|
144
|
+
Subcommands:
|
|
145
|
+
list List all environments (name, active, variable count)
|
|
146
|
+
get <name> Show all variables for an environment
|
|
147
|
+
set <env> <k> <v> Permanently write a variable to the env JSON file
|
|
148
|
+
unset <env> <key> Remove a variable from the env JSON file
|
|
149
|
+
Options:
|
|
150
|
+
--workspace <path> Workspace folder (default: $HTTP_FORGE_WORKSPACE or cwd)
|
|
151
|
+
--output <fmt> Output format for list/get: json or table (default: json)
|
|
152
|
+
--no-values Omit values in 'get' (show only key names)
|
|
153
|
+
|
|
154
|
+
generate-collection Create a collection from a curl command, Postman file, or OpenAPI spec
|
|
155
|
+
Sources (one required):
|
|
156
|
+
--curl <cmd> curl command string (quote the whole thing)
|
|
157
|
+
--postman <file> Postman Collection v2.x JSON file
|
|
158
|
+
--openapi <file> OpenAPI 3.0 spec file (.json / .yaml / .yml)
|
|
159
|
+
Options:
|
|
160
|
+
--name <name> Collection name (default: derived from source)
|
|
161
|
+
--env <name> Write detected vars (curl) or create env (openapi) with this name
|
|
162
|
+
--create-envs openapi: create environments from server URLs
|
|
163
|
+
--ai Enhance collection with AI (needs OPENAI_API_KEY or ANTHROPIC_API_KEY)
|
|
164
|
+
--workspace <path> Workspace folder (default: $HTTP_FORGE_WORKSPACE or cwd)
|
|
99
165
|
--output <fmt> Output format: json or table (default: json)
|
|
100
166
|
|
|
101
|
-
|
|
167
|
+
suggest-env Detect hardcoded values and suggest environment variables
|
|
102
168
|
Required:
|
|
103
|
-
--collection <ref> Collection
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
--
|
|
108
|
-
|
|
109
|
-
--workspace <path> Workspace folder (default:
|
|
110
|
-
--environment <name> Environment to use
|
|
111
|
-
--var <KEY=VALUE> Override a variable (repeatable; highest priority)
|
|
112
|
-
--iterations <num> Number of iterations (default: 1)
|
|
113
|
-
--stop-on-error Stop on first failure
|
|
114
|
-
--delay <ms> Delay between requests
|
|
115
|
-
--include <field> Include extra fields (repeatable):
|
|
116
|
-
perRequest, failedOnly, consoleOutput, report
|
|
169
|
+
--collection <ref> Collection name, slug, or id
|
|
170
|
+
Options:
|
|
171
|
+
--apply Replace values in collection + write to environment
|
|
172
|
+
--env <name> Target environment for --apply (default: active env)
|
|
173
|
+
--ai Use AI detection (needs OPENAI_API_KEY or ANTHROPIC_API_KEY)
|
|
174
|
+
--min-occurrences Only suggest values in at least N requests (default: 1)
|
|
175
|
+
--workspace <path> Workspace folder (default: $HTTP_FORGE_WORKSPACE or cwd)
|
|
117
176
|
--output <fmt> Output format: json or table (default: json)
|
|
118
177
|
|
|
119
|
-
|
|
178
|
+
schedule Generate a CI schedule config for running a test suite
|
|
120
179
|
Required:
|
|
121
|
-
--suite <
|
|
122
|
-
|
|
123
|
-
--
|
|
124
|
-
--
|
|
125
|
-
--
|
|
126
|
-
--
|
|
127
|
-
--
|
|
128
|
-
--
|
|
129
|
-
--
|
|
130
|
-
|
|
131
|
-
--output <fmt> Output format: json or table (default: json)
|
|
180
|
+
--suite <name> Test suite name (or id/slug)
|
|
181
|
+
Options:
|
|
182
|
+
--env <name> Environment to pass to the suite run
|
|
183
|
+
--cron <expr> Cron schedule expression (default: "0 */6 * * *")
|
|
184
|
+
--output <path> Output file path (default: .github/workflows/http-forge-<suite>.yml)
|
|
185
|
+
--reporter <spec> Reporter spec, e.g. "junit:results/junit.xml" (default: junit)
|
|
186
|
+
--no-exit-code Do not fail the job on assertion failures
|
|
187
|
+
--format <type> github-actions | cron | both (default: github-actions)
|
|
188
|
+
--print-cron Print cron entry to stdout (alias for --format cron)
|
|
189
|
+
--workspace <path> Workspace folder (default: $HTTP_FORGE_WORKSPACE or cwd)
|
|
132
190
|
|
|
133
191
|
EXAMPLES:
|
|
134
|
-
http-forge mcp
|
|
135
|
-
http-forge mcp
|
|
136
|
-
http-forge mcp
|
|
137
|
-
http-forge
|
|
138
|
-
http-forge
|
|
139
|
-
http-forge
|
|
140
|
-
http-forge run
|
|
141
|
-
http-forge run
|
|
142
|
-
http-forge run
|
|
143
|
-
http-forge run
|
|
144
|
-
http-forge run
|
|
145
|
-
http-forge run
|
|
192
|
+
http-forge mcp start --port 3100
|
|
193
|
+
http-forge mcp status
|
|
194
|
+
http-forge mcp stop
|
|
195
|
+
http-forge launch
|
|
196
|
+
http-forge launch --dev
|
|
197
|
+
http-forge launch --both /path/to/workspace
|
|
198
|
+
http-forge run collection "my-api" --env dev
|
|
199
|
+
http-forge run request "Get Users" --collection "my-api" --env production
|
|
200
|
+
http-forge run request "Get Users" --collection "my-api" --folder Auth --include tests
|
|
201
|
+
http-forge run collection "my-api" --env dev --include perRequest
|
|
202
|
+
http-forge run collection "my-api" --env prod --var BASE_URL=https://api.example.com --var API_KEY=$API_KEY
|
|
203
|
+
http-forge run folder "Auth/Login" --collection "my-api" --env dev --include perRequest
|
|
204
|
+
http-forge run folder Users --collection "my-api" --no-recursive --include report
|
|
205
|
+
http-forge run suite "smoke-tests" --iterations 3 --include failedOnly --output json
|
|
206
|
+
http-forge run suite "smoke-tests" --env staging --var TOKEN=$CI_TOKEN
|
|
207
|
+
http-forge run suite "smoke-tests" --reporter junit:results/junit.xml --exit-code
|
|
208
|
+
http-forge run suite "smoke-tests" --reporter html --reporter junit:results/junit.xml --exit-code
|
|
209
|
+
http-forge run suite "load-test" --concurrency 10 --iterations 5
|
|
210
|
+
http-forge copy-as --collection my-api --request get-users --lang curl
|
|
211
|
+
http-forge copy-as --collection my-api --request "Create User" --lang python
|
|
212
|
+
http-forge list collections
|
|
213
|
+
http-forge list suites --output table
|
|
214
|
+
http-forge list environments --workspace /path/to/workspace
|
|
215
|
+
http-forge list requests --collection my-api --output table
|
|
216
|
+
http-forge list requests --collection my-api --folder Auth
|
|
217
|
+
http-forge list folders --collection my-api
|
|
218
|
+
http-forge env list
|
|
219
|
+
http-forge env get staging
|
|
220
|
+
http-forge env get staging --output table
|
|
221
|
+
http-forge env set staging BASE_URL https://staging.example.com
|
|
222
|
+
http-forge env set staging API_KEY=my-secret-key
|
|
223
|
+
http-forge env unset staging OLD_VAR
|
|
224
|
+
http-forge generate-collection --curl "curl https://api.example.com/users"
|
|
225
|
+
http-forge generate-collection --curl "curl -X POST -H 'Authorization: Bearer sk-abc' https://api.example.com/v1/users -d '{\"name\":\"Alice\"}'" --env dev
|
|
226
|
+
http-forge generate-collection --postman ./MyCollection.postman_collection.json
|
|
227
|
+
http-forge generate-collection --openapi ./openapi.yaml --name "Payments API" --create-envs --env staging
|
|
228
|
+
http-forge suggest-env --collection my-api --output table
|
|
229
|
+
http-forge suggest-env --collection my-api --apply --env staging
|
|
230
|
+
http-forge schedule --suite smoke-tests --env staging
|
|
231
|
+
http-forge schedule --suite regression --env prod --cron "0 2 * * *" --format both
|
|
146
232
|
|
|
147
233
|
NOTES:
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
234
|
+
Collection, request, and folder references accept an id, a slug, or a display
|
|
235
|
+
name. Resolution tries id, then slug, then name, and stops at the first match.
|
|
236
|
+
If a name matches multiple items, the command lists the candidates and exits
|
|
237
|
+
non-zero — pass the id or slug to disambiguate.
|
|
238
|
+
|
|
239
|
+
Set HTTP_FORGE_WORKSPACE and HTTP_FORGE_ENV in your shell profile to avoid
|
|
240
|
+
repeating --workspace and --env on every command.
|
|
153
241
|
|
|
154
242
|
OPTIONS:
|
|
155
243
|
--help, -h Show this help message
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAcH,oBA8DC;AA1ED,yCAUoB;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,C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CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,SAAS,UAAU;IACjB,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgLb,CAAC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output formatting and argument parsing utilities shared across all CLI commands.
|
|
3
|
+
*/
|
|
4
|
+
import type { ResolutionInfo } from '@http-forge/core';
|
|
5
|
+
export interface ParsedArgs {
|
|
6
|
+
workspace: string;
|
|
7
|
+
collection?: string;
|
|
8
|
+
request?: string;
|
|
9
|
+
suite?: string;
|
|
10
|
+
folder?: string;
|
|
11
|
+
recursive: boolean;
|
|
12
|
+
environment?: string;
|
|
13
|
+
variables: Record<string, unknown>;
|
|
14
|
+
iterations?: number;
|
|
15
|
+
concurrency?: number;
|
|
16
|
+
stopOnError: boolean;
|
|
17
|
+
delay?: number;
|
|
18
|
+
requestFilter?: string[];
|
|
19
|
+
include: string[];
|
|
20
|
+
/** Parsed reporter entries: { name: 'junit'|'html', path?: string } */
|
|
21
|
+
reporters: Array<{
|
|
22
|
+
name: string;
|
|
23
|
+
path?: string;
|
|
24
|
+
}>;
|
|
25
|
+
exitCode: boolean;
|
|
26
|
+
output: 'json' | 'table';
|
|
27
|
+
}
|
|
28
|
+
export declare function parseArgs(args: string[]): ParsedArgs;
|
|
29
|
+
/**
|
|
30
|
+
* Merge process.env into variables at lowest priority.
|
|
31
|
+
* Explicit --var flags (already in opts.variables) take precedence.
|
|
32
|
+
*/
|
|
33
|
+
export declare function mergeProcessEnv(opts: ParsedArgs): void;
|
|
34
|
+
/**
|
|
35
|
+
* Print how a reference (collection/folder/request) was resolved to stderr.
|
|
36
|
+
* Goes to stderr to keep stdout reserved for the JSON/table result.
|
|
37
|
+
*/
|
|
38
|
+
export declare function logResolution(info: ResolutionInfo): void;
|
|
39
|
+
/**
|
|
40
|
+
* Guard stdout so it carries ONLY the machine-readable result.
|
|
41
|
+
* Routes console.log/info to stderr while a run is in progress.
|
|
42
|
+
* @returns a restore function that reinstates the original console methods.
|
|
43
|
+
*/
|
|
44
|
+
export declare function installStdoutGuard(): () => void;
|
|
45
|
+
export declare function outputResult(result: unknown, format: 'json' | 'table'): void;
|
|
46
|
+
/**
|
|
47
|
+
* Tabular output for list commands.
|
|
48
|
+
*/
|
|
49
|
+
export declare function outputListResult(items: object[], format: 'json' | 'table', tableColumns: string[]): void;
|
|
50
|
+
/**
|
|
51
|
+
* Determine whether a run result represents an all-passing run.
|
|
52
|
+
* Suite/collection/folder results expose `summary.allPassed`; a single request
|
|
53
|
+
* result exposes `allPassed` directly. Defaults to true so we never fail a CI
|
|
54
|
+
* build on an unrecognized response shape.
|
|
55
|
+
*/
|
|
56
|
+
export declare function runAllPassed(result: unknown): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Post-run CI handling:
|
|
59
|
+
* - Copy reporters to their explicit output paths.
|
|
60
|
+
* - Exit 1 when --exit-code is set and any test failed.
|
|
61
|
+
*/
|
|
62
|
+
export declare function finalizeCiReports(result: unknown, opts: ParsedArgs): void;
|
|
63
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/output/format.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAQvD,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAA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