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, 03:37 UTC
| 1 | import { type CliReleaseChannel, cliReleaseChannelOf } from "./cliRelease.ts"; |
| 2 | |
| 3 | export type ReleaseChannel = "dev" | CliReleaseChannel; |
| 4 | |
| 5 | // Desktop PR preview builds are stamped `X.Y.Z-pr.<number>.<run>`; the CLI updater must not see them as preview. |
| 6 | export const releaseChannelOf = (version: string): ReleaseChannel => |
| 7 | /-pr\.\d+\.\d+$/.test(version) ? "preview" : cliReleaseChannelOf(version); |
| 8 | |
| 9 | // Effect lets code attributes beat OTEL_RESOURCE_ATTRIBUTES, so the operator value is applied here. |
| 10 | export const releaseResourceAttributes = ( |
| 11 | channel: ReleaseChannel, |
| 12 | operatorAttributes: Readonly<Record<string, unknown>> = {}, |
| 13 | ) => { |
| 14 | const operatorValue = (key: string) => { |
| 15 | const value = operatorAttributes[key]; |
| 16 | return typeof value === "string" && value !== "" ? value : undefined; |
| 17 | }; |
| 18 | return { |
| 19 | "t3code.release.channel": operatorValue("t3code.release.channel") ?? channel, |
| 20 | "deployment.environment.name": |
| 21 | operatorValue("deployment.environment.name") ?? |
| 22 | (channel === "dev" ? "development" : channel === "preview" ? "staging" : "production"), |
| 23 | }; |
| 24 | }; |