@postman/postman-plugin 0.1.1-rc.0 → 0.1.2

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 (40) hide show
  1. package/README.md +14 -2
  2. package/dist/cli.js +7 -1
  3. package/dist/hosts/index.js +2 -1
  4. package/dist/hosts/kimi.js +5 -2
  5. package/dist/hosts/pi.js +84 -0
  6. package/dist/pi-extension.js +27 -0
  7. package/dist/run.js +16 -10
  8. package/dist/source.js +3 -1
  9. package/hooks/session-start-context.md +11 -0
  10. package/mcp.pi.json +14 -0
  11. package/package.json +21 -6
  12. package/skills/ai-readiness/SKILL.md +50 -0
  13. package/skills/api-discovery/SKILL.md +135 -0
  14. package/skills/api-discovery/reference/orbit.md +101 -0
  15. package/skills/api-documentation/SKILL.md +34 -0
  16. package/skills/api-documentation/reference/rest-api-best-practices.md +47 -0
  17. package/skills/api-engineer/SKILL.md +29 -0
  18. package/skills/api-mocking/SKILL.md +141 -0
  19. package/skills/api-monitoring/SKILL.md +137 -0
  20. package/skills/api-testing/SKILL.md +103 -0
  21. package/skills/bootstrap/SKILL.md +216 -0
  22. package/skills/bootstrap/reference/cli_installation.md +58 -0
  23. package/skills/ci-integration/SKILL.md +121 -0
  24. package/skills/collection-schema-v3/SKILL.md +210 -0
  25. package/skills/collection-schema-v3/reference/environment.md +63 -0
  26. package/skills/collection-schema-v3/reference/other_protocols.md +86 -0
  27. package/skills/datasets/SKILL.md +323 -0
  28. package/skills/flows/SKILL.md +212 -0
  29. package/skills/flows/reference/flow_cli_flags.md +111 -0
  30. package/skills/performance-testing/SKILL.md +71 -0
  31. package/skills/postman-mcp-server/SKILL.md +71 -0
  32. package/skills/postman-mcp-server/references/docs.md +88 -0
  33. package/skills/postman-mcp-server/references/learn.md +73 -0
  34. package/skills/postman-mcp-server/references/mcp-limitations.md +38 -0
  35. package/skills/postman-mcp-server/references/mock.md +101 -0
  36. package/skills/postman-mcp-server/references/search.md +83 -0
  37. package/skills/postman-mcp-server/references/security.md +129 -0
  38. package/skills/postman-mcp-server/references/setup.md +141 -0
  39. package/skills/postman-mcp-server/references/sync.md +85 -0
  40. package/skills/postman-mcp-server/references/test.md +84 -0
