postiz 2.0.3 → 2.0.5

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,254 +1,461 @@
1
1
  # Postiz CLI
2
2
 
3
- > Command-line interface for the Postiz social media scheduling platform
3
+ **Social media automation CLI for AI agents** - Schedule posts across 28+ platforms programmatically.
4
4
 
5
- ## Overview
5
+ The Postiz CLI provides a command-line interface to the Postiz API, enabling developers and AI agents to automate social media posting, manage content, and handle media uploads across platforms like Twitter/X, LinkedIn, Reddit, YouTube, TikTok, Instagram, Facebook, and more.
6
6
 
7
- The Postiz CLI allows you to interact with the Postiz API from the command line, making it easy for developers and AI agents to automate social media scheduling, manage posts, and upload media.
7
+ ---
8
8
 
9
- ## Quick Start
9
+ ## Installation
10
10
 
11
- ### Installation
11
+ ### From npm (Recommended)
12
12
 
13
13
  ```bash
14
- # Install dependencies
15
- pnpm install
14
+ npm install -g postiz
15
+ # or
16
+ pnpm install -g postiz
17
+ ```
18
+
19
+ ### From Source
16
20
 
17
- # Build the CLI
21
+ ```bash
22
+ git clone https://github.com/gitroomhq/postiz-app.git
23
+ cd postiz-app/apps/cli
24
+ pnpm install
18
25
  pnpm run build
26
+ pnpm link --global
27
+ ```
19
28
 
20
- # Run locally (development)
21
- pnpm run start -- [command]
29
+ ### For Development
22
30
 
23
- # Or link globally
31
+ ```bash
32
+ cd apps/cli
33
+ pnpm install
34
+ pnpm run build
24
35
  pnpm link --global
36
+
37
+ # Or run directly without linking
38
+ pnpm run start -- posts:list
25
39
  ```
26
40
 
27
- ### Setup
41
+ ---
28
42
 
29
- Before using the CLI, you need to set your Postiz API key:
43
+ ## Setup
44
+
45
+ **Required:** Set your Postiz API key
30
46
 
31
47
  ```bash
32
48
  export POSTIZ_API_KEY=your_api_key_here
33
49
  ```
34
50
 
35
- Optionally, you can set a custom API URL:
51
+ **Optional:** Custom API endpoint
36
52
 
37
53
  ```bash
38
54
  export POSTIZ_API_URL=https://your-custom-api.com
39
55
  ```
40
56
 
41
- ## Usage
57
+ ---
58
+
59
+ ## Commands
60
+
61
+ ### Discovery & Settings
42
62
 
63
+ **List all connected integrations**
43
64
  ```bash
44
- postiz <command> [options]
65
+ postiz integrations:list
45
66
  ```
46
67
 
47
- ### Commands
68
+ Returns integration IDs, provider names, and metadata.
48
69
 
49
- #### Create a Post
70
+ **Get integration settings schema**
71
+ ```bash
72
+ postiz integrations:settings <integration-id>
73
+ ```
50
74
 
75
+ Returns character limits, required settings, and available tools for fetching dynamic data.
76
+
77
+ **Trigger integration tools**
51
78
  ```bash
52
- postiz posts:create -c "Your content here" -i "integration-id-1,integration-id-2"
79
+ postiz integrations:trigger <integration-id> <method-name>
80
+ postiz integrations:trigger <integration-id> <method-name> -d '{"key":"value"}'
53
81
  ```
54
82
 
55
- **Options:**
56
- - `-c, --content <text>` - Post/comment content (can be used multiple times)
57
- - `-m, --media <urls>` - Comma-separated media URLs for the corresponding `-c` (can be used multiple times)
58
- - `-i, --integrations <ids>` - Comma-separated integration IDs (required)
59
- - `-s, --schedule <date>` - Schedule date (ISO 8601)
60
- - `-d, --delay <ms>` - Delay between comments in milliseconds (default: 5000)
61
- - `-p, --provider-type <type>` - Provider type for platform-specific settings (e.g., reddit, youtube, x, tiktok)
62
- - `--settings <json>` - Provider-specific settings as JSON string
83
+ Fetch dynamic data like Reddit flairs, YouTube playlists, LinkedIn companies, etc.
63
84
 
