@postman/postman-plugin 0.2.2 → 0.4.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 (53) hide show
  1. package/README.md +58 -10
  2. package/dist/hosts/antigravity.js +47 -0
  3. package/dist/hosts/copilot.js +60 -0
  4. package/dist/hosts/index.js +3 -1
  5. package/dist/hosts/opencode-config.js +147 -0
  6. package/dist/hosts/opencode.js +315 -34
  7. package/dist/hosts/shared.js +10 -3
  8. package/dist/source.js +19 -5
  9. package/dist/system.js +20 -1
  10. package/hooks/session-start-context.md +1 -1
  11. package/mcp.pi.json +2 -2
  12. package/package.json +1 -1
  13. package/skills/ai-readiness/SKILL.md +40 -44
  14. package/skills/api-discovery/SKILL.md +64 -129
  15. package/skills/api-discovery/reference/orbit.md +17 -5
  16. package/skills/api-documentation/SKILL.md +38 -25
  17. package/skills/api-engineer/SKILL.md +78 -23
  18. package/skills/api-mocking/SKILL.md +117 -135
  19. package/skills/api-monitoring/SKILL.md +52 -129
  20. package/skills/api-simulation/SKILL.md +138 -0
  21. package/skills/api-simulation/reference/sim_yaml_schema.md +50 -0
  22. package/skills/api-testing/SKILL.md +48 -95
  23. package/skills/bootstrap/SKILL.md +123 -210
  24. package/skills/bootstrap/reference/cli_installation.md +4 -3
  25. package/skills/ci-integration/SKILL.md +53 -112
  26. package/skills/collection-schema-v3/SKILL.md +43 -204
  27. package/skills/collection-schema-v3/reference/http.md +150 -0
  28. package/skills/datasets/SKILL.md +89 -314
  29. package/skills/datasets/reference/spreadsheets.md +25 -0
  30. package/skills/flows/SKILL.md +57 -206
  31. package/skills/flows/reference/flow_cli_flags.md +3 -2
  32. package/skills/performance-testing/SKILL.md +46 -62
  33. package/skills/performance-testing/references/jmeter-import/README.md +113 -0
  34. package/skills/performance-testing/references/jmeter-import/import-report.md +52 -0
  35. package/skills/performance-testing/references/jmeter-import/mapping-table.md +97 -0
  36. package/skills/performance-testing/references/jmeter-import/postman-perf-capabilities.md +56 -0
  37. package/skills/performance-testing/references/jmeter-import/script-translation.md +98 -0
  38. package/skills/performance-testing/references/jmeter-import/scripts/groovy_to_js.py +83 -0
  39. package/skills/performance-testing/references/jmeter-import/scripts/jmx_to_postman.py +1433 -0
  40. package/skills/postman-mcp-server/SKILL.md +53 -59
  41. package/skills/postman-mcp-server/references/docs.md +0 -1
  42. package/skills/postman-mcp-server/references/learn.md +10 -9
  43. package/skills/postman-mcp-server/references/mock.md +0 -1
  44. package/skills/postman-mcp-server/references/search.md +0 -1
  45. package/skills/postman-mcp-server/references/security.md +0 -1
  46. package/skills/postman-mcp-server/references/setup.md +0 -1
  47. package/skills/postman-mcp-server/references/sync.md +0 -1
  48. package/skills/postman-mcp-server/references/test.md +0 -1
  49. package/skills/variables/SKILL.md +63 -0
  50. package/skills/webhook-testing/SKILL.md +103 -0
  51. package/skills/webhook-testing/reference/forwarding.md +10 -0
  52. package/skills/webhook-testing/reference/outbound_webhooks.md +25 -0
  53. package/skills/webhook-testing/reference/webhook_scripts.md +163 -0