@@ -0,0 +1,216 @@
1
+ ---
2
+ name: bootstrap
3
+ description: Resolves the Postman CLI, authenticates when the task needs it, and manages the filesystem/workspace binding for a repository. Use when the user asks to set up Postman, enable filesystem workflows, authenticate, initialize, import, connect, pull, push, sync, or share a workspace — and before skills that need a linked workspace, only when the CLI, linked workspace, or spec path has not already been confirmed.
4
+ ---
5
+
6
+ # Bootstrap Postman for This Repo
7
+
8
+ ## Overview
9
+
10
+ One-time and idempotent: every other Postman skill in this plugin reads the
11
+ values this one records and re-derives none of them. Finding an existing
12
+ `postman/` tree or an OpenAPI file is a signal to inspect, not to assume this
13
+ repo is already set up.
14
+
15
+ ## Rules
16
+
17
+ - Make ad-hoc HTTP calls with `postman request`, never `curl` or another
18
+ client. If the request already exists in a collection, preserve its saved
19
+ auth, variables, scripts, and payload by using `postman collection run
20
+ <collection-path> -i <request>` instead of reconstructing it on the command
21
+ line; see `api-testing`.
22
+ - Never invent a subcommand or a flag. Run `-h` first and believe it.
23
+ - Lint specs with `postman spec lint`, never `postman api …` — the API Builder
24
+ is deprecated in v12+ and the CLI prints no warning.
25
+ - Local commands need no login; only commands that reach the Postman
26
+ workspace do. Don't force a login the task doesn't need.
27
+ - A missing `postman` binary means install it. Route to `postman-mcp-server`
28
+ only after an install has been attempted and actually failed.
29
+ - Never fabricate a workspace id, spec path, or collections directory. Report
30
+ the gap and stop.
31
+ - Never echo an API key or session token into output, logs, or summaries.
32
+ - "Present" is not "current": check the version and existing links before
33
+ setting anything up.
34
+ - Wire up an existing repo only. Never scaffold a new API or a starter spec.
35
+ - Write no host-specific paths — the same `skills/` directory loads on every
36
+ route.
37
+ - Do not use `init` or `workspace create` to share or import a workspace that
38
+ already exists. Choose the direction of sync from the lifecycle table below.
39
+
40
+ ## Ask the CLI: `-h`
41
+
42
+ The CLI is self-describing at different levels. Walk down only as far as the
43
+ question needs:
44
+
45
+ ```bash
46
+ postman -h # resources: collection, spec, mock, monitor, workspace, api, flows…
47
+ postman <resource> -h # that resource's actions
48
+ postman <resource> <action> -h # real flags, defaults, and worked `Eg.` lines
49
+ ```
50
+
51
+ Read the third level before writing any command that carries a flag — it is the
52
+ only place defaults are stated, and a wrong default fails silently. Live output
53
+ is authoritative over any summary, including this file. There is also no single
54
+ verb for "is the workspace linked and synced": run `postman workspace -h` and
55
+ pick from what it prints.
56
+
57
+ ---
58
+
59
+ # Process
60
+
61
+ Three steps, in order. Stop at the first that fails and report which one.
62
+
63
+ ## 1. Resolve the CLI
64
+
65
+ ### 1.1 Check what is already there
66
+
67
+ **Present, and at which version?**
68
+
69
+ ```bash
70
+ command -v postman && postman --version
71
+ ```
72
+
73
+ **Current?** Never blocking — no network is a normal answer. But don't call a
74
+ feature missing without having made this comparison.
75
+
76
+ ```bash
77
+ npm view postman-cli version
78
+ ```
79
+
80
+ ### 1.2 Install only if missing
81
+
82
+ **Preferred — npm, all platforms:**
83
+
84
+ ```bash
85
+ npm install -g postman-cli
86
+ ```
87
+
88
+ **Windows, or avoiding a global npm install:** use the platform installers in
89
+ [reference/cli_installation.md](reference/cli_installation.md). Every route puts
90
+ `postman` on `PATH`.
91
+
92
+ **Updating a copy that already exists:** use the same route that installed it.
93
+ curl-installed binaries don't take `npm install -g` cleanly.
94
+
95
+ **If every route fails:** name what blocked you — no Node, no shell, no write
96
+ access, or a hosted session that cannot install — then hand off to the
97
+ `postman-mcp-server` skill. An attempted install that actually failed is the
98
+ only thing that qualifies.
99
+
100
+ ## 2. Establish the filesystem and workspace bindings
101
+
102
+ ### 2.1 Authenticate only if this step needs it
103
+
104
+ Local commands need no login, and `postman init` is among them — its own help
105
+ says *"No authentication, and safe in CI."* Skip this entirely unless the
106
+ command you're about to run pulls or pushes an existing workspace, or shares
107
+ one with a team.
108
+
109
+ **With an API key — preferred, non-interactive:**
110
+
111
+ ```bash
112
+ [ -n "$POSTMAN_API_KEY" ] && postman login --with-api-key "$POSTMAN_API_KEY"
113
+ ```
114
+
115
+ **Browser flow, when that variable is unset:**
116
+
117
+ ```bash
118
+ postman login
119
+ ```
120
+
121
+ **Never echo the key or token.** Auth state lives in the CLI's own config; this
122
+ skill writes no credential file. Report that authentication succeeded, nothing
123
+ more.
124
+
125
+ ### 2.2 Inspect both sides before choosing a command
126
+
127
+ Read `.postman/resources.yaml` for `localResources` and `workspace.id`, and
128
+ inspect the local `postman/` tree. When the user names an existing workspace or
129
+ asks to import, sync, or share one, use `workspace list --json` and `workspace
130
+ get <id> --elements --json` to confirm the workspace side. Never create a
131
+ second workspace merely because this repository is not connected yet.
132
+
133
+ Prefer filesystem-first work: materialize an existing workspace with
134
+ `workspace pull <id>`, or initialize local files with `postman init --no-cloud`
135
+ when no workspace exists. Then inspect, edit, diff, and validate the
136
+ version-controlled files before any push.
137
+
138
+ | Existing state and intent | Use | Why |
139
+ | --- | --- | --- |
140
+ | No workspace exists; start locally | `postman init --json --no-cloud` | Creates the git-native filesystem without requiring login. |
141
+ | No workspace exists; create and bind one | `postman workspace create --visibility <value>` or the explicit init creation path | Creation is the requested lifecycle event. |
142
+ | Workspace exists; enable filesystem work | `postman workspace pull <workspace-id>` | Connects the workspace to the repository and materializes its entities under `postman/`. |
143
+ | Workspace exists; record only the Git binding | `postman workspace connect-git <workspace-id> [path]` | Binds without downloading its contents. |
144
+ | Bound workspace; the workspace is authoritative | `postman workspace pull` | Refreshes local files from the connected workspace. |
145
+ | Bound workspace; local files are authoritative | `postman workspace diff --push-strategy default`, then `postman workspace push` | Previews and publishes creates/updates without deleting unmatched workspace entities. |
146
+ | “Share this existing workspace with my team” and it is already team-accessible | Diff, then `postman workspace push` | Publishes local contents to the existing workspace; `create` would make a duplicate. |
147
+
148
+ If “share” also requires changing a personal workspace's visibility or team
149
+ permissions, inspect its metadata first. `push` synchronizes entities; it does
150
+ not change access control. Do not create a replacement to work around a missing
151
+ metadata-update command.
152
+
153
+ `workspace diff` is read-only. Match its push strategy to the intended push.
154
+ `--push-strategy force-sync` can delete workspace entities absent locally, so use it
155
+ only when the user explicitly requests mirroring and approves the shown
156
+ deletions. Do not add `-y` merely to bypass a prompt.
157
+
158
+ ### 2.3 Initialize only when there is no workspace to pull
159
+
160
+ `postman init --json` is the agent-facing form. It writes
161
+ `.postman/resources.yaml` and scaffolds `postman/` for specs, collections and
162
+ environments. Downstream skills read that file and nothing else.
163
+
164
+ ```bash
165
+ postman init --json --no-cloud # local only, no workspace
166
+ postman init --json --visibility personal # also create and bind a workspace
167
+ ```
168
+
169
+ Use `--visibility` only when a new workspace is actually wanted. If the
170
+ workspace already exists, use `pull` to enable the filesystem workflow;
171
+ use `push` only when publishing local changes to an already-bound workspace.
172
+
173
+ **The workspace step is interactive** without `--no-cloud` or `--visibility`.
174
+
175
+ **Read the payload, not stderr.** Take `bindings` and `exitCode` from the JSON.
176
+ Each binding reports a `source` of `inferred` or `none` — an inferred spec is a
177
+ guess worth confirming before building on it.
178
+
179
+ **Exit codes that are not failures:** 2 means several specs could be
180
+ authoritative, so re-run with `--spec <path>`. 5 means the local files were
181
+ written but the requested workspace was not created — it does *not* mean re-run.
182
+
183
+ ## 3. Verify and report
184
+
185
+ ### 3.1 Checkpoints
186
+
187
+ - `postman --version` returned a real version.
188
+ - Auth is confirmed, or established as not required for this task.
189
+ - `.postman/resources.yaml` names a spec or a collections directory.
190
+ - `workspace.id` is set, or the run was deliberately local-only — `--no-cloud`
191
+ leaves it empty and still exits 0, which is a pass, not a gap.
192
+ - After `pull`, expected workspace entities exist under `postman/`. After
193
+ `push`, report created/updated entities and conflicts; do not claim a
194
+ workspace is shared unless its access level permits the intended teammates.
195
+
196
+ "The CLI is installed" is not the bar, and a loaded skill configures nothing.
197
+
198
+ ### 3.2 Summary format
199
+
200
+ ```md
201
+ ## Postman bootstrap
202
+ - **CLI**: <version> (latest: <version> | not checked)
203
+ - **Auth**: <api-key | browser | not required for this task>
204
+ - **Workspace**: <id | none — local only>
205
+ - **Spec path**: <path (inferred | explicit) | none — user must create>
206
+ - **Collections dir**: <path | none — user must create>
207
+ ```
208
+
209
+ ---
210
+
211
+ # Reference Files
212
+
213
+ - `collection-schema-v3` skill — read when inspecting or writing the
214
+ collection files this skill resolves.
215
+ - [CLI Installation](reference/cli_installation.md) — read for install, update
216
+ and uninstall commands per platform.
@@ -0,0 +1,58 @@
1
+ # Postman CLI Installation
2
+
3
+ A global install, on `PATH`, installed by one of three tools depending on
4
+ platform. Whichever one put the binary there is the one to use again when
5
+ updating it — mixing tools leaves two `postman` binaries and a `PATH`
6
+ question.
7
+
8
+ ## Install
9
+
10
+ **npm (all platforms):**
11
+
12
+ ```bash
13
+ npm install -g postman-cli
14
+ ```
15
+
16
+ **macOS, Linux, and WSL (curl):**
17
+
18
+ ```bash
19
+ curl -o- "https://dl-cli.pstmn.io/install/unix.sh" | sh
20
+ ```
21
+
22
+ **Windows (PowerShell):**
23
+
24
+ ```powershell
25
+ powershell.exe -NoProfile -InputFormat None -ExecutionPolicy AllSigned -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://dl-cli.pstmn.io/install/win64.ps1'))"
26
+ ```
27
+
28
+ ## Check for drift
29
+
30
+ ```bash
31
+ postman --version # installed
32
+ npm view postman-cli version # latest published
33
+ ```
34
+
35
+ ## Update
36
+
37
+ Run the same command that installed it — the npm, curl or PowerShell line
38
+ above, whichever put the binary there. Using a different one leaves two
39
+ `postman` binaries and a `PATH` question. Never `npm install -g` over a copy
40
+ that came from the curl installer or a system package manager.
41
+
42
+ The CLI has no self-update verb. `postman skills update` is a different
43
+ thing: it refreshes a repository's committed `postman/skills/`, not the
44
+ binary.
45
+
46
+ ## Uninstall
47
+
48
+ npm installations:
49
+
50
+ ```bash
51
+ npm uninstall -g postman-cli
52
+ ```
53
+
54
+ Other install methods: delete the `postman` binary from its install
55
+ directory (`%USERPROFILE%\AppData\Local\Microsoft\WindowsApps` on Windows,
56
+ `/usr/local/bin` on macOS/Linux/WSL).
57
+
58
+ Source: https://learning.postman.com/docs/postman-cli/postman-cli-installation/
@@ -0,0 +1,121 @@
1
+ ---
2
+ name: ci-integration
3
+ description: Common CI integrations that can added as independent pass/fail gates. Use when the user asks to "add Postman to CI," "run this collection on every PR," "fail the build on a governance violation," or "push to the postman cloud workspace after merge to main", "add some api related operation in my Github actions".
4
+ ---
5
+
6
+ # CI Integration
7
+
8
+ ## Overview
9
+ These are some common workflows that one can add in their CI pipeline leveraging postman cli.
10
+
11
+ ## Run a collection — a gated pipeline step
12
+
13
+ `postman collection run <path/id>` exits nonzero on a failed `pm.test`
14
+ assertion, which is what makes it a usable gate — see `api-testing` for how
15
+ that exit code actually gets set. What's CI-specific: `-r junit,html` (or
16
+ `--reporter-*-export`) writes a report your CI provider can surface as
17
+ build artifacts or test annotations, instead of leaving the result buried in
18
+ a log. `--bail` stops the run early on the first failure when a fast signal
19
+ matters more than a full report.
20
+
21
+ ## Lint — pick the target that matches the gate you want
22
+
23
+ Three verbs look interchangeable and aren't — only two of them apply your
24
+ organization's governance rules, and the CLI's own `-h` output is where that
25
+ becomes visible (no assumption below goes further than what it printed):
26
+
27
+ | Want to check | Command | Applies org governance? |
28
+ | --- | --- | --- |
29
+ | One spec against your rules | `spec lint <spec> --workspace-id <id> -f error` | Yes, via `--workspace-id` |
30
+ | One collection's structure/style | `collection lint <path> -f error` | **No** — this verb takes no `--workspace-id` at all |
31
+ | The whole workspace: every entity plus `.postman/resources.yaml` | `workspace lint --workspace-id <id> -f error` | Yes |
32
+
33
+ `collection lint` is a schema/style check only — running it and reporting
34
+ "governance passed" overstates what it did. If the ask is "does this
35
+ collection violate our rules," `workspace lint` is the one that actually
36
+ answers it (and covers every collection in the repo in one pass); reach for
37
+ bare `collection lint` only when there's no workspace to fetch rules from
38
+ yet.
39
+
40
+ ## Push to workspace — only after merge
41
+
42
+ `postman workspace push -y` is the one command in this skill that changes
43
+ shared cloud state, so it belongs behind a merge-to-main trigger, not a PR
44
+ trigger. `-y` skips confirmation prompts a non-interactive job can't answer.
45
+ Leave `--no-prepare` off — the default prepare step is what assigns real IDs
46
+ to entities that are new since the last push; skipping it because a run
47
+ felt slow trades a few seconds for a push that silently fails to create
48
+ anything new.
49
+
50
+ `--push-strategy force-sync` mirrors the whole workspace, deleting any cloud
51
+ entity with no local counterpart — genuinely destructive, and not the
52
+ default for a reason. See Critical Rules before adding it to a merge job.
53
+
54
+ ## AI readiness threshold
55
+
56
+ `collection ai-readiness <path> --min-score <n>` and its spec-side
57
+ counterpart `spec ai-readiness <path> --min-score <n>` (see `ai-readiness`
58
+ skill) are a fourth, separate gate — they score AI-agent consumability, not
59
+ test results or governance/structural style. Keep either in its own step:
60
+ folding it into the same step as `run` or one of the `lint` verbs above
61
+ hides which kind of check actually failed when the job goes red. Pick the
62
+ verb that matches what's checked into the repo — `collection ai-readiness`
63
+ for a git-synced collection, `spec ai-readiness` for an OpenAPI spec with no
64
+ collection generated from it yet.
65
+
66
+ ```yaml
67
+ - run: postman collection ai-readiness ./postman/collections/My\ API --min-score 70
68
+ ```
69
+
70
+ ## Critical Rules
71
+
72
+ 1. **Never collapse `run`, `lint`, and `ai-readiness` into one step, and
73
+ never pass `-x`/`--suppress-exit-code` to a CI run.** One combined exit
74
+ code hides which check broke; a suppressed one hides that anything broke
75
+ at all.
76
+ 2. **Gate `workspace push` to the merge event, never a PR event.** Everything
77
+ else in this skill is read-only against the cloud; this is the one
78
+ command that writes to it, so a PR-triggered push ships an unmerged
79
+ branch's entities to the shared workspace.
80
+ 3. **`--push-strategy force-sync` deletes cloud entities absent locally.**
81
+ Only add it to a job whose explicit job is mirroring the workspace exactly,
82
+ with that intent confirmed — never as the default merge step, where the
83
+ default (create/update-only) strategy is the safe choice.
84
+ 4. **Authenticate once, non-interactively:**
85
+ `postman login --with-api-key "$POSTMAN_API_KEY"`, reading the key from
86
+ the CI provider's secret store. Don't reach for `collection run`'s
87
+ `--postman-api-key` as the general answer — it's US-region only — and
88
+ `spec lint`/`workspace push` don't take it at all.
89
+
90
+ ```yaml
91
+ # WRONG — key committed in plain text, and scoped to one command anyway
92
+ - run: postman collection run api.json --postman-api-key PMAK-abc123...
93
+
94
+ # CORRECT — one non-interactive login, key from the provider's secret store
95
+ - run: postman login --with-api-key "$POSTMAN_API_KEY"
96
+ - run: postman collection run api.json
97
+ - run: postman spec lint spec.yaml --workspace-id $WS -f error
98
+ ```
99
+ 5. **Never `newman run` in place of `postman collection run`.** The CLI is
100
+ the supported runner every other skill here assumes; Newman forks the
101
+ toolchain and skips whatever reporting/governance depends on the CLI
102
+ specifically.
103
+
104
+ ## Verification
105
+
106
+ State each gate that ran and its individual result — not "CI passed," but
107
+ which check ran, what it checked (governance vs. structure per the Lint
108
+ table above, or AI-agent consumability for `ai-readiness`), and its exit
109
+ code. If `workspace push` ran, confirm it was triggered by the merge event
110
+ and not a PR event, state which push strategy was used, and report
111
+ `Created`/`Updated` per entity rather than just "push succeeded." Confirm
112
+ no secret value appears literally in the committed workflow file.
113
+
114
+ ## Reference
115
+
116
+ - `api-testing` skill — `collection run`'s exit-code semantics and reporter
117
+ flags in full.
118
+ - `collection-schema-v3` skill — what `workspace push` is actually pushing.
119
+ - `bootstrap` skill — CLI resolution, workspace linking, `.postman/resources.yaml`.
120
+ - `ai-readiness` skill — `collection ai-readiness`, `spec ai-readiness`, and
121
+ their `--min-score` gate.
@@ -0,0 +1,210 @@
1
+ ---
2
+ name: collection-schema-v3
3
+ description: The reference for the git-native v3 collection file format — one YAML file per request/folder/example under postman/collections/, plus postman/environments/. Read before writing, editing, or generating any file in either directory by hand, or before debugging a `collection lint` failure. Covers the HTTP request/example/definition schema, environment schema, and the YAML/naming rules that make files parse — GraphQL, gRPC, WebSocket, Socket.IO, MQTT, MCP, and LLM request schemas are non-HTTP protocols and live in reference/other_protocols.md, read only when a collection actually uses one.
4
+ ---
5
+
6
+ # Collection Schema (v3, Git-Native)
7
+
8
+ ## Overview
9
+
10
+ A v3 collection is a directory tree under `postman/collections/`, one file
11
+ per entity — every request, every folder's metadata, every saved example is
12
+ its own file. There is no single collection.json to open and edit; the
13
+ directory structure itself *is* the collection.
14
+
15
+ ```text
16
+ postman/collections/
17
+ bookstore api/
18
+ .resources/
19
+ definition.yaml (optional)
20
+ get all books.resources/
21
+ examples/
22
+ 200 OK.example.yaml
23
+ 400 Bad Request.example.yaml
24
+ 500 Internal Server Error.example.yaml
25
+ get all books.request.yaml
26
+ get-book-by-id.request.yaml
27
+ add new book.request.yaml
28
+ authentication/
29
+ .resources/
30
+ definition.yaml (optional)
31
+ signup.request.yaml
32
+ login.request.yaml
33
+ ```
34
+
35
+ - Every folder under `postman/collections/` is a collection; it can contain
36
+ subfolders and requests.
37
+ - A folder or collection can have a `.resources/` directory — an optional
38
+ metadata directory for that scope. `.resources/definition.yaml` holds the
39
+ collection/folder's own metadata; request examples live under
40
+ `.resources/<request-name>.resources/examples/`.
41
+ - Never place a request file inside a `.resources/` directory — those are
42
+ metadata-only.
43
+
44
+ ## Definition file (`.resources/definition.yaml`)
45
+
46
+ Optional metadata for a collection or folder:
47
+
48
+ - `$kind: "collection"` — required, even for a folder's definition.
49
+ - `name` — optional, defaults to the filesystem folder name.
50
+ - `description` — optional.
51
+ - `variables` — array of `{key, value, description?, disabled?}`. `value`
52
+ must be a string; `disabled` a boolean.
53
+ - `auth` — a single auth object `{type, credentials: [{key, value}, ...]}`,
54
+ or an array for multiAuth: `[{id, name, type, credentials, rules?}, ...]`.
55
+ - `scripts` — array of `{type, code, language: "text/javascript"}`. `type`
56
+ is one of `http:beforeRequest`, `http:afterResponse`,
57
+ `graphql:beforeQuery`, `graphql:afterResponse`, `grpc:beforeInvoke`,
58
+ `grpc:onIncomingMessage`, `grpc:afterResponse`.
59
+ - `order` — number, used for folder ordering.
60
+
61
+ ## HTTP request (`*.request.yaml`)
62
+
63
+ - `$kind: "http-request"` — required.
64
+ - `name` — optional (see naming rules below for when to include it).
65
+ - `order` — number; only used for relative comparison, so space values out
66
+ (e.g. multiples of 1000) rather than packing them tight — a later
67
+ insertion between two requests shouldn't force renumbering every sibling.
68
+ - `url` — string, with `{{varName}}` variable syntax.
69
+ - `method` — `GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS`.
70
+ - `headers` — array of `{key, value, description?, disabled?}`.
71
+ - `queryParams` — array of `{key, value, description?, disabled?}`.
72
+ - `pathVariables` — array of `{key, value, description?}`.
73
+ - `body` — `{type, content}`; `type` required whenever `body` is present.
74
+ - Types: `json`, `formdata`, `urlencoded`, `text`, `xml`, `html`,
75
+ `javascript`, `file`, `none`.
76
+ - `json`/`text`/`xml`/`html`/`javascript`: `content` is a string.
77
+ - `formdata`: `content` is an array of
78
+ `{key, type: "text"|"file", value or src, contentType?, description?}`.
79
+ - `urlencoded`: `content` is an array of `{key, value, description?}`.
80
+ - `auth` — `{type, credentials}`.
81
+ - `settings` —
82
+ `{protocolVersion?, strictSSL?, followRedirects?, maxRedirects?, disabledSystemHeaders?}`.
83
+ - `scripts` — array of `{type: "beforeRequest"|"afterResponse", code, language: "text/javascript"}`.
84
+ - `examples` — optional, a relative path to the examples directory, e.g.
85
+ `./.resources/<request-name>.resources/examples/`.
86
+
87
+ ## HTTP example (`*.example.yaml`)
88
+
89
+ - `$kind: "http-example"` — required.
90
+ - `name` — optional.
91
+ - `request: {url, method}`.
92
+ - `response: {statusCode, statusText, headers: [{key, value}], body: {type, content}}`.
93
+ - `order` — optional.
94
+
95
+ Saved examples are what `collection ai-readiness` checks for — a request
96
+ with no examples scores worse for agent consumption even if perfectly
97
+ valid structurally.
98
+
99
+ ## Environments (`postman/environments/*.environment.yaml`)
100
+
101
+ Environment files are v3 YAML but are not collection entities: they do not use
102
+ `$kind`. Before creating or editing one by hand, read
103
+ [reference/environment.md](reference/environment.md) for the schema, secret
104
+ handling, CLI-first edit commands, and a linted example.
105
+
106
+ ## YAML rules
107
+
108
+ Invalid YAML breaks parsing silently in confusing ways — when in doubt,
109
+ single-quote it:
110
+
111
+ 1. Single-quote any value containing `{{variables}}`:
112
+ `url: '{{base_url}}/users'` — never leave it unquoted.
113
+ 2. Single-quote values containing `: # & * ! [ ] { } > |`, e.g.
114
+ `name: 'Health check: v2'`.
115
+ 3. Multi-line content (JSON bodies, scripts, queries) uses a `|-` block
116
+ scalar:
117
+ ```yaml
118
+ body:
119
+ type: json
120
+ content: |-
121
+ {
122
+ "name": "example"
123
+ }
124
+ ```
125
+ 4. Quote strings that resemble booleans/numbers when a string is intended:
126
+ `value: "true"`, `value: "123"`.
127
+ 5. `order` must be a bare number, never quoted: `order: 1000`.
128
+ 6. Single-quote file paths and use forward slashes only:
129
+ `examples: './.resources/name.resources/examples'`.
130
+
131
+ ## Naming rules
132
+
133
+ - `<request-name>` (the filename stem before `.request.yaml`) must not
134
+ contain `/ \ : * ? " < > |` — sanitize to `-`.
135
+ - Include `name` in the file only when it differs from `<request-name>`
136
+ (e.g. `name: 'Health/check'` inside `Health-check.request.yaml`, since the
137
+ filename itself can't hold the `/`).
138
+ - Filenames must be unique, case-insensitively, per directory.
139
+
140
+ ## Worked example: "bookstore api"
141
+
142
+ `postman/collections/bookstore api/get all books.request.yaml`
143
+ ```yaml
144
+ $kind: http-request
145
+ method: GET
146
+ url: '{{base_url}}/books'
147
+ order: 1000
148
+ ```
149
+
150
+ `postman/collections/bookstore api/get-book-by-id.request.yaml`
151
+ ```yaml
152
+ $kind: http-request
153
+ name: 'get book by :id'
154
+ method: GET
155
+ url: '{{base_url}}/books/:id'
156
+ order: 2000
157
+ pathVariables:
158
+ - key: id
159
+ value: '1'
160
+ ```
161
+
162
+ `postman/collections/bookstore api/add new book.request.yaml`
163
+ ```yaml
164
+ $kind: http-request
165
+ method: POST
166
+ url: '{{base_url}}/books'
167
+ order: 3000
168
+ headers:
169
+ - key: Content-Type
170
+ value: application/json
171
+ body:
172
+ type: json
173
+ content: |-
174
+ {
175
+ "title": "Example Book",
176
+ "author": "Jane Doe"
177
+ }
178
+ ```
179
+
180
+ `postman/collections/bookstore api/.resources/definition.yaml`
181
+ ```yaml
182
+ $kind: collection
183
+ name: Bookstore API
184
+ variables:
185
+ - key: base_url
186
+ value: 'https://api.bookstore.com/v1'
187
+ ```
188
+
189
+ ## Critical Rules
190
+
191
+ 1. **Every entity is its own file — there's no single collection.json to
192
+ open.** A request, its parent folder's metadata, and its saved examples
193
+ are three separate files, not sections of one document.
194
+ 2. **Unquoted `{{variables}}` or special characters are the most common way
195
+ a hand-written file fails to parse.** Single-quote per the YAML rules
196
+ above rather than debugging a cryptic lint error after the fact.
197
+ 3. **`order` is relative, not an index.** Don't renumber every sibling file
198
+ to insert one request — leave headroom (spacing of 1000) from the start.
199
+ 4. **This file covers HTTP only.** A collection using GraphQL, gRPC,
200
+ WebSocket, Socket.IO, MQTT, MCP, or LLM requests needs
201
+ [reference/other_protocols.md](reference/other_protocols.md) — don't
202
+ guess those schemas from the HTTP shape above, they diverge in real ways
203
+ (e.g. gRPC's `methodDescriptor`, LLM's `userPrompts`/`systemPrompts`).
204
+
205
+ ## Reference
206
+
207
+ - [Other request protocols](reference/other_protocols.md) — GraphQL, gRPC,
208
+ WebSocket, Socket.IO, MQTT, MCP, and LLM request schemas.
209
+ - [Environment schema](reference/environment.md) — v3 environment filenames,
210
+ fields, variable types, safe editing commands, and validation.
@@ -0,0 +1,63 @@
1
+ # Environment Schema (v3)
2
+
3
+ Read this reference before creating, editing, or debugging files under
4
+ `postman/environments/`.
5
+
6
+ ## Prefer the CLI for ordinary edits
7
+
8
+ The CLI preserves the schema and avoids leaking secret values into command
9
+ output:
10
+
11
+ ```bash
12
+ postman environment new "Staging EU"
13
+ postman environment var set baseUrl https://staging.example.com \
14
+ --environment "postman/environments/Staging EU.environment.yaml"
15
+ postman environment var unset oldToken \
16
+ --environment "postman/environments/Staging EU.environment.yaml"
17
+ postman environment lint postman/environments --fail-severity warning
18
+ ```
19
+
20
+ Use `environment get --show-secrets` only when the user explicitly needs the
21
+ secret value revealed. Do not print, summarize, or commit credentials returned
22
+ by it.
23
+
24
+ ## File and fields
25
+
26
+ An environment is one YAML file named `<name>.environment.yaml` under
27
+ `postman/environments/`. It has no `$kind` field.
28
+
29
+ - `name` — required string.
30
+ - `values` — required array; an empty environment uses `values: []`.
31
+ - Each value has:
32
+ - `key` — required variable name.
33
+ - `value` — required string. Quote booleans, numbers, empty values, and
34
+ values containing YAML punctuation or `{{variables}}` so YAML does not
35
+ coerce them.
36
+ - `enabled` — boolean. The CLI writes `true` for a newly set variable.
37
+ - `type` — optional string. Use `default` for ordinary values and `secret`
38
+ for sensitive values.
39
+ - `description` — optional string.
40
+
41
+ Do not add collection-only fields such as `$kind`, `scripts`, `auth`, or
42
+ `variables`. Do not put secrets into an example merely to make it executable;
43
+ leave the value empty or use the team's supported secret source.
44
+
45
+ ## Linted example
46
+
47
+ ```yaml
48
+ name: Staging EU
49
+ values:
50
+ - key: baseUrl
51
+ value: 'https://staging.example.com'
52
+ enabled: true
53
+ type: default
54
+ description: API base URL
55
+ - key: apiToken
56
+ value: ''
57
+ enabled: false
58
+ type: secret
59
+ ```
60
+
61
+ After any hand edit, run `postman environment lint <file-or-directory>`. Use
62
+ `postman workspace lint` when the task is to validate the entire local
63
+ workspace, not just its environments.