- C# 100%
forj #
A command-line tool for source forges, in the spirit of gh, that works the same way whichever
forge a repository is on. Tangled is the first forge it supports.
forj login tangled # sign in in the browser; the session goes in the keychain
forj whoami
forj issue list # open issues of the repository in the current directory
forj issue list --state all -L 50
forj issue view 3mwxz7tjlyc44
forj issue create --title "Crash on start" --body-file notes.md
forj pr create # the current branch, pushed, into main
forj pr create --head fix --base release --title "Fix the crash"
forj issue list -R tangled.org/core # any repository, by owner/name or host/owner/name
forj release upload v1.0.0 tool-linux tool-macos # attach files to a release's tag
Without -R, forj uses the repository named by the current directory's origin remote, like
git@tangled.org:owner/name or https://tangled.org/owner/name.
Tangled #
Tangled keeps everything as AT Protocol records: an issue is an sh.tangled.repo.issue record in
its author's own repo, which tangled.org indexes.
- Reading goes through Tangled's index at
api.tangled.org, and needs no account. - Writing creates records on your PDS, as the account
forj login tangledsigned in.
Signing in #
forj login tangled signs in with atproto OAuth: forj finds your PDS from your handle, and your
PDS's sign-in server, then opens your browser to approve. forj never sees your password. The
session's tokens are bound to a DPoP key that forj keeps with them, so they're useless without
it. Sessions go in the system keychain, never in a file: the macOS keychain, or the Secret Service
on Linux, through secret-tool. Windows isn't supported yet.
- If the browser can't reach forj, as over SSH where it's on another machine, paste the address
the browser ends up on back into forj, even if the page shows an error. forj always prints the
sign-in address and accepts the paste, while it also waits for the browser to come back by
itself. Over SSH, or with
--no-browser, it doesn't try to open a browser. atproto has no device flow, the "enter this code" sign-in thatghuses, so this is the closest equivalent. - Sessions last up to two weeks, the most atproto allows a client that can't keep a secret,
so
forj loginagain after that. forj refreshes the tokens in between. - forj asks for
transition:generic, which is as broad as an app password, since the narrower permissions aren't offered by sign-in servers like bsky.social yet. Unlike an app password, it's revocable on its own, andforj logout tangledrevokes it. - forj identifies itself as atproto's development client (
http://localhost) for now, until its client metadata is hosted. - In CI, where there's no browser, set
FORJ_TANGLED_ACCOUNTto a handle or DID andFORJ_TANGLED_APP_PASSWORDto an app password. They're used instead of a saved sign-in. - Pull requests are made as tangled.org's web interface makes them: the knot that hosts the
repository compares the pushed branches, and its
git format-patchoutput goes in ansh.tangled.repo.pullrecord. So push the branch first; local commits that aren't pushed aren't sent. The title and body default to the first commit's. - Issues have no numbers in Tangled's index, so forj names them by record key, like
3mwxz7tjlyc44, or byat://URI. - A new issue takes a moment to appear, since tangled.org indexes it from the network.
- Release files attach to annotated tags, since Tangled has no releases of its own. Each file is
a blob on your PDS, with an
sh.tangled.repo.artifactrecord naming the repository and the tag object. Upload them as the repository's owner: tangled.org serves files only from the owner's PDS, so forj refuses anyone else. Files can be up to 50 MB. A tag can have only one file with each name, since tangled.org answers 404 for both when there are two, so--clobberdeletes the old one first.
Handles resolve as the AT Protocol defines: the DNS TXT record _atproto.{handle}, looked up
through DNS over HTTPS, or else https://{handle}/.well-known/atproto-did.
Building #
dotnet test
dotnet publish src/forj
forj is a .NET Native AOT program, using Serde for JSON and Serde.CmdLine for its commands.