forked from supabase/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatus.command.ts
More file actions
39 lines (35 loc) · 1.75 KB
/
Copy pathstatus.command.ts
File metadata and controls
39 lines (35 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { Layer } from "effect";
import { DEFAULT_MANAGED_STACK_NAME } from "@supabase/stack/effect";
import { Command, Flag } from "effect/unstable/cli";
import type * as CliCommand from "effect/unstable/cli/Command";
import { projectLinkStateLayer } from "../../config/project-link-state.layer.ts";
import { projectLocalServiceVersionsLayer } from "../../config/project-local-service-versions.layer.ts";
import { provideProjectCommandRuntime } from "../../config/project-runtime.layer.ts";
import { projectStackStateManagerLayer } from "../../config/project-stack-state-manager.layer.ts";
import { withJsonErrorHandling } from "../../../shared/output/json-error-handling.ts";
import { commandRuntimeLayer } from "../../../shared/runtime/command-runtime.layer.ts";
import { withCommandInstrumentation } from "../../../shared/telemetry/command-instrumentation.ts";
import { status } from "./status.handler.ts";
const flags = {
stack: Flag.string("stack").pipe(
Flag.withDescription("Name of the managed local stack for this project."),
Flag.withDefault(DEFAULT_MANAGED_STACK_NAME),
),
} as const;
export type StatusFlags = CliCommand.Command.Config.Infer<typeof flags>;
const statusRuntimeLayer = provideProjectCommandRuntime(
Layer.mergeAll(
projectLinkStateLayer,
projectLocalServiceVersionsLayer,
projectStackStateManagerLayer,
commandRuntimeLayer(["status"]),
),
);
export const statusCommand = Command.make("status", flags).pipe(
Command.withDescription("Show the current local Supabase stack status."),
Command.withShortDescription("Show local stack connection info and service status"),
Command.withHandler((flags) =>
status(flags).pipe(withCommandInstrumentation(), withJsonErrorHandling),
),
Command.provide(statusRuntimeLayer),
);