@usesocial/cli 0.7.1 → 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 CHANGED
@@ -1,5 +1,22 @@
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
+
3
20
  ## 0.7.1
4
21
 
5
22
  ### Patch 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 handles, profile/post/conversation/company URLs, LinkedIn URNs,
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 @handle < note.txt
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
- ## Your data is local
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 sender_handle, text, datetime(created_at/1000,'unixepoch') AS at FROM x_messages ORDER BY created_at DESC LIMIT 20" \
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 `sender_handle` from the `x_messages` view; no extra
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
@@ -117,26 +144,25 @@ profile lookup is needed.
117
144
  | `billing portal` | Open the hosted billing portal and print its URL. | |
118
145
  | `usage` | Aggregate proxy calls and credits. | |
119
146
  | `logs` | Recent proxy calls. | |
120
- | `config cache mode` | Read or set the live-read proxy cache mode. | |
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
 
125
151
  | Command | Description | |
126
152
  | --- | --- | --- |
127
153
  | `profile [target]` | Fetch a profile; omit target for your own account. | |
128
- | `posts <target>` | Live posts for a person or company; target required. Supports `--limit` and `--cursor` from `.meta.cursor`. | |
129
- | `comments <target>` | List a post's comments; supports `--limit` and `--offset`. | |
130
- | `reactions <target>` | List a post's reactions; supports `--limit` and `--offset`. | |
131
- | `connections [target]` | Live connection graph read; omit target for your own account. Supports `--limit` and `--cursor` from `.meta.cursor`. Costs credits. | |
154
+ | `posts <target>` | Live posts for a person or company; target required. | |
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; supports `--limit` and `--offset`. | |
134
- | `search people\|posts\|jobs\|companies <keywords>` | Search LinkedIn; live offset-paginated reads. | |
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 the schema. | |
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 or comment; use `--type` for non-like reactions. | write |
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 the schema. | |
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 |
@@ -184,7 +210,7 @@ profile lookup is needed.
184
210
  ```sh
185
211
  # SQL insight: synced contacts you have never messaged.
186
212
  # Run `social linkedin sync connections` and `social linkedin sync messages` first.
187
- social linkedin sql "SELECT c.user_display_name, c.user_public_identifier, 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" \
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" \
188
214
  | jq '.items[]'
189
215
 
190
216
  # Live fan-out: review recent posts, fan out to reactions, rank warm contacts.
@@ -192,8 +218,8 @@ social linkedin posts profile_id:<profile-id> --limit 25 > /tmp/recent-posts.jso
192
218
  jq -r '.items[].id' /tmp/recent-posts.json \
193
219
  | xargs -I{} social linkedin reactions post_id:{} --limit 100 --offset 0 \
194
220
  | jq -s '[ .[] | .items[] ]
195
- | group_by(.actor.id // .reactor.id // .profile_id)
196
- | map({person: (.[0].actor // .[0].reactor), signals: length})
221
+ | group_by(.sender.id)
222
+ | map({person: .[0].sender, signals: length})
197
223
  | sort_by(-.signals) | .[0:15]'
198
224
  ```
199
225
 
@@ -206,7 +232,7 @@ jq -r '.items[].id' /tmp/recent-posts.json \
206
232
  | `3` | Not found | Check the resource ID or pick a different item. |
207
233
  | `4` | Auth or scope error | Run `social account login`, or log out and choose the needed scope. |
208
234
  | `5` | API, proxy, or unexpected error | Retry later or surface the server error. |
209
- | `7` | Rate limited | Back off, using `retryAfterSeconds` when present. |
235
+ | `7` | Rate limited | Back off, using `retryAfterSeconds`, `resumeAt`, and `retryCommand` when present. |
210
236
 
211
237
  ## Auth
212
238
 
@@ -230,26 +256,22 @@ The proxy cache applies to live reads only. Cache hits are free; fresh upstream
230
256
  reads are metered. Configure the default:
231
257
 
232
258
  ```sh
233
- social account config cache mode
234
- social account config cache mode live
235
- social account config cache mode analytical
236
- social account config cache mode historical
237
259
  social account config cache ttl 3600
238
260
  ```
239
261
 
240
262
  Override one live read when the command lists `--header`:
241
263
 
242
264
  ```sh
243
- social linkedin profile @handle -H "Cache-Control: no-cache"
244
- social linkedin profile @handle -H "Cache-Control: no-store"
245
- social linkedin profile @handle -H "Cache-Control: max-age=60"
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"
246
268
  ```
247
269
 
248
270
  The local mirror is separate: run `sync` when you want newer local data, then
249
271
  query it with `sql`. SQL reads show local freshness in `meta.cache.tables`:
250
272
 
251
273
  ```sh
252
- social x sql "SELECT sender_handle, text FROM x_messages ORDER BY created_at DESC LIMIT 5" \
274
+ social x sql "SELECT sender_username, text FROM x_messages ORDER BY created_at DESC LIMIT 5" \
253
275
  | jq '{cost: .meta.cost, cache: .meta.cache}'
254
276
  social x timeline --limit 20 | jq '{cost: .meta.cost, cursor: .meta.cursor, cache: .meta.cache}'
255
277
  ```
@@ -263,8 +285,8 @@ Agents should watch `.meta.cost` during high-fanout loops, use
263
285
  ```sh
264
286
  # LinkedIn local mirror.
265
287
  social linkedin sync messages
266
- social linkedin sql "SELECT sender_display_name, text, datetime(timestamp/1000,'unixepoch') AS at FROM li_messages ORDER BY timestamp DESC LIMIT 20"
267
- social linkedin sql "SELECT user_display_name, user_public_identifier FROM li_requests WHERE type='received' ORDER BY created_at DESC LIMIT 25"
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"
268
290
 
269
291
  # LinkedIn live reads.
270
292
  social linkedin profile
@@ -275,7 +297,7 @@ social linkedin reactions post_id:<post-id> --limit 100 --offset 0
275
297
 
276
298
  # X local mirror.
277
299
  social x sync messages
278
- social x sql "SELECT sender_handle, text FROM x_messages ORDER BY created_at DESC LIMIT 20"
300
+ social x sql "SELECT sender_username, text FROM x_messages ORDER BY created_at DESC LIMIT 20"
279
301
  social x sql "SELECT text, url FROM x_bookmarks ORDER BY created_at DESC LIMIT 50"
280
302
  social x sql "SELECT username, name, followers_count FROM x_followers ORDER BY followers_count DESC LIMIT 100"
281
303