@voiden/runner 0.1.0-beta.5 → 2.1.0

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.
Files changed (41) hide show
  1. package/README.md +117 -95
  2. package/dist/cliElectron.d.ts +1 -1
  3. package/dist/index.js +197 -51
  4. package/dist/index.js.map +1 -1
  5. package/dist/plugins/community.d.ts +4 -3
  6. package/dist/plugins/community.d.ts.map +1 -1
  7. package/dist/plugins/community.js +23 -19
  8. package/dist/plugins/community.js.map +1 -1
  9. package/dist/plugins/loader.d.ts +8 -0
  10. package/dist/plugins/loader.d.ts.map +1 -1
  11. package/dist/plugins/loader.js +78 -7
  12. package/dist/plugins/loader.js.map +1 -1
  13. package/dist/plugins/registry.d.ts +26 -21
  14. package/dist/plugins/registry.d.ts.map +1 -1
  15. package/dist/plugins/registry.js +69 -46
  16. package/dist/plugins/registry.js.map +1 -1
  17. package/dist/plugins/registryCache.d.ts +28 -0
  18. package/dist/plugins/registryCache.d.ts.map +1 -0
  19. package/dist/plugins/registryCache.js +95 -0
  20. package/dist/plugins/registryCache.js.map +1 -0
  21. package/dist/plugins/store.d.ts +6 -1
  22. package/dist/plugins/store.d.ts.map +1 -1
  23. package/dist/plugins/store.js +21 -1
  24. package/dist/plugins/store.js.map +1 -1
  25. package/dist/plugins/updateCheck.d.ts +14 -0
  26. package/dist/plugins/updateCheck.d.ts.map +1 -0
  27. package/dist/plugins/updateCheck.js +46 -0
  28. package/dist/plugins/updateCheck.js.map +1 -0
  29. package/dist/report/mail.d.ts +1 -0
  30. package/dist/report/mail.d.ts.map +1 -1
  31. package/dist/report/mail.js +199 -35
  32. package/dist/report/mail.js.map +1 -1
  33. package/dist/runner.d.ts +1 -1
  34. package/dist/runner.d.ts.map +1 -1
  35. package/dist/runner.js +19 -2
  36. package/dist/runner.js.map +1 -1
  37. package/dist/runtimeVars.d.ts +5 -0
  38. package/dist/runtimeVars.d.ts.map +1 -1
  39. package/dist/runtimeVars.js +36 -2
  40. package/dist/runtimeVars.js.map +1 -1
  41. package/package.json +10 -5
