@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 CHANGED
@@ -1,103 +1,56 @@
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.
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.