The best way to control Claude Code, Codex and more from any computer or phone

main
ts 23 lines 791 Bytes
Raw
1 import { Schema, pipe } from "effect";
2 import { Route } from "foldkit";
3 import { defineRouteUnion, literal } from "foldkit/route";
4
5 export const AppRoute = defineRouteUnion({
6 Home: {},
7 About: {},
8 Counter: {},
9 NotFound: { path: Schema.String },
10 });
11
12 export type AppRoute = typeof AppRoute.Type;
13
14 export const homeRouter = pipe(Route.root, Route.mapTo(AppRoute.Home));
15 export const aboutRouter = pipe(literal("about"), Route.mapTo(AppRoute.About));
16
17 export const counterRouter = pipe(literal("counter"), Route.mapTo(AppRoute.Counter));
18
19 export const prerenderPaths: ReadonlyArray<string> = [homeRouter(), aboutRouter()];
20
21 const routeParser = Route.oneOf(counterRouter, aboutRouter, homeRouter);
22
23 export const urlToAppRoute = Route.parseUrlWithFallback(routeParser, AppRoute.NotFound);