Skip to content

export requests

Terminal window
holocron export requests [--to <provider>] [--out <dir>] [--dry-run] [--yes]

A repo can keep a collection of requests and an environment as JSON files (apps/sentinel/api/webhook.collection.json and webhook.environment.json, named for the endpoint they exercise and kept beside it). Those files are the one source. A tool that reads another format cannot open them, so export requests asks each tooling provider to write its own format from them. Nothing is written back to the source and no account is touched.

For every tooling provider in holocron.config (or only --to <provider>), the command reads that provider’s collectionFiles and envFiles options (paths relative to the repo root) and calls the provider’s optional export with them and an output folder. A provider with no export (it reads the source files as they are) is a skipped row, and so is an entry with no collectionFiles.

providers: {
tooling: [
["bruno", { collectionFiles: ["api/webhook.collection.json"], envFiles: ["api/webhook.environment.json"] }],
],
},

Each provider writes under its own folder, <out>/<provider>. The default <out> is .export next to the collection files, so api/.export/bruno/, which the repo’s .gitignore leaves out (**/api/.export/). Collection files in different folders are exported separately, each into the .export beside its own folder (apps/sentinel/api/.export/bruno/ and apps/comlink/src/.export/bruno/), and the run prints one row per folder. Collection files in the same folder go out together. Each folder’s collections get the envFiles that sit in that same folder (webhook.environment.json, webhook.environment.dev.json, …), so Sentinel’s collection carries Sentinel’s environments and not Comlink’s; if none sits beside a collection, it gets all of them. --out <dir> puts the provider folders under <dir> instead (absolute, or relative to the repo root), with every collection in one folder. The run ends with a Wrote: list (Would write: on --dry-run) of the full path of every file, so you can open them straight from the terminal.

  • It never writes where the source files are. A folder that is, or contains, the folder of a collection or environment file is refused, so an export can never overwrite the source. A folder below the source folder, like the default, is fine.
  • It asks first. --dry-run converts the files and lists what would be written, without writing anything, and without asking. --yes skips the question; without a terminal and without either flag the command refuses.
  • A conversion issue is reported, not fatal. What a format cannot carry across is listed under the provider’s row. The run still exits 0 when every provider wrote its files; a provider that fails (unreadable file, a tool that is missing) fails the run.
  • It needs the plugins. It is a workspace command: the tooling providers’ packages must resolve, as for every command that calls a provider. No provider token is needed to export.