@chaouidz/postpilot 1.1.1 → 1.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 +56 -103
- package/bin/postpilot.mjs +309 -292
- package/package.json +27 -27
- package/src/bootstrap.mjs +53 -0
- package/src/client.mjs +168 -168
- package/src/plan.mjs +333 -331
package/README.md
CHANGED
|
@@ -1,103 +1,56 @@
|
|
|
1
|
-
# PostPilot CLI
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
## Schedule a plan with one approval
|
|
59
|
-
|
|
60
|
-
```json
|
|
61
|
-
[
|
|
62
|
-
{
|
|
63
|
-
"video": "videos/first.mp4",
|
|
64
|
-
"title": "First video",
|
|
65
|
-
"description": "My description",
|
|
66
|
-
"tags": ["tutorial", "workflow"],
|
|
67
|
-
"scheduledAt": "2027-02-01T09:00:00+01:00",
|
|
68
|
-
"account": "My Tutorials"
|
|
69
|
-
}
|
|
70
|
-
]
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Paths are relative to the JSON file. Use an array or `{ "posts": [...] }`, with 1-100 items. Each account must be an exact ID or uniquely named account visible to your token. `--account` supplies a fallback for items without an account.
|
|
74
|
-
|
|
75
|
-
```sh
|
|
76
|
-
postpilot schedule --file plan.json
|
|
77
|
-
# Default is read-only. Review the preview, then explicitly prepare the plan:
|
|
78
|
-
postpilot schedule --file plan.json --yes
|
|
79
|
-
# Open the single returned approvalUrl and review every video/account/time.
|
|
80
|
-
postpilot status --approval APPROVAL_ID --json
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
`--yes` prepares uploads and drafts; the batch still needs human approval. It never proves approval or bypasses it. `--yes --dry-run` is rejected. Existing single-post scheduling commands retain their behavior for compatibility.
|
|
84
|
-
|
|
85
|
-
The CLI validates every file and the server calendar-day cap before any upload. Default capacity is 10 posts per account per local calendar day, configurable by plan. A rejected plan identifies the account/day and item numbers to move. Existing billing entitlements and provider quotas still apply. Twenty posts over ten days fit the default daily cap on an eligible plan.
|
|
86
|
-
|
|
87
|
-
MP4 files are limited to 90 MiB each; use `prepare-video` first for other formats. Only HTTP 429 uploads retry, at most five retries, honoring seconds or HTTP-date Retry-After. A wait over five minutes stops with an actionable error. Ambiguous network failures never retry automatically.
|
|
88
|
-
|
|
89
|
-
Stable per-item keys and a `.postpilot-*.json` checkpoint beside the plan allow interrupted runs to resume without uploading or creating drafts again. Checkpoints contain hashes, post IDs and an approval link, never credentials or file contents. Do not edit them. Reusing an explicit `--idempotency-key` for changed content is rejected. Inspect expired/failed/partly failed batch results and prepare only intended retries with a new plan key.
|
|
90
|
-
|
|
91
|
-
YouTube defaults to private visibility; optional `privacy` selects `private`, `unlisted` or `public`. Tags become YouTube keywords and are appended as hashtags to other platform captions. TikTok items must include explicit `tiktokSettings` with `privacy`, `allowComments`, `allowDuet` and `allowStitch`; creator policy is rechecked during approval. Pinterest requires the target board in `pinterestSettings.boardIds`. Existing platform settings can be supplied through `facebookSettings`, `instagramPostType` and `instagramCaption`.
|
|
92
|
-
|
|
93
|
-
## Exit codes
|
|
94
|
-
|
|
95
|
-
0 success, 2 invalid usage/input, 3 authentication or scope failure, 4 not found, 5 pending browser approval, 6 rate limited, 7 provider/network/server failure, 8 capacity exceeded. JSON errors include stable `code`, `message`, and available request/retry details. Honor Retry-After; provider quotas are not unlimited or guaranteed.
|
|
96
|
-
|
|
97
|
-
## Tests
|
|
98
|
-
|
|
99
|
-
`npm test` uses a local mock server, fake account IDs and fixture media. Native keychain integration is opt-in with `POSTPILOT_TEST_NATIVE_KEYCHAIN=true`; it creates and removes only a unique fixture credential. No live publishing or real social-account calls occur.
|
|
100
|
-
|
|
101
|
-
## Resume an interrupted batch
|
|
102
|
-
|
|
103
|
-
Run the same `postpilot schedule --file plan.json --yes` command with unchanged files and arguments. The credential-free checkpoint retains completed draft IDs; stable upload, draft and batch idempotency keys recover a server commit whose response was lost. Inspect expired or partly failed approvals before intentionally preparing new work. Never remove a checkpoint or change keys merely to retry an ambiguous operation.
|
|
1
|
+
# PostPilot CLI 1.1.2
|
|
2
|
+
|
|
3
|
+
Node.js 20+ on Windows, macOS and Linux. Install `npm install -g @chaouidz/postpilot@1.1.2` or the matching versioned archive at https://postpilot.yktis.com/downloads/chaouidz-postpilot-1.1.2.tgz. Existing versioned downloads remain available.
|
|
4
|
+
|
|
5
|
+
## Authenticate
|
|
6
|
+
|
|
7
|
+
Use `postpilot login` for a hidden token prompt, `postpilot login --token-stdin --non-interactive --json` for piped tokens, or set POSTPILOT_TOKEN from a protected runtime secret store. The OS keychain stores tokens with no plaintext fallback.
|
|
8
|
+
|
|
9
|
+
Browserless setup for an existing email/password account: pipe protected JSON into `postpilot login --credentials-stdin --non-interactive --json`. Required JSON fields: email and password. Optional: tokenName, scopes (default social:read and social:write), allowedAccountIds, expiresInDays (7, 30, 90 or null), requireHumanApproval (default false). It uses the existing CSRF-protected session/token APIs. No password is saved. OAuth-only login and initial provider consent can require provider interaction. Users do not need an npm account.
|
|
10
|
+
|
|
11
|
+
## Schedule one Short to one named channel
|
|
12
|
+
|
|
13
|
+
The runnable https://postpilot.yktis.com/downloads/agent-short.mjs parses resource IDs automatically. Set POSTPILOT_TOKEN, POSTPILOT_FILE, POSTPILOT_CHANNEL, POSTPILOT_SCHEDULED_AT (future ISO-8601 offset) and POSTPILOT_OPERATION_KEY in your runtime. Run `node agent-short.mjs cli` or `node agent-short.mjs mcp`. It resolves one exact channel, uploads MP4, creates a private Short draft, validates, schedules and polls status. No browser action or manual copy-paste occurs in that flow.
|
|
14
|
+
|
|
15
|
+
## Schedule a plan
|
|
16
|
+
|
|
17
|
+
A plan is an array or {"posts": [...]} of 1-100 items with video, title, description, tags, scheduledAt and account. Paths are relative to the plan file; account is an exact ID or unique name. --account supplies a fallback.
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
postpilot help --json
|
|
21
|
+
postpilot whoami --json
|
|
22
|
+
postpilot accounts list --json
|
|
23
|
+
postpilot schedule --file plan.json --json
|
|
24
|
+
postpilot schedule --file plan.json --yes --json
|
|
25
|
+
postpilot status --post POST_ID --json
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Batch files default to read-only preview. --yes uploads, creates drafts and schedules automatically. --yes --dry-run is invalid. Human review is optional per-token requireHumanApproval, default OFF. Existing tokens and legacy tool names remain valid. Opt-in review returns PENDING_APPROVAL; schedule review expires in 24 hours, publish-now review in 15 minutes. Successful posts retain their scheduled time. Scheduled/queued does not mean published.
|
|
29
|
+
|
|
30
|
+
Default capacity is 10 posts/account/calendar day, configurable by plan. Account metadata timezone falls back to owner timezone. Billing entitlements and provider quotas remain enforced. CAPACITY_EXCEEDED is not retryable unchanged and has no retryAfter. Move the identified items to another account day. RATE_LIMITED is genuine throttling with Retry-After.
|
|
31
|
+
|
|
32
|
+
Uploads accept PNG up to 20 MiB or MP4 up to 90 MiB. Only HTTP 429 uploads retry, up to five times, honoring Retry-After; waits above five minutes stop. Stable per-item keys and credential-free .postpilot-*.json checkpoints resume interrupted runs without duplicate uploads, drafts or schedules. Do not change keys merely to retry an ambiguous result. Inspect failed/EXECUTING results; retry failed destinations only. Existing CLI 1.1.1 remains compatible with automatic batch responses through the legacy approvalId/approvalUrl fields (the URL is a status read, not a manual approval action).
|
|
33
|
+
|
|
34
|
+
YouTube privacy defaults to private. TikTok needs explicit privacy, allowComments, allowDuet and allowStitch in tiktokSettings. Pinterest needs pinterestSettings.boardIds. Media rules and provider consent are rechecked at execution.
|
|
35
|
+
|
|
36
|
+
## Commands and exit codes
|
|
37
|
+
|
|
38
|
+
Every command supports --json and --non-interactive. Non-TTY stdin never triggers a prompt.
|
|
39
|
+
|
|
40
|
+
- login [--token-stdin | --credentials-stdin], whoami, logout
|
|
41
|
+
- accounts list; assets list [--limit 1-100] [--cursor CURSOR]
|
|
42
|
+
- upload FILE; prepare-video FILE --output FILE (offline, ffmpeg required)
|
|
43
|
+
- draft create --account ID_OR_NAME --asset ID --title TITLE --privacy private
|
|
44
|
+
- schedule --post ID --account ID_OR_NAME --at ISO_OFFSET [--dry-run]
|
|
45
|
+
- publish --post ID --account ID_OR_NAME [--dry-run]
|
|
46
|
+
- status --post ID; status --approval ID; cancel --post ID
|
|
47
|
+
|
|
48
|
+
Exit codes: 0 success, 2 invalid input, 3 auth/scope, 4 not found, 5 optional pending approval, 6 rate limit, 7 provider/network/server, 8 capacity exceeded. --idempotency-key is stable across identical retries. --timezone returns the requested IANA zone; timestamp offsets determine the instant. JSON errors keep code/message and available retry/request details.
|
|
49
|
+
|
|
50
|
+
MCP analytics tools are available; this public CLI has no dedicated TikTok statistics command. Python, Rust and PHP can invoke it or use HTTPS directly. Internal repository scripts are separate interfaces.
|
|
51
|
+
|
|
52
|
+
Full public reference: https://postpilot.yktis.com/cli.md
|
|
53
|
+
Tool names, scopes and per-tool limits: https://postpilot.yktis.com/mcp-tools.json
|
|
54
|
+
Plans: https://postpilot.yktis.com/pricing.json
|
|
55
|
+
|
|
56
|
+
`npm test` uses fixtures and mock servers. Native keychain tests are opt-in with POSTPILOT_TEST_NATIVE_KEYCHAIN=true and clean up their unique fixture credential. No real social account is published, scheduled or deleted.
|