index.ts 1.1 KB

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