Open History to see the last commit
1import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
2import * as NodeServices from "@effect/platform-node/NodeServices";
3import * as Effect from "effect/Effect";
4import * as Layer from "effect/Layer";
5import { Command } from "effect/unstable/cli";
6
7import * as NetService from "@t3tools/shared/Net";
8import packageJson from "../package.json" with { type: "json" };
9import { authCommand } from "./cli/auth.ts";
10import { sharedServerCommandFlags } from "./cli/config.ts";
11import { projectCommand } from "./cli/project.ts";
12import { runServerCommand, serveCommand, startCommand } from "./cli/server.ts";
13
14const CliRuntimeLayer = Layer.mergeAll(NodeServices.layer, NetService.layer);
15
16export const cli = Command.make("t3", { ...sharedServerCommandFlags }).pipe(
17 Command.withDescription("Run the T3 Code server."),
18 Command.withHandler((flags) => runServerCommand(flags)),
19 Command.withSubcommands([startCommand, serveCommand, authCommand, projectCommand]),
20);
21
22if (import.meta.main) {
23 Command.run(cli, { version: packageJson.version }).pipe(
24 Effect.scoped,
25 Effect.provide(CliRuntimeLayer),
26 NodeRuntime.runMain,
27 );
28}