64
85
  **Examples:**
86
+ ```bash
87
+ # Get Reddit flairs
88
+ postiz integrations:trigger reddit-123 getFlairs -d '{"subreddit":"programming"}'
89
+
90
+ # Get YouTube playlists
91
+ postiz integrations:trigger youtube-456 getPlaylists
92
+
93
+ # Get LinkedIn companies
94
+ postiz integrations:trigger linkedin-789 getCompanies
95
+ ```
96
+
97
+ ---
98
+
99
+ ### Creating Posts
65
100
 
101
+ **Simple scheduled post**
66
102
  ```bash
67
- # Simple post
68
- postiz posts:create -c "Hello World!" -i "twitter-123"
103
+ postiz posts:create -c "Content" -s "2024-12-31T12:00:00Z" -i "integration-id"
104
+ ```
69
105
 
70
- # Post with multiple images
71
- postiz posts:create \
72
- -c "Check these out!" \
73
- -m "img1.jpg,img2.jpg,img3.jpg" \
74
- -i "twitter-123"
106
+ **Draft post**
107
+ ```bash
108
+ postiz posts:create -c "Content" -s "2024-12-31T12:00:00Z" -t draft -i "integration-id"
109
+ ```
75
110
 
76
- # Post with comments, each having their own media
77
- postiz posts:create \
78
- -c "Main post 🚀" -m "main.jpg,main2.jpg" \
79
- -c "First comment 📸" -m "comment1.jpg" \
80
- -c "Second comment 🎨" -m "comment2.jpg" \
81
- -i "twitter-123"
111
+ **Post with media**
112
+ ```bash
113
+ postiz posts:create -c "Content" -m "img1.jpg,img2.jpg" -s "2024-12-31T12:00:00Z" -i "integration-id"
114
+ ```
82
115
 
83
- # Comments can contain semicolons!
116
+ **Post with comments** (each comment can have its own media)
117
+ ```bash
84
118
  postiz posts:create \
85
- -c "Main post" \
86
- -c "Comment with semicolon; see, it works!" \
87
- -c "Another comment; multiple; semicolons!" \
88
- -i "twitter-123"
119
+ -c "Main post" -m "main.jpg" \
120
+ -c "First comment" -m "comment1.jpg" \
121
+ -c "Second comment" -m "comment2.jpg,comment3.jpg" \
122
+ -s "2024-12-31T12:00:00Z" \
123
+ -i "integration-id"
124
+ ```
89
125
 
90
- # Twitter thread with custom delay
91
- postiz posts:create \
92
- -c "Thread 1/3" \
93
- -c "Thread 2/3" \
94
- -c "Thread 3/3" \
95
- -d 2000 \
96
- -i "twitter-123"
126
+ **Multi-platform post**
127
+ ```bash
128
+ postiz posts:create -c "Content" -s "2024-12-31T12:00:00Z" -i "twitter-id,linkedin-id,facebook-id"
129
+ ```
97
130
 
98
- # Scheduled post
131
+ **Platform-specific settings**
132
+ ```bash
99
133
  postiz posts:create \
100
- -c "Future post" \
134
+ -c "Content" \
101
135
  -s "2024-12-31T12:00:00Z" \
102
- -i "twitter-123"
136
+ --settings '{"subreddit":[{"value":{"subreddit":"programming","title":"Post Title","type":"text"}}]}' \
137
+ -i "reddit-id"
138
+ ```
103
139
 
104
- # With provider-specific settings
105
- postiz posts:create \
106
- -c "Video description" \
107
- -p youtube \
108
- --settings '{"title":"My Video","type":"public"}' \
109
- -i "youtube-123"
140
+ **Complex post from JSON file**
141
+ ```bash
142
+ postiz posts:create --json post.json
110
143
  ```
111
144
 
