Command line
Postguy has two programs:
| Program | What it is |
|---|---|
postguy | The desktop app. Two flags: --workspace and --control. |
postguy-cli | The headless tool. It runs automation tools and collections, and drives the app's control channel. |
See Installation to find where each one is installed.
postguy (desktop app)
postguy [--workspace DIR] [--control FILE]
| Flag | Meaning |
|---|---|
--workspace DIR | Open this workspace folder. It is created if missing. |
--control FILE | Start the opt-in UI control channel and write its port and token to FILE. |
- With no
--workspace, the app picks a folder in this order:./postguy-workspace, if that folder exists.~/postguy-workspace(%USERPROFILE%\postguy-workspaceon Windows).- The relative path
postguy-workspace, only when no home folder is known.
- The Flatpak build adds
--workspace "${XDG_DATA_HOME:-$HOME/.local/share}/postguy-workspace"unless you pass--workspaceyourself. - These are the only two flags. Other arguments are ignored. There is no
--helpor--version. - If the control channel cannot start, the app still runs. It prints
control channel disabled: ...to stderr and shows the same text in the status bar.
postguy-cli
postguy-cli has no --help and no --version. With no command, or an unknown command, it prints this usage to stderr and exits 2:
usage:
postguy-cli tools [--json]
postguy-cli call <tool> --json '<args>' [--root DIR]
postguy-cli run --script FILE [--root DIR]
postguy-cli run --collection ID_OR_NAME --workspace DIR [--folder F] [--environment E] [--iterations N] [--delay MS] [--data FILE] [--bail] [--requests ID,ID] [--reporters cli,json,junit,html,csv,xlsx,pdf] [--out DIR] [--root DIR]
postguy-cli fuzz-target <name> <seed-file> (dev tooling)
postguy-cli ui --control FILE inspect|command ID|set KEY=VALUE|screenshot --out FILE|click X Y|key NAME|type TEXT [--root DIR]
Run `postguy-cli tools` for the tool table; `ui` talks to an app launched with `--control FILE`.
--reporter instead of --reporters is not an error. To check that the binary works, run postguy-cli tools. The installer tests do the same.Exit codes
| Code | Meaning |
|---|---|
0 | Success. For run --collection: every request, script and test passed. |
1 | A failure: a tool returned an error, a script step failed, a test failed, or a report could not be written. |
2 | Usage problem: missing or conflicting arguments, invalid JSON, a number that is not a number, an unknown reporter, a name that matches nothing (or too much), an unreadable script, or a script outside --root. Every ui error also exits 2. |
--root DIR
--root DIR limits every path argument to one directory. The directory is created if it does not exist.
- Relative paths resolve against the root, not the current directory.
- Absolute paths are accepted only inside the root;
..is resolved before the check, and symlinks that point outside are refused. - A path outside the root is refused with
PATH is outside the allowed directory ROOT. The message is the same whether or not the path exists, so a confined caller cannot probe the disk. - It applies to the
--scriptfile itself,workspace_openpaths, imports, exports,--workspace,--dataand--out. - Without
--root, nothing is confined and relative paths resolve against the current directory. uiuses--rootonly for thescreenshot --outpath.
The workspace's config folder is always <workspace>/.postguy-config in a postguy-cli session.
tools
postguy-cli tools # one line per tool
postguy-cli tools --json # full schemas
Plain output is one line per tool: the name (padded to 20 columns), the safety (read-only, write or destructive) and the title. With --json it prints one JSON object, {"tools":[{"name","title","description","inputSchema","readOnly","destructive"}]}. Exit code is 0. The tools are described in Automation tools.
call
postguy-cli call <tool> --json '<args>' [--root DIR]
Runs one tool and prints its JSON result on stdout (exit 0).
| Case | Result |
|---|---|
The tool fails (unknown tool, bad argument, not found, outside --root, ...) | {"ok":false,"error":"..."} on stderr, exit 1. |
No tool name, --json is not valid JSON, or --root cannot be created | Message on stderr, exit 2. |
--json omitted | The arguments are {}. |
Each call starts a new process with no workspace open. On its own, only workspace_open (and tools that need no workspace) can succeed. For anything with more than one step, use run --script. See Automation tools.
postguy-cli call workspace_open --json '{"path":"work"}' --root /tmp/pg
run --script
postguy-cli run --script FILE [--root DIR]
Runs a JSON script of tool steps in one process and one session.
FILEis a JSON array of steps, or an object with astepsarray, at most 8 MiB. Each step is{"tool": "<name>", "args": {...}};argsis optional.- Steps run in order. The first step normally is
workspace_open. - Each successful step prints one stdout line
{"step":N,"tool":"...","ok":true,"result":{...}}. After the last step it prints{"ok":true,"steps":N}. - The first failing step prints
{"step":N,"tool":"...","ok":false,"error":"..."}on stderr, stops the run and exits 1. A step without atoolalso exits 1. - A script that is not readable, not JSON, not an array or
{"steps":[...]}, or outside--rootexits 2.
[
{"tool": "workspace_open", "args": {"path": "work"}},
{"tool": "collection_create", "args": {"name": "Smoke"}},
{"tool": "collection_list", "args": {}}
]
postguy-cli run --script steps.json --root .
run --collection
postguy-cli run --collection ID_OR_NAME --workspace DIR [options]
This opens the workspace, runs the collection with the collection runner, and prints or writes reports. --collection and --workspace are both required.
| Flag | Meaning |
|---|---|
--collection | Collection id, or a unique exact name. |
--workspace DIR | The workspace folder. Resolved inside --root when one is given. |
--folder F | Run only this folder (id or unique name). |
--environment E | Environment id or unique name. Default: the workspace's active environment. |
--iterations N | Number of iterations, a whole number. The collection_run tool accepts 1 to 10000. Default: one per data row, or 1. |
--delay MS | Pause between requests in milliseconds (at most 600000). |
--data FILE | A CSV (header row) or JSON array-of-objects data file. Resolved inside --root. |
--bail | A switch, no value: stop after the first request error, script failure or failed test. |
--requests ID,ID | Request ids to run, comma-separated, in that order. |
--reporters LIST | Comma-separated from cli, json, junit, html, csv, xlsx, pdf. Default cli. |
--out DIR | Directory for report files. Default .. |
--root DIR | Path confinement, as above. |
cliprints the text summary to stdout:Iteration i/n,✓ nameor✗ name: reasonlines, and a totals line.- Every other reporter writes
<out>/postguy-run-<run id>.<ext>and printswrote <path>. The extension is the reporter name, exceptjunit, which uses.xml. - The run is also stored in the workspace (newest 20 per collection). See Workspace format.
| Exit | When |
|---|---|
0 | Everything passed. |
1 | Any failed request, script or test; an error from the run itself; a report that could not be written; a --data path outside --root. |
2 | --collection or --workspace missing, --iterations or --delay not a whole number, an unknown reporter, or a collection, folder or environment name that matches nothing or more than one. |
Name errors list the candidates, for example:
no collection `X`; known: Smoke (col1)
`X` matches 2 collections; use an id: Smoke (col1), Smoke (col2)
postguy-cli run --collection "Smoke" --workspace ~/postguy-workspace \
--environment dev --reporters cli,junit --out reports
For a CI step, see Collection runner.
ui
postguy-cli ui --control FILE inspect
postguy-cli ui --control FILE command <id>
postguy-cli ui --control FILE set <key>=<value>
postguy-cli ui --control FILE screenshot --out FILE [--root DIR]
This talks to an app started with postguy --control FILE.
--control FILEis required.- On success it prints the response body and exits 0. Any error exits 2.
- On Unix the control file must be owner-only. Otherwise the client refuses to read the token.
click X Y,key NAMEandtype TEXTare accepted by the client but refused by the app.
The actions, keys and limits are in UI control channel.
fuzz-target
postguy-cli fuzz-target <name> <seed-file> is a development command used by cargo xtask fuzz. It is not for end users.
- The names are
url,vars,curl,script,data,openapiandhar. - Exit 0 means the code survived the input. Exit 2 means an error or bad usage.
mcp
postguy-cli mcp does not exist yet. It is planned as an opt-in stdio server over the same tool table. Today the command falls through to the usage text and exits 2. See Automation tools.Environment variables
| Variable | Read by | Meaning |
|---|---|---|
HOME, or USERPROFILE on Windows | postguy | Locates the default workspace ~/postguy-workspace. |
HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, NO_PROXY (and the lowercase forms) | Both programs | Proxy settings used when the proxy mode is System, the default. A custom proxy in the settings wins. Empty values are ignored. They are read once, when the HTTP client is created. See Cookies, proxy and certificates. |
Privacy and security
What Postguy sends over the network, where secrets are stored, what scripts can do, and how the opt-in control channel is protected.
Automation tools
The JSON tool table behind postguy-cli: call rules, the run --script step format, and all 71 tools with their arguments and safety flags.