mmt-mcp 1.47.1 → 1.49.0-pre

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 (23) hide show
  1. package/dist/examples/README.md +1 -1
  2. package/dist/examples/basic/03_environment_variables/README.md +1 -1
  3. package/dist/examples/examples-index.json +46 -39
  4. package/dist/examples/intermediate/06_imports/README.md +1 -1
  5. package/dist/examples/intermediate/10_environment_variables/README.md +81 -0
  6. package/dist/examples/intermediate/{10_environment_presets → 10_environment_variables}/multimeter.mmt +6 -1
  7. package/dist/examples/intermediate/10_environment_variables/os_variables/echo_path.mmt +14 -0
  8. package/dist/examples/intermediate/10_environment_variables/os_variables/path_test.mmt +13 -0
  9. package/dist/examples/intermediate/10_environment_variables/suite.mmt +9 -0
  10. package/dist/guides/generate-env.md +1 -1
  11. package/dist/server.cjs +389 -33
  12. package/dist/server.js +389 -33
  13. package/package.json +1 -1
  14. package/dist/examples/intermediate/10_environment_presets/README.md +0 -58
  15. package/dist/examples/intermediate/32_environment_live_variables/README.md +0 -63
  16. package/dist/examples/intermediate/32_environment_live_variables/multimeter.mmt +0 -4
  17. package/dist/examples/intermediate/32_environment_live_variables/suite.mmt +0 -7
  18. /package/dist/examples/intermediate/{32_environment_live_variables → 10_environment_variables/live_variables}/consume_session_api.mmt +0 -0
  19. /package/dist/examples/intermediate/{32_environment_live_variables → 10_environment_variables/live_variables}/consume_session_test.mmt +0 -0
  20. /package/dist/examples/intermediate/{32_environment_live_variables → 10_environment_variables/live_variables}/create_session_api.mmt +0 -0
  21. /package/dist/examples/intermediate/{32_environment_live_variables → 10_environment_variables/live_variables}/create_session_test.mmt +0 -0
  22. /package/dist/examples/intermediate/{10_environment_presets → 10_environment_variables/presets}/api/echo_env.mmt +0 -0
  23. /package/dist/examples/intermediate/{10_environment_presets → 10_environment_variables/presets}/test/preset_test.mmt +0 -0
