Skip to content
37 linesCodeBlameRaw

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

The phone app's scaffolding, in apps/mobile: Expo SDK 57 with Expo Router, Android first, with Chat, Code and Customize. It signs in with g1t's own OAuth 2.1 (PKCE, a client id that encodes "g1t for Android" and g1t://oauth/callback, so nothing is registered), keeps the server and credentials in the phone's keystore, refreshes the 30-day token a minute early and shares the single-use refresh between requests. A personal access token is the other way in, and a self-hosted g1t the other server.1import assert from "node:assert/strict";
2import { test } from "node:test";
3
4import { routeFor, sitePathOf } from "./links.ts";
5
6test("a g1t:// link names a site path, as on the desktop", () => {
7 assert.equal(sitePathOf("g1t://acme/-/chat/dm/chn_1"), "/acme/-/chat/dm/chn_1");
8 assert.equal(sitePathOf("g1t:///acme/rocket/pull/3?tab=files"), "/acme/rocket/pull/3?tab=files");
9 assert.equal(sitePathOf("https://g1t.sh/acme"), null);
10});
11
12test("Chat's pages open the app's Chat", () => {
13 assert.equal(routeFor("/acme/-/chat"), "/chat?workspace=acme");
14 assert.equal(routeFor("/acme/-/chat/general"), "/chat/general?workspace=acme");
15 assert.equal(routeFor("/acme/-/chat/dm/chn_1"), "/chat/chn_1?workspace=acme");
16 assert.equal(routeFor("/acme/-/chat/browse"), null);
17});
18
19test("Code's pages open the app's Code", () => {
20 assert.equal(routeFor("/acme/rocket"), "/code/acme/rocket");
21 assert.equal(routeFor("/acme/rocket/pull/14"), "/code/acme/rocket/pull/14");
22 assert.equal(routeFor("/acme/rocket/issues/12"), "/code/acme/rocket/issues/12");
23 assert.equal(routeFor("/acme/-/overview"), "/code?workspace=acme");
24 assert.equal(routeFor("/acme/rocket/pull/14/files"), null);
25 assert.equal(routeFor("/acme/rocket/issues/new"), null);
26});
27
28test("the Marketplace, integrations and skills open Customize", () => {
29 assert.equal(routeFor("/acme/-/marketplace/integrations"), "/customize?workspace=acme");
30 assert.equal(routeFor("/acme/-/agents/skills"), "/customize?workspace=acme");
31});
32
33test("the app's sign-in comes back to its own screen, and the site's own pages stay on the site", () => {
34 assert.equal(routeFor("/oauth/callback?code=c&state=s"), "/oauth/callback?code=c&state=s");
35 assert.equal(routeFor("/settings/tokens"), null);
36 assert.equal(routeFor("/"), "/");
37});