112
- ### Provider-Specific Settings
145
+ **Options:**
146
+ - `-c, --content` - Post/comment content (use multiple times for posts with comments)
147
+ - `-s, --date` - Schedule date in ISO 8601 format (REQUIRED)
148
+ - `-t, --type` - Post type: "schedule" or "draft" (default: "schedule")
149
+ - `-m, --media` - Comma-separated media URLs for corresponding `-c`
150
+ - `-i, --integrations` - Comma-separated integration IDs (required)
151
+ - `-d, --delay` - Delay between comments in milliseconds (default: 5000)
152
+ - `--settings` - Platform-specific settings as JSON string
153
+ - `-j, --json` - Path to JSON file with full post structure
154
+ - `--shortLink` - Use short links (default: true)
155
+
156
+ ---
113
157
 
114
- Many platforms support specific settings (Reddit subreddits, YouTube visibility, TikTok privacy, etc.):
158
+ ### Managing Posts
115
159
 
160
+ **List posts**
116
161
  ```bash
117
- # Reddit with subreddit settings
118
- postiz posts:create \
119
- -c "Post content" \
120
- -p reddit \
121
- --settings '{"subreddit":[{"value":{"subreddit":"programming","title":"My Title","type":"text","url":"","is_flair_required":false}}]}' \
122
- -i "reddit-123"
162
+ postiz posts:list
163
+ postiz posts:list --startDate "2024-01-01T00:00:00Z" --endDate "2024-12-31T23:59:59Z"
164
+ postiz posts:list --customer "customer-id"
165
+ ```
123
166
 
124
- # YouTube with title and visibility
125
- postiz posts:create \
126
- -c "Video description" \
127
- -p youtube \
128
- --settings '{"title":"My Video","type":"public","tags":[{"value":"tech","label":"Tech"}]}' \
129
- -i "youtube-123"
167
+ Defaults to last 30 days to next 30 days if dates not specified.
130
168
 
131
- # X (Twitter) with reply settings
132
- postiz posts:create \
133
- -c "Tweet" \
134
- -p x \
135
- --settings '{"who_can_reply_post":"everyone"}' \
136
- -i "twitter-123"
169
+ **Delete post**
170
+ ```bash
171
+ postiz posts:delete <post-id>
137
172
  ```
138
173
 
139
- See **[PROVIDER_SETTINGS.md](./PROVIDER_SETTINGS.md)** for complete documentation on all platform-specific settings.
174
+ ---
175
+
176
+ ### Media Upload
177
+
178
+ **Upload file and get URL**
179
+ ```bash
180
+ postiz upload <file-path>
140
181
  ```
141
182
 
142
- #### List Posts
183
+ **Supported formats:**
184
+ - **Images:** PNG, JPG, JPEG, GIF, WEBP, SVG, BMP, ICO
185
+ - **Videos:** MP4, MOV, AVI, MKV, WEBM, FLV, WMV, M4V, MPEG, MPG, 3GP
186
+ - **Audio:** MP3, WAV, OGG, AAC, FLAC, M4A
187
+ - **Documents:** PDF, DOC, DOCX
143
188
 
189
+ **Example:**
144
190
  ```bash
145
- postiz posts:list [options]
191
+ RESULT=$(postiz upload video.mp4)
192
+ PATH=$(echo "$RESULT" | jq -r '.path')
193
+ postiz posts:create -c "Check out my video!" -m "$PATH" -i "tiktok-id"
146
194
  ```
147
195
 
148
- **Options:**
149
- - `-p, --page <number>` - Page number (default: 1)
150
- - `-l, --limit <number>` - Posts per page (default: 10)
151
- - `-s, --search <query>` - Search query
196
+ ---
152
197
 
153
- **Examples:**
198
+ ## Platform-Specific Features
154
199
 
200
+ ### Reddit
155
201
  ```bash
156
- # List all posts
157
- postiz posts:list
202
+ # Get available flairs
203
+ postiz integrations:trigger reddit-id getFlairs -d '{"subreddit":"programming"}'
204
+
205
+ # Post with subreddit and flair
206
+ postiz posts:create \
207
+ -c "Content" \
208
+ -s "2024-12-31T12:00:00Z" \
209
+ --settings '{"subreddit":[{"value":{"subreddit":"programming","title":"My Post","type":"text","is_flair_required":true,"flair":{"id":"flair-123","name":"Discussion"}}}]}' \
210
+ -i "reddit-id"
211
+ ```
158
212
 