package/README.md CHANGED
@@ -15,7 +15,6 @@ GitHub Actions, GitLab CI, Docker, and more.
15
15
  - [Quick start](#quick-start)
16
16
  - [Commands](#commands)
17
17
  - [run](#run)
18
- - [env](#env)
19
18
  - [session](#session)
20
19
  - [report](#report)
21
20
  - [plugin](#plugin)
@@ -29,7 +28,7 @@ GitHub Actions, GitLab CI, Docker, and more.
29
28
  - [voiden-advanced-auth](#voiden-advanced-auth)
30
29
  - [voiden-graphql](#voiden-graphql)
31
30
  - [Output formats](#output-formats)
32
- - [Reports — CSV and email](#reports--csv-and-email)
31
+ - [Reports — CSV, JSON, and email](#reports--csv-json-and-email)
33
32
  - [Exit codes](#exit-codes)
34
33
  - [CI/CD](#cicd)
35
34
  - [Supported protocols](#supported-protocols)
@@ -61,11 +60,16 @@ voiden-runner run ./requests/ --env .env.staging
61
60
  # Stop on first failure (CI-friendly)
62
61
  voiden-runner run ./tests/ --env .env.ci --stop-on-failure
63
62
 
64
- # Export report to CSV + send by email
65
- # SMTP settings (host, user, etc.) are read from your .env file
63
+ # Send an email report (no attachment required HTML includes all details)
64
+ voiden-runner run ./tests/ \
65
+ --env .env.staging \
66
+ --mail-to team@company.com
67
+
68
+ # Send with both CSV and JSON attached
66
69
  voiden-runner run ./tests/ \
67
70
  --env .env.staging \
68
71
  --csv ./results/report.csv \
72
+ --output-json ./results/report.json \
69
73
  --mail-to team@company.com
70
74
  ```
71
75
 
@@ -93,12 +97,12 @@ voiden-runner run <paths...> [options]
93
97
  | `--show-req` | Print sent request headers and body for each request |
94
98
  | `--show-res` | Print response headers and body for each request |
95
99
  | `--verbose` | Print script logs, plugin messages, and section dividers |
96
- | `--json` | Machine-readable JSON output (suppresses normal output) |
97
- | `--no-session` | Completely stateless run (do not load/save results or runtime variables) |
98
- | `--output-json <file>` | Write the full result object to a JSON file pass the whole response data to the next CLI or script |
100
+ | `--json` | Output results as JSON to stdout instead of the normal colored output — useful for piping to other tools in CI |
101
+ | `--no-session` | Completely stateless run no variables are loaded from disk, shared between files, or saved |
102
+ | `--output-json <file>` | Write the full result object to a JSON file (also attached to email if `--mail` is used) |
99
103
  | `--csv <path>` | Export full report to a CSV file. Use `.` for the current directory (auto-generates filename) |
100
- | `--mail` | Send HTML summary + attached CSV using `VOIDEN_MAIL_TO` (requires `--csv`) |
101
- | `--mail-to <address>` | Send HTML summary + attached CSV to this address (requires `--csv`) |
104
+ | `--mail` | Send HTML report to the address in `VOIDEN_MAIL_TO` env |
105
+ | `--mail-to <address>` | Send HTML report to this email address |
102
106
  | `--mail-from <address>` | Sender address (default: `VOIDEN_MAIL_FROM` env) |
103
107
  | `--mail-subject <text>` | Email subject (default: `VOIDEN_MAIL_SUBJECT` env or auto-summary) |
104
108
  | `--smtp-host <host>` | SMTP server host (default: `VOIDEN_SMTP_HOST` env) |
@@ -107,7 +111,7 @@ voiden-runner run <paths...> [options]
107
111
  | `--smtp-user <user>` | SMTP username (default: `VOIDEN_SMTP_USER` env) |
108
112
  | `--smtp-pass <pass>` | SMTP password (default: `VOIDEN_SMTP_PASS` env) |
109
113
 
110
- ### Environment Variables
114
+ ### `session`
111
115
 
112
116
  ```
113
117
  voiden-runner session status
@@ -122,15 +126,26 @@ state (results and runtime variables).
122
126
  ### `report`
123
127
 
124
128
  ```
125
- voiden-runner report generate [--csv <path>] [--mail] [--mail-to <address>]
129
+ voiden-runner report generate [options]
126
130
  voiden-runner report clear
127
131
  ```
128
132
 
129
- `generate` (alias `gen`) creates a combined report from all accumulated results
130
- in the current session. `clear` wipes the results history only (runtime
133
+ `generate` (alias `gen`) creates a combined report from all accumulated results
134
+ in the current session. `clear` wipes the results history only (runtime
131
135
  variables are preserved).
132
136
 
133
- Accepts all mail and SMTP options listed above.
137
+ **`report generate` options**
138
+
139
+ | Flag | Description |
140
+ |---|---|
141
+ | `-e, --env <path>` | `.env` file for SMTP configuration |
142
+ | `--csv <path>` | Export session results to a CSV file |
143
+ | `--output-json <file>` | Write session results to a JSON file (also attached to email if `--mail` is used) |
144
+ | `--mail` | Send HTML report to `VOIDEN_MAIL_TO` (attaches `--csv` and/or `--output-json` if provided) |
145
+ | `--mail-to <address>` | Send HTML report to this address |
146
+ | `--mail-from <address>` | Sender address |
147
+ | `--mail-subject <text>` | Email subject line |
148
+ | `--smtp-*` | All SMTP flags listed above |
134
149
 
135
150
  ### `plugin`
136
151
 
@@ -270,8 +285,8 @@ voiden.variables.set('token', voiden.response.body.access_token)
270
285
  By default, runtime variables are **persisted to disk** at `~/.voiden/.process.env.json`.
271
286
  This allows you to share state across multiple `voiden-runner` commands.
272
287
 
273
- - **To disable persistence** (keep variables in-memory only for a single run), use the `--no-session` flag.
274
- - **To clear variables**, delete the `.process.env.json` file or use `voiden-runner session clear`.
288
+ - **To run completely stateless**, use the `--no-session` flag no variables are loaded from disk, no variables flow between files, and nothing is saved after the run.
289
+ - **To clear variables**, use `voiden-runner session clear`.
275
290
 
276
291
  The `.void` files themselves are never modified. This ensures that your source
277
292
  files remain clean while still allowing for stateful execution chains.
@@ -306,11 +321,11 @@ in `get-profile.void`.
306
321
  ## Sessions & Persistence
307
322
 
308
323
  By default, `voiden-runner` operates in a **stateful session**. This means it
309
- persists captured runtime variables and run results across multiple command
324
+ persists captured runtime variables and run results across multiple command
310
325
  invocations until you explicitly clear them.
311
326
 
312
327
  ### 1. Persistent State
313
- Captured variables stay active until you clear the session. This is ideal for
328
+ Captured variables stay active until you clear the session. This is ideal for
314
329
  multi-step workflows:
315
330
 
316
331
  ```bash
@@ -329,20 +344,37 @@ voiden-runner run users.void
329
344
  voiden-runner run posts.void
330
345
 
331
346
  # Generate a combined CSV report for all 3 runs
332
- voiden-runner report --csv ./session-report.csv
347
+ voiden-runner report generate --csv ./session-report.csv
333
348
 
334
349
  # Email the combined report
335
- voiden-runner report --mail-to qa@company.com
350
+ voiden-runner report generate --mail-to qa@company.com
351
+
352
+ # Email with both CSV and JSON attached
353
+ voiden-runner report generate \
354
+ --csv ./session-report.csv \
355
+ --output-json ./session-report.json \
356
+ --mail-to qa@company.com
336
357
  ```
337
358
 
338
- ### Managing the Session
359
+ ### 3. Stateless runs
339
360
 
340
- Use the `session` command to check status or wipe all state.
361
+ Use `--no-session` to run completely isolated no state is loaded from disk,
362
+ no variables flow between files within the run, and nothing is saved after:
363
+
364
+ ```bash
365
+ # Each file is fully isolated — no vars from disk, no cross-file var sharing
366
+ voiden-runner run ./tests/ --no-session
367
+ ```
368
+
369
+ ### Managing the Session
341
370
 
342
371
  ```bash
343
372
  # See how many variables and results are stored
344
373
  voiden-runner session status
345
374
 
375
+ # List all persisted runtime variables and their values
376
+ voiden-runner session vars
377
+
346
378
  # Wipe everything (results and runtime variables)
347
379
  voiden-runner session clear
348
380
  ```
@@ -497,6 +529,9 @@ POST (`Content-Type: application/json`, body `{query, variables}`).
497
529
 
498
530
  ### `--json`
499
531
 
532
+ Outputs results as JSON to stdout instead of the normal colored output. The terminal
533
+ output is completely replaced by the JSON — useful for piping directly to another tool.
534
+
500
535
  ```json
501
536
  {
502
537
  "summary": { "total": 3, "passed": 2, "failed": 1, "totalDurationMs": 559, "activePlugins": ["..."] },
@@ -515,9 +550,35 @@ POST (`Content-Type: application/json`, body `{query, variables}`).
515
550
  }
516
551
  ```
517
552
 
553
+ ### `--output-json <file>`
554
+
555
+ Writes the same JSON structure to a file. Unlike `--json`, normal terminal output
556
+ is preserved. If `--mail` is also used, the JSON file is attached to the email.
557
+
558
+ ```bash
559
+ # Save results to file — terminal output still shows normally
560
+ voiden-runner run auth.void --output-json result.json
561
+
562
+ # Combine: normal output + JSON file + email with JSON attached
563
+ voiden-runner run ./tests/ \
564
+ --output-json results.json \
565
+ --mail-to qa@company.com
566
+ ```
567
+
568
+ ### `--json` vs `--output-json`
569
+
570
+ | | `--json` | `--output-json <file>` |
571
+ |---|---|---|
572
+ | Output destination | stdout | file on disk |
573
+ | Terminal output | replaced by JSON | preserved (normal colored output) |
574
+ | Email attachment | — | yes, if `--mail` is also used |
575
+ | Use case | piping to other tools | saving to disk / attaching to email |
576
+
577
+ Both flags can be combined — the JSON goes to stdout AND to a file simultaneously.
578
+
518
579
  ---
519
580
 
520
- ## Reports — CSV and email
581
+ ## Reports — CSV, JSON, and email
521
582
 
522
583
  ### CSV
523
584
 
@@ -537,27 +598,50 @@ CSV columns: `File`, `Protocol`, `Method`, `URL`, `Success`, `Status`,
537
598
  ### Email
538
599
 
539
600
  ```bash
601
+ # Send HTML report (no attachment required)
540
602
  voiden-runner run ./tests/ \
541
603
  --env .env.ci \
542
604
  --mail-to qa@company.com
605
+
606
+ # Attach a CSV
607
+ voiden-runner run ./tests/ \
608
+ --env .env.ci \
609
+ --csv ./report.csv \
610
+ --mail-to qa@company.com
611
+
612
+ # Attach both CSV and JSON
613
+ voiden-runner run ./tests/ \
614
+ --env .env.ci \
615
+ --csv ./report.csv \
616
+ --output-json ./report.json \
617
+ --mail-to qa@company.com
543
618
  ```
544
619
 
545
- Sends a dark-themed HTML report with per-request cards showing request/response
546
- headers, bodies, and assertion results. Subject line is auto-generated from the
547
- pass/fail summary unless `--mail-subject` is provided.
620
+ The HTML email is styled using the Voiden dark theme and includes:
621
+
622
+ - **Summary stats** passed, failed, total, and total duration at a glance
623
+ - **Failed section** — all failed requests listed first, each with a red indicator
624
+ - **Passed section** — all passed requests listed after
625
+ - **Per-request cards** — each card shows method, URL, status code, and duration
626
+ - **▸ Request & Response dropdown** — expand any card to see the full request headers/body and response headers/body
627
+ - **Assertion results** — pass/fail per assertion shown inline on each card
628
+ - **Attachments** — CSV and/or JSON attached when `--csv` or `--output-json` is provided
548
629
 
549
630
  **SMTP Configuration**
550
631
 
551
- The runner reads SMTP settings from your `.env` file (passed via `--env`) or
632
+ SMTP and mail settings are read from your `.env` file (passed via `--env`) or
552
633
  the system environment.
553
634
 
554
635
  | Variable | Description |
555
636
  |---|---|
556
- | `VOIDEN_SMTP_HOST` | **Required** for email. SMTP server hostname (e.g., `smtp.gmail.com`). |
557
- | `VOIDEN_SMTP_PORT` | SMTP port. Defaults to `587` (or `465` if secure). |
558
- | `VOIDEN_SMTP_SECURE` | Set to `true` to use TLS/SSL (port 465). |
559
- | `VOIDEN_SMTP_USER` | SMTP login username. |
560
- | `VOIDEN_SMTP_PASS` | SMTP login password. |
637
+ | `VOIDEN_MAIL_TO` | Default recipient address (used when `--mail` is passed without `--mail-to`) |
638
+ | `VOIDEN_MAIL_FROM` | Default sender address |
639
+ | `VOIDEN_MAIL_SUBJECT` | Default email subject |
640
+ | `VOIDEN_SMTP_HOST` | **Required** for email. SMTP server hostname (e.g. `smtp.gmail.com`) |
641
+ | `VOIDEN_SMTP_PORT` | SMTP port. Defaults to `587` (or `465` if secure) |
642
+ | `VOIDEN_SMTP_SECURE` | Set to `true` to use TLS/SSL (port 465) |
643
+ | `VOIDEN_SMTP_USER` | SMTP login username |
644
+ | `VOIDEN_SMTP_PASS` | SMTP login password |
561
645
 
562
646
  ---
563
647
 
@@ -580,68 +664,6 @@ This exit code works universally — bash (`$?`), PowerShell (`$LASTEXITCODE`),
580
664
  `set -e`, `&&`/`||` chains, GitHub Actions, GitLab CI, Jenkins, CircleCI, and
581
665
  any other CI/CD system.
582
666
 
583
- ## Passing results to other CLI commands
584
-
585
- ### `--output-json <file>`
586
-
587
- Writes the full result — the whole response object and array — to a JSON file.
588
- Normal terminal output still shows. The next CLI, script, or tool reads the file
589
- and gets everything: status, headers, body, assertions, duration.
590
-
591
- ```bash
592
- # Write results to a file, then pass the whole object to the next tool
593
- voiden-runner run auth.void --output-json result.json
594
- my-deploy-cli --data result.json
595
-
596
- # Chain multiple runs — each appends its own file
597
- voiden-runner run login.void --output-json login.json
598
- voiden-runner run users.void --output-json users.json
599
- my-report-tool login.json users.json
600
- ```
601
-
602
- The JSON structure written to the file is the same as `--json` stdout output:
603
-
604
- ```json
605
- {
606
- "summary": { "total": 1, "passed": 1, "failed": 0, "totalDurationMs": 342 },
607
- "requests": [
608
- {
609
- "file": "/path/to/auth.void",
610
- "protocol": "rest",
611
- "method": "POST",
612
- "url": "https://api.example.com/auth",
613
- "success": true,
614
- "status": 200,
615
- "durationMs": 342,
616
- "body": "{\"access_token\":\"sk-abc\",\"user\":{\"id\":42}}",
617
- "requestHeaders": { "Content-Type": "application/json" },
618
- "responseHeaders": { "content-type": "application/json" }
619
- }
620
- ]
621
- }
622
- ```
623
-
624
- ### `--json` stdout pipe
625
-
626
- Use `--json` to pipe the same structure directly to another command:
627
-
628
- ```bash
629
- voiden-runner run auth.void --json | jq .
630
- voiden-runner run tests/ --json | my-cli --stdin
631
- voiden-runner run tests/ --json > results.json && python3 analyse.py results.json
632
- ```
633
-
634
- ### Runtime variable chaining
635
-
636
- Variables captured via `{{$res.body.xxx}}` blocks persist to
637
- `~/.voiden/.process.env.json` between separate `voiden-runner run` calls —
638
- no piping or files needed:
639
-
640
- ```bash
641
- voiden-runner run login.void # captures token via runtime-variables block
642
- voiden-runner run users.void # uses {{process.token}} automatically
643
- ```
644
-
645
667
  ---
646
668
 
647
669
  ## CI/CD
@@ -692,7 +714,7 @@ jobs:
692
714
  voiden-runner run ./tests/ \
693
715
  --env .env.ci \
694
716
  --stop-on-failure \
695
- --json | tee results.json
717
+ --output-json results.json
696
718
 
697
719
  - uses: actions/upload-artifact@v4
698
720
  if: always()
@@ -40,7 +40,7 @@ export declare function createCliElectron(env: Record<string, string>, runtimeVa
40
40
  * .voiden/.process.env.json. In CLI we have no project dir, so just return
41
41
  * the state as-is. Pass --env to cover the same variables.
42
42
  */
43
- preSendProcess: (state: RestApiRequestState) => Promise<any>;
43
+ preSendProcess: (state: RestApiRequestState) => Promise<RestApiRequestState>;
44
44
  /** replaceProcessVariablesInText equivalent — identity in CLI */
45
45
  replaceVar: (text: string) => Promise<string>;
46
46
  /** expandLinkedBlocksInDoc equivalent — no linked blocks in CLI */