index.ts 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env bun
  2. import * as NodeRuntime from "@effect/platform-node/NodeRuntime"
  3. import * as NodeServices from "@effect/platform-node/NodeServices"
  4. import * as Effect from "effect/Effect"
  5. import { Commands } from "./commands/commands"
  6. import { Runtime } from "./framework/runtime"
  7. import { Daemon } from "./services/daemon"
  8. const Handlers = Runtime.handlers(Commands, {
  9. $: () => import("./commands/handlers/default"),
  10. debug: {
  11. agents: () => import("./commands/handlers/debug/agents"),
  12. },
  13. migrate: () => import("./commands/handlers/migrate"),
  14. service: {
  15. start: () => import("./commands/handlers/service/start"),
  16. restart: () => import("./commands/handlers/service/restart"),
  17. status: () => import("./commands/handlers/service/status"),
  18. stop: () => import("./commands/handlers/service/stop"),
  19. password: () => import("./commands/handlers/service/password"),
  20. },
  21. serve: () => import("./commands/handlers/serve"),
  22. })
  23. Runtime.run(Commands, Handlers, { version: "local" }).pipe(
  24. Effect.provide(Daemon.defaultLayer),
  25. Effect.provide(NodeServices.layer),
  26. Effect.scoped,
  27. NodeRuntime.runMain,
  28. )