159
- # With pagination
160
- postiz posts:list -p 2 -l 20
213
+ ### YouTube
214
+ ```bash
215
+ # Get playlists
216
+ postiz integrations:trigger youtube-id getPlaylists
161
217
 
162
- # Search posts
163
- postiz posts:list -s "keyword"
218
+ # Upload video with metadata
219
+ postiz posts:create \
220
+ -c "Video description" \
221
+ -s "2024-12-31T12:00:00Z" \
222
+ --settings '{"title":"Video Title","type":"public","tags":[{"value":"tech","label":"Tech"}],"playlistId":"playlist-id"}' \
223
+ -m "video.mp4" \
224
+ -i "youtube-id"
164
225
  ```
165
226
 
166
- #### Delete a Post
227
+ ### TikTok
228
+ ```bash
229
+ postiz posts:create \
230
+ -c "Video caption #fyp" \
231
+ -s "2024-12-31T12:00:00Z" \
232
+ --settings '{"privacy":"PUBLIC_TO_EVERYONE","duet":true,"stitch":true}' \
233
+ -m "video.mp4" \
234
+ -i "tiktok-id"
235
+ ```
167
236
 
237
+ ### LinkedIn
168
238
  ```bash
169
- postiz posts:delete <post-id>
239
+ # Get companies you can post to
240
+ postiz integrations:trigger linkedin-id getCompanies
241
+
242
+ # Post as company
243
+ postiz posts:create \
244
+ -c "Company announcement" \
245
+ -s "2024-12-31T12:00:00Z" \
246
+ --settings '{"companyId":"company-123"}' \
247
+ -i "linkedin-id"
170
248
  ```
171
249
 
172
- **Example:**
250
+ ### X (Twitter)
251
+ ```bash
252
+ # Create thread
253
+ postiz posts:create \
254
+ -c "Thread 1/3 🧵" \
255
+ -c "Thread 2/3" \
256
+ -c "Thread 3/3" \
257
+ -s "2024-12-31T12:00:00Z" \
258
+ -d 2000 \
259
+ -i "twitter-id"
173
260
 
261
+ # With reply settings
262
+ postiz posts:create \
263
+ -c "Tweet content" \
264
+ -s "2024-12-31T12:00:00Z" \
265
+ --settings '{"who_can_reply_post":"everyone"}' \
266
+ -i "twitter-id"
267
+ ```
268
+
269
+ ### Instagram
174
270
  ```bash
175
- postiz posts:delete abc123xyz
271
+ # Regular post
272
+ postiz posts:create \
273
+ -c "Caption #hashtag" \
274
+ -s "2024-12-31T12:00:00Z" \
275
+ --settings '{"post_type":"post"}' \
276
+ -m "image.jpg" \
277
+ -i "instagram-id"
278
+
279
+ # Story
280
+ postiz posts:create \
281
+ -c "" \
282
+ -s "2024-12-31T12:00:00Z" \
283
+ --settings '{"post_type":"story"}' \
284
+ -m "story.jpg" \
285
+ -i "instagram-id"
176
286
  ```
177
287
 
178
- #### List Integrations
288
+ **See [PROVIDER_SETTINGS.md](./PROVIDER_SETTINGS.md) for all 28+ platforms.**
289
+
290
+ ---
291
+
292
+ ## Features for AI Agents
293
+
294
+ ### Discovery Workflow
295
+ The CLI enables dynamic discovery of integration capabilities:
296
+
297
+ 1. **List integrations** - Get available social media accounts
298
+ 2. **Get settings** - Retrieve character limits, required fields, and available tools
299
+ 3. **Trigger tools** - Fetch dynamic data (flairs, playlists, boards, etc.)
300
+ 4. **Create posts** - Use discovered data in posts
301
+
302
+ This allows AI agents to adapt to different platforms without hardcoded knowledge.
303
+
304
+ ### JSON Mode
305
+ For complex posts with multiple platforms and settings:
179
306
 
