The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 06:00 UTC
| 1 | import * as Cloudflare from "@alchemy.run/cloudflare"; |
| 2 | import * as GitHub from "@alchemy.run/github"; |
| 3 | import * as Neon from "@alchemy.run/neon"; |
| 4 | import * as Alchemy from "alchemy"; |
| 5 | import * as Output from "alchemy/Output"; |
| 6 | import * as Config from "effect/Config"; |
| 7 | import * as Effect from "effect/Effect"; |
| 8 | import * as Layer from "effect/Layer"; |
| 9 | import * as Option from "effect/Option"; |
| 10 | import Chat from "./ChatModules.ts"; |
| 11 | |
| 12 | // #region show |
| 13 | export default Alchemy.Stack( |
| 14 | "Chat", |
| 15 | { |
| 16 | providers: Layer.mergeAll(Cloudflare.providers(), Neon.providers(), GitHub.providers()), |
| 17 | state: Cloudflare.state(), |
| 18 | }, |
| 19 | Effect.gen(function* () { |
| 20 | const chat = yield* Chat; |
| 21 | // #region comment |
| 22 | const pullRequest = yield* Config.Int("PULL_REQUEST").pipe( |
| 23 | Config.option, |
| 24 | Config.map(Option.getOrUndefined), |
| 25 | ); |
| 26 | |
| 27 | if (pullRequest) { |
| 28 | yield* GitHub.Comment("Preview", { |
| 29 | owner: "alchemy-run", |
| 30 | repository: "chat", |
| 31 | issueNumber: pullRequest, |
| 32 | body: Output.interpolate`🚀 Preview deployed to ${chat.url}`, |
| 33 | }); |
| 34 | } |
| 35 | // #endregion comment |
| 36 | return { url: chat.url.as<string>() }; |
| 37 | }), |
| 38 | ); |
| 39 | // #endregion show |