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:
rsync -avL desk/* ~/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 or use Tlon's Bouncer utility (requires Ruby 3+).
- Clone or pull latest versions of this repo,
tloncorp/landscape
andurbit/urbit
. - Boot a fake ship. Use local networking with
-F
like so:urbit -F zod
- Create and mount the appropriate desks on local
~zod
:|new-desk %landscape
|mount %landscape
|new-desk %groups
|mount %groups
- From the
urbit/urbit
repo:rsync -avL --delete pkg/base-dev/* ~/urbit/zod/landscape/
rsync -avL --delete pkg/base-dev/* ~/urbit/zod/groups/
- From the
tloncorp/landscape
repo:rsync -avL desk/* ~/urbit/zod/landscape/
rsync -avL desk-dev/* ~/urbit/zod/groups/
- From this repo:
rsync -avL desk/* ~/urbit/zod/groups/
rsync -avL landscape-dev/* ~/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 build
in theapps/tlon-web
directory, 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 %base
to create a new desk and mount it with|mount %work
. - Now the
%work
desk 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/groups
andrsync -avL desk/mar/webmanifest.hoon ~/zod/work/mar/webmanifest.hoon
where~/zod
is your fake urbit's pier. - Once completed, run
|commit %work
on your urbit and you should see your files logged back out from the dojo. - Run
=dir /=landscape
to 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/put
you should see a file that looks something like:glob-0v5.fdf99.nph65.qecq3.ncpjn.q13mb.glob
. The characters betweenglob-
and.glob
are 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)
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.