180
307
  ```bash
181
- postiz integrations:list
308
+ postiz posts:create --json complex-post.json
182
309
  ```
183
310
 
184
- Shows all connected social media accounts.
311
+ JSON structure:
312
+ ```json
313
+ {
314
+ "integrations": ["twitter-123", "linkedin-456"],
315
+ "posts": [
316
+ {
317
+ "provider": "twitter",
318
+ "post": [
319
+ {
320
+ "content": "Tweet version",
321
+ "image": ["twitter-image.jpg"]
322
+ }
323
+ ]
324
+ },
325
+ {
326
+ "provider": "linkedin",
327
+ "post": [
328
+ {
329
+ "content": "LinkedIn version with more context...",
330
+ "image": ["linkedin-image.jpg"]
331
+ }
332
+ ],
333
+ "settings": {
334
+ "__type": "linkedin",
335
+ "companyId": "company-123"
336
+ }
337
+ }
338
+ ]
339
+ }
340
+ ```
185
341
 
186
- #### Upload a File
342
+ ### All Output is JSON
343
+ Every command outputs JSON for easy parsing:
187
344
 
188
345
  ```bash
189
- postiz upload <file-path>
346
+ INTEGRATIONS=$(postiz integrations:list | jq -r '.')
347
+ REDDIT_ID=$(echo "$INTEGRATIONS" | jq -r '.[] | select(.identifier=="reddit") | .id')
190
348
  ```
191
349
 
192
- **Example:**
350
+ ### Threading Support
351
+ Comments are automatically converted to threads/replies based on platform:
352
+ - **Twitter/X**: Thread of tweets
353
+ - **Reddit**: Comment replies
354
+ - **LinkedIn**: Comment on post
355
+ - **Instagram**: First comment
193
356
 
194
357
  ```bash
195
- postiz upload ./images/photo.png
358
+ postiz posts:create \
359
+ -c "Main post" \
360
+ -c "Comment 1" \
361
+ -c "Comment 2" \
362
+ -i "integration-id"
196
363
  ```
197
364
 
198
- ## Development
365
+ ---
199
366
 
200
- ### Project Structure
367
+ ## Common Workflows
201
368
 
202
- ```
203
- apps/cli/
204
- ├── src/
205
- │ ├── index.ts # CLI entry point
206
- │ ├── api.ts # API client
207
- │ ├── config.ts # Configuration handler
208
- │ └── commands/
209
- │ ├── posts.ts # Post commands
210
- │ ├── integrations.ts # Integration commands
211
- │ └── upload.ts # Upload commands
212
- ├── package.json
213
- ├── tsconfig.json
214
- ├── tsup.config.ts
215
- ├── README.md
216
- └── SKILL.md # AI agent usage guide
217
- ```
369
+ ### Reddit Post with Flair
370
+ ```bash
371
+ #!/bin/bash
372
+ REDDIT_ID=$(postiz integrations:list | jq -r '.[] | select(.identifier=="reddit") | .id')
373
+ FLAIRS=$(postiz integrations:trigger "$REDDIT_ID" getFlairs -d '{"subreddit":"programming"}')
374
+ FLAIR_ID=$(echo "$FLAIRS" | jq -r '.output[0].id')
218
375
 
219
- ### Scripts
376
+ postiz posts:create \
377
+ -c "My post content" \
378
+ -s "2024-12-31T12:00:00Z" \
379
+ --settings "{\"subreddit\":[{\"value\":{\"subreddit\":\"programming\",\"title\":\"Post Title\",\"type\":\"text\",\"is_flair_required\":true,\"flair\":{\"id\":\"$FLAIR_ID\",\"name\":\"Discussion\"}}}]}" \
380
+ -i "$REDDIT_ID"
381
+ ```
220
382
 