@@ -18,7 +18,7 @@ Suites against well-known **public** APIs (no Multimeter echo server). See [`rea
18
18
 
19
19
  ## Intermediate
20
20
 
21
- Use these when you are ready for reusable APIs, authentication, mock servers, richer environment variables, inputs and outputs, suites, tag filters (`filter.only` / `filter.skip`), imports, data-driven tests, environment presets, documentation options/ranges, control flow, comparison operators (`expect` / `check` / `assert`), helper JavaScript, additional protocol or file formats, converting a small OpenAPI / Postman / WSDL / HTTP / Bruno file to `.mmt`, and the `omit` keyword.
21
+ Use these when you are ready for reusable APIs, authentication, mock servers, richer environment variables (presets, OS `$VAR`, live `./….mmt` — see `intermediate/10_environment_variables`), inputs and outputs, suites, tag filters (`filter.only` / `filter.skip`), imports, data-driven tests, documentation options/ranges, control flow, comparison operators (`expect` / `check` / `assert`), helper JavaScript, additional protocol or file formats, converting a small OpenAPI / Postman / WSDL / HTTP / Bruno file to `.mmt`, and the `omit` keyword.
22
22
 
23
23
  ## Professional
24
24
 
@@ -34,7 +34,7 @@ npx testlight run examples/basic/03_environment_variables/get_json.mmt \
34
34
  ## Key concepts
35
35
 
36
36
  - **`<<e:var>>`** embeds an environment variable inside a string.
37
+ - Presets, OS `$VAR` refs, and live `./….mmt` values are covered in [Environment Variables (intermediate)](../../intermediate/10_environment_variables/).
37
38
  - POST requests with env headers are covered later in [Environment POST Echo](../../intermediate/19_environment_post_echo/).
38
- - Presets are covered later in [Environment Presets](../../intermediate/10_environment_presets/).
39
39
 
40
40
  See [Environment docs](../../../docs/files/env/index.md) for full details.
@@ -304,22 +304,64 @@
304
304
  "title": "Data driven echo test"
305
305
  },
306
306
  {
307
- "path": "intermediate/10_environment_presets/api/echo_env.mmt",
307
+ "path": "intermediate/10_environment_variables/live_variables/consume_session_api.mmt",
308
308
  "type": "api",
309
309
  "category": "intermediate",
310
- "title": "Echo with Environment"
310
+ "title": "Echo both live sessions"
311
+ },
312
+ {
313
+ "path": "intermediate/10_environment_variables/live_variables/consume_session_test.mmt",
314
+ "type": "test",
315
+ "category": "intermediate",
316
+ "title": "Read live env from a test"
317
+ },
318
+ {
319
+ "path": "intermediate/10_environment_variables/live_variables/create_session_api.mmt",
320
+ "type": "api",
321
+ "category": "intermediate",
322
+ "title": "Create session (API)"
311
323
  },
312
324
  {
313
- "path": "intermediate/10_environment_presets/multimeter.mmt",
325
+ "path": "intermediate/10_environment_variables/live_variables/create_session_test.mmt",
326
+ "type": "test",
327
+ "category": "intermediate",
328
+ "title": "Create session (test)"
329
+ },
330
+ {
331
+ "path": "intermediate/10_environment_variables/multimeter.mmt",
314
332
  "type": "env",
315
333
  "category": "intermediate"
316
334
  },
317
335
  {
318
- "path": "intermediate/10_environment_presets/test/preset_test.mmt",
336
+ "path": "intermediate/10_environment_variables/os_variables/echo_path.mmt",
337
+ "type": "api",
338
+ "category": "intermediate",
339
+ "title": "Echo OS PATH"
340
+ },
341
+ {
342
+ "path": "intermediate/10_environment_variables/os_variables/path_test.mmt",
343
+ "type": "test",
344
+ "category": "intermediate",
345
+ "title": "OS PATH env ref"
346
+ },
347
+ {
348
+ "path": "intermediate/10_environment_variables/presets/api/echo_env.mmt",
349
+ "type": "api",
350
+ "category": "intermediate",
351
+ "title": "Echo with Environment"
352
+ },
353
+ {
354
+ "path": "intermediate/10_environment_variables/presets/test/preset_test.mmt",
319
355
  "type": "test",
320
356
  "category": "intermediate",
321
357
  "title": "Environment Preset Test"
322
358
  },
359
+ {
360
+ "path": "intermediate/10_environment_variables/suite.mmt",
361
+ "type": "suite",
362
+ "category": "intermediate",
363
+ "title": "Environment variables"
364
+ },
323
365
  {
324
366
  "path": "intermediate/11_control_flow/api/echo.mmt",
325
367
  "type": "api",
@@ -1110,41 +1152,6 @@
1110
1152
  "category": "intermediate",
1111
1153
  "title": "Reuse the token in a later suite item"
1112
1154
  },
1113
- {
1114
- "path": "intermediate/32_environment_live_variables/consume_session_api.mmt",
1115
- "type": "api",
1116
- "category": "intermediate",
1117
- "title": "Echo both live sessions"
1118
- },
1119
- {
1120
- "path": "intermediate/32_environment_live_variables/consume_session_test.mmt",
1121
- "type": "test",
1122
- "category": "intermediate",
1123
- "title": "Read live env from a test"
1124
- },
1125
- {
1126
- "path": "intermediate/32_environment_live_variables/create_session_api.mmt",
1127
- "type": "api",
1128
- "category": "intermediate",
1129
- "title": "Create session (API)"
1130
- },
1131
- {
1132
- "path": "intermediate/32_environment_live_variables/create_session_test.mmt",
1133
- "type": "test",
1134
- "category": "intermediate",
1135
- "title": "Create session (test)"
1136
- },
1137
- {
1138
- "path": "intermediate/32_environment_live_variables/multimeter.mmt",
1139
- "type": "env",
1140
- "category": "intermediate"
1141
- },
1142
- {
1143
- "path": "intermediate/32_environment_live_variables/suite.mmt",
1144
- "type": "suite",
1145
- "category": "intermediate",
1146
- "title": "Live env consumers"
1147
- },
1148
1155
  {
1149
1156
  "path": "professional/01_report_generation/api/echo.mmt",
1150
1157
  "type": "api",
@@ -89,4 +89,4 @@ npx testlight run examples/intermediate/06_imports/tests/test_api.mmt --env-file
89
89
 
90
90
  - See [Simple Test](../../basic/02_simple_test/) for a direct basic test example.
91
91
  - See [CSV Data Driven Test](../09_csv_data_driven_test/) for CSV data imports.
92
- - See [Environment Presets](../10_environment_presets/) for environment presets in `multimeter.mmt`.
92
+ - See [Environment Variables](../10_environment_variables/) for presets, OS `$VAR`, and live values in `multimeter.mmt`.
@@ -0,0 +1,81 @@
1
+ # Environment Variables
2
+
3
+ Presets, OS process-env refs (`$VAR`), and live file-backed values (`./….mmt`) in one project — each concept in its own folder.
4
+
5
+ ## Structure
6
+
7
+ ```
8
+ 10_environment_variables/
9
+ ├── multimeter.mmt # Shared variables + presets
10
+ ├── presets/
11
+ │ ├── api/echo_env.mmt # <<e:api_url>>, e:mode
12
+ │ └── test/preset_test.mmt
13
+ ├── os_variables/
14
+ │ ├── echo_path.mmt # Posts e:path_from_os ($PATH) in the body
15
+ │ └── path_test.mmt
16
+ ├── live_variables/
17
+ │ ├── create_session_api.mmt # Live target (API → outputs.session)
18
+ │ ├── create_session_test.mmt # Live target (test → outputs.session, cache: 2s)
19
+ │ ├── consume_session_test.mmt # Asserts e:session_* look like UUIDs
20
+ │ └── consume_session_api.mmt # Optional Send — body uses e:session_*
21
+ ├── suite.mmt # preset + OS PATH + live consumers
22
+ └── README.md
23
+ ```
24
+
25
+ ## Files
26
+
27
+ | Path | Description |
28
+ |---|---|
29
+ | `multimeter.mmt` | Choices + presets; `path_from_os: $PATH`; live `session_*` → `./live_variables/…` |
30
+ | `presets/` | Presets — `api_url.local` is `https://local.mmt.dev`, staging is `https://test.mmt.dev` |
31
+ | `os_variables/` | OS `$PATH` echoed in the JSON **body** (not the URL) |
32
+ | `live_variables/` | Live `./….mmt` getters ([docs](../../../docs/files/env/live-variables.md)) |
33
+ | `suite.mmt` | Runs all three concepts |
34
+
35
+ ## Key concepts
36
+
37
+ - **Presets** — `runner.dev` / `runner.staging` pick `api_url`, `mode`, `timeout`.
38
+ - **`$PATH`** — OS ref; consumers use `e:path_from_os` in the body. See [OS variables](../../../docs/files/env/os-variables.md).
39
+ - **`./….mmt`** — live getters; each `e:session_*` uses the target’s first `outputs:` key.
40
+ - **`<<e:var>>`** / **`e:var`** — inline string vs whole-value (type-preserving) substitution.
41
+
42
+ ## How to use
43
+
44
+ ### In VS Code
45
+
46
+ 1. Open the folder (or repo) so `multimeter.mmt` loads as the workspace env.
47
+ 2. Pick a preset (e.g. `runner.dev`) in the Environment panel.
48
+ 3. Run `suite.mmt`, or files under `presets/`, `os_variables/`, `live_variables/`.
49
+ 4. `path_from_os` shows an `(os)` chip; live paths show `(live)`.
50
+
51
+ ### With the CLI
52
+
53
+ ```sh
54
+ # Full suite
55
+ npx testlight run examples/intermediate/10_environment_variables/suite.mmt \
56
+ --env-file examples/intermediate/10_environment_variables/multimeter.mmt \
57
+ --preset runner.dev
58
+
59
+ # Presets only (local.mmt.dev in-process twin)
60
+ npx testlight run examples/intermediate/10_environment_variables/presets/test/preset_test.mmt \
61
+ --env-file examples/intermediate/10_environment_variables/multimeter.mmt \
62
+ --preset runner.dev
63
+
64
+ # OS PATH in the request body
65
+ npx testlight run examples/intermediate/10_environment_variables/os_variables/path_test.mmt \
66
+ --env-file examples/intermediate/10_environment_variables/multimeter.mmt \
67
+ --preset runner.dev
68
+
69
+ # Live variables
70
+ npx testlight run examples/intermediate/10_environment_variables/live_variables/consume_session_test.mmt \
71
+ --env-file examples/intermediate/10_environment_variables/multimeter.mmt
72
+ ```
73
+
74
+ Override a preset value:
75
+
76
+ ```sh
77
+ npx testlight run examples/intermediate/10_environment_variables/presets/test/preset_test.mmt \
78
+ --env-file examples/intermediate/10_environment_variables/multimeter.mmt \
79
+ --preset runner.dev \
80
+ -e mode=release
81
+ ```
@@ -1,7 +1,7 @@
1
1
  type: env
2
2
  variables:
3
3
  api_url:
4
- local: "https://test.mmt.dev"
4
+ local: "https://local.mmt.dev"
5
5
  staging: "https://test.mmt.dev"
6
6
  mode:
7
7
  dev: debug
@@ -10,6 +10,11 @@ variables:
10
10
  - 5000
11
11
  - 10000
12
12
  - 30000
13
+ # OS process env — PATH exists on macOS, Linux, and Windows
14
+ path_from_os: $PATH
15
+ # Live file-backed values (run on each e: read)
16
+ session_api: ./live_variables/create_session_api.mmt
17
+ session_test: ./live_variables/create_session_test.mmt
13
18
  presets:
14
19
  runner:
15
20
  dev:
@@ -0,0 +1,14 @@
1
+ type: api
2
+ title: Echo OS PATH
3
+ description: Posts the host PATH (via e:path_from_os / $PATH) in the JSON body — not in the URL
4
+ inputs:
5
+ note: from OS PATH
6
+ outputs:
7
+ echoed_path: body.body.path
8
+ echoed_note: body.body.note
9
+ url: <<e:api_url>>/echo
10
+ method: post
11
+ format: json
12
+ body:
13
+ note: i:note
14
+ path: e:path_from_os
@@ -0,0 +1,13 @@
1
+ type: test
2
+ title: OS PATH env ref
3
+ description: Reads $PATH through e:path_from_os and echoes it in the request body
4
+ import:
5
+ echoOs: ./echo_path.mmt
6
+ steps:
7
+ # Must be the real process PATH, not the literal `$PATH` string.
8
+ - check: <<e:path_from_os>> != $PATH
9
+ - check: <<e:path_from_os>> =* .
10
+ - call: echoOs
11
+ id: result
12
+ expect:
13
+ echoed_path: e:path_from_os
@@ -0,0 +1,9 @@
1
+ type: suite
2
+ title: Environment variables
3
+ description: >
4
+ Preset consumer, OS $PATH body echo, and live ./….mmt session consumers.
5
+ runner.dev uses https://local.mmt.dev (in-process); live session_api hits test.mmt.dev.
6
+ items:
7
+ - ./presets/test/preset_test.mmt
8
+ - ./os_variables/path_test.mmt
9
+ - ./live_variables/consume_session_test.mmt
@@ -52,7 +52,7 @@ Env variables are **read in APIs/tests**, not stored as tokens here. In `type: a
52
52
  | `<<e:api_url>>` | Inside strings / URLs |
53
53
  | `e:city.latitude` / `<<e:city.latitude>>` | Property access on a nested choice value |
54
54
 
55
- The AI should not put `e:` tokens into env files; here we only define raw values or options.
55
+ The AI should not put `e:` tokens into env files; here we only define raw values or options. Whole-value `$VAR` (OS process env) and `./….mmt` (live) are allowed as bare scalars or choice values — see [OS variables](../files/env/os-variables.md) and [Live variables](../files/env/live-variables.md).
56
56
 
57
57
  ---
58
58