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: Chat in full with phone notifications, plus Code and Customize (#4) | 1 | import assert from "node:assert/strict"; |
| 2 | import { test } from "node:test"; | |
| 3 | ||
| 4 | import { routeFor, sitePathOf } from "./links.ts"; | |
| 5 | ||
| 6 | test("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 | ||
| 12 | test("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 | ||
| 19 | test("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 | ||
| 28 | test("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 | ||
| 33 | test("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 | }); | |
| The phone app works with a g1t of your own as well as g1t.sh, and nothing about that shows to people on g1t.sh. Every g1t now says where its parts are at /.well-known/g1t.json (the site, the API and the MCP server, and whether it sends phones notifications; @g1t/contracts/discovery), so someone pointing the app at theirs types only the address they open it at; a g1t from before has none, and the app takes the API to be api. in front of the site, as before. A self-hosted g1t's download page shows a QR code and Open in the g1t app, a g1t://connect?server=<site> link the app asks about before switching, so its people type nothing. The sign-in screen has one button on g1t.sh, with a quiet "Using your own g1t?" at its foot, and says "Signing in to <host>" when pointed elsewhere. | 38 | |
| 39 | test("a connect link points the app at a g1t", () => { | |
| 40 | assert.equal(routeFor("/connect?server=https%3A%2F%2Fg1t.example.com"), "/connect?server=https%3A%2F%2Fg1t.example.com"); | |
| 41 | assert.equal(sitePathOf("g1t://connect?server=https%3A%2F%2Fg1t.example.com"), "/connect?server=https%3A%2F%2Fg1t.example.com"); | |
| 42 | // A workspace named connect is still a workspace. | |
| 43 | assert.equal(routeFor("/connect/-/chat"), "/chat?workspace=connect"); | |
| 44 | assert.equal(routeFor("/connect/web"), "/code/connect/web"); | |
| 45 | }); |
This file's history is long; its oldest lines are credited to the oldest commit read.