221
- - `pnpm run dev` - Watch mode for development
222
- - `pnpm run build` - Build the CLI
223
- - `pnpm run start` - Run the built CLI
383
+ ### YouTube Video Upload
384
+ ```bash
385
+ #!/bin/bash
386
+ VIDEO=$(postiz upload video.mp4)
387
+ VIDEO_PATH=$(echo "$VIDEO" | jq -r '.path')
224
388
 
225
- ### Building
389
+ postiz posts:create \
390
+ -c "Video description..." \
391
+ -s "2024-12-31T12:00:00Z" \
392
+ --settings '{"title":"My Video","type":"public","tags":[{"value":"tech","label":"Tech"}]}' \
393
+ -m "$VIDEO_PATH" \
394
+ -i "youtube-id"
395
+ ```
226
396
 
227
- The CLI uses `tsup` for building:
397
+ ### Multi-Platform Campaign
398
+ ```bash
399
+ #!/bin/bash
400
+ postiz posts:create \
401
+ -c "Same content everywhere" \
402
+ -s "2024-12-31T12:00:00Z" \
403
+ -m "image.jpg" \
404
+ -i "twitter-id,linkedin-id,facebook-id"
405
+ ```
228
406
 
407
+ ### Batch Scheduling
229
408
  ```bash
230
- pnpm run build
409
+ #!/bin/bash
410
+ DATES=("2024-02-14T09:00:00Z" "2024-02-15T09:00:00Z" "2024-02-16T09:00:00Z")
411
+ CONTENT=("Monday motivation 💪" "Tuesday tips 💡" "Wednesday wisdom 🧠")
412
+
413
+ for i in "${!DATES[@]}"; do
414
+ postiz posts:create \
415
+ -c "${CONTENT[$i]}" \
416
+ -s "${DATES[$i]}" \
417
+ -i "twitter-id"
418
+ done
231
419
  ```
232
420
 
233
- This creates a `dist/` directory with:
234
- - Compiled JavaScript
235
- - Type declarations
236
- - Source maps
237
- - Executable shebang for Node.js
421
+ ---
238
422
 
239
- ## For AI Agents
423
+ ## Documentation
240
424
 
241
- See [SKILL.md](./SKILL.md) for detailed usage patterns and examples for AI agents.
425
+ **For AI Agents:**
426
+ - **[SKILL.md](./SKILL.md)** - Complete skill reference with patterns and examples
242
427
 
243
- ## API Reference
428
+ **Deep-Dive Guides:**
429
+ - **[HOW_TO_RUN.md](./HOW_TO_RUN.md)** - Installation and setup methods
430
+ - **[COMMAND_LINE_GUIDE.md](./COMMAND_LINE_GUIDE.md)** - Complete command syntax reference
431
+ - **[PROVIDER_SETTINGS.md](./PROVIDER_SETTINGS.md)** - All platform settings schemas
432
+ - **[INTEGRATION_TOOLS_WORKFLOW.md](./INTEGRATION_TOOLS_WORKFLOW.md)** - Tools workflow guide
433
+ - **[INTEGRATION_SETTINGS_DISCOVERY.md](./INTEGRATION_SETTINGS_DISCOVERY.md)** - Settings discovery
434
+ - **[SUPPORTED_FILE_TYPES.md](./SUPPORTED_FILE_TYPES.md)** - Media format reference
435
+ - **[PROJECT_STRUCTURE.md](./PROJECT_STRUCTURE.md)** - Code architecture
436
+ - **[PUBLISHING.md](./PUBLISHING.md)** - npm publishing guide
437
+
438
+ **Examples:**
439
+ - **[examples/EXAMPLES.md](./examples/EXAMPLES.md)** - Comprehensive examples
440
+ - **[examples/](./examples/)** - Ready-to-use scripts and JSON files
441
+
442
+ ---
443
+
444
+ ## API Endpoints
244
445
 
245
446
  The CLI interacts with these Postiz API endpoints:
246
447
 
