1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
|
.\" Generated by scdoc 1.11.1
.\" Complete documentation for this program is not available as a GNU info page
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.nh
.ad l
.\" Begin generated content:
.TH "adenosine" "1" "2022-11-07" "adenosine CLI Client Manual Page"
.P
.SH NAME
.P
adenosine - command-line client for AT protocol (atproto.\&com)
.P
.SH SYNOPSIS
.P
adenosine [OPTIONS] <COMMAND> <ARGS>
.P
.SH DESCRIPTION
.P
This is a simple, enthusiast-grade CLI client for the work-in-progress AT
Protocol (atproto.\&com).\& It is an entirely "delegated" client, which means that
it does not store or cache any user content locally; everything works by making
HTTP/XRPC requests to a Personal Data Server (PDS), which is usually a remote
service.\&
.P
The only real utility of this tool currently is messing around with prototype
implementations, possibly while developing them.\&
.P
This client does not currently do any schema validation of Lexicons, either at
compile time or runtime (eg, dynamically fetching Lexicons).\& The Bluesky
Lexicon (bsky.\&app) is partially supported with helper commands.\&
.P
.SH FIELD SYNTAX
.P
Several commands accept generic key/value fields which are passed through as
either query parameters or combined together in to a request body JSON object.\&
Escaping and other corner-cases aren't handled.\&
.P
\fB==\fR
.RS 4
Query parameter.\& Key and Value both passed as strings.\&
.P
.RE
\fB=\fR
.RS 4
Body fields, combined together as a JSON object.\& Keys are strings, values are parsed as JSON with fall-through to string type.\&
.P
.RE
For example, the argument list \fBlimit==25 title="regarding documentation" year=2022 tags='["blue", "green"]'\fR
would be interpreted as a single query parameter "limit" with value "25", and a
JSON object with keys "title" (string value), "year" (number value), "tags"
(array of strings).\&
.P
.SH COMMANDS
.P
\fBstatus\fR
.RS 4
Summarizes configuration, and (TODO) connection and authentication to the API server.\& Useful for debugging.\&
.P
.RE
\fBdescribe\fR [name]
.RS 4
Prints repository description fetched from PDS
.P
.RE
\fBresolve\fR <name>
.RS 4
Has PDS resolve handle to a DID
.P
.RE
.SS Generic XRPC Requests
.P
It is possible to construct and submit a generic XRPC request to the PDS, and
prints any response.\&See field syntax section above about query parameters and
body fields.\& Body fields only used for "post" requests.\&
.P
\fBxrpc\fR <"get"|"post"> <nsid> [fields]+
.P
.SS Generic Record Interaction
.P
\fBls\fR <at-uri>
.RS 4
List either collections under a repository, or records under a collection
.P
.RE
\fBget\fR <at-uri>
.RS 4
Fetch and print a single record
.P
.RE
\fBcreate\fR <collection> [fields].\&.\&.\&
.RS 4
Construct and create a generic record, printing the resulting AT-URI and CID
.P
.RE
\fBupdate\fR <at-uri> [fields].\&.\&.\&
.RS 4
Fetch record, update fields, "put" back to same record path
.P
.RE
\fBdelete\fR <at-uri>
.RS 4
Delete a single record from repository
.P
.RE
.SS Bluesky (bsky.app)
.P
\fBbsky feed\fR
.RS 4
Fetch the home feed, or account feed for a specific user
.P
.RE
\fBbsky follow\fR
.RS 4
Create a 'follow' record for the target by AT URI
.P
.RE
\fBbsky like\fR
.RS 4
Create a 'like' record for the target by AT URI
.P
.RE
\fBbsky notifications\fR
.RS 4
Fetch notification feed
.P
.RE
\fBbsky post\fR
.RS 4
Create a new 'post' record
.P
.RE
\fBbsky profile\fR
.RS 4
Display a profile record (or self if not provided)
.P
.RE
\fBbsky repost\fR
.RS 4
Create a 'repost' record for the target by AT URI
.P
.RE
\fBbsky search-users\fR
.RS 4
Query by partial handle
.P
.P
.RE
.SS Account Management
.P
\fBaccount register --email <email> --password <password> --handle <handle>\fR
.P
\fBaccount info\fR
.RS 4
Fetches account metadata for the current session
.P
.RE
\fBaccount login --password <password> --handle <handle>\fR
.RS 4
Create a new authenticated session
.P
.RE
\fBaccount logout\fR
.RS 4
Deletes the current login session
.P
.RE
.SS Raw Repository Management
.P
\fBrepo export [did]\fR
.RS 4
Dump raw binary repository as CAR format to stdout
.P
.RE
\fBrepo import [did]\fR
.RS 4
Read raw binary repository as CAR format from stdin, and import to PDS
.P
.RE
\fBrepo root [did]\fR
.RS 4
Get the current 'root' commit for a DID
.P
.RE
.SH OPTIONS
.P
\fB-h, --help\fR
.RS 4
Prints help information
.P
.RE
\fB-V, --version\fR
.RS 4
Prints version information
.P
.RE
\fB-v, --verbose\fR
.RS 4
Pass many times for more log output
By default, it'll only report errors.\& Passing `-v` one time also prints warnings, `-vv` enables info logging, `-vvv` debug, and `-vvvv` trace.\&
.P
.RE
\fB--host <atp-host>\fR [env: ATP_HOST]
.P
\fB--auth-token <auth-token>\fR [env: ATP_AUTH_TOKEN]
.P
.SH GETTING STARTED
.P
To start interacting with a PDS, set the `ATP_HOST` environment variable.\& Then
either register a test account, or create a new session for an existing
account, and save the JWT token to the `ATP_AUTH_TOKEN`:
.P
.nf
.RS 4
# default port for bluesky-social/atproto implementation
export ATP_HOST=http://localhost:2583
# register a new account
adenosine account register -u voltaire\&.test -p bogus -e voltaire@example\&.com
{
"did": "did:plc:yqtuksvatmmgngd5nkkw75hn",
"jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9\&.eyJzdWIiOiJkaWQ6cGxjOnlxdHVrc3ZhdG1tZ25nZDVua2t3NzVobiIsImlhdCI6MTY2Njk5NjMwNn0\&.MMQa4JIQdwvhy-rjJ0kO-z8-KdoOL0Lto9JtOkK-lwE",
"handle": "voltaire\&.test"
}
export ATP_AUTH_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9\&.eyJzdWIiOiJkaWQ6cGxjOnlxdHVrc3ZhdG1tZ25nZDVua2t3NzVobiIsImlhdCI6MTY2Njk5NjMwNn0\&.MMQa4JIQdwvhy-rjJ0kO-z8-KdoOL0Lto9JtOkK-lwE
# to clear the auth token env variable
unset ATP_AUTH_TOKEN
# create a new session (login) for existing account
adenosine account login -u voltaire\&.test -p bogus
{
"did": "did:plc:yqtuksvatmmgngd5nkkw75hn",
"jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9\&.eyJzdWIiOiJkaWQ6cGxjOnlxdHVrc3ZhdG1tZ25nZDVua2t3NzVobiIsImlhdCI6MTY2Njk5NjQxNX0\&.j2wcF1g9NxT_1AvYRiplNf_jtK6S81y3L38AkcBwOqY",
"name": "voltaire\&.test"
}
export ATP_AUTH_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9\&.eyJzdWIiOiJkaWQ6cGxjOnlxdHVrc3ZhdG1tZ25nZDVua2t3NzVobiIsImlhdCI6MTY2Njk5NjQxNX0\&.j2wcF1g9NxT_1AvYRiplNf_jtK6S81y3L38AkcBwOqY
.fi
.RE
.P
You could save the `ATP_HOST` and `ATP_AUTH_TOKEN` values in `~/.\&bashrc` so you
don't need to enter them every time.\&
.P
Now you can start posting and poking around:
.P
.nf
.RS 4
adenosine bsky post "gruel again for breakfast"
{
"cid": "bafyreig2aqlsg4arslck64wbo2hnhe6k2a4z3z2sjfzh3uapv3a4zjld7e",
"uri": "at://did:plc:yqtuksvatmmgngd5nkkw75hn/app\&.bsky\&.post/3jg5zkr322c2a"
}
adenosine ls at://voltaire\&.test
app\&.bsky\&.post
.fi
.RE
|