@@ -0,0 +1,138 @@
1
+ ---
2
+ name: api-simulation
3
+ description: Runs your code for real against stand-ins for the HTTP services it calls, served together as one environment on one local port or one deployed URL, whether that code is a service you're changing, a frontend, a test suite or a demo. Use when you add or change code that calls other services and need to run it, test it, prove a fix or reproduce an upstream failure (timeouts, 5xx, 409, 429) end to end, locally or in CI, without the real services because they're unreachable, need credentials, cost money, have side effects or don't exist yet. Also answers what happens to a request, or to the data it writes, when a service it calls goes down, is slow or returns errors ("what happens to a booking if the email service is down?"), by running each failure instead of reading the code. Applies even when nobody says mock or simulation. To give a frontend or another team a stand-in for an API, use api-mocking. Covers `postman simulation`.
4
+ ---
5
+
6
+ # API Simulation
7
+
8
+ A simulation serves several mocks as one environment, each reached by its
9
+ routeKey: as a path prefix by default, or as an `x-mock-slug` header when the
10
+ caller's paths can't change.
11
+
12
+ Run your code against it rather than stubbing its HTTP client in tests or
13
+ calling the real services. A stub skips the client, config, timeouts and
14
+ error handling that will run in production; the real services need
15
+ credentials and leave side effects. A simulation runs that code over real
16
+ HTTP, the same way in CI, and its log shows what each dependency was asked.
17
+
18
+ Do only what the task needs. If a `.sim.yaml` in `postman/simulations/`
19
+ already covers it, run that one. One request through the changed path proves
20
+ a change; build failure variants only when asked how the code fails or when
21
+ it must survive a failure.
22
+
23
+ `postman simulation` needs CLI 1.70.0 or later (`postman --version`; an older
24
+ CLI answers `postman simulation -h` with its general help).
25
+
26
+ ## Building it
27
+
28
+ - **Members are the code's HTTP dependencies.** Databases, queues and caches
29
+ aren't; run them locally. **api-discovery** can find calls made through
30
+ shared code; ask about the repo by its `git remote` name, because a close
31
+ name matches another repo.
32
+ - **Each member needs a mock: see `api-mocking`,** which looks for the owning
33
+ team's published mock before building one. For a question, one built from
34
+ the contract will do; one that invents responses can send the caller down a
35
+ path the real service never would. In a mock you build, answer `501` for calls this path
36
+ doesn't make: a `404` reads to the caller like a real "not found".
37
+ - **Prefix each mock's `pm.state` keys with its name.** As of CLI 1.73.0,
38
+ members of a local run read each other's keys, so two mocks storing
39
+ `orders` overwrite each other.
40
+
41
+ ## Running it
42
+
43
+ The run is a server that never exits, so a foreground command never returns.
44
+ Start it in the background with an explicit port, its log in a file:
45
+
46
+ ```bash
47
+ postman simulation run postman/simulations/checkout-dev.sim.yaml --port 4900 --output ndjson > sim.ndjson 2> sim.err &
48
+ ```
49
+
50
+ Without `--port`, a busy 3000 silently becomes a random port and every base
51
+ URL points at nothing. It's up when `sim.ndjson` has a `listening` event; a
52
+ start-up error is in `sim.err`. It listens on 127.0.0.1 only, so a caller in
53
+ a container or VM can't reach it. Stop it with
54
+ `pkill -INT -f "simulation run <file>"`; `kill $!` leaves it running,
55
+ because the `postman` launcher ignores the signal. Nothing reloads: restart
56
+ it after a mock edit.
57
+
58
+ Point the caller at it without changing what the code does once deployed.
59
+ Under path routing, swap only the host and keep the path:
60
+ `https://catalog.internal.example.com/v2` becomes
61
+ `http://127.0.0.1:4900/catalog/v2`; a dropped `/v2` is the usual cause of a
62
+ `404`. A hard-coded base URL should read an environment variable with
63
+ today's value as the default. If the code mustn't change at all,
64
+ `simulation run --proxy` reaches the members through `HTTPS_PROXY` instead;
65
+ it applies no conditions, and passes any other host through to the real
66
+ service.
67
+
68
+ ## Reading the log
69
+
70
+ A passing test command doesn't show the dependency path ran: read
71
+ `sim.ndjson`. A member with no `request` events isn't wired or isn't on this
72
+ path. Some answers come from the simulation itself and mean wiring, not code:
73
+
74
+ - `404 Unknown simulation member`: a base URL lost its routeKey, or a client
75
+ sent the wrong `x-mock-slug`.
76
+ - `501`, or a generated mock's `404 Endpoint not defined`: a call the mock
77
+ doesn't model yet.
78
+ - `502 Proxy error`: the member's process died, usually an async throw in a
79
+ mock without `interceptRequests: true`. It stays down and logs nothing
80
+ until you restart; run that mock alone with `postman mock run` to see why.
81
+
82
+ ## When a dependency goes down
83
+
84
+ Run it rather than reason from the code: each way of going down takes a
85
+ different path through the caller, and a stub skips the client code that
86
+ picks the path. Fail the one dependency in each shape that matters, a run
87
+ each, with the others answering normally:
88
+
89
+ - **Unreachable:** point its base URL at a port nothing listens on.
90
+ - **Hanging:** give its member a `latency` condition longer than the
91
+ client's timeout. If the client sets none, that is the finding: Node's
92
+ `fetch` waits about five minutes, so say so rather than wait it out.
93
+ - **An error with a JSON body:** the `error` condition.
94
+ - **An error with an HTML body,** as proxies send: a copy of its mock whose
95
+ default handler answers `500` with HTML. No condition can do this.
96
+
97
+ Only `overrides.conditions` on a member change it. Members always serve
98
+ their default handler and ignore `x-mock-scenario`, and a `scenarios` entry
99
+ with just a `path`, as the Postman app writes, does nothing. Fields and the
100
+ other conditions are in [reference/sim_yaml_schema.md](reference/sim_yaml_schema.md). An injected
101
+ failure never reaches the mock and isn't logged, so judge it by what the
102
+ caller did, and check the other members' logs for side effects, such as
103
+ stock reserved and never released.
104
+
105
+ ## Keeping it
106
+
107
+ Commit your own mocks, the `.sim.yaml` and what `postman dependency add`
108
+ changed, so the next session or CI reruns it in one command. Don't commit
109
+ `postman/.dependencies/`: a copy goes stale when its owner updates theirs,
110
+ and `postman dependency install` restores it. Don't commit `sim.ndjson`: the
111
+ CLI redacts common auth headers and fields, but other headers and bodies are
112
+ logged as sent. In CI, `postman dependency install` needs `POSTMAN_API_KEY`,
113
+ and `postman collection run <collection> --simulation <file> --port <n>`
114
+ starts and stops the simulation around a collection run.
115
+
116
+ `postman simulation push` uploads every member to the workspace, so ask
117
+ first. It fails on a pulled member, which keeps its owner's `id:`; copy it to
118
+ `postman/mocks/` and delete that line.
119
+
120
+ ## Rules
121
+
122
+ 1. **What you're testing is never a member.** It must run for real, or the
123
+ test only proves the mock.
124
+ 2. **Pull the owner's mock even if it's deployed.** Only members take
125
+ conditions and appear in the log, and a private mock server wants a key
126
+ your code won't send.
127
+ 3. **`simulation deploy` is public by default,** unlike `mock deploy`. Ask
128
+ before deploying without `--private`; a local run needs no deploy.
129
+
130
+ ## Before you say it works
131
+
132
+ Claim nothing until what you're testing actually ran: a service printed
133
+ that it's listening and answered your request, or the frontend or test
134
+ suite finished, and its calls are in the log. If its start command exited
135
+ or hung, the run proved nothing; say so and why. Say what a pass proves,
136
+ your code against these stand-ins rather than the real services, what still
137
+ needs the real service before release, and where each mock came from,
138
+ including when you skipped the owner's.
@@ -0,0 +1,50 @@
1
+ # `.sim.yaml` reference
2
+
3
+ Read this when writing or debugging a `.sim.yaml` by hand.
4
+ `postman simulation create` writes the same shape; the Postman app adds
5
+ `id:` fields, which a local run ignores.
6
+
7
+ ```yaml
8
+ simulation: checkout-dev # required: the name
9
+ routing: path # path (default) or header
10
+ mocks: # required: one entry per member
11
+ - routeKey: catalog # lowercase letters, digits, - and _
12
+ path: ../mocks/catalog/config.yaml # a mock's config.yaml, or a .js handler
13
+ scenarios: # optional: conditions, below
14
+ - overrides:
15
+ conditions:
16
+ latency: { delay_ms: 250 }
17
+ ```
18
+
19
+ Run the `.sim.yaml` rather than a simulation id: a run by id drops every
20
+ member's conditions (CLI 1.70.0–1.73.0).
21
+
22
+ ## Conditions
23
+
24
+ | Condition | Field | Effect |
25
+ | --- | --- | --- |
26
+ | `latency` | `delay_ms` | Holds each request that long, then serves it. |
27
+ | `error` | `status_code` (400–599) | Every request gets that status as JSON, with `"scenario":"error"`. |
28
+ | `rate_limit` | `requests_per_minute` | Requests over the limit get `429` and `Retry-After`. |
29
+ | `chaos` | `failure_rate` (0–100), optional `status_code` | That share of requests, at random, get `500` or that status. |
30
+
31
+ - A condition covers every route on its member. To fail one endpoint while
32
+ its siblings succeed, give that endpoint a mock of its own.
33
+ - They run in a fixed order (`latency`, `error`, `rate_limit`, `chaos`), and
34
+ the first to fail a request ends it, so set one failure at a time,
35
+ optionally with `latency`.
36
+ - An unknown condition name is ignored silently, so a misspelling injects
37
+ nothing. `overrides.bypass` prints a warning and is ignored.
38
+ - A `latency` request is served and logged, with a `duration` that leaves
39
+ out the delay.
40
+
41
+ ## The log (`--output ndjson`)
42
+
43
+ One JSON event per line on stdout; notices go to stderr, so keep them apart.
44
+
45
+ - `listening`: every member has started; a member that fails to start
46
+ stops the run with `Error: …` and exit code 1.
47
+ - `request`: one per request a member served.
48
+ - `summary`, on stop: `requestsServed` (under 400), `requestsFailed` (400
49
+ and up), `uptimeMs` and `signal`. Injected failures and the simulation's
50
+ own `400`, `404` and `502` aren't counted.
@@ -1,104 +1,57 @@
1
1
  ---