247
- - `POST /public/v1/posts` - Create a post
248
- - `GET /public/v1/posts` - List posts
249
- - `DELETE /public/v1/posts/:id` - Delete a post
250
- - `GET /public/v1/integrations` - List integrations
251
- - `POST /public/v1/upload` - Upload media
448
+ | Endpoint | Method | Purpose |
449
+ |----------|--------|---------|
450
+ | `/public/v1/posts` | POST | Create a post |
451
+ | `/public/v1/posts` | GET | List posts |
452
+ | `/public/v1/posts/:id` | DELETE | Delete a post |
453
+ | `/public/v1/integrations` | GET | List integrations |
454
+ | `/public/v1/integration-settings/:id` | GET | Get integration settings |
455
+ | `/public/v1/integration-trigger/:id` | POST | Trigger integration tool |
456
+ | `/public/v1/upload` | POST | Upload media |
457
+
458
+ ---
252
459
 
253
460
  ## Environment Variables
254
461
 
@@ -257,65 +464,147 @@ The CLI interacts with these Postiz API endpoints:
257
464
  | `POSTIZ_API_KEY` | ✅ Yes | - | Your Postiz API key |
258
465
  | `POSTIZ_API_URL` | No | `https://api.postiz.com` | Custom API endpoint |
259
466
 
467
+ ---
468
+
260
469
  ## Error Handling
261
470
 
262
- The CLI provides user-friendly error messages:
471
+ The CLI provides clear error messages with exit codes:
263
472
 
264
- - Success messages with green checkmarks
265
- - Error messages with red X marks
266
- - 📋 Info messages with emojis
267
- - Exit code 0 for success, 1 for errors
473
+ - **Exit code 0**: Success
474
+ - **Exit code 1**: Error occurred
268
475
 
269
- ## Examples
476
+ **Common errors:**
270
477
 
271
- ### Basic Workflow
478
+ | Error | Solution |
479
+ |-------|----------|
480
+ | `POSTIZ_API_KEY is not set` | Set environment variable: `export POSTIZ_API_KEY=key` |
481
+ | `Integration not found` | Run `integrations:list` to get valid IDs |
482
+ | `startDate/endDate required` | Use ISO 8601 format: `"2024-12-31T12:00:00Z"` |
483
+ | `Invalid settings` | Check `integrations:settings` for required fields |
484
+ | `Tool not found` | Check available tools in `integrations:settings` output |
485
+ | `Upload failed` | Verify file exists and format is supported |
272
486
 
273
- ```bash
274
- # 1. Set API key
275
- export POSTIZ_API_KEY=your_key
487
+ ---
276
488
 
277
- # 2. Check connected integrations
278
- postiz integrations:list
489
+ ## Development
279
490
 
280
- # 3. Create a post
281
- postiz posts:create -c "Hello from CLI!" -i "twitter-123"
491
+ ### Project Structure
282
492
 
283
- # 4. List posts
284
- postiz posts:list
493
+ ```
494
+ apps/cli/
495
+ ├── src/
496
+ │ ├── index.ts # CLI entry point with yargs
497
+ │ ├── api.ts # PostizAPI client class
498
+ │ ├── config.ts # Environment configuration
499
+ │ └── commands/
500
+ │ ├── posts.ts # Post management commands
501
+ │ ├── integrations.ts # Integration commands
502
+ │ └── upload.ts # Media upload command
503
+ ├── examples/ # Example scripts and JSON files
504
+ ├── package.json
505
+ ├── tsconfig.json
506
+ ├── tsup.config.ts # Build configuration
507
+ ├── README.md # This file
508
+ └── SKILL.md # AI agent reference
509
+ ```
510
+
511
+ ### Scripts
285
512
 
286
- # 5. Delete a post
287
- postiz posts:delete post-id-123
513
+ ```bash
514
+ pnpm run dev # Watch mode for development
515
+ pnpm run build # Build the CLI
516
+ pnpm run start # Run the built CLI
288
517
  ```
289
518
 
290
- ### Scheduled Posting
519
+ ### Building
520
+
521
+ The CLI uses `tsup` for bundling:
291
522
 
292
523
  ```bash
293
- # Schedule posts for different times
294
- postiz posts:create -c "Morning post" -s "2024-01-15T09:00:00Z"
295
- postiz posts:create -c "Afternoon post" -s "2024-01-15T15:00:00Z"
296
- postiz posts:create -c "Evening post" -s "2024-01-15T20:00:00Z"
524
+ pnpm run build
297
525
  ```
298
526
 
299
- ### Media Upload Workflow
527
+ Output in `dist/`:
528
+ - `index.js` - Bundled executable with shebang
529
+ - `index.js.map` - Source map
530
+
531
+ ---
532
+
533
+ ## Quick Reference
300
534
 
301
535
  ```bash
