nandi/frqpublic Fork 0
627b785fbf6cef0c29d54b82a1ffb5e870ca9f51
Commits
Clone
git clone https://git.rickub.com/nandi/frq.git
git clone ssh://git@rickub.com/nandi/frq.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

CLAUDE.md · 140 lines · 6.6 KBmarkdown Blame HistoryRaw
Read the clock in the reader's zone when /etc/localtime is a file bffe879 nandi 19d ago1# Working in this repo
2
Six verbs, and the last of the nix 2e24e64 nandi yesterday3## The toolchain, and where builds happen
Read the clock in the reader's zone when /etc/localtime is a file bffe879 nandi 19d ago4
The last of the Clojure 284b59c nandi 22h ago5There is no nix in the build. `tools/toolchain.sh` fetches Flutter (which
6carries Dart) and Nim as sha256-pinned tarballs into `.toolchain/`, and every
7`just` recipe runs inside the environment that script prints. The host brings
8a C compiler, OpenSSL, git, curl, unzip and python3 — and GTK with the usual
9CMake/Ninja/pkg-config for the Linux target.
10
11It used to carry a JDK, the Clojure CLI, a maven repo and an Android SDK as
12well. Those were ClojureDart's and the APK's, and both are gone.
Six verbs, and the last of the nix 2e24e64 nandi yesterday13
14**Prefer Modal for a long build.** A cold Flutter toolchain plus a full
15compile is a lot of laptop, and the containers in `.modal/` do it on a real
16machine:
Read the clock in the reader's zone when /etc/localtime is a file bffe879 nandi 19d ago17
18```bash
Six verbs, and the last of the nix 2e24e64 nandi yesterday19just modal dev # the incremental Flutter loop
Read the clock in the reader's zone when /etc/localtime is a file bffe879 nandi 19d ago20```
21
One frontend where there were three, and a core that is not Clojure 438b247 nandi yesterday22The containers in `.modal/` are not a third source tree: they are CI config
Six verbs, and the last of the nix 2e24e64 nandi yesterday23that happens to live here, the way `.github/` would be. They run the very same
24`tools/toolchain.sh`, which is why a plain Debian image is enough.
Build the window somewhere with room for it 1451151 nandi 6d ago25
26`modal app logs` is no substitute for watching that command: it resolves
27deployed apps by name, not the ephemeral one a `modal run` creates, and carries
28nothing until the Sandbox starts — the image build streams to the client and
29nowhere else.
30
CI builds the image, Modal serves it 5693bd5 nandi 6h ago31Two containers, and they are not the same kind of thing. `dev` is a build
The registry it pushes to is the one it has 627b785 nandi 6h ago32that ends. `web` is a deploy: rickub builds `.modal/web/Dockerfile` into
33`registry.rickub.com` (`.rickub/workflows/web.yml`), and
34`modal deploy .modal/web/container.py` serves that exact tag at a URL,
35building nothing. So `just build web` on a laptop and the thing
CI builds the image, Modal serves it 5693bd5 nandi 6h ago36on the internet come from the same two commands, run in different places —
37and a deploy is a pull rather than a compile.
38
Six verbs, and the last of the nix 2e24e64 nandi yesterday39The containers run as Modal **Sandboxes on a real VM** rather than under
40gVisor: a real kernel, a working pty, and memory that is exactly what
41`[resources] memory` asks for.
Read the clock in the reader's zone when /etc/localtime is a file bffe879 nandi 19d ago42
Follow the xorg renames, and stop wrapping nix in distrobox a400a00 nandi 17d ago43One thing this container is *not* representative of: `/etc/localtime` is a
44regular file here rather than a symlink, so anything that reads the zone out
Read the clock in the reader's zone when /etc/localtime is a file bffe879 nandi 19d ago45of its path sees nothing. That is a real deployment shape, not an artefact —
46frq.clock handles it.
Split the tree three ways, and let the phone be Flutter's 7070931 nandi 8d ago47
Build the window somewhere with room for it 1451151 nandi 6d ago48## Never pipe a long task through `tail`
49
50`tail` and `head` do not emit anything until their input ends, so a build, a
51test run or a deploy piped through one shows nothing at all until it is over —
52and if it is killed or times out first, its output is lost with it. That is the
53opposite of what you want from the commands that take longest.
54
55Let them write to the terminal, or `tee` them if you want a copy to grep
56afterwards:
57
58```bash
Six verbs, and the last of the nix 2e24e64 nandi yesterday59modal run .modal/web/container.py 2>&1 | tee /tmp/frq-build.log
Build the window somewhere with room for it 1451151 nandi 6d ago60```
61
62Trim afterwards, on the file, where the whole run is still there to re-read.
63The same goes for `grep` and `awk` in a live pipeline: they buffer when their
64output is not a terminal, so pass `--line-buffered` / `fflush()` or watch the
65file instead.
66
One frontend where there were three, and a core that is not Clojure 438b247 nandi yesterday67## The Nim core
68
The last of the Clojure 284b59c nandi 22h ago69`nim/` is the program. It owns the state, the screens, the IRC connection and
70the signing; Flutter is a renderer over the widget tree it emits. Read
71`nim/README.md` before touching it.
One frontend where there were three, and a core that is not Clojure 438b247 nandi yesterday72
73Two rules the ABI has, both of which cost a segfault to rediscover:
74
75* Every string the core returns is the **caller's** to free, with `frq_free`.
76 Nim's allocator is not Dart's.
77* `frq_init` runs once before anything else.
78
The last of the Clojure 284b59c nandi 22h ago79`dart/frq_core` is the other half of that seam. It is a plain Dart package and
80not a Flutter one, deliberately: `flutter/pubspec.yaml` depends on the Flutter
81SDK, so anything living there needs a Flutter toolchain to check one assertion
82about a string, where this resolves and tests on its own.
83
84The rule that used to be here said new Dart-side code is written in Dart
85rather than ClojureDart. There is no ClojureDart left for it to rule against,
86but the reasoning it rested on still holds for the next thing: logic goes in
87Nim, the platform goes in Dart, and neither is written in a third language
88because it is already open.
The binding is Dart, and it works f7aea3b nandi yesterday89
Six verbs, and the last of the nix 2e24e64 nandi yesterday90`just test nim` and `just test dart` need no Flutter, which is most of the
The binding is Dart, and it works f7aea3b nandi yesterday91point: the whole boundary is checkable in about a second.
One frontend where there were three, and a core that is not Clojure 438b247 nandi yesterday92
The last of the Clojure 284b59c nandi 22h ago93There is no `common/` any more, and that rule went with it. It said a module
94stays until there is a wasm build of the core, because a browser has no
A web version, from the same core 23846db nandi 7h ago95dart:ffi. The premise was right and the conclusion was wrong: the answer was
96not wasm but `nim js`, which compiles the same core — state, reducer, every
97screen — to JavaScript that a page loads with a `<script>` tag.
98
99So there is a web target again, `just build web`. What differs from the
100desktop is only the host: `nim/web/frq/*.nim` shadows `nim/src/frq/*.nim` by
101search path (`--path:src --path:web`, later wins), so `frq/conn` is a queue a
102WebSocket fills rather than two socket threads, `frq/store` is localStorage,
103and `frq/crypto` says plainly that it cannot sign. The shared code above them
104imports the same names either way and never learns which host it is on. Dart
105does the same thing one layer up, in `dart/frq_core/lib/src/host.dart`.
One frontend where there were three, and a core that is not Clojure 438b247 nandi yesterday106
The last of the Clojure 284b59c nandi 22h ago107## The source trees
Split the tree three ways, and let the phone be Flutter's 7070931 nandi 8d ago108
109```
A web version, from the same core 23846db nandi 7h ago110nim/src the program: state, screens, IRC, signing
111nim/web the same program's host half, for a browser
112dart/frq_core the binding — plain Dart, not a Flutter package
The last of the Clojure 284b59c nandi 22h ago113flutter/lib the renderer, and the app's entry point
A web version, from the same core 23846db nandi 7h ago114flutter/web the page, and the JavaScript that owns the socket
Split the tree three ways, and let the phone be Flutter's 7070931 nandi 8d ago115```
116
The last of the Clojure 284b59c nandi 22h ago117`nim/src/frq/ui.nim` builds a widget tree; `frq_core` carries it across the
118FFI as JSON; `flutter/lib/nim_renderer.dart` walks it into Flutter widgets.
119The renderer knows the tag vocabulary and nothing else — no screens, no state,
120no idea what "connect" means. If a feature ever needs a change on both sides,
121the boundary is in the wrong place.
122
123There used to be two more trees. `src/` was jolt and libcosmic; `common/` and
124`flutter/src/` were ClojureDart, compiled for Android, Linux and the web. Both
A web version, from the same core 23846db nandi 7h ago125are gone. The APK went with them and has not come back — it wants
126`libfrqcore.so` cross-compiled for Android's ABIs — but the web target has,
127by a different road than the one that was expected: `just build web`.
128
129Three things the web build does not do, all of them written down where they
130are done rather than only here. It cannot sign a message, because Ed25519 in
131a browser is asynchronous and every signature here is wanted inline, so a
132reader is in a guest's position for reactions and edits. It has no
133app-password tab, because that wants a blocking call to the reader's own PDS.
134And it does not keep a broker token, because `localStorage` is readable by
135every script the origin runs.
The last of the Clojure 284b59c nandi 22h ago136
137Two modules were never ported and are gone rather than moved: `frq.profile`
138(the Bluesky profile behind a nick) and `frq.replies` (asking freeq what a
139collapsed msgid was). Neither had a screen in the Nim app to appear on.
140