@pubnio/cli 0.0.0-stage → 0.0.1
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.
- package/README.md +163 -2
- package/dist/index.js +272 -0
- package/dist/skills/pnio/SKILL.md +109 -0
- package/package.json +28 -4
package/README.md
CHANGED
|
@@ -1,3 +1,164 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @pubnio/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The PubNio command-line interface. The executable is named `pnio`.
|
|
4
|
+
|
|
5
|
+
## What it is
|
|
6
|
+
|
|
7
|
+
- Bun-native CLI built with Effect CLI.
|
|
8
|
+
- Talks to the PubNio HTTP API through `@pubnio/sdk`.
|
|
9
|
+
- Defaults to `https://pubnio.com`; set `PUBNIO_BASE_URL` for another origin.
|
|
10
|
+
- Uses a WorkOS device session by default, or `PUBNIO_API_KEY` for workspace
|
|
11
|
+
automation.
|
|
12
|
+
- Stores sessions per origin under
|
|
13
|
+
`${XDG_CONFIG_HOME:-$HOME/.config}/pubnio/<sha256(origin)>.json` with
|
|
14
|
+
directory mode `0700` and file mode `0600`.
|
|
15
|
+
|
|
16
|
+
## Build
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
bun run cli:build # dist/index.js, requires Bun at runtime
|
|
20
|
+
bun run cli:compile # dist/pnio, standalone binary for this platform
|
|
21
|
+
bun run cli:compile:all # all supported cross-compile targets
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The compiled binary embeds the Bun runtime and passes `--use-system-ca`, so it
|
|
25
|
+
trusts the system keychain and works with mkcert's local HTTPS certificate. The
|
|
26
|
+
JS bundle is small and requires Bun; the standalone binary is larger but needs
|
|
27
|
+
no runtime. On the current macOS arm64 build, the JS bundle is about 761 KB and
|
|
28
|
+
the standalone binary is about 132 MB.
|
|
29
|
+
|
|
30
|
+
Build outputs go to `apps/cli/dist`, which is ignored by Git.
|
|
31
|
+
|
|
32
|
+
## Install options
|
|
33
|
+
|
|
34
|
+
The package is not published yet. The available paths are:
|
|
35
|
+
|
|
36
|
+
1. **Bun package** — publish `@pubnio/cli` with `bin: { "pnio": "dist/index.js" }`.
|
|
37
|
+
Users run `bun add -g @pubnio/cli` or `bunx @pubnio/cli`. This requires Bun.
|
|
38
|
+
2. **Standalone binaries** — attach `pnio-darwin-arm64`,
|
|
39
|
+
`pnio-darwin-x64`, `pnio-linux-x64`, `pnio-linux-arm64`, and
|
|
40
|
+
`pnio-windows-x64.exe` to a GitHub Release. Add checksums and an install
|
|
41
|
+
script that selects the platform.
|
|
42
|
+
3. **Homebrew** — create `homebrew-tap` and a `pnio` formula that downloads the
|
|
43
|
+
matching release artifact and verifies its SHA-256.
|
|
44
|
+
4. **npm alias** — the unscoped `pnio` npm name was available when this was
|
|
45
|
+
written, but it is not reserved. `@pubnio/cli` with a `pnio` binary is the
|
|
46
|
+
safer package identity; an unscoped `pnio` wrapper can be added later.
|
|
47
|
+
|
|
48
|
+
## Before publishing
|
|
49
|
+
|
|
50
|
+
- Add a repository `LICENSE` and a `license` field. The repo does not have one
|
|
51
|
+
yet.
|
|
52
|
+
- Choose the release version and remove `"private": true`.
|
|
53
|
+
- Add `"publishConfig": { "access": "public" }` for the scoped package.
|
|
54
|
+
- Build the JS bundle before packing; `prepack` runs `bun run build`.
|
|
55
|
+
- The bundle is self-contained. For npm, use `bun publish`, which understands
|
|
56
|
+
workspace ranges, or replace `workspace:*` dependencies with fixed versions
|
|
57
|
+
before publishing; npm does not resolve `workspace:*`.
|
|
58
|
+
- Publish with `npm publish --access public` from `apps/cli`, or use
|
|
59
|
+
`bun publish`.
|
|
60
|
+
- Run a CI matrix to compile each target on its native runner where possible.
|
|
61
|
+
- Sign and notarize macOS binaries; sign Windows binaries. Unsigned downloads
|
|
62
|
+
trigger Gatekeeper and SmartScreen warnings.
|
|
63
|
+
- Publish SHA-256 checksums with every artifact.
|
|
64
|
+
- Keep the source-of-truth version in `package.json`; tag releases to match.
|
|
65
|
+
|
|
66
|
+
## Local development
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
bun run cli --help
|
|
70
|
+
PUBNIO_BASE_URL=https://localhost:3000 bun run cli auth login
|
|
71
|
+
PUBNIO_BASE_URL=https://localhost:3000 bun run cli posts list
|
|
72
|
+
|
|
73
|
+
# The standalone binary supports the same local HTTPS origin.
|
|
74
|
+
PUBNIO_BASE_URL=https://localhost:3000 pnio auth login
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
For API-key automation:
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
export PUBNIO_BASE_URL=https://pubnio.com
|
|
81
|
+
export PUBNIO_API_KEY=pubnio_sk_...
|
|
82
|
+
export PUBNIO_WORKSPACE_ID=<workspace-id>
|
|
83
|
+
pnio posts list
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Provider connections, API-key creation, and webhook management still require a
|
|
87
|
+
signed-in owner; API keys are workspace actors for reads, posts, drafts, media,
|
|
88
|
+
publishing, scheduling, retries, and reconciliation.
|
|
89
|
+
|
|
90
|
+
## Workspaces
|
|
91
|
+
|
|
92
|
+
Create a workspace with an optional default time zone, or update its name and
|
|
93
|
+
default on its own. An omitted `--default-timezone` starts at UTC. New queues
|
|
94
|
+
use the workspace default when `--timezone` is omitted; changing the default
|
|
95
|
+
never moves an existing queue.
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
pnio workspaces create --name "Studio" --default-timezone America/New_York
|
|
99
|
+
pnio workspaces update "$WORKSPACE_ID" --name "Studio"
|
|
100
|
+
pnio workspaces update "$WORKSPACE_ID" --default-timezone Asia/Tokyo
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Weekly queues
|
|
104
|
+
|
|
105
|
+
Create queues for a connected account, then inspect or skip occurrences. The
|
|
106
|
+
first active queue is always the default; `--default` promotes another queue
|
|
107
|
+
and `--no-default` demotes a non-default one. Omit `--timezone` to use the
|
|
108
|
+
workspace default:
|
|
109
|
+
|
|
110
|
+
```sh
|
|
111
|
+
pnio queues create --account "$ACCOUNT_ID" --name "Brand queue" \
|
|
112
|
+
--timezone America/New_York --slot 1:09:00 --slot 3:13:00
|
|
113
|
+
pnio queues create --account "$ACCOUNT_ID" --name "Stories queue" \
|
|
114
|
+
--timezone America/New_York --slot 2:12:00 --default
|
|
115
|
+
pnio queues update "$QUEUE_ID" --version 2 --default
|
|
116
|
+
pnio queues next-slot "$QUEUE_ID"
|
|
117
|
+
pnio queues skip "$QUEUE_ID" --slot-id "$SLOT_ID" --occurrence-date 2026-12-07
|
|
118
|
+
pnio queues blackout "$QUEUE_ID" --starts-on 2026-12-24 --ends-on 2026-12-26
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Use `pnio queues skips`, `unskip --skip-id`, `blackouts`, and
|
|
122
|
+
`unblackout --blackout-id` to manage the same records. A skip or blackout
|
|
123
|
+
stops future assignment; it does not cancel or move scheduled work.
|
|
124
|
+
|
|
125
|
+
Read the calendar with an inclusive ISO range of at most 90 days:
|
|
126
|
+
|
|
127
|
+
```sh
|
|
128
|
+
pnio schedule list --from 2026-12-01T00:00:00Z --to 2026-12-31T23:59:59Z
|
|
129
|
+
pnio schedule list --from 2026-12-01T00:00:00Z --to 2026-12-31T23:59:59Z \
|
|
130
|
+
--account-id "$ACCOUNT_ID" --queue-id "$QUEUE_ID"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Rows are current queued attempts, ascending by scheduled time. Queue-assigned
|
|
134
|
+
rows include the queue name, slot, assignment, occurrence date, and local date
|
|
135
|
+
and time. Like every CLI command, the output is JSON.
|
|
136
|
+
|
|
137
|
+
Move one queue-assigned target to the next free occurrence after its current
|
|
138
|
+
time. The queue and attempt come from the target unless overridden:
|
|
139
|
+
|
|
140
|
+
```sh
|
|
141
|
+
pnio schedule skip-to-next --post-id "$POST_ID" --target-id "$TARGET_ID"
|
|
142
|
+
pnio schedule skip-to-next --post-id "$POST_ID" --target-id "$TARGET_ID" \
|
|
143
|
+
--queue-id "$QUEUE_ID" --expected-attempt-id "$ATTEMPT_ID"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
The result is `{ "skipped": true, "result": ... }` after a reschedule, or
|
|
147
|
+
`{ "skipped": false, "horizonEndsAt": ... }` when no occurrence is free.
|
|
148
|
+
A target with no queue exits non-zero with `schedule_required` and
|
|
149
|
+
`param: "queueId"`; reschedule with `--at` instead.
|
|
150
|
+
|
|
151
|
+
## Webhooks
|
|
152
|
+
|
|
153
|
+
A signed-in workspace owner can inspect deliveries and replay a settled one:
|
|
154
|
+
|
|
155
|
+
```sh
|
|
156
|
+
pnio webhooks list-deliveries "$ENDPOINT_ID" --limit 20
|
|
157
|
+
pnio webhooks replay-delivery --workspace "$WORKSPACE_ID" \
|
|
158
|
+
--endpoint-id "$ENDPOINT_ID" --delivery-id "$DELIVERY_ID"
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Replay resets only a `delivered`, `failed`, or `cancelled` delivery to
|
|
162
|
+
`pending` with zero attempts and queues it for the dispatcher. A pending or
|
|
163
|
+
sending delivery exits non-zero with `webhook_delivery_not_replayable` and a
|
|
164
|
+
`nextAction`. Replay is unavailable to API keys.
|