@postonus/cli 0.1.0
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 +85 -0
- package/dist/index.js +11301 -0
- package/dist/index.js.map +1 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# postonus
|
|
2
|
+
|
|
3
|
+
Schedule and publish social posts from your terminal.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install -g postonus
|
|
7
|
+
postonus login
|
|
8
|
+
postonus post "shipping today" --to x,linkedin --optimal
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Commands
|
|
12
|
+
|
|
13
|
+
| Command | What it does |
|
|
14
|
+
| ------------------------------ | --------------------------------------------- |
|
|
15
|
+
| `login` / `logout` / `whoami` | Browser-approved sign in, and who you are |
|
|
16
|
+
| `channels list` | Connected channels and their health |
|
|
17
|
+
| `channels connect` | Connect a new channel over OAuth |
|
|
18
|
+
| `post <text>` | Schedule a post (never publishes immediately) |
|
|
19
|
+
| `queue list` | Upcoming scheduled posts |
|
|
20
|
+
| `queue move <scheduleId> --at` | Reschedule one queued post |
|
|
21
|
+
| `media upload <path…>` | Upload images or video for use in posts |
|
|
22
|
+
| `best-times --to <platforms>` | Recommended posting windows, computed locally |
|
|
23
|
+
|
|
24
|
+
`postonus <command> --help` for the flags on any of them.
|
|
25
|
+
|
|
26
|
+
## Scripting
|
|
27
|
+
|
|
28
|
+
Every command takes `--json`, which prints machine-readable JSON on stdout and
|
|
29
|
+
skips all interactive rendering:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
postonus queue list --json | jq -r '.queue[] | "\(.scheduledAt) \(.platform)"'
|
|
33
|
+
postonus post --file draft.md --to linkedin --at 2026-08-01T09:30:00Z --json
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Data goes to stdout, progress and errors to stderr, so pipes stay clean. Exit
|
|
37
|
+
codes are `0` success, `1` failure, `2` usage error. With no TTY the CLI never
|
|
38
|
+
prompts — pass the flags instead, and use `--no-input` to make a missing one an
|
|
39
|
+
error rather than a wait.
|
|
40
|
+
|
|
41
|
+
Content can also be piped: `cat draft.md | postonus post --to x --optimal`.
|
|
42
|
+
|
|
43
|
+
### CI
|
|
44
|
+
|
|
45
|
+
Set `POSTONUS_API_KEY` to an API key from the dashboard. It takes precedence over
|
|
46
|
+
a stored session, so no `login` step is needed:
|
|
47
|
+
|
|
48
|
+
```yaml
|
|
49
|
+
- run: npx postonus post "$MESSAGE" --to x --optimal
|
|
50
|
+
env:
|
|
51
|
+
POSTONUS_API_KEY: ${{ secrets.POSTONUS_API_KEY }}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Environment
|
|
55
|
+
|
|
56
|
+
| Variable | Purpose |
|
|
57
|
+
| ------------------ | ---------------------------------------------------- |
|
|
58
|
+
| `POSTONUS_API_KEY` | API key for non-interactive use; overrides `login` |
|
|
59
|
+
| `POSTONUS_API_URL` | Dashboard to talk to; defaults to production |
|
|
60
|
+
| `EDITOR`/`VISUAL` | Editor opened by `post --editor` |
|
|
61
|
+
| `NO_COLOR` | Disable coloured output |
|
|
62
|
+
| `XDG_CONFIG_HOME` | Where the session is stored; defaults to `~/.config` |
|
|
63
|
+
|
|
64
|
+
## Development
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pnpm --filter postonus build # bundle to dist/
|
|
68
|
+
pnpm --filter postonus dev # rebuild on change
|
|
69
|
+
pnpm --filter postonus test
|
|
70
|
+
POSTONUS_API_URL=http://localhost:5174 node dist/index.js whoami
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The CLI calls the public REST API at `/api/v1` through `@orpc/client`'s
|
|
74
|
+
`OpenAPILink`, typed from `@postonus/api-contract` — the same contract the
|
|
75
|
+
dashboard's own browser client uses (ADR-0006). End-to-end types cost nothing,
|
|
76
|
+
because they come from a shared package rather than a type import into another
|
|
77
|
+
app's internals.
|
|
78
|
+
|
|
79
|
+
There is no minimum-version gate. The contract is documented and versioned in its
|
|
80
|
+
mount prefix, so an old CLI gets a normal typed error from the operation it
|
|
81
|
+
actually calls. The CLI still sends `x-postonus-cli-version` on every request;
|
|
82
|
+
nothing reads it today.
|
|
83
|
+
|
|
84
|
+
`src/version.ts` must match `package.json` — a test enforces it, because that is
|
|
85
|
+
the version published to npm and reported in that header.
|