@usesocial/cli 0.7.0 → 0.8.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/CHANGELOG.md +24 -0
- package/README.md +62 -36
- package/dist/index.mjs +1415 -1012
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @usesocial/cli
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#33](https://github.com/usesocial/monorepo/pull/33) [`abb6401`](https://github.com/usesocial/monorepo/commit/abb64017354f4607a25d321f115d5063ad3d4117) Thanks [@CyrusNuevoDia](https://github.com/CyrusNuevoDia)! - Remove `social account config cache mode`; configure live-read proxy caching with `social account config cache ttl` only.
|
|
8
|
+
|
|
9
|
+
- [#33](https://github.com/usesocial/monorepo/pull/33) [`2c315ba`](https://github.com/usesocial/monorepo/commit/2c315ba6ba0f8279b9bad05928450d5666476627) Thanks [@CyrusNuevoDia](https://github.com/CyrusNuevoDia)! - Add sync `--timeout` rate-limit wait budgets and resumable rate-limit abort guidance.
|
|
10
|
+
|
|
11
|
+
- [#33](https://github.com/usesocial/monorepo/pull/33) [`76d03f2`](https://github.com/usesocial/monorepo/commit/76d03f21d6e2e2214f85338c8cb13c4eae2a96c3) Thanks [@CyrusNuevoDia](https://github.com/CyrusNuevoDia)! - Rebuild the local SQL mirror as curated views and slim the schema surfaces.
|
|
12
|
+
|
|
13
|
+
- Every cache table is now a view over a `<name>_raw` physical table. Views drop `raw`/`synced_at` (a `SELECT *` row is ~5× smaller) and normalize names across platforms: `username`/`name`/`avatar_url` everywhere, `created_at` (was `timestamp`), `conversation_id` (was `chat_id`/`dm_conversation_id`), `last_message_at`, `is_mentioned`, `*_distance`. Upstream JSON stays queryable in the `_raw` twins via `json_extract(raw, '$.field')`. Existing caches migrate automatically.
|
|
14
|
+
- Promoted raw fields: `li_requests.message` (invitation note text) and `x_profiles.receives_your_dm`.
|
|
15
|
+
- `li_posts` is a curated ~29-column view; the quoted-post/permissions long tail lives in `li_posts_raw`.
|
|
16
|
+
- Bare `social <platform> sql` now prints compact schema metadata — column lists, row counts, `synced_at`, `query_ready`, indexed columns, join hints, and enum values — instead of raw `CREATE TABLE` statements (~35% smaller).
|
|
17
|
+
- `social schema` output is leaner: the redundant `params` field is gone (use `args`/`flags`/`inputSchema`), `schemaVersion` prints once at the root, and empty `subCommands` are omitted (`--leaves` is ~26% smaller).
|
|
18
|
+
- `sql` contract examples are projected queries on `x_followers`, `x_following`, and `li_connections`.
|
|
19
|
+
|
|
20
|
+
## 0.7.1
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- [#32](https://github.com/usesocial/monorepo/pull/32) [`b2ca106`](https://github.com/usesocial/monorepo/commit/b2ca106f970bfe73d776f3f10225df7c6c7a1b80) Thanks [@CyrusNuevoDia](https://github.com/CyrusNuevoDia)! - Use cursor pagination for `social linkedin posts` so the CLI matches the LinkedIn
|
|
25
|
+
posts provider contract.
|
|
26
|
+
|
|
3
27
|
## 0.7.0
|
|
4
28
|
|
|
5
29
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -25,6 +25,12 @@ Published as `@usesocial/cli` on npm; the binary is `social`.
|
|
|
25
25
|
curl -fsSL https://usesocial.dev/install.sh | bash
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
Or with Homebrew:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
brew install usesocial/tap/cli
|
|
32
|
+
```
|
|
33
|
+
|
|
28
34
|
## Quickstart
|
|
29
35
|
|
|
30
36
|
```sh
|
|
@@ -56,7 +62,7 @@ marked **local** update local CLI state or the local mirror.
|
|
|
56
62
|
|
|
57
63
|
### Targets
|
|
58
64
|
|
|
59
|
-
Targets accept
|
|
65
|
+
Targets accept usernames, profile/post/conversation/company URLs, LinkedIn URNs,
|
|
60
66
|
or typed IDs such as `profile_id:<id>`, `post_id:<id>`, `chat_id:<id>`,
|
|
61
67
|
`conversation_id:<id>`, `company_id:<id>`, and `request_id:<id>`. Bare IDs are
|
|
62
68
|
not accepted.
|
|
@@ -69,25 +75,46 @@ freeform text from stdin. There is no text positional:
|
|
|
69
75
|
```sh
|
|
70
76
|
echo "gm" | social x post
|
|
71
77
|
social linkedin post < draft.md
|
|
72
|
-
social linkedin requests send @
|
|
78
|
+
social linkedin requests send @username < note.txt
|
|
73
79
|
```
|
|
74
80
|
|
|
75
81
|
Pipe a JSON object for advanced payload fields.
|
|
76
82
|
|
|
77
|
-
|
|
83
|
+
### Pagination
|
|
84
|
+
|
|
85
|
+
Live list reads take `--limit`. X lists and LinkedIn `posts`/`connections`
|
|
86
|
+
continue with `--cursor` from `.meta.cursor`; LinkedIn `search`, `comments`,
|
|
87
|
+
`reactions`, and `jobs` continue with `--offset`. `sql` does not paginate —
|
|
88
|
+
use SQL `LIMIT` and `ORDER BY`.
|
|
89
|
+
|
|
90
|
+
### Your data is local
|
|
78
91
|
|
|
79
92
|
`sync` pulls your own data down; it is explicit and costs credits. `sql` queries
|
|
80
93
|
that local mirror; it is free, instant, and read-only. Named read commands call
|
|
81
94
|
the live network and cost credits; `x tweets <target>` and
|
|
82
95
|
`linkedin posts <target>` require a target. Writes act.
|
|
83
96
|
|
|
97
|
+
`sync <collection> --since 2026-05-04` (ISO date or datetime) pulls only newer
|
|
98
|
+
items where the bare `sync` listing shows `supportsSince: true` — cheaper than a
|
|
99
|
+
full re-pull. `sync <collection> --reset` clears a collection's local
|
|
100
|
+
rows and sync state so the next sync rebuilds it.
|
|
101
|
+
`sync <collection> --timeout 900` opts into a wall-clock wait budget, in seconds,
|
|
102
|
+
for rate-limit handling. LinkedIn sync may sleep and retry while the next wait
|
|
103
|
+
fits the budget; X keeps its current no-new-retry behavior.
|
|
104
|
+
|
|
105
|
+
Rate-limit JSON includes `retryAfterSeconds`, `resumeAt`, `retryCommand`,
|
|
106
|
+
`hint`, and `syncResume`. When `syncResume.cursorPersisted` is true, already
|
|
107
|
+
synced pages are saved and the listed `retryCommand` resumes from the saved
|
|
108
|
+
cursor. For parent/child message syncs, the hint says when an exact cursor
|
|
109
|
+
resume is not safe and the re-run may re-fetch unfinished pages.
|
|
110
|
+
|
|
84
111
|
```sh
|
|
85
112
|
social x sync messages
|
|
86
|
-
social x sql "SELECT
|
|
113
|
+
social x sql "SELECT sender_username, text, datetime(created_at/1000,'unixepoch') AS at FROM x_messages ORDER BY created_at DESC LIMIT 20" \
|
|
87
114
|
| jq '.items[]'
|
|
88
115
|
```
|
|
89
116
|
|
|
90
|
-
The X inbox query gets `
|
|
117
|
+
The X inbox query gets `sender_username` from the `x_messages` view; no extra
|
|
91
118
|
profile lookup is needed.
|
|
92
119
|
|
|
93
120
|
### Top level
|
|
@@ -115,10 +142,9 @@ profile lookup is needed.
|
|
|
115
142
|
| `disconnect x <account>` | Disconnect an X account. | write |
|
|
116
143
|
| `billing` | Show seats, subscription, and current usage billing. | |
|
|
117
144
|
| `billing portal` | Open the hosted billing portal and print its URL. | |
|
|
118
|
-
| `usage` | Aggregate proxy
|
|
145
|
+
| `usage` | Aggregate proxy calls and credits. | |
|
|
119
146
|
| `logs` | Recent proxy calls. | |
|
|
120
|
-
| `config cache
|
|
121
|
-
| `config cache ttl` | Set a live-read proxy cache TTL in seconds. | |
|
|
147
|
+
| `config cache ttl` | Read or set the live-read proxy cache TTL in seconds. | |
|
|
122
148
|
|
|
123
149
|
### `social linkedin`
|
|
124
150
|
|
|
@@ -126,17 +152,17 @@ profile lookup is needed.
|
|
|
126
152
|
| --- | --- | --- |
|
|
127
153
|
| `profile [target]` | Fetch a profile; omit target for your own account. | |
|
|
128
154
|
| `posts <target>` | Live posts for a person or company; target required. | |
|
|
129
|
-
| `comments <target>` | List a post's comments
|
|
130
|
-
| `reactions <target>` | List a post's reactions
|
|
131
|
-
| `connections [target]` | Live connection graph read; omit target for your own account.
|
|
155
|
+
| `comments <target>` | List a post's comments. | |
|
|
156
|
+
| `reactions <target>` | List a post's reactions. | |
|
|
157
|
+
| `connections [target]` | Live connection graph read; omit target for your own account. Costs credits. | |
|
|
132
158
|
| `company <target>` | Fetch a company profile. | |
|
|
133
|
-
| `jobs <target>` | List a company's job postings
|
|
134
|
-
| `search people\|posts\|jobs\|companies <keywords>` | Search LinkedIn
|
|
159
|
+
| `jobs <target>` | List a company's job postings. | |
|
|
160
|
+
| `search people\|posts\|jobs\|companies <keywords>` | Search LinkedIn. | |
|
|
135
161
|
| `sync [collection]` | Pull your own `connections`, `posts`, `messages`, or `requests` into the local mirror; costs credits. | local |
|
|
136
|
-
| `sql [query]` | Query your synced local mirror with read-only SQL - free; bare `sql` prints
|
|
162
|
+
| `sql [query]` | Query your synced local mirror with read-only SQL - free; bare `sql` prints compact schema metadata. | |
|
|
137
163
|
| `post` | Create a post (body from stdin). | write |
|
|
138
164
|
| `comment <target>` | Comment on a post (body from stdin). | write |
|
|
139
|
-
| `react <target>` | React to a post
|
|
165
|
+
| `react <target>` | React to a post; use `--type` for non-like reactions. | write |
|
|
140
166
|
| `requests send <target>` | Send a connection request (optional note from stdin). | write |
|
|
141
167
|
| `requests accept request_id:<id>` | Accept a received connection request. | write |
|
|
142
168
|
| `requests cancel request_id:<id>` | Cancel a sent request or refuse a received connection request. | write |
|
|
@@ -163,7 +189,7 @@ profile lookup is needed.
|
|
|
163
189
|
| `likers <target>` | List users who liked a post. | |
|
|
164
190
|
| `reposters <target>` | List users who reposted a post. | |
|
|
165
191
|
| `sync [collection]` | Pull your own `tweets`, `followers`, `following`, `bookmarks`, or `messages` into the local mirror; costs credits. | local |
|
|
166
|
-
| `sql [query]` | Query your synced local mirror with read-only SQL - free; bare `sql` prints
|
|
192
|
+
| `sql [query]` | Query your synced local mirror with read-only SQL - free; bare `sql` prints compact schema metadata. | |
|
|
167
193
|
| `post` | Create a post (body from stdin). | write |
|
|
168
194
|
| `message <recipients>` | Send a DM (body from stdin). | write |
|
|
169
195
|
| `like <target>` / `unlike <target>` | Like or unlike a post. | write |
|
|
@@ -175,24 +201,25 @@ profile lookup is needed.
|
|
|
175
201
|
## Built for agents
|
|
176
202
|
|
|
177
203
|
- Everything speaks JSON: success on stdout, structured errors on stderr.
|
|
178
|
-
-
|
|
179
|
-
lives under `.meta`.
|
|
204
|
+
- Platform reads return one envelope: lists use `.items[]`, single resources use
|
|
205
|
+
`.data`, metadata lives under `.meta`. `social account` service commands return
|
|
206
|
+
bare JSON; `account logs` returns `{ items, meta: { cursor } }`.
|
|
180
207
|
- Schema-backed planning: `social schema --list` is the compact runnable index.
|
|
181
208
|
- Local SQL is the free surface for your own synced data.
|
|
182
209
|
|
|
183
210
|
```sh
|
|
184
211
|
# SQL insight: synced contacts you have never messaged.
|
|
185
212
|
# Run `social linkedin sync connections` and `social linkedin sync messages` first.
|
|
186
|
-
social linkedin sql "SELECT c.
|
|
213
|
+
social linkedin sql "SELECT c.user_name, c.user_username, c.user_profile_url FROM li_connections c LEFT JOIN li_messages m ON m.sender_id = c.user_id WHERE m.id IS NULL ORDER BY c.created_at DESC LIMIT 100" \
|
|
187
214
|
| jq '.items[]'
|
|
188
215
|
|
|
189
216
|
# Live fan-out: review recent posts, fan out to reactions, rank warm contacts.
|
|
190
|
-
social linkedin posts profile_id:<profile-id> --limit 25
|
|
217
|
+
social linkedin posts profile_id:<profile-id> --limit 25 > /tmp/recent-posts.json
|
|
191
218
|
jq -r '.items[].id' /tmp/recent-posts.json \
|
|
192
219
|
| xargs -I{} social linkedin reactions post_id:{} --limit 100 --offset 0 \
|
|
193
220
|
| jq -s '[ .[] | .items[] ]
|
|
194
|
-
| group_by(.
|
|
195
|
-
| map({person:
|
|
221
|
+
| group_by(.sender.id)
|
|
222
|
+
| map({person: .[0].sender, signals: length})
|
|
196
223
|
| sort_by(-.signals) | .[0:15]'
|
|
197
224
|
```
|
|
198
225
|
|
|
@@ -205,7 +232,7 @@ jq -r '.items[].id' /tmp/recent-posts.json \
|
|
|
205
232
|
| `3` | Not found | Check the resource ID or pick a different item. |
|
|
206
233
|
| `4` | Auth or scope error | Run `social account login`, or log out and choose the needed scope. |
|
|
207
234
|
| `5` | API, proxy, or unexpected error | Retry later or surface the server error. |
|
|
208
|
-
| `7` | Rate limited | Back off, using `retryAfterSeconds` when present. |
|
|
235
|
+
| `7` | Rate limited | Back off, using `retryAfterSeconds`, `resumeAt`, and `retryCommand` when present. |
|
|
209
236
|
|
|
210
237
|
## Auth
|
|
211
238
|
|
|
@@ -229,26 +256,22 @@ The proxy cache applies to live reads only. Cache hits are free; fresh upstream
|
|
|
229
256
|
reads are metered. Configure the default:
|
|
230
257
|
|
|
231
258
|
```sh
|
|
232
|
-
social account config cache mode
|
|
233
|
-
social account config cache mode live
|
|
234
|
-
social account config cache mode analytical
|
|
235
|
-
social account config cache mode historical
|
|
236
259
|
social account config cache ttl 3600
|
|
237
260
|
```
|
|
238
261
|
|
|
239
262
|
Override one live read when the command lists `--header`:
|
|
240
263
|
|
|
241
264
|
```sh
|
|
242
|
-
social linkedin profile @
|
|
243
|
-
social linkedin profile @
|
|
244
|
-
social linkedin profile @
|
|
265
|
+
social linkedin profile @username -H "Cache-Control: no-cache"
|
|
266
|
+
social linkedin profile @username -H "Cache-Control: no-store"
|
|
267
|
+
social linkedin profile @username -H "Cache-Control: max-age=60"
|
|
245
268
|
```
|
|
246
269
|
|
|
247
270
|
The local mirror is separate: run `sync` when you want newer local data, then
|
|
248
271
|
query it with `sql`. SQL reads show local freshness in `meta.cache.tables`:
|
|
249
272
|
|
|
250
273
|
```sh
|
|
251
|
-
social x sql "SELECT
|
|
274
|
+
social x sql "SELECT sender_username, text FROM x_messages ORDER BY created_at DESC LIMIT 5" \
|
|
252
275
|
| jq '{cost: .meta.cost, cache: .meta.cache}'
|
|
253
276
|
social x timeline --limit 20 | jq '{cost: .meta.cost, cursor: .meta.cursor, cache: .meta.cache}'
|
|
254
277
|
```
|
|
@@ -262,17 +285,19 @@ Agents should watch `.meta.cost` during high-fanout loops, use
|
|
|
262
285
|
```sh
|
|
263
286
|
# LinkedIn local mirror.
|
|
264
287
|
social linkedin sync messages
|
|
265
|
-
social linkedin sql "SELECT
|
|
266
|
-
social linkedin sql "SELECT
|
|
288
|
+
social linkedin sql "SELECT sender_name, text, datetime(created_at/1000,'unixepoch') AS at FROM li_messages ORDER BY created_at DESC LIMIT 20"
|
|
289
|
+
social linkedin sql "SELECT user_name, user_username FROM li_requests WHERE type='received' ORDER BY created_at DESC LIMIT 25"
|
|
267
290
|
|
|
268
291
|
# LinkedIn live reads.
|
|
269
292
|
social linkedin profile
|
|
270
|
-
social linkedin posts profile_id:<profile-id> --limit 25
|
|
293
|
+
PAGE1=$(social linkedin posts profile_id:<profile-id> --limit 25)
|
|
294
|
+
NEXT=$(echo "$PAGE1" | jq -r '.meta.cursor // empty')
|
|
295
|
+
[ -n "$NEXT" ] && social linkedin posts profile_id:<profile-id> --limit 25 --cursor "$NEXT"
|
|
271
296
|
social linkedin reactions post_id:<post-id> --limit 100 --offset 0
|
|
272
297
|
|
|
273
298
|
# X local mirror.
|
|
274
299
|
social x sync messages
|
|
275
|
-
social x sql "SELECT
|
|
300
|
+
social x sql "SELECT sender_username, text FROM x_messages ORDER BY created_at DESC LIMIT 20"
|
|
276
301
|
social x sql "SELECT text, url FROM x_bookmarks ORDER BY created_at DESC LIMIT 50"
|
|
277
302
|
social x sql "SELECT username, name, followers_count FROM x_followers ORDER BY followers_count DESC LIMIT 100"
|
|
278
303
|
|
|
@@ -290,7 +315,8 @@ echo "Loved your launch notes." | social linkedin requests send profile_id:<prof
|
|
|
290
315
|
social account billing
|
|
291
316
|
social account billing portal
|
|
292
317
|
social account usage
|
|
293
|
-
social account logs --limit 20 --from 2026-05-01T00:00:00Z
|
|
318
|
+
social account logs --limit 20 --from 2026-05-01T00:00:00Z \
|
|
319
|
+
| jq -r '.items[] | [.createdAt, .platform, .method, .path, .responseStatus, .cacheStatus, .credits] | @tsv'
|
|
294
320
|
|
|
295
321
|
# Command schema.
|
|
296
322
|
social schema
|