@posthubify/cli
v0.1.1
Published
PostHubify command-line tool — commands generated from the /v1 spec, JSON output (script/AI-agent friendly).
Downloads
282
Readme
PostHubify CLI
Use the PostHubify /v1 API from your terminal — commands are generated from the live OpenAPI spec,
and output is JSON (script- and AI-agent-friendly).
- Zero extra dependencies (only the spec→command + dispatch logic shared with
@posthubify/mcp). - 190+ operations → 190+ commands (operationId = command name).
- Correct exit codes: error →
1, success →0(CI/script integration).
Installation
npm install -g @posthubify/cliConfiguration
| Environment variable | Description |
|---|---|
| POSTHUBIFY_API_KEY | sk_… API key (or --api-key) |
| POSTHUBIFY_BASE_URL | Defaults to http://localhost:8787/v1 (or --base-url) |
Usage
# List all commands (operationId + description)
posthubify list
posthubify list --tag posts # only a single tag
# View a command's parameters
posthubify postPosts --help
# Run a command (output is JSON)
export POSTHUBIFY_API_KEY=sk_...
posthubify getProfiles
posthubify postPosts --content "Hello world" --accountIds '["acc_1"]'
posthubify getAdsAccountsByIdCampaigns --id acc_1 --status enabled --pretty
# Script usage (with jq)
posthubify getProfiles | jq '.data[].name'Parameters
--key value/--key=value/--flag(boolean).- Values are parsed as JSON:
--limit 5→ number,--accountIds '["a","b"]'→ array, anything that can't be parsed → plain text. - Use
--prettyfor formatted JSON; the default is single-line (pipeline-friendly).
How it works
On startup, BASE_URL/openapi.json is fetched; each operation becomes a command named after its
operationId. Command arguments are split into path/query/body according to the operation's schema
and forwarded to the /v1 endpoint with Bearer authentication. (Same @posthubify/mcp engine as
the MCP server.)
License
MIT
