index.ts 1.1 KB

123456789101112131415161718192021222324252627282930
  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. debug: {
  10. agents: () => import("./commands/handlers/debug/agents"),
  11. },
  12. migrate: () => import("./commands/handlers/migrate"),
  13. service: {
  14. start: () => import("./commands/handlers/service/start"),
  15. restart: () => import("./commands/handlers/service/restart"),
  16. status: () => import("./commands/handlers/service/status"),
  17. stop: () => import("./commands/handlers/service/stop"),
  18. password: () => import("./commands/handlers/service/password"),
  19. },
  20. serve: () => import("./commands/handlers/serve"),
  21. })
  22. Runtime.run(Commands, Handlers, { version: "local" }).pipe(
  23. Effect.provide(Daemon.defaultLayer),
  24. Effect.provide(NodeServices.layer),
  25. Effect.scoped,
  26. NodeRuntime.runMain,
  27. )