this repo has no description
1`goat`: Go AT protocol CLI tool
2===============================
3
4**NOTE: this project is moving to a dedicated git repo at [bluesky-social/goat](https://github.com/bluesky-social/goat). This copy of the code is deprecated and will eventually be removed, though a notice will remain.**
5
6
7This is a re-implementation of [adenosine-cli](https://gitlab.com/bnewbold/adenosine/-/tree/main/adenosine-cli?ref_type=heads) in golang.
8
9
10## Install
11
12If you have the Go toolchain installed and configured correctly, you can directly build and install the tool for your local account:
13
14```bash
15go install github.com/bluesky-social/goat@latest
16```
17
18A more manual way to install is:
19
20```bash
21git clone https://github.com/bluesky-social/goat
22go build .
23sudo cp goat /usr/local/bin
24```
25
26The intention is to also provide a Homebrew "cask" and Debian/Ubuntu packages.
27
28
29## Usage
30
31`goat` is relatively self-documenting via help pages:
32
33```bash
34goat --help
35goat bsky -h
36goat help bsky
37# etc
38```
39
40Most commands use public APIs are don't require authentication. Some commands, like creating records, require an atproto account. You can log in using an "app password" with `goat account login -u <handle> -p <app-password>`.
41
42WARNING: `goat` will store both the app password and authentication tokens in the current users home directory, in cleartext. `goat logout` will wipe the file. Intention is to eventually support configuration via environment variables to keep sensitive state in a password manager or otherwise not-cleartext-on-disk.
43
44Some commands output JSON, and you can use tools like `jq` to process them.
45
46## Examples
47
48Resolve an account's identity in the network:
49
50```bash
51$ goat resolve wyden.senate.gov
52{
53 "id": "did:plc:ydtsvzzsl6nlfkmnuooeqcmc",
54 "alsoKnownAs": [
55 "at://wyden.senate.gov"
56 ],
57 "verificationMethod": [
58 {
59 "id": "did:plc:ydtsvzzsl6nlfkmnuooeqcmc#atproto",
60 "type": "Multikey",
61 "controller": "did:plc:ydtsvzzsl6nlfkmnuooeqcmc",
62 "publicKeyMultibase": "zQ3shuMW7q4KBdsFcdvebGi2EVv8KcqS24tF9Pg7Wh5NLB2NM"
63 }
64 ],
65 "service": [
66 {
67 "id": "#atproto_pds",
68 "type": "AtprotoPersonalDataServer",
69 "serviceEndpoint": "https://shimeji.us-east.host.bsky.network"
70 }
71 ]
72}
73```
74
75List record collection types for an account:
76
77```bash
78$ goat ls -c dril.bsky.social
79app.bsky.actor.profile
80app.bsky.feed.post
81app.bsky.feed.repost
82app.bsky.graph.follow
83chat.bsky.actor.declaration
84```
85
86Fetch a record from the network as JSON:
87
88```bash
89$ goat get at://dril.bsky.social/app.bsky.feed.post/3kkreaz3amd27
90{
91 "$type": "app.bsky.feed.post",
92 "createdAt": "2024-02-06T18:15:19.802Z",
93 "langs": [
94 "en"
95 ],
96 "text": "I do not Fucking recall them asking the blue sky elders permission to open registration to commoners ."
97}
98```
99
100Make a public snapshot of your account:
101
102```bash
103$ goat repo export jay.bsky.team
104downloading from https://morel.us-east.host.bsky.network to: jay.bsky.team.20240811183155.car
105
106$ downloading blobs to: jay.bsky.team_blobs
107jay.bsky.team_blobs/bafkreia2x4faux5y7v7v54yl5ebkbaek7z7nhmsd4cooubz3yj4zox34cq downloaded
108jay.bsky.team_blobs/bafkreia3qgbww7odprmysd6jcyxoh5sczkwoxinnmzpsp73gs623fqfm3a downloaded
109jay.bsky.team_blobs/bafkreia3rgnywdrysy65vid42ulyno2cybxhxrn3ragm7cw3smmsxzvbs4 downloaded
110[...]
111```
112
113Show PLC history for a single account, or make a snapshot of all PLC records (this takes a while), or monitor new ops:
114
115```bash
116$ goat plc history atproto.com
117[...]
118
119$ goat plc dump | pv -l | gzip > plc_snapshot.json.gz
120[...]
121
122$ goat plc dump --cursor now --tail
123[...]
124```
125
126Verify syntax and generate TIDs:
127
128```bash
129$ goat syntax handle check xn--fiqa61au8b7zsevnm8ak20mc4a87e.xn--fiqs8s
130valid
131
132$ goat syntax rkey check dHJ1ZQ==
133error: recordkey syntax didn't validate via regex
134
135$ goat syntax tid inspect 3kzifvcppte22
136Timestamp (UTC): 2024-08-12T02:08:03.29Z
137Timestamp (Local): 2024-08-11T19:08:03-07:00
138ClockID: 0
139uint64: 0x187dcbda2b5ca800
140```
141
142The `firehose` commands subscribes to the repo commit stream from a Relay. The default stream outputs event metadata, but doesn't include record blocks (bytes). The `--ops` variant will unpack records and output one line per record operation (instead of one line per commit event), and includes the record values themselves. Some example invocations:
143
144```bash
145# possible handle updates
146$ goat firehose --account-events | jq .payload.handle
147[...]
148
149# text of posts (empty lines for post-deletions)
150$ goat firehose - app.bsky.feed.post --ops | jq .record.text
151[...]
152
153# sample ratio of languages in current posts
154$ goat firehose --ops -c app.bsky.feed.post | head -n100 | jq .record.langs[0] -c | sort | uniq -c | sort -nr
155 51 "en"
156 33 "ja"
157 7 null
158 3 "pt"
159 2 "ko"
160 1 "th"
161 1 "id"
162 1 "es"
163 1 "am"
164```
165
166A minimal bsky posting interface, requires account login:
167
168```bash
169$ goat bsky post "hello from goat"
170```