@postonus/cli 0.1.0 → 0.1.2
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 +26 -26
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +30 -27
package/README.md
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
# postonus
|
|
1
|
+
# @postonus/cli
|
|
2
2
|
|
|
3
3
|
Schedule and publish social posts from your terminal.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npm install -g postonus
|
|
6
|
+
npm install -g @postonus/cli
|
|
7
7
|
postonus login
|
|
8
8
|
postonus post "shipping today" --to x,linkedin --optimal
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
Requires Node.js 22.12 or newer. Needs a [Postonus](https://postonus.com) account.
|
|
12
|
+
|
|
13
|
+
Run without installing: `npx @postonus/cli whoami`
|
|
14
|
+
|
|
11
15
|
## Commands
|
|
12
16
|
|
|
13
17
|
| Command | What it does |
|
|
@@ -19,10 +23,24 @@ postonus post "shipping today" --to x,linkedin --optimal
|
|
|
19
23
|
| `queue list` | Upcoming scheduled posts |
|
|
20
24
|
| `queue move <scheduleId> --at` | Reschedule one queued post |
|
|
21
25
|
| `media upload <path…>` | Upload images or video for use in posts |
|
|
22
|
-
| `best-times --to <platforms>` | Recommended posting windows
|
|
26
|
+
| `best-times --to <platforms>` | Recommended posting windows |
|
|
23
27
|
|
|
24
28
|
`postonus <command> --help` for the flags on any of them.
|
|
25
29
|
|
|
30
|
+
### Scheduling a post
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
postonus post "shipping today" --to x,linkedin --optimal
|
|
34
|
+
postonus post --file draft.md --to linkedin --at 2026-08-01T09:30:00Z
|
|
35
|
+
postonus post --editor --to x --draft
|
|
36
|
+
postonus post "with a video" --to x --media ./demo.mp4 --optimal
|
|
37
|
+
cat draft.md | postonus post --to x --optimal
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`post` always schedules; it never publishes on the spot. Pick a time with
|
|
41
|
+
`--at <ISO timestamp>` or `--optimal` for the next recommended window, or use
|
|
42
|
+
`--draft` to save without a time. `--dry-run` shows what would happen and stops.
|
|
43
|
+
|
|
26
44
|
## Scripting
|
|
27
45
|
|
|
28
46
|
Every command takes `--json`, which prints machine-readable JSON on stdout and
|
|
@@ -38,15 +56,13 @@ codes are `0` success, `1` failure, `2` usage error. With no TTY the CLI never
|
|
|
38
56
|
prompts — pass the flags instead, and use `--no-input` to make a missing one an
|
|
39
57
|
error rather than a wait.
|
|
40
58
|
|
|
41
|
-
Content can also be piped: `cat draft.md | postonus post --to x --optimal`.
|
|
42
|
-
|
|
43
59
|
### CI
|
|
44
60
|
|
|
45
61
|
Set `POSTONUS_API_KEY` to an API key from the dashboard. It takes precedence over
|
|
46
62
|
a stored session, so no `login` step is needed:
|
|
47
63
|
|
|
48
64
|
```yaml
|
|
49
|
-
- run: npx postonus post "$MESSAGE" --to x --optimal
|
|
65
|
+
- run: npx @postonus/cli post "$MESSAGE" --to x --optimal
|
|
50
66
|
env:
|
|
51
67
|
POSTONUS_API_KEY: ${{ secrets.POSTONUS_API_KEY }}
|
|
52
68
|
```
|
|
@@ -61,25 +77,9 @@ a stored session, so no `login` step is needed:
|
|
|
61
77
|
| `NO_COLOR` | Disable coloured output |
|
|
62
78
|
| `XDG_CONFIG_HOME` | Where the session is stored; defaults to `~/.config` |
|
|
63
79
|
|
|
64
|
-
|
|
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.
|
|
80
|
+
`postonus logout` removes the stored credentials.
|
|
78
81
|
|
|
79
|
-
|
|
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.
|
|
82
|
+
## Links
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
- [postonus.com](https://postonus.com)
|
|
85
|
+
- [Report an issue](https://github.com/udayvunnam/experiments/issues)
|
package/dist/index.js
CHANGED
|
@@ -10360,7 +10360,7 @@ function formatTable(headers, rows) {
|
|
|
10360
10360
|
}
|
|
10361
10361
|
|
|
10362
10362
|
// src/version.ts
|
|
10363
|
-
var CLI_VERSION = "0.1.
|
|
10363
|
+
var CLI_VERSION = "0.1.1";
|
|
10364
10364
|
|
|
10365
10365
|
// src/client.ts
|
|
10366
10366
|
var DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
|
|
@@ -10460,7 +10460,7 @@ async function getApi() {
|
|
|
10460
10460
|
function describeError(error2) {
|
|
10461
10461
|
if (error2 instanceof ORPCError3) {
|
|
10462
10462
|
if (error2.code === "UNAUTHORIZED") {
|
|
10463
|
-
return "
|
|
10463
|
+
return error2.message || "Sign-in expired or not valid. Run `postonus login` again.";
|
|
10464
10464
|
}
|
|
10465
10465
|
if (error2.code === "RATE_LIMITED") {
|
|
10466
10466
|
return `Rate limit reached. ${error2.message}`;
|