@chaouidz/postpilot 1.0.0 → 1.1.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 CHANGED
@@ -1,52 +1,103 @@
1
- # PostPilot CLI
2
-
3
- Thin Node.js 20+ client for the same approval-based API used by MCP. No bundled server or provider credentials. Public docs: https://postpilot.yktis.com/docs.
4
-
5
- Install from npm: `npm install -g @chaouidz/postpilot@1.0.0`, then run `postpilot help`.
6
- Without a global install: `npx @chaouidz/postpilot@1.0.0 help`.
7
- Package: https://www.npmjs.com/package/@chaouidz/postpilot.
8
- The original versioned download remains available: `npm install -g https://postpilot.yktis.com/downloads/postpilot-1.0.0.tgz`.
9
- For source review: run `npm pack` in `packages/cli`, then `npm install -g ./chaouidz-postpilot-1.0.0.tgz`. Packing does not publish to npm.
10
-
11
- Python, PHP and other languages can call the HTTP API directly or invoke this CLI as a subprocess. npm distributes the Node.js CLI; it does not require your application to use JavaScript. There is no separate pip or Composer package.
12
-
13
- ## Login and secrets
14
-
15
- Create a token in PostPilot Settings with `social:read`, `social:write`, an expiry and only the channel you intend to use. Keep trusted automation disabled for human approval.
16
-
17
- Run `postpilot login` and paste the token at the hidden prompt. Windows uses Credential Manager; macOS uses Keychain via `security`; Linux uses Secret Service via `secret-tool` (install your distribution's libsecret tools and unlock a desktop keychain). A missing/locked keychain fails explicitly. There is no plaintext-file fallback. Piped login requires `--token-stdin` and still stores in the OS keychain.
18
-
19
- CI/cron: configure `POSTPILOT_TOKEN` through the runtime's secret store and use `--non-interactive --json`. Do not put it in a shell history, command argument, checked-in config or prompt. `POSTPILOT_URL` or `--url` selects an API origin; remote connections require HTTPS. Redirects are not followed with credentials.
20
-
21
- `logout` removes only the local keychain entry. Revoke the token in PostPilot Settings to invalidate all copies; already scheduled posts must be cancelled separately.
22
-
23
- ## Schedule a Short to ONE named channel
24
-
25
- ```sh
26
- postpilot login
27
- postpilot whoami --json
28
- postpilot accounts list --json
29
- postpilot upload short.mp4 --idempotency-key my-short-import-001 --json
30
- # Copy the returned uploadSessionId as UPLOAD_ID below.
31
- postpilot draft create --account "My Tutorials" --asset UPLOAD_ID --title "My Short" --privacy private --idempotency-key my-short-draft-001 --json
32
- # Copy the returned id as DRAFT_ID. Pick a FUTURE ISO timestamp with an offset.
33
- postpilot schedule --post DRAFT_ID --account "My Tutorials" --at "2027-01-10T09:00:00+01:00" --timezone Europe/Zurich --dry-run --json
34
- postpilot schedule --post DRAFT_ID --account "My Tutorials" --at "2027-01-10T09:00:00+01:00" --timezone Europe/Zurich --idempotency-key my-short-schedule-001 --json
35
- # Exit code 5 means PENDING_APPROVAL. Open the returned approvalUrl while signed in.
36
- # Review the exact single account, private visibility and time, then approve.
37
- postpilot status --post DRAFT_ID --json
38
- ```
39
-
40
- Exact IDs are preferred. Names must uniquely match one visible channel; an ambiguous name fails. No platform-wide broadcast fallback. A scheduled/queued result does not mean published. Dry-run validates local inputs; dynamic provider capacity and plan allowances are not reserved. Publication is queued only after browser approval, unless this token explicitly enables trusted automation.
41
-
42
- Other commands: `assets list [--limit 1-100] [--cursor CURSOR]`, `publish --post ID --account ID [--dry-run]`, `cancel --post ID`, `prepare-video input.mov --output compatible.mp4` (offline, requires ffmpeg, never overwrites an existing file). Set privacy on the draft before scheduling; the approval payload and stored draft determine publication privacy. Image/raw uploads accept PNG up to 20 MiB and MP4 up to 90 MiB. Preparation may produce larger files, which the raw upload API will reject.
43
-
44
- All commands accept `--json` and `--non-interactive`. `--account`, `--at`, `--privacy` and `--dry-run` apply where relevant; help lists the full syntax. Keep an idempotency key identical on retries of one operation. Inspect failed/ambiguous delivery before attempting a new publication.
45
-
46
- ## Exit codes
47
-
48
- 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. JSON errors include stable `code`, `message`, and available request/retry details. Honor Retry-After; provider quotas are not unlimited or guaranteed.
49
-
50
- ## Tests
51
-
52
- `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.
1
+ # PostPilot CLI
2
+
3
+ Thin Node.js 20+ client for the same approval-based API used by MCP. No bundled server or provider credentials. Public docs: https://postpilot.yktis.com/docs.
4
+
5
+ Install this patch: `npm install -g https://postpilot.yktis.com/downloads/chaouidz-postpilot-1.1.1.tgz`, then run `postpilot help`.
6
+ Without a global install: `npx --package=https://postpilot.yktis.com/downloads/chaouidz-postpilot-1.1.1.tgz postpilot help`.
7
+ Registry package: https://www.npmjs.com/package/@chaouidz/postpilot. npm currently has 1.1.0; publishing 1.1.1 still requires a completed npm browser-authentication session. The versioned archive above contains the tested 1.1.1 patch.
8
+ The original versioned download remains available: `npm install -g https://postpilot.yktis.com/downloads/postpilot-1.0.0.tgz`.
9
+ For source review: run `npm pack` in `packages/cli`, then `npm install -g ./chaouidz-postpilot-1.1.1.tgz`. Packing does not publish to npm.
10
+
11
+ Python, PHP and other languages can call the HTTP API directly or invoke this CLI as a subprocess. npm distributes the Node.js CLI; it does not require your application to use JavaScript. There is no separate pip or Composer package.
12
+
13
+ ## Runtime requirement
14
+
15
+ Node.js 20 or newer is required on Windows, macOS and Linux. Install the current Node.js LTS from https://nodejs.org/en/download, reopen your terminal, then check `node --version`.
16
+
17
+ ## Capacity and retry errors
18
+
19
+ `CAPACITY_EXCEEDED` exits with code 8, is not retryable unchanged and has no retryAfter. It names the account, calendar day, cap, excess items and timezone. Move the named items to another account day. Only genuine throttling uses RATE_LIMITED (exit 6) and Retry-After.
20
+
21
+ The server counts days in the account metadata timezone, falling back to the owner profile timezone. It does not group by UTC or by the machine timezone. An ISO timestamp's numeric offset determines the instant, not the account's quota boundary. Plan timezone overrides do not change account/day capacity.
22
+
23
+ During rolling upgrades, the CLI recognizes an old RATE_LIMITED response only when it explicitly identifies ACCOUNT_CALENDAR_DAY capacity. Existing single-post commands and MCP tool names remain supported.
24
+
25
+ ## Login and secrets
26
+
27
+ Create a token in PostPilot Settings with `social:read`, `social:write`, an expiry and only the channel you intend to use. Keep trusted automation disabled for human approval.
28
+
29
+ Run `postpilot login` and paste the token at the hidden prompt. Windows uses Credential Manager; macOS uses Keychain via `security`; Linux uses Secret Service via `secret-tool` (install your distribution's libsecret tools and unlock a desktop keychain). A missing/locked keychain fails explicitly. There is no plaintext-file fallback. Piped login requires `--token-stdin` and still stores in the OS keychain.
30
+
31
+ CI/cron: configure `POSTPILOT_TOKEN` through the runtime's secret store and use `--non-interactive --json`. Do not put it in a shell history, command argument, checked-in config or prompt. `POSTPILOT_URL` or `--url` selects an API origin; remote connections require HTTPS. Redirects are not followed with credentials.
32
+
33
+ `logout` removes only the local keychain entry. Revoke the token in PostPilot Settings to invalidate all copies; already scheduled posts must be cancelled separately.
34
+
35
+ ## Schedule a Short to ONE named channel
36
+
37
+ ```sh
38
+ postpilot login
39
+ postpilot whoami --json
40
+ postpilot accounts list --json
41
+ postpilot upload short.mp4 --idempotency-key my-short-import-001 --json
42
+ # Copy the returned uploadSessionId as UPLOAD_ID below.
43
+ postpilot draft create --account "My Tutorials" --asset UPLOAD_ID --title "My Short" --privacy private --idempotency-key my-short-draft-001 --json
44
+ # Copy the returned id as DRAFT_ID. Pick a FUTURE ISO timestamp with an offset.
45
+ postpilot schedule --post DRAFT_ID --account "My Tutorials" --at "2027-01-10T09:00:00+01:00" --timezone Europe/Zurich --dry-run --json
46
+ postpilot schedule --post DRAFT_ID --account "My Tutorials" --at "2027-01-10T09:00:00+01:00" --timezone Europe/Zurich --idempotency-key my-short-schedule-001 --json
47
+ # Exit code 5 means PENDING_APPROVAL. Open the returned approvalUrl while signed in.
48
+ # Review the exact single account, private visibility and time, then approve.
49
+ postpilot status --post DRAFT_ID --json
50
+ ```
51
+
52
+ Exact IDs are preferred. Names must uniquely match one visible channel; an ambiguous name fails. No platform-wide broadcast fallback. A scheduled/queued result does not mean published. Dry-run validates local inputs; dynamic provider capacity and plan allowances are not reserved. Publication is queued only after browser approval, unless this token explicitly enables trusted automation.
53
+
54
+ Other commands: `assets list [--limit 1-100] [--cursor CURSOR]`, `publish --post ID --account ID [--dry-run]`, `cancel --post ID`, `prepare-video input.mov --output compatible.mp4` (offline, requires ffmpeg, never overwrites an existing file). Set privacy on the draft before scheduling; the approval payload and stored draft determine publication privacy. Image/raw uploads accept PNG up to 20 MiB and MP4 up to 90 MiB. Preparation may produce larger files, which the raw upload API will reject.
55
+
56
+ All commands accept `--json` and `--non-interactive`. `--account`, `--at`, `--privacy` and `--dry-run` apply where relevant; help lists the full syntax. Keep an idempotency key identical on retries of one operation. Inspect failed/ambiguous delivery before attempting a new publication.
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.