postiz 1.0.0 → 2.0.0

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 ADDED
@@ -0,0 +1,321 @@
1
+ # Postiz CLI
2
+
3
+ > Command-line interface for the Postiz social media scheduling platform
4
+
5
+ ## Overview
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.
8
+
9
+ ## Quick Start
10
+
11
+ ### Installation
12
+
13
+ ```bash
14
+ # Install dependencies
15
+ pnpm install
16
+
17
+ # Build the CLI
18
+ pnpm run build
19
+
20
+ # Run locally (development)
21
+ pnpm run start -- [command]
22
+
23
+ # Or link globally
24
+ pnpm link --global
25
+ ```
26
+
27
+ ### Setup
28
+
29
+ Before using the CLI, you need to set your Postiz API key:
30
+
31
+ ```bash
32
+ export POSTIZ_API_KEY=your_api_key_here
33
+ ```
34
+
35
+ Optionally, you can set a custom API URL:
36
+
37
+ ```bash
38
+ export POSTIZ_API_URL=https://your-custom-api.com
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ ```bash
44
+ postiz <command> [options]
45
+ ```
46
+
47
+ ### Commands
48
+
49
+ #### Create a Post
50
+
51
+ ```bash
52
+ postiz posts:create -c "Your content here" -i "integration-id-1,integration-id-2"
53
+ ```
54
+
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
63
+
64
+ **Examples:**
65
+
66
+ ```bash
67
+ # Simple post
68
+ postiz posts:create -c "Hello World!" -i "twitter-123"
69
+
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"
75
+
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"
82
+
83
+ # Comments can contain semicolons!
84
+ 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"
89
+
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"
97
+
98
+ # Scheduled post
99
+ postiz posts:create \
100
+ -c "Future post" \
101
+ -s "2024-12-31T12:00:00Z" \
102
+ -i "twitter-123"
103
+
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"
110
+ ```
111
+
112
+ ### Provider-Specific Settings
113
+
114
+ Many platforms support specific settings (Reddit subreddits, YouTube visibility, TikTok privacy, etc.):
115
+
116
+ ```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"
123
+
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"
130
+
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"
137
+ ```
138
+
139
+ See **[PROVIDER_SETTINGS.md](./PROVIDER_SETTINGS.md)** for complete documentation on all platform-specific settings.
140
+ ```
141
+
142
+ #### List Posts
143
+
144
+ ```bash
145
+ postiz posts:list [options]
146
+ ```
147
+
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
152
+
153
+ **Examples:**
154
+
155
+ ```bash
156
+ # List all posts
157
+ postiz posts:list
158
+
159
+ # With pagination
160
+ postiz posts:list -p 2 -l 20
161
+
162
+ # Search posts
163
+ postiz posts:list -s "keyword"
164
+ ```
165
+
166
+ #### Delete a Post
167
+
168
+ ```bash
169
+ postiz posts:delete <post-id>
170
+ ```
171
+
172
+ **Example:**
173
+
174
+ ```bash
175
+ postiz posts:delete abc123xyz
176
+ ```
177
+
178
+ #### List Integrations
179
+
180
+ ```bash
181
+ postiz integrations:list
182
+ ```
183
+
184
+ Shows all connected social media accounts.
185
+
186
+ #### Upload a File
187
+
188
+ ```bash
189
+ postiz upload <file-path>
190
+ ```
191
+
192
+ **Example:**
193
+
194
+ ```bash
195
+ postiz upload ./images/photo.png
196
+ ```
197
+
198
+ ## Development
199
+
200
+ ### Project Structure
201
+
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
+ ```
218
+
219
+ ### Scripts
220
+
221
+ - `pnpm run dev` - Watch mode for development
222
+ - `pnpm run build` - Build the CLI
223
+ - `pnpm run start` - Run the built CLI
224
+
225
+ ### Building
226
+
227
+ The CLI uses `tsup` for building:
228
+
229
+ ```bash
230
+ pnpm run build
231
+ ```
232
+
233
+ This creates a `dist/` directory with:
234
+ - Compiled JavaScript
235
+ - Type declarations
236
+ - Source maps
237
+ - Executable shebang for Node.js
238
+
239
+ ## For AI Agents
240
+
241
+ See [SKILL.md](./SKILL.md) for detailed usage patterns and examples for AI agents.
242
+
243
+ ## API Reference
244
+
245
+ The CLI interacts with these Postiz API endpoints:
246
+
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
252
+
253
+ ## Environment Variables
254
+
255
+ | Variable | Required | Default | Description |
256
+ |----------|----------|---------|-------------|
257
+ | `POSTIZ_API_KEY` | ✅ Yes | - | Your Postiz API key |
258
+ | `POSTIZ_API_URL` | No | `https://api.postiz.com` | Custom API endpoint |
259
+
260
+ ## Error Handling
261
+
262
+ The CLI provides user-friendly error messages:
263
+
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
268
+
269
+ ## Examples
270
+
271
+ ### Basic Workflow
272
+
273
+ ```bash
274
+ # 1. Set API key
275
+ export POSTIZ_API_KEY=your_key
276
+
277
+ # 2. Check connected integrations
278
+ postiz integrations:list
279
+
280
+ # 3. Create a post
281
+ postiz posts:create -c "Hello from CLI!" -i "twitter-123"
282
+
283
+ # 4. List posts
284
+ postiz posts:list
285
+
286
+ # 5. Delete a post
287
+ postiz posts:delete post-id-123
288
+ ```
289
+
290
+ ### Scheduled Posting
291
+
292
+ ```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"
297
+ ```
298
+
299
+ ### Media Upload Workflow
300
+
301
+ ```bash
302
+ # Upload an image
303
+ postiz upload ./image.png
304
+
305
+ # The response includes the URL, use it in a post
306
+ postiz posts:create -c "Check this out!" --image "url-from-upload"
307
+ ```
308
+
309
+ ## Contributing
310
+
311
+ This CLI is part of the [Postiz monorepo](https://github.com/gitroomhq/postiz-app).
312
+
313
+ ## License
314
+
315
+ AGPL-3.0
316
+
317
+ ## Links
318
+
319
+ - [Postiz Website](https://postiz.com)
320
+ - [API Documentation](https://postiz.com/api-docs)
321
+ - [GitHub Repository](https://github.com/gitroomhq/postiz-app)