@usesocial/cli 0.2.6 → 0.3.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 +14 -0
- package/README.md +75 -27
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +372 -206
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @usesocial/cli
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#10](https://github.com/usesocial/monorepo/pull/10) [`66a94e1`](https://github.com/usesocial/monorepo/commit/66a94e1196aebd9758e9e063cdbaab299db1e5cd) Thanks [@CyrusNuevoDia](https://github.com/CyrusNuevoDia)! - **BREAKING:** Body text is now pipe-only. The freeform body-text positional has been removed from every text-bearing write command — X `post`/`message`, LinkedIn `post`/`comment`/`message`/`message edit`, and the LinkedIn connection-request note (`requests send`). Post/comment/message body text is now read from stdin (or `--body '<json>'`); the structured target/typed-ID positionals (e.g. `message <target>`, `comment <post>`) stay on argv.
|
|
8
|
+
|
|
9
|
+
Pipe the content: `echo "..." | social x post`, `social linkedin post < file.txt`, `pbpaste | social linkedin message <target>`. A single trailing newline is trimmed; internal newlines and tabs are preserved. `--body` remains the structured escape hatch and its fields merge with the stdin text. If a command needs body text and stdin is an interactive TTY with no `--body`, it fails fast with a pipe hint instead of blocking on an interactive read. The connection-request note stays optional (omit stdin to send no note).
|
|
10
|
+
|
|
11
|
+
Schema and `--help` no longer advertise a text positional; commands that source body text from stdin are marked with `inputSource: "stdin"` in the generated schema so agents know to pipe.
|
|
12
|
+
|
|
13
|
+
Migration: replace `social x post "text"` with `echo "text" | social x post` (same for `linkedin post`, `comment`, `message`, `message edit`, and `requests send`).
|
|
14
|
+
|
|
15
|
+
- [#10](https://github.com/usesocial/monorepo/pull/10) [`f4c316c`](https://github.com/usesocial/monorepo/commit/f4c316cbc9fe485162d69d459b665929a7228812) Thanks [@CyrusNuevoDia](https://github.com/CyrusNuevoDia)! - Allow newlines and tabs in post/message body text, and accept body text piped via stdin (e.g. `pbpaste | social x post`). Identifier fields (handles, IDs, query params) still reject control characters.
|
|
16
|
+
|
|
3
17
|
## 0.2.6
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -51,11 +51,14 @@ A few of the things the command surface supports:
|
|
|
51
51
|
## Commands
|
|
52
52
|
|
|
53
53
|
The main command surfaces print compact JSON by default. List commands commonly
|
|
54
|
-
accept `--limit`
|
|
55
|
-
|
|
54
|
+
accept `--limit` plus either `--cursor` or `--offset`; LinkedIn list reads use
|
|
55
|
+
`--offset`, while LinkedIn messages and X reads use `--cursor`. Pass `--help` on
|
|
56
|
+
any subcommand for the full flag list, or run `social schema "<command path>"`
|
|
56
57
|
for the machine-readable contract for a runnable command. Agents planning across
|
|
57
58
|
many calls can run `social schema --leaves` for a manifest of runnable commands
|
|
58
|
-
keyed by command path.
|
|
59
|
+
keyed by command path. For example, `social schema "linkedin requests received"`
|
|
60
|
+
reports offset pagination, while `social schema "linkedin messages"` reports
|
|
61
|
+
cursor pagination.
|
|
59
62
|
|
|
60
63
|
Commands marked **✎ write** mutate your account and require an explicit write
|
|
61
64
|
scope (see [Account safety](#account-safety)).
|
|
@@ -64,10 +67,25 @@ scope (see [Account safety](#account-safety)).
|
|
|
64
67
|
|
|
65
68
|
Commands with `[target]` or `<target>` accept `@handle` or `@public-identifier`,
|
|
66
69
|
a full X/LinkedIn URL, a LinkedIn URN, or a typed ID such as `profile_id:<id>`,
|
|
67
|
-
`post_id:<id>`, `list_id:<id>`, `chat_id:<id>`, `company_id:<id>`, or `request_id:<id>`. Bare IDs are not
|
|
70
|
+
`post_id:<id>`, `list_id:<id>`, `chat_id:<id>`, `conversation_id:<id>`, `company_id:<id>`, or `request_id:<id>`. Bare IDs are not
|
|
68
71
|
accepted. When an optional target is omitted, the command acts on your own
|
|
69
72
|
connected account.
|
|
70
73
|
|
|
74
|
+
### Body text
|
|
75
|
+
|
|
76
|
+
Commands that create a post, comment, message, or connection note read the body
|
|
77
|
+
from **stdin** — there is no text argument. Pipe it in, or pass a raw `--body`
|
|
78
|
+
JSON object:
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
echo "gm" | social x post
|
|
82
|
+
social linkedin post < draft.md
|
|
83
|
+
social linkedin requests send @handle < note.txt # optional connection note
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
On an interactive terminal with nothing piped (and no `--body`), these commands
|
|
87
|
+
fail fast rather than hang.
|
|
88
|
+
|
|
71
89
|
### Top level
|
|
72
90
|
|
|
73
91
|
| Command | Description |
|
|
@@ -101,26 +119,26 @@ connected account.
|
|
|
101
119
|
|
|
102
120
|
| Command | Description | |
|
|
103
121
|
|---|---|---|
|
|
104
|
-
| `post
|
|
105
|
-
| `comment <target
|
|
122
|
+
| `post` | Create a post (body from stdin). | ✎ write |
|
|
123
|
+
| `comment <target>` | Comment on a post (body from stdin). | ✎ write |
|
|
106
124
|
| `react <target> [type=like]` | React to a post or comment. | ✎ write |
|
|
107
|
-
| `requests send <target
|
|
108
|
-
| `requests sent` | List pending sent connection requests; supports `--limit`, `--
|
|
109
|
-
| `requests received` | List pending received connection requests; supports `--limit`, `--
|
|
125
|
+
| `requests send <target>` | Send a connection request (optional note from stdin). | ✎ write |
|
|
126
|
+
| `requests sent` | List pending sent connection requests; supports `--limit`, `--offset`, and `-H/--header`. | |
|
|
127
|
+
| `requests received` | List pending received connection requests; supports `--limit`, `--offset`, and `-H/--header`. | |
|
|
110
128
|
| `requests accept request_id:<id>` | Accept a received connection request. | ✎ write |
|
|
111
129
|
| `requests cancel request_id:<id>` | Cancel a sent request or refuse a received connection request. | ✎ write |
|
|
112
|
-
| `posts [target]` | List a user's or company's posts; omit the target for your own account. | |
|
|
113
|
-
| `comments <target>` | List a post's comments
|
|
114
|
-
| `reactions <target>` | List a post's reactions
|
|
130
|
+
| `posts [target]` | List a user's or company's posts; supports `--limit` and `--offset`; omit the target for your own account. | |
|
|
131
|
+
| `comments <target>` | List a post's comments; supports `--limit` and `--offset`. | |
|
|
132
|
+
| `reactions <target>` | List a post's reactions; supports `--limit` and `--offset`. | |
|
|
115
133
|
| `profile [target]` | Fetch a profile; omit the target for your own account. | |
|
|
116
|
-
| `connections [target]` | List connections; omit the target for account-level connections. | |
|
|
134
|
+
| `connections [target]` | List connections; supports `--limit` and `--offset`; omit the target for account-level connections. | |
|
|
117
135
|
| `company <target>` | Fetch a company profile. | |
|
|
118
|
-
| `jobs <target>` | List a company's job postings
|
|
136
|
+
| `jobs <target>` | List a company's job postings; supports `--limit` and `--offset`. | |
|
|
119
137
|
| `messages` | List conversations. | |
|
|
120
138
|
| `messages <target>` | Read a conversation by `chat_id:<id>`, `@handle`, `profile_id:<id>`, profile URL, or messaging-thread URL. | |
|
|
121
|
-
| `message <target
|
|
139
|
+
| `message <target>` | Send a message (body from stdin). | ✎ write |
|
|
122
140
|
| `message <target> delete message_id:<id>` | Delete one of your own messages. | ✎ write |
|
|
123
|
-
| `message <target> edit message_id:<id
|
|
141
|
+
| `message <target> edit message_id:<id>` | Edit one of your own messages (new text from stdin). | ✎ write |
|
|
124
142
|
| `messages <target> mark read` | Mark a conversation read. | ✎ write |
|
|
125
143
|
| `messages <target> mark unread` | Mark a conversation unread. | ✎ write |
|
|
126
144
|
|
|
@@ -128,38 +146,47 @@ connected account.
|
|
|
128
146
|
|
|
129
147
|
| Command | Description | |
|
|
130
148
|
|---|---|---|
|
|
131
|
-
| `post
|
|
149
|
+
| `post` | Create a post (body from stdin). | ✎ write |
|
|
150
|
+
| `delete <target>` | Delete one of your own posts. | ✎ write |
|
|
132
151
|
| `repost <target>` · `unrepost <target>` | Repost or undo a repost. | ✎ write |
|
|
152
|
+
| `reposters <target>` | List users who reposted a post. | |
|
|
153
|
+
| `quotes <target>` | List quote posts of a post. | |
|
|
154
|
+
| `replies <target>` | List replies to a post; accepts `post_id:<id>`, `conversation_id:<id>`, or a post URL. | |
|
|
133
155
|
| `like <target>` · `unlike <target>` | Like or unlike a post. | ✎ write |
|
|
156
|
+
| `liked [target]` | List posts a user has liked; omit the target for your own account. | |
|
|
157
|
+
| `likers <target>` | List users who liked a post. | |
|
|
134
158
|
| `follow <target>` · `unfollow <target>` | Follow or unfollow a user. | ✎ write |
|
|
135
159
|
| `followers [target]` | List a user's followers; omit the target for your own account. | |
|
|
136
160
|
| `following [target]` | List accounts a user follows; omit the target for your own account. | |
|
|
137
161
|
| `tweet <target>` | Fetch a single post. | |
|
|
138
162
|
| `tweets [target]` | List a user's recent posts; omit the target for your own account. | |
|
|
163
|
+
| `mentions [target]` | List posts mentioning a user; omit the target for your own account. | |
|
|
139
164
|
| `profile [target]` | Fetch a profile; omit the target for your own account. | |
|
|
140
165
|
| `timeline` | Read the home timeline. | |
|
|
166
|
+
| `bookmarks` | List your saved bookmarks. | |
|
|
141
167
|
| `bookmark <target>` · `unbookmark <target>` | Add or remove a bookmark. | ✎ write |
|
|
142
168
|
| `messages` | List conversations. | |
|
|
143
169
|
| `messages <target>` | Read a DM conversation or participant target: chat URL, `chat_id:<id>`, `@handle`, profile URL, or `profile_id:<id>`. | |
|
|
144
|
-
| `message <recipients
|
|
170
|
+
| `message <recipients>` | Send a DM (body from stdin) to a chat URL, `chat_id:<id>`, `@handle`, profile URL, or `profile_id:<id>`; comma-separate profile targets for a group. | ✎ write |
|
|
145
171
|
|
|
146
172
|
## Built for agents
|
|
147
173
|
|
|
148
174
|
- **Everything speaks JSON.** Pipe output through `jq`, `fzf`, or your agent's
|
|
149
175
|
planner — anything that reads stdin. Structured errors and predictable exit
|
|
150
176
|
codes mean an agent can branch on what happened.
|
|
151
|
-
- **
|
|
152
|
-
|
|
153
|
-
|
|
177
|
+
- **Schema-backed pagination.** Use `--offset` for LinkedIn list reads,
|
|
178
|
+
`--cursor` for LinkedIn messages and X reads, and `--limit` to bound pages.
|
|
179
|
+
Cacheable reads also list `-H/--header` for proxy cache headers such as
|
|
180
|
+
`Cache-Control: no-cache`.
|
|
154
181
|
- **A skill you drop straight in.** Install the public skill repo with
|
|
155
182
|
`npx skills add usesocial/skill`; Claude, Codex, or any other supported agent
|
|
156
183
|
then knows the commands.
|
|
157
184
|
|
|
158
185
|
```sh
|
|
159
186
|
# Review recent LinkedIn posts, fan out to reaction graphs, rank warm contacts.
|
|
160
|
-
social linkedin posts --limit 25 > /tmp/recent-posts.json
|
|
187
|
+
social linkedin posts --limit 25 --offset 0 > /tmp/recent-posts.json
|
|
161
188
|
jq -r '.items[].id' /tmp/recent-posts.json \
|
|
162
|
-
| xargs -I{} social linkedin reactions post_id:{} \
|
|
189
|
+
| xargs -I{} social linkedin reactions post_id:{} --limit 100 --offset 0 \
|
|
163
190
|
| jq -s '[ .[] | .items[] ]
|
|
164
191
|
| group_by(.actor.id // .reactor.id // .profile_id)
|
|
165
192
|
| map({person: (.[0].actor // .[0].reactor), signals: length})
|
|
@@ -214,14 +241,28 @@ social account config cache ttl 3600 # custom TTL in seconds
|
|
|
214
241
|
```
|
|
215
242
|
|
|
216
243
|
Setting `ttl` switches the mode to `custom`. Config is stored at
|
|
217
|
-
`~/.social/config.json` with mode `0600`.
|
|
218
|
-
|
|
219
|
-
|
|
244
|
+
`~/.social/config.json` with mode `0600`.
|
|
245
|
+
|
|
246
|
+
Use command-level request headers to override freshness for a single read when a
|
|
247
|
+
command lists `--header` in help:
|
|
248
|
+
|
|
249
|
+
```sh
|
|
250
|
+
social linkedin profile @handle -H "Cache-Control: no-cache" # bypass cache read, refresh cache
|
|
251
|
+
social linkedin profile @handle -H "Cache-Control: no-store" # bypass cache read and write
|
|
252
|
+
social linkedin profile @handle -H "Cache-Control: max-age=60" # override TTL for this request
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
`Cache-Control` is the functional request cache surface. Cached responses may
|
|
256
|
+
preserve validators such as `ETag` and `Last-Modified` when the upstream returns
|
|
257
|
+
them, but the CLI does not expose conditional revalidation semantics; use
|
|
258
|
+
`Cache-Control: no-cache` when you need a fresh upstream read.
|
|
220
259
|
|
|
221
260
|
Command output exposes actual per-call cost and pagination under `meta`:
|
|
222
261
|
|
|
223
262
|
```sh
|
|
224
|
-
social linkedin
|
|
263
|
+
social linkedin reactions post_id:<post-id> --limit 100 --offset 0 \
|
|
264
|
+
| jq '{cost: .meta.cost, totalCount: .meta.totalCount}'
|
|
265
|
+
social linkedin messages --limit 20 | jq '{cost: .meta.cost, cursor: .meta.cursor}'
|
|
225
266
|
social x bookmarks --limit 20 | jq '{cost: .meta.cost, cursor: .meta.cursor}'
|
|
226
267
|
```
|
|
227
268
|
|
|
@@ -244,6 +285,8 @@ Built so your accounts outlive your prototype.
|
|
|
244
285
|
```sh
|
|
245
286
|
# LinkedIn
|
|
246
287
|
social linkedin profile
|
|
288
|
+
social linkedin requests received --limit 25 --offset 0
|
|
289
|
+
social linkedin requests sent --limit 25 --offset 0
|
|
247
290
|
|
|
248
291
|
# X
|
|
249
292
|
social x bookmarks --limit 50
|
|
@@ -251,6 +294,10 @@ social x followers --limit 100
|
|
|
251
294
|
social x following profile_id:<x-user-id> --limit 100
|
|
252
295
|
social x messages --limit 50
|
|
253
296
|
|
|
297
|
+
# Writes (body via stdin)
|
|
298
|
+
echo "gm" | social x post
|
|
299
|
+
social linkedin post < draft.md
|
|
300
|
+
|
|
254
301
|
# Usage / billing
|
|
255
302
|
social account usage
|
|
256
303
|
social account logs --limit 20 --from 2026-05-01T00:00:00Z
|
|
@@ -258,6 +305,7 @@ social account logs --limit 20 --from 2026-05-01T00:00:00Z
|
|
|
258
305
|
# Command schema
|
|
259
306
|
social schema
|
|
260
307
|
social schema --leaves
|
|
308
|
+
social schema "linkedin requests received"
|
|
261
309
|
social schema "x post"
|
|
262
310
|
```
|
|
263
311
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1395,6 +1395,8 @@ declare const createSocialCommand: (deps?: {
|
|
|
1395
1395
|
api: KyInstance;
|
|
1396
1396
|
parseResourceId: (name: string, value: unknown) => string;
|
|
1397
1397
|
parseQueryString: (name: string, value: unknown) => string;
|
|
1398
|
+
parseBodyText: (name: string, value: unknown) => string;
|
|
1399
|
+
readStdin: () => Promise<string>;
|
|
1398
1400
|
parseIntegerString: (name: string, value: unknown, options?: {
|
|
1399
1401
|
min?: number;
|
|
1400
1402
|
max?: number;
|