+Legend:
+- [ ] not started
+- [-] in-progress
+- [x] done
+- [~] cancelled
+
+In-progress
+-----------
+
+- [-] Convert to Typed Racket
+ - [x] build executable (otherwise too-slow)
+ - [-] add signatures
+ - [x] top-level
+ - [ ] inner
+ - [ ] imports
+- [-] commands:
+ - [x] c | crawl
+ Discover new peers mentioned by known peers.
+ - [x] r | read
+ - see timeline ops above
+ - [ ] w | write
+ - arg or stdin
+ - nick expand to URI
+ - Watch FIFO for lines, then read, timestamp and append [+ upload].
+ Can be part of a "live" mode, along with background polling and
+ incremental printing. Sort of an ii-like IRC experience.
+ - [ ] q | query
+ - see timeline ops above
+ - see hashtag and channels above
+ - [x] d | download
+ - [ ] options:
+ - [ ] all - use all known peers
+ - [ ] fast - all except peers known to be slow or unavailable
+ REQUIRES: stats
+ - [x] u | upload
+ - calls user-configured command to upload user's own timeline file to their server
+ Looks like a better CLI parser than "racket/cmdline": https://docs.racket-lang.org/natural-cli/
+ But it is no longer necessary now that I've figured out how to chain (command-line ..) calls.
+- [-] Output formats:
+ - [x] text long
+ - [x] text short
+ - [ ] HTML
+ - [ ] JSON
+- [-] Peer discovery
+ - [-] parse peer refs from peer timelines
+ - [x] mentions from timeline messages
+ - [x] @<source.nick source.url>
+ - [x] @<source.url>
+ - [ ] "following" from timeline comments: # following = <nick> <uri>
+ - [ ] Parse User-Agent web access logs.
+ - [-] Update peer ref file(s)
+ - [x] peers-all
+ - [x] peers-mentioned
+ - [ ] peers-followed (by others, parsed from comments)
+ - [ ] peers-down (net errors)
+ - [ ] redirects?
+ Rough sketch from late 2019:
+ let read file =
+ ...
+ let write file peers =
+ ...
+ let fetch peer =
+ (* Fetch could mean either or both of:
+ * - fetch peer's we-are-twtxt.txt
+ * - fetch peer's twtxt.txt and extract mentioned peer URIs
+ * *)
+ ...
+ let test peers =
+ ...
+ let rec discover peers_old =
+ let peers_all =
+ Set.fold peers_old ~init:peers_old ~f:(fun peers p ->
+ match fetch p with
+ | Error _ ->
+ (* TODO: Should p be moved to down set here? *)
+ log_warning ...;
+ peers
+ | Ok peers_fetched ->
+ Set.union peers peers_fetched
+ )
+ in
+ if Set.empty (Set.diff peers_old peers_all) then
+ peers_all
+ else
+ discover peers_all
+ let rec loop interval peers_old =
+ let peers_all = discover peers_old in
+ let (peers_up, peers_down) = test peers_all in
+ write "peers-all.txt" peers_all;
+ write "peers-up.txt" peers_up;
+ write "peers-down.txt" peers_down;
+ sleep interval;
+ loop interval peers_all
+ let () =
+ loop (Sys.argv.(1)) (read "peers-all.txt")