302
- # Upload an image
303
- postiz upload ./image.png
536
+ # Environment setup
537
+ export POSTIZ_API_KEY=your_key
304
538
 
305
- # The response includes the URL, use it in a post
306
- postiz posts:create -c "Check this out!" --image "url-from-upload"
539
+ # Discovery
540
+ postiz integrations:list # List integrations
541
+ postiz integrations:settings <id> # Get settings
542
+ postiz integrations:trigger <id> <method> -d '{}' # Fetch data
543
+
544
+ # Posting (date is required)
545
+ postiz posts:create -c "text" -s "2024-12-31T12:00:00Z" -i "id" # Simple
546
+ postiz posts:create -c "text" -s "2024-12-31T12:00:00Z" -t draft -i "id" # Draft
547
+ postiz posts:create -c "text" -m "img.jpg" -s "2024-12-31T12:00:00Z" -i "id" # With media
548
+ postiz posts:create -c "main" -c "comment" -s "2024-12-31T12:00:00Z" -i "id" # With comment
549
+ postiz posts:create -c "text" -s "2024-12-31T12:00:00Z" --settings '{}' -i "id" # Platform-specific
550
+ postiz posts:create --json file.json # Complex
551
+
552
+ # Management
553
+ postiz posts:list # List posts
554
+ postiz posts:delete <id> # Delete post
555
+ postiz upload <file> # Upload media
556
+
557
+ # Help
558
+ postiz --help # Show help
559
+ postiz posts:create --help # Command help
307
560
  ```
308
561
 
562
+ ---
563
+
309
564
  ## Contributing
310
565
 
311
566
  This CLI is part of the [Postiz monorepo](https://github.com/gitroomhq/postiz-app).
312
567
 
568
+ To contribute:
569
+ 1. Fork the repository
570
+ 2. Create a feature branch
571
+ 3. Make your changes in `apps/cli/`
572
+ 4. Run tests: `pnpm run build`
573
+ 5. Submit a pull request
574
+
575
+ ---
576
+
313
577
  ## License
314
578
 
315
579
  AGPL-3.0
316
580
 
581
+ ---
582
+
317
583
  ## Links
318
584
 
319
- - [Postiz Website](https://postiz.com)
320
- - [API Documentation](https://postiz.com/api-docs)
321
- - [GitHub Repository](https://github.com/gitroomhq/postiz-app)
585
+ - **Website:** [postiz.com](https://postiz.com)
586
+ - **API Docs:** [postiz.com/api-docs](https://postiz.com/api-docs)
587
+ - **GitHub:** [gitroomhq/postiz-app](https://github.com/gitroomhq/postiz-app)
588
+ - **Issues:** [Report bugs](https://github.com/gitroomhq/postiz-app/issues)
589
+
590
+ ---
591
+
592
+ ## Supported Platforms
593
+
594
+ 28+ platforms including:
595
+
596
+ | Platform | Integration Tools | Settings |
597
+ |----------|------------------|----------|
598
+ | Twitter/X | getLists, getCommunities | who_can_reply_post |
599
+ | LinkedIn | getCompanies | companyId, carousel |
600
+ | Reddit | getFlairs, searchSubreddits | subreddit, title, flair |
601
+ | YouTube | getPlaylists, getCategories | title, type, tags, playlistId |
602
+ | TikTok | - | privacy, duet, stitch |
603
+ | Instagram | - | post_type (post/story) |
604
+ | Facebook | getPages | - |
605
+ | Pinterest | getBoards, getBoardSections | - |
606
+ | Discord | getChannels | - |
607
+ | Slack | getChannels | - |
608
+ | And 18+ more... | | |
609
+
610
+ **See [PROVIDER_SETTINGS.md](./PROVIDER_SETTINGS.md) for complete documentation.**