2
2
  name: api-testing
3
- description: Runs tests against an API from the command line — a single ad-hoc request, a full collection of pm.test assertions, or matching real captured app traffic against a collection contract. Use when the user asks to "test this endpoint," "run this collection," "check the API still works," or "verify my app's requests match the contract." Covers `postman request`, `postman collection run`, and `postman application test`. Depends on bootstrap when the target is a cloud collection or workspace-bound environment; a bare URL or local collection needs nothing from bootstrap.
3
+ description: Use when testing an endpoint, running collection assertions, or checking real application traffic against an API contract. Reuses saved requests and reports what live, mocked, or captured-traffic results actually establish. Use for requests such as "test this endpoint".
4
4
  ---
5
5
 
6
6
  # API Testing
7
7
 
8
- ## Overview
9
-
10
- Three tools, matched to what already exists:
11
-
12
- | Have | Use |
13
- | --- | --- |
14
- | Just a URL to check, with no saved request | `postman request` |
15
- | A request already saved in a collection | `postman collection run <collection-path> -i <request-id-name-or-path>` |
16
- | A collection with `pm.test` assertions saved in it | `postman collection run` |
17
- | A real app (browser flow, CLI, service) whose traffic should match a collection's contract | `postman application test` |
18
-
19
- Don't reach for the heavier tool when the lighter one already answers the
20
- question — a one-off endpoint check doesn't need a collection, and a
21
- collection run doesn't need Playwright.
22
-
23
- ## `postman request` — over curl, not instead of testing
24
-
25
- A single request with Postman's resolution built in: `-e` resolves
26
- `{{variables}}` from an environment file the same way a collection run
27
- would, `--auth-*` flags cover basic/bearer/digest/oauth/aws/etc. without
28
- hand-building headers, and `--retry`/`--timeout` handle flaky endpoints.
29
- `--script-post-request` can run `pm.test(...)` assertions inline — the exit
30
- code counts *failed assertions*, not just HTTP status, so a 200 with a
31
- failing test still exits nonzero. Useful for a quick check or a CI health
32
- check; not the place to accumulate assertions that should outlive one
33
- command — those belong saved in a collection.
34
-
35
- Before constructing a URL, headers, auth, and body on the command line, look
36
- for a matching `*.request.yaml` under `postman/collections/`. If it exists,
37
- execute the saved request through its collection:
38
-
39
- ```bash
40
- postman collection run "postman/collections/Orders API" -i "create order"
41
- ```
42
-
43
- Do not copy the saved YAML fields into `postman request`; that bypasses the
44
- collection's inherited variables, auth, scripts, and maintained payload. The
45
- `postman request` positional target is a URL, not a `.request.yaml` path. When
46
- there is no saved request but its body already lives in a separate file, keep
47
- the file as the source of truth with `--body @path/to/payload.json` instead of
48
- inlining its contents.
49
-
50
- ## `collection run` — the assertion suite
51
-
52
- Debugging a request's behavior during a run (why a `pm.test` failed, what a
53
- request actually sends) means reading the request's own YAML — see the
54
- `collection-schema-v3` skill for that file format before assuming a field's
55
- shape.
56
-
57
- Runs every request in a collection (or a subset via `-i`, repeatable),
58
- executing whatever `pm.test` scripts are already saved in it.
59
- `-d`/`--iteration-data` (or the beta `--iteration-data-dataset` +
60
- `--iteration-data-view` pair) drives data-driven runs across a CSV/JSON
61
- file or a Postman Dataset. `-r junit,html` for CI-consumable reports.
62
- `--use-mock`/`--mock` redirects the run at a mock instead of a real backend
63
- (see the `api-mocking` skill) — reach for this to test request/assertion
64
- logic without depending on a live service.
65
-
66
- ## `application test` — contract-matching real traffic
67
-
68
- This doesn't send its own requests. It runs your existing test command
69
- (`--command "npx playwright test"`, or config-driven via
70
- `postman.config.cjs` targets), captures the network traffic that command
71
- generates, and matches/asserts it against your Postman collections —
72
- answering "did my app's actual calls conform to the contract," not "does
73
- this endpoint respond correctly." `--capture-only` skips the matching step
74
- entirely and just exports what was captured as a new v3 collection,
75
- organized by host — a way to bootstrap a collection from real traffic
76
- rather than authoring one from scratch. Results are published to the connected
77
- workspace after each run, so the evidence of the run outlives the terminal
78
- session; `--report-events=false` keeps a run local when it shouldn't be
79
- recorded.
80
-
81
- ## Critical Rules
82
-
83
- 1. **Don't reach for `application test` for something a plain
84
- `collection run` covers.** It exists specifically for matching *captured*
85
- app traffic (via Playwright or similar), not for driving requests itself.
86
- 2. **`postman request`'s exit code reflects failed `pm.test` assertions, not
87
- HTTP status alone.** A nonzero exit on a 200 response usually means a
88
- post-request script assertion failed, not a network problem.
89
- 3. **Assertions meant to be reused belong in the collection, not on the
90
- command line.** A `--script-post-request` test on `collection run` runs
91
- once and leaves nothing for the next person; save it as a `pm.test` in
92
- the request instead.
93
- 4. **`--use-mock` is the way to test without a live backend** — prefer it
94
- over standing up ad hoc fakes or skipping tests that need a dependency.
95
- 5. **Reuse a saved request instead of reconstructing it.** If a matching v3
96
- request exists, use `collection run <collection-path> -i <request>`; reserve
97
- `postman request` for genuinely ad-hoc requests.
8
+ Saved requests preserve the auth, payloads, variables, and assertions that make
9
+ an API check reproducible. The useful result is evidence about an intended
10
+ guarantee; a successful HTTP exchange alone does not establish correctness.
11
+
12
+ 1. Choose the smallest execution mode that answers the question:
13
+
14
+ | Evidence needed | Use |
15
+ | --- | --- |
16
+ | One endpoint with no saved request | `postman request <url>` |
17
+ | Behavior of an existing saved request | `postman collection run <collection-path> -i <request-id-name-or-path>` |
18
+ | Reusable regression checks | `postman collection run <path-or-id>` |
19
+ | Whether a real app's calls match the contract | `postman application test` |
20
+
21
+ 2. Reuse a matching request under `postman/collections/` before reconstructing
22
+ its HTTP fields. Running it through the collection retains inherited auth,
23
+ variables, and scripts. `postman request` takes a URL, not a request YAML
24
+ path; for an unsaved request with an existing payload file, `--body @path`
25
+ preserves that file as the source. See **collection-schema-v3** when
26
+ editing the saved request.
27
+ 3. Derive assertions from the contract and the behavior at risk. A test that
28
+ merely repeats the current implementation can bless its bug. Preserve
29
+ existing guarantees and add checks for the changed behavior; put reusable
30
+ `pm.test` assertions in the collection so later runs and teammates inherit
31
+ them. Inline `--script-post-request` assertions suit a one-off check.
32
+ 4. Choose a real or mocked target according to the claim. `--use-mock` lets a
33
+ collection run exercise request and assertion logic without a live
34
+ backend; `--mock` alone only starts one. `--use-mock` replaces the
35
+ variable's whole value, base path included (see **api-mocking**). Passing
36
+ against that mock does not verify the service the mock stands in for.
37
+ 5. Reuse environment resolution with `-e` and **variables**. Use a CSV/JSON
38
+ file through `-d` for simple iteration; use **datasets** when the inputs
39
+ need queries, joins, or reusable views. Export reports such as
40
+ `-r junit,html` when **ci-integration** needs evidence beyond terminal output.
41
+ 6. Use `application test` when the application's actual traffic is the subject.
42
+ It runs an existing command, such as `--command "npx playwright test"`,
43
+ captures its traffic, and matches it against collections. `--capture-only`
44
+ instead exports a v3 collection organized by host; that captures behavior
45
+ without validating it. Results are recorded in the connected workspace by
46
+ default; `--report-events=false` keeps the run local when required.
47
+
48
+ Use command-specific `-h` for supported options and **bootstrap** for unresolved
49
+ CLI setup or authentication when using workspace resources. A bare URL or
50
+ local collection does not require a workspace binding.
98
51
 
99
52
  ## Verification
100
53
 
101
- State the actual result (pass/fail counts, exit code), not just that the
102
- command ran. For `application test`, state whether it ran in match mode or
103
- `--capture-only` — they answer different questions and shouldn't be
104
- reported the same way.
54
+ Report the target, tested behavior, assertion counts, and exit code. The exit
55
+ code reflects failed assertions, not HTTP status alone: a 200 can fail a test.
56
+ For application testing, distinguish matching from capture-only mode, and for
57
+ mocked runs state which real behavior remains unverified.