The best way to control Claude Code, Codex and more from any computer or phone

main
ts 37 lines 1.27 KB
Raw
1 import { GcpEnvironment } from "@alchemy.run/gcp/Environment";
2 import * as Effect from "effect/Effect";
3 import { MinimumLogLevel } from "effect/References";
4 import * as Schedule from "effect/Schedule";
5
6 export const logLevel = Effect.provideService(
7 MinimumLogLevel,
8 process.env.DEBUG ? "Debug" : "Info",
9 );
10
11 export const runLifecycle = !process.env.FAST;
12
13 // Releases need a blueprint image pushed to Artifact Registry. Set
14 // GCP_TEST_SAAS_BLUEPRINT_PACKAGE (e.g.
15 // `us-central1-docker.pkg.dev/<project>/blueprints/store:v1`) to run the
16 // release, rollout, and unit-operation lifecycles.
17 export const blueprintPackage = process.env.GCP_TEST_SAAS_BLUEPRINT_PACKAGE;
18 export const runBlueprintLifecycle = runLifecycle && blueprintPackage !== undefined;
19
20 export const currentProject = GcpEnvironment.current.pipe(Effect.map((env) => env.project));
21 export const location = "us-central1";
22
23 export const waitUntilGone = <E extends { readonly _tag: string }, R>(
24 get: Effect.Effect<unknown, E, R>,
25 ) =>
26 get.pipe(
27 Effect.as("found" as const),
28 Effect.catchIf(
29 (error) => error._tag === "NotFound",
30 () => Effect.succeed("gone" as const),
31 ),
32 Effect.repeat({
33 schedule: Schedule.spaced("1 second"),
34 until: (status) => status === "gone",
35 times: 10,
36 }),
37 );