These instructions are for working on the Tlon app as a developer at Tlon.
-
/desk: The folder containing the desk for %groups. This currently contains the agents necessary for the Tlon app. -
/apps/tlon-web: Tlon is built primarily using React, Typescript, and Tailwind CSS. Vite ensures that all code and assets are loaded appropriately, bundles the application for distribution and provides a functional dev environment.
To get started working on Tlon, run pnpm install in the root directory.
To develop, you'll need a running ship to point to. To do so you first need to add a .env.local file to the apps/tlon-web directory. This file will not be committed. Adding VITE_SHIP_URL={URL} (where {URL} is the URL of the ship you would like to point to) will allow you to run pnpm dev. This will proxy all requests to the ship except for those powering the interface, which lets you work with live data.
Regardless of what you run to develop, Vite will hot-reload code changes as you work so you don't have to constantly refresh.
To get started, make sure your %groups desk is mounted:
|mount %groups
Sync the latest %groups files. assemble-desk.sh vendors the base-dev/landscape
dependencies into desk-deps/ (gitignored — see peru.yaml) and layers them
with our desk/ into the ship's mounted groups desk:
./scripts/assemble-desk.sh ~/urbit/zod/groups
And commit:
|commit %groups
Since %groups has already been released and is now in the pill. It is very unlikely that you would have to create this desk from scratch, but if you do you can follow these instructions.
- Clone or pull latest versions of this repo,
tloncorp/landscapeandurbit/urbit. - Boot a fake ship. Use local networking with
-Flike so:urbit -F zod - Create and mount the appropriate desks on local
~zod:|new-desk %landscape|mount %landscape|new-desk %groups|mount %groups
- Assemble the
%landscapedesk (it is built from upstream, not via peru):- From
urbit/urbit:rsync -avL --delete pkg/base-dev/* ~/urbit/zod/landscape/ - From
tloncorp/landscape:rsync -avL desk/* ~/urbit/zod/landscape/
- From
- Assemble the
%groupsdesk from this repo.assemble-desk.shvendors its base-dev and landscape dependencies intodesk-deps/via peru, then layersdesk-deps/+desk/into the mounted desk:./scripts/assemble-desk.sh ~/urbit/zod/groups
- Commit and install landscape on local
~zod:|commit %landscape|install our %landscape
- Similarly commit and install Tlon:
|commit %groups|install our %groups
Tlon is distributed via the Urbit network by way of a glob, or a Landscape application bundle. Instructions are as follows:
- Run
pnpm buildin theapps/tlon-webdirectory, which outputs to/dist. - Create or launch an urbit using the -F flag.
- On that urbit, if you don't already have a desk to run from, run
|merge %work our %baseto create a new desk and mount it with|mount %work. - Now the
%workdesk is accessible through the host OS's filesystem as a directory of that urbit's pier ie~/zod/work. - From the repo you can run
rsync -avL --delete apps/tlon-web/dist/ ~/zod/work/groupsandrsync -avL desk/mar/webmanifest.hoon ~/zod/work/mar/webmanifest.hoonwhere~/zodis your fake urbit's pier. - Once completed, run
|commit %workon your urbit and you should see your files logged back out from the dojo. - Run
=dir /=landscapeto switch to the landscape desk directory. - Run
-make-glob %work /groups. This will create a glob from the folder where you just added files. It will output to~/zod/.urb/put. - Navigate to
~/zod/.urb/putyou should see a file that looks something like:glob-0v5.fdf99.nph65.qecq3.ncpjn.q13mb.glob. The characters betweenglob-and.globare a hash of the glob's contents. - Upload the glob to any publicly available HTTP endpoint that can serve files. This allows the application to be distributed over HTTP.
- Once you've uploaded the glob, update the corresponding entry in the docket file at
desk/desk.docket-0. Both the full URL and the hash should be updated to match the glob we just created, on the line that looks like this:
glob-http+['https://bootstrap.urbit.org/glob-0v5.fdf99.nph65.qecq3.ncpjn.q13mb.glob' 0v5.fdf99.nph65.qecq3.ncpjn.q13mb]- The docket file containing a pointer to the new glob can now be safely committed and deployed via the Urbit network.
This project uses husky to run git pre-commit hooks. You may disable Husky by adding HUSKY=0 to your .zshrc or .bashrc.
bloc : superuser sects
sects in the bloc set are allowed to make modifications to the group, and its various metadata and permissions
brief : a representation of the last thing we've seen, and how many new items since
cabal : contains the metadata for a role
chat : backend term for a group chat
club : backend term for a multi-DM group (distinct from a chat and a dm)
cordon : represents a group's permissions. open allows anyone to enter but those banned, shut requires requesting to join, afar is a custom policy determined by another agent
curio : represents an item in a collection
dm : backend term for a 1:1 message
flag : composite identifier consisting of ship/group-name used to key state and in routes
fleet : the map of ships that are part of a group
gang : a group invite
heap : a collection
sect : a term representing a role
stash : all heaps we are a part of
vessel : represents the roles a group member has and their join time
bloc : roles that have superuser perms (default is admin)
To test locally you need:
- Install openjdk21 if you don't have it on your system already.
- Install Maestro.
- Make sure your repo is up to date with
pnpm iandpod installfrom/apps/tlon-mobile/ios - Run
pnpm ios:releasefrom/apps/tlon-mobile. - Wait until the app has booted in the simulator.
- Run maestro tests from the root of the repository with the following arguments:
maestro test -e URL={URL} -e CODE={CODE} -e EMAIL={EMAIL} -e PASSWORD={PASSWORD} .maestro/00-start.yaml- {URL} should be a self-hosted ship's URL
- {CODE} should be the code that goes with that ship
- {EMAIL} should be the email of a Tlon hosted account
- {PASSWORD} should be the corresponding password for that account
To write tests run:
maestro studio
You can use this to inspect whatever view you have loaded in the simulator. Clicking on elements will suggest selectors/commands to use in your tests. Full set of commands are here: https://maestro.mobile.dev/api-reference/commands
Run cosmos:
npm run cosmos
Cosmos uses fixture files to generate component previews. You can create fixture files in two ways (from the docs).
- End fixture file names with
.fixture.{js,jsx,ts,tsx,md,mdx}. - Put fixture files inside
__fixtures__.
Fixture files and folders can be nested at any level under /src.
Many components need to be wrapped with providers or other context to work properly. Cosmos uses a cosmos.decorator.tsx files to share wrappers between components. From the Cosmos docs:
A decorator only applies to fixture files contained in the decorator's directory. Decorators can be composed, in the order of their position in the file system hierarchy (from outer to inner).
Cosmos runs two servers: a UI wrapper on port 5000, and a renderer on port 5050. The wrapper renders the Cosmos UI, and the renderer renders the actual component previews in an environment that's very close to our standard application environment.
Our setup uses react-cosmos-plugin-vite to configure the renderer. When you start cosmos, it evaluates our vite configuration file, does some module rewiring to replace our main.ts file with its own, and spins up a wrapped vite dev server on a new port.