@better-update/cli 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +5 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["idParam","projectIdParam","idParam","idParam","idParam","idParam","idParam","idParam","idParam","projectIdParam","idParam","idParam","idParam","idParam","idParam","idParam","projectIdParam","idParam","process","channelsCommand","channelsCommand","listCommand","listCommand","listCommand","createCommand","renameCommand","deleteCommand","process","asString","process","deleteCommand","getCommand","listCommand","uploadCommand","listCommand","getCommand","deleteCommand","uploadCommand","resolveNamedResourceId","resolveNamedResourceId","resolveNamedResourceIdBase","createCommand","resolveNamedResourceId","deleteCommand","listCommand","completeCommand","createCommand","resolveNamedResourceId","revertCommand","updateCommand","rolloutCommand","createCommand","updateCommand","completeCommand","revertCommand","updateCommand","resolveNamedResourceId","listCommand","createCommand","updateCommand","deleteCommand","rolloutCommand","CREDENTIAL_TYPES","deleteCommand","listCommand","listCommand","deleteCommand","deleteCommand","getCommand","listCommand","setCommand","listCommand","getCommand","setCommand","deleteCommand","asString","listCommand","deleteCommand","resolveNamedResourceIdBase","pkg.version"],"sources":["../package.json","../../../packages/type-guards/src/index.ts","../src/lib/exit-codes.ts","../src/lib/format-error.ts","../src/lib/app-json.ts","../../../packages/api/src/auth/context.ts","../../../packages/api/src/auth/errors.ts","../../../packages/api/src/auth/middleware.ts","../../../packages/api/src/auth/ownership.ts","../../../packages/api/src/domain/common.ts","../../../packages/api/src/domain/analytics.ts","../../../packages/api/src/groups/analytics.ts","../../../packages/api/src/domain/android-application-identifier.ts","../../../packages/api/src/domain/errors.ts","../../../packages/api/src/groups/android-application-identifiers.ts","../../../packages/api/src/domain/android-build-credentials.ts","../../../packages/api/src/groups/android-build-credentials.ts","../../../packages/api/src/domain/android-upload-keystore.ts","../../../packages/api/src/groups/android-upload-keystores.ts","../../../packages/api/src/domain/apple-team.ts","../../../packages/api/src/domain/apple-distribution-certificate.ts","../../../packages/api/src/groups/apple-distribution-certificates.ts","../../../packages/api/src/domain/apple-provisioning-profile.ts","../../../packages/api/src/groups/apple-provisioning-profiles.ts","../../../packages/api/src/domain/apple-push-key.ts","../../../packages/api/src/groups/apple-push-keys.ts","../../../packages/api/src/groups/apple-teams.ts","../../../packages/api/src/domain/asc-api-key.ts","../../../packages/api/src/groups/asc-api-keys.ts","../../../packages/api/src/domain/asset.ts","../../../packages/api/src/groups/assets.ts","../../../packages/api/src/domain/audit-log.ts","../../../packages/api/src/groups/audit-logs.ts","../../../packages/api/src/domain/branch.ts","../../../packages/api/src/groups/branches.ts","../../../packages/api/src/domain/build-credentials.ts","../../../packages/api/src/groups/build-credentials.ts","../../../packages/api/src/domain/build.ts","../../../packages/api/src/domain/build-compatibility.ts","../../../packages/api/src/groups/builds.ts","../../../packages/api/src/domain/channel.ts","../../../packages/api/src/groups/channels.ts","../../../packages/api/src/domain/device.ts","../../../packages/api/src/groups/devices.ts","../../../packages/api/src/domain/env-var.ts","../../../packages/api/src/groups/env-vars.ts","../../../packages/api/src/domain/google-service-account-key.ts","../../../packages/api/src/groups/google-service-account-keys.ts","../../../packages/api/src/domain/ios-bundle-configuration.ts","../../../packages/api/src/groups/ios-bundle-configurations.ts","../../../packages/api/src/domain/project.ts","../../../packages/api/src/groups/projects.ts","../../../packages/api/src/domain/update.ts","../../../packages/api/src/groups/updates.ts","../../../packages/api/src/api.ts","../../../packages/api/src/groups/manifest.ts","../../../packages/api/src/protocol-api.ts","../src/services/cli-runtime.ts","../src/services/auth-store.ts","../src/services/config-store.ts","../src/services/api-client.ts","../../../packages/safe-json/src/index.ts","../src/services/apple-session-store.ts","../src/services/presigned-upload.ts","../src/services/update-asset-uploader.ts","../src/app-layer.ts","../src/application/command-exit.ts","../src/lib/command-errors.ts","../src/lib/citty-effect.ts","../src/lib/output.ts","../src/commands/analytics/adoption.ts","../src/commands/analytics/channels.ts","../src/commands/analytics/platforms.ts","../src/commands/analytics/updates.ts","../src/commands/analytics/index.ts","../src/lib/cli-schemas.ts","../src/commands/audit-logs/list.ts","../src/commands/audit-logs/index.ts","../src/lib/drain-cursor.ts","../src/commands/branches.ts","../src/lib/android-signing-gradle.ts","../src/lib/string-utils.ts","../src/lib/artifact-finder.ts","../../../packages/encoding/src/index.ts","../src/lib/credentials-downloader.ts","../src/lib/sha256.ts","../src/commands/build/run-step.ts","../src/commands/build/android.ts","../src/lib/ios-export-options.ts","../src/lib/ios-keychain.ts","../src/lib/plist.ts","../src/lib/ios-provisioning.ts","../src/lib/post-build-validation.ts","../src/lib/xcpretty-formatter.ts","../src/commands/build/ios.ts","../src/commands/build/reserve-and-upload.ts","../src/lib/build-profile.ts","../src/lib/env-exporter.ts","../src/lib/expo-config.ts","../src/lib/git-context.ts","../src/lib/gradle-config.ts","../src/lib/fingerprint.ts","../src/lib/runtime-version.ts","../src/lib/temp-dir.ts","../src/application/build-workflow.ts","../src/commands/build/index.ts","../src/commands/builds/compatibility-matrix.ts","../src/commands/builds/delete.ts","../src/commands/builds/get.ts","../src/commands/builds/install-link.ts","../src/commands/builds/list.ts","../src/application/upload-workflow.ts","../src/commands/builds/upload.ts","../src/commands/builds/index.ts","../src/lib/resolve-named-resource.ts","../src/commands/channels/helpers.ts","../src/commands/channels/create.ts","../src/commands/channels/delete.ts","../src/commands/channels/list.ts","../src/commands/channels/pause.ts","../src/commands/channels/resume.ts","../src/commands/channels/rollout/complete.ts","../src/commands/channels/rollout/create.ts","../src/commands/channels/rollout/revert.ts","../src/commands/channels/rollout/update.ts","../src/commands/channels/rollout/index.ts","../src/commands/channels/update.ts","../src/commands/channels/index.ts","../src/lib/pkcs12.ts","../src/lib/credentials-manager.ts","../src/commands/credentials/delete.ts","../src/commands/credentials/list.ts","../src/commands/credentials/upload.ts","../src/commands/credentials/index.ts","../src/commands/env/helpers.ts","../src/commands/env/delete.ts","../src/commands/env/export.ts","../src/commands/env/get.ts","../src/commands/env/import.ts","../src/commands/env/list.ts","../src/commands/env/pull.ts","../src/commands/env/set.ts","../src/commands/env/index.ts","../src/commands/fingerprint/compare.ts","../src/commands/fingerprint/generate.ts","../src/commands/fingerprint/index.ts","../src/commands/init.ts","../src/lib/browser-login.ts","../src/lib/prompts.ts","../src/application/login.ts","../src/commands/login.ts","../src/commands/logout.ts","../src/commands/projects.ts","../src/commands/status.ts","../src/commands/update/helpers.ts","../src/commands/update/delete.ts","../src/commands/update/list.ts","../src/lib/signed-payloads.ts","../src/application/update-promote.ts","../src/commands/update/promote.ts","../src/lib/expo-export.ts","../src/lib/update-platforms.ts","../src/application/update-publish.ts","../src/commands/update/publish.ts","../../../packages/expo-protocol/src/index.ts","../src/application/update-rollback.ts","../src/commands/update/rollback.ts","../src/commands/update/rollout/complete.ts","../src/commands/update/rollout/revert.ts","../src/commands/update/rollout/set.ts","../src/commands/update/rollout/index.ts","../src/commands/update/index.ts","../src/index.ts"],"sourcesContent":["","export const isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nexport const asRecord = (value: unknown): Record<string, unknown> | undefined =>\n isRecord(value) ? value : undefined;\n","/* eslint-disable eslint/max-classes-per-file -- dedicated error-taxonomy module: each error class is a small, purpose-built tag used across the CLI for Effect.catchTag */\n\nimport { Data } from \"effect\";\n\nexport class AuthRequiredError extends Data.TaggedError(\"AuthRequiredError\")<{\n readonly message: string;\n}> {}\n\nexport class ProjectNotLinkedError extends Data.TaggedError(\"ProjectNotLinkedError\")<{\n readonly message: string;\n}> {}\n\nexport class UploadFailedError extends Data.TaggedError(\"UploadFailedError\")<{\n readonly message: string;\n}> {}\n\nexport class BuildProfileError extends Data.TaggedError(\"BuildProfileError\")<{\n readonly message: string;\n}> {}\n\nexport class RuntimeVersionError extends Data.TaggedError(\"RuntimeVersionError\")<{\n readonly message: string;\n}> {}\n\nexport class MissingCredentialsError extends Data.TaggedError(\"MissingCredentialsError\")<{\n readonly message: string;\n readonly hint: string;\n}> {}\n\nexport class BuildFailedError extends Data.TaggedError(\"BuildFailedError\")<{\n readonly step: string;\n readonly exitCode: number;\n readonly message: string;\n}> {}\n\nexport class ReserveError extends Data.TaggedError(\"ReserveError\")<{\n readonly message: string;\n}> {}\n\nexport class CompleteError extends Data.TaggedError(\"CompleteError\")<{\n readonly message: string;\n}> {}\n\nexport class PresignedUrlExpiredError extends Data.TaggedError(\"PresignedUrlExpiredError\")<{\n readonly message: string;\n}> {}\n\nexport class ArtifactNotFoundError extends Data.TaggedError(\"ArtifactNotFoundError\")<{\n readonly message: string;\n}> {}\n\nexport class KeychainError extends Data.TaggedError(\"KeychainError\")<{\n readonly message: string;\n}> {}\n\nexport class ProvisioningError extends Data.TaggedError(\"ProvisioningError\")<{\n readonly message: string;\n}> {}\n\nexport class EnvExportError extends Data.TaggedError(\"EnvExportError\")<{\n readonly message: string;\n}> {}\n\nexport class UpdatePublishError extends Data.TaggedError(\"UpdatePublishError\")<{\n readonly message: string;\n}> {}\n\nexport class UpdateRollbackError extends Data.TaggedError(\"UpdateRollbackError\")<{\n readonly message: string;\n}> {}\n\nexport class UpdatePromoteError extends Data.TaggedError(\"UpdatePromoteError\")<{\n readonly message: string;\n}> {}\n\nexport class CredentialValidationError extends Data.TaggedError(\"CredentialValidationError\")<{\n readonly message: string;\n}> {}\n\nexport class AppleAuthError extends Data.TaggedError(\"AppleAuthError\")<{\n readonly message: string;\n}> {}\n\nexport class InvalidArgumentError extends Data.TaggedError(\"InvalidArgumentError\")<{\n readonly message: string;\n}> {}\n","export const formatCause = (cause: unknown): string => {\n if (cause instanceof Error) {\n return cause.message;\n }\n\n if (typeof cause === \"object\" && cause !== null) {\n const tagged = cause as { readonly _tag?: unknown; readonly message?: unknown };\n const tag = typeof tagged._tag === \"string\" ? tagged._tag : undefined;\n const message = typeof tagged.message === \"string\" ? tagged.message : undefined;\n if (tag && message) {\n return `${tag}: ${message}`;\n }\n if (message) {\n return message;\n }\n if (tag) {\n return tag;\n }\n }\n\n return String(cause);\n};\n","import { asRecord, isRecord } from \"@better-update/type-guards\";\nimport { FileSystem } from \"@effect/platform\";\nimport { Effect } from \"effect\";\n\nimport { ProjectNotLinkedError } from \"./exit-codes\";\nimport { formatCause } from \"./format-error\";\n\nexport const readAppJson = Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const content = yield* fs\n .readFileString(\"./app.json\")\n .pipe(\n Effect.mapError(\n () => new ProjectNotLinkedError({ message: \"app.json not found in current directory\" }),\n ),\n );\n const parsed = yield* Effect.try({\n try: (): unknown => JSON.parse(content),\n catch: () => new ProjectNotLinkedError({ message: \"app.json contains malformed JSON\" }),\n });\n if (!isRecord(parsed)) {\n return yield* new ProjectNotLinkedError({ message: \"app.json must be a JSON object\" });\n }\n return parsed;\n});\n\nexport const readProjectId = Effect.gen(function* () {\n const appJson = yield* readAppJson;\n const expo = asRecord(appJson[\"expo\"]);\n const extra = asRecord(expo?.[\"extra\"]);\n const betterUpdate = asRecord(extra?.[\"betterUpdate\"]);\n const projectId = betterUpdate?.[\"projectId\"];\n\n if (typeof projectId !== \"string\") {\n return yield* new ProjectNotLinkedError({\n message:\n \"Project not linked. Run `better-update link` to connect this project, or set expo.extra.betterUpdate.projectId in app.json.\",\n });\n }\n\n return projectId;\n});\n\nexport const readSlug = Effect.gen(function* () {\n const appJson = yield* readAppJson;\n const expo = asRecord(appJson[\"expo\"]);\n const slug = expo?.[\"slug\"];\n\n if (typeof slug !== \"string\") {\n return yield* new ProjectNotLinkedError({\n message: \"Missing expo.slug in app.json. Required to identify the project.\",\n });\n }\n\n return slug;\n});\n\nexport const writeProjectId = (id: string) =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const appJson = yield* readAppJson;\n\n const expo = asRecord(appJson[\"expo\"]) ?? {};\n const extra = asRecord(expo[\"extra\"]) ?? {};\n const betterUpdate = asRecord(extra[\"betterUpdate\"]) ?? {};\n\n betterUpdate[\"projectId\"] = id;\n extra[\"betterUpdate\"] = betterUpdate;\n expo[\"extra\"] = extra;\n appJson[\"expo\"] = expo;\n\n yield* fs.writeFileString(\"./app.json\", `${JSON.stringify(appJson, null, 2)}\\n`);\n }).pipe(\n Effect.mapError((cause) =>\n cause instanceof ProjectNotLinkedError\n ? cause\n : new ProjectNotLinkedError({\n message: `Failed to write project ID to app.json: ${formatCause(cause)}`,\n }),\n ),\n );\n","import { Context } from \"effect\";\n\nexport type Role = \"owner\" | \"admin\" | \"developer\" | \"viewer\";\n\nexport type Resource =\n | \"organization\"\n | \"member\"\n | \"invitation\"\n | \"project\"\n | \"channel\"\n | \"branch\"\n | \"update\"\n | \"rollout\"\n | \"billing\"\n | \"apiKey\"\n | \"build\"\n | \"appleCredential\"\n | \"androidCredential\"\n | \"iosBundleConfiguration\"\n | \"envVar\"\n | \"auditLog\"\n | \"device\";\n\nexport type Action = \"read\" | \"create\" | \"update\" | \"delete\" | \"cancel\" | \"download\";\n\nexport type EffectivePermissions = Partial<Record<Resource, readonly Action[]>>;\n\nexport interface AuthContextShape {\n readonly userId: string | null;\n readonly organizationId: string;\n readonly role: Role | null;\n readonly effectivePermissions: EffectivePermissions;\n readonly source: \"session\" | \"api-key\";\n readonly actorEmail: string;\n}\n\nexport class AuthContext extends Context.Tag(\"api/AuthContext\")<AuthContext, AuthContextShape>() {}\n","import { HttpApiSchema } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nexport class Unauthorized extends Schema.TaggedError<Unauthorized>()(\n \"Unauthorized\",\n { message: Schema.String },\n HttpApiSchema.annotations({ status: 401 }),\n) {}\n\nexport class Forbidden extends Schema.TaggedError<Forbidden>()(\n \"Forbidden\",\n { message: Schema.String },\n HttpApiSchema.annotations({ status: 403 }),\n) {}\n\nexport class OrgRequired extends Schema.TaggedError<OrgRequired>()(\n \"OrgRequired\",\n { message: Schema.String },\n HttpApiSchema.annotations({ status: 400 }),\n) {}\n","import { HttpApiMiddleware, HttpApiSecurity } from \"@effect/platform\";\n\nimport { AuthContext } from \"./context\";\nimport { Unauthorized } from \"./errors\";\n\nconst bearerSecurity = HttpApiSecurity.bearer;\nconst cookieSecurity = HttpApiSecurity.apiKey({\n key: \"__Secure-better-auth.session_token\",\n in: \"cookie\",\n});\n\nexport class Authentication extends HttpApiMiddleware.Tag<Authentication>()(\"api/Authentication\", {\n failure: Unauthorized,\n provides: AuthContext,\n security: { bearer: bearerSecurity, cookie: cookieSecurity },\n}) {}\n","import { HttpApiSchema } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nexport class NotFound extends Schema.TaggedError<NotFound>()(\n \"NotFound\",\n { message: Schema.String },\n HttpApiSchema.annotations({ status: 404 }),\n) {}\n","import { Schema } from \"effect\";\n\nexport const Id = Schema.String.annotations({\n description: \"UUIDv7 identifier\",\n});\n\nexport const DateTimeString = Schema.String.annotations({\n description: \"ISO 8601 datetime\",\n});\n\nexport const Platform = Schema.Literal(\"ios\", \"android\");\n\nexport const PaginationParams = Schema.Struct({\n page: Schema.optional(Schema.NumberFromString),\n limit: Schema.optional(Schema.NumberFromString),\n});\n\nexport const CursorPaginationParams = Schema.Struct({\n cursor: Schema.optional(Schema.String),\n limit: Schema.optional(Schema.NumberFromString),\n});\n\nexport const cursorPageResult = <T, Encoded, R>(itemSchema: Schema.Schema<T, Encoded, R>) =>\n Schema.Struct({\n items: Schema.Array(itemSchema),\n nextCursor: Schema.NullOr(Schema.String),\n });\n\nexport const UpdateRolloutBody = Schema.Struct({\n percentage: Schema.Number.pipe(Schema.int(), Schema.between(1, 100)),\n});\n\nexport const UploadHeaders = Schema.Record({ key: Schema.String, value: Schema.String });\n","import { Schema } from \"effect\";\n\nimport { Id } from \"./common\";\n\n// -- Shared --\n\nexport const PeriodLiteral = Schema.Literal(\"1d\", \"7d\", \"30d\", \"90d\");\nexport const Period = Schema.optional(PeriodLiteral);\n\n// -- Adoption --\n\nexport const AdoptionParams = Schema.Struct({\n projectId: Id,\n period: Period,\n});\n\nconst AdoptionEntry = Schema.Struct({\n updateId: Schema.String,\n devices: Schema.Number,\n firstSeen: Schema.String,\n lastSeen: Schema.String,\n});\n\nexport const AdoptionResult = Schema.Struct({\n updates: Schema.Array(AdoptionEntry),\n});\n\n// -- Update Analytics --\n\nexport const UpdateAnalyticsParams = Schema.Struct({\n projectId: Id,\n updateId: Schema.String,\n period: Period,\n});\n\nconst ResponseTypeBreakdown = Schema.Struct({\n manifest: Schema.Number,\n directive: Schema.Number,\n no_update: Schema.Number,\n});\n\nconst TimeSeriesEntry = Schema.Struct({\n timestamp: Schema.String,\n requests: Schema.Number,\n});\n\nexport const UpdateAnalyticsResult = Schema.Struct({\n updateId: Schema.String,\n totalRequests: Schema.Number,\n uniqueDevices: Schema.Number,\n byResponseType: ResponseTypeBreakdown,\n timeSeries: Schema.Array(TimeSeriesEntry),\n});\n\n// -- Channel Analytics --\n\nexport const ChannelAnalyticsParams = Schema.Struct({\n projectId: Id,\n channel: Schema.String,\n period: Period,\n});\n\nexport const ChannelAnalyticsResult = Schema.Struct({\n channel: Schema.String,\n totalRequests: Schema.Number,\n uniqueDevices: Schema.Number,\n responseTypeDistribution: ResponseTypeBreakdown,\n});\n\n// -- Platform Analytics --\n\nexport const PlatformParams = Schema.Struct({\n projectId: Id,\n period: Period,\n});\n\nconst PlatformEntry = Schema.Struct({\n platform: Schema.String,\n requests: Schema.Number,\n devices: Schema.Number,\n});\n\nexport const PlatformResult = Schema.Struct({\n platforms: Schema.Array(PlatformEntry),\n});\n","import { HttpApiEndpoint, HttpApiGroup, OpenApi } from \"@effect/platform\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n AdoptionParams,\n AdoptionResult,\n ChannelAnalyticsParams,\n ChannelAnalyticsResult,\n PlatformParams,\n PlatformResult,\n UpdateAnalyticsParams,\n UpdateAnalyticsResult,\n} from \"../domain/analytics\";\n\nexport class AnalyticsGroup extends HttpApiGroup.make(\"analytics\")\n .add(\n HttpApiEndpoint.get(\"adoption\", \"/api/analytics/adoption\")\n .setUrlParams(AdoptionParams)\n .addSuccess(AdoptionResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Adoption analytics\",\n description: \"Adoption rate per update for a project\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"updates\", \"/api/analytics/updates\")\n .setUrlParams(UpdateAnalyticsParams)\n .addSuccess(UpdateAnalyticsResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Update analytics\",\n description: \"Request metrics for a specific update\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"channels\", \"/api/analytics/channels\")\n .setUrlParams(ChannelAnalyticsParams)\n .addSuccess(ChannelAnalyticsResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Channel analytics\",\n description: \"Channel-level health metrics\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"platforms\", \"/api/analytics/platforms\")\n .setUrlParams(PlatformParams)\n .addSuccess(PlatformResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Platform analytics\",\n description: \"Device count breakdown by platform\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Analytics\",\n description: \"Deployment analytics endpoints\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id } from \"./common\";\n\nexport const AndroidPackageName = Schema.String.pipe(\n Schema.pattern(/^[A-Za-z][A-Za-z0-9_]*(\\.[A-Za-z][A-Za-z0-9_]*)+$/u, {\n message: () => \"Package name must be reverse-domain style (e.g., com.acme.app)\",\n }),\n);\n\nexport class AndroidApplicationIdentifier extends Schema.Class<AndroidApplicationIdentifier>(\n \"AndroidApplicationIdentifier\",\n)({\n id: Id,\n organizationId: Id,\n projectId: Id,\n packageName: Schema.String,\n createdAt: DateTimeString,\n updatedAt: DateTimeString,\n}) {}\n\nexport const CreateAndroidApplicationIdentifierBody = Schema.Struct({\n packageName: AndroidPackageName,\n});\n\nexport const DeleteAndroidApplicationIdentifierResult = Schema.Struct({\n deleted: Schema.Number,\n});\n","import { HttpApiSchema } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nexport class BadRequest extends Schema.TaggedError<BadRequest>()(\n \"BadRequest\",\n { message: Schema.String },\n HttpApiSchema.annotations({ status: 400 }),\n) {}\n\nexport class Conflict extends Schema.TaggedError<Conflict>()(\n \"Conflict\",\n { message: Schema.String },\n HttpApiSchema.annotations({ status: 409 }),\n) {}\n\nexport class NotAcceptable extends Schema.TaggedError<NotAcceptable>()(\n \"NotAcceptable\",\n { message: Schema.String },\n HttpApiSchema.annotations({ status: 406 }),\n) {}\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n AndroidApplicationIdentifier,\n CreateAndroidApplicationIdentifierBody,\n DeleteAndroidApplicationIdentifierResult,\n} from \"../domain/android-application-identifier\";\nimport { BadRequest, Conflict } from \"../domain/errors\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\nconst projectIdParam = HttpApiSchema.param(\"projectId\", Schema.String);\n\nexport class AndroidApplicationIdentifiersGroup extends HttpApiGroup.make(\n \"androidApplicationIdentifiers\",\n)\n .add(\n HttpApiEndpoint.get(\"list\")`/api/projects/${projectIdParam}/android-application-identifiers`\n .addSuccess(Schema.Struct({ items: Schema.Array(AndroidApplicationIdentifier) }))\n .annotateContext(\n OpenApi.annotations({\n title: \"List Android application identifiers\",\n description: \"List all Android package identifiers for a project\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"create\")`/api/projects/${projectIdParam}/android-application-identifiers`\n .setPayload(CreateAndroidApplicationIdentifierBody)\n .addSuccess(AndroidApplicationIdentifier, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Create Android application identifier\",\n description: \"Register an Android package name for a project\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/android-application-identifiers/${idParam}`\n .addSuccess(DeleteAndroidApplicationIdentifierResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete Android application identifier\",\n description: \"Remove an Android application identifier\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(BadRequest)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Android Application Identifiers\",\n description: \"Manage Android package name registrations per project\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id } from \"./common\";\n\nexport class AndroidBuildCredentials extends Schema.Class<AndroidBuildCredentials>(\n \"AndroidBuildCredentials\",\n)({\n id: Id,\n organizationId: Id,\n androidApplicationIdentifierId: Id,\n androidUploadKeystoreId: Schema.NullOr(Id),\n googleServiceAccountKeyForSubmissionsId: Schema.NullOr(Id),\n googleServiceAccountKeyForFcmV1Id: Schema.NullOr(Id),\n name: Schema.String,\n isDefault: Schema.Boolean,\n createdAt: DateTimeString,\n updatedAt: DateTimeString,\n}) {}\n\nexport const CreateAndroidBuildCredentialsBody = Schema.Struct({\n name: Schema.String.pipe(Schema.minLength(1), Schema.maxLength(120)),\n androidUploadKeystoreId: Schema.optional(Id),\n googleServiceAccountKeyForSubmissionsId: Schema.optional(Id),\n googleServiceAccountKeyForFcmV1Id: Schema.optional(Id),\n isDefault: Schema.optional(Schema.Boolean),\n});\n\nexport const UpdateAndroidBuildCredentialsBody = Schema.Struct({\n name: Schema.optional(Schema.String.pipe(Schema.minLength(1), Schema.maxLength(120))),\n androidUploadKeystoreId: Schema.optional(Schema.NullOr(Id)),\n googleServiceAccountKeyForSubmissionsId: Schema.optional(Schema.NullOr(Id)),\n googleServiceAccountKeyForFcmV1Id: Schema.optional(Schema.NullOr(Id)),\n isDefault: Schema.optional(Schema.Boolean),\n});\n\nexport const DeleteAndroidBuildCredentialsResult = Schema.Struct({ deleted: Schema.Number });\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n AndroidBuildCredentials,\n CreateAndroidBuildCredentialsBody,\n DeleteAndroidBuildCredentialsResult,\n UpdateAndroidBuildCredentialsBody,\n} from \"../domain/android-build-credentials\";\nimport { BadRequest, Conflict } from \"../domain/errors\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\nconst applicationIdentifierIdParam = HttpApiSchema.param(\"applicationIdentifierId\", Schema.String);\n\nexport class AndroidBuildCredentialsGroup extends HttpApiGroup.make(\"androidBuildCredentials\")\n .add(\n HttpApiEndpoint.get(\n \"list\",\n )`/api/android-application-identifiers/${applicationIdentifierIdParam}/build-credentials`\n .addSuccess(Schema.Struct({ items: Schema.Array(AndroidBuildCredentials) }))\n .annotateContext(\n OpenApi.annotations({\n title: \"List Android build credentials\",\n description: \"List named build credential groups for an Android app identifier\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\n \"create\",\n )`/api/android-application-identifiers/${applicationIdentifierIdParam}/build-credentials`\n .setPayload(CreateAndroidBuildCredentialsBody)\n .addSuccess(AndroidBuildCredentials, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Create Android build credentials group\",\n description: \"Create a named build credentials group (Default or custom)\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.put(\"update\")`/api/android-build-credentials/${idParam}`\n .setPayload(UpdateAndroidBuildCredentialsBody)\n .addSuccess(AndroidBuildCredentials)\n .annotateContext(\n OpenApi.annotations({\n title: \"Update Android build credentials\",\n description: \"Rename group, change default flag, or swap bound keystore/keys\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/android-build-credentials/${idParam}`\n .addSuccess(DeleteAndroidBuildCredentialsResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete Android build credentials\",\n description: \"Remove a build credentials group\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(BadRequest)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Android Build Credentials\",\n description: \"Named groups of build credentials per Android application identifier\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id } from \"./common\";\n\nexport class AndroidUploadKeystore extends Schema.Class<AndroidUploadKeystore>(\n \"AndroidUploadKeystore\",\n)({\n id: Id,\n organizationId: Id,\n keyAlias: Schema.String,\n md5Fingerprint: Schema.NullOr(Schema.String),\n sha1Fingerprint: Schema.NullOr(Schema.String),\n sha256Fingerprint: Schema.NullOr(Schema.String),\n createdAt: DateTimeString,\n updatedAt: DateTimeString,\n}) {}\n\nexport const UploadAndroidUploadKeystoreBody = Schema.Struct({\n keystoreBase64: Schema.String.pipe(Schema.minLength(1)),\n keyAlias: Schema.String.pipe(Schema.minLength(1), Schema.maxLength(200)),\n keystorePassword: Schema.String.pipe(Schema.minLength(1)),\n keyPassword: Schema.String.pipe(Schema.minLength(1)),\n md5Fingerprint: Schema.optional(Schema.String.pipe(Schema.maxLength(200))),\n sha1Fingerprint: Schema.optional(Schema.String.pipe(Schema.maxLength(200))),\n sha256Fingerprint: Schema.optional(Schema.String.pipe(Schema.maxLength(200))),\n});\n\nexport const DeleteAndroidUploadKeystoreResult = Schema.Struct({ deleted: Schema.Number });\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n AndroidUploadKeystore,\n DeleteAndroidUploadKeystoreResult,\n UploadAndroidUploadKeystoreBody,\n} from \"../domain/android-upload-keystore\";\nimport { BadRequest, Conflict } from \"../domain/errors\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\n\nexport class AndroidUploadKeystoresGroup extends HttpApiGroup.make(\"androidUploadKeystores\")\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/android/upload-keystores\")\n .addSuccess(Schema.Struct({ items: Schema.Array(AndroidUploadKeystore) }))\n .annotateContext(\n OpenApi.annotations({\n title: \"List Android upload keystores\",\n description: \"List uploaded Android keystores\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"upload\", \"/api/android/upload-keystores\")\n .setPayload(UploadAndroidUploadKeystoreBody)\n .addSuccess(AndroidUploadKeystore, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Upload Android keystore\",\n description: \"Upload a JKS/PKCS12 keystore with key alias + passwords\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/android/upload-keystores/${idParam}`\n .addSuccess(DeleteAndroidUploadKeystoreResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete Android keystore\",\n description: \"Remove a stored Android keystore\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(BadRequest)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Android Upload Keystores\",\n description: \"Manage Android signing keystores\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id } from \"./common\";\n\nexport const AppleTeamType = Schema.Literal(\"IN_HOUSE\", \"COMPANY_ORGANIZATION\", \"INDIVIDUAL\");\nexport type AppleTeamTypeValue = typeof AppleTeamType.Type;\n\nexport const AppleTeamIdentifier = Schema.String.pipe(\n Schema.pattern(/^[A-Z0-9]{10}$/u, {\n message: () => \"Apple Team identifier must be 10 uppercase alphanumeric characters\",\n }),\n);\n\nexport class AppleTeam extends Schema.Class<AppleTeam>(\"AppleTeam\")({\n id: Id,\n organizationId: Id,\n appleTeamId: Schema.String,\n appleTeamType: AppleTeamType,\n name: Schema.NullOr(Schema.String),\n distributionCertificateCount: Schema.Number,\n pushKeyCount: Schema.Number,\n ascApiKeyCount: Schema.Number,\n provisioningProfileCount: Schema.Number,\n deviceCount: Schema.Number,\n createdAt: DateTimeString,\n updatedAt: DateTimeString,\n}) {}\n","import { Schema } from \"effect\";\n\nimport { AppleTeamIdentifier } from \"./apple-team\";\nimport { DateTimeString, Id } from \"./common\";\n\nexport class AppleDistributionCertificate extends Schema.Class<AppleDistributionCertificate>(\n \"AppleDistributionCertificate\",\n)({\n id: Id,\n organizationId: Id,\n appleTeamId: Id,\n serialNumber: Schema.String,\n developerIdIdentifier: Schema.NullOr(Schema.String),\n validFrom: DateTimeString,\n validUntil: DateTimeString,\n createdAt: DateTimeString,\n updatedAt: DateTimeString,\n}) {}\n\nexport const UploadAppleDistributionCertificateBody = Schema.Struct({\n p12Base64: Schema.String.pipe(Schema.minLength(1)),\n p12Password: Schema.String.pipe(Schema.minLength(1)),\n serialNumber: Schema.String.pipe(Schema.minLength(1), Schema.maxLength(200)),\n appleTeamIdentifier: AppleTeamIdentifier,\n appleTeamName: Schema.optional(Schema.String.pipe(Schema.maxLength(200))),\n appleTeamType: Schema.optional(Schema.Literal(\"IN_HOUSE\", \"COMPANY_ORGANIZATION\", \"INDIVIDUAL\")),\n developerIdIdentifier: Schema.optional(Schema.String.pipe(Schema.maxLength(200))),\n validFrom: DateTimeString,\n validUntil: DateTimeString,\n});\n\nexport const DeleteAppleDistributionCertificateResult = Schema.Struct({\n deleted: Schema.Number,\n});\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n AppleDistributionCertificate,\n DeleteAppleDistributionCertificateResult,\n UploadAppleDistributionCertificateBody,\n} from \"../domain/apple-distribution-certificate\";\nimport { BadRequest, Conflict } from \"../domain/errors\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\n\nexport class AppleDistributionCertificatesGroup extends HttpApiGroup.make(\n \"appleDistributionCertificates\",\n)\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/apple/distribution-certificates\")\n .addSuccess(Schema.Struct({ items: Schema.Array(AppleDistributionCertificate) }))\n .annotateContext(\n OpenApi.annotations({\n title: \"List Apple distribution certificates\",\n description: \"List uploaded Apple distribution certificates for the organization\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"upload\", \"/api/apple/distribution-certificates\")\n .setPayload(UploadAppleDistributionCertificateBody)\n .addSuccess(AppleDistributionCertificate, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Upload distribution certificate\",\n description:\n \"Upload a .p12 distribution certificate; auto-derives the Apple team from the provided identifier\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/apple/distribution-certificates/${idParam}`\n .addSuccess(DeleteAppleDistributionCertificateResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete distribution certificate\",\n description: \"Remove a distribution certificate from storage\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(BadRequest)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Apple Distribution Certificates\",\n description: \"Manage .p12 distribution certificates\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id } from \"./common\";\n\nexport const DistributionType = Schema.Literal(\"APP_STORE\", \"AD_HOC\", \"ENTERPRISE\", \"DEVELOPMENT\");\nexport type DistributionTypeValue = typeof DistributionType.Type;\n\nexport const BundleIdentifier = Schema.String.pipe(\n Schema.pattern(/^[A-Za-z0-9.\\-_]{1,200}$/u, {\n message: () => \"Bundle identifier must be reverse-domain style (letters, digits, dot, dash)\",\n }),\n);\n\nexport class AppleProvisioningProfile extends Schema.Class<AppleProvisioningProfile>(\n \"AppleProvisioningProfile\",\n)({\n id: Id,\n organizationId: Id,\n appleTeamId: Id,\n appleDistributionCertificateId: Schema.NullOr(Id),\n bundleIdentifier: Schema.String,\n distributionType: DistributionType,\n developerPortalIdentifier: Schema.NullOr(Schema.String),\n profileName: Schema.NullOr(Schema.String),\n validUntil: Schema.NullOr(DateTimeString),\n createdAt: DateTimeString,\n updatedAt: DateTimeString,\n}) {}\n\nexport const UploadAppleProvisioningProfileBody = Schema.Struct({\n profileBase64: Schema.String.pipe(Schema.minLength(1)),\n appleDistributionCertificateId: Schema.optional(Id),\n});\n\nexport const GenerateAppleProvisioningProfileBody = Schema.Struct({\n ascApiKeyId: Id,\n appleDistributionCertificateId: Id,\n bundleIdentifier: BundleIdentifier,\n distributionType: DistributionType,\n deviceIds: Schema.optional(Schema.Array(Id)),\n});\n\nexport const DeleteAppleProvisioningProfileResult = Schema.Struct({ deleted: Schema.Number });\n\nexport const ListAppleProvisioningProfilesParams = Schema.Struct({\n bundleIdentifier: Schema.optional(BundleIdentifier),\n distributionType: Schema.optional(DistributionType),\n appleTeamId: Schema.optional(Id),\n});\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n AppleProvisioningProfile,\n DeleteAppleProvisioningProfileResult,\n GenerateAppleProvisioningProfileBody,\n ListAppleProvisioningProfilesParams,\n UploadAppleProvisioningProfileBody,\n} from \"../domain/apple-provisioning-profile\";\nimport { BadRequest, Conflict } from \"../domain/errors\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\n\nexport class AppleProvisioningProfilesGroup extends HttpApiGroup.make(\"appleProvisioningProfiles\")\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/apple/provisioning-profiles\")\n .setUrlParams(ListAppleProvisioningProfilesParams)\n .addSuccess(Schema.Struct({ items: Schema.Array(AppleProvisioningProfile) }))\n .annotateContext(\n OpenApi.annotations({\n title: \"List provisioning profiles\",\n description: \"List stored provisioning profiles, optionally filtered by bundle + team\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"upload\", \"/api/apple/provisioning-profiles\")\n .setPayload(UploadAppleProvisioningProfileBody)\n .addSuccess(AppleProvisioningProfile, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Upload provisioning profile\",\n description: \"Upload an existing .mobileprovision; auto-parses the embedded plist\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"generate\", \"/api/apple/provisioning-profiles/generate\")\n .setPayload(GenerateAppleProvisioningProfileBody)\n .addSuccess(AppleProvisioningProfile, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Generate provisioning profile\",\n description: \"Generate + download a new provisioning profile via App Store Connect API\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/apple/provisioning-profiles/${idParam}`\n .addSuccess(DeleteAppleProvisioningProfileResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete provisioning profile\",\n description: \"Remove a stored provisioning profile\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(BadRequest)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Apple Provisioning Profiles\",\n description: \"Manage .mobileprovision profiles (upload or generate)\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { AppleTeamIdentifier } from \"./apple-team\";\nimport { DateTimeString, Id } from \"./common\";\n\nexport const ApplePushKeyId = Schema.String.pipe(\n Schema.pattern(/^[A-Z0-9]{10}$/u, {\n message: () => \"Push Key ID must be 10 uppercase alphanumeric characters\",\n }),\n);\n\nexport class ApplePushKey extends Schema.Class<ApplePushKey>(\"ApplePushKey\")({\n id: Id,\n organizationId: Id,\n appleTeamId: Id,\n keyId: Schema.String,\n createdAt: DateTimeString,\n updatedAt: DateTimeString,\n}) {}\n\nexport const UploadApplePushKeyBody = Schema.Struct({\n keyId: ApplePushKeyId,\n p8Pem: Schema.String.pipe(Schema.minLength(1)),\n appleTeamIdentifier: AppleTeamIdentifier,\n appleTeamName: Schema.optional(Schema.String.pipe(Schema.maxLength(200))),\n appleTeamType: Schema.optional(Schema.Literal(\"IN_HOUSE\", \"COMPANY_ORGANIZATION\", \"INDIVIDUAL\")),\n});\n\nexport const DeleteApplePushKeyResult = Schema.Struct({ deleted: Schema.Number });\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n ApplePushKey,\n DeleteApplePushKeyResult,\n UploadApplePushKeyBody,\n} from \"../domain/apple-push-key\";\nimport { BadRequest, Conflict } from \"../domain/errors\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\n\nexport class ApplePushKeysGroup extends HttpApiGroup.make(\"applePushKeys\")\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/apple/push-keys\")\n .addSuccess(Schema.Struct({ items: Schema.Array(ApplePushKey) }))\n .annotateContext(\n OpenApi.annotations({\n title: \"List Apple push keys\",\n description: \"List APNs push keys for the organization\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"upload\", \"/api/apple/push-keys\")\n .setPayload(UploadApplePushKeyBody)\n .addSuccess(ApplePushKey, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Upload push key\",\n description: \"Upload an APNs .p8 push notification key\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/apple/push-keys/${idParam}`\n .addSuccess(DeleteApplePushKeyResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete push key\",\n description: \"Remove a stored APNs push key\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(BadRequest)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Apple Push Keys\",\n description: \"Manage APNs push notification keys\",\n }),\n ) {}\n","import { HttpApiEndpoint, HttpApiGroup, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { AppleTeam } from \"../domain/apple-team\";\n\nexport class AppleTeamsGroup extends HttpApiGroup.make(\"appleTeams\")\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/apple-teams\")\n .addSuccess(Schema.Struct({ items: Schema.Array(AppleTeam) }))\n .annotateContext(\n OpenApi.annotations({\n title: \"List Apple teams\",\n description:\n \"List Apple developer teams derived from uploaded artifacts (certs, push keys, ASC keys)\",\n }),\n ),\n )\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Apple Teams\",\n description: \"Read-only view of Apple teams auto-created from uploaded credentials\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { AppleTeamIdentifier } from \"./apple-team\";\nimport { DateTimeString, Id } from \"./common\";\n\nexport const AscApiKeyId = Schema.String.pipe(\n Schema.pattern(/^[A-Z0-9]{10}$/u, {\n message: () => \"ASC API Key ID must be 10 uppercase alphanumeric characters\",\n }),\n);\n\nexport const IssuerId = Schema.String.pipe(\n Schema.pattern(/^[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}$/u, {\n message: () => \"Issuer ID must be a UUID (8-4-4-4-12 hex)\",\n }),\n);\n\nexport class AscApiKey extends Schema.Class<AscApiKey>(\"AscApiKey\")({\n id: Id,\n organizationId: Id,\n appleTeamId: Schema.NullOr(Id),\n keyId: Schema.String,\n name: Schema.String,\n roles: Schema.Array(Schema.String),\n createdAt: DateTimeString,\n updatedAt: DateTimeString,\n}) {}\n\nexport const UploadAscApiKeyBody = Schema.Struct({\n name: Schema.String.pipe(Schema.minLength(1), Schema.maxLength(120)),\n keyId: AscApiKeyId,\n issuerId: IssuerId,\n p8Pem: Schema.String.pipe(Schema.minLength(1)),\n appleTeamIdentifier: Schema.optional(AppleTeamIdentifier),\n appleTeamName: Schema.optional(Schema.String.pipe(Schema.maxLength(200))),\n appleTeamType: Schema.optional(Schema.Literal(\"IN_HOUSE\", \"COMPANY_ORGANIZATION\", \"INDIVIDUAL\")),\n roles: Schema.optional(Schema.Array(Schema.String)),\n});\n\nexport const DeleteAscApiKeyResult = Schema.Struct({ deleted: Schema.Number });\n\nexport const SyncedDeviceSummary = Schema.Struct({\n id: Id,\n identifier: Schema.String,\n name: Schema.String,\n deviceClass: Schema.Literal(\"IPHONE\", \"IPAD\", \"MAC\", \"UNKNOWN\"),\n});\n\nexport const SyncDevicesResult = Schema.Struct({\n pulled: Schema.Number,\n pushed: Schema.Number,\n skipped: Schema.Number,\n devices: Schema.Array(SyncedDeviceSummary),\n});\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n AscApiKey,\n DeleteAscApiKeyResult,\n SyncDevicesResult,\n UploadAscApiKeyBody,\n} from \"../domain/asc-api-key\";\nimport { BadRequest, Conflict } from \"../domain/errors\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\n\nexport class AscApiKeysGroup extends HttpApiGroup.make(\"ascApiKeys\")\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/apple/asc-api-keys\")\n .addSuccess(Schema.Struct({ items: Schema.Array(AscApiKey) }))\n .annotateContext(\n OpenApi.annotations({\n title: \"List App Store Connect API keys\",\n description: \"List stored ASC API keys for the organization\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"upload\", \"/api/apple/asc-api-keys\")\n .setPayload(UploadAscApiKeyBody)\n .addSuccess(AscApiKey, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Upload ASC API key\",\n description: \"Upload an App Store Connect API key (.p8 + issuer)\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/apple/asc-api-keys/${idParam}`\n .addSuccess(DeleteAscApiKeyResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete ASC API key\",\n description: \"Remove a stored ASC API key\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"syncDevices\")`/api/apple/asc-api-keys/${idParam}/sync-devices`\n .addSuccess(SyncDevicesResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Sync devices via ASC API key\",\n description:\n \"Pull registered devices from Apple Developer Portal for this key's team; push local devices that aren't yet registered\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(BadRequest)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"App Store Connect API Keys\",\n description: \"Manage ASC API keys used for device + profile sync\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id, UploadHeaders } from \"./common\";\n\nexport class Asset extends Schema.Class<Asset>(\"Asset\")({\n hash: Schema.String,\n contentType: Schema.String,\n fileExt: Schema.String,\n byteSize: Schema.Number,\n r2Key: Schema.String,\n createdAt: DateTimeString,\n}) {}\n\nexport const AssetUploadBody = Schema.Struct({\n projectId: Id,\n assets: Schema.Array(\n Schema.Struct({\n hash: Schema.String,\n contentType: Schema.String,\n fileExt: Schema.String,\n contentChecksum: Schema.optional(Schema.String),\n }),\n ),\n});\n\nexport const AssetUploadResult = Schema.Struct({\n uploaded: Schema.Array(\n Schema.Struct({\n hash: Schema.String,\n uploadMode: Schema.Literal(\"single\"),\n uploadUrl: Schema.String,\n uploadExpiresAt: DateTimeString,\n uploadHeaders: UploadHeaders,\n }),\n ),\n deduplicated: Schema.Array(Schema.String),\n});\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport { Asset, AssetUploadBody, AssetUploadResult } from \"../domain/asset\";\nimport { BadRequest } from \"../domain/errors\";\n\nconst hashParam = HttpApiSchema.param(\"hash\", Schema.String);\n\nexport class AssetsGroup extends HttpApiGroup.make(\"assets\")\n .add(\n HttpApiEndpoint.post(\"upload\", \"/api/assets/upload\")\n .setPayload(AssetUploadBody)\n .addSuccess(AssetUploadResult, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Upload assets\",\n description: \"Upload asset files to R2 storage (deduplicated by content hash)\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"finalize\")`/api/assets/${hashParam}/finalize`\n .addSuccess(Asset)\n .annotateContext(\n OpenApi.annotations({\n title: \"Finalize asset upload\",\n description: \"Verify a directly uploaded asset in R2 and mark it available for updates\",\n }),\n ),\n )\n .addError(BadRequest)\n .addError(NotFound)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Assets\",\n description: \"Asset upload endpoints\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id } from \"./common\";\n\nexport const AuditLogResourceType = Schema.Literal(\n \"project\",\n \"branch\",\n \"channel\",\n \"update\",\n \"build\",\n \"appleCredential\",\n \"androidCredential\",\n \"iosBundleConfiguration\",\n \"envVar\",\n \"device\",\n);\n\nexport const AuditLogSource = Schema.Literal(\"session\", \"api-key\");\n\nexport class AuditLog extends Schema.Class<AuditLog>(\"AuditLog\")({\n id: Id,\n organizationId: Id,\n actorId: Schema.NullOr(Schema.String),\n actorEmail: Schema.String,\n action: Schema.String,\n resourceType: AuditLogResourceType,\n resourceId: Schema.NullOr(Schema.String),\n metadata: Schema.NullOr(Schema.String),\n source: AuditLogSource,\n createdAt: DateTimeString,\n}) {}\n","import { HttpApiEndpoint, HttpApiGroup, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { AuditLog } from \"../domain/audit-log\";\nimport { CursorPaginationParams, cursorPageResult } from \"../domain/common\";\n\nexport class AuditLogsGroup extends HttpApiGroup.make(\"audit-logs\")\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/audit-logs\")\n .setUrlParams(\n Schema.Struct({\n projectId: Schema.optional(Schema.String),\n resourceType: Schema.optional(Schema.String),\n from: Schema.optional(Schema.String),\n to: Schema.optional(Schema.String),\n ...CursorPaginationParams.fields,\n }),\n )\n .addSuccess(cursorPageResult(AuditLog))\n .annotateContext(\n OpenApi.annotations({\n title: \"List audit logs\",\n description: \"List audit log entries with optional filters\",\n }),\n ),\n )\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Audit Logs\",\n description: \"View audit trail for organization actions\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id, PaginationParams } from \"./common\";\n\nexport class Branch extends Schema.Class<Branch>(\"Branch\")({\n id: Id,\n projectId: Id,\n name: Schema.String,\n createdAt: DateTimeString,\n updateCount: Schema.Number,\n}) {}\n\nexport const BranchSortColumn = Schema.Literal(\"name\", \"createdAt\", \"updateCount\");\n\n/**\n * Sort param: column name optionally prefixed with `-` for descending.\n * Example: `name` (asc), `-createdAt` (desc).\n */\nexport const BranchSort = Schema.Union(\n BranchSortColumn,\n Schema.TemplateLiteral(\"-\", BranchSortColumn),\n);\n\nexport const ListBranchesParams = Schema.Struct({\n projectId: Id,\n ...PaginationParams.fields,\n sort: Schema.optional(BranchSort),\n});\n\nexport const CreateBranchBody = Schema.Struct({\n projectId: Id,\n name: Schema.String.pipe(Schema.minLength(1)),\n});\n\nexport const UpdateBranchBody = Schema.Struct({\n name: Schema.String.pipe(Schema.minLength(1)),\n});\n\nexport const DeleteBranchResult = Schema.Struct({ deleted: Schema.Number });\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n Branch,\n CreateBranchBody,\n DeleteBranchResult,\n ListBranchesParams,\n UpdateBranchBody,\n} from \"../domain/branch\";\nimport { Conflict } from \"../domain/errors\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\n\nexport class BranchesGroup extends HttpApiGroup.make(\"branches\")\n .add(\n HttpApiEndpoint.post(\"create\", \"/api/branches\")\n .setPayload(CreateBranchBody)\n .addSuccess(Branch, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Create branch\",\n description: \"Create a new branch within a project\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/branches\")\n .setUrlParams(ListBranchesParams)\n .addSuccess(\n Schema.Struct({\n items: Schema.Array(Branch),\n total: Schema.Number,\n page: Schema.Number,\n limit: Schema.Number,\n }),\n )\n .annotateContext(\n OpenApi.annotations({\n title: \"List branches\",\n description: \"List all branches for a project\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.patch(\"rename\")`/api/branches/${idParam}`\n .setPayload(UpdateBranchBody)\n .addSuccess(Branch)\n .addError(Conflict)\n .annotateContext(\n OpenApi.annotations({\n title: \"Rename branch\",\n description: \"Rename a branch (channels and updates are unaffected)\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/branches/${idParam}`\n .addSuccess(DeleteBranchResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete branch\",\n description: \"Delete a branch and all its updates\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Branches\",\n description: \"Branch management endpoints\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { AndroidPackageName } from \"./android-application-identifier\";\nimport { BundleIdentifier, DistributionType } from \"./apple-provisioning-profile\";\n\nexport const ResolveBuildCredentialsIosBody = Schema.Struct({\n platform: Schema.Literal(\"ios\"),\n bundleIdentifier: BundleIdentifier,\n distributionType: DistributionType,\n});\n\nexport const ResolveBuildCredentialsAndroidBody = Schema.Struct({\n platform: Schema.Literal(\"android\"),\n applicationIdentifier: AndroidPackageName,\n});\n\nexport const ResolveBuildCredentialsBody = Schema.Union(\n ResolveBuildCredentialsIosBody,\n ResolveBuildCredentialsAndroidBody,\n);\n\nexport const IosBuildDistributionCertificate = Schema.Struct({\n p12Base64: Schema.String,\n p12Password: Schema.String,\n});\n\nexport const IosBuildProvisioningProfile = Schema.Struct({\n mobileprovisionBase64: Schema.String,\n uuid: Schema.NullOr(Schema.String),\n name: Schema.NullOr(Schema.String),\n teamId: Schema.String,\n bundleIdentifier: Schema.String,\n distributionType: DistributionType,\n});\n\nexport const IosBuildPushKey = Schema.Struct({\n p8Base64: Schema.String,\n keyId: Schema.String,\n teamId: Schema.String,\n});\n\nexport const ResolveBuildCredentialsIosResult = Schema.Struct({\n platform: Schema.Literal(\"ios\"),\n distributionCertificate: IosBuildDistributionCertificate,\n provisioningProfile: IosBuildProvisioningProfile,\n pushKey: Schema.NullOr(IosBuildPushKey),\n});\n\nexport const AndroidBuildKeystore = Schema.Struct({\n keystoreBase64: Schema.String,\n storePassword: Schema.String,\n keyAlias: Schema.String,\n keyPassword: Schema.String,\n});\n\nexport const ResolveBuildCredentialsAndroidResult = Schema.Struct({\n platform: Schema.Literal(\"android\"),\n keystore: AndroidBuildKeystore,\n});\n\nexport const ResolveBuildCredentialsResult = Schema.Union(\n ResolveBuildCredentialsIosResult,\n ResolveBuildCredentialsAndroidResult,\n);\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n ResolveBuildCredentialsBody,\n ResolveBuildCredentialsResult,\n} from \"../domain/build-credentials\";\nimport { BadRequest } from \"../domain/errors\";\n\nconst projectIdParam = HttpApiSchema.param(\"projectId\", Schema.String);\n\nexport class BuildCredentialsGroup extends HttpApiGroup.make(\"buildCredentials\")\n .add(\n HttpApiEndpoint.post(\"resolve\")`/api/projects/${projectIdParam}/build-credentials/resolve`\n .setPayload(ResolveBuildCredentialsBody)\n .addSuccess(ResolveBuildCredentialsResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Resolve build credentials\",\n description:\n \"Return decrypted signing assets for a project build. Regenerates the iOS provisioning profile via Apple ASC when the registered device roster has changed since the profile was last generated.\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(BadRequest)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Build Credentials\",\n description: \"Materialize signing assets needed by a CLI build run\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id, PaginationParams, Platform, UploadHeaders } from \"./common\";\n\nexport const Distribution = Schema.Literal(\n \"app-store\",\n \"ad-hoc\",\n \"development\",\n \"enterprise\",\n \"simulator\",\n \"play-store\",\n \"direct\",\n);\n\nexport const ArtifactFormat = Schema.Literal(\"ipa\", \"apk\", \"aab\", \"tar.gz\");\nconst Sha256Hex = Schema.String.pipe(Schema.pattern(/^[a-fA-F0-9]{64}$/u), Schema.maxLength(64));\n\nconst CreateBuildCommonFields = {\n projectId: Id,\n profile: Schema.optional(Schema.String),\n runtimeVersion: Schema.optional(Schema.String),\n appVersion: Schema.optional(Schema.String),\n buildNumber: Schema.optional(Schema.String),\n bundleId: Schema.optional(Schema.String),\n gitRef: Schema.optional(Schema.String),\n gitCommit: Schema.optional(Schema.String),\n message: Schema.optional(Schema.String),\n metadata: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Unknown })),\n sha256: Sha256Hex,\n byteSize: Schema.Number.pipe(Schema.nonNegative()),\n} as const;\n\nexport class Build extends Schema.Class<Build>(\"Build\")({\n id: Id,\n projectId: Id,\n platform: Platform,\n profile: Schema.String,\n distribution: Distribution,\n runtimeVersion: Schema.NullOr(Schema.String),\n appVersion: Schema.NullOr(Schema.String),\n buildNumber: Schema.NullOr(Schema.String),\n bundleId: Schema.NullOr(Schema.String),\n gitRef: Schema.NullOr(Schema.String),\n gitCommit: Schema.NullOr(Schema.String),\n message: Schema.NullOr(Schema.String),\n metadataJson: Schema.String,\n createdAt: DateTimeString,\n}) {}\n\nexport class BuildArtifact extends Schema.Class<BuildArtifact>(\"BuildArtifact\")({\n buildId: Id,\n r2Key: Schema.String,\n format: ArtifactFormat,\n contentType: Schema.String,\n byteSize: Schema.Number,\n sha256: Schema.String,\n createdAt: DateTimeString,\n}) {}\n\nexport class BuildWithArtifact extends Build.extend<BuildWithArtifact>(\"BuildWithArtifact\")({\n artifact: Schema.NullOr(\n Schema.Struct({\n r2Key: Schema.String,\n format: ArtifactFormat,\n contentType: Schema.String,\n byteSize: Schema.Number,\n sha256: Schema.String,\n }),\n ),\n}) {}\n\nexport const CreateBuildBody = Schema.Union(\n Schema.Struct({\n ...CreateBuildCommonFields,\n platform: Schema.Literal(\"ios\"),\n distribution: Schema.Literal(\"app-store\", \"ad-hoc\", \"development\", \"enterprise\"),\n artifactFormat: Schema.Literal(\"ipa\"),\n }),\n Schema.Struct({\n ...CreateBuildCommonFields,\n platform: Schema.Literal(\"ios\"),\n distribution: Schema.Literal(\"simulator\"),\n artifactFormat: Schema.Literal(\"tar.gz\"),\n }),\n Schema.Struct({\n ...CreateBuildCommonFields,\n platform: Schema.Literal(\"android\"),\n distribution: Schema.Literal(\"play-store\"),\n artifactFormat: Schema.Literal(\"aab\"),\n }),\n Schema.Struct({\n ...CreateBuildCommonFields,\n platform: Schema.Literal(\"android\"),\n distribution: Schema.Literal(\"direct\"),\n artifactFormat: Schema.Literal(\"apk\"),\n }),\n);\n\nexport const BuildSortColumn = Schema.Literal(\n \"createdAt\",\n \"platform\",\n \"distribution\",\n \"runtimeVersion\",\n \"appVersion\",\n);\n\n/**\n * Sort param: column name optionally prefixed with `-` for descending.\n * Example: `runtimeVersion` (asc), `-createdAt` (desc).\n */\nexport const BuildSort = Schema.Union(\n BuildSortColumn,\n Schema.TemplateLiteral(\"-\", BuildSortColumn),\n);\n\nexport const ListBuildsParams = Schema.Struct({\n projectId: Id,\n platform: Schema.optional(Platform),\n profile: Schema.optional(Schema.String),\n runtimeVersion: Schema.optional(Schema.String),\n distribution: Schema.optional(Distribution),\n ...PaginationParams.fields,\n sort: Schema.optional(BuildSort),\n});\n\nexport const CompleteBuildBody = Schema.Struct({\n sha256: Sha256Hex,\n byteSize: Schema.Number.pipe(Schema.nonNegative()),\n});\n\nexport const ReserveBuildResult = Schema.Struct({\n id: Id,\n uploadMode: Schema.Literal(\"single\"),\n uploadUrl: Schema.String,\n uploadExpiresAt: DateTimeString,\n uploadHeaders: UploadHeaders,\n});\n\nexport const DeleteBuildResult = Schema.Struct({\n deleted: Schema.Number,\n});\n\nexport const InstallLinkResult = Schema.Struct({\n token: Schema.String,\n expires: Schema.Number,\n artifactUrl: Schema.String,\n installUrl: Schema.NullOr(Schema.String),\n});\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id, Platform } from \"./common\";\n\n// Per-runtime channel status — varies per (platform, runtimeVersion).\nexport class BuildCompatibilityChannel extends Schema.Class<BuildCompatibilityChannel>(\n \"BuildCompatibilityChannel\",\n)({\n channelId: Id,\n updateCount: Schema.Number,\n latestUpdateId: Schema.NullOr(Id),\n latestUpdateMessage: Schema.NullOr(Schema.String),\n latestUpdateCreatedAt: Schema.NullOr(DateTimeString),\n}) {}\n\n// Channel-level metadata that does not depend on a specific build's runtime.\nexport class CompatibilityChannelInfo extends Schema.Class<CompatibilityChannelInfo>(\n \"CompatibilityChannelInfo\",\n)({\n channelId: Id,\n channelName: Schema.String,\n isPaused: Schema.Boolean,\n rolloutActive: Schema.Boolean,\n}) {}\n\nexport class MissingRuntimeVersionBuild extends Schema.Class<MissingRuntimeVersionBuild>(\n \"MissingRuntimeVersionBuild\",\n)({\n channelId: Id,\n channelName: Schema.String,\n platform: Platform,\n runtimeVersion: Schema.String,\n updateCount: Schema.Number,\n latestUpdateId: Id,\n latestUpdateMessage: Schema.String,\n latestUpdateCreatedAt: DateTimeString,\n rolloutActive: Schema.Boolean,\n}) {}\n\nexport const BuildCompatibilityMatrixResult = Schema.Struct({\n channels: Schema.Array(CompatibilityChannelInfo),\n channelStatusByKey: Schema.Record({\n key: Schema.String,\n value: Schema.Array(BuildCompatibilityChannel),\n }),\n missingRuntimeVersions: Schema.Array(MissingRuntimeVersionBuild),\n});\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n BuildWithArtifact,\n CompleteBuildBody,\n CreateBuildBody,\n DeleteBuildResult,\n InstallLinkResult,\n ListBuildsParams,\n ReserveBuildResult,\n} from \"../domain/build\";\nimport { BuildCompatibilityMatrixResult } from \"../domain/build-compatibility\";\nimport { Id } from \"../domain/common\";\nimport { BadRequest, Conflict } from \"../domain/errors\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\n\nexport class BuildsGroup extends HttpApiGroup.make(\"builds\")\n .add(\n HttpApiEndpoint.post(\"reserve\", \"/api/builds\")\n .setPayload(CreateBuildBody)\n .addSuccess(ReserveBuildResult, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Reserve build\",\n description: \"Reserve a build ID and get a presigned upload URL\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"complete\")`/api/builds/${idParam}/complete`\n .setPayload(CompleteBuildBody)\n .addSuccess(BuildWithArtifact)\n .addError(Conflict)\n .annotateContext(\n OpenApi.annotations({\n title: \"Complete build\",\n description: \"Finalize a build after artifact upload\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/builds\")\n .setUrlParams(ListBuildsParams)\n .addSuccess(\n Schema.Struct({\n items: Schema.Array(BuildWithArtifact),\n total: Schema.Number,\n page: Schema.Number,\n limit: Schema.Number,\n }),\n )\n .annotateContext(\n OpenApi.annotations({\n title: \"List builds\",\n description: \"List builds for a project with optional filters\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"compatibilityMatrix\", \"/api/builds/compatibility-matrix\")\n .setUrlParams(\n Schema.Struct({\n projectId: Id,\n }),\n )\n .addSuccess(BuildCompatibilityMatrixResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Build compatibility matrix\",\n description: \"List build-to-channel OTA compatibility for a project\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"get\")`/api/builds/${idParam}`\n .addSuccess(BuildWithArtifact)\n .annotateContext(\n OpenApi.annotations({\n title: \"Get build\",\n description: \"Get a build by ID with artifact details\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/builds/${idParam}`\n .addSuccess(DeleteBuildResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete build\",\n description: \"Delete a build and its artifact from storage\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"getInstallLink\")`/api/builds/${idParam}/install-link`\n .addSuccess(InstallLinkResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Get install link\",\n description: \"Generate a signed install link for a build artifact\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Forbidden)\n .addError(BadRequest)\n .annotateContext(\n OpenApi.annotations({\n title: \"Builds\",\n description: \"Build artifact upload, tracking, and download endpoints\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id, PaginationParams } from \"./common\";\n\nexport class Channel extends Schema.Class<Channel>(\"Channel\")({\n id: Id,\n projectId: Id,\n name: Schema.String,\n branchId: Id,\n branchMappingJson: Schema.NullOr(Schema.String),\n cacheVersion: Schema.Number,\n isPaused: Schema.Boolean,\n createdAt: DateTimeString,\n}) {}\n\nexport const ChannelSortColumn = Schema.Literal(\"name\", \"createdAt\");\n\n/**\n * Sort param: column name optionally prefixed with `-` for descending.\n * Example: `name` (asc), `-createdAt` (desc).\n */\nexport const ChannelSort = Schema.Union(\n ChannelSortColumn,\n Schema.TemplateLiteral(\"-\", ChannelSortColumn),\n);\n\nexport const ListChannelsParams = Schema.Struct({\n projectId: Id,\n ...PaginationParams.fields,\n sort: Schema.optional(ChannelSort),\n});\n\nexport const CreateChannelBody = Schema.Struct({\n projectId: Id,\n name: Schema.String.pipe(Schema.minLength(1)),\n branchId: Id,\n});\n\nexport const UpdateChannelBody = Schema.Struct({\n branchId: Id,\n});\n\nexport const CreateBranchRolloutBody = Schema.Struct({\n newBranchId: Id,\n percentage: Schema.Number.pipe(Schema.int(), Schema.between(1, 100)),\n});\n\nexport const DeleteChannelResult = Schema.Struct({ deleted: Schema.Number });\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n Channel,\n CreateBranchRolloutBody,\n CreateChannelBody,\n DeleteChannelResult,\n ListChannelsParams,\n UpdateChannelBody,\n} from \"../domain/channel\";\nimport { UpdateRolloutBody } from \"../domain/common\";\nimport { Conflict } from \"../domain/errors\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\n\nexport class ChannelsGroup extends HttpApiGroup.make(\"channels\")\n .add(\n HttpApiEndpoint.post(\"create\", \"/api/channels\")\n .setPayload(CreateChannelBody)\n .addSuccess(Channel, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Create channel\",\n description: \"Create a new channel linked to a branch\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.patch(\"update\")`/api/channels/${idParam}`\n .setPayload(UpdateChannelBody)\n .addSuccess(Channel)\n .annotateContext(\n OpenApi.annotations({\n title: \"Update channel\",\n description: \"Relink channel to a different branch\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/channels\")\n .setUrlParams(ListChannelsParams)\n .addSuccess(\n Schema.Struct({\n items: Schema.Array(Channel),\n total: Schema.Number,\n page: Schema.Number,\n limit: Schema.Number,\n }),\n )\n .annotateContext(\n OpenApi.annotations({\n title: \"List channels\",\n description: \"List all channels for a project\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"pause\")`/api/channels/${idParam}/pause`\n .addSuccess(Channel)\n .annotateContext(\n OpenApi.annotations({\n title: \"Pause channel\",\n description: \"Pause a channel — manifest requests return 204 No Content\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"resume\")`/api/channels/${idParam}/resume`\n .addSuccess(Channel)\n .annotateContext(\n OpenApi.annotations({\n title: \"Resume channel\",\n description: \"Resume a paused channel\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"createBranchRollout\")`/api/channels/${idParam}/rollout`\n .setPayload(CreateBranchRolloutBody)\n .addSuccess(Channel)\n .annotateContext(\n OpenApi.annotations({\n title: \"Create branch rollout\",\n description: \"Start a gradual rollout to a new branch on this channel\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.patch(\"updateBranchRollout\")`/api/channels/${idParam}/rollout`\n .setPayload(UpdateRolloutBody)\n .addSuccess(Channel)\n .annotateContext(\n OpenApi.annotations({\n title: \"Update branch rollout\",\n description: \"Change the rollout percentage for a branch rollout\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"completeBranchRollout\")`/api/channels/${idParam}/rollout/complete`\n .addSuccess(Channel)\n .annotateContext(\n OpenApi.annotations({\n title: \"Complete branch rollout\",\n description: \"Finalize the rollout — promote the new branch to 100%\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"revertBranchRollout\")`/api/channels/${idParam}/rollout/revert`\n .addSuccess(Channel)\n .annotateContext(\n OpenApi.annotations({\n title: \"Revert branch rollout\",\n description: \"Revert the rollout — restore the original branch\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/channels/${idParam}`\n .addSuccess(DeleteChannelResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete channel\",\n description: \"Delete a channel\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Channels\",\n description: \"Channel management endpoints including pause/resume and branch rollouts\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id, PaginationParams } from \"./common\";\n\nexport const DeviceClass = Schema.Literal(\"IPHONE\", \"IPAD\", \"MAC\", \"UNKNOWN\");\nexport type DeviceClassValue = typeof DeviceClass.Type;\n\nconst IDENTIFIER_PATTERN =\n /^(?:[A-Fa-f0-9]{40}|[A-Fa-f0-9]{8}-[A-Fa-f0-9]{16}|[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12})$/u;\n\nexport const DeviceIdentifier = Schema.String.pipe(\n Schema.pattern(IDENTIFIER_PATTERN, {\n message: () =>\n \"Identifier must be an Apple UDID: 40 hex chars, 8-16 hex, or UUID (8-4-4-4-12 hex)\",\n }),\n);\n\nexport class Device extends Schema.Class<Device>(\"Device\")({\n id: Id,\n organizationId: Id,\n appleTeamId: Schema.NullOr(Id),\n identifier: Schema.String,\n name: Schema.String,\n model: Schema.NullOr(Schema.String),\n deviceClass: DeviceClass,\n enabled: Schema.Boolean,\n appleDevicePortalId: Schema.NullOr(Schema.String),\n createdAt: DateTimeString,\n updatedAt: DateTimeString,\n}) {}\n\nexport const RegisterDeviceBody = Schema.Struct({\n identifier: DeviceIdentifier,\n name: Schema.String.pipe(Schema.minLength(1), Schema.maxLength(120)),\n deviceClass: DeviceClass,\n model: Schema.optional(Schema.String.pipe(Schema.maxLength(120))),\n appleTeamId: Schema.optional(Id),\n});\n\nexport const UpdateDeviceBody = Schema.Struct({\n name: Schema.optional(Schema.String.pipe(Schema.minLength(1), Schema.maxLength(120))),\n enabled: Schema.optional(Schema.Boolean),\n appleTeamId: Schema.optional(Schema.NullOr(Id)),\n});\n\nexport const DeleteDeviceResult = Schema.Struct({ deleted: Schema.Number });\n\nexport const DeviceSortColumn = Schema.Literal(\"name\", \"createdAt\", \"deviceClass\");\n\n/**\n * Sort param: column name optionally prefixed with `-` for descending.\n * Example: `name` (asc), `-createdAt` (desc).\n */\nexport const DeviceSort = Schema.Union(\n DeviceSortColumn,\n Schema.TemplateLiteral(\"-\", DeviceSortColumn),\n);\n\nexport const ListDevicesParams = Schema.Struct({\n ...PaginationParams.fields,\n deviceClass: Schema.optional(DeviceClass),\n appleTeamId: Schema.optional(Id),\n query: Schema.optional(Schema.String),\n sort: Schema.optional(DeviceSort),\n});\n\nexport class DeviceRegistrationRequest extends Schema.Class<DeviceRegistrationRequest>(\n \"DeviceRegistrationRequest\",\n)({\n id: Id,\n organizationId: Id,\n appleTeamId: Schema.NullOr(Id),\n deviceNameHint: Schema.NullOr(Schema.String),\n deviceClassHint: Schema.NullOr(DeviceClass),\n url: Schema.String,\n expiresAt: DateTimeString,\n consumedAt: Schema.NullOr(DateTimeString),\n consumedDeviceId: Schema.NullOr(Id),\n createdAt: DateTimeString,\n}) {}\n\nexport const CreateRegistrationRequestBody = Schema.Struct({\n deviceNameHint: Schema.optional(Schema.String.pipe(Schema.maxLength(120))),\n deviceClassHint: Schema.optional(DeviceClass),\n ttlHours: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.between(1, 168))),\n appleTeamId: Schema.optional(Id),\n});\n\nexport const ListRegistrationRequestsParams = Schema.Struct({\n active: Schema.optional(Schema.Literal(\"true\", \"false\")),\n appleTeamId: Schema.optional(Id),\n});\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n CreateRegistrationRequestBody,\n DeleteDeviceResult,\n Device,\n DeviceRegistrationRequest,\n ListDevicesParams,\n ListRegistrationRequestsParams,\n RegisterDeviceBody,\n UpdateDeviceBody,\n} from \"../domain/device\";\nimport { Conflict } from \"../domain/errors\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\n\nexport class DevicesGroup extends HttpApiGroup.make(\"devices\")\n .add(\n HttpApiEndpoint.post(\"register\", \"/api/devices\")\n .setPayload(RegisterDeviceBody)\n .addSuccess(Device, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Register device\",\n description: \"Register an Apple device UDID in the caller's active organization\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/devices\")\n .setUrlParams(ListDevicesParams)\n .addSuccess(\n Schema.Struct({\n items: Schema.Array(Device),\n total: Schema.Number,\n page: Schema.Number,\n limit: Schema.Number,\n }),\n )\n .annotateContext(\n OpenApi.annotations({\n title: \"List devices\",\n description: \"List registered Apple devices in the caller's active organization\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"get\")`/api/devices/${idParam}`.addSuccess(Device).annotateContext(\n OpenApi.annotations({\n title: \"Get device\",\n description: \"Get a single device by ID\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.patch(\"update\")`/api/devices/${idParam}`\n .setPayload(UpdateDeviceBody)\n .addSuccess(Device)\n .annotateContext(\n OpenApi.annotations({\n title: \"Update device\",\n description: \"Rename a device or toggle its enabled state\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/devices/${idParam}`\n .addSuccess(DeleteDeviceResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete device\",\n description: \"Remove a registered device from the organization\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"createRegistrationRequest\", \"/api/devices/registration-requests\")\n .setPayload(CreateRegistrationRequestBody)\n .addSuccess(DeviceRegistrationRequest, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Create device registration request\",\n description:\n \"Generate a URL + QR code for self-service device enrollment via Safari on iOS\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"listRegistrationRequests\", \"/api/devices/registration-requests\")\n .setUrlParams(ListRegistrationRequestsParams)\n .addSuccess(\n Schema.Struct({\n items: Schema.Array(DeviceRegistrationRequest),\n }),\n )\n .annotateContext(\n OpenApi.annotations({\n title: \"List device registration requests\",\n description: \"List outstanding device registration invites\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Devices\",\n description: \"Apple device management for ad-hoc builds\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id } from \"./common\";\n\nexport const EnvVarVisibility = Schema.Literal(\"plaintext\", \"sensitive\", \"secret\");\n\nexport class EnvVar extends Schema.Class<EnvVar>(\"EnvVar\")({\n id: Id,\n organizationId: Id,\n projectId: Id,\n environment: Schema.String,\n key: Schema.String,\n visibility: EnvVarVisibility,\n value: Schema.NullOr(Schema.String),\n createdAt: DateTimeString,\n updatedAt: DateTimeString,\n}) {}\n\n// Key validation: uppercase letters, digits, underscores. Must start with letter.\nconst EnvVarKey = Schema.String.pipe(Schema.pattern(/^[A-Z][A-Z0-9_]*$/u), Schema.maxLength(256));\n\nconst EnvVarValue = Schema.String.pipe(Schema.maxLength(32_768));\n\nconst EnvVarEnvironment = Schema.String.pipe(Schema.minLength(1), Schema.maxLength(64));\n\nexport const CreateEnvVarBody = Schema.Struct({\n projectId: Id,\n environment: EnvVarEnvironment,\n key: EnvVarKey,\n value: EnvVarValue,\n visibility: EnvVarVisibility,\n});\n\nexport const UpdateEnvVarBody = Schema.Struct({\n value: Schema.optional(EnvVarValue),\n visibility: Schema.optional(EnvVarVisibility),\n});\n\nexport const BulkImportEnvVarsBody = Schema.Struct({\n projectId: Id,\n environment: EnvVarEnvironment,\n content: Schema.String.pipe(Schema.maxLength(4_000_000)),\n visibility: EnvVarVisibility,\n});\n\nexport const BulkImportResult = Schema.Struct({\n created: Schema.Number,\n updated: Schema.Number,\n skipped: Schema.Number,\n});\n\nexport const DeleteEnvVarResult = Schema.Struct({\n id: Id,\n});\n\nexport const EnvVarExportItem = Schema.Struct({\n key: Schema.String,\n value: Schema.String,\n visibility: EnvVarVisibility,\n});\n\nexport const EnvVarExportResult = Schema.Struct({\n items: Schema.Array(EnvVarExportItem),\n environment: Schema.String,\n});\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport { Id, PaginationParams } from \"../domain/common\";\nimport {\n BulkImportEnvVarsBody,\n BulkImportResult,\n CreateEnvVarBody,\n DeleteEnvVarResult,\n EnvVar,\n EnvVarExportResult,\n UpdateEnvVarBody,\n} from \"../domain/env-var\";\nimport { BadRequest, Conflict } from \"../domain/errors\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\n\nexport class EnvVarsGroup extends HttpApiGroup.make(\"env-vars\")\n .add(\n HttpApiEndpoint.post(\"create\", \"/api/env-vars\")\n .setPayload(CreateEnvVarBody)\n .addSuccess(EnvVar, { status: 201 })\n .addError(BadRequest)\n .addError(Conflict)\n .annotateContext(\n OpenApi.annotations({\n title: \"Create environment variable\",\n description: \"Create a new environment variable for a project\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/env-vars\")\n .setUrlParams(\n Schema.Struct({\n projectId: Id,\n environment: Schema.optional(Schema.String),\n ...PaginationParams.fields,\n }),\n )\n .addSuccess(\n Schema.Struct({\n items: Schema.Array(EnvVar),\n }),\n )\n .annotateContext(\n OpenApi.annotations({\n title: \"List environment variables\",\n description: \"List environment variables with optional filters\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"get\")`/api/env-vars/${idParam}`.addSuccess(EnvVar).annotateContext(\n OpenApi.annotations({\n title: \"Get environment variable\",\n description: \"Get an environment variable by ID\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.patch(\"update\")`/api/env-vars/${idParam}`\n .setPayload(UpdateEnvVarBody)\n .addSuccess(EnvVar)\n .addError(BadRequest)\n .annotateContext(\n OpenApi.annotations({\n title: \"Update environment variable\",\n description: \"Update an environment variable's value or visibility\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/env-vars/${idParam}`\n .addSuccess(DeleteEnvVarResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete environment variable\",\n description: \"Delete an environment variable\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"bulkImport\", \"/api/env-vars/bulk-import\")\n .setPayload(BulkImportEnvVarsBody)\n .addSuccess(BulkImportResult)\n .addError(BadRequest)\n .annotateContext(\n OpenApi.annotations({\n title: \"Bulk import environment variables\",\n description:\n \"Import environment variables from a dotenv-formatted string. Supports KEY=VALUE format with # comments. Quoted values (single/double) are unquoted. Multiline values are not supported.\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"export\", \"/api/env-vars/export\")\n .setUrlParams(\n Schema.Struct({\n projectId: Id,\n environment: Schema.String,\n }),\n )\n .addSuccess(EnvVarExportResult)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Export environment variables\",\n description: \"Export environment variables for a project environment\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Forbidden)\n .addError(BadRequest)\n .annotateContext(\n OpenApi.annotations({\n title: \"Environment Variables\",\n description: \"Manage environment variables for project builds and deployments\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id } from \"./common\";\n\nexport class GoogleServiceAccountKey extends Schema.Class<GoogleServiceAccountKey>(\n \"GoogleServiceAccountKey\",\n)({\n id: Id,\n organizationId: Id,\n clientEmail: Schema.String,\n privateKeyId: Schema.String,\n googleProjectId: Schema.String,\n createdAt: DateTimeString,\n updatedAt: DateTimeString,\n}) {}\n\nexport const UploadGoogleServiceAccountKeyBody = Schema.Struct({\n json: Schema.String.pipe(Schema.minLength(1)),\n});\n\nexport const DeleteGoogleServiceAccountKeyResult = Schema.Struct({ deleted: Schema.Number });\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport { BadRequest, Conflict } from \"../domain/errors\";\nimport {\n DeleteGoogleServiceAccountKeyResult,\n GoogleServiceAccountKey,\n UploadGoogleServiceAccountKeyBody,\n} from \"../domain/google-service-account-key\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\n\nexport class GoogleServiceAccountKeysGroup extends HttpApiGroup.make(\"googleServiceAccountKeys\")\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/google/service-account-keys\")\n .addSuccess(Schema.Struct({ items: Schema.Array(GoogleServiceAccountKey) }))\n .annotateContext(\n OpenApi.annotations({\n title: \"List Google service account keys\",\n description: \"List uploaded Google service account JSON keys\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"upload\", \"/api/google/service-account-keys\")\n .setPayload(UploadGoogleServiceAccountKeyBody)\n .addSuccess(GoogleServiceAccountKey, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Upload service account key\",\n description: \"Upload a Google service account JSON key\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/google/service-account-keys/${idParam}`\n .addSuccess(DeleteGoogleServiceAccountKeyResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete service account key\",\n description: \"Remove a stored Google service account key\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(BadRequest)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Google Service Account Keys\",\n description: \"Manage Google Play + FCM service account JSON keys\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { BundleIdentifier, DistributionType } from \"./apple-provisioning-profile\";\nimport { DateTimeString, Id } from \"./common\";\n\nexport class IosBundleConfiguration extends Schema.Class<IosBundleConfiguration>(\n \"IosBundleConfiguration\",\n)({\n id: Id,\n organizationId: Id,\n projectId: Id,\n bundleIdentifier: Schema.String,\n distributionType: DistributionType,\n appleTeamId: Id,\n appleDistributionCertificateId: Schema.NullOr(Id),\n appleProvisioningProfileId: Schema.NullOr(Id),\n applePushKeyId: Schema.NullOr(Id),\n ascApiKeyId: Schema.NullOr(Id),\n createdAt: DateTimeString,\n updatedAt: DateTimeString,\n}) {}\n\nexport const CreateIosBundleConfigurationBody = Schema.Struct({\n bundleIdentifier: BundleIdentifier,\n distributionType: DistributionType,\n appleTeamId: Id,\n appleDistributionCertificateId: Schema.optional(Id),\n appleProvisioningProfileId: Schema.optional(Id),\n applePushKeyId: Schema.optional(Id),\n ascApiKeyId: Schema.optional(Id),\n});\n\nexport const UpdateIosBundleConfigurationBody = Schema.Struct({\n appleDistributionCertificateId: Schema.optional(Schema.NullOr(Id)),\n appleProvisioningProfileId: Schema.optional(Schema.NullOr(Id)),\n applePushKeyId: Schema.optional(Schema.NullOr(Id)),\n ascApiKeyId: Schema.optional(Schema.NullOr(Id)),\n});\n\nexport const DeleteIosBundleConfigurationResult = Schema.Struct({ deleted: Schema.Number });\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport { BadRequest, Conflict } from \"../domain/errors\";\nimport {\n CreateIosBundleConfigurationBody,\n DeleteIosBundleConfigurationResult,\n IosBundleConfiguration,\n UpdateIosBundleConfigurationBody,\n} from \"../domain/ios-bundle-configuration\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\nconst projectIdParam = HttpApiSchema.param(\"projectId\", Schema.String);\n\nexport class IosBundleConfigurationsGroup extends HttpApiGroup.make(\"iosBundleConfigurations\")\n .add(\n HttpApiEndpoint.get(\"list\")`/api/projects/${projectIdParam}/ios-bundle-configurations`\n .addSuccess(Schema.Struct({ items: Schema.Array(IosBundleConfiguration) }))\n .annotateContext(\n OpenApi.annotations({\n title: \"List iOS bundle configurations\",\n description: \"List all iOS bundle configurations for a project\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"create\")`/api/projects/${projectIdParam}/ios-bundle-configurations`\n .setPayload(CreateIosBundleConfigurationBody)\n .addSuccess(IosBundleConfiguration, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Create iOS bundle configuration\",\n description: \"Bind certificate + profile + push + ASC to a bundle identifier\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.put(\"update\")`/api/ios-bundle-configurations/${idParam}`\n .setPayload(UpdateIosBundleConfigurationBody)\n .addSuccess(IosBundleConfiguration)\n .annotateContext(\n OpenApi.annotations({\n title: \"Update iOS bundle configuration\",\n description: \"Change the credentials bound to an iOS bundle configuration\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/ios-bundle-configurations/${idParam}`\n .addSuccess(DeleteIosBundleConfigurationResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete iOS bundle configuration\",\n description: \"Remove an iOS bundle configuration binding\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(BadRequest)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"iOS Bundle Configurations\",\n description: \"Per-project per-bundle credential bindings\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { PaginationParams, DateTimeString, Id } from \"./common\";\n\nexport class Project extends Schema.Class<Project>(\"Project\")({\n id: Id,\n organizationId: Id,\n name: Schema.String,\n slug: Schema.String,\n createdAt: DateTimeString,\n lastActivityAt: DateTimeString,\n branchCount: Schema.Number,\n channelCount: Schema.Number,\n updateCount: Schema.Number,\n}) {}\n\nexport const ProjectSortColumn = Schema.Literal(\n \"lastActivityAt\",\n \"name\",\n \"createdAt\",\n \"branchCount\",\n \"channelCount\",\n \"updateCount\",\n);\n\n/**\n * Sort param: column name optionally prefixed with `-` for descending.\n * Example: `name` (asc), `-lastActivityAt` (desc).\n */\nexport const ProjectSort = Schema.Union(\n ProjectSortColumn,\n Schema.TemplateLiteral(\"-\", ProjectSortColumn),\n);\n\nexport const ListProjectsParams = Schema.Struct({\n ...PaginationParams.fields,\n query: Schema.optional(Schema.String),\n sort: Schema.optional(ProjectSort),\n});\n\nexport const CreateProjectBody = Schema.Struct({\n name: Schema.String.pipe(Schema.minLength(1)),\n slug: Schema.String.pipe(Schema.minLength(1)),\n});\n\nexport const UpdateProjectBody = Schema.Struct({\n name: Schema.String.pipe(Schema.minLength(1)),\n});\n\nexport const DeleteProjectResult = Schema.Struct({ deleted: Schema.Number });\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport { Conflict } from \"../domain/errors\";\nimport {\n CreateProjectBody,\n DeleteProjectResult,\n ListProjectsParams,\n Project,\n UpdateProjectBody,\n} from \"../domain/project\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\nconst slugParam = HttpApiSchema.param(\"slug\", Schema.String);\n\nexport class ProjectsGroup extends HttpApiGroup.make(\"projects\")\n .add(\n HttpApiEndpoint.post(\"create\", \"/api/projects\")\n .setPayload(CreateProjectBody)\n .addSuccess(Project, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Create project\",\n description: \"Create a new project in the caller's active organization\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/projects\")\n .setUrlParams(ListProjectsParams)\n .addSuccess(\n Schema.Struct({\n items: Schema.Array(Project),\n total: Schema.Number,\n page: Schema.Number,\n limit: Schema.Number,\n }),\n )\n .annotateContext(\n OpenApi.annotations({\n title: \"List projects\",\n description: \"List all projects in the caller's active organization\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"get\")`/api/projects/${idParam}`.addSuccess(Project).annotateContext(\n OpenApi.annotations({\n title: \"Get project\",\n description: \"Get a single project by ID\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"getBySlug\")`/api/projects/by-slug/${slugParam}`\n .addSuccess(Project)\n .annotateContext(\n OpenApi.annotations({\n title: \"Get project by slug\",\n description: \"Get a single project by slug within the caller's active organization\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.patch(\"rename\")`/api/projects/${idParam}`\n .setPayload(UpdateProjectBody)\n .addSuccess(Project)\n .annotateContext(\n OpenApi.annotations({\n title: \"Rename project\",\n description: \"Rename a project\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/projects/${idParam}`\n .addSuccess(DeleteProjectResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete project\",\n description: \"Delete a project and all its branches, channels, and updates\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Projects\",\n description: \"Project management endpoints\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id, PaginationParams, Platform } from \"./common\";\n\nexport class Update extends Schema.Class<Update>(\"Update\")({\n id: Id,\n branchId: Id,\n runtimeVersion: Schema.String,\n platform: Platform,\n message: Schema.String,\n metadataJson: Schema.String,\n extraJson: Schema.NullOr(Schema.String),\n groupId: Schema.String,\n rolloutPercentage: Schema.Number,\n isRollback: Schema.Boolean,\n signature: Schema.NullOr(Schema.String),\n certificateChain: Schema.NullOr(Schema.String),\n manifestBody: Schema.NullOr(Schema.String),\n directiveBody: Schema.NullOr(Schema.String),\n createdAt: DateTimeString,\n}) {}\n\nexport const UpdateSortColumn = Schema.Literal(\n \"createdAt\",\n \"runtimeVersion\",\n \"platform\",\n \"rolloutPercentage\",\n);\n\n/**\n * Sort param: column name optionally prefixed with `-` for descending.\n * Example: `runtimeVersion` (asc), `-createdAt` (desc).\n */\nexport const UpdateSort = Schema.Union(\n UpdateSortColumn,\n Schema.TemplateLiteral(\"-\", UpdateSortColumn),\n);\n\nexport const ListUpdatesParams = Schema.Struct({\n projectId: Id,\n branchId: Schema.optional(Id),\n platform: Schema.optional(Platform),\n ...PaginationParams.fields,\n sort: Schema.optional(UpdateSort),\n});\n\nexport const AssetRef = Schema.Struct({\n hash: Schema.String,\n key: Schema.String,\n isLaunch: Schema.Boolean,\n contentChecksum: Schema.optional(Schema.String),\n});\n\nexport const CreateUpdateBody = Schema.Struct({\n branch: Schema.String.pipe(Schema.minLength(1)),\n slug: Schema.String.pipe(Schema.minLength(1)),\n runtimeVersion: Schema.String.pipe(Schema.minLength(1)),\n platform: Platform,\n message: Schema.String,\n groupId: Schema.String.pipe(Schema.minLength(1)),\n metadata: Schema.Record({ key: Schema.String, value: Schema.Unknown }),\n extra: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Unknown })),\n assets: Schema.Array(AssetRef),\n manifestBody: Schema.optional(Schema.String),\n directiveBody: Schema.optional(Schema.String),\n isRollback: Schema.optional(Schema.Boolean),\n signature: Schema.optional(Schema.String),\n certificateChain: Schema.optional(Schema.String),\n rolloutPercentage: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.between(1, 100))),\n});\n\nexport const RepublishBody = Schema.Struct({\n sourceUpdateId: Schema.optional(Id),\n sourceGroupId: Schema.optional(Schema.String.pipe(Schema.minLength(1))),\n destinationBranchId: Schema.optional(Id),\n destinationChannel: Schema.optional(Schema.String.pipe(Schema.minLength(1))),\n message: Schema.optional(Schema.String),\n signedUpdates: Schema.optional(\n Schema.Array(\n Schema.Struct({\n sourceUpdateId: Id,\n manifestBody: Schema.String.pipe(Schema.minLength(1)),\n signature: Schema.String.pipe(Schema.minLength(1)),\n certificateChain: Schema.String.pipe(Schema.minLength(1)),\n }),\n ),\n ),\n});\n\nexport const RepublishResult = Schema.Struct({\n updates: Schema.Array(Update),\n});\n\nexport const DeleteUpdateResult = Schema.Struct({\n deleted: Schema.Number,\n});\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport { UpdateRolloutBody } from \"../domain/common\";\nimport { BadRequest, Conflict } from \"../domain/errors\";\nimport {\n CreateUpdateBody,\n DeleteUpdateResult,\n ListUpdatesParams,\n RepublishBody,\n RepublishResult,\n Update,\n} from \"../domain/update\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\nconst groupIdParam = HttpApiSchema.param(\"groupId\", Schema.String);\n\nexport class UpdatesGroup extends HttpApiGroup.make(\"updates\")\n .add(\n HttpApiEndpoint.post(\"create\", \"/api/updates\")\n .setPayload(CreateUpdateBody)\n .addSuccess(Update, { status: 201 })\n .addError(Conflict)\n .annotateContext(\n OpenApi.annotations({\n title: \"Create update\",\n description: \"Publish a new update (manifest + directive) to a branch\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/updates\")\n .setUrlParams(ListUpdatesParams)\n .addSuccess(\n Schema.Struct({\n items: Schema.Array(Update),\n total: Schema.Number,\n page: Schema.Number,\n limit: Schema.Number,\n }),\n )\n .annotateContext(\n OpenApi.annotations({\n title: \"List updates\",\n description: \"List updates for a project, optionally filtered by branch\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"deleteGroup\")`/api/updates/${groupIdParam}`\n .addSuccess(DeleteUpdateResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete update group\",\n description: \"Delete all updates in a group (paired iOS + Android updates)\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"republish\", \"/api/updates/republish\")\n .setPayload(RepublishBody)\n .addSuccess(RepublishResult)\n .addError(Conflict)\n .annotateContext(\n OpenApi.annotations({\n title: \"Republish update\",\n description: \"Cross-channel republish (promote) an update\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.patch(\"editRollout\")`/api/updates/${idParam}/rollout`\n .setPayload(UpdateRolloutBody)\n .addSuccess(Update)\n .annotateContext(\n OpenApi.annotations({\n title: \"Edit per-update rollout\",\n description: \"Change the rollout percentage for a specific update\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"completeRollout\")`/api/updates/${idParam}/rollout/complete`\n .addSuccess(Update)\n .annotateContext(\n OpenApi.annotations({\n title: \"Complete per-update rollout\",\n description: \"End rollout — make update available to all devices\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"revertRollout\")`/api/updates/${idParam}/rollout/revert`\n .addSuccess(Update)\n .annotateContext(\n OpenApi.annotations({\n title: \"Revert per-update rollout\",\n description: \"End rollout — revert to previous update\",\n }),\n ),\n )\n .addError(BadRequest)\n .addError(NotFound)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Updates\",\n description: \"Update publishing, deletion, republish, and per-update rollout endpoints\",\n }),\n ) {}\n","import { HttpApi, OpenApi } from \"@effect/platform\";\n\nimport { Authentication } from \"./auth/middleware\";\nimport { AnalyticsGroup } from \"./groups/analytics\";\nimport { AndroidApplicationIdentifiersGroup } from \"./groups/android-application-identifiers\";\nimport { AndroidBuildCredentialsGroup } from \"./groups/android-build-credentials\";\nimport { AndroidUploadKeystoresGroup } from \"./groups/android-upload-keystores\";\nimport { AppleDistributionCertificatesGroup } from \"./groups/apple-distribution-certificates\";\nimport { AppleProvisioningProfilesGroup } from \"./groups/apple-provisioning-profiles\";\nimport { ApplePushKeysGroup } from \"./groups/apple-push-keys\";\nimport { AppleTeamsGroup } from \"./groups/apple-teams\";\nimport { AscApiKeysGroup } from \"./groups/asc-api-keys\";\nimport { AssetsGroup } from \"./groups/assets\";\nimport { AuditLogsGroup } from \"./groups/audit-logs\";\nimport { BranchesGroup } from \"./groups/branches\";\nimport { BuildCredentialsGroup } from \"./groups/build-credentials\";\nimport { BuildsGroup } from \"./groups/builds\";\nimport { ChannelsGroup } from \"./groups/channels\";\nimport { DevicesGroup } from \"./groups/devices\";\nimport { EnvVarsGroup } from \"./groups/env-vars\";\nimport { GoogleServiceAccountKeysGroup } from \"./groups/google-service-account-keys\";\nimport { IosBundleConfigurationsGroup } from \"./groups/ios-bundle-configurations\";\nimport { ProjectsGroup } from \"./groups/projects\";\nimport { UpdatesGroup } from \"./groups/updates\";\n\nexport class ManagementApi extends HttpApi.make(\"management-api\")\n .add(ProjectsGroup)\n .add(BranchesGroup)\n .add(ChannelsGroup)\n .add(UpdatesGroup)\n .add(AssetsGroup)\n .add(AnalyticsGroup)\n .add(BuildsGroup)\n .add(EnvVarsGroup)\n .add(AuditLogsGroup)\n .add(DevicesGroup)\n .add(AppleTeamsGroup)\n .add(AppleDistributionCertificatesGroup)\n .add(ApplePushKeysGroup)\n .add(AscApiKeysGroup)\n .add(AppleProvisioningProfilesGroup)\n .add(GoogleServiceAccountKeysGroup)\n .add(IosBundleConfigurationsGroup)\n .add(AndroidApplicationIdentifiersGroup)\n .add(AndroidUploadKeystoresGroup)\n .add(AndroidBuildCredentialsGroup)\n .add(BuildCredentialsGroup)\n .middleware(Authentication)\n .annotateContext(\n OpenApi.annotations({\n title: \"Better Update Management API\",\n version: \"1.0.0\",\n description: \"Management API for OTA update publishing, deployment, and analytics\",\n }),\n ) {}\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { NotFound } from \"../auth/ownership\";\nimport { BadRequest, NotAcceptable } from \"../domain/errors\";\n\nconst projectIdParam = HttpApiSchema.param(\"projectId\", Schema.String);\n\nexport class ManifestGroup extends HttpApiGroup.make(\"manifest\")\n .add(\n HttpApiEndpoint.get(\"serve\")`/manifest/${projectIdParam}`\n .addError(BadRequest)\n .addError(NotFound)\n .addError(NotAcceptable)\n .annotateContext(\n OpenApi.annotations({\n title: \"Serve manifest\",\n description: \"Expo Updates protocol v1 manifest endpoint\",\n }),\n ),\n )\n .annotateContext(\n OpenApi.annotations({\n title: \"Protocol\",\n description: \"Expo Updates protocol endpoints\",\n }),\n ) {}\n","import { HttpApi, OpenApi } from \"@effect/platform\";\n\nimport { ManifestGroup } from \"./groups/manifest\";\n\n/**\n * Documentation-only contract for OpenAPI/Scalar generation.\n * The manifest endpoint bypasses HttpApiBuilder at runtime because the Expo Updates\n * protocol requires multipart/mixed responses that do not fit the standard pipeline.\n */\nexport class ProtocolApi extends HttpApi.make(\"protocol-api\")\n .add(ManifestGroup)\n .annotateContext(\n OpenApi.annotations({\n title: \"Better Update Protocol API\",\n version: \"1.0.0\",\n description: \"Expo Updates protocol endpoints (unauthenticated)\",\n }),\n ) {}\n","import process from \"node:process\";\n\nimport { Context, Effect, Layer } from \"effect\";\n\nconst definedEnvironment = (): Readonly<Record<string, string>> =>\n Object.fromEntries(\n Object.entries(process.env).flatMap(([key, value]) =>\n typeof value === \"string\" ? [[key, value] as const] : [],\n ),\n );\n\nexport class CliRuntime extends Context.Tag(\"cli/CliRuntime\")<\n CliRuntime,\n {\n readonly argv: readonly string[];\n readonly platform: NodeJS.Platform;\n readonly cwd: Effect.Effect<string>;\n readonly getEnv: (name: string) => Effect.Effect<string | undefined>;\n readonly homeDirectory: Effect.Effect<string>;\n readonly userName: Effect.Effect<string>;\n readonly commandEnvironment: (\n overrides?: Readonly<Record<string, string>>,\n ) => Effect.Effect<Readonly<Record<string, string>>>;\n readonly setExitCode: (code: number) => Effect.Effect<void>;\n }\n>() {}\n\nexport const CliRuntimeLive = Layer.succeed(CliRuntime, {\n argv: [...process.argv],\n platform: process.platform,\n cwd: Effect.sync(() => process.cwd()),\n getEnv: (name: string) => Effect.sync(() => process.env[name]),\n homeDirectory: Effect.sync(\n () => process.env[\"HOME\"] ?? process.env[\"USERPROFILE\"] ?? process.cwd(),\n ),\n userName: Effect.sync(() => process.env[\"USER\"] ?? process.env[\"USERNAME\"] ?? \"better-update\"),\n commandEnvironment: (overrides = {}) =>\n Effect.sync(() => ({\n ...definedEnvironment(),\n ...overrides,\n })),\n setExitCode: (code: number) =>\n Effect.sync(() => {\n process.exitCode = code;\n }),\n});\n","import path from \"node:path\";\n\nimport { isRecord } from \"@better-update/type-guards\";\nimport { FileSystem } from \"@effect/platform\";\nimport { Context, Effect, Layer } from \"effect\";\n\nimport { AuthRequiredError } from \"../lib/exit-codes\";\nimport { formatCause } from \"../lib/format-error\";\nimport { CliRuntime } from \"./cli-runtime\";\n\nexport class AuthStore extends Context.Tag(\"cli/AuthStore\")<\n AuthStore,\n {\n readonly getToken: Effect.Effect<string, AuthRequiredError>;\n readonly saveToken: (token: string) => Effect.Effect<void, AuthRequiredError>;\n readonly clearToken: Effect.Effect<void>;\n }\n>() {}\n\nexport const AuthStoreLive = Layer.effect(\n AuthStore,\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const runtime = yield* CliRuntime;\n const homeDirectory = yield* runtime.homeDirectory;\n const authDir = path.join(homeDirectory, \".better-update\");\n const authFile = path.join(authDir, \"auth.json\");\n\n return {\n getToken: Effect.gen(function* () {\n const envToken = yield* runtime.getEnv(\"BETTER_UPDATE_TOKEN\");\n if (envToken) {\n return envToken;\n }\n\n const content = yield* fs.readFileString(authFile).pipe(\n Effect.mapError(\n () =>\n new AuthRequiredError({\n message: \"Not logged in. Run `better-update login` to authenticate.\",\n }),\n ),\n );\n\n const parsed = yield* Effect.try({\n try: (): unknown => JSON.parse(content),\n catch: () =>\n new AuthRequiredError({\n message: \"Corrupted auth file. Run `better-update login` to re-authenticate.\",\n }),\n });\n if (!isRecord(parsed)) {\n return yield* new AuthRequiredError({\n message: \"Invalid auth file. Run `better-update login` to re-authenticate.\",\n });\n }\n const { token } = parsed;\n if (typeof token !== \"string\") {\n return yield* new AuthRequiredError({\n message: \"Invalid auth file. Run `better-update login` to re-authenticate.\",\n });\n }\n\n return token;\n }),\n\n saveToken: (token: string) =>\n Effect.gen(function* () {\n yield* fs.makeDirectory(authDir, { recursive: true });\n yield* fs.chmod(authDir, 0o700);\n yield* fs.writeFileString(authFile, `${JSON.stringify({ token }, null, 2)}\\n`);\n yield* fs.chmod(authFile, 0o600);\n }).pipe(\n Effect.mapError(\n (cause) =>\n new AuthRequiredError({\n message: `Failed to save auth token: ${formatCause(cause)}`,\n }),\n ),\n ),\n\n clearToken: fs.remove(authFile).pipe(Effect.catchAll(() => Effect.void)),\n };\n }),\n);\n","import path from \"node:path\";\n\nimport { isRecord } from \"@better-update/type-guards\";\nimport { FileSystem } from \"@effect/platform\";\nimport { Context, Data, Effect, Layer } from \"effect\";\n\nimport { CliRuntime } from \"./cli-runtime\";\n\nconst DEFAULT_BASE_URL = \"https://graph.better-update.dev\";\nconst DEFAULT_WEB_URL = \"https://better-update.dev\";\n\nclass ConfigStoreParseError extends Data.TaggedError(\"ConfigStoreParseError\")<{\n readonly message: string;\n readonly cause: unknown;\n}> {}\n\nconst normalizeUrl = (value: string): string => value.replace(/\\/$/u, \"\");\n\nexport class ConfigStore extends Context.Tag(\"cli/ConfigStore\")<\n ConfigStore,\n {\n readonly getBaseUrl: Effect.Effect<string>;\n readonly getWebUrl: Effect.Effect<string>;\n }\n>() {}\n\nexport const ConfigStoreLive = Layer.effect(\n ConfigStore,\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const runtime = yield* CliRuntime;\n const homeDirectory = yield* runtime.homeDirectory;\n const configFile = path.join(homeDirectory, \".better-update\", \"config.json\");\n const readConfig = fs.readFileString(configFile).pipe(\n Effect.catchAll(() => Effect.succeed(\"\")),\n Effect.flatMap((content) =>\n content.length === 0\n ? Effect.succeed(undefined)\n : Effect.try({\n try: (): unknown => JSON.parse(content),\n catch: (cause) =>\n new ConfigStoreParseError({\n message: \"Config file contains invalid JSON\",\n cause,\n }),\n }).pipe(\n Effect.map((parsed) => (isRecord(parsed) ? parsed : undefined)),\n Effect.catchAll(() => Effect.succeed(undefined)),\n ),\n ),\n );\n const resolveBaseUrl = Effect.gen(function* () {\n const envUrl = yield* runtime.getEnv(\"BETTER_UPDATE_URL\");\n if (envUrl) {\n return normalizeUrl(envUrl);\n }\n\n const parsed = yield* readConfig;\n const baseUrl = parsed?.[\"baseUrl\"];\n if (typeof baseUrl === \"string\") {\n return normalizeUrl(baseUrl);\n }\n\n return DEFAULT_BASE_URL;\n });\n\n return {\n getBaseUrl: resolveBaseUrl,\n\n getWebUrl: Effect.gen(function* () {\n const envUrl = yield* runtime.getEnv(\"BETTER_UPDATE_WEB_URL\");\n if (envUrl) {\n return normalizeUrl(envUrl);\n }\n\n const parsed = yield* readConfig;\n const webUrl = parsed?.[\"webUrl\"];\n if (typeof webUrl === \"string\") {\n return normalizeUrl(webUrl);\n }\n\n return DEFAULT_WEB_URL;\n }),\n };\n }),\n);\n","import { ManagementApi } from \"@better-update/api\";\nimport { HttpApiClient, HttpClient, HttpClientRequest } from \"@effect/platform\";\nimport { Context, Effect, Layer } from \"effect\";\n\nimport { AuthStore } from \"./auth-store\";\nimport { ConfigStore } from \"./config-store\";\n\nimport type { AuthRequiredError } from \"../lib/exit-codes\";\n\nconst client = HttpApiClient.make(ManagementApi);\nexport type ApiClient = Effect.Effect.Success<typeof client>;\n\nexport class ApiClientService extends Context.Tag(\"cli/ApiClient\")<\n ApiClientService,\n {\n readonly get: Effect.Effect<ApiClient, AuthRequiredError>;\n }\n>() {}\n\nexport const apiClient: Effect.Effect<ApiClient, AuthRequiredError, ApiClientService> =\n // eslint-disable-next-line unicorn/no-array-method-this-argument -- Effect.flatMap, not Array.prototype.flatMap; the second arg is a continuation, not a thisArg\n Effect.flatMap(ApiClientService, ({ get }) => get);\n\nexport const ApiClientLive = Layer.effect(\n ApiClientService,\n Effect.gen(function* () {\n const clientService = yield* HttpClient.HttpClient;\n const authStore = yield* AuthStore;\n const configStore = yield* ConfigStore;\n\n return {\n get: Effect.gen(function* () {\n const token = yield* authStore.getToken;\n const baseUrl = yield* configStore.getBaseUrl;\n return yield* HttpApiClient.make(ManagementApi, {\n transformClient: HttpClient.mapRequest(HttpClientRequest.bearerToken(token)),\n baseUrl,\n }).pipe(Effect.provideService(HttpClient.HttpClient, clientService));\n }),\n };\n }),\n);\n","export type JsonParseResult =\n | { readonly ok: true; readonly value: unknown }\n | { readonly ok: false };\n\nexport const parseJsonResult = (text: string): JsonParseResult => {\n // eslint-disable-next-line functional/no-try-statements -- JSON.parse exposes syntax errors via throw; this helper converts them to an explicit result value\n try {\n return { ok: true, value: JSON.parse(text) as unknown };\n } catch {\n return { ok: false };\n }\n};\n\nexport const safeJsonParse = (text: string): unknown => {\n const result = parseJsonResult(text);\n return result.ok ? result.value : null;\n};\n","import path from \"node:path\";\n\nimport { safeJsonParse } from \"@better-update/safe-json\";\nimport { isRecord } from \"@better-update/type-guards\";\nimport { FileSystem } from \"@effect/platform\";\nimport { Context, Effect, Layer } from \"effect\";\n\nimport type { Auth } from \"@expo/apple-utils\";\n\nimport { AppleAuthError } from \"../lib/exit-codes\";\nimport { formatCause } from \"../lib/format-error\";\nimport { CliRuntime } from \"./cli-runtime\";\n\n// The cookies payload accepted by @expo/apple-utils Auth.loginWithCookiesAsync.\n// Derived structurally so we don't depend on the un-exported `CookiesJSON` alias.\nexport type AppleSessionCookies = Parameters<typeof Auth.loginWithCookiesAsync>[0][\"cookies\"];\n\nexport interface SerializedAppleSession {\n readonly cookies: AppleSessionCookies;\n readonly teamId: string;\n readonly username: string;\n readonly providerId?: number;\n}\n\nexport class AppleSessionStore extends Context.Tag(\"cli/AppleSessionStore\")<\n AppleSessionStore,\n {\n readonly loadSession: Effect.Effect<SerializedAppleSession | null>;\n readonly saveSession: (session: SerializedAppleSession) => Effect.Effect<void, AppleAuthError>;\n readonly clearSession: Effect.Effect<void>;\n }\n>() {}\n\nexport const AppleSessionStoreLive = Layer.effect(\n AppleSessionStore,\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const runtime = yield* CliRuntime;\n const homeDirectory = yield* runtime.homeDirectory;\n const sessionDir = path.join(homeDirectory, \".better-update\");\n const sessionFile = path.join(sessionDir, \"apple-session.json\");\n\n return {\n loadSession: Effect.gen(function* () {\n const content = yield* fs\n .readFileString(sessionFile)\n .pipe(Effect.catchAll(() => Effect.succeed(null)));\n\n if (!content) {\n return null;\n }\n\n const parsed = safeJsonParse(content);\n if (!isRecord(parsed)) {\n return null;\n }\n\n if (\n typeof parsed[\"teamId\"] !== \"string\" ||\n typeof parsed[\"username\"] !== \"string\" ||\n !parsed[\"cookies\"]\n ) {\n return null;\n }\n\n const providerIdRaw = parsed[\"providerId\"];\n const hasProviderId = typeof providerIdRaw === \"number\" && Number.isInteger(providerIdRaw);\n\n // eslint-disable-next-line typescript/no-unsafe-type-assertion, typescript/no-unsafe-assignment -- AppleSessionCookies is an opaque cookies payload from @expo/apple-utils; round-tripped verbatim from disk\n const cookies = parsed[\"cookies\"] as AppleSessionCookies;\n\n const session: SerializedAppleSession = {\n // eslint-disable-next-line typescript/no-unsafe-assignment -- see disable on the `cookies` declaration above; same opaque value\n cookies,\n teamId: parsed[\"teamId\"],\n username: parsed[\"username\"],\n ...(hasProviderId ? { providerId: providerIdRaw } : {}),\n };\n return session;\n }),\n\n saveSession: (session: SerializedAppleSession) =>\n Effect.gen(function* () {\n yield* fs.makeDirectory(sessionDir, { recursive: true });\n yield* fs.chmod(sessionDir, 0o700);\n yield* fs.writeFileString(sessionFile, `${JSON.stringify(session, null, 2)}\\n`);\n yield* fs.chmod(sessionFile, 0o600);\n }).pipe(\n Effect.mapError(\n (cause) =>\n new AppleAuthError({\n message: `Failed to save Apple session: ${formatCause(cause)}`,\n }),\n ),\n ),\n\n clearSession: fs.remove(sessionFile).pipe(Effect.catchAll(() => Effect.void)),\n };\n }),\n);\n","import { FileSystem, HttpClient, HttpClientRequest } from \"@effect/platform\";\nimport { Context, Effect, Layer } from \"effect\";\n\nimport { PresignedUrlExpiredError, UploadFailedError } from \"../lib/exit-codes\";\n\nconst EXPIRY_SAFETY_MARGIN_MS = 30_000;\n\nexport interface PutToPresignedUrlInput {\n readonly url: string;\n readonly filePath: string;\n readonly byteSize: number;\n readonly expiresAt: string;\n readonly headers?: Record<string, string>;\n}\n\nexport class PresignedUploadClient extends Context.Tag(\"cli/PresignedUploadClient\")<\n PresignedUploadClient,\n {\n readonly putToPresignedUrl: (\n input: PutToPresignedUrlInput,\n ) => Effect.Effect<void, PresignedUrlExpiredError | UploadFailedError>;\n }\n>() {}\n\nexport const PresignedUploadClientLive = Layer.effect(\n PresignedUploadClient,\n Effect.gen(function* () {\n const client = yield* HttpClient.HttpClient;\n const fileSystem = yield* FileSystem.FileSystem;\n\n return {\n putToPresignedUrl: ({\n url,\n filePath,\n byteSize,\n expiresAt,\n headers,\n }: PutToPresignedUrlInput) =>\n Effect.gen(function* () {\n const now = Date.now();\n const expiryMs = new Date(expiresAt).getTime();\n if (Number.isNaN(expiryMs) || now > expiryMs - EXPIRY_SAFETY_MARGIN_MS) {\n return yield* new PresignedUrlExpiredError({\n message: `Presigned upload URL expired or too close to expiry (expiresAt=${expiresAt}).`,\n });\n }\n\n const request = yield* HttpClientRequest.put(url).pipe(\n HttpClientRequest.bodyFile(filePath),\n Effect.provideService(FileSystem.FileSystem, fileSystem),\n Effect.map(\n HttpClientRequest.setHeaders({\n \"content-length\": String(byteSize),\n ...headers,\n }),\n ),\n Effect.mapError(\n (cause) =>\n new UploadFailedError({\n message: `Failed to open artifact for upload: ${String(cause)}`,\n }),\n ),\n );\n\n const response = yield* client.execute(request).pipe(\n Effect.mapError(\n (cause) =>\n new UploadFailedError({\n message: `HTTP request to presigned URL failed: ${String(cause)}`,\n }),\n ),\n );\n\n if (response.status < 200 || response.status >= 300) {\n const body = yield* response.text.pipe(Effect.orElseSucceed(() => \"\"));\n return yield* new UploadFailedError({\n message: `Presigned URL upload failed with status ${response.status}: ${body}`,\n });\n }\n return undefined;\n }),\n };\n }),\n);\n","import { Context, Effect, Layer } from \"effect\";\n\nimport { UpdatePublishError } from \"../lib/exit-codes\";\nimport { formatCause } from \"../lib/format-error\";\nimport { ApiClientService } from \"./api-client\";\nimport { PresignedUploadClient } from \"./presigned-upload\";\n\nexport interface UploadUpdateAssetInput {\n readonly path: string;\n readonly hash: string;\n readonly byteSize: number;\n readonly uploadUrl: string;\n readonly uploadExpiresAt: string;\n readonly uploadHeaders: Record<string, string>;\n}\n\nexport class UpdateAssetUploader extends Context.Tag(\"cli/UpdateAssetUploader\")<\n UpdateAssetUploader,\n {\n readonly uploadAssetBinary: (\n input: UploadUpdateAssetInput,\n ) => Effect.Effect<void, UpdatePublishError>;\n }\n>() {}\n\nexport const UpdateAssetUploaderLive = Layer.effect(\n UpdateAssetUploader,\n Effect.gen(function* () {\n const presignedUploadClient = yield* PresignedUploadClient;\n const apiService = yield* ApiClientService;\n\n return {\n uploadAssetBinary: (asset: UploadUpdateAssetInput) =>\n Effect.gen(function* () {\n const api = yield* apiService.get.pipe(\n Effect.mapError(\n (cause) =>\n new UpdatePublishError({\n message: `Asset upload requires authentication: ${formatCause(cause)}`,\n }),\n ),\n );\n\n yield* presignedUploadClient\n .putToPresignedUrl({\n url: asset.uploadUrl,\n filePath: asset.path,\n byteSize: asset.byteSize,\n expiresAt: asset.uploadExpiresAt,\n headers: asset.uploadHeaders,\n })\n .pipe(\n Effect.mapError(\n (cause) =>\n new UpdatePublishError({\n message: `Asset upload failed for ${asset.hash}: ${formatCause(cause)}`,\n }),\n ),\n );\n\n yield* api.assets.finalize({ path: { hash: asset.hash } }).pipe(\n Effect.mapError(\n (cause) =>\n new UpdatePublishError({\n message: `Asset finalize failed for ${asset.hash}: ${formatCause(cause)}`,\n }),\n ),\n );\n }),\n };\n }),\n);\n","import { FetchHttpClient } from \"@effect/platform\";\nimport { NodeContext } from \"@effect/platform-node\";\nimport { Layer } from \"effect\";\n\nimport { ApiClientLive } from \"./services/api-client\";\nimport { AppleSessionStoreLive } from \"./services/apple-session-store\";\nimport { AuthStoreLive } from \"./services/auth-store\";\nimport { CliRuntimeLive } from \"./services/cli-runtime\";\nimport { ConfigStoreLive } from \"./services/config-store\";\nimport { PresignedUploadClientLive } from \"./services/presigned-upload\";\nimport { UpdateAssetUploaderLive } from \"./services/update-asset-uploader\";\n\nconst CliPlatformLayer = Layer.mergeAll(CliRuntimeLive, NodeContext.layer, FetchHttpClient.layer);\nconst CliStoreLayer = Layer.mergeAll(AuthStoreLive, ConfigStoreLive, AppleSessionStoreLive).pipe(\n Layer.provide(CliPlatformLayer),\n);\nconst CliAdapterDependencies = Layer.mergeAll(CliPlatformLayer, CliStoreLayer);\nconst ApiClientLayer = ApiClientLive.pipe(Layer.provide(CliAdapterDependencies));\nconst PresignedUploadLayer = PresignedUploadClientLive.pipe(Layer.provide(CliPlatformLayer));\nconst UpdateAssetUploaderLayer = UpdateAssetUploaderLive.pipe(\n Layer.provide(Layer.mergeAll(ApiClientLayer, PresignedUploadLayer)),\n);\n\nexport const CliLive = Layer.mergeAll(\n CliAdapterDependencies,\n ApiClientLayer,\n PresignedUploadLayer,\n UpdateAssetUploaderLayer,\n);\n","import { Console, Effect } from \"effect\";\n\nimport { CliRuntime } from \"../services/cli-runtime\";\n\nexport const exitWith = (code: number, message: string): Effect.Effect<void, never, CliRuntime> =>\n Console.error(message).pipe(\n Effect.zipRight(\n Effect.gen(function* () {\n const runtime = yield* CliRuntime;\n yield* runtime.setExitCode(code);\n }),\n ),\n );\n","import { Effect } from \"effect\";\n\nimport { exitWith } from \"../application/command-exit\";\nimport { formatCause } from \"./format-error\";\n\nimport type { CliRuntime } from \"../services/cli-runtime\";\n\ntype ExitCode = 1 | 2 | 3 | 4 | 5 | 6 | 7;\n\ninterface TaggedError {\n readonly message: string;\n}\n\ntype Handler = (error: TaggedError) => Effect.Effect<void, never, CliRuntime>;\n\nconst BASE_TAG_MAP: Record<string, ExitCode> = {\n AuthRequiredError: 3,\n ProjectNotLinkedError: 4,\n NotFound: 1,\n Conflict: 1,\n Forbidden: 1,\n BadRequest: 2,\n InvalidArgumentError: 2,\n};\n\nconst SYSTEM_TAG_MESSAGE: Record<string, (error: TaggedError) => string> = {\n SystemError: (error) => `Filesystem error: ${error.message}`,\n BadArgument: (error) => `Invalid argument: ${error.message}`,\n};\n\nconst SYSTEM_TAG_CODE: Record<string, ExitCode> = {\n SystemError: 6,\n BadArgument: 6,\n};\n\nexport const makeCommandErrorHandler = (\n extras: Record<string, ExitCode> = {},\n): (<Success, Requirements>(\n effect: Effect.Effect<Success, unknown, Requirements>,\n) => Effect.Effect<Success, never, Requirements | CliRuntime>) => {\n const combined = { ...BASE_TAG_MAP, ...extras };\n const handlers: Record<string, Handler> = {};\n for (const [tag, code] of Object.entries(combined)) {\n const systemFormat = SYSTEM_TAG_MESSAGE[tag];\n const resolvedCode = SYSTEM_TAG_CODE[tag] ?? code;\n handlers[tag] = (error) =>\n exitWith(resolvedCode, systemFormat ? systemFormat(error) : error.message);\n }\n\n return <Success, Requirements>(\n effect: Effect.Effect<Success, unknown, Requirements>,\n ): Effect.Effect<Success, never, Requirements | CliRuntime> => {\n const piped = effect.pipe(\n // eslint-disable-next-line typescript/no-unsafe-type-assertion -- Effect.catchTags tag-inference requires a literal object; we accept a dynamic handler map so tags are chosen at runtime\n Effect.catchTags(handlers as never),\n Effect.catchAll((cause) => exitWith(1, formatCause(cause))),\n );\n // eslint-disable-next-line typescript/no-unsafe-type-assertion -- catchTags narrowing lost when handlers is dynamic; re-narrow at the boundary\n return piped as Effect.Effect<Success, never, Requirements | CliRuntime>;\n };\n};\n","import { Effect } from \"effect\";\n\nimport { CliLive } from \"../app-layer\";\nimport { makeCommandErrorHandler } from \"./command-errors\";\n\ntype ExtraExitMap = Parameters<typeof makeCommandErrorHandler>[0];\n\nexport const runEffect = async <Value, Err, Req>(\n effect: Effect.Effect<Value, Err, Req>,\n extras: ExtraExitMap = {},\n): Promise<void> => {\n const handled = makeCommandErrorHandler(extras)(effect);\n // eslint-disable-next-line typescript/no-unsafe-type-assertion -- CliLive provides every service the CLI handlers require; after makeCommandErrorHandler's catch-all the failure channel is `never`\n const provided = handled.pipe(Effect.provide(CliLive)) as Effect.Effect<Value>;\n return Effect.runPromise(provided.pipe(Effect.asVoid));\n};\n","import { Console, Effect } from \"effect\";\n\nexport const printTable = (\n headers: readonly string[],\n rows: readonly (readonly string[])[],\n): Effect.Effect<void> =>\n Effect.gen(function* () {\n const allRows = [headers, ...rows];\n const colWidths = headers.map((_, colIndex) =>\n // eslint-disable-next-line eslint-js/no-restricted-syntax -- table padding for ragged rows; missing cell treated as empty-width\n Math.max(...allRows.map((row) => (row[colIndex] ?? \"\").length)),\n );\n\n const formatRow = (row: readonly string[]): string =>\n row.map((cell, idx) => cell.padEnd(colWidths[idx] ?? 0)).join(\" \");\n\n yield* Console.log(formatRow(headers));\n yield* Console.log(colWidths.map((width) => \"-\".repeat(width)).join(\" \"));\n\n for (const row of rows) {\n yield* Console.log(formatRow(row));\n }\n });\n\nexport const printKeyValue = (pairs: readonly (readonly [string, string])[]): Effect.Effect<void> =>\n Effect.gen(function* () {\n const maxKeyLen = Math.max(...pairs.map(([key]) => key.length));\n\n for (const [key, value] of pairs) {\n yield* Console.log(`${key.padEnd(maxKeyLen)} ${value}`);\n }\n });\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { printTable } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\n\nexport const adoptionCommand = defineCommand({\n meta: { name: \"adoption\", description: \"Show update adoption across devices\" },\n args: {\n period: { type: \"enum\", options: [\"1d\", \"7d\", \"30d\", \"90d\"], description: \"Time window\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const periodFilter = args.period ? { period: args.period } : {};\n\n const result = yield* api.analytics.adoption({\n urlParams: { projectId, ...periodFilter },\n });\n\n if (result.updates.length === 0) {\n yield* Console.log(\"No adoption data found.\");\n return;\n }\n\n yield* printTable(\n [\"Update ID\", \"Devices\", \"First Seen\", \"Last Seen\"],\n result.updates.map((update) => [\n update.updateId,\n String(update.devices),\n update.firstSeen,\n update.lastSeen,\n ]),\n );\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { printKeyValue } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\n\nexport const channelsCommand = defineCommand({\n meta: { name: \"channels\", description: \"Stats for a specific channel\" },\n args: {\n channel: { type: \"string\", required: true, description: \"Channel name\" },\n period: { type: \"enum\", options: [\"1d\", \"7d\", \"30d\", \"90d\"], description: \"Time window\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const periodFilter = args.period ? { period: args.period } : {};\n\n const result = yield* api.analytics.channels({\n urlParams: { projectId, channel: args.channel, ...periodFilter },\n });\n\n yield* printKeyValue([\n [\"Channel\", result.channel],\n [\"Total Requests\", String(result.totalRequests)],\n [\"Unique Devices\", String(result.uniqueDevices)],\n [\"Manifest\", String(result.responseTypeDistribution.manifest)],\n [\"Directive\", String(result.responseTypeDistribution.directive)],\n [\"No Update\", String(result.responseTypeDistribution.no_update)],\n ]);\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { printTable } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\n\nexport const platformsCommand = defineCommand({\n meta: { name: \"platforms\", description: \"Stats by platform\" },\n args: {\n period: { type: \"enum\", options: [\"1d\", \"7d\", \"30d\", \"90d\"], description: \"Time window\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const periodFilter = args.period ? { period: args.period } : {};\n\n const result = yield* api.analytics.platforms({\n urlParams: { projectId, ...periodFilter },\n });\n\n if (result.platforms.length === 0) {\n yield* Console.log(\"No platform data found.\");\n return;\n }\n\n yield* printTable(\n [\"Platform\", \"Requests\", \"Devices\"],\n result.platforms.map((platform) => [\n platform.platform,\n String(platform.requests),\n String(platform.devices),\n ]),\n );\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { printKeyValue } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\n\nexport const updatesCommand = defineCommand({\n meta: { name: \"updates\", description: \"Stats for a specific update\" },\n args: {\n \"update-id\": { type: \"string\", required: true, description: \"Update ID\" },\n period: { type: \"enum\", options: [\"1d\", \"7d\", \"30d\", \"90d\"], description: \"Time window\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const periodFilter = args.period ? { period: args.period } : {};\n\n const result = yield* api.analytics.updates({\n urlParams: { projectId, updateId: args[\"update-id\"], ...periodFilter },\n });\n\n yield* printKeyValue([\n [\"Update ID\", result.updateId],\n [\"Total Requests\", String(result.totalRequests)],\n [\"Unique Devices\", String(result.uniqueDevices)],\n [\"Manifest\", String(result.byResponseType.manifest)],\n [\"Directive\", String(result.byResponseType.directive)],\n [\"No Update\", String(result.byResponseType.no_update)],\n ]);\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\n\nimport { adoptionCommand } from \"./adoption\";\nimport { channelsCommand } from \"./channels\";\nimport { platformsCommand } from \"./platforms\";\nimport { updatesCommand } from \"./updates\";\n\nexport const analyticsCommand = defineCommand({\n meta: { name: \"analytics\", description: \"View deployment analytics\" },\n subCommands: {\n adoption: adoptionCommand,\n updates: updatesCommand,\n channels: channelsCommand,\n platforms: platformsCommand,\n },\n});\n","import { Effect, ParseResult, Schema } from \"effect\";\n\nimport { InvalidArgumentError } from \"./exit-codes\";\n\nexport const RolloutPercentage = Schema.Number.pipe(\n Schema.int(),\n Schema.between(1, 100),\n).annotations({\n message: () => \"Rollout percentage must be between 1 and 100.\",\n identifier: \"RolloutPercentage\",\n});\n\nexport const KeyValuePair = Schema.Struct({\n key: Schema.String,\n value: Schema.String,\n});\nexport type KeyValuePair = Schema.Schema.Type<typeof KeyValuePair>;\n\nexport const KeyValueFromString = Schema.transformOrFail(Schema.String, KeyValuePair, {\n strict: true,\n decode: (input, _options, ast) => {\n const eqIndex = input.indexOf(\"=\");\n if (eqIndex <= 0) {\n return ParseResult.fail(\n new ParseResult.Type(ast, input, \"Invalid format. Use KEY=VALUE (e.g. API_KEY=abc123)\"),\n );\n }\n return ParseResult.succeed({\n key: input.slice(0, eqIndex),\n value: input.slice(eqIndex + 1),\n });\n },\n encode: ({ key, value }) => ParseResult.succeed(`${key}=${value}`),\n});\n\nexport const parseRolloutPercentage = (\n raw: string,\n flag: string,\n): Effect.Effect<number, InvalidArgumentError> =>\n Effect.try({\n try: () => Schema.decodeUnknownSync(RolloutPercentage)(Number(raw)),\n catch: () =>\n new InvalidArgumentError({\n message: `--${flag} must be an integer between 1 and 100, got \"${raw}\".`,\n }),\n });\n\nexport const parseKeyValue = (raw: string): Effect.Effect<KeyValuePair, InvalidArgumentError> =>\n Effect.try({\n try: () => Schema.decodeUnknownSync(KeyValueFromString)(raw),\n catch: () =>\n new InvalidArgumentError({\n message: \"Invalid format. Use KEY=VALUE (e.g. API_KEY=abc123)\",\n }),\n });\n\nexport const parseLimit = (\n raw: string | undefined,\n defaultValue: number,\n): Effect.Effect<number, InvalidArgumentError> => {\n if (raw === undefined) {\n return Effect.succeed(defaultValue);\n }\n const parsed = Number(raw);\n if (!Number.isInteger(parsed) || parsed < 1) {\n return Effect.fail(\n new InvalidArgumentError({ message: `--limit must be a positive integer, got \"${raw}\".` }),\n );\n }\n return Effect.succeed(parsed);\n};\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { parseLimit } from \"../../lib/cli-schemas\";\nimport { printTable } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\n\nexport const listCommand = defineCommand({\n meta: { name: \"list\", description: \"List audit log entries\" },\n args: {\n \"resource-type\": { type: \"string\", description: \"Filter by resource type\" },\n from: { type: \"string\", description: \"ISO timestamp lower bound\" },\n to: { type: \"string\", description: \"ISO timestamp upper bound\" },\n limit: { type: \"string\", default: \"100\", description: \"Max rows (default 100)\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const limit = yield* parseLimit(args.limit, 100);\n const api = yield* apiClient;\n\n const filters: Record<string, string> = {};\n if (args[\"resource-type\"]) {\n filters[\"resourceType\"] = args[\"resource-type\"];\n }\n if (args.from) {\n filters[\"from\"] = args.from;\n }\n if (args.to) {\n filters[\"to\"] = args.to;\n }\n\n const { items } = yield* api[\"audit-logs\"].list({\n urlParams: { ...filters, limit },\n });\n\n if (items.length === 0) {\n yield* Console.log(\"No audit log entries found.\");\n return;\n }\n\n yield* printTable(\n [\"ID\", \"Action\", \"Resource Type\", \"Resource ID\", \"Actor\", \"Source\", \"Created\"],\n items.map((log) => [\n log.id,\n log.action,\n log.resourceType,\n log.resourceId ?? \"-\",\n log.actorEmail,\n log.source,\n log.createdAt,\n ]),\n );\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\n\nimport { listCommand } from \"./list\";\n\nexport const auditLogsCommand = defineCommand({\n meta: { name: \"audit-logs\", description: \"View audit logs\" },\n subCommands: {\n list: listCommand,\n },\n});\n","import { Effect } from \"effect\";\n\ninterface NumberedPage<Item> {\n readonly items: readonly Item[];\n readonly total: number;\n readonly page: number;\n readonly limit: number;\n}\n\nconst MAX_PAGES = 100;\n\n/**\n * Drain a page-numbered list endpoint into a single array. Used by CLI\n * commands that need the full set, not a page slice.\n */\nexport const drainPages = <Item, Err, Req>(\n fetchPage: (page: number) => Effect.Effect<NumberedPage<Item>, Err, Req>,\n): Effect.Effect<readonly Item[], Err, Req> => {\n const loop = (\n accumulator: readonly Item[],\n page: number,\n ): Effect.Effect<readonly Item[], Err, Req> =>\n fetchPage(page).pipe(\n Effect.flatMap((response) => {\n const next = [...accumulator, ...response.items];\n const fetched = page * response.limit;\n const reachedLimit = page >= MAX_PAGES || next.length >= response.total;\n return reachedLimit || fetched >= response.total\n ? Effect.succeed(next)\n : loop(next, page + 1);\n }),\n );\n return loop([], 1);\n};\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../lib/app-json\";\nimport { runEffect } from \"../lib/citty-effect\";\nimport { drainPages } from \"../lib/drain-cursor\";\nimport { printKeyValue, printTable } from \"../lib/output\";\nimport { apiClient } from \"../services/api-client\";\n\nconst listCommand = defineCommand({\n meta: { name: \"list\", description: \"List branches for the linked project\" },\n run: async () =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n const items = yield* drainPages((page) =>\n api.branches.list({\n urlParams: { projectId, limit: 100, page },\n }),\n );\n\n if (items.length === 0) {\n yield* Console.log(\"No branches found.\");\n return;\n }\n\n yield* printTable(\n [\"ID\", \"Name\", \"Created\"],\n items.map((branch) => [branch.id, branch.name, branch.createdAt]),\n );\n }),\n ),\n});\n\nconst createCommand = defineCommand({\n meta: { name: \"create\", description: \"Create a branch\" },\n args: {\n name: { type: \"string\", required: true, description: \"Branch name\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n const branch = yield* api.branches.create({\n payload: { projectId, name: args.name },\n });\n yield* printKeyValue([\n [\"ID\", branch.id],\n [\"Name\", branch.name],\n [\"Created\", branch.createdAt],\n ]);\n }),\n ),\n});\n\nconst renameCommand = defineCommand({\n meta: { name: \"rename\", description: \"Rename a branch\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Branch ID\" },\n name: { type: \"string\", required: true, description: \"New branch name\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const branch = yield* api.branches.rename({\n path: { id: args.id },\n payload: { name: args.name },\n });\n yield* Console.log(`Branch renamed to \"${branch.name}\".`);\n }),\n ),\n});\n\nconst deleteCommand = defineCommand({\n meta: { name: \"delete\", description: \"Delete a branch\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Branch ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n yield* api.branches.delete({ path: { id: args.id } });\n yield* Console.log(`Branch ${args.id} deleted.`);\n }),\n ),\n});\n\nexport const branchesCommand = defineCommand({\n meta: { name: \"branches\", description: \"Manage branches\" },\n subCommands: {\n list: listCommand,\n create: createCommand,\n rename: renameCommand,\n delete: deleteCommand,\n },\n});\n","export interface RenderSigningGradleInput {\n readonly keystorePath: string;\n readonly storePassword: string;\n readonly keyAlias: string;\n readonly keyPassword: string;\n}\n\n/**\n * Escape a Groovy single-quoted string literal: backslashes, single quotes,\n * and `$` (to prevent string interpolation on Groovy double-quoted strings,\n * though we use single quotes everywhere for safety).\n */\nconst escapeGroovySingleQuoted = (value: string): string =>\n value\n .replaceAll(\"\\\\\", String.raw`\\\\`)\n .replaceAll(\"'\", String.raw`\\'`)\n .replaceAll(\"$\", String.raw`\\$`);\n\n/**\n * Render a Gradle init script that injects a `release` signing config into\n * every Android application module after evaluation. This is passed to\n * `./gradlew --init-script <path>` so the keystore never has to live in the\n * project tree.\n */\nexport const renderSigningGradle = ({\n keystorePath,\n storePassword,\n keyAlias,\n keyPassword,\n}: RenderSigningGradleInput): string =>\n `allprojects {\n afterEvaluate { project ->\n if (project.plugins.hasPlugin('com.android.application')) {\n project.android {\n signingConfigs {\n release {\n storeFile file('${escapeGroovySingleQuoted(keystorePath)}')\n storePassword '${escapeGroovySingleQuoted(storePassword)}'\n keyAlias '${escapeGroovySingleQuoted(keyAlias)}'\n keyPassword '${escapeGroovySingleQuoted(keyPassword)}'\n }\n }\n buildTypes {\n release {\n signingConfig signingConfigs.release\n }\n }\n }\n }\n }\n}\n`;\n","export const capitalize = (value: string): string => {\n const [first] = value;\n return first === undefined ? value : `${first.toUpperCase()}${value.slice(1)}`;\n};\n","import path from \"node:path\";\n\nimport { FileSystem } from \"@effect/platform\";\nimport { Effect, Option } from \"effect\";\nimport { maxBy } from \"es-toolkit\";\n\nimport type { PlatformError } from \"@effect/platform/Error\";\n\nimport { ArtifactNotFoundError } from \"./exit-codes\";\nimport { capitalize } from \"./string-utils\";\n\nexport interface FindIosArtifactOptions {\n readonly exportPath: string;\n}\n\nexport interface FindAndroidArtifactOptions {\n readonly projectRoot: string;\n readonly format: \"apk\" | \"aab\";\n readonly flavor?: string;\n readonly buildType: \"debug\" | \"release\";\n /**\n * If provided, only artifacts with mtimeMs >= this value are considered.\n * Used to exclude stale artifacts from previous builds when the current\n * build failed to write an expected output.\n */\n readonly minMtimeMs?: number;\n}\n\ninterface FoundFile {\n readonly path: string;\n readonly mtimeMs: number;\n}\n\nconst walkAndFind = (\n root: string,\n extension: string,\n): Effect.Effect<readonly FoundFile[], PlatformError, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n // No fs.exists pre-check: readDirectory on a missing/non-dir path fails\n // With a PlatformError that we catch into an empty list below.\n const entries = yield* fs.readDirectory(root).pipe(Effect.orElseSucceed(() => []));\n\n const results: FoundFile[] = [];\n for (const entry of entries) {\n const fullPath = path.join(root, entry);\n const stat = yield* fs.stat(fullPath).pipe(Effect.option);\n if (Option.isSome(stat)) {\n const info = stat.value;\n if (info.type === \"Directory\") {\n const nested = yield* walkAndFind(fullPath, extension);\n results.push(...nested);\n } else if (info.type === \"File\" && entry.toLowerCase().endsWith(extension)) {\n results.push({\n path: fullPath,\n mtimeMs: Option.match(info.mtime, {\n onNone: () => 0,\n onSome: (date) => date.getTime(),\n }),\n });\n }\n }\n }\n return results;\n });\n\nconst newest = (files: readonly FoundFile[], minMtimeMs?: number): FoundFile | undefined => {\n const eligible =\n minMtimeMs === undefined ? files : files.filter((file) => file.mtimeMs >= minMtimeMs);\n return maxBy(eligible, (file) => file.mtimeMs);\n};\n\nexport const findIosArtifact = ({\n exportPath,\n}: FindIosArtifactOptions): Effect.Effect<\n string,\n ArtifactNotFoundError | PlatformError,\n FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const files = yield* walkAndFind(exportPath, \".ipa\");\n const picked = newest(files);\n if (!picked) {\n return yield* new ArtifactNotFoundError({\n message: `No .ipa file found under \"${exportPath}\".`,\n });\n }\n return picked.path;\n });\n\nexport const findAndroidArtifact = ({\n projectRoot,\n format,\n flavor,\n buildType,\n minMtimeMs,\n}: FindAndroidArtifactOptions): Effect.Effect<\n string,\n ArtifactNotFoundError | PlatformError,\n FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const outputsRoot = path.join(projectRoot, \"android\", \"app\", \"build\", \"outputs\");\n const subdir = format === \"aab\" ? \"bundle\" : \"apk\";\n const variantDir = flavor ? `${flavor}${capitalize(buildType)}` : buildType;\n const expectedDir = path.join(outputsRoot, subdir, variantDir);\n\n const direct = yield* walkAndFind(expectedDir, `.${format}`);\n const pickedDirect = newest(direct, minMtimeMs);\n if (pickedDirect) {\n return pickedDirect.path;\n }\n\n const fallback = yield* walkAndFind(outputsRoot, `.${format}`);\n const pickedFallback = newest(fallback, minMtimeMs);\n if (!pickedFallback) {\n return yield* new ArtifactNotFoundError({\n message: `No .${format} artifact found under \"${outputsRoot}\"${minMtimeMs === undefined ? \"\" : \" (newer than build start)\"}.`,\n });\n }\n return pickedFallback.path;\n });\n","const asUint8Array = (data: Uint8Array | ArrayBuffer): Uint8Array =>\n data instanceof Uint8Array ? data : new Uint8Array(data);\n\nconst toBinaryString = (data: Uint8Array | ArrayBuffer): string =>\n Array.from(asUint8Array(data), (byte) => String.fromCodePoint(byte)).join(\"\");\n\nconst padBase64 = (value: string): string =>\n value.padEnd(value.length + ((4 - (value.length % 4)) % 4), \"=\");\n\nconst BASE64_PATTERN = /^[A-Za-z0-9+/]*={0,2}$/u;\nconst BASE64_URL_PATTERN = /^[A-Za-z0-9_-]*={0,2}$/u;\nconst HEX_PATTERN = /^(?:[0-9A-Fa-f]{2})*$/u;\n\nconst normalizeBase64 = (value: string): string => {\n const compact = value.replaceAll(/\\s+/gu, \"\");\n if (!BASE64_PATTERN.test(compact) || compact.length % 4 === 1) {\n throw new RangeError(\"Invalid base64 string\");\n }\n return padBase64(compact);\n};\n\nconst normalizeBase64Url = (value: string): string => {\n const compact = value.replaceAll(/\\s+/gu, \"\");\n if (!BASE64_URL_PATTERN.test(compact) || compact.length % 4 === 1) {\n throw new RangeError(\"Invalid base64url string\");\n }\n return compact.replaceAll(\"-\", \"+\").replaceAll(\"_\", \"/\");\n};\n\nexport const toBase64 = (data: Uint8Array | ArrayBuffer): string => btoa(toBinaryString(data));\n\nexport const fromBase64 = (str: string): Uint8Array<ArrayBuffer> => {\n const binary = atob(normalizeBase64(str));\n return Uint8Array.from(binary, (char) => char.codePointAt(0) ?? 0);\n};\n\nexport const toBase64Url = (data: Uint8Array | ArrayBuffer): string =>\n toBase64(data).replaceAll(\"+\", \"-\").replaceAll(\"/\", \"_\").replace(/=+$/u, \"\");\n\nexport const fromBase64Url = (str: string): Uint8Array<ArrayBuffer> =>\n fromBase64(padBase64(normalizeBase64Url(str)));\n\nexport const toHex = (bytes: Uint8Array | ArrayBuffer): string =>\n Array.from(asUint8Array(bytes), (byte) => byte.toString(16).padStart(2, \"0\")).join(\"\");\n\nexport const fromHex = (hex: string): Uint8Array<ArrayBuffer> => {\n if (!HEX_PATTERN.test(hex)) {\n throw new RangeError(\"Invalid hex string\");\n }\n return Uint8Array.from(hex.match(/.{2}/gu) ?? [], (byte) => Number.parseInt(byte, 16));\n};\n","import path from \"node:path\";\n\nimport { fromBase64 } from \"@better-update/encoding\";\nimport { FileSystem } from \"@effect/platform\";\nimport { Effect } from \"effect\";\n\nimport type { PlatformError } from \"@effect/platform/Error\";\n\nimport { MissingCredentialsError } from \"./exit-codes\";\n\nimport type { ApiClient } from \"../services/api-client\";\nimport type { IosDistribution } from \"./build-profile\";\n\nexport interface DownloadIosCredentialsOptions {\n readonly projectId: string;\n readonly bundleIdentifier: string;\n readonly distribution: IosDistribution;\n readonly tempDir: string;\n}\n\nexport interface IosCredentials {\n readonly p12Path: string;\n readonly p12Password: string;\n readonly profilePath: string;\n readonly profileFilename: string;\n readonly teamId: string;\n}\n\nconst IOS_DISTRIBUTION_TO_TYPE = {\n \"app-store\": \"APP_STORE\",\n \"ad-hoc\": \"AD_HOC\",\n development: \"DEVELOPMENT\",\n enterprise: \"ENTERPRISE\",\n} as const satisfies Record<IosDistribution, \"APP_STORE\" | \"AD_HOC\" | \"DEVELOPMENT\" | \"ENTERPRISE\">;\n\nconst bindHint =\n \"Bind the bundle via the dashboard (Credentials → iOS Bundle Configurations) and make sure a distribution certificate, provisioning profile, and ASC API key are attached.\";\n\nconst permissionHint = \"Ask an org admin to grant the build-credentials download permission.\";\n\nconst androidBindHint =\n \"Register the package in the dashboard (Credentials → Android Build Credentials) and bind a keystore to the default group.\";\n\ninterface TaggedCause {\n readonly _tag: string;\n readonly message?: string;\n}\n\nconst hasTag = (cause: unknown): cause is TaggedCause =>\n typeof cause === \"object\" && cause !== null && \"_tag\" in cause;\n\nconst resolveErrorToMissingCredentials = (\n cause: unknown,\n platform: \"ios\" | \"android\",\n): MissingCredentialsError => {\n const tag = hasTag(cause) ? cause._tag : null;\n const message = hasTag(cause) && typeof cause.message === \"string\" ? cause.message : null;\n const platformLabel = platform === \"ios\" ? \"iOS\" : \"Android\";\n const bind = platform === \"ios\" ? bindHint : androidBindHint;\n\n if (tag === \"Forbidden\") {\n return new MissingCredentialsError({\n message: message ?? `Permission denied when resolving ${platformLabel} build credentials`,\n hint: permissionHint,\n });\n }\n if (tag === \"NotFound\") {\n return new MissingCredentialsError({\n message: message ?? `No ${platformLabel} build credentials configured`,\n hint: bind,\n });\n }\n if (tag === \"BadRequest\") {\n return new MissingCredentialsError({\n message: message ?? `${platformLabel} build credentials are misconfigured`,\n hint: bind,\n });\n }\n return new MissingCredentialsError({\n message: message ?? `Failed to resolve ${platformLabel} build credentials`,\n hint: bind,\n });\n};\n\nexport const downloadIosCredentials = (\n api: ApiClient,\n options: DownloadIosCredentialsOptions,\n): Effect.Effect<IosCredentials, MissingCredentialsError | PlatformError, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n\n const resolved = yield* api.buildCredentials\n .resolve({\n path: { projectId: options.projectId },\n payload: {\n platform: \"ios\" as const,\n bundleIdentifier: options.bundleIdentifier,\n distributionType: IOS_DISTRIBUTION_TO_TYPE[options.distribution],\n },\n })\n .pipe(Effect.mapError((cause) => resolveErrorToMissingCredentials(cause, \"ios\")));\n\n if (resolved.platform !== \"ios\") {\n return yield* Effect.fail(\n new MissingCredentialsError({\n message: \"Server returned non-iOS credentials for an iOS build request\",\n hint: bindHint,\n }),\n );\n }\n\n const p12Path = path.join(options.tempDir, \"signing.p12\");\n const profileFilename = `${resolved.provisioningProfile.uuid ?? \"profile\"}.mobileprovision`;\n const profilePath = path.join(options.tempDir, profileFilename);\n\n yield* fs.writeFile(p12Path, fromBase64(resolved.distributionCertificate.p12Base64));\n yield* fs.writeFile(\n profilePath,\n fromBase64(resolved.provisioningProfile.mobileprovisionBase64),\n );\n\n return {\n p12Path,\n p12Password: resolved.distributionCertificate.p12Password,\n profilePath,\n profileFilename,\n teamId: resolved.provisioningProfile.teamId,\n };\n });\n\nexport interface DownloadAndroidCredentialsOptions {\n readonly projectId: string;\n readonly applicationIdentifier: string;\n readonly tempDir: string;\n}\n\nexport interface AndroidCredentials {\n readonly keystorePath: string;\n readonly storePassword: string;\n readonly keyAlias: string;\n readonly keyPassword: string;\n}\n\nexport const downloadAndroidCredentials = (\n api: ApiClient,\n options: DownloadAndroidCredentialsOptions,\n): Effect.Effect<\n AndroidCredentials,\n MissingCredentialsError | PlatformError,\n FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n\n const resolved = yield* api.buildCredentials\n .resolve({\n path: { projectId: options.projectId },\n payload: {\n platform: \"android\" as const,\n applicationIdentifier: options.applicationIdentifier,\n },\n })\n .pipe(Effect.mapError((cause) => resolveErrorToMissingCredentials(cause, \"android\")));\n\n if (resolved.platform !== \"android\") {\n return yield* Effect.fail(\n new MissingCredentialsError({\n message: \"Server returned non-Android credentials for an Android build request\",\n hint: androidBindHint,\n }),\n );\n }\n\n const keystorePath = path.join(options.tempDir, \"upload.keystore\");\n yield* fs.writeFile(keystorePath, fromBase64(resolved.keystore.keystoreBase64));\n\n return {\n keystorePath,\n storePassword: resolved.keystore.storePassword,\n keyAlias: resolved.keystore.keyAlias,\n keyPassword: resolved.keystore.keyPassword,\n };\n });\n","import { createHash } from \"node:crypto\";\nimport { createReadStream } from \"node:fs\";\n\nimport { toBase64Url } from \"@better-update/encoding\";\nimport { Effect } from \"effect\";\n\nimport { BuildFailedError } from \"./exit-codes\";\n\nexport interface Sha256FileResult {\n readonly sha256: string;\n readonly byteSize: number;\n}\n\nexport interface Sha256FileBase64UrlResult {\n readonly sha256Base64Url: string;\n readonly byteSize: number;\n}\n\nconst hashReadError = (message: string) =>\n new BuildFailedError({\n step: \"sha256\",\n exitCode: 1,\n message,\n });\n\nconst hashFile = <TDigest>(\n path: string,\n formatDigest: (digest: Buffer) => TDigest,\n): Effect.Effect<{ digest: TDigest; byteSize: number }, BuildFailedError> =>\n Effect.async<{ digest: TDigest; byteSize: number }, BuildFailedError>((resume) => {\n const hash = createHash(\"sha256\");\n const stream = createReadStream(path);\n let byteSize = 0;\n\n stream.on(\"data\", (chunk) => {\n const buffer = typeof chunk === \"string\" ? Buffer.from(chunk) : chunk;\n byteSize += buffer.byteLength;\n hash.update(buffer);\n });\n stream.on(\"error\", (error) => {\n resume(Effect.fail(hashReadError(`Failed to read file for SHA-256: ${error.message}`)));\n });\n stream.on(\"end\", () => {\n resume(\n Effect.succeed({\n digest: formatDigest(hash.digest()),\n byteSize,\n }),\n );\n });\n });\n\n/**\n * Compute the SHA-256 digest and byte size of a file using Node's streaming\n * hash API. The file is never fully loaded into memory — chunks flow through\n * `createReadStream` into `crypto.createHash(\"sha256\")`.\n */\nexport const sha256File = (path: string): Effect.Effect<Sha256FileResult, BuildFailedError> =>\n hashFile(path, (digest) => digest.toString(\"hex\")).pipe(\n Effect.map(({ digest, byteSize }) => ({ sha256: digest, byteSize })),\n );\n\nexport const sha256FileBase64Url = (\n path: string,\n): Effect.Effect<Sha256FileBase64UrlResult, BuildFailedError> =>\n hashFile(path, toBase64Url).pipe(\n Effect.map(({ digest, byteSize }) => ({ sha256Base64Url: digest, byteSize })),\n );\n\n/**\n * Compute a content-type-namespaced hash: `SHA-256(contentType + '\\0' + SHA-256_hex(fileBytes))`.\n *\n * This prevents hash collisions when identical bytes are served with different\n * MIME types (e.g. same file used as both `application/javascript` and `text/plain`).\n * The raw content hash is still needed separately for R2 upload verification.\n */\nexport const sha256Namespaced = (contentType: string, contentSha256Hex: string): string => {\n const input = `${contentType}\\0${contentSha256Hex}`;\n return toBase64Url(createHash(\"sha256\").update(input).digest());\n};\n","import process from \"node:process\";\n\nimport { Command } from \"@effect/platform\";\nimport { Effect, Fiber, Stream } from \"effect\";\n\nimport type { CommandExecutor } from \"@effect/platform\";\nimport type { Scope } from \"effect\";\n\nimport { BuildFailedError } from \"../../lib/exit-codes\";\n\nimport type { XcodebuildFormatter } from \"../../lib/xcpretty-formatter\";\n\nexport const runStep = (\n cmd: Command.Command,\n step: string,\n): Effect.Effect<void, BuildFailedError, CommandExecutor.CommandExecutor> =>\n Command.exitCode(cmd.pipe(Command.stdout(\"inherit\"), Command.stderr(\"inherit\"))).pipe(\n Effect.mapError(\n (cause) =>\n new BuildFailedError({\n step,\n exitCode: 1,\n message: `${step} failed to spawn: ${String(cause)}`,\n }),\n ),\n Effect.flatMap((code) =>\n code === 0\n ? Effect.void\n : Effect.fail(\n new BuildFailedError({\n step,\n exitCode: code,\n message: `${step} exited with code ${code}`,\n }),\n ),\n ),\n );\n\n/**\n * Run a build step with stdout piped through a formatter (e.g., xcpretty).\n * stderr passes through to the terminal directly.\n */\nexport const runStepFormatted = (\n cmd: Command.Command,\n step: string,\n formatter: XcodebuildFormatter,\n): Effect.Effect<void, BuildFailedError, CommandExecutor.CommandExecutor | Scope.Scope> =>\n Effect.gen(function* () {\n const proc = yield* Command.start(\n cmd.pipe(Command.stdout(\"pipe\"), Command.stderr(\"pipe\")),\n ).pipe(\n Effect.mapError(\n (cause) =>\n new BuildFailedError({\n step,\n exitCode: 1,\n message: `${step} failed to spawn: ${String(cause)}`,\n }),\n ),\n );\n\n const stdoutFiber = yield* proc.stdout.pipe(\n Stream.decodeText(),\n Stream.splitLines,\n Stream.runForEach((line) => {\n const formatted = formatter.pipe(line);\n return formatted.length > 0\n ? Effect.sync(() => {\n for (const output of formatted) {\n process.stdout.write(`${output}\\n`);\n }\n })\n : Effect.void;\n }),\n Effect.mapError(\n (cause) =>\n new BuildFailedError({\n step,\n exitCode: 1,\n message: `${step} stdout stream error: ${String(cause)}`,\n }),\n ),\n Effect.fork,\n );\n\n const stderrFiber = yield* proc.stderr.pipe(\n Stream.decodeText(),\n Stream.splitLines,\n Stream.runForEach((line) => Effect.sync(() => process.stderr.write(`${line}\\n`))),\n Effect.mapError(\n (cause) =>\n new BuildFailedError({\n step,\n exitCode: 1,\n message: `${step} stderr stream error: ${String(cause)}`,\n }),\n ),\n Effect.fork,\n );\n\n // Join fibers concurrently — stream errors are non-fatal, exit code takes precedence.\n yield* Effect.all([Fiber.join(stdoutFiber), Fiber.join(stderrFiber)], {\n concurrency: 2,\n }).pipe(Effect.catchAll(() => Effect.void));\n\n const code = yield* proc.exitCode.pipe(\n Effect.mapError(\n (cause) =>\n new BuildFailedError({\n step,\n exitCode: 1,\n message: `${step} exit code error: ${String(cause)}`,\n }),\n ),\n );\n\n if (code !== 0) {\n // Print build summary on failure for xcpretty diagnostics\n const summary = formatter.getBuildSummary();\n if (summary) {\n process.stderr.write(`${summary}\\n`);\n }\n\n return yield* new BuildFailedError({\n step,\n exitCode: code,\n message: `${step} exited with code ${code}`,\n });\n }\n return undefined;\n });\n","import path from \"node:path\";\n\nimport { Command, FileSystem } from \"@effect/platform\";\nimport { Effect } from \"effect\";\n\nimport type { CommandExecutor } from \"@effect/platform\";\nimport type { PlatformError } from \"@effect/platform/Error\";\n\nimport { renderSigningGradle } from \"../../lib/android-signing-gradle\";\nimport { findAndroidArtifact } from \"../../lib/artifact-finder\";\nimport { downloadAndroidCredentials } from \"../../lib/credentials-downloader\";\nimport { sha256File } from \"../../lib/sha256\";\nimport { capitalize } from \"../../lib/string-utils\";\nimport { CliRuntime } from \"../../services/cli-runtime\";\nimport { runStep } from \"./run-step\";\n\nimport type { AndroidProfile } from \"../../lib/build-profile\";\nimport type {\n ArtifactNotFoundError,\n BuildFailedError,\n MissingCredentialsError,\n} from \"../../lib/exit-codes\";\nimport type { ApiClient } from \"../../services/api-client\";\n\nexport interface RunAndroidBuildInput {\n readonly api: ApiClient;\n readonly tempDir: string;\n readonly projectRoot: string;\n readonly androidProfile: AndroidProfile;\n readonly applicationIdentifier: string;\n readonly envVars: Record<string, string>;\n readonly projectId: string;\n}\n\nexport interface RunAndroidBuildResult {\n readonly artifactPath: string;\n readonly byteSize: number;\n readonly sha256: string;\n}\n\n/**\n * Compose the Gradle task name from flavor, format, and buildType.\n *\n * Gradle naming convention: `<verb><Flavor><Variant>`, e.g.\n * - no flavor + apk + release → `assembleRelease`\n * - no flavor + aab + release → `bundleRelease`\n * - flavor=prod + aab + release → `bundleProdRelease`\n * - flavor=prod + apk + debug → `assembleProdDebug`\n */\nconst gradleTaskName = (\n format: \"apk\" | \"aab\",\n flavor: string | undefined,\n buildType: \"debug\" | \"release\",\n): string => {\n const verb = format === \"aab\" ? \"bundle\" : \"assemble\";\n return flavor\n ? `${verb}${capitalize(flavor)}${capitalize(buildType)}`\n : `${verb}${capitalize(buildType)}`;\n};\n\nexport const runAndroidBuild = (\n input: RunAndroidBuildInput,\n): Effect.Effect<\n RunAndroidBuildResult,\n BuildFailedError | MissingCredentialsError | ArtifactNotFoundError | PlatformError,\n CliRuntime | CommandExecutor.CommandExecutor | FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const { api, tempDir, projectRoot, androidProfile, applicationIdentifier, envVars, projectId } =\n input;\n const runtime = yield* CliRuntime;\n\n // Record build start so artifact-finder can reject stale outputs from\n // Earlier builds that may still live in `android/app/build/outputs/`.\n const buildStartMs = Date.now();\n\n const { format } = androidProfile;\n const { flavor } = androidProfile;\n const buildType = androidProfile.buildType ?? \"release\";\n const androidDir = path.join(projectRoot, \"android\");\n const commandEnv = yield* runtime.commandEnvironment(envVars);\n\n const credentials = yield* downloadAndroidCredentials(api, {\n projectId,\n applicationIdentifier,\n tempDir,\n });\n\n yield* runStep(\n Command.make(\"bunx\", \"expo\", \"prebuild\", \"--platform\", \"android\", \"--clean\").pipe(\n Command.workingDirectory(projectRoot),\n Command.env(commandEnv),\n ),\n \"expo prebuild android\",\n );\n\n const fs = yield* FileSystem.FileSystem;\n const signingGradlePath = path.join(tempDir, \"signing.gradle\");\n yield* fs.writeFileString(\n signingGradlePath,\n renderSigningGradle({\n keystorePath: credentials.keystorePath,\n storePassword: credentials.storePassword,\n keyAlias: credentials.keyAlias,\n keyPassword: credentials.keyPassword,\n }),\n );\n\n const taskName = gradleTaskName(format, flavor, buildType);\n yield* runStep(\n Command.make(\"./gradlew\", \"--init-script\", signingGradlePath, `:app:${taskName}`).pipe(\n Command.workingDirectory(androidDir),\n Command.env(commandEnv),\n ),\n \"gradlew\",\n );\n\n const artifactPath = yield* findAndroidArtifact({\n projectRoot,\n format,\n ...(flavor === undefined ? {} : { flavor }),\n buildType,\n minMtimeMs: buildStartMs,\n });\n\n const { sha256, byteSize } = yield* sha256File(artifactPath);\n\n return { artifactPath, byteSize, sha256 };\n });\n","export type ExportMethod = \"app-store\" | \"ad-hoc\" | \"enterprise\" | \"development\";\n\nexport interface RenderExportOptionsPlistInput {\n readonly method: ExportMethod;\n readonly teamId: string;\n readonly bundleId: string;\n readonly provisioningProfileName: string;\n readonly compileBitcode?: boolean;\n}\n\nconst escapeXml = (value: string): string =>\n value\n .replaceAll(\"&\", \"&\")\n .replaceAll(\"<\", \"<\")\n .replaceAll(\">\", \">\")\n .replaceAll('\"', \""\")\n .replaceAll(\"'\", \"'\");\n\nconst boolTag = (value: boolean): string => (value ? \"<true/>\" : \"<false/>\");\n\n/**\n * Render an Xcode `ExportOptions.plist` for `xcodebuild -exportArchive`.\n *\n * - `signingStyle` is always `manual` (ephemeral keychain + downloaded profile)\n * - `uploadSymbols` is emitted only for `app-store` exports\n * - `provisioningProfiles` dict maps bundleId → profile name\n * - `compileBitcode` defaults to `false`\n */\nexport const renderExportOptionsPlist = ({\n method,\n teamId,\n bundleId,\n provisioningProfileName,\n compileBitcode = false,\n}: RenderExportOptionsPlistInput): string => {\n const lines: string[] = [\n '<?xml version=\"1.0\" encoding=\"UTF-8\"?>',\n '<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">',\n '<plist version=\"1.0\">',\n \"<dict>\",\n \"\\t<key>method</key>\",\n `\\t<string>${escapeXml(method)}</string>`,\n \"\\t<key>teamID</key>\",\n `\\t<string>${escapeXml(teamId)}</string>`,\n \"\\t<key>signingStyle</key>\",\n \"\\t<string>manual</string>\",\n \"\\t<key>compileBitcode</key>\",\n `\\t${boolTag(compileBitcode)}`,\n \"\\t<key>provisioningProfiles</key>\",\n \"\\t<dict>\",\n `\\t\\t<key>${escapeXml(bundleId)}</key>`,\n `\\t\\t<string>${escapeXml(provisioningProfileName)}</string>`,\n \"\\t</dict>\",\n ];\n\n if (method === \"app-store\") {\n lines.push(\"\\t<key>uploadSymbols</key>\", \"\\t<true/>\");\n }\n\n lines.push(\"</dict>\", \"</plist>\", \"\");\n return lines.join(\"\\n\");\n};\n","import { randomBytes, randomUUID } from \"node:crypto\";\nimport path from \"node:path\";\n\nimport { Command } from \"@effect/platform\";\nimport { Effect } from \"effect\";\n\nimport type { CommandExecutor } from \"@effect/platform\";\nimport type { Scope } from \"effect\";\n\nimport { KeychainError } from \"./exit-codes\";\n\nexport interface AcquireKeychainOptions {\n readonly tempDir: string;\n readonly p12Path: string;\n readonly p12Password: string;\n}\n\nexport interface KeychainHandle {\n readonly keychainName: string;\n readonly keychainPath: string;\n readonly signingIdentity: string;\n}\n\n// ── shell helpers ─────────────────────────────────────────────────\n\nconst runOrFail = (\n cmd: Command.Command,\n step: string,\n): Effect.Effect<string, KeychainError, CommandExecutor.CommandExecutor> =>\n Command.string(cmd).pipe(\n Effect.mapError(\n (cause) =>\n new KeychainError({\n message: `keychain ${step} failed: ${String(cause)}`,\n }),\n ),\n );\n\nconst listCurrentKeychains = Effect.gen(function* () {\n // `security list-keychains -d user` returns each keychain path on its own line,\n // Surrounded by double quotes and optionally preceded by whitespace.\n const output = yield* runOrFail(\n Command.make(\"security\", \"list-keychains\", \"-d\", \"user\"),\n \"list-keychains\",\n );\n return output\n .split(\"\\n\")\n .map((line) => line.trim().replace(/^\"/u, \"\").replace(/\"$/u, \"\"))\n .filter((line) => line.length > 0);\n});\n\n// Parse `security find-identity -v <keychain>` output to extract the first\n// Signing identity. Lines look like:\n// 1) 1A2B3C4D... \"Apple Distribution: Your Name (TEAMID)\"\nconst parseSigningIdentity = (output: string): string | undefined => {\n const lines = output.split(\"\\n\");\n for (const line of lines) {\n const match = /\"([^\"]+)\"/u.exec(line);\n if (match?.[1]) {\n return match[1];\n }\n }\n return undefined;\n};\n\n// ── acquireRelease ────────────────────────────────────────────────\n\n/**\n * Acquire an ephemeral macOS keychain, import a `.p12` into it, add it to the\n * user search list, and tear it all down on scope close. The keychain name is\n * namespaced as `better-update-<uuid>` and lives in `$tempDir`, so cleanup is\n * guaranteed under all termination paths.\n */\nexport const acquireKeychain = ({\n tempDir,\n p12Path,\n p12Password,\n}: AcquireKeychainOptions): Effect.Effect<\n KeychainHandle,\n KeychainError,\n CommandExecutor.CommandExecutor | Scope.Scope\n> => {\n const keychainName = `better-update-${randomUUID()}.keychain-db`;\n const keychainPath = path.join(tempDir, keychainName);\n const keychainPassword = randomBytes(32).toString(\"hex\");\n\n return Effect.acquireRelease(\n // ── acquire ─────────────────────────────────────────────────\n Effect.gen(function* () {\n const priorKeychains = yield* listCurrentKeychains;\n\n yield* runOrFail(\n Command.make(\"security\", \"create-keychain\", \"-p\", keychainPassword, keychainPath),\n \"create-keychain\",\n );\n\n yield* runOrFail(\n Command.make(\"security\", \"unlock-keychain\", \"-p\", keychainPassword, keychainPath),\n \"unlock-keychain\",\n );\n\n yield* runOrFail(\n Command.make(\"security\", \"set-keychain-settings\", \"-t\", \"3600\", \"-l\", keychainPath),\n \"set-keychain-settings\",\n );\n\n yield* runOrFail(\n Command.make(\n \"security\",\n \"import\",\n p12Path,\n \"-k\",\n keychainPath,\n \"-P\",\n p12Password,\n \"-T\",\n \"/usr/bin/codesign\",\n ),\n \"import\",\n );\n\n yield* runOrFail(\n Command.make(\n \"security\",\n \"set-key-partition-list\",\n \"-S\",\n \"apple-tool:,apple:,codesign:\",\n \"-s\",\n \"-k\",\n keychainPassword,\n keychainPath,\n ),\n \"set-key-partition-list\",\n );\n\n // Prepend our keychain to the search list while preserving the user's\n // Existing ones.\n yield* runOrFail(\n Command.make(\n \"security\",\n \"list-keychains\",\n \"-d\",\n \"user\",\n \"-s\",\n keychainPath,\n ...priorKeychains,\n ),\n \"list-keychains -s (add)\",\n );\n\n const identitiesOutput = yield* runOrFail(\n Command.make(\"security\", \"find-identity\", \"-v\", \"-p\", \"codesigning\", keychainPath),\n \"find-identity\",\n );\n const signingIdentity = parseSigningIdentity(identitiesOutput);\n if (!signingIdentity) {\n return yield* new KeychainError({\n message: \"No code signing identity found after importing .p12 into ephemeral keychain.\",\n });\n }\n\n return {\n handle: { keychainName, keychainPath, signingIdentity },\n priorKeychains,\n };\n }),\n\n // ── release ─────────────────────────────────────────────────\n ({ priorKeychains }) =>\n Effect.gen(function* () {\n // Restore the original search list first, then delete our keychain.\n yield* Command.string(\n Command.make(\"security\", \"list-keychains\", \"-d\", \"user\", \"-s\", ...priorKeychains),\n ).pipe(Effect.catchAll(() => Effect.void));\n\n yield* Command.string(Command.make(\"security\", \"delete-keychain\", keychainPath)).pipe(\n Effect.catchAll(() => Effect.void),\n );\n }),\n ).pipe(Effect.map(({ handle }) => handle));\n};\n","import plist from \"@expo/plist\";\n\nimport type { PlistObject } from \"@expo/plist\";\n// eslint-disable-next-line import-plugin/no-namespace -- bplist-parser typings have no named export; used only as `typeof BplistParser` for the CJS require result\nimport type * as BplistParser from \"bplist-parser\";\n\nexport type { PlistObject, PlistValue } from \"@expo/plist\";\n\n/**\n * Parse an XML plist string into a typed object.\n * Throws on malformed XML — callers should wrap in Effect.try.\n */\nexport const parsePlistXml = (xml: string): PlistObject =>\n // eslint-disable-next-line typescript/no-unsafe-type-assertion -- @expo/plist.parse returns `any`; PlistObject is the library's declared shape for XML plists\n plist.parse(xml) as PlistObject;\n\n/**\n * Parse a binary plist buffer into a typed object.\n * Uses bplist-parser for Apple's binary plist format.\n */\nexport const parsePlistBinary = (buffer: Buffer): PlistObject => {\n const bplistParser =\n // eslint-disable-next-line typescript/no-unsafe-type-assertion -- CJS require returns `any`; narrow to the package's own typings at the boundary\n require(\"bplist-parser\") as typeof BplistParser;\n // eslint-disable-next-line typescript/no-unsafe-assignment -- bplist-parser typings declare parseBuffer<T>(): T[] with T=any in the shipped .d.ts\n const [result] = bplistParser.parseBuffer(buffer);\n // eslint-disable-next-line typescript/no-unsafe-type-assertion -- bplist-parser typings return `any[]`; PlistObject is the superset shape we consume\n return result as PlistObject;\n};\n\nconst BPLIST_MAGIC = Buffer.from(\"bplist00\");\n\n/**\n * Auto-detect plist format (binary vs XML) and parse accordingly.\n */\nexport const parsePlist = (data: Buffer): PlistObject =>\n data.subarray(0, 8).equals(BPLIST_MAGIC)\n ? parsePlistBinary(data)\n : parsePlistXml(data.toString(\"utf8\"));\n","import os from \"node:os\";\nimport path from \"node:path\";\n\nimport { Command, FileSystem } from \"@effect/platform\";\nimport { Effect } from \"effect\";\n\nimport type { CommandExecutor } from \"@effect/platform\";\nimport type { Scope } from \"effect\";\n\nimport { ProvisioningError } from \"./exit-codes\";\nimport { parsePlistXml } from \"./plist\";\n\nimport type { PlistObject } from \"./plist\";\n\n// ── pure extraction ───────────────────────────────────────────────\n\nexport interface ProvisioningInfo {\n readonly uuid: string;\n readonly name: string;\n readonly teamId: string;\n}\n\nconst getString = (obj: PlistObject, key: string): string | undefined => {\n const value = obj[key];\n return typeof value === \"string\" ? value : undefined;\n};\n\nconst getFirstArrayString = (obj: PlistObject, key: string): string | undefined => {\n const value = obj[key];\n if (Array.isArray(value) && typeof value[0] === \"string\") {\n return value[0];\n }\n return undefined;\n};\n\n/**\n * Extract `UUID`, `Name`, and the first `TeamIdentifier` from the XML plist\n * output of `security cms -D -i <path>`. Returns `ProvisioningError` when any\n * of the three fields are missing.\n */\nexport const extractProvisioningInfo = (\n plistXml: string,\n): Effect.Effect<ProvisioningInfo, ProvisioningError> =>\n Effect.gen(function* () {\n const parsed: PlistObject = yield* Effect.try({\n try: () => parsePlistXml(plistXml),\n catch: (error) =>\n new ProvisioningError({\n message: `Failed to parse provisioning profile plist: ${error instanceof Error ? error.message : String(error)}`,\n }),\n });\n\n const uuid = getString(parsed, \"UUID\");\n const name = getString(parsed, \"Name\");\n const teamId = getFirstArrayString(parsed, \"TeamIdentifier\");\n\n if (!uuid || !name || !teamId) {\n return yield* new ProvisioningError({\n message:\n `Failed to parse provisioning profile: missing ${uuid ? \"\" : \"UUID \"}${name ? \"\" : \"Name \"}${teamId ? \"\" : \"TeamIdentifier \"}`.trim(),\n });\n }\n\n return { uuid, name, teamId };\n });\n\n// ── scoped installation ───────────────────────────────────────────\n\nexport interface InstallProvisioningProfileOptions {\n readonly profilePath: string;\n}\n\nexport interface InstalledProvisioning {\n readonly uuid: string;\n readonly name: string;\n readonly teamId: string;\n readonly installedPath: string;\n}\n\ninterface AcquiredProvisioning extends InstalledProvisioning {\n /**\n * True if we installed the profile (so release should delete it).\n * False if the profile was already present (e.g., installed by Xcode) —\n * in that case we leave it alone on release to avoid breaking the user's\n * other signing operations.\n */\n readonly ownsInstallation: boolean;\n}\n\nconst userProvisioningProfilesDir = (): string =>\n path.join(os.homedir(), \"Library\", \"MobileDevice\", \"Provisioning Profiles\");\n\n/**\n * Scoped installation of a provisioning profile: parses its metadata via\n * `security cms -D -i`, copies it into `~/Library/MobileDevice/Provisioning Profiles`\n * under `<uuid>.mobileprovision`, and removes the copy on scope close — but\n * only if we installed it. If the target file already existed when we arrived\n * (e.g., Xcode had it), we leave both the file and the contents untouched.\n */\nexport const installProvisioningProfile = ({\n profilePath,\n}: InstallProvisioningProfileOptions): Effect.Effect<\n InstalledProvisioning,\n ProvisioningError,\n CommandExecutor.CommandExecutor | FileSystem.FileSystem | Scope.Scope\n> =>\n Effect.acquireRelease(\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n\n const plistXml = yield* Command.string(\n Command.make(\"security\", \"cms\", \"-D\", \"-i\", profilePath),\n ).pipe(\n Effect.mapError(\n (cause) =>\n new ProvisioningError({\n message: `security cms -D failed for ${profilePath}: ${String(cause)}`,\n }),\n ),\n );\n\n const info = yield* extractProvisioningInfo(plistXml);\n const targetDir = userProvisioningProfilesDir();\n const installedPath = path.join(targetDir, `${info.uuid}.mobileprovision`);\n\n yield* fs.makeDirectory(targetDir, { recursive: true }).pipe(\n Effect.catchAll(\n (cause) =>\n new ProvisioningError({\n message: `Failed to create provisioning profiles dir: ${String(cause)}`,\n }),\n ),\n );\n\n const alreadyInstalled = yield* fs\n .exists(installedPath)\n .pipe(Effect.orElseSucceed(() => false));\n\n if (alreadyInstalled) {\n return {\n ...info,\n installedPath,\n ownsInstallation: false,\n } satisfies AcquiredProvisioning;\n }\n\n yield* fs.copyFile(profilePath, installedPath).pipe(\n Effect.catchAll(\n (cause) =>\n new ProvisioningError({\n message: `Failed to copy provisioning profile into ${installedPath}: ${String(cause)}`,\n }),\n ),\n );\n\n return {\n ...info,\n installedPath,\n ownsInstallation: true,\n } satisfies AcquiredProvisioning;\n }),\n (acquired) =>\n Effect.gen(function* () {\n if (!acquired.ownsInstallation) {\n return;\n }\n const fs = yield* FileSystem.FileSystem;\n yield* fs.remove(acquired.installedPath).pipe(Effect.catchAll(() => Effect.void));\n }),\n ).pipe(\n Effect.map<AcquiredProvisioning, InstalledProvisioning>(\n ({ uuid, name, teamId, installedPath }) => ({\n uuid,\n name,\n teamId,\n installedPath,\n }),\n ),\n );\n","import path from \"node:path\";\n\nimport { Command, FileSystem } from \"@effect/platform\";\nimport { Console, Effect } from \"effect\";\n\nimport type { CommandExecutor } from \"@effect/platform\";\n\nimport { parsePlist, parsePlistXml } from \"./plist\";\n\nexport interface IosValidationParams {\n readonly archivePath: string;\n readonly expectedBundleId: string;\n readonly expectedTeamId: string;\n readonly expectedProfileUuid: string;\n}\n\nexport interface ValidationResult {\n readonly passed: boolean;\n readonly warnings: readonly string[];\n}\n\n/**\n * Validate an iOS build after xcodebuild completes. Checks:\n * 1. Bundle ID matches expected value\n * 2. Provisioning profile UUID matches\n * 3. Team ID matches\n *\n * All checks are non-blocking — returns warnings, never fails the build.\n */\nexport const validateIosBuild = (\n params: IosValidationParams,\n): Effect.Effect<\n ValidationResult,\n never,\n CommandExecutor.CommandExecutor | FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const appDir = yield* findAppDirectory(params.archivePath).pipe(\n Effect.catchAll(() => Effect.succeed(undefined)),\n );\n\n if (!appDir) {\n const warnings = [\"Could not locate .app bundle in archive — skipping post-build validation\"];\n return { passed: false, warnings };\n }\n\n const bundleWarning = yield* checkBundleId(appDir, params.expectedBundleId).pipe(\n Effect.catchAll(() => Effect.succeed(undefined)),\n );\n\n const profileWarnings = yield* checkEmbeddedProfile(\n appDir,\n params.expectedProfileUuid,\n params.expectedTeamId,\n ).pipe(Effect.catchAll(() => Effect.succeed([] as readonly string[])));\n\n const warnings: readonly string[] = [\n ...(bundleWarning ? [bundleWarning] : []),\n ...profileWarnings,\n ];\n\n if (warnings.length > 0) {\n yield* Console.warn(\"Post-build validation warnings:\");\n for (const warning of warnings) {\n yield* Console.warn(` - ${warning}`);\n }\n }\n\n return { passed: warnings.length === 0, warnings };\n });\n\n// ── helpers ──────────────────────────────────────────────────────\n\nconst findAppDirectory = (\n archivePath: string,\n): Effect.Effect<string, unknown, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const productsDir = path.join(archivePath, \"Products\", \"Applications\");\n const entries = yield* fs.readDirectory(productsDir);\n const appEntry = entries.find((entry) => entry.endsWith(\".app\"));\n if (!appEntry) {\n return yield* Effect.fail(\"No .app found\");\n }\n return path.join(productsDir, appEntry);\n });\n\nconst checkBundleId = (\n appDir: string,\n expectedBundleId: string,\n): Effect.Effect<string | undefined, unknown, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const plistPath = path.join(appDir, \"Info.plist\");\n const data = yield* fs.readFile(plistPath);\n const parsed = parsePlist(Buffer.from(data));\n const actualBundleId = parsed[\"CFBundleIdentifier\"];\n\n if (typeof actualBundleId === \"string\" && actualBundleId !== expectedBundleId) {\n return `Bundle ID mismatch: expected \"${expectedBundleId}\", got \"${actualBundleId}\"`;\n }\n return undefined;\n });\n\nconst checkEmbeddedProfile = (\n appDir: string,\n expectedUuid: string,\n expectedTeamId: string,\n): Effect.Effect<\n readonly string[],\n unknown,\n CommandExecutor.CommandExecutor | FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const warnings: string[] = [];\n const profilePath = path.join(appDir, \"embedded.mobileprovision\");\n\n // Use security cms to decrypt the profile (it's CMS-signed)\n const plistXml = yield* Command.string(\n Command.make(\"security\", \"cms\", \"-D\", \"-i\", profilePath),\n );\n\n const parsed = parsePlistXml(plistXml);\n\n const actualUuid = parsed[\"UUID\"];\n if (typeof actualUuid === \"string\" && actualUuid !== expectedUuid) {\n warnings.push(`Profile UUID mismatch: expected \"${expectedUuid}\", got \"${actualUuid}\"`);\n }\n\n const teamIdentifiers = parsed[\"TeamIdentifier\"];\n if (Array.isArray(teamIdentifiers)) {\n // eslint-disable-next-line typescript/no-unsafe-assignment -- @expo/plist types array entries as any; narrowed via typeof check below\n const [actualTeamId] = teamIdentifiers;\n if (typeof actualTeamId === \"string\" && actualTeamId !== expectedTeamId) {\n warnings.push(`Team ID mismatch: expected \"${expectedTeamId}\", got \"${actualTeamId}\"`);\n }\n }\n\n // Check expiration\n const expirationDate = parsed[\"ExpirationDate\"];\n if (expirationDate instanceof Date && expirationDate.getTime() < Date.now()) {\n warnings.push(`Embedded provisioning profile expired on ${expirationDate.toISOString()}`);\n }\n\n return warnings;\n });\n","import { ExpoRunFormatter } from \"@expo/xcpretty\";\n\nexport interface XcodebuildFormatter {\n /** Feed a line of raw xcodebuild output. Returns formatted lines (0 or more). */\n readonly pipe: (line: string) => readonly string[];\n /** Get a build summary after the process completes. */\n readonly getBuildSummary: () => string;\n}\n\n/**\n * Create a stateful xcodebuild output formatter backed by `@expo/xcpretty`.\n * Each `pipe(line)` call may return zero or more formatted lines — zero means\n * the line was suppressed (e.g., intermediate compiler invocations).\n */\nexport const createXcodebuildFormatter = (projectRoot: string): XcodebuildFormatter => {\n const formatter = ExpoRunFormatter.create(projectRoot);\n return {\n pipe: (line: string) => formatter.pipe(line),\n getBuildSummary: () => formatter.getBuildSummary(),\n };\n};\n","import path from \"node:path\";\n\nimport { Command, FileSystem } from \"@effect/platform\";\nimport { Effect } from \"effect\";\n\nimport type { CommandExecutor } from \"@effect/platform\";\nimport type { PlatformError } from \"@effect/platform/Error\";\nimport type { Scope } from \"effect\";\n\nimport { findIosArtifact } from \"../../lib/artifact-finder\";\nimport { downloadIosCredentials } from \"../../lib/credentials-downloader\";\nimport { BuildFailedError } from \"../../lib/exit-codes\";\nimport { renderExportOptionsPlist } from \"../../lib/ios-export-options\";\nimport { acquireKeychain } from \"../../lib/ios-keychain\";\nimport { installProvisioningProfile } from \"../../lib/ios-provisioning\";\nimport { validateIosBuild } from \"../../lib/post-build-validation\";\nimport { sha256File } from \"../../lib/sha256\";\nimport { createXcodebuildFormatter } from \"../../lib/xcpretty-formatter\";\nimport { CliRuntime } from \"../../services/cli-runtime\";\nimport { runStep, runStepFormatted } from \"./run-step\";\n\nimport type { IosProfile } from \"../../lib/build-profile\";\nimport type {\n ArtifactNotFoundError,\n KeychainError,\n MissingCredentialsError,\n ProvisioningError,\n} from \"../../lib/exit-codes\";\nimport type { ApiClient } from \"../../services/api-client\";\n\nexport interface RunIosBuildInput {\n readonly api: ApiClient;\n readonly tempDir: string;\n readonly projectRoot: string;\n readonly iosProfile: IosProfile;\n readonly bundleId: string;\n readonly envVars: Record<string, string>;\n readonly projectId: string;\n readonly rawOutput?: boolean | undefined;\n}\n\nexport interface RunIosBuildResult {\n readonly artifactPath: string;\n readonly byteSize: number;\n readonly sha256: string;\n}\n\nconst findXcworkspace = (\n iosDir: string,\n): Effect.Effect<string, BuildFailedError | PlatformError, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const entries = yield* fs.readDirectory(iosDir);\n const workspace = entries.find((entry) => entry.endsWith(\".xcworkspace\"));\n if (!workspace) {\n return yield* new BuildFailedError({\n step: \"detect xcworkspace\",\n exitCode: 1,\n message: `No .xcworkspace found under ${iosDir}. Did \"pod install\" run?`,\n });\n }\n return workspace;\n });\n\nexport const runIosBuild = (\n input: RunIosBuildInput,\n): Effect.Effect<\n RunIosBuildResult,\n | BuildFailedError\n | MissingCredentialsError\n | KeychainError\n | ProvisioningError\n | ArtifactNotFoundError\n | PlatformError,\n CliRuntime | CommandExecutor.CommandExecutor | FileSystem.FileSystem | Scope.Scope\n> =>\n // eslint-disable-next-line eslint/max-statements -- ios build orchestration is inherently sequential (prebuild → pod → credentials → archive → exportArchive → find artifact → sha256); splitting further fragments the pipeline without clarifying it\n Effect.gen(function* () {\n const { api, tempDir, projectRoot, iosProfile, bundleId, envVars, projectId } = input;\n const runtime = yield* CliRuntime;\n\n const iosDir = path.join(projectRoot, \"ios\");\n const { distribution } = iosProfile;\n const commandEnv = yield* runtime.commandEnvironment(envVars);\n\n // 1. Download credentials (p12 + mobileprovision) into tempDir.\n const credentials = yield* downloadIosCredentials(api, {\n projectId,\n bundleIdentifier: bundleId,\n distribution,\n tempDir,\n });\n\n // 2. Expo prebuild (ios).\n yield* runStep(\n Command.make(\"bunx\", \"expo\", \"prebuild\", \"--platform\", \"ios\", \"--clean\").pipe(\n Command.workingDirectory(projectRoot),\n Command.env(commandEnv),\n ),\n \"expo prebuild ios\",\n );\n\n // 3. pod install.\n yield* runStep(\n Command.make(\"pod\", \"install\").pipe(\n Command.workingDirectory(iosDir),\n Command.env(commandEnv),\n ),\n \"pod install\",\n );\n\n // 4. Scoped ephemeral keychain (auto-cleaned on scope close).\n const keychain = yield* acquireKeychain({\n tempDir,\n p12Path: credentials.p12Path,\n p12Password: credentials.p12Password,\n });\n\n // 5. Scoped provisioning profile install.\n const provisioning = yield* installProvisioningProfile({\n profilePath: credentials.profilePath,\n });\n\n // 6. Detect workspace + scheme.\n const workspaceFilename = yield* findXcworkspace(iosDir);\n const scheme = iosProfile.scheme ?? workspaceFilename.replace(/\\.xcworkspace$/u, \"\");\n const configuration = iosProfile.buildConfiguration ?? \"Release\";\n\n // 7. xcodebuild archive.\n const archivePath = path.join(tempDir, \"build.xcarchive\");\n const archiveCmd = Command.make(\n \"xcodebuild\",\n \"-workspace\",\n workspaceFilename,\n \"-scheme\",\n scheme,\n \"-configuration\",\n configuration,\n \"-archivePath\",\n archivePath,\n \"-allowProvisioningUpdates\",\n \"archive\",\n \"CODE_SIGN_STYLE=Manual\",\n `DEVELOPMENT_TEAM=${provisioning.teamId}`,\n `CODE_SIGN_IDENTITY=${keychain.signingIdentity}`,\n `PROVISIONING_PROFILE_SPECIFIER=${provisioning.name}`,\n ).pipe(Command.workingDirectory(iosDir), Command.env(commandEnv));\n\n const formatter = input.rawOutput ? undefined : createXcodebuildFormatter(projectRoot);\n yield* formatter\n ? runStepFormatted(archiveCmd, \"xcodebuild archive\", formatter)\n : runStep(archiveCmd, \"xcodebuild archive\");\n\n const fs = yield* FileSystem.FileSystem;\n const exportOptionsPath = path.join(tempDir, \"ExportOptions.plist\");\n yield* fs.writeFileString(\n exportOptionsPath,\n renderExportOptionsPlist({\n method: distribution,\n teamId: provisioning.teamId,\n bundleId,\n provisioningProfileName: provisioning.name,\n }),\n );\n\n // 9. xcodebuild exportArchive.\n const exportPath = path.join(tempDir, \"export\");\n const exportCmd = Command.make(\n \"xcodebuild\",\n \"-exportArchive\",\n \"-archivePath\",\n archivePath,\n \"-exportPath\",\n exportPath,\n \"-exportOptionsPlist\",\n exportOptionsPath,\n \"-allowProvisioningUpdates\",\n ).pipe(Command.workingDirectory(iosDir), Command.env(commandEnv));\n\n yield* formatter\n ? runStepFormatted(exportCmd, \"xcodebuild exportArchive\", formatter)\n : runStep(exportCmd, \"xcodebuild exportArchive\");\n\n // 10. Post-build validation (non-blocking).\n yield* validateIosBuild({\n archivePath,\n expectedBundleId: bundleId,\n expectedTeamId: provisioning.teamId,\n expectedProfileUuid: provisioning.uuid,\n });\n\n // 11. Locate artifact.\n const artifactPath = yield* findIosArtifact({ exportPath });\n\n // 12. SHA-256 + byte size.\n const { sha256, byteSize } = yield* sha256File(artifactPath);\n\n return { artifactPath, byteSize, sha256 };\n });\n","import { Effect } from \"effect\";\n\nimport { CompleteError, ReserveError } from \"../../lib/exit-codes\";\nimport { formatCause } from \"../../lib/format-error\";\nimport { PresignedUploadClient } from \"../../services/presigned-upload\";\n\nimport type { PresignedUrlExpiredError, UploadFailedError } from \"../../lib/exit-codes\";\nimport type { ApiClient } from \"../../services/api-client\";\n\nexport type BuildTarget =\n | {\n readonly platform: \"ios\";\n readonly distribution: \"app-store\" | \"ad-hoc\" | \"development\" | \"enterprise\";\n readonly artifactFormat: \"ipa\";\n }\n | {\n readonly platform: \"ios\";\n readonly distribution: \"simulator\";\n readonly artifactFormat: \"tar.gz\";\n }\n | {\n readonly platform: \"android\";\n readonly distribution: \"play-store\";\n readonly artifactFormat: \"aab\";\n }\n | {\n readonly platform: \"android\";\n readonly distribution: \"direct\";\n readonly artifactFormat: \"apk\";\n };\n\nexport interface ReserveAndUploadInput {\n readonly target: BuildTarget;\n readonly projectId: string;\n readonly profileName: string;\n readonly runtimeVersion: string;\n readonly appVersion?: string;\n readonly buildNumber?: string;\n readonly bundleId: string;\n readonly gitContext: {\n readonly ref?: string;\n readonly commit?: string;\n readonly dirty: boolean;\n };\n readonly message?: string;\n readonly artifactPath: string;\n readonly sha256: string;\n readonly byteSize: number;\n}\n\nconst buildReserveCommon = (input: ReserveAndUploadInput) =>\n ({\n projectId: input.projectId,\n profile: input.profileName,\n runtimeVersion: input.runtimeVersion,\n bundleId: input.bundleId,\n sha256: input.sha256,\n byteSize: input.byteSize,\n ...(input.appVersion === undefined ? {} : { appVersion: input.appVersion }),\n ...(input.buildNumber === undefined ? {} : { buildNumber: input.buildNumber }),\n ...(input.gitContext.ref === undefined ? {} : { gitRef: input.gitContext.ref }),\n ...(input.gitContext.commit === undefined ? {} : { gitCommit: input.gitContext.commit }),\n ...(input.message === undefined ? {} : { message: input.message }),\n }) as const;\n\nconst callReserve = (api: ApiClient, input: ReserveAndUploadInput) => {\n const common = buildReserveCommon(input);\n const { target } = input;\n if (target.platform === \"ios\") {\n return target.distribution === \"simulator\"\n ? api.builds.reserve({\n payload: {\n ...common,\n platform: \"ios\",\n distribution: \"simulator\",\n artifactFormat: \"tar.gz\",\n },\n })\n : api.builds.reserve({\n payload: {\n ...common,\n platform: \"ios\",\n distribution: target.distribution,\n artifactFormat: \"ipa\",\n },\n });\n }\n return target.distribution === \"play-store\"\n ? api.builds.reserve({\n payload: {\n ...common,\n platform: \"android\",\n distribution: \"play-store\",\n artifactFormat: \"aab\",\n },\n })\n : api.builds.reserve({\n payload: { ...common, platform: \"android\", distribution: \"direct\", artifactFormat: \"apk\" },\n });\n};\n\nexport interface ReserveAndUploadResult {\n readonly id: string;\n readonly status: string;\n}\n\n/**\n * Reserve a build record on the server, upload the artifact to the returned\n * presigned URL, and finalize the build with its sha256 + byteSize.\n */\nexport const reserveAndUpload = (\n api: ApiClient,\n input: ReserveAndUploadInput,\n): Effect.Effect<\n ReserveAndUploadResult,\n ReserveError | UploadFailedError | PresignedUrlExpiredError | CompleteError,\n PresignedUploadClient\n> =>\n Effect.gen(function* () {\n const presignedUploadClient = yield* PresignedUploadClient;\n\n const reserveResult = yield* callReserve(api, input).pipe(\n Effect.mapError(\n (cause) =>\n new ReserveError({\n message: `Failed to reserve build: ${formatCause(cause)}`,\n }),\n ),\n );\n\n yield* presignedUploadClient.putToPresignedUrl({\n url: reserveResult.uploadUrl,\n filePath: input.artifactPath,\n byteSize: input.byteSize,\n expiresAt: reserveResult.uploadExpiresAt,\n headers: reserveResult.uploadHeaders,\n });\n\n const completed = yield* api.builds\n .complete({\n path: { id: reserveResult.id },\n payload: { sha256: input.sha256, byteSize: input.byteSize },\n })\n .pipe(\n Effect.mapError(\n (cause) =>\n new CompleteError({\n message: `Failed to complete build ${reserveResult.id}: ${formatCause(cause)}`,\n }),\n ),\n );\n\n if (!completed.artifact) {\n return yield* new CompleteError({\n message: `Build ${completed.id} completed but server returned no artifact record.`,\n });\n }\n\n return { id: completed.id, status: \"uploaded\" };\n });\n","import { asRecord } from \"@better-update/type-guards\";\nimport { Effect } from \"effect\";\n\nimport { BuildProfileError } from \"./exit-codes\";\n\nexport type Platform = \"ios\" | \"android\";\n\nexport type IosDistribution = \"app-store\" | \"ad-hoc\" | \"development\" | \"enterprise\";\n\nexport interface IosProfile {\n readonly buildConfiguration?: string;\n readonly distribution: IosDistribution;\n readonly scheme?: string;\n}\n\nexport type AndroidDistribution = \"play-store\" | \"direct\";\n\nexport interface AndroidProfile {\n readonly buildType?: \"debug\" | \"release\";\n readonly format: \"apk\" | \"aab\";\n readonly flavor?: string;\n readonly distribution: AndroidDistribution;\n}\n\nexport interface BuildProfile {\n readonly name: string;\n readonly environment: string;\n readonly ios?: IosProfile;\n readonly android?: AndroidProfile;\n}\n\nexport type RawRuntimeVersion = string | { readonly policy: string };\n\nexport interface AppMeta {\n readonly bundleId: string | undefined;\n readonly androidPackage: string | undefined;\n readonly appVersion: string | undefined;\n readonly buildNumber: string | undefined;\n readonly rawRuntimeVersion: RawRuntimeVersion | undefined;\n}\n\nexport interface RuntimeVersionMeta {\n readonly appVersion: string | undefined;\n readonly rawRuntimeVersion: RawRuntimeVersion | undefined;\n}\n\nexport const asString = (value: unknown): string | undefined =>\n typeof value === \"string\" ? value : undefined;\n\nconst getBetterUpdateExtra = (\n appJson: Record<string, unknown>,\n): Record<string, unknown> | undefined => {\n const expo = asRecord(appJson[\"expo\"]);\n const extra = asRecord(expo?.[\"extra\"]);\n return asRecord(extra?.[\"betterUpdate\"]);\n};\n\nconst VALID_IOS_DISTRIBUTIONS: readonly IosDistribution[] = [\n \"app-store\",\n \"ad-hoc\",\n \"development\",\n \"enterprise\",\n];\n\nconst isIosDistribution = (value: string): value is IosDistribution =>\n (VALID_IOS_DISTRIBUTIONS as readonly string[]).includes(value);\n\nconst readIosProfile = (raw: unknown): IosProfile | undefined => {\n const iosRaw = asRecord(raw);\n if (!iosRaw) {\n return undefined;\n }\n const distributionRaw = asString(iosRaw[\"distribution\"]);\n if (!distributionRaw) {\n return undefined;\n }\n if (!isIosDistribution(distributionRaw)) {\n return undefined;\n }\n const distribution: IosDistribution = distributionRaw;\n const buildConfiguration = asString(iosRaw[\"buildConfiguration\"]);\n const scheme = asString(iosRaw[\"scheme\"]);\n return {\n distribution,\n ...(buildConfiguration === undefined ? {} : { buildConfiguration }),\n ...(scheme === undefined ? {} : { scheme }),\n };\n};\n\nconst resolveAndroidDistribution = (\n raw: string | undefined,\n format: \"apk\" | \"aab\",\n): AndroidDistribution => {\n if (raw === \"play-store\" || raw === \"direct\") {\n return raw;\n }\n return format === \"aab\" ? \"play-store\" : \"direct\";\n};\n\nconst readAndroidProfile = (raw: unknown): AndroidProfile | undefined => {\n const androidRaw = asRecord(raw);\n if (!androidRaw) {\n return undefined;\n }\n const formatValue = asString(androidRaw[\"format\"]);\n const format = formatValue === \"apk\" || formatValue === \"aab\" ? formatValue : undefined;\n if (!format) {\n return undefined;\n }\n const buildTypeValue = asString(androidRaw[\"buildType\"]);\n const buildType =\n buildTypeValue === \"debug\" || buildTypeValue === \"release\" ? buildTypeValue : undefined;\n const flavor = asString(androidRaw[\"flavor\"]);\n const distribution = resolveAndroidDistribution(asString(androidRaw[\"distribution\"]), format);\n return {\n format,\n distribution,\n ...(buildType === undefined ? {} : { buildType }),\n ...(flavor === undefined ? {} : { flavor }),\n };\n};\n\nexport const readBuildProfile = (\n appJson: Record<string, unknown>,\n profileName: string,\n): Effect.Effect<BuildProfile, BuildProfileError> =>\n Effect.gen(function* () {\n const betterUpdate = getBetterUpdateExtra(appJson);\n const profiles = asRecord(betterUpdate?.[\"profiles\"]);\n if (!profiles) {\n return yield* new BuildProfileError({\n message: \"No build profiles defined. Add expo.extra.betterUpdate.profiles to app.json.\",\n });\n }\n const profileRaw = asRecord(profiles[profileName]);\n if (!profileRaw) {\n return yield* new BuildProfileError({\n message: `Build profile \"${profileName}\" not found in app.json.`,\n });\n }\n const environment = asString(profileRaw[\"environment\"]) ?? \"production\";\n const ios = readIosProfile(profileRaw[\"ios\"]);\n const android = readAndroidProfile(profileRaw[\"android\"]);\n return {\n name: profileName,\n environment,\n ...(ios === undefined ? {} : { ios }),\n ...(android === undefined ? {} : { android }),\n };\n });\n\nexport const readRuntimeVersionMeta = (\n appJson: Record<string, unknown>,\n): Effect.Effect<RuntimeVersionMeta, BuildProfileError> =>\n Effect.gen(function* () {\n const expo = asRecord(appJson[\"expo\"]);\n if (!expo) {\n return yield* new BuildProfileError({\n message: \"Missing expo section in app.json.\",\n });\n }\n\n return {\n appVersion: asString(expo[\"version\"]),\n rawRuntimeVersion: readRawRuntimeVersion(expo[\"runtimeVersion\"]),\n };\n });\n\nexport const readAppMeta = (\n appJson: Record<string, unknown>,\n platform: Platform,\n): Effect.Effect<AppMeta, BuildProfileError> =>\n Effect.gen(function* () {\n const expo = asRecord(appJson[\"expo\"]);\n if (!expo) {\n return yield* new BuildProfileError({\n message: \"Missing expo section in app.json.\",\n });\n }\n\n if (platform === \"ios\") {\n const ios = asRecord(expo[\"ios\"]);\n if (!ios) {\n return yield* new BuildProfileError({\n message:\n \"Missing expo.ios section in app.json. Required for iOS builds (bundleIdentifier).\",\n });\n }\n } else {\n const android = asRecord(expo[\"android\"]);\n if (!android) {\n return yield* new BuildProfileError({\n message:\n \"Missing expo.android section in app.json. Required for Android builds (package).\",\n });\n }\n }\n\n const iosSection = asRecord(expo[\"ios\"]);\n const androidSection = asRecord(expo[\"android\"]);\n const buildNumber =\n platform === \"ios\"\n ? asString(iosSection?.[\"buildNumber\"])\n : asStringOrNumber(androidSection?.[\"versionCode\"]);\n return {\n bundleId: asString(iosSection?.[\"bundleIdentifier\"]),\n androidPackage: asString(androidSection?.[\"package\"]),\n appVersion: asString(expo[\"version\"]),\n buildNumber,\n rawRuntimeVersion: readRawRuntimeVersion(expo[\"runtimeVersion\"]),\n };\n });\n\nconst asStringOrNumber = (value: unknown): string | undefined => {\n if (typeof value === \"string\") {\n return value;\n }\n if (typeof value === \"number\" && Number.isFinite(value)) {\n return String(value);\n }\n return undefined;\n};\n\nconst readRawRuntimeVersion = (value: unknown): RawRuntimeVersion | undefined => {\n if (typeof value === \"string\") {\n return value;\n }\n const record = asRecord(value);\n const policy = asString(record?.[\"policy\"]);\n if (policy) {\n return { policy };\n }\n return undefined;\n};\n","import { Effect } from \"effect\";\n\nimport { EnvExportError } from \"./exit-codes\";\n\nimport type { ApiClient } from \"../services/api-client\";\n\nexport interface PullEnvVarsOptions {\n readonly projectId: string;\n readonly environment: string;\n}\n\n/**\n * Pull environment variables for a project + environment and flatten them into\n * a key/value map. Returns an empty map when the project has no variables.\n */\nexport const pullEnvVars = (\n api: ApiClient,\n { projectId, environment }: PullEnvVarsOptions,\n): Effect.Effect<Record<string, string>, EnvExportError> =>\n api[\"env-vars\"].export({ urlParams: { projectId, environment } }).pipe(\n Effect.map((result) => Object.fromEntries(result.items.map((item) => [item.key, item.value]))),\n Effect.mapError(\n (cause) =>\n new EnvExportError({\n message: `Failed to export environment variables for \"${environment}\": ${String(cause)}`,\n }),\n ),\n );\n","import process from \"node:process\";\n\nimport { Effect } from \"effect\";\n\nimport { BuildProfileError } from \"./exit-codes\";\n\nimport type { AppMeta, Platform, RawRuntimeVersion } from \"./build-profile\";\n\ninterface ExpoConfig {\n readonly name?: string;\n readonly slug?: string;\n readonly version?: string;\n readonly runtimeVersion?: string | { readonly policy: string };\n readonly ios?: {\n readonly bundleIdentifier?: string;\n readonly buildNumber?: string;\n };\n readonly android?: {\n readonly package?: string;\n readonly versionCode?: number;\n };\n readonly [key: string]: unknown;\n}\n\n/**\n * Resolve the full Expo config using `@expo/config`, which handles\n * `app.json`, `app.config.js`, and `app.config.ts` with plugin evaluation.\n *\n * `envVars` are applied as a scoped overlay on `process.env` for the duration\n * of the call (restored afterwards) so dynamic configs (`app.config.js`)\n * can read them without leaking server-side secrets to child processes.\n *\n * Falls back to undefined if `@expo/config` is not available or fails.\n */\nexport const readExpoConfig = (\n projectRoot: string,\n envVars: Record<string, string> = {},\n): Effect.Effect<ExpoConfig | undefined> =>\n Effect.acquireUseRelease(\n Effect.sync(() => {\n const previous: Record<string, string | undefined> = {};\n for (const [key, value] of Object.entries(envVars)) {\n previous[key] = process.env[key];\n process.env[key] = value;\n }\n return previous;\n }),\n () =>\n Effect.try({\n try: () => {\n const expoConfigCjs =\n // eslint-disable-next-line typescript/no-unsafe-type-assertion -- CJS require returns `any`; narrow to @expo/config's shape at this boundary\n require(\"@expo/config\") as {\n getConfig: (\n projectRoot: string,\n options?: { skipSDKVersionRequirement?: boolean },\n ) => { exp: ExpoConfig };\n };\n const { getConfig } = expoConfigCjs;\n\n const { exp } = getConfig(projectRoot, {\n skipSDKVersionRequirement: true,\n });\n\n return exp;\n },\n catch: () => undefined,\n }).pipe(Effect.catchAll(() => Effect.succeed<ExpoConfig | undefined>(undefined))),\n (previous) =>\n Effect.sync(() => {\n for (const [key, value] of Object.entries(previous)) {\n if (value === undefined) {\n // eslint-disable-next-line typescript/no-dynamic-delete -- restoring previous process.env snapshot; keys are arbitrary env var names we captured earlier\n delete process.env[key];\n } else {\n process.env[key] = value;\n }\n }\n }),\n );\n\nconst extractBuildNumber = (config: ExpoConfig, platform: Platform): string | undefined => {\n if (platform === \"ios\") {\n return config.ios?.buildNumber;\n }\n if (config.android?.versionCode === undefined) {\n return undefined;\n }\n return String(config.android.versionCode);\n};\n\nconst extractRawRuntimeVersion = (config: ExpoConfig): RawRuntimeVersion | undefined => {\n if (typeof config.runtimeVersion === \"string\") {\n return config.runtimeVersion;\n }\n if (typeof config.runtimeVersion === \"object\") {\n return config.runtimeVersion;\n }\n return undefined;\n};\n\n/**\n * Extract AppMeta from a resolved ExpoConfig (from `@expo/config`).\n * Mirrors `readAppMeta` from build-profile.ts but uses the resolved config\n * which handles dynamic configs (`app.config.js`, `app.config.ts`).\n */\nexport const readAppMetaFromConfig = (\n config: ExpoConfig,\n platform: Platform,\n): Effect.Effect<AppMeta, BuildProfileError> =>\n Effect.gen(function* () {\n if (platform === \"ios\" && !config.ios) {\n return yield* new BuildProfileError({\n message: \"Missing expo.ios section in config. Required for iOS builds (bundleIdentifier).\",\n });\n }\n if (platform === \"android\" && !config.android) {\n return yield* new BuildProfileError({\n message: \"Missing expo.android section in config. Required for Android builds (package).\",\n });\n }\n\n return {\n bundleId: config.ios?.bundleIdentifier,\n androidPackage: config.android?.package,\n appVersion: config.version,\n buildNumber: extractBuildNumber(config, platform),\n rawRuntimeVersion: extractRawRuntimeVersion(config),\n };\n });\n","import { Command } from \"@effect/platform\";\nimport { Effect } from \"effect\";\n\nimport type { CommandExecutor } from \"@effect/platform\";\n\nexport interface GitContext {\n readonly ref: string | undefined;\n readonly commit: string | undefined;\n readonly commitMessage: string | undefined;\n readonly dirty: boolean;\n}\n\nconst runString = (\n cmd: Command.Command,\n cwd: string,\n): Effect.Effect<string, unknown, CommandExecutor.CommandExecutor> =>\n Command.string(Command.workingDirectory(cmd, cwd));\n\n/**\n * Best-effort git context extraction. If git is missing, the directory isn't\n * a repo, or any command fails, we silently return undefined fields so the\n * build can still proceed. This is intentional — git context is metadata,\n * not a requirement.\n */\nexport const readGitContext = (\n projectRoot: string,\n): Effect.Effect<GitContext, never, CommandExecutor.CommandExecutor> =>\n Effect.gen(function* () {\n const [commit, ref, commitMessage, status] = yield* Effect.all(\n [\n runString(Command.make(\"git\", \"rev-parse\", \"HEAD\"), projectRoot).pipe(\n Effect.map((output) => output.trim()),\n Effect.catchAll(() => Effect.succeed(\"\")),\n ),\n runString(Command.make(\"git\", \"symbolic-ref\", \"--short\", \"HEAD\"), projectRoot).pipe(\n Effect.map((output) => output.trim()),\n Effect.catchAll(() => Effect.succeed(\"\")),\n ),\n runString(Command.make(\"git\", \"log\", \"-1\", \"--format=%s\"), projectRoot).pipe(\n Effect.map((output) => output.trim()),\n Effect.catchAll(() => Effect.succeed(\"\")),\n ),\n runString(Command.make(\"git\", \"status\", \"--porcelain\"), projectRoot).pipe(\n Effect.catchAll(() => Effect.succeed(\"\")),\n ),\n ],\n { concurrency: \"unbounded\" },\n );\n\n return {\n ref: ref.length > 0 ? ref : undefined,\n commit: commit.length > 0 ? commit : undefined,\n commitMessage: commitMessage.length > 0 ? commitMessage : undefined,\n dirty: status.trim().length > 0,\n };\n });\n","import path from \"node:path\";\n\nimport { asRecord } from \"@better-update/type-guards\";\nimport { FileSystem } from \"@effect/platform\";\nimport { Console, Effect } from \"effect\";\n\nexport interface GradleConfig {\n readonly applicationId?: string;\n readonly versionCode?: number;\n readonly versionName?: string;\n}\n\n/**\n * Parse Groovy `build.gradle` to extract key Android config values.\n * Returns `undefined` if:\n * - Only `build.gradle.kts` exists (Kotlin DSL not supported by gradle-to-js)\n * - No build.gradle found at all\n * - Parse fails\n *\n * Informational only — never blocks the build.\n */\nexport const readGradleConfig = (\n androidDir: string,\n): Effect.Effect<GradleConfig | undefined, never, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const gradlePath = path.join(androidDir, \"app\", \"build.gradle\");\n const ktsPath = path.join(androidDir, \"app\", \"build.gradle.kts\");\n\n const hasGroovy = yield* fs.exists(gradlePath).pipe(Effect.orElseSucceed(() => false));\n const hasKts = yield* fs.exists(ktsPath).pipe(Effect.orElseSucceed(() => false));\n\n if (!hasGroovy && hasKts) {\n // Kotlin DSL — gradle-to-js cannot parse it\n return undefined;\n }\n\n if (!hasGroovy) {\n return undefined;\n }\n\n const content = yield* fs\n .readFileString(gradlePath)\n .pipe(Effect.catchAll(() => Effect.succeed(undefined)));\n if (!content) {\n return undefined;\n }\n\n return yield* Effect.tryPromise({\n try: async () => {\n const gradle =\n // eslint-disable-next-line typescript/no-unsafe-type-assertion -- CJS require returns `any`; narrow to gradle-to-js declared shape\n require(\"gradle-to-js\") as {\n parseText: (text: string) => Promise<Record<string, unknown>>;\n };\n return gradle.parseText(stripGroovyComments(content));\n },\n catch: () => undefined,\n }).pipe(\n Effect.map(extractGradleConfig),\n Effect.catchAll(() => Effect.succeed(undefined)),\n );\n });\n\n/**\n * Log a warning if Gradle applicationId differs from app.json package name.\n */\nexport const warnOnGradleMismatch = (\n gradleConfig: GradleConfig | undefined,\n expectedPackage: string,\n): Effect.Effect<void> => {\n if (!gradleConfig?.applicationId) {\n return Effect.void;\n }\n if (gradleConfig.applicationId === expectedPackage) {\n return Effect.void;\n }\n return Console.warn(\n `Gradle applicationId \"${gradleConfig.applicationId}\" differs from app.json package \"${expectedPackage}\". ` +\n `The Gradle value will be used in the built APK/AAB.`,\n );\n};\n\n// ── helpers ──────────────────────────────────────────────────────\n\n/**\n * Strip Groovy single-line and block comments.\n * gradle-to-js chokes on comments — EAS CLI does this same pre-processing.\n */\nconst stripGroovyComments = (text: string): string =>\n text.replaceAll(/\\/\\/.*$/gmu, \"\").replaceAll(/\\/\\*[\\s\\S]*?\\*\\//gu, \"\");\n\nconst parseVersionCode = (raw: unknown): number | undefined => {\n if (typeof raw === \"number\") {\n return raw;\n }\n if (typeof raw === \"string\") {\n return Number.parseInt(raw, 10) || undefined;\n }\n return undefined;\n};\n\nconst extractGradleConfig = (parsed: Record<string, unknown>): GradleConfig => {\n const android = asRecord(parsed[\"android\"]);\n const defaultConfig = asRecord(android?.[\"defaultConfig\"]);\n\n const applicationId =\n typeof defaultConfig?.[\"applicationId\"] === \"string\"\n ? unquote(defaultConfig[\"applicationId\"])\n : undefined;\n const versionCode = parseVersionCode(defaultConfig?.[\"versionCode\"]);\n const versionName =\n typeof defaultConfig?.[\"versionName\"] === \"string\"\n ? unquote(defaultConfig[\"versionName\"])\n : undefined;\n\n return {\n ...(applicationId === undefined ? {} : { applicationId }),\n ...(versionCode === undefined ? {} : { versionCode }),\n ...(versionName === undefined ? {} : { versionName }),\n };\n};\n\nconst unquote = (input: string): string =>\n input.startsWith('\"') && input.endsWith('\"') ? input.slice(1, -1) : input;\n","import { isRecord } from \"@better-update/type-guards\";\nimport { Command } from \"@effect/platform\";\nimport { Data, Effect } from \"effect\";\n\nimport type { CommandExecutor } from \"@effect/platform\";\n\nexport class FingerprintError extends Data.TaggedError(\"FingerprintError\")<{\n readonly message: string;\n}> {}\n\nexport interface FingerprintSource {\n readonly type: string;\n readonly filePath?: string;\n readonly reasons: readonly string[];\n readonly hash: string | null;\n}\n\nexport interface FingerprintResult {\n readonly hash: string;\n readonly sources: readonly FingerprintSource[];\n}\n\nexport const runFingerprintFull = (\n projectRoot: string,\n): Effect.Effect<FingerprintResult, FingerprintError, CommandExecutor.CommandExecutor> =>\n Effect.gen(function* () {\n const cmd = Command.make(\"bunx\", \"@expo/fingerprint\", projectRoot).pipe(\n Command.workingDirectory(projectRoot),\n );\n const stdout = yield* Command.string(cmd).pipe(\n Effect.mapError(\n (cause) =>\n new FingerprintError({\n message: `Failed to run \"@expo/fingerprint\": ${cause.message}`,\n }),\n ),\n );\n\n const parsed = yield* Effect.try({\n try: (): unknown => JSON.parse(stdout),\n catch: () =>\n new FingerprintError({\n message: \"Failed to parse @expo/fingerprint output as JSON.\",\n }),\n });\n\n if (!isRecord(parsed)) {\n return yield* new FingerprintError({\n message: \"@expo/fingerprint output was not a JSON object.\",\n });\n }\n\n const { hash } = parsed;\n if (typeof hash !== \"string\" || hash.length === 0) {\n return yield* new FingerprintError({\n message: '@expo/fingerprint output did not contain a \"hash\" string field.',\n });\n }\n\n const sourcesRaw = parsed[\"sources\"];\n const sources: readonly FingerprintSource[] = Array.isArray(sourcesRaw)\n ? (sourcesRaw as readonly FingerprintSource[])\n : [];\n\n return { hash, sources };\n });\n","import { Effect } from \"effect\";\n\nimport type { CommandExecutor } from \"@effect/platform\";\n\nimport { RuntimeVersionError } from \"./exit-codes\";\nimport { runFingerprintFull } from \"./fingerprint\";\n\nimport type { RawRuntimeVersion } from \"./build-profile\";\n\nexport interface ResolveRuntimeVersionOptions {\n readonly raw: RawRuntimeVersion | undefined;\n readonly appVersion: string | undefined;\n readonly projectRoot: string;\n}\n\nexport const resolveRuntimeVersion = ({\n raw,\n appVersion,\n projectRoot,\n}: ResolveRuntimeVersionOptions): Effect.Effect<\n string,\n RuntimeVersionError,\n CommandExecutor.CommandExecutor\n> =>\n Effect.gen(function* () {\n if (typeof raw === \"string\") {\n return raw;\n }\n if (raw === undefined) {\n return yield* new RuntimeVersionError({\n message: \"No runtimeVersion configured in expo section of app.json.\",\n });\n }\n\n const { policy } = raw;\n if (policy === \"appVersion\") {\n if (appVersion === undefined) {\n return yield* new RuntimeVersionError({\n message: 'runtimeVersion policy is \"appVersion\" but expo.version is missing in app.json.',\n });\n }\n return appVersion;\n }\n\n if (policy === \"fingerprint\") {\n return yield* runFingerprintFull(projectRoot).pipe(\n Effect.map((result) => result.hash),\n Effect.mapError((cause) => new RuntimeVersionError({ message: cause.message })),\n );\n }\n\n if (policy === \"nativeVersion\") {\n return yield* new RuntimeVersionError({\n message:\n 'runtimeVersion policy \"nativeVersion\" is not supported. Set a static runtimeVersion string in app.json.',\n });\n }\n\n return yield* new RuntimeVersionError({\n message: `Unsupported runtimeVersion policy \"${policy}\". Use a static string, \"appVersion\", or \"fingerprint\".`,\n });\n });\n","import { FileSystem } from \"@effect/platform\";\nimport { Effect } from \"effect\";\n\n/**\n * Create a scoped temp directory prefixed with \"better-update-\" and `chmod 0o700`\n * it so only the current user can read its contents. The directory and all files\n * inside it are removed when the enclosing scope closes.\n */\nexport const acquireBuildTempDir = Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const dir = yield* fs.makeTempDirectoryScoped({ prefix: \"better-update-\" });\n yield* fs.chmod(dir, 0o700);\n return dir;\n});\n","import { Console, Effect } from \"effect\";\n\nimport { runAndroidBuild } from \"../commands/build/android\";\nimport { runIosBuild } from \"../commands/build/ios\";\nimport { reserveAndUpload } from \"../commands/build/reserve-and-upload\";\nimport { readAppJson, readProjectId } from \"../lib/app-json\";\nimport { readAppMeta, readBuildProfile } from \"../lib/build-profile\";\nimport { pullEnvVars } from \"../lib/env-exporter\";\nimport { BuildProfileError } from \"../lib/exit-codes\";\nimport { readAppMetaFromConfig, readExpoConfig } from \"../lib/expo-config\";\nimport { readGitContext } from \"../lib/git-context\";\nimport { readGradleConfig, warnOnGradleMismatch } from \"../lib/gradle-config\";\nimport { printKeyValue } from \"../lib/output\";\nimport { resolveRuntimeVersion } from \"../lib/runtime-version\";\nimport { acquireBuildTempDir } from \"../lib/temp-dir\";\nimport { apiClient } from \"../services/api-client\";\nimport { CliRuntime } from \"../services/cli-runtime\";\n\nimport type { BuildTarget } from \"../commands/build/reserve-and-upload\";\nimport type { Platform } from \"../lib/build-profile\";\n\nexport interface RunBuildWorkflowOptions {\n readonly platform: Platform;\n readonly profileName: string;\n readonly message: string | undefined;\n readonly noUpload: boolean;\n readonly rawOutput?: boolean;\n}\n\ntype AppMeta = Effect.Effect.Success<ReturnType<typeof readAppMeta>>;\ntype BuildProfile = Effect.Effect.Success<ReturnType<typeof readBuildProfile>>;\ntype ApiClient = Effect.Effect.Success<typeof apiClient>;\n\ninterface PlatformBuildInput {\n readonly api: ApiClient;\n readonly options: RunBuildWorkflowOptions;\n readonly profile: BuildProfile;\n readonly appMeta: AppMeta;\n readonly envVars: Record<string, string>;\n readonly projectId: string;\n readonly projectRoot: string;\n readonly tempDir: string;\n}\n\nconst runIosPlatformBuild = (input: PlatformBuildInput) =>\n Effect.gen(function* () {\n const { api, appMeta, envVars, options, profile, projectId, projectRoot, tempDir } = input;\n if (!profile.ios) {\n return yield* new BuildProfileError({\n message: `Profile \"${profile.name}\" has no ios section.`,\n });\n }\n const iosProfile = profile.ios;\n const iosBundleId = appMeta.bundleId;\n if (!iosBundleId) {\n return yield* new BuildProfileError({\n message: \"Missing expo.ios.bundleIdentifier in app.json.\",\n });\n }\n const build = yield* runIosBuild({\n api,\n tempDir,\n projectRoot,\n iosProfile,\n bundleId: iosBundleId,\n envVars,\n projectId,\n rawOutput: options.rawOutput,\n });\n const target: BuildTarget = {\n platform: \"ios\",\n distribution: iosProfile.distribution,\n artifactFormat: \"ipa\",\n };\n return { build, target, bundleId: iosBundleId };\n });\n\nconst runAndroidPlatformBuild = (input: PlatformBuildInput) =>\n Effect.gen(function* () {\n const { api, appMeta, envVars, profile, projectId, projectRoot, tempDir } = input;\n if (!profile.android) {\n return yield* new BuildProfileError({\n message: `Profile \"${profile.name}\" has no android section.`,\n });\n }\n const androidProfile = profile.android;\n const androidBundleId = appMeta.androidPackage;\n if (!androidBundleId) {\n return yield* new BuildProfileError({\n message: \"Missing expo.android.package in app.json.\",\n });\n }\n // Cross-validate Gradle config against app.json (Groovy only). When\n // Gradle resolves a different applicationId, the built APK/AAB is signed\n // Under that id — so the Credential resolver must key off the Gradle value.\n const androidDir = `${projectRoot}/android`;\n const gradleConfig = yield* readGradleConfig(androidDir);\n yield* warnOnGradleMismatch(gradleConfig, androidBundleId);\n const applicationIdentifier = gradleConfig?.applicationId ?? androidBundleId;\n const build = yield* runAndroidBuild({\n api,\n tempDir,\n projectRoot,\n androidProfile,\n applicationIdentifier,\n envVars,\n projectId,\n });\n const target: BuildTarget =\n androidProfile.format === \"aab\"\n ? { platform: \"android\", distribution: \"play-store\", artifactFormat: \"aab\" }\n : { platform: \"android\", distribution: \"direct\", artifactFormat: \"apk\" };\n return { build, target, bundleId: applicationIdentifier };\n });\n\nconst runPlatformBuild = (input: PlatformBuildInput) =>\n input.options.platform === \"ios\" ? runIosPlatformBuild(input) : runAndroidPlatformBuild(input);\n\nexport const runBuildWorkflow = (options: RunBuildWorkflowOptions) =>\n Effect.scoped(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const runtime = yield* CliRuntime;\n const projectRoot = yield* runtime.cwd;\n\n const appJson = yield* readAppJson;\n const projectId = yield* readProjectId;\n\n const profile = yield* readBuildProfile(appJson, options.profileName);\n\n // Load env vars BEFORE resolving dynamic config — app.config.js may read process.env\n const envVars = yield* pullEnvVars(api, {\n projectId,\n environment: profile.environment,\n });\n\n // Try @expo/config for dynamic configs (app.config.js/ts), fall back to static app.json.\n // EnvVars are applied as a scoped process.env overlay inside readExpoConfig and restored\n // After the call so secrets do not leak to child processes spawned later.\n const expoConfig = yield* readExpoConfig(projectRoot, envVars);\n const appMeta = expoConfig\n ? yield* readAppMetaFromConfig(expoConfig, options.platform).pipe(\n Effect.tap(() => Console.log(\"Resolved app config via @expo/config\")),\n Effect.catchAll(() => readAppMeta(appJson, options.platform)),\n )\n : yield* readAppMeta(appJson, options.platform);\n\n const runtimeVersion = yield* resolveRuntimeVersion({\n raw: appMeta.rawRuntimeVersion,\n appVersion: appMeta.appVersion,\n projectRoot,\n });\n\n const tempDir = yield* acquireBuildTempDir;\n\n yield* Console.log(\n `Building ${options.platform} artifact for profile \"${profile.name}\" (runtimeVersion=${runtimeVersion})`,\n );\n\n const outcome = yield* runPlatformBuild({\n api,\n options,\n profile,\n appMeta,\n envVars,\n projectId,\n projectRoot,\n tempDir,\n });\n const { build, target, bundleId } = outcome;\n\n yield* Console.log(`Artifact produced: ${build.artifactPath}`);\n\n if (options.noUpload) {\n yield* printKeyValue([\n [\"Artifact\", build.artifactPath],\n [\"SHA-256\", build.sha256],\n [\"Bytes\", String(build.byteSize)],\n [\"Upload\", \"skipped (--no-upload)\"],\n ]);\n return;\n }\n\n const rawGitContext = yield* readGitContext(projectRoot);\n const gitContext: {\n readonly ref?: string;\n readonly commit?: string;\n readonly dirty: boolean;\n } = {\n ...(rawGitContext.ref === undefined ? {} : { ref: rawGitContext.ref }),\n ...(rawGitContext.commit === undefined ? {} : { commit: rawGitContext.commit }),\n dirty: rawGitContext.dirty,\n };\n\n const result = yield* reserveAndUpload(api, {\n target,\n projectId,\n profileName: profile.name,\n runtimeVersion,\n ...(appMeta.appVersion === undefined ? {} : { appVersion: appMeta.appVersion }),\n ...(appMeta.buildNumber === undefined ? {} : { buildNumber: appMeta.buildNumber }),\n bundleId,\n gitContext,\n ...(options.message === undefined ? {} : { message: options.message }),\n artifactPath: build.artifactPath,\n sha256: build.sha256,\n byteSize: build.byteSize,\n });\n\n yield* Console.log(\"\");\n yield* printKeyValue([\n [\"Build ID\", result.id],\n [\"Status\", result.status],\n [\"Platform\", options.platform],\n [\"Profile\", profile.name],\n [\"Runtime version\", runtimeVersion],\n [\"Artifact\", build.artifactPath],\n [\"SHA-256\", build.sha256],\n [\"Bytes\", String(build.byteSize)],\n ]);\n }),\n );\n","import { defineCommand } from \"citty\";\n\nimport { runBuildWorkflow } from \"../../application/build-workflow\";\nimport { runEffect } from \"../../lib/citty-effect\";\n\nconst BUILD_EXIT_EXTRAS = {\n BuildProfileError: 2,\n RuntimeVersionError: 2,\n MissingCredentialsError: 5,\n BuildFailedError: 6,\n KeychainError: 6,\n ProvisioningError: 6,\n ArtifactNotFoundError: 6,\n ReserveError: 7,\n UploadFailedError: 7,\n PresignedUrlExpiredError: 7,\n CompleteError: 7,\n EnvExportError: 7,\n} as const;\n\nexport const buildCommand = defineCommand({\n meta: { name: \"build\", description: \"Build the app locally and optionally upload\" },\n args: {\n platform: { type: \"enum\", options: [\"ios\", \"android\"], required: true },\n profile: { type: \"string\", default: \"production\", description: \"Build profile name\" },\n message: { type: \"string\", description: \"Optional build message\" },\n upload: {\n type: \"boolean\",\n default: true,\n description: \"Upload the built artifact to better-update\",\n negativeDescription: \"Skip upload (use --no-upload)\",\n },\n \"raw-output\": { type: \"boolean\", description: \"Stream raw Gradle/Xcode output\" },\n },\n run: async ({ args }) =>\n runEffect(\n runBuildWorkflow({\n platform: args.platform,\n profileName: args.profile,\n message: args.message,\n noUpload: !args.upload,\n rawOutput: args[\"raw-output\"] ?? false,\n }),\n BUILD_EXIT_EXTRAS,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { printTable } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\n\nexport const compatibilityMatrixCommand = defineCommand({\n meta: {\n name: \"compatibility-matrix\",\n description: \"Show build-to-channel compatibility and missing runtime versions\",\n },\n run: async () =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n const result = yield* api.builds.compatibilityMatrix({ urlParams: { projectId } });\n\n const matrixKeys = Object.keys(result.channelStatusByKey);\n\n if (matrixKeys.length === 0 && result.missingRuntimeVersions.length === 0) {\n yield* Console.log(\"No compatibility data found.\");\n return;\n }\n\n const channelLookup: Record<string, string> = Object.fromEntries(\n result.channels.map((channel) => [channel.channelId, channel.channelName]),\n );\n\n if (matrixKeys.length > 0) {\n yield* Console.log(\"Channel Status by (Platform / Runtime Version):\");\n yield* printTable(\n [\"Platform / Runtime\", \"Channel\", \"Updates\"],\n matrixKeys.flatMap((key) =>\n (result.channelStatusByKey[key] ?? [])\n .filter((entry) => entry.updateCount > 0)\n .map((entry) => [\n key,\n channelLookup[entry.channelId] ?? entry.channelId,\n String(entry.updateCount),\n ]),\n ),\n );\n }\n\n if (result.missingRuntimeVersions.length > 0) {\n yield* Console.log(\"\\nMissing Runtime Versions:\");\n yield* printTable(\n [\"Channel\", \"Platform\", \"Runtime Version\", \"Updates\"],\n result.missingRuntimeVersions.map((missing) => [\n missing.channelName,\n missing.platform,\n missing.runtimeVersion,\n String(missing.updateCount),\n ]),\n );\n }\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { apiClient } from \"../../services/api-client\";\n\nexport const deleteCommand = defineCommand({\n meta: { name: \"delete\", description: \"Delete a build\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Build ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n yield* api.builds.delete({ path: { id: args.id } });\n yield* Console.log(`Build ${args.id} deleted.`);\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { printKeyValue } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\n\nexport const getCommand = defineCommand({\n meta: { name: \"get\", description: \"Show a build\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Build ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const build = yield* api.builds.get({ path: { id: args.id } });\n yield* printKeyValue([\n [\"ID\", build.id],\n [\"Platform\", build.platform],\n [\"Profile\", build.profile],\n [\"Distribution\", build.distribution],\n [\"Version\", build.appVersion ?? \"-\"],\n [\"Build Number\", build.buildNumber ?? \"-\"],\n [\"Runtime Version\", build.runtimeVersion ?? \"-\"],\n [\"Bundle ID\", build.bundleId ?? \"-\"],\n [\"Git Ref\", build.gitRef ?? \"-\"],\n [\"Message\", build.message ?? \"-\"],\n [\n \"Artifact\",\n build.artifact\n ? `${build.artifact.format} (${String(build.artifact.byteSize)} bytes)`\n : \"none\",\n ],\n [\"Created\", build.createdAt],\n ]);\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { printKeyValue } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\n\nexport const installLinkCommand = defineCommand({\n meta: { name: \"install-link\", description: \"Get install/artifact URLs for a build\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Build ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const result = yield* api.builds.getInstallLink({ path: { id: args.id } });\n yield* printKeyValue([\n [\"Artifact URL\", result.artifactUrl],\n [\"Install URL\", result.installUrl ?? \"-\"],\n [\"Expires\", String(result.expires)],\n ]);\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { parseLimit } from \"../../lib/cli-schemas\";\nimport { printTable } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\n\nexport const listCommand = defineCommand({\n meta: { name: \"list\", description: \"List builds for the linked project\" },\n args: {\n platform: { type: \"enum\", options: [\"ios\", \"android\"], description: \"Filter by platform\" },\n limit: { type: \"string\", default: \"10\", description: \"Max rows (default 10)\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const limit = yield* parseLimit(args.limit, 10);\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const platformFilter = args.platform ? { platform: args.platform } : {};\n\n const { items } = yield* api.builds.list({\n urlParams: { projectId, ...platformFilter, limit },\n });\n\n yield* printTable(\n [\"ID\", \"Platform\", \"Profile\", \"Distribution\", \"Version\", \"Created\"],\n items.map((build) => [\n build.id,\n build.platform,\n build.profile,\n build.distribution,\n build.appVersion ?? \"-\",\n build.createdAt,\n ]),\n );\n }),\n ),\n});\n","import { FileSystem } from \"@effect/platform\";\nimport { Console, Effect } from \"effect\";\n\nimport { reserveAndUpload } from \"../commands/build/reserve-and-upload\";\nimport { readAppJson, readProjectId } from \"../lib/app-json\";\nimport { readAppMeta, readBuildProfile } from \"../lib/build-profile\";\nimport { pullEnvVars } from \"../lib/env-exporter\";\nimport { ArtifactNotFoundError, BuildProfileError } from \"../lib/exit-codes\";\nimport { readAppMetaFromConfig, readExpoConfig } from \"../lib/expo-config\";\nimport { readGitContext } from \"../lib/git-context\";\nimport { readGradleConfig, warnOnGradleMismatch } from \"../lib/gradle-config\";\nimport { printKeyValue } from \"../lib/output\";\nimport { resolveRuntimeVersion } from \"../lib/runtime-version\";\nimport { sha256File } from \"../lib/sha256\";\nimport { apiClient } from \"../services/api-client\";\nimport { CliRuntime } from \"../services/cli-runtime\";\n\nimport type { BuildTarget } from \"../commands/build/reserve-and-upload\";\nimport type { Platform } from \"../lib/build-profile\";\n\nexport interface RunUploadWorkflowOptions {\n readonly platform: Platform;\n readonly profileName: string;\n readonly artifactPath: string;\n readonly message: string | undefined;\n}\n\ninterface ResolvedTarget {\n readonly target: BuildTarget;\n readonly bundleId: string;\n}\n\nconst resolveIosTarget = (\n profile: Effect.Effect.Success<ReturnType<typeof readBuildProfile>>,\n appMeta: Effect.Effect.Success<ReturnType<typeof readAppMeta>>,\n): Effect.Effect<ResolvedTarget, BuildProfileError> =>\n Effect.gen(function* () {\n if (!profile.ios) {\n return yield* new BuildProfileError({\n message: `Profile \"${profile.name}\" has no ios section.`,\n });\n }\n if (!appMeta.bundleId) {\n return yield* new BuildProfileError({\n message: \"Missing expo.ios.bundleIdentifier in app.json.\",\n });\n }\n return {\n target: {\n platform: \"ios\",\n distribution: profile.ios.distribution,\n artifactFormat: \"ipa\",\n },\n bundleId: appMeta.bundleId,\n };\n });\n\nconst resolveAndroidTarget = (\n profile: Effect.Effect.Success<ReturnType<typeof readBuildProfile>>,\n appMeta: Effect.Effect.Success<ReturnType<typeof readAppMeta>>,\n projectRoot: string,\n) =>\n Effect.gen(function* () {\n if (!profile.android) {\n return yield* new BuildProfileError({\n message: `Profile \"${profile.name}\" has no android section.`,\n });\n }\n if (!appMeta.androidPackage) {\n return yield* new BuildProfileError({\n message: \"Missing expo.android.package in app.json.\",\n });\n }\n const gradleConfig = yield* readGradleConfig(`${projectRoot}/android`);\n yield* warnOnGradleMismatch(gradleConfig, appMeta.androidPackage);\n const bundleId = gradleConfig?.applicationId ?? appMeta.androidPackage;\n const target: BuildTarget =\n profile.android.format === \"aab\"\n ? { platform: \"android\", distribution: \"play-store\", artifactFormat: \"aab\" }\n : { platform: \"android\", distribution: \"direct\", artifactFormat: \"apk\" };\n return { target, bundleId };\n });\n\nexport const runUploadWorkflow = (options: RunUploadWorkflowOptions) =>\n Effect.gen(function* () {\n const api = yield* apiClient;\n const runtime = yield* CliRuntime;\n const projectRoot = yield* runtime.cwd;\n\n const fs = yield* FileSystem.FileSystem;\n const artifactExists = yield* fs\n .exists(options.artifactPath)\n .pipe(Effect.orElseSucceed(() => false));\n if (!artifactExists) {\n yield* new ArtifactNotFoundError({\n message: `Artifact not found at ${options.artifactPath}.`,\n });\n }\n\n const appJson = yield* readAppJson;\n const projectId = yield* readProjectId;\n const profile = yield* readBuildProfile(appJson, options.profileName);\n\n const envVars = yield* pullEnvVars(api, {\n projectId,\n environment: profile.environment,\n });\n\n const expoConfig = yield* readExpoConfig(projectRoot, envVars);\n const appMeta = expoConfig\n ? yield* readAppMetaFromConfig(expoConfig, options.platform).pipe(\n Effect.tap(() => Console.log(\"Resolved app config via @expo/config\")),\n Effect.catchAll(() => readAppMeta(appJson, options.platform)),\n )\n : yield* readAppMeta(appJson, options.platform);\n\n const runtimeVersion = yield* resolveRuntimeVersion({\n raw: appMeta.rawRuntimeVersion,\n appVersion: appMeta.appVersion,\n projectRoot,\n });\n\n const { target, bundleId } =\n options.platform === \"ios\"\n ? yield* resolveIosTarget(profile, appMeta)\n : yield* resolveAndroidTarget(profile, appMeta, projectRoot);\n\n yield* Console.log(`Hashing ${options.artifactPath}...`);\n const { sha256, byteSize } = yield* sha256File(options.artifactPath);\n\n const rawGitContext = yield* readGitContext(projectRoot);\n const gitContext: {\n readonly ref?: string;\n readonly commit?: string;\n readonly dirty: boolean;\n } = {\n ...(rawGitContext.ref === undefined ? {} : { ref: rawGitContext.ref }),\n ...(rawGitContext.commit === undefined ? {} : { commit: rawGitContext.commit }),\n dirty: rawGitContext.dirty,\n };\n\n const result = yield* reserveAndUpload(api, {\n target,\n projectId,\n profileName: profile.name,\n runtimeVersion,\n ...(appMeta.appVersion === undefined ? {} : { appVersion: appMeta.appVersion }),\n ...(appMeta.buildNumber === undefined ? {} : { buildNumber: appMeta.buildNumber }),\n bundleId,\n gitContext,\n ...(options.message === undefined ? {} : { message: options.message }),\n artifactPath: options.artifactPath,\n sha256,\n byteSize,\n });\n\n yield* Console.log(\"\");\n yield* printKeyValue([\n [\"Build ID\", result.id],\n [\"Status\", result.status],\n [\"Platform\", options.platform],\n [\"Profile\", profile.name],\n [\"Runtime version\", runtimeVersion],\n [\"Artifact\", options.artifactPath],\n [\"SHA-256\", sha256],\n [\"Bytes\", String(byteSize)],\n ]);\n });\n","import { defineCommand } from \"citty\";\n\nimport { runUploadWorkflow } from \"../../application/upload-workflow\";\nimport { runEffect } from \"../../lib/citty-effect\";\n\nconst UPLOAD_EXIT_EXTRAS = {\n BuildProfileError: 2,\n RuntimeVersionError: 2,\n ArtifactNotFoundError: 6,\n BuildFailedError: 6,\n ReserveError: 7,\n UploadFailedError: 7,\n PresignedUrlExpiredError: 7,\n CompleteError: 7,\n EnvExportError: 7,\n} as const;\n\nexport const uploadCommand = defineCommand({\n meta: { name: \"upload\", description: \"Upload an existing artifact to better-update\" },\n args: {\n \"artifact-path\": { type: \"positional\", required: true, description: \"Path to artifact\" },\n platform: { type: \"enum\", options: [\"ios\", \"android\"], required: true },\n profile: { type: \"string\", default: \"production\", description: \"Build profile name\" },\n message: { type: \"string\", description: \"Optional build message\" },\n },\n run: async ({ args }) =>\n runEffect(\n runUploadWorkflow({\n artifactPath: args[\"artifact-path\"],\n platform: args.platform,\n profileName: args.profile,\n message: args.message,\n }),\n UPLOAD_EXIT_EXTRAS,\n ),\n});\n","import { defineCommand } from \"citty\";\n\nimport { compatibilityMatrixCommand } from \"./compatibility-matrix\";\nimport { deleteCommand } from \"./delete\";\nimport { getCommand } from \"./get\";\nimport { installLinkCommand } from \"./install-link\";\nimport { listCommand } from \"./list\";\nimport { uploadCommand } from \"./upload\";\n\nexport const buildsCommand = defineCommand({\n meta: { name: \"builds\", description: \"Manage builds\" },\n subCommands: {\n list: listCommand,\n get: getCommand,\n delete: deleteCommand,\n \"install-link\": installLinkCommand,\n \"compatibility-matrix\": compatibilityMatrixCommand,\n upload: uploadCommand,\n },\n});\n","import { Effect } from \"effect\";\n\ninterface NamedResource {\n readonly id: string;\n readonly name: string;\n}\n\nexport const resolveNamedResourceId = <Err>(\n params: {\n readonly items: readonly NamedResource[];\n readonly kind: string;\n readonly name: string;\n },\n makeError: (message: string) => Err,\n): Effect.Effect<string, Err> =>\n Effect.gen(function* () {\n const match = params.items.find((item) => item.name === params.name);\n if (match === undefined) {\n return yield* Effect.fail(\n makeError(`${params.kind} \"${params.name}\" not found in the linked project.`),\n );\n }\n return match.id;\n });\n","import { Data } from \"effect\";\n\nimport { resolveNamedResourceId as resolveNamedResourceIdBase } from \"../../lib/resolve-named-resource\";\n\nexport class ChannelCommandError extends Data.TaggedError(\"ChannelCommandError\")<{\n readonly message: string;\n}> {}\n\nexport const channelErrorExtras = { ChannelCommandError: 2 } as const;\n\nexport const resolveNamedResourceId = (params: {\n readonly items: readonly { readonly id: string; readonly name: string }[];\n readonly kind: string;\n readonly name: string;\n}) => resolveNamedResourceIdBase(params, (message) => new ChannelCommandError({ message }));\n","import { defineCommand } from \"citty\";\nimport { Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { drainPages } from \"../../lib/drain-cursor\";\nimport { printKeyValue } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\nimport { channelErrorExtras, resolveNamedResourceId } from \"./helpers\";\n\nexport const createCommand = defineCommand({\n meta: { name: \"create\", description: \"Create a channel\" },\n args: {\n name: { type: \"string\", required: true, description: \"Channel name\" },\n branch: { type: \"string\", required: true, description: \"Initial branch name\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const branches = yield* drainPages((page) =>\n api.branches.list({\n urlParams: { projectId, limit: 100, page },\n }),\n );\n const branchId = yield* resolveNamedResourceId({\n items: branches,\n kind: \"Branch\",\n name: args.branch,\n });\n\n const channel = yield* api.channels.create({\n payload: { projectId, name: args.name, branchId },\n });\n\n yield* printKeyValue([\n [\"ID\", channel.id],\n [\"Name\", channel.name],\n [\"Branch\", args.branch],\n [\"Created\", channel.createdAt],\n ]);\n }),\n channelErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { apiClient } from \"../../services/api-client\";\nimport { channelErrorExtras } from \"./helpers\";\n\nexport const deleteCommand = defineCommand({\n meta: { name: \"delete\", description: \"Delete a channel\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Channel ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n yield* api.channels.delete({ path: { id: args.id } });\n yield* Console.log(`Channel ${args.id} deleted.`);\n }),\n channelErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { drainPages } from \"../../lib/drain-cursor\";\nimport { printTable } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\nimport { channelErrorExtras } from \"./helpers\";\n\nexport const listCommand = defineCommand({\n meta: { name: \"list\", description: \"List channels for the linked project\" },\n run: async () =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const [items, branches] = yield* Effect.all([\n drainPages((page) =>\n api.channels.list({\n urlParams: { projectId, limit: 100, page },\n }),\n ),\n drainPages((page) =>\n api.branches.list({\n urlParams: { projectId, limit: 100, page },\n }),\n ),\n ]);\n\n if (items.length === 0) {\n yield* Console.log(\"No channels found.\");\n return;\n }\n\n const branchNames = new Map(branches.map((branch) => [branch.id, branch.name]));\n\n yield* printTable(\n [\"ID\", \"Name\", \"Branch\", \"Paused\", \"Rollout\", \"Created\"],\n items.map((channel) => [\n channel.id,\n channel.name,\n branchNames.get(channel.branchId) ?? channel.branchId,\n channel.isPaused ? \"yes\" : \"no\",\n channel.branchMappingJson === null ? \"-\" : \"active\",\n channel.createdAt,\n ]),\n );\n }),\n channelErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { apiClient } from \"../../services/api-client\";\nimport { channelErrorExtras } from \"./helpers\";\n\nexport const pauseCommand = defineCommand({\n meta: { name: \"pause\", description: \"Pause a channel\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Channel ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const channel = yield* api.channels.pause({ path: { id: args.id } });\n yield* Console.log(`Channel \"${channel.name}\" paused.`);\n }),\n channelErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { apiClient } from \"../../services/api-client\";\nimport { channelErrorExtras } from \"./helpers\";\n\nexport const resumeCommand = defineCommand({\n meta: { name: \"resume\", description: \"Resume a paused channel\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Channel ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const channel = yield* api.channels.resume({ path: { id: args.id } });\n yield* Console.log(`Channel \"${channel.name}\" resumed.`);\n }),\n channelErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../../lib/citty-effect\";\nimport { apiClient } from \"../../../services/api-client\";\nimport { channelErrorExtras } from \"../helpers\";\n\nexport const completeCommand = defineCommand({\n meta: { name: \"complete\", description: \"Complete the active branch rollout\" },\n args: {\n channelId: { type: \"positional\", required: true, description: \"Channel ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const channel = yield* api.channels.completeBranchRollout({\n path: { id: args.channelId },\n });\n yield* Console.log(`Completed rollout on channel \"${channel.name}\".`);\n }),\n channelErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../../lib/app-json\";\nimport { runEffect } from \"../../../lib/citty-effect\";\nimport { parseRolloutPercentage } from \"../../../lib/cli-schemas\";\nimport { drainPages } from \"../../../lib/drain-cursor\";\nimport { apiClient } from \"../../../services/api-client\";\nimport { channelErrorExtras, resolveNamedResourceId } from \"../helpers\";\n\nexport const createCommand = defineCommand({\n meta: { name: \"create\", description: \"Start a branch rollout on a channel\" },\n args: {\n channelId: { type: \"positional\", required: true, description: \"Channel ID\" },\n branch: { type: \"string\", required: true, description: \"Target branch name\" },\n percentage: {\n type: \"string\",\n required: true,\n description: \"Initial rollout percentage (1-100)\",\n },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const percentage = yield* parseRolloutPercentage(args.percentage, \"percentage\");\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const branches = yield* drainPages((page) =>\n api.branches.list({\n urlParams: { projectId, limit: 100, page },\n }),\n );\n const newBranchId = yield* resolveNamedResourceId({\n items: branches,\n kind: \"Branch\",\n name: args.branch,\n });\n\n const channel = yield* api.channels.createBranchRollout({\n path: { id: args.channelId },\n payload: { newBranchId, percentage },\n });\n\n yield* Console.log(\n `Started rollout on channel \"${channel.name}\" to branch \"${args.branch}\" at ${String(percentage)}%.`,\n );\n }),\n channelErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../../lib/citty-effect\";\nimport { apiClient } from \"../../../services/api-client\";\nimport { channelErrorExtras } from \"../helpers\";\n\nexport const revertCommand = defineCommand({\n meta: { name: \"revert\", description: \"Revert the active branch rollout\" },\n args: {\n channelId: { type: \"positional\", required: true, description: \"Channel ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const channel = yield* api.channels.revertBranchRollout({\n path: { id: args.channelId },\n });\n yield* Console.log(`Reverted rollout on channel \"${channel.name}\".`);\n }),\n channelErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../../lib/citty-effect\";\nimport { parseRolloutPercentage } from \"../../../lib/cli-schemas\";\nimport { apiClient } from \"../../../services/api-client\";\nimport { channelErrorExtras } from \"../helpers\";\n\nexport const updateCommand = defineCommand({\n meta: { name: \"update\", description: \"Update the rollout percentage on a channel\" },\n args: {\n channelId: { type: \"positional\", required: true, description: \"Channel ID\" },\n percentage: { type: \"string\", required: true, description: \"New rollout percentage (1-100)\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const percentage = yield* parseRolloutPercentage(args.percentage, \"percentage\");\n const api = yield* apiClient;\n const channel = yield* api.channels.updateBranchRollout({\n path: { id: args.channelId },\n payload: { percentage },\n });\n\n yield* Console.log(\n `Updated rollout on channel \"${channel.name}\" to ${String(percentage)}%.`,\n );\n }),\n channelErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\n\nimport { completeCommand } from \"./complete\";\nimport { createCommand } from \"./create\";\nimport { revertCommand } from \"./revert\";\nimport { updateCommand } from \"./update\";\n\nexport const rolloutCommand = defineCommand({\n meta: { name: \"rollout\", description: \"Manage channel branch rollouts\" },\n subCommands: {\n create: createCommand,\n update: updateCommand,\n complete: completeCommand,\n revert: revertCommand,\n },\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { drainPages } from \"../../lib/drain-cursor\";\nimport { apiClient } from \"../../services/api-client\";\nimport { channelErrorExtras, resolveNamedResourceId } from \"./helpers\";\n\nexport const updateCommand = defineCommand({\n meta: { name: \"update\", description: \"Relink a channel to a different branch\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Channel ID\" },\n branch: { type: \"string\", required: true, description: \"Target branch name\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const branches = yield* drainPages((page) =>\n api.branches.list({\n urlParams: { projectId, limit: 100, page },\n }),\n );\n const branchId = yield* resolveNamedResourceId({\n items: branches,\n kind: \"Branch\",\n name: args.branch,\n });\n\n const channel = yield* api.channels.update({\n path: { id: args.id },\n payload: { branchId },\n });\n\n yield* Console.log(`Channel \"${channel.name}\" relinked to branch \"${args.branch}\".`);\n }),\n channelErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\n\nimport { createCommand } from \"./create\";\nimport { deleteCommand } from \"./delete\";\nimport { listCommand } from \"./list\";\nimport { pauseCommand } from \"./pause\";\nimport { resumeCommand } from \"./resume\";\nimport { rolloutCommand } from \"./rollout\";\nimport { updateCommand } from \"./update\";\n\nexport const channelsCommand = defineCommand({\n meta: { name: \"channels\", description: \"Manage channels\" },\n subCommands: {\n list: listCommand,\n create: createCommand,\n update: updateCommand,\n pause: pauseCommand,\n resume: resumeCommand,\n delete: deleteCommand,\n rollout: rolloutCommand,\n },\n});\n","/* eslint-disable typescript/no-unsafe-assignment, typescript/no-unsafe-member-access, typescript/no-unsafe-call -- @expo/pkcs12 exports declare node-forge cert shapes as `any`; this file is the narrowing boundary that produces the typed P12Info for the rest of the CLI */\n\nimport { getFormattedSerialNumber, getX509Certificate, parsePKCS12 } from \"@expo/pkcs12\";\nimport { Effect } from \"effect\";\n\nimport { CredentialValidationError } from \"./exit-codes\";\n\nexport interface P12Info {\n readonly serialNumber: string;\n readonly validFrom: Date | undefined;\n readonly expiresAt: Date | undefined;\n readonly subject: string;\n readonly issuerCN: string | undefined;\n readonly signingIdentity: string;\n readonly teamId: string | undefined;\n}\n\nconst APPLE_TEAM_ID_RE = /^[A-Z0-9]{10}$/u;\n\nconst extractTeamId = (params: {\n readonly signingIdentity: string;\n readonly orgUnit: string | undefined;\n}): string | undefined => {\n if (params.orgUnit && APPLE_TEAM_ID_RE.test(params.orgUnit)) {\n return params.orgUnit;\n }\n const parenMatch = /\\(([A-Z0-9]{10})\\)\\s*$/u.exec(params.signingIdentity);\n return parenMatch?.[1];\n};\n\n/**\n * Parse a PKCS#12 (.p12) buffer and extract certificate metadata.\n */\nexport const inspectP12 = (params: {\n readonly data: Buffer;\n readonly password: string;\n}): Effect.Effect<P12Info, CredentialValidationError> =>\n Effect.try({\n try: () => {\n const p12 = parsePKCS12(params.data, params.password);\n const cert = getX509Certificate(p12);\n\n const serialNumber = getFormattedSerialNumber(cert) ?? \"unknown\";\n\n const validFrom =\n cert.validity.notBefore instanceof Date ? cert.validity.notBefore : undefined;\n const expiresAt = cert.validity.notAfter instanceof Date ? cert.validity.notAfter : undefined;\n\n const subjectParts = cert.subject.attributes.map(\n (attr: { shortName?: string; name: string; value: unknown }) =>\n `${attr.shortName ?? attr.name}=${String(attr.value)}`,\n );\n const subject = subjectParts.join(\", \");\n\n const issuerCNValue = cert.issuer.getField(\"CN\")?.value;\n const issuerCN = typeof issuerCNValue === \"string\" ? issuerCNValue : undefined;\n\n // Signing identity = Common Name from subject, e.g. \"Apple Distribution: Name (TEAMID)\"\n const cnValue = cert.subject.getField(\"CN\")?.value;\n const cn = typeof cnValue === \"string\" ? cnValue : undefined;\n const signingIdentity = cn ?? subject;\n const orgUnitValue = cert.subject.getField(\"OU\")?.value;\n const orgUnit = typeof orgUnitValue === \"string\" ? orgUnitValue : undefined;\n\n const teamId = extractTeamId({ signingIdentity, orgUnit });\n\n return { serialNumber, validFrom, expiresAt, subject, issuerCN, signingIdentity, teamId };\n },\n catch: (error) =>\n new CredentialValidationError({\n message: `Failed to parse P12 certificate: ${error instanceof Error ? error.message : String(error)}`,\n }),\n });\n","import { toBase64 } from \"@better-update/encoding\";\nimport { FileSystem } from \"@effect/platform\";\nimport { Effect, Match } from \"effect\";\n\nimport { CredentialValidationError } from \"./exit-codes\";\nimport { inspectP12 } from \"./pkcs12\";\n\nimport type { ApiClient } from \"../services/api-client\";\n\nexport type CliCredentialType =\n | \"distribution-certificate\"\n | \"push-key\"\n | \"asc-api-key\"\n | \"provisioning-profile\"\n | \"keystore\"\n | \"google-service-account-key\";\n\nexport type CliCredentialPlatform = \"ios\" | \"android\";\n\nexport interface CliCredentialRow {\n readonly id: string;\n readonly name: string;\n readonly platform: CliCredentialPlatform;\n readonly type: CliCredentialType;\n readonly distribution: string | null;\n}\n\nconst formatDistribution = (value: string): string => value.toLowerCase().replaceAll(\"_\", \"-\");\n\nexport const listAllCredentials = (api: ApiClient) =>\n Effect.gen(function* () {\n const [certs, pushKeys, ascKeys, profiles, keystores, googleKeys] = yield* Effect.all(\n [\n api.appleDistributionCertificates.list(),\n api.applePushKeys.list(),\n api.ascApiKeys.list(),\n api.appleProvisioningProfiles.list({ urlParams: {} }),\n api.androidUploadKeystores.list(),\n api.googleServiceAccountKeys.list(),\n ],\n { concurrency: \"unbounded\" },\n );\n\n const rows: CliCredentialRow[] = [\n ...certs.items.map(\n (cert): CliCredentialRow => ({\n id: cert.id,\n name: cert.serialNumber,\n platform: \"ios\",\n type: \"distribution-certificate\",\n distribution: null,\n }),\n ),\n ...pushKeys.items.map(\n (key): CliCredentialRow => ({\n id: key.id,\n name: key.keyId,\n platform: \"ios\",\n type: \"push-key\",\n distribution: null,\n }),\n ),\n ...ascKeys.items.map(\n (key): CliCredentialRow => ({\n id: key.id,\n name: key.name,\n platform: \"ios\",\n type: \"asc-api-key\",\n distribution: null,\n }),\n ),\n ...profiles.items.map(\n (profile): CliCredentialRow => ({\n id: profile.id,\n name: profile.profileName ?? profile.bundleIdentifier,\n platform: \"ios\",\n type: \"provisioning-profile\",\n distribution: formatDistribution(profile.distributionType),\n }),\n ),\n ...keystores.items.map(\n (ks): CliCredentialRow => ({\n id: ks.id,\n name: ks.keyAlias,\n platform: \"android\",\n type: \"keystore\",\n distribution: null,\n }),\n ),\n ...googleKeys.items.map(\n (key): CliCredentialRow => ({\n id: key.id,\n name: key.clientEmail,\n platform: \"android\",\n type: \"google-service-account-key\",\n distribution: null,\n }),\n ),\n ];\n\n return rows;\n });\n\nexport const filterCredentials = (\n rows: readonly CliCredentialRow[],\n filter: {\n readonly platform?: CliCredentialPlatform;\n readonly type?: CliCredentialType;\n readonly distribution?: string;\n },\n): CliCredentialRow[] =>\n rows.filter((row) => {\n if (filter.platform && row.platform !== filter.platform) {\n return false;\n }\n if (filter.type && row.type !== filter.type) {\n return false;\n }\n if (filter.distribution && row.distribution !== filter.distribution) {\n return false;\n }\n return true;\n });\n\nexport interface UploadCredentialInput {\n readonly platform: CliCredentialPlatform;\n readonly type: CliCredentialType;\n readonly name: string;\n readonly filePath: string;\n readonly password?: string;\n readonly distribution?: string;\n readonly keyAlias?: string;\n readonly keyPassword?: string;\n readonly keyId?: string;\n readonly issuerId?: string;\n readonly appleTeamIdentifier?: string;\n}\n\nconst toUtf8 = (bytes: Uint8Array): string => new TextDecoder().decode(bytes);\n\nconst missing = (label: string) =>\n new CredentialValidationError({\n message: `Missing --${label} required for the selected credential type.`,\n });\n\nconst uploadIosDistributionCertificate = (\n api: ApiClient,\n input: UploadCredentialInput,\n bytes: Uint8Array,\n) =>\n Effect.gen(function* () {\n if (input.password === undefined) {\n return yield* missing(\"password\");\n }\n const info = yield* inspectP12({ data: Buffer.from(bytes), password: input.password });\n if (!info.teamId) {\n return yield* new CredentialValidationError({\n message:\n \"Could not derive Apple Team ID from certificate subject (expected OU=TEAMID or CN with (TEAMID)).\",\n });\n }\n if (!info.validFrom || !info.expiresAt) {\n return yield* new CredentialValidationError({\n message: \"Certificate is missing notBefore/notAfter dates.\",\n });\n }\n const created = yield* api.appleDistributionCertificates.upload({\n payload: {\n p12Base64: toBase64(bytes),\n p12Password: input.password,\n serialNumber: info.serialNumber,\n appleTeamIdentifier: info.teamId,\n validFrom: info.validFrom.toISOString(),\n validUntil: info.expiresAt.toISOString(),\n },\n });\n return {\n id: created.id,\n name: input.name,\n platform: \"ios\" as const,\n type: \"distribution-certificate\" as const,\n };\n });\n\nconst uploadIosPushKey = (api: ApiClient, input: UploadCredentialInput, bytes: Uint8Array) =>\n Effect.gen(function* () {\n if (!input.keyId) {\n return yield* missing(\"key-id\");\n }\n if (!input.appleTeamIdentifier) {\n return yield* missing(\"apple-team-identifier\");\n }\n const created = yield* api.applePushKeys.upload({\n payload: {\n keyId: input.keyId,\n p8Pem: toUtf8(bytes),\n appleTeamIdentifier: input.appleTeamIdentifier,\n },\n });\n return {\n id: created.id,\n name: input.name,\n platform: \"ios\" as const,\n type: \"push-key\" as const,\n };\n });\n\nconst uploadIosAscApiKey = (api: ApiClient, input: UploadCredentialInput, bytes: Uint8Array) =>\n Effect.gen(function* () {\n if (!input.keyId) {\n return yield* missing(\"key-id\");\n }\n if (!input.issuerId) {\n return yield* missing(\"issuer-id\");\n }\n const created = yield* api.ascApiKeys.upload({\n payload: {\n name: input.name,\n keyId: input.keyId,\n issuerId: input.issuerId,\n p8Pem: toUtf8(bytes),\n ...(input.appleTeamIdentifier === undefined\n ? {}\n : { appleTeamIdentifier: input.appleTeamIdentifier }),\n },\n });\n return {\n id: created.id,\n name: input.name,\n platform: \"ios\" as const,\n type: \"asc-api-key\" as const,\n };\n });\n\nconst uploadIosProvisioningProfile = (\n api: ApiClient,\n input: UploadCredentialInput,\n bytes: Uint8Array,\n) =>\n Effect.gen(function* () {\n const created = yield* api.appleProvisioningProfiles.upload({\n payload: { profileBase64: toBase64(bytes) },\n });\n return {\n id: created.id,\n name: input.name,\n platform: \"ios\" as const,\n type: \"provisioning-profile\" as const,\n };\n });\n\nconst uploadAndroidKeystore = (api: ApiClient, input: UploadCredentialInput, bytes: Uint8Array) =>\n Effect.gen(function* () {\n if (input.password === undefined) {\n return yield* missing(\"password\");\n }\n if (!input.keyAlias) {\n return yield* missing(\"key-alias\");\n }\n if (!input.keyPassword) {\n return yield* missing(\"key-password\");\n }\n const created = yield* api.androidUploadKeystores.upload({\n payload: {\n keystoreBase64: toBase64(bytes),\n keyAlias: input.keyAlias,\n keystorePassword: input.password,\n keyPassword: input.keyPassword,\n },\n });\n return {\n id: created.id,\n name: input.name,\n platform: \"android\" as const,\n type: \"keystore\" as const,\n };\n });\n\nconst uploadAndroidGoogleServiceAccountKey = (\n api: ApiClient,\n input: UploadCredentialInput,\n bytes: Uint8Array,\n) =>\n Effect.gen(function* () {\n const created = yield* api.googleServiceAccountKeys.upload({\n payload: { json: toUtf8(bytes) },\n });\n return {\n id: created.id,\n name: input.name,\n platform: \"android\" as const,\n type: \"google-service-account-key\" as const,\n };\n });\n\nconst uploadHandlers = {\n \"ios:distribution-certificate\": uploadIosDistributionCertificate,\n \"ios:push-key\": uploadIosPushKey,\n \"ios:asc-api-key\": uploadIosAscApiKey,\n \"ios:provisioning-profile\": uploadIosProvisioningProfile,\n \"android:keystore\": uploadAndroidKeystore,\n \"android:google-service-account-key\": uploadAndroidGoogleServiceAccountKey,\n};\n\nexport const uploadCredential = (api: ApiClient, input: UploadCredentialInput) =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const bytes = yield* fs.readFile(input.filePath);\n const key = `${input.platform}:${input.type}`;\n type HandlerKey = keyof typeof uploadHandlers;\n const hasKey = (candidate: string): candidate is HandlerKey =>\n Object.hasOwn(uploadHandlers, candidate);\n const handler = hasKey(key) ? uploadHandlers[key] : undefined;\n if (!handler) {\n return yield* new CredentialValidationError({\n message: `Unsupported credential combination: platform=${input.platform} type=${input.type}`,\n });\n }\n return yield* handler(api, input, bytes);\n });\n\nexport const deleteCredential = (\n api: ApiClient,\n input: {\n readonly id: string;\n readonly platform: CliCredentialPlatform;\n readonly type: CliCredentialType;\n },\n) => {\n const path = { id: input.id };\n return Match.value({ platform: input.platform, type: input.type }).pipe(\n Match.when({ platform: \"ios\", type: \"distribution-certificate\" }, () =>\n api.appleDistributionCertificates.delete({ path }),\n ),\n Match.when({ platform: \"ios\", type: \"push-key\" }, () => api.applePushKeys.delete({ path })),\n Match.when({ platform: \"ios\", type: \"asc-api-key\" }, () => api.ascApiKeys.delete({ path })),\n Match.when({ platform: \"ios\", type: \"provisioning-profile\" }, () =>\n api.appleProvisioningProfiles.delete({ path }),\n ),\n Match.when({ platform: \"android\", type: \"keystore\" }, () =>\n api.androidUploadKeystores.delete({ path }),\n ),\n Match.when({ platform: \"android\", type: \"google-service-account-key\" }, () =>\n api.googleServiceAccountKeys.delete({ path }),\n ),\n Match.orElse(() =>\n Effect.fail(\n new CredentialValidationError({\n message: `Unsupported credential combination: platform=${input.platform} type=${input.type}`,\n }),\n ),\n ),\n );\n};\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { deleteCredential } from \"../../lib/credentials-manager\";\nimport { apiClient } from \"../../services/api-client\";\n\nimport type { CliCredentialType } from \"../../lib/credentials-manager\";\n\nconst CREDENTIAL_TYPES = [\n \"distribution-certificate\",\n \"provisioning-profile\",\n \"push-key\",\n \"asc-api-key\",\n \"keystore\",\n \"google-service-account-key\",\n] as const;\n\nexport const deleteCommand = defineCommand({\n meta: { name: \"delete\", description: \"Delete a credential\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Credential ID\" },\n platform: { type: \"enum\", options: [\"ios\", \"android\"], required: true },\n type: { type: \"enum\", options: [...CREDENTIAL_TYPES], required: true },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n yield* deleteCredential(api, {\n id: args.id,\n platform: args.platform,\n type: args.type as CliCredentialType,\n });\n yield* Console.log(`Credential ${args.id} deleted.`);\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { filterCredentials, listAllCredentials } from \"../../lib/credentials-manager\";\nimport { printTable } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\n\nexport const listCommand = defineCommand({\n meta: { name: \"list\", description: \"List credentials across platforms\" },\n args: {\n platform: { type: \"enum\", options: [\"ios\", \"android\"], description: \"Filter by platform\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const rows = yield* listAllCredentials(api);\n\n const filtered = filterCredentials(rows, args.platform ? { platform: args.platform } : {});\n\n if (filtered.length === 0) {\n yield* Console.log(\"No credentials found.\");\n return;\n }\n\n yield* printTable(\n [\"ID\", \"Name\", \"Platform\", \"Type\", \"Distribution\"],\n filtered.map((row) => [\n row.id,\n row.name,\n row.platform,\n row.type,\n row.distribution ?? \"-\",\n ]),\n );\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { uploadCredential } from \"../../lib/credentials-manager\";\nimport { printKeyValue } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\n\nimport type { CliCredentialType } from \"../../lib/credentials-manager\";\n\nconst CREDENTIAL_TYPES = [\n \"distribution-certificate\",\n \"provisioning-profile\",\n \"push-key\",\n \"asc-api-key\",\n \"keystore\",\n \"google-service-account-key\",\n] as const;\n\nexport const uploadCommand = defineCommand({\n meta: { name: \"upload\", description: \"Upload a credential\" },\n args: {\n platform: { type: \"enum\", options: [\"ios\", \"android\"], required: true },\n type: { type: \"enum\", options: [...CREDENTIAL_TYPES], required: true },\n name: { type: \"string\", required: true, description: \"Display name\" },\n file: { type: \"string\", required: true, description: \"Path to credential file\" },\n password: { type: \"string\", description: \"File password (keystore/p12)\" },\n \"key-alias\": { type: \"string\", description: \"Keystore alias\" },\n \"key-password\": { type: \"string\", description: \"Keystore key password\" },\n \"key-id\": { type: \"string\", description: \"ASC API key ID\" },\n \"issuer-id\": { type: \"string\", description: \"ASC API issuer ID\" },\n \"apple-team-identifier\": { type: \"string\", description: \"Apple Team ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n\n const input: {\n readonly platform: \"ios\" | \"android\";\n readonly type: CliCredentialType;\n readonly name: string;\n readonly filePath: string;\n readonly password?: string;\n readonly keyAlias?: string;\n readonly keyPassword?: string;\n readonly keyId?: string;\n readonly issuerId?: string;\n readonly appleTeamIdentifier?: string;\n } = {\n platform: args.platform,\n type: args.type as CliCredentialType,\n name: args.name,\n filePath: args.file,\n ...(args.password === undefined ? {} : { password: args.password }),\n ...(args[\"key-alias\"] === undefined ? {} : { keyAlias: args[\"key-alias\"] }),\n ...(args[\"key-password\"] === undefined ? {} : { keyPassword: args[\"key-password\"] }),\n ...(args[\"key-id\"] === undefined ? {} : { keyId: args[\"key-id\"] }),\n ...(args[\"issuer-id\"] === undefined ? {} : { issuerId: args[\"issuer-id\"] }),\n ...(args[\"apple-team-identifier\"] === undefined\n ? {}\n : { appleTeamIdentifier: args[\"apple-team-identifier\"] }),\n };\n\n const credential = yield* uploadCredential(api, input);\n\n yield* Console.log(\"Credential uploaded successfully.\");\n yield* Console.log(\"\");\n yield* printKeyValue([\n [\"ID\", credential.id],\n [\"Name\", credential.name],\n [\"Platform\", credential.platform],\n [\"Type\", credential.type],\n ]);\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\n\nimport { deleteCommand } from \"./delete\";\nimport { listCommand } from \"./list\";\nimport { uploadCommand } from \"./upload\";\n\nexport const credentialsCommand = defineCommand({\n meta: { name: \"credentials\", description: \"Manage credentials\" },\n subCommands: {\n list: listCommand,\n upload: uploadCommand,\n delete: deleteCommand,\n },\n});\n","import { Data } from \"effect\";\n\nexport class EnvResourceNotFoundError extends Data.TaggedError(\"EnvResourceNotFoundError\")<{\n readonly message: string;\n}> {}\n\nexport const envErrorExtras = {\n EnvResourceNotFoundError: 1,\n SystemError: 6,\n BadArgument: 6,\n} as const;\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { apiClient } from \"../../services/api-client\";\nimport { EnvResourceNotFoundError, envErrorExtras } from \"./helpers\";\n\nexport const deleteCommand = defineCommand({\n meta: { name: \"delete\", description: \"Delete an environment variable by key\" },\n args: {\n key: { type: \"positional\", required: true, description: \"Env var key\" },\n environment: { type: \"string\", default: \"production\", description: \"Target environment\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const existing = yield* api[\"env-vars\"].list({\n urlParams: { projectId, environment: args.environment },\n });\n\n const match = existing.items.find((item) => item.key === args.key);\n\n if (!match) {\n return yield* new EnvResourceNotFoundError({\n message: `Environment variable ${args.key} not found in ${args.environment}`,\n });\n }\n\n yield* api[\"env-vars\"].delete({ path: { id: match.id } });\n yield* Console.log(`Deleted ${args.key} from ${args.environment}`);\n return undefined;\n }),\n envErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { apiClient } from \"../../services/api-client\";\nimport { envErrorExtras } from \"./helpers\";\n\nexport const exportCommand = defineCommand({\n meta: { name: \"export\", description: \"Print env vars in KEY='value' format\" },\n args: {\n environment: { type: \"string\", default: \"production\", description: \"Target environment\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const result = yield* api[\"env-vars\"].export({\n urlParams: { projectId, environment: args.environment },\n });\n\n for (const item of result.items) {\n const escaped = item.value.replaceAll(\"'\", String.raw`'\\''`);\n yield* Console.log(`${item.key}='${escaped}'`);\n }\n }),\n envErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { printKeyValue } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\nimport { envErrorExtras } from \"./helpers\";\n\nexport const getCommand = defineCommand({\n meta: { name: \"get\", description: \"Show an environment variable\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Env var ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const envVar = yield* api[\"env-vars\"].get({ path: { id: args.id } });\n yield* printKeyValue([\n [\"ID\", envVar.id],\n [\"Key\", envVar.key],\n [\"Environment\", envVar.environment],\n [\"Visibility\", envVar.visibility],\n // eslint-disable-next-line eslint-js/no-restricted-syntax -- EnvVar.value nullable at storage; display empty when absent\n [\"Value\", envVar.visibility === \"plaintext\" ? (envVar.value ?? \"\") : \"******\"],\n [\"Created\", envVar.createdAt],\n [\"Updated\", envVar.updatedAt],\n ]);\n }),\n envErrorExtras,\n ),\n});\n","import { FileSystem } from \"@effect/platform\";\nimport { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { apiClient } from \"../../services/api-client\";\nimport { envErrorExtras } from \"./helpers\";\n\nexport const importCommand = defineCommand({\n meta: { name: \"import\", description: \"Bulk-import env vars from a dotenv file\" },\n args: {\n file: { type: \"positional\", required: true, description: \"Path to .env file\" },\n environment: { type: \"string\", default: \"production\", description: \"Target environment\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const content = yield* fs.readFileString(args.file);\n\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const result = yield* api[\"env-vars\"].bulkImport({\n payload: { projectId, environment: args.environment, content, visibility: \"plaintext\" },\n });\n\n yield* Console.log(\n `Imported: ${String(result.created)} created, ${String(result.updated)} updated, ${String(result.skipped)} skipped`,\n );\n }),\n envErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { printTable } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\nimport { envErrorExtras } from \"./helpers\";\n\nexport const listCommand = defineCommand({\n meta: { name: \"list\", description: \"List environment variables\" },\n args: {\n environment: { type: \"string\", description: \"Filter by environment\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const envFilter = args.environment ? { environment: args.environment } : {};\n\n const result = yield* api[\"env-vars\"].list({\n urlParams: { projectId, ...envFilter },\n });\n\n if (result.items.length === 0) {\n yield* Console.log(\"No environment variables found.\");\n return;\n }\n\n yield* printTable(\n [\"Key\", \"Environment\", \"Visibility\", \"Value\"],\n result.items.map((item) => [\n item.key,\n item.environment,\n item.visibility,\n // eslint-disable-next-line eslint-js/no-restricted-syntax -- EnvVar.value nullable at storage; display empty when absent\n item.visibility === \"plaintext\" ? (item.value ?? \"\") : \"••••••\",\n ]),\n );\n }),\n envErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { apiClient } from \"../../services/api-client\";\nimport { envErrorExtras } from \"./helpers\";\n\nexport const pullCommand = defineCommand({\n meta: { name: \"pull\", description: \"Print env vars in `export KEY='value'` format\" },\n args: {\n environment: { type: \"string\", default: \"production\", description: \"Target environment\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const result = yield* api[\"env-vars\"].export({\n urlParams: { projectId, environment: args.environment },\n });\n\n for (const item of result.items) {\n const escaped = item.value.replaceAll(\"'\", String.raw`'\\''`);\n yield* Console.log(`export ${item.key}='${escaped}'`);\n }\n }),\n envErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { parseKeyValue } from \"../../lib/cli-schemas\";\nimport { apiClient } from \"../../services/api-client\";\nimport { envErrorExtras } from \"./helpers\";\n\nexport const setCommand = defineCommand({\n meta: { name: \"set\", description: \"Create or update an environment variable\" },\n args: {\n keyValue: {\n type: \"positional\",\n required: true,\n description: \"KEY=VALUE pair (e.g. API_KEY=abc123)\",\n },\n environment: { type: \"string\", default: \"production\", description: \"Target environment\" },\n visibility: {\n type: \"enum\",\n options: [\"plaintext\", \"sensitive\", \"secret\"],\n default: \"plaintext\",\n description: \"Value visibility\",\n },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const { key, value } = yield* parseKeyValue(args.keyValue);\n const { environment } = args;\n const { visibility } = args;\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const existing = yield* api[\"env-vars\"].list({\n urlParams: { projectId, environment },\n });\n\n const match = existing.items.find((item) => item.key === key);\n\n if (match) {\n yield* api[\"env-vars\"].update({\n path: { id: match.id },\n payload: { value, visibility },\n });\n yield* Console.log(`Updated ${key} in ${environment}`);\n } else {\n yield* api[\"env-vars\"].create({\n payload: { projectId, environment, key, value, visibility },\n });\n yield* Console.log(`Created ${key} in ${environment}`);\n }\n }),\n envErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\n\nimport { deleteCommand } from \"./delete\";\nimport { exportCommand } from \"./export\";\nimport { getCommand } from \"./get\";\nimport { importCommand } from \"./import\";\nimport { listCommand } from \"./list\";\nimport { pullCommand } from \"./pull\";\nimport { setCommand } from \"./set\";\n\nexport const envCommand = defineCommand({\n meta: { name: \"env\", description: \"Manage environment variables\" },\n subCommands: {\n list: listCommand,\n get: getCommand,\n set: setCommand,\n delete: deleteCommand,\n import: importCommand,\n export: exportCommand,\n pull: pullCommand,\n },\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { exitWith } from \"../../application/command-exit\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { runFingerprintFull } from \"../../lib/fingerprint\";\nimport { CliRuntime } from \"../../services/cli-runtime\";\n\nexport const compareCommand = defineCommand({\n meta: { name: \"compare\", description: \"Compare a fingerprint hash against the current project\" },\n args: {\n hash: { type: \"positional\", required: true, description: \"Fingerprint hash to compare\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const runtime = yield* CliRuntime;\n const projectRoot = yield* runtime.cwd;\n const result = yield* runFingerprintFull(projectRoot);\n\n if (result.hash === args.hash) {\n yield* Console.log(\"Fingerprints match.\");\n return undefined;\n }\n yield* Console.log(\"Fingerprints differ.\");\n yield* Console.log(` Local: ${result.hash}`);\n yield* Console.log(` Provided: ${args.hash}`);\n return yield* exitWith(1, \"Fingerprint mismatch\");\n }),\n { FingerprintError: 2 },\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { runFingerprintFull } from \"../../lib/fingerprint\";\nimport { CliRuntime } from \"../../services/cli-runtime\";\n\nexport const generateCommand = defineCommand({\n meta: { name: \"generate\", description: \"Compute a fingerprint for the current project\" },\n run: async () =>\n runEffect(\n Effect.gen(function* () {\n const runtime = yield* CliRuntime;\n const projectRoot = yield* runtime.cwd;\n const result = yield* runFingerprintFull(projectRoot);\n yield* Console.log(result.hash);\n if (result.sources.length > 0) {\n yield* Console.log(`${result.sources.length} sources`);\n }\n }),\n { FingerprintError: 2 },\n ),\n});\n","import { defineCommand } from \"citty\";\n\nimport { compareCommand } from \"./compare\";\nimport { generateCommand } from \"./generate\";\n\nexport const fingerprintCommand = defineCommand({\n meta: { name: \"fingerprint\", description: \"Fingerprint utilities\" },\n subCommands: {\n generate: generateCommand,\n compare: compareCommand,\n },\n});\n","import { asRecord } from \"@better-update/type-guards\";\nimport { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readAppJson, readSlug, writeProjectId } from \"../lib/app-json\";\nimport { asString } from \"../lib/build-profile\";\nimport { runEffect } from \"../lib/citty-effect\";\nimport { apiClient } from \"../services/api-client\";\n\nexport const initCommand = defineCommand({\n meta: { name: \"init\", description: \"Link the local Expo project to a better-update project\" },\n run: async () =>\n runEffect(\n Effect.gen(function* () {\n const appJson = yield* readAppJson;\n const expo = asRecord(appJson[\"expo\"]);\n const name = asString(expo?.[\"name\"]) ?? asString(expo?.[\"slug\"]) ?? \"untitled\";\n const slug = yield* readSlug;\n\n yield* Console.log(`Linking project: ${name} (${slug})`);\n\n const api = yield* apiClient;\n const { items } = yield* api.projects.list({ urlParams: { page: 1, limit: 100 } });\n\n const existing = items.find((project) => project.slug === slug);\n\n if (existing) {\n yield* Console.log(`Found existing project: ${existing.name} (${existing.id})`);\n yield* writeProjectId(existing.id);\n } else {\n yield* Console.log(\"No existing project found. Creating new project...\");\n const project = yield* api.projects.create({ payload: { name, slug } });\n yield* Console.log(`Created project: ${project.name} (${project.id})`);\n yield* writeProjectId(project.id);\n }\n\n yield* Console.log(\"Project linked successfully. ID saved to app.json.\");\n }),\n ),\n});\n","import { createServer } from \"node:http\";\nimport type { IncomingMessage, Server, ServerResponse } from \"node:http\";\n\nimport { isRecord } from \"@better-update/type-guards\";\nimport { Data, Deferred, Duration, Effect } from \"effect\";\n\nexport class BrowserLoginTimeoutError extends Data.TaggedError(\"BrowserLoginTimeoutError\")<{\n readonly message: string;\n}> {}\n\nexport class BrowserLoginSessionClosedError extends Data.TaggedError(\n \"BrowserLoginSessionClosedError\",\n)<{\n readonly message: string;\n}> {}\n\nexport type BrowserLoginError = BrowserLoginSessionClosedError | BrowserLoginTimeoutError;\n\nexport const CALLBACK_PAGE = `<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <title>better-update CLI Login</title>\n <style>\n :root { color-scheme: light dark; font-family: ui-sans-serif, system-ui, sans-serif; }\n body { margin: 0; min-height: 100vh; display: grid; place-items: center; padding: 24px; }\n main { max-width: 32rem; line-height: 1.5; }\n code { font-family: ui-monospace, SFMono-Regular, monospace; }\n </style>\n </head>\n <body>\n <main>\n <h1>Completing CLI login...</h1>\n <p id=\"message\">Finalizing the local session. You can keep this tab open.</p>\n </main>\n <script>\n const message = document.getElementById(\"message\");\n const render = (text) => {\n if (message) message.textContent = text;\n };\n\n const params = new URLSearchParams(window.location.hash.slice(1));\n const token = params.get(\"token\");\n\n if (!token) {\n render(\"Missing token. Return to the CLI and run login again.\");\n } else {\n fetch(\"/callback/token\", {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ token }),\n })\n .then(async (response) => {\n if (!response.ok) {\n const body = await response.text();\n throw new Error(body || \"Callback failed\");\n }\n window.history.replaceState({}, document.title, window.location.pathname);\n render(\"CLI login complete. You can close this tab.\");\n setTimeout(() => window.close(), 300);\n })\n .catch((error) => {\n render(error instanceof Error ? error.message : \"Callback failed.\");\n });\n }\n </script>\n </body>\n</html>`;\n\nexport interface BrowserLoginServer {\n readonly callbackUrl: string;\n readonly waitForToken: Effect.Effect<string, BrowserLoginError>;\n readonly stop: () => void;\n}\n\nexport interface BrowserLoginSession {\n readonly callbackPath: string;\n readonly waitForToken: Effect.Effect<string, BrowserLoginError>;\n readonly handleRequest: (request: Request) => Promise<Response>;\n readonly dispose: () => void;\n}\n\nexport interface CreateBrowserLoginServerOptions {\n readonly timeoutMs?: number;\n}\n\nexport const createBrowserLoginSession = (\n options: CreateBrowserLoginServerOptions = {},\n): BrowserLoginSession => {\n const tokenDeferred = Effect.runSync(Deferred.make<string, BrowserLoginSessionClosedError>());\n const waitForToken = Deferred.await(tokenDeferred).pipe(\n Effect.timeoutFail({\n duration:\n options.timeoutMs === undefined ? Duration.minutes(5) : Duration.millis(options.timeoutMs),\n onTimeout: () =>\n new BrowserLoginTimeoutError({\n message: \"Timed out waiting for browser login to complete.\",\n }),\n }),\n );\n\n const dispose = () => {\n Effect.runSync(\n Deferred.fail(\n tokenDeferred,\n new BrowserLoginSessionClosedError({\n message: \"Browser login session closed.\",\n }),\n ),\n );\n };\n\n return {\n callbackPath: \"/callback\",\n waitForToken,\n handleRequest: async (request) => {\n const url = new URL(request.url);\n\n if (request.method === \"GET\" && url.pathname === \"/callback\") {\n return new Response(CALLBACK_PAGE, {\n headers: { \"content-type\": \"text/html; charset=utf-8\" },\n });\n }\n\n if (request.method === \"POST\" && url.pathname === \"/callback/token\") {\n try {\n const body: unknown = await request.json();\n if (!isRecord(body)) {\n return new Response(\"Invalid callback payload\", { status: 400 });\n }\n const token = typeof body[\"token\"] === \"string\" ? body[\"token\"].trim() : \"\";\n if (token.length === 0) {\n return new Response(\"Missing token\", { status: 400 });\n }\n\n Effect.runSync(Deferred.succeed(tokenDeferred, token));\n return Response.json({ ok: true });\n } catch {\n return new Response(\"Invalid callback payload\", { status: 400 });\n }\n }\n\n return new Response(\"Not found\", { status: 404 });\n },\n dispose,\n };\n};\n\nconst readBody = async (req: IncomingMessage): Promise<Buffer> => {\n const chunks: Buffer[] = [];\n for await (const chunk of req as AsyncIterable<Buffer>) {\n chunks.push(chunk);\n }\n return Buffer.concat(chunks);\n};\n\nconst toFetchRequest = async (req: IncomingMessage, origin: string): Promise<Request> => {\n const url = new URL(req.url ?? \"/\", origin);\n const method = req.method ?? \"GET\";\n const headers = new Headers();\n for (const [key, value] of Object.entries(req.headers)) {\n if (value === undefined) {\n // eslint-disable-next-line no-continue -- forEach would require push-style state mutation; continue keeps the filter inline\n continue;\n }\n if (Array.isArray(value)) {\n for (const entry of value) {\n headers.append(key, entry);\n }\n } else {\n headers.append(key, value);\n }\n }\n const init: RequestInit = { method, headers };\n if (method !== \"GET\" && method !== \"HEAD\") {\n const body = await readBody(req);\n init.body = new Uint8Array(body);\n }\n return new Request(url, init);\n};\n\nconst writeFetchResponse = async (res: ServerResponse, response: Response): Promise<void> => {\n res.statusCode = response.status;\n response.headers.forEach((value, key) => {\n res.setHeader(key, value);\n });\n const body = await response.arrayBuffer();\n res.end(Buffer.from(body));\n};\n\nconst handleIncoming = async (\n req: IncomingMessage,\n res: ServerResponse,\n session: BrowserLoginSession,\n): Promise<void> => {\n try {\n const request = await toFetchRequest(req, \"http://127.0.0.1\");\n const response = await session.handleRequest(request);\n await writeFetchResponse(res, response);\n } catch {\n res.statusCode = 500;\n res.end(\"Local callback failed\");\n }\n};\n\nexport const createBrowserLoginServer = (\n options: CreateBrowserLoginServerOptions = {},\n): BrowserLoginServer => {\n const session = createBrowserLoginSession(options);\n const server: Server = createServer((req, res) => {\n // eslint-disable-next-line promise/prefer-await-to-then -- node createServer callback is sync; rejections already swallowed inside handleIncoming, so .catch here is a safety net, not a control-flow then()\n handleIncoming(req, res, session).catch(() => undefined);\n });\n\n server.listen(0, \"127.0.0.1\");\n const address = server.address();\n const port = address !== null && typeof address === \"object\" ? address.port : 0;\n\n return {\n callbackUrl: `http://127.0.0.1:${port}${session.callbackPath}`,\n waitForToken: session.waitForToken,\n stop: () => {\n session.dispose();\n server.close();\n },\n };\n};\n","import { cancel, isCancel, password, select } from \"@clack/prompts\";\n\nexport const promptPassword = async (message: string): Promise<string> => {\n const value = await password({ message });\n if (isCancel(value)) {\n cancel(\"Operation cancelled.\");\n // eslint-disable-next-line eslint-plugin-unicorn/no-process-exit -- SIGINT at a CLI prompt must terminate the process; throwing would leave Effect runtime stuck\n process.exit(130);\n }\n return value;\n};\n\ntype SelectOption<T> = Parameters<typeof select<T>>[0][\"options\"][number];\n\nexport const promptSelect = async <T>(\n message: string,\n options: readonly SelectOption<T>[],\n): Promise<T> => {\n const value = await select<T>({ message, options: [...options] });\n if (isCancel(value)) {\n cancel(\"Operation cancelled.\");\n // eslint-disable-next-line eslint-plugin-unicorn/no-process-exit -- SIGINT at a CLI prompt must terminate the process; throwing would leave Effect runtime stuck\n process.exit(130);\n }\n return value;\n};\n","import { Command } from \"@effect/platform\";\nimport { Console, Effect } from \"effect\";\n\nimport type { CommandExecutor } from \"@effect/platform\";\n\nimport { createBrowserLoginServer } from \"../lib/browser-login\";\nimport { promptPassword } from \"../lib/prompts\";\nimport { AuthStore } from \"../services/auth-store\";\nimport { CliRuntime } from \"../services/cli-runtime\";\nimport { ConfigStore } from \"../services/config-store\";\n\nconst buildOpenBrowserCommand = (platform: NodeJS.Platform, url: string) => {\n if (platform === \"darwin\") {\n return Command.make(\"open\", url);\n }\n if (platform === \"win32\") {\n return Command.make(\"cmd\", \"/c\", \"start\", \"\", url);\n }\n return Command.make(\"xdg-open\", url);\n};\n\nconst openBrowser = (\n url: string,\n): Effect.Effect<void, never, CliRuntime | CommandExecutor.CommandExecutor> =>\n Effect.gen(function* () {\n const runtime = yield* CliRuntime;\n const command = buildOpenBrowserCommand(runtime.platform, url);\n\n const opened = yield* Command.exitCode(command).pipe(\n Effect.map((code) => code === 0),\n Effect.catchAll(() => Effect.succeed(false)),\n );\n\n if (!opened) {\n yield* Console.log(`Open this URL manually:\\n${url}`);\n }\n });\n\nconst browserLogin = Effect.scoped(\n Effect.gen(function* () {\n const configStore = yield* ConfigStore;\n const authStore = yield* AuthStore;\n const webUrl = yield* configStore.getWebUrl;\n\n const loginServer = yield* Effect.acquireRelease(\n Effect.sync(createBrowserLoginServer),\n (server) => Effect.sync(server.stop),\n );\n\n const loginUrl = `${webUrl}/auth/cli-login?callbackUrl=${encodeURIComponent(loginServer.callbackUrl)}`;\n\n yield* Console.log(\"Opening browser for better-update login...\");\n yield* Console.log(\"\");\n yield* openBrowser(loginUrl);\n\n const token = yield* loginServer.waitForToken;\n yield* authStore.saveToken(token);\n yield* Console.log(\"\");\n yield* Console.log(\"Logged in successfully. Token saved to ~/.better-update/auth.json\");\n }),\n);\n\nconst manualLogin = Effect.gen(function* () {\n yield* Console.log(\"Log in to better-update with an existing API key\");\n yield* Console.log(\"Get your API key from the dashboard > API Keys page\");\n yield* Console.log(\"\");\n\n const token = yield* Effect.promise(async () =>\n promptPassword(\"Paste your API key (from dashboard > API Keys):\"),\n );\n const authStore = yield* AuthStore;\n yield* authStore.saveToken(token);\n yield* Console.log(\"\");\n yield* Console.log(\"Logged in successfully. Token saved to ~/.better-update/auth.json\");\n});\n\nexport const runLogin = (options: { readonly manualApiKey: boolean }) =>\n Effect.gen(function* () {\n if (options.manualApiKey) {\n yield* manualLogin;\n return;\n }\n\n yield* browserLogin;\n });\n","import { defineCommand } from \"citty\";\n\nimport { runLogin } from \"../application/login\";\nimport { runEffect } from \"../lib/citty-effect\";\n\nexport const loginCommand = defineCommand({\n meta: { name: \"login\", description: \"Log in to better-update\" },\n args: {\n \"api-key\": {\n type: \"boolean\",\n description: \"Paste an API key manually instead of opening the browser\",\n },\n },\n run: async ({ args }) => runEffect(runLogin({ manualApiKey: args[\"api-key\"] ?? false })),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../lib/citty-effect\";\nimport { AuthStore } from \"../services/auth-store\";\n\nexport const logoutCommand = defineCommand({\n meta: { name: \"logout\", description: \"Remove the stored auth token\" },\n run: async () =>\n runEffect(\n Effect.gen(function* () {\n const authStore = yield* AuthStore;\n yield* authStore.clearToken;\n yield* Console.log(\"Logged out. Auth token removed.\");\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../lib/citty-effect\";\nimport { printKeyValue, printTable } from \"../lib/output\";\nimport { apiClient } from \"../services/api-client\";\n\nconst listCommand = defineCommand({\n meta: { name: \"list\", description: \"List projects (most recently active first)\" },\n args: {\n query: { type: \"string\", description: \"Substring search on name or slug\" },\n sort: {\n type: \"string\",\n description: \"Sort key: lastActivityAt (default) or name\",\n default: \"lastActivityAt\",\n },\n limit: { type: \"string\", description: \"Page size (default 50, max 100)\", default: \"50\" },\n page: { type: \"string\", description: \"1-based page number\", default: \"1\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const sort = args.sort === \"name\" ? \"name\" : \"lastActivityAt\";\n const { items, total, page } = yield* api.projects.list({\n urlParams: {\n page: Number(args.page),\n limit: Number(args.limit),\n sort,\n ...(args.query ? { query: args.query } : {}),\n },\n });\n\n if (items.length === 0) {\n yield* Console.log(\"No projects found.\");\n return;\n }\n\n yield* printTable(\n [\"ID\", \"Name\", \"Slug\", \"Last activity\"],\n items.map((project) => [project.id, project.name, project.slug, project.lastActivityAt]),\n );\n yield* Console.log(`Page ${page} · ${items.length} of ${total} project(s)`);\n }),\n ),\n});\n\nconst createCommand = defineCommand({\n meta: { name: \"create\", description: \"Create a new project\" },\n args: {\n name: { type: \"string\", required: true, description: \"Display name\" },\n slug: { type: \"string\", required: true, description: \"URL-safe slug\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const project = yield* api.projects.create({\n payload: { name: args.name, slug: args.slug },\n });\n yield* printKeyValue([\n [\"ID\", project.id],\n [\"Name\", project.name],\n [\"Slug\", project.slug],\n [\"Created\", project.createdAt],\n ]);\n }),\n ),\n});\n\nconst getCommand = defineCommand({\n meta: { name: \"get\", description: \"Show a project\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Project ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const project = yield* api.projects.get({ path: { id: args.id } });\n yield* printKeyValue([\n [\"ID\", project.id],\n [\"Name\", project.name],\n [\"Slug\", project.slug],\n [\"Created\", project.createdAt],\n ]);\n }),\n ),\n});\n\nconst renameCommand = defineCommand({\n meta: { name: \"rename\", description: \"Rename a project\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Project ID\" },\n name: { type: \"string\", required: true, description: \"New display name\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const project = yield* api.projects.rename({\n path: { id: args.id },\n payload: { name: args.name },\n });\n yield* Console.log(`Project renamed to \"${project.name}\".`);\n }),\n ),\n});\n\nconst deleteCommand = defineCommand({\n meta: { name: \"delete\", description: \"Delete a project\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Project ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n yield* api.projects.delete({ path: { id: args.id } });\n yield* Console.log(`Project ${args.id} deleted.`);\n }),\n ),\n});\n\nexport const projectsCommand = defineCommand({\n meta: { name: \"projects\", description: \"Manage projects\" },\n subCommands: {\n list: listCommand,\n create: createCommand,\n get: getCommand,\n rename: renameCommand,\n delete: deleteCommand,\n },\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../lib/app-json\";\nimport { runEffect } from \"../lib/citty-effect\";\nimport { listAllCredentials } from \"../lib/credentials-manager\";\nimport { printKeyValue } from \"../lib/output\";\nimport { apiClient } from \"../services/api-client\";\n\nexport const statusCommand = defineCommand({\n meta: { name: \"status\", description: \"Show project status (credentials, builds)\" },\n run: async () =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const { project, credentials, builds } = yield* Effect.all(\n {\n project: api.projects.get({ path: { id: projectId } }),\n credentials: listAllCredentials(api),\n builds: api.builds.list({ urlParams: { projectId } }),\n },\n { concurrency: \"unbounded\" },\n );\n\n yield* Console.log(\"Project\");\n yield* Console.log(\"-------\");\n yield* printKeyValue([\n [\"Name\", project.name],\n [\"ID\", project.id],\n [\"Slug\", project.slug],\n [\"Created\", project.createdAt],\n ]);\n\n yield* Console.log(\"\");\n yield* Console.log(\"Credentials\");\n yield* Console.log(\"-----------\");\n const iosCreds = credentials.filter((cred) => cred.platform === \"ios\").length;\n const androidCreds = credentials.filter((cred) => cred.platform === \"android\").length;\n yield* printKeyValue([\n [\"iOS\", String(iosCreds)],\n [\"Android\", String(androidCreds)],\n [\"Total\", String(credentials.length)],\n ]);\n\n yield* Console.log(\"\");\n yield* Console.log(\"Builds\");\n yield* Console.log(\"------\");\n const moreSuffix = builds.items.length < builds.total ? \"+\" : \"\";\n yield* printKeyValue([\n [\"Recent\", `${String(builds.items.length)}${moreSuffix}`],\n [\"Total\", String(builds.total)],\n ]);\n }),\n ),\n});\n","import { Data } from \"effect\";\n\nimport { resolveNamedResourceId as resolveNamedResourceIdBase } from \"../../lib/resolve-named-resource\";\n\nexport class UpdateCommandError extends Data.TaggedError(\"UpdateCommandError\")<{\n readonly message: string;\n}> {}\n\nexport const updateErrorExtras = {\n UpdateCommandError: 2,\n BuildProfileError: 2,\n RuntimeVersionError: 2,\n UpdateRollbackError: 2,\n UpdatePromoteError: 2,\n} as const;\n\nexport const resolveNamedResourceId = (params: {\n readonly items: readonly { readonly id: string; readonly name: string }[];\n readonly kind: string;\n readonly name: string;\n}) => resolveNamedResourceIdBase(params, (message) => new UpdateCommandError({ message }));\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { apiClient } from \"../../services/api-client\";\nimport { updateErrorExtras } from \"./helpers\";\n\nexport const deleteCommand = defineCommand({\n meta: { name: \"delete\", description: \"Delete an update group\" },\n args: {\n groupId: { type: \"positional\", required: true, description: \"Update group ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const result = yield* api.updates.deleteGroup({ path: { groupId: args.groupId } });\n yield* Console.log(\n `Deleted ${String(result.deleted)} update(s) from group ${args.groupId}.`,\n );\n }),\n updateErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { parseLimit } from \"../../lib/cli-schemas\";\nimport { drainPages } from \"../../lib/drain-cursor\";\nimport { printTable } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\nimport { resolveNamedResourceId, updateErrorExtras } from \"./helpers\";\n\nexport const listCommand = defineCommand({\n meta: { name: \"list\", description: \"List recent updates\" },\n args: {\n branch: { type: \"string\", description: \"Filter by branch name\" },\n limit: { type: \"string\", default: \"20\", description: \"Max rows (default 20)\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const limit = yield* parseLimit(args.limit, 20);\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n const branches = yield* drainPages((page) =>\n api.branches.list({\n urlParams: { projectId, limit: 100, page },\n }),\n );\n\n const branchId = args.branch\n ? yield* resolveNamedResourceId({\n items: branches,\n kind: \"Branch\",\n name: args.branch,\n })\n : undefined;\n\n const { items } = yield* api.updates.list({\n urlParams: {\n projectId,\n ...(branchId === undefined ? {} : { branchId }),\n limit,\n },\n });\n\n if (items.length === 0) {\n yield* Console.log(\"No updates found.\");\n return;\n }\n\n const branchNames = new Map(branches.map((item) => [item.id, item.name]));\n\n yield* printTable(\n [\"Update ID\", \"Group\", \"Branch\", \"Platform\", \"Runtime\", \"Rollout\", \"Rollback\", \"Created\"],\n items.map((item) => [\n item.id,\n item.groupId,\n branchNames.get(item.branchId) ?? item.branchId,\n item.platform,\n item.runtimeVersion,\n `${String(item.rolloutPercentage)}%`,\n item.isRollback ? \"yes\" : \"no\",\n item.createdAt,\n ]),\n );\n }),\n updateErrorExtras,\n ),\n});\n","import { FileSystem } from \"@effect/platform\";\nimport { Effect } from \"effect\";\n\nimport { formatCause } from \"./format-error\";\n\nimport type { Platform } from \"./build-profile\";\n\nexport interface SignedPayload {\n readonly manifestBody: string;\n readonly signature: string;\n readonly certificateChain: string;\n}\n\nexport interface SignedPayloadFileSet {\n readonly manifestBodyFile: string | undefined;\n readonly signatureFile: string | undefined;\n readonly certificateChainFile: string | undefined;\n}\n\nconst emptySignedPayloadFileSet = {\n manifestBodyFile: undefined,\n signatureFile: undefined,\n certificateChainFile: undefined,\n} as const satisfies SignedPayloadFileSet;\n\nconst hasAnySignedPayloadFile = (files: SignedPayloadFileSet) =>\n files.manifestBodyFile !== undefined ||\n files.signatureFile !== undefined ||\n files.certificateChainFile !== undefined;\n\nconst loadSignedPayloadFromFiles = <Err>(params: {\n readonly files: SignedPayloadFileSet;\n readonly label: string;\n readonly makeError: (message: string) => Err;\n}): Effect.Effect<SignedPayload | null, Err, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fileSystem = yield* FileSystem.FileSystem;\n if (!hasAnySignedPayloadFile(params.files)) {\n return null;\n }\n\n if (\n !params.files.manifestBodyFile ||\n !params.files.signatureFile ||\n !params.files.certificateChainFile\n ) {\n return yield* Effect.fail(\n params.makeError(\n `${params.label} requires ${[\n params.files.manifestBodyFile ? null : \"manifest body\",\n params.files.signatureFile ? null : \"signature\",\n params.files.certificateChainFile ? null : \"certificate chain\",\n ]\n .filter(Boolean)\n .join(\", \")} file inputs to be provided as a complete triplet.`,\n ),\n );\n }\n\n const [manifestBody, signature, certificateChain] = yield* Effect.all(\n [\n fileSystem.readFileString(params.files.manifestBodyFile),\n fileSystem.readFileString(params.files.signatureFile),\n fileSystem.readFileString(params.files.certificateChainFile),\n ],\n { concurrency: \"unbounded\" },\n ).pipe(\n Effect.mapError((cause) =>\n params.makeError(`${params.label} failed to read signed inputs: ${formatCause(cause)}`),\n ),\n );\n\n return {\n manifestBody,\n signature: signature.trim(),\n certificateChain: certificateChain.trimEnd(),\n } as const satisfies SignedPayload;\n });\n\nexport const loadOptionalSignedPayload = loadSignedPayloadFromFiles;\n\nexport const loadSignedPublishPayloads = <Err>(params: {\n readonly platforms: readonly Platform[];\n readonly globalFiles: SignedPayloadFileSet;\n readonly platformFiles: Partial<Record<Platform, SignedPayloadFileSet>>;\n readonly makeError: (message: string) => Err;\n}): Effect.Effect<Partial<Record<Platform, SignedPayload>>, Err, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const targetedPlatforms = new Set(params.platforms);\n const nonTargetedPlatforms = ([\"ios\", \"android\"] as const).filter(\n (platform) =>\n !targetedPlatforms.has(platform) &&\n hasAnySignedPayloadFile(params.platformFiles[platform] ?? emptySignedPayloadFileSet),\n );\n if (nonTargetedPlatforms.length > 0) {\n return yield* Effect.fail(\n params.makeError(\n `Signed publish inputs were provided for non-targeted platform(s): ${nonTargetedPlatforms.join(\", \")}.`,\n ),\n );\n }\n\n const hasGlobalFiles = hasAnySignedPayloadFile(params.globalFiles);\n if (\n !hasGlobalFiles &&\n Object.values(params.platformFiles).every((files) => !hasAnySignedPayloadFile(files))\n ) {\n return {};\n }\n\n if (params.platforms.length > 1 && hasGlobalFiles) {\n return yield* Effect.fail(\n params.makeError(\n \"Signed multi-platform publish requires per-platform file sets. Use the --*-ios and --*-android options.\",\n ),\n );\n }\n\n if (params.platforms.length === 1 && hasGlobalFiles) {\n const [platform] = params.platforms;\n if (!platform) {\n return {};\n }\n if (hasAnySignedPayloadFile(params.platformFiles[platform] ?? emptySignedPayloadFileSet)) {\n return yield* Effect.fail(\n params.makeError(\n `Signed publish for ${platform} is ambiguous. Use either the generic file options or the ${platform}-specific file options, not both.`,\n ),\n );\n }\n\n const globalPayload = yield* loadSignedPayloadFromFiles({\n files: params.globalFiles,\n label: \"Signed publish\",\n makeError: params.makeError,\n });\n return globalPayload === null ? {} : { [platform]: globalPayload };\n }\n\n const platformPayloadEntries = yield* Effect.forEach(\n params.platforms,\n (platform) =>\n Effect.gen(function* () {\n const payload = yield* loadSignedPayloadFromFiles({\n files: params.platformFiles[platform] ?? emptySignedPayloadFileSet,\n label: `Signed publish for ${platform}`,\n makeError: params.makeError,\n });\n\n if (payload === null) {\n return yield* Effect.fail(\n params.makeError(\n `Signed multi-platform publish requires a signed payload for ${platform}.`,\n ),\n );\n }\n\n return [platform, payload] as const;\n }),\n { concurrency: 1 },\n );\n\n return Object.fromEntries(platformPayloadEntries) as Partial<Record<Platform, SignedPayload>>;\n });\n","import { Effect } from \"effect\";\n\nimport type { FileSystem } from \"@effect/platform\";\n\nimport { UpdatePromoteError } from \"../lib/exit-codes\";\nimport { formatCause } from \"../lib/format-error\";\nimport { loadOptionalSignedPayload } from \"../lib/signed-payloads\";\nimport { apiClient } from \"../services/api-client\";\n\nimport type { AuthRequiredError } from \"../lib/exit-codes\";\nimport type { ApiClientService } from \"../services/api-client\";\n\nexport interface RunUpdatePromoteOptions {\n readonly updateId: string;\n readonly channel: string;\n readonly manifestBodyFile: string | undefined;\n readonly signatureFile: string | undefined;\n readonly certificateChainFile: string | undefined;\n}\n\nexport interface UpdatePromoteResult {\n readonly sourceUpdateId: string;\n readonly channel: string;\n readonly updateId: string;\n}\n\nexport const runUpdatePromote = (\n options: RunUpdatePromoteOptions,\n): Effect.Effect<\n UpdatePromoteResult,\n AuthRequiredError | UpdatePromoteError,\n ApiClientService | FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const api = yield* apiClient;\n const signedPayload = yield* loadOptionalSignedPayload({\n files: {\n manifestBodyFile: options.manifestBodyFile,\n signatureFile: options.signatureFile,\n certificateChainFile: options.certificateChainFile,\n },\n label: \"Signed promote\",\n makeError: (message) => new UpdatePromoteError({ message }),\n });\n\n const result = yield* api.updates\n .republish({\n payload: {\n sourceUpdateId: options.updateId,\n destinationChannel: options.channel,\n ...(signedPayload\n ? {\n signedUpdates: [\n {\n sourceUpdateId: options.updateId,\n manifestBody: signedPayload.manifestBody,\n signature: signedPayload.signature,\n certificateChain: signedPayload.certificateChain,\n },\n ],\n }\n : {}),\n },\n })\n .pipe(\n Effect.catchIf(\n (cause): cause is Exclude<typeof cause, AuthRequiredError> =>\n (cause as { readonly _tag?: string })._tag !== \"AuthRequiredError\",\n (cause) =>\n new UpdatePromoteError({\n message: `Failed to promote update: ${formatCause(cause)}`,\n }),\n ),\n );\n\n const [promotedUpdate] = result.updates;\n if (!promotedUpdate) {\n return yield* new UpdatePromoteError({\n message: \"Promote completed without returning a promoted update.\",\n });\n }\n\n return {\n sourceUpdateId: options.updateId,\n channel: options.channel,\n updateId: promotedUpdate.id,\n } as const satisfies UpdatePromoteResult;\n });\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runUpdatePromote } from \"../../application/update-promote\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { updateErrorExtras } from \"./helpers\";\n\nexport const promoteCommand = defineCommand({\n meta: { name: \"promote\", description: \"Promote an existing update to a channel\" },\n args: {\n updateId: { type: \"positional\", required: true, description: \"Source update ID\" },\n channel: { type: \"string\", required: true, description: \"Target channel name\" },\n \"manifest-body-file\": { type: \"string\" },\n \"signature-file\": { type: \"string\" },\n \"certificate-chain-file\": { type: \"string\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const result = yield* runUpdatePromote({\n updateId: args.updateId,\n channel: args.channel,\n manifestBodyFile: args[\"manifest-body-file\"],\n signatureFile: args[\"signature-file\"],\n certificateChainFile: args[\"certificate-chain-file\"],\n });\n\n yield* Console.log(\n `Promoted update ${result.sourceUpdateId} to channel \"${result.channel}\" as update ${result.updateId}.`,\n );\n }),\n updateErrorExtras,\n ),\n});\n","import path from \"node:path\";\n\nimport { asRecord } from \"@better-update/type-guards\";\nimport { Command, FileSystem } from \"@effect/platform\";\nimport { Effect } from \"effect\";\n\nimport type { CommandExecutor } from \"@effect/platform\";\n\nimport { CliRuntime } from \"../services/cli-runtime\";\nimport { BuildFailedError, UpdatePublishError } from \"./exit-codes\";\n\nimport type { Platform } from \"./build-profile\";\n\nexport interface ExportedUpdateAssetFile {\n readonly path: string;\n readonly key: string;\n readonly fileExt: string;\n readonly contentType: string;\n readonly isLaunch: boolean;\n}\n\ninterface ReadExpoPublicConfigOptions {\n readonly projectRoot: string;\n readonly envVars: Record<string, string>;\n}\n\ninterface RunExpoExportOptions extends ReadExpoPublicConfigOptions {\n readonly exportDir: string;\n readonly platform: Platform;\n readonly clear: boolean;\n}\n\ninterface ReadExpoExportAssetsOptions {\n readonly exportDir: string;\n readonly platform: Platform;\n}\n\nconst asString = (value: unknown): string | undefined =>\n typeof value === \"string\" ? value : undefined;\n\nconst normalizeExtension = (value: string | undefined): string | undefined => {\n if (!value) {\n return undefined;\n }\n return value.startsWith(\".\") ? value.slice(1) : value;\n};\n\nconst inferContentType = (fileExt: string, isLaunch: boolean): string => {\n const normalized = fileExt.toLowerCase();\n if (isLaunch || normalized === \"js\" || normalized === \"hbc\" || normalized === \"bundle\") {\n return \"application/javascript\";\n }\n\n switch (normalized) {\n case \"png\": {\n return \"image/png\";\n }\n case \"jpg\":\n case \"jpeg\": {\n return \"image/jpeg\";\n }\n case \"webp\": {\n return \"image/webp\";\n }\n case \"gif\": {\n return \"image/gif\";\n }\n case \"svg\": {\n return \"image/svg+xml\";\n }\n case \"json\": {\n return \"application/json\";\n }\n case \"mp4\": {\n return \"video/mp4\";\n }\n case \"mp3\": {\n return \"audio/mpeg\";\n }\n case \"wav\": {\n return \"audio/wav\";\n }\n case \"ttf\": {\n return \"font/ttf\";\n }\n case \"otf\": {\n return \"font/otf\";\n }\n case \"woff\": {\n return \"font/woff\";\n }\n case \"woff2\": {\n return \"font/woff2\";\n }\n default: {\n return \"application/octet-stream\";\n }\n }\n};\n\nconst makeBunxCommand = (...args: readonly string[]): Command.Command =>\n Command.make(\"bunx\", ...args);\n\nconst runCommand = (\n cmd: Command.Command,\n step: string,\n): Effect.Effect<void, BuildFailedError, CommandExecutor.CommandExecutor> =>\n Command.exitCode(cmd.pipe(Command.stdout(\"inherit\"), Command.stderr(\"inherit\"))).pipe(\n Effect.mapError(\n (cause) =>\n new BuildFailedError({\n step,\n exitCode: 1,\n message: `${step} failed to spawn: ${String(cause)}`,\n }),\n ),\n Effect.flatMap((code) =>\n code === 0\n ? Effect.void\n : Effect.fail(\n new BuildFailedError({\n step,\n exitCode: code,\n message: `${step} exited with code ${code}`,\n }),\n ),\n ),\n );\n\nexport const readExpoPublicConfig = ({\n projectRoot,\n envVars,\n}: ReadExpoPublicConfigOptions): Effect.Effect<\n Record<string, unknown>,\n UpdatePublishError,\n CliRuntime | CommandExecutor.CommandExecutor\n> =>\n Effect.gen(function* () {\n const runtime = yield* CliRuntime;\n const commandEnv = yield* runtime.commandEnvironment(envVars);\n const stdout = yield* Command.string(\n makeBunxCommand(\"expo\", \"config\", \"--type\", \"public\", \"--json\").pipe(\n Command.workingDirectory(projectRoot),\n Command.env(commandEnv),\n ),\n ).pipe(\n Effect.mapError(\n (cause) =>\n new UpdatePublishError({\n message: `Failed to read Expo public config: ${String(cause)}`,\n }),\n ),\n );\n\n const parsed = yield* Effect.try({\n try: () => JSON.parse(stdout) as unknown,\n catch: () =>\n new UpdatePublishError({\n message: \"Expo public config output was not valid JSON.\",\n }),\n });\n\n const config = asRecord(parsed);\n if (!config) {\n return yield* new UpdatePublishError({\n message: \"Expo public config did not decode to a JSON object.\",\n });\n }\n\n return config;\n });\n\nexport const runExpoExport = ({\n projectRoot,\n exportDir,\n platform,\n envVars,\n clear,\n}: RunExpoExportOptions): Effect.Effect<\n void,\n BuildFailedError,\n CliRuntime | CommandExecutor.CommandExecutor\n> =>\n Effect.gen(function* () {\n const runtime = yield* CliRuntime;\n const commandEnv = yield* runtime.commandEnvironment(envVars);\n const args = [\n \"expo\",\n \"export\",\n \"--platform\",\n platform,\n \"--output-dir\",\n exportDir,\n \"--dump-assetmap\",\n ];\n if (clear) {\n args.push(\"--clear\");\n }\n\n return yield* runCommand(\n makeBunxCommand(...args).pipe(Command.workingDirectory(projectRoot), Command.env(commandEnv)),\n `expo export ${platform}`,\n );\n });\n\nexport const readExpoExportAssets = ({\n exportDir,\n platform,\n}: ReadExpoExportAssetsOptions): Effect.Effect<\n readonly ExportedUpdateAssetFile[],\n UpdatePublishError,\n FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const metadataPath = path.join(exportDir, \"metadata.json\");\n const metadataText = yield* fs.readFileString(metadataPath).pipe(\n Effect.mapError(\n () =>\n new UpdatePublishError({\n message: `Expected Expo export metadata at ${metadataPath}.`,\n }),\n ),\n );\n\n const metadata = yield* Effect.try({\n try: () => JSON.parse(metadataText) as unknown,\n catch: () =>\n new UpdatePublishError({\n message: `Failed to parse ${metadataPath} as JSON.`,\n }),\n });\n\n const platformMetadata = asRecord(asRecord(asRecord(metadata)?.[\"fileMetadata\"])?.[platform]);\n const bundlePath = asString(platformMetadata?.[\"bundle\"]);\n if (!bundlePath) {\n return yield* new UpdatePublishError({\n message: `Expo export did not contain a bundle path for platform \"${platform}\".`,\n });\n }\n\n const bundleExt = normalizeExtension(path.extname(bundlePath)) ?? \"js\";\n const rawAssets = Array.isArray(platformMetadata?.[\"assets\"]) ? platformMetadata[\"assets\"] : [];\n\n // eslint-disable-next-line unicorn/no-array-method-this-argument -- Effect.forEach, not Array.prototype.forEach; the second arg is a mapping effect, not a thisArg\n const assets = yield* Effect.forEach(rawAssets, (rawAsset, index) =>\n Effect.gen(function* () {\n const asset = asRecord(rawAsset);\n const assetPath = asString(asset?.[\"path\"]);\n if (!assetPath) {\n return yield* new UpdatePublishError({\n message: `Expo export asset #${String(index + 1)} is missing its \"path\" field.`,\n });\n }\n\n const fileExt =\n normalizeExtension(asString(asset?.[\"ext\"])) ??\n normalizeExtension(path.extname(assetPath)) ??\n \"bin\";\n\n return {\n path: path.join(exportDir, assetPath),\n key: path.posix.basename(assetPath),\n fileExt,\n contentType: inferContentType(fileExt, false),\n isLaunch: false,\n } as const satisfies ExportedUpdateAssetFile;\n }),\n );\n\n return [\n {\n path: path.join(exportDir, bundlePath),\n key: path.posix.basename(bundlePath),\n fileExt: bundleExt,\n contentType: inferContentType(bundleExt, true),\n isLaunch: true,\n } as const satisfies ExportedUpdateAssetFile,\n ...assets,\n ] as const;\n });\n","import { asRecord } from \"@better-update/type-guards\";\n\nimport type { Platform } from \"./build-profile\";\n\nexport type UpdatePlatformOption = Platform | \"all\";\n\nexport const resolveUpdatePlatforms = (\n appJson: Record<string, unknown>,\n requestedPlatform: UpdatePlatformOption,\n): readonly Platform[] => {\n if (requestedPlatform !== \"all\") {\n return [requestedPlatform] as const;\n }\n\n const expo = asRecord(appJson[\"expo\"]);\n return ([\"ios\", \"android\"] as const).filter(\n (platform) => asRecord(expo?.[platform]) !== undefined,\n );\n};\n","import { randomUUID } from \"node:crypto\";\nimport path from \"node:path\";\n\nimport { fromHex, toBase64Url } from \"@better-update/encoding\";\nimport { Effect } from \"effect\";\nimport { uniqBy } from \"es-toolkit\";\n\nimport type { CommandExecutor, FileSystem } from \"@effect/platform\";\n\nimport { readAppJson, readProjectId, readSlug } from \"../lib/app-json\";\nimport { readRuntimeVersionMeta } from \"../lib/build-profile\";\nimport { pullEnvVars } from \"../lib/env-exporter\";\nimport { UpdatePublishError } from \"../lib/exit-codes\";\nimport { readExpoExportAssets, readExpoPublicConfig, runExpoExport } from \"../lib/expo-export\";\nimport { formatCause } from \"../lib/format-error\";\nimport { readGitContext } from \"../lib/git-context\";\nimport { resolveRuntimeVersion } from \"../lib/runtime-version\";\nimport { sha256File, sha256Namespaced } from \"../lib/sha256\";\nimport { loadSignedPublishPayloads } from \"../lib/signed-payloads\";\nimport { acquireBuildTempDir } from \"../lib/temp-dir\";\nimport { resolveUpdatePlatforms } from \"../lib/update-platforms\";\nimport { apiClient } from \"../services/api-client\";\nimport { CliRuntime } from \"../services/cli-runtime\";\nimport { UpdateAssetUploader } from \"../services/update-asset-uploader\";\n\nimport type { Platform } from \"../lib/build-profile\";\nimport type {\n AuthRequiredError,\n BuildProfileError,\n BuildFailedError,\n ProjectNotLinkedError,\n EnvExportError,\n RuntimeVersionError,\n} from \"../lib/exit-codes\";\nimport type { SignedPayload } from \"../lib/signed-payloads\";\nimport type { ApiClientService } from \"../services/api-client\";\n\nexport interface RunUpdatePublishOptions {\n readonly branch: string | undefined;\n readonly platform: Platform | \"all\";\n readonly message: string | undefined;\n readonly auto: boolean;\n readonly environment: string;\n readonly clear: boolean;\n readonly rolloutPercentage: number | undefined;\n readonly manifestBodyFile: string | undefined;\n readonly signatureFile: string | undefined;\n readonly certificateChainFile: string | undefined;\n readonly manifestBodyFileIos: string | undefined;\n readonly signatureFileIos: string | undefined;\n readonly certificateChainFileIos: string | undefined;\n readonly manifestBodyFileAndroid: string | undefined;\n readonly signatureFileAndroid: string | undefined;\n readonly certificateChainFileAndroid: string | undefined;\n}\n\nexport interface PublishedPlatformResult {\n readonly platform: Platform;\n readonly updateId: string;\n readonly runtimeVersion: string;\n readonly uploadedAssets: number;\n readonly deduplicatedAssets: number;\n}\n\nexport interface PublishUpdatesResult {\n readonly groupId: string;\n readonly branch: string;\n readonly results: readonly PublishedPlatformResult[];\n}\n\ninterface PreparedAsset {\n readonly path: string;\n readonly key: string;\n readonly hash: string;\n readonly contentChecksum: string;\n readonly byteSize: number;\n readonly contentType: string;\n readonly fileExt: string;\n readonly isLaunch: boolean;\n}\n\nconst buildUpdateExtra = (\n expoClient: Record<string, unknown>,\n projectId: string,\n environment: string,\n) => ({\n expoClient,\n eas: { projectId },\n environment,\n});\n\nconst dedupeAssetsByHash = (assets: readonly PreparedAsset[]): readonly PreparedAsset[] =>\n uniqBy(assets, (asset) => asset.hash);\n\nconst preparePlatformAssets = ({\n exportDir,\n platform,\n}: {\n readonly exportDir: string;\n readonly platform: Platform;\n}): Effect.Effect<\n readonly PreparedAsset[],\n UpdatePublishError | BuildFailedError,\n FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const exportedAssets = yield* readExpoExportAssets({ exportDir, platform });\n return yield* Effect.forEach(\n exportedAssets,\n (asset) =>\n sha256File(asset.path).pipe(\n Effect.map(({ sha256: contentSha256Hex, byteSize }) => ({\n ...asset,\n hash: sha256Namespaced(asset.contentType, contentSha256Hex),\n contentChecksum: toBase64Url(fromHex(contentSha256Hex)),\n byteSize,\n })),\n ),\n { concurrency: 4 },\n );\n });\n\nconst publishPlatform = (params: {\n readonly projectRoot: string;\n readonly exportDir: string;\n readonly projectId: string;\n readonly slug: string;\n readonly branch: string;\n readonly groupId: string;\n readonly message: string;\n readonly environment: string;\n readonly environmentVars: Record<string, string>;\n readonly expoClientConfig: Record<string, unknown>;\n readonly clear: boolean;\n readonly appJson: Record<string, unknown>;\n readonly platform: Platform;\n readonly signedPayload: SignedPayload | null;\n readonly rolloutPercentage: number | undefined;\n}): Effect.Effect<\n PublishedPlatformResult,\n | AuthRequiredError\n | UpdatePublishError\n | BuildProfileError\n | BuildFailedError\n | RuntimeVersionError,\n | ApiClientService\n | CliRuntime\n | UpdateAssetUploader\n | CommandExecutor.CommandExecutor\n | FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const api = yield* apiClient;\n const assetUploader = yield* UpdateAssetUploader;\n\n const runtimeVersionMeta = yield* readRuntimeVersionMeta(params.appJson);\n const runtimeVersion = yield* resolveRuntimeVersion({\n raw: runtimeVersionMeta.rawRuntimeVersion,\n appVersion: runtimeVersionMeta.appVersion,\n projectRoot: params.projectRoot,\n });\n\n yield* runExpoExport({\n projectRoot: params.projectRoot,\n exportDir: params.exportDir,\n platform: params.platform,\n envVars: params.environmentVars,\n clear: params.clear,\n });\n\n const preparedAssets = yield* preparePlatformAssets({\n exportDir: params.exportDir,\n platform: params.platform,\n });\n const uniqueAssets = dedupeAssetsByHash(preparedAssets);\n\n const assetRegistration = yield* api.assets\n .upload({\n payload: {\n projectId: params.projectId,\n assets: uniqueAssets.map((asset) => ({\n hash: asset.hash,\n contentType: asset.contentType,\n fileExt: asset.fileExt,\n contentChecksum: asset.contentChecksum,\n })),\n },\n })\n .pipe(\n Effect.mapError(\n (cause) =>\n new UpdatePublishError({\n message: `Failed to register ${params.platform} assets: ${formatCause(cause)}`,\n }),\n ),\n );\n\n const uploadDetailsByHash = new Map(\n assetRegistration.uploaded.map((asset) => [asset.hash, asset] as const),\n );\n yield* Effect.forEach(\n uniqueAssets.filter((asset) => uploadDetailsByHash.has(asset.hash)),\n (asset) =>\n Effect.gen(function* () {\n const detail = uploadDetailsByHash.get(asset.hash);\n if (!detail) {\n return yield* Effect.fail(\n new UpdatePublishError({\n message: `Missing upload details for asset ${asset.hash}`,\n }),\n );\n }\n return yield* assetUploader.uploadAssetBinary({\n path: asset.path,\n hash: asset.hash,\n byteSize: asset.byteSize,\n uploadUrl: detail.uploadUrl,\n uploadExpiresAt: detail.uploadExpiresAt,\n uploadHeaders: detail.uploadHeaders,\n });\n }),\n { concurrency: 4 },\n );\n\n const update = yield* api.updates\n .create({\n payload: {\n branch: params.branch,\n slug: params.slug,\n runtimeVersion,\n platform: params.platform,\n message: params.message,\n groupId: params.groupId,\n metadata: {},\n extra: buildUpdateExtra(params.expoClientConfig, params.projectId, params.environment),\n assets: preparedAssets.map((asset) => ({\n hash: asset.hash,\n key: asset.key,\n isLaunch: asset.isLaunch,\n contentChecksum: asset.contentChecksum,\n })),\n ...(params.signedPayload\n ? {\n manifestBody: params.signedPayload.manifestBody,\n signature: params.signedPayload.signature,\n certificateChain: params.signedPayload.certificateChain,\n }\n : {}),\n ...(params.rolloutPercentage === undefined\n ? {}\n : { rolloutPercentage: params.rolloutPercentage }),\n },\n })\n .pipe(\n Effect.mapError(\n (cause) =>\n new UpdatePublishError({\n message: `Failed to publish ${params.platform} update: ${formatCause(cause)}`,\n }),\n ),\n );\n\n return {\n platform: params.platform,\n updateId: update.id,\n runtimeVersion,\n uploadedAssets: assetRegistration.uploaded.length,\n deduplicatedAssets: assetRegistration.deduplicated.length,\n } as const satisfies PublishedPlatformResult;\n });\n\nexport const runUpdatePublish = (\n options: RunUpdatePublishOptions,\n): Effect.Effect<\n PublishUpdatesResult,\n | AuthRequiredError\n | UpdatePublishError\n | ProjectNotLinkedError\n | BuildProfileError\n | RuntimeVersionError\n | EnvExportError\n | BuildFailedError,\n | ApiClientService\n | CliRuntime\n | UpdateAssetUploader\n | CommandExecutor.CommandExecutor\n | FileSystem.FileSystem\n> =>\n Effect.scoped(\n // eslint-disable-next-line eslint/max-statements -- update publish orchestration is inherently sequential (read config → resolve runtime version → expo export → register assets → publish per platform); splitting further fragments the pipeline without improving readability\n Effect.gen(function* () {\n const runtime = yield* CliRuntime;\n const projectRoot = yield* runtime.cwd;\n const api = yield* apiClient;\n\n const projectId = yield* readProjectId;\n const slug = yield* readSlug;\n const appJson = yield* readAppJson;\n const platforms = resolveUpdatePlatforms(appJson, options.platform);\n if (platforms.length === 0) {\n return yield* new UpdatePublishError({\n message:\n 'No publishable platforms found in app.json. Add an \"expo.ios\" or \"expo.android\" section, or pass --platform explicitly.',\n });\n }\n\n const environmentVars = yield* pullEnvVars(api, {\n projectId,\n environment: options.environment,\n });\n const expoClientConfig = yield* readExpoPublicConfig({\n projectRoot,\n envVars: environmentVars,\n });\n const tempDir = yield* acquireBuildTempDir.pipe(\n Effect.mapError(\n (cause) =>\n new UpdatePublishError({\n message: `Failed to create a temporary export directory: ${formatCause(cause)}`,\n }),\n ),\n );\n let resolvedBranch = options.branch;\n let resolvedMessage = options.message;\n\n if (options.auto) {\n const gitContext = yield* readGitContext(projectRoot);\n if (!resolvedBranch) {\n if (!gitContext.ref) {\n return yield* new UpdatePublishError({\n message:\n \"Cannot infer branch from git. Ensure you are in a git repo with a checked-out branch, or provide --branch explicitly.\",\n });\n }\n resolvedBranch = gitContext.ref;\n }\n if (!resolvedMessage && gitContext.commitMessage) {\n resolvedMessage = gitContext.commitMessage;\n }\n }\n\n if (!resolvedBranch) {\n return yield* new UpdatePublishError({\n message: \"Missing --branch. Provide it explicitly or use --auto to infer from git.\",\n });\n }\n\n const branch = resolvedBranch;\n const groupId = randomUUID();\n const message = resolvedMessage ?? \"Publish via better-update CLI\";\n const signedPayloads = yield* loadSignedPublishPayloads({\n platforms,\n globalFiles: {\n manifestBodyFile: options.manifestBodyFile,\n signatureFile: options.signatureFile,\n certificateChainFile: options.certificateChainFile,\n },\n platformFiles: {\n ios: {\n manifestBodyFile: options.manifestBodyFileIos,\n signatureFile: options.signatureFileIos,\n certificateChainFile: options.certificateChainFileIos,\n },\n android: {\n manifestBodyFile: options.manifestBodyFileAndroid,\n signatureFile: options.signatureFileAndroid,\n certificateChainFile: options.certificateChainFileAndroid,\n },\n },\n makeError: (errorMessage) => new UpdatePublishError({ message: errorMessage }),\n });\n const results = yield* Effect.forEach(\n platforms,\n (platform) =>\n publishPlatform({\n projectRoot,\n exportDir: path.join(tempDir, `export-${platform}`),\n projectId,\n slug,\n branch,\n groupId,\n message,\n environment: options.environment,\n environmentVars,\n expoClientConfig,\n clear: options.clear,\n appJson,\n platform,\n // eslint-disable-next-line eslint-js/no-restricted-syntax -- signedPayload absence means unsigned; null is correct downstream\n signedPayload: signedPayloads[platform] ?? null,\n rolloutPercentage: options.rolloutPercentage,\n }),\n { concurrency: 1 },\n );\n\n return {\n groupId,\n branch,\n results,\n } as const satisfies PublishUpdatesResult;\n }),\n );\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runUpdatePublish } from \"../../application/update-publish\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { parseRolloutPercentage } from \"../../lib/cli-schemas\";\nimport { printTable } from \"../../lib/output\";\n\nconst PUBLISH_EXIT_EXTRAS = {\n BuildProfileError: 2,\n RuntimeVersionError: 2,\n EnvExportError: 7,\n BuildFailedError: 6,\n UpdatePublishError: 7,\n} as const;\n\nexport const publishCommand = defineCommand({\n meta: { name: \"publish\", description: \"Publish a new OTA update group\" },\n args: {\n branch: { type: \"string\", description: \"Target branch name\" },\n platform: {\n type: \"enum\",\n options: [\"ios\", \"android\", \"all\"],\n default: \"all\",\n description: \"Platform(s) to publish\",\n },\n message: { type: \"string\", description: \"Optional update message\" },\n environment: { type: \"string\", default: \"production\", description: \"Env vars scope\" },\n auto: { type: \"boolean\", description: \"Skip prompts (for CI)\" },\n clear: { type: \"boolean\", description: \"Drop existing assets before upload\" },\n \"rollout-percentage\": { type: \"string\", description: \"Initial rollout percentage (1-100)\" },\n \"manifest-body-file\": { type: \"string\" },\n \"signature-file\": { type: \"string\" },\n \"certificate-chain-file\": { type: \"string\" },\n \"manifest-body-file-ios\": { type: \"string\" },\n \"signature-file-ios\": { type: \"string\" },\n \"certificate-chain-file-ios\": { type: \"string\" },\n \"manifest-body-file-android\": { type: \"string\" },\n \"signature-file-android\": { type: \"string\" },\n \"certificate-chain-file-android\": { type: \"string\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const rolloutPercentage = args[\"rollout-percentage\"]\n ? yield* parseRolloutPercentage(args[\"rollout-percentage\"], \"rollout-percentage\")\n : undefined;\n\n const result = yield* runUpdatePublish({\n branch: args.branch,\n platform: args.platform,\n message: args.message,\n auto: args.auto ?? false,\n environment: args.environment,\n clear: args.clear ?? false,\n rolloutPercentage,\n manifestBodyFile: args[\"manifest-body-file\"],\n signatureFile: args[\"signature-file\"],\n certificateChainFile: args[\"certificate-chain-file\"],\n manifestBodyFileIos: args[\"manifest-body-file-ios\"],\n signatureFileIos: args[\"signature-file-ios\"],\n certificateChainFileIos: args[\"certificate-chain-file-ios\"],\n manifestBodyFileAndroid: args[\"manifest-body-file-android\"],\n signatureFileAndroid: args[\"signature-file-android\"],\n certificateChainFileAndroid: args[\"certificate-chain-file-android\"],\n });\n\n yield* Console.log(\n `Published update group ${result.groupId} to branch \"${result.branch}\".`,\n );\n yield* Console.log(\"\");\n yield* printTable(\n [\"Platform\", \"Update ID\", \"Runtime Version\", \"Uploaded\", \"Reused\"],\n result.results.map((entry) => [\n entry.platform,\n entry.updateId,\n entry.runtimeVersion,\n String(entry.uploadedAssets),\n String(entry.deduplicatedAssets),\n ]),\n );\n }),\n PUBLISH_EXIT_EXTRAS,\n ),\n});\n","export const buildRollbackDirectiveBody = (commitTime: string): string =>\n JSON.stringify({\n type: \"rollBackToEmbedded\",\n parameters: {\n commitTime,\n },\n });\n","import { randomUUID } from \"node:crypto\";\n\nimport { buildRollbackDirectiveBody } from \"@better-update/expo-protocol\";\nimport { isRecord } from \"@better-update/type-guards\";\nimport { FileSystem } from \"@effect/platform\";\nimport { Effect } from \"effect\";\n\nimport type { CommandExecutor } from \"@effect/platform\";\n\nimport { readAppJson, readProjectId, readSlug } from \"../lib/app-json\";\nimport { readRuntimeVersionMeta } from \"../lib/build-profile\";\nimport { UpdateRollbackError } from \"../lib/exit-codes\";\nimport { formatCause } from \"../lib/format-error\";\nimport { resolveRuntimeVersion } from \"../lib/runtime-version\";\nimport { resolveUpdatePlatforms } from \"../lib/update-platforms\";\nimport { apiClient } from \"../services/api-client\";\nimport { CliRuntime } from \"../services/cli-runtime\";\n\nimport type { Platform } from \"../lib/build-profile\";\nimport type {\n AuthRequiredError,\n BuildProfileError,\n ProjectNotLinkedError,\n RuntimeVersionError,\n} from \"../lib/exit-codes\";\nimport type { UpdatePlatformOption } from \"../lib/update-platforms\";\nimport type { ApiClientService } from \"../services/api-client\";\n\ninterface CreateRollbackParams {\n readonly branch: string;\n readonly projectSlug: string;\n readonly runtimeVersion: string;\n readonly platform: Platform;\n readonly message: string;\n readonly groupId: string;\n readonly directiveBody: string;\n readonly signature: string | undefined;\n readonly certificateChain: string | undefined;\n}\n\nexport interface RollbackResultItem {\n readonly platform: Platform;\n readonly updateId: string;\n readonly runtimeVersion: string;\n}\n\nexport interface RunUpdateRollbackOptions {\n readonly branch: string;\n readonly platform: UpdatePlatformOption;\n readonly message: string | undefined;\n readonly commitTime: string | undefined;\n readonly directiveBodyFile: string | undefined;\n readonly signatureFile: string | undefined;\n readonly certificateChainFile: string | undefined;\n}\n\nexport interface UpdateRollbackResult {\n readonly groupId: string;\n readonly branch: string;\n readonly commitTime: string;\n readonly results: readonly RollbackResultItem[];\n}\n\ninterface SignedRollbackPayload {\n readonly directiveBody: string;\n readonly signature: string;\n readonly certificateChain: string;\n}\n\nconst resolveCommitTime = (input: string | undefined): Effect.Effect<string, UpdateRollbackError> =>\n Effect.gen(function* () {\n const commitTime = input ?? new Date().toISOString();\n if (Number.isNaN(Date.parse(commitTime))) {\n return yield* new UpdateRollbackError({\n message: \"commitTime must be a valid ISO 8601 timestamp.\",\n });\n }\n return commitTime;\n });\n\nconst extractDirectiveCommitTime = (\n directiveBody: string,\n): Effect.Effect<string, UpdateRollbackError> =>\n Effect.gen(function* () {\n const directive = yield* Effect.try({\n try: (): unknown => JSON.parse(directiveBody),\n catch: () =>\n new UpdateRollbackError({\n message: \"directiveBody must be valid JSON.\",\n }),\n });\n\n if (!isRecord(directive)) {\n return yield* new UpdateRollbackError({\n message: \"directiveBody must decode to a JSON object.\",\n });\n }\n\n if (directive[\"type\"] !== \"rollBackToEmbedded\") {\n return yield* new UpdateRollbackError({\n message: 'directiveBody.type must be \"rollBackToEmbedded\".',\n });\n }\n\n const { parameters } = directive;\n if (!isRecord(parameters)) {\n return yield* new UpdateRollbackError({\n message: \"directiveBody.parameters must be an object.\",\n });\n }\n\n const { commitTime } = parameters;\n if (typeof commitTime !== \"string\" || Number.isNaN(Date.parse(commitTime))) {\n return yield* new UpdateRollbackError({\n message: \"directiveBody.parameters.commitTime must be a valid ISO 8601 timestamp.\",\n });\n }\n\n return commitTime;\n });\n\nconst loadOptionalSignedRollbackPayload = (\n options: RunUpdateRollbackOptions,\n): Effect.Effect<SignedRollbackPayload | null, UpdateRollbackError, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fileSystem = yield* FileSystem.FileSystem;\n const hasAnySigningInput =\n options.directiveBodyFile !== undefined ||\n options.signatureFile !== undefined ||\n options.certificateChainFile !== undefined;\n\n if (!hasAnySigningInput) {\n return null;\n }\n\n if (!options.directiveBodyFile || !options.signatureFile || !options.certificateChainFile) {\n return yield* new UpdateRollbackError({\n message:\n \"Signed rollback requires --directive-body-file, --signature-file, and --certificate-chain-file together.\",\n });\n }\n\n const [directiveBody, signature, certificateChain] = yield* Effect.all(\n [\n fileSystem.readFileString(options.directiveBodyFile),\n fileSystem.readFileString(options.signatureFile),\n fileSystem.readFileString(options.certificateChainFile),\n ],\n { concurrency: \"unbounded\" },\n ).pipe(\n Effect.mapError(\n (cause) =>\n new UpdateRollbackError({\n message: `Failed to read signed rollback inputs: ${formatCause(cause)}`,\n }),\n ),\n );\n\n return {\n directiveBody,\n signature: signature.trim(),\n certificateChain: certificateChain.trimEnd(),\n } satisfies SignedRollbackPayload;\n });\n\nconst createRollbackForPlatform = (\n params: CreateRollbackParams,\n): Effect.Effect<RollbackResultItem, AuthRequiredError | UpdateRollbackError, ApiClientService> =>\n Effect.gen(function* () {\n const api = yield* apiClient;\n const update = yield* api.updates\n .create({\n payload: {\n branch: params.branch,\n slug: params.projectSlug,\n runtimeVersion: params.runtimeVersion,\n platform: params.platform,\n message: params.message,\n groupId: params.groupId,\n metadata: {},\n assets: [],\n isRollback: true,\n directiveBody: params.directiveBody,\n ...(params.signature ? { signature: params.signature } : {}),\n ...(params.certificateChain ? { certificateChain: params.certificateChain } : {}),\n },\n })\n .pipe(\n Effect.mapError(\n (cause) =>\n new UpdateRollbackError({\n message: `Failed to create ${params.platform} rollback: ${formatCause(cause)}`,\n }),\n ),\n );\n\n return {\n platform: params.platform,\n updateId: update.id,\n runtimeVersion: params.runtimeVersion,\n } as const satisfies RollbackResultItem;\n });\n\nexport const runUpdateRollback = (\n options: RunUpdateRollbackOptions,\n): Effect.Effect<\n UpdateRollbackResult,\n | AuthRequiredError\n | ProjectNotLinkedError\n | BuildProfileError\n | RuntimeVersionError\n | UpdateRollbackError,\n ApiClientService | CliRuntime | CommandExecutor.CommandExecutor | FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const runtime = yield* CliRuntime;\n const projectRoot = yield* runtime.cwd;\n yield* readProjectId;\n const projectSlug = yield* readSlug;\n const appJson = yield* readAppJson;\n const platforms = resolveUpdatePlatforms(appJson, options.platform);\n if (platforms.length === 0) {\n return yield* new UpdateRollbackError({\n message:\n 'No publishable platforms found in app.json. Add an \"expo.ios\" or \"expo.android\" section, or pass --platform explicitly.',\n });\n }\n\n const { appVersion, rawRuntimeVersion } = yield* readRuntimeVersionMeta(appJson);\n const runtimeVersion = yield* resolveRuntimeVersion({\n raw: rawRuntimeVersion,\n appVersion,\n projectRoot,\n });\n const signedPayload = yield* loadOptionalSignedRollbackPayload(options);\n const commitTime = signedPayload\n ? yield* Effect.gen(function* () {\n const directiveCommitTime = yield* extractDirectiveCommitTime(\n signedPayload.directiveBody,\n );\n if (options.commitTime && options.commitTime !== directiveCommitTime) {\n return yield* new UpdateRollbackError({\n message: \"commitTime must match directiveBody.parameters.commitTime in signed mode.\",\n });\n }\n return directiveCommitTime;\n })\n : yield* resolveCommitTime(options.commitTime);\n const groupId = randomUUID();\n const message = options.message ?? \"Rollback to embedded via better-update CLI\";\n\n const results = yield* Effect.forEach(\n platforms,\n (platform) =>\n createRollbackForPlatform({\n branch: options.branch,\n projectSlug,\n runtimeVersion,\n platform,\n message,\n groupId,\n directiveBody: signedPayload?.directiveBody ?? buildRollbackDirectiveBody(commitTime),\n signature: signedPayload?.signature,\n certificateChain: signedPayload?.certificateChain,\n }),\n { concurrency: 1 },\n );\n\n return {\n groupId,\n branch: options.branch,\n commitTime,\n results,\n } as const satisfies UpdateRollbackResult;\n });\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runUpdateRollback } from \"../../application/update-rollback\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { printTable } from \"../../lib/output\";\nimport { updateErrorExtras } from \"./helpers\";\n\nexport const rollbackCommand = defineCommand({\n meta: { name: \"rollback\", description: \"Roll back updates on a branch\" },\n args: {\n branch: { type: \"string\", required: true, description: \"Branch to roll back\" },\n platform: {\n type: \"enum\",\n options: [\"ios\", \"android\", \"all\"],\n default: \"all\",\n description: \"Platform(s) to roll back\",\n },\n message: { type: \"string\" },\n \"commit-time\": { type: \"string\" },\n \"directive-body-file\": { type: \"string\" },\n \"signature-file\": { type: \"string\" },\n \"certificate-chain-file\": { type: \"string\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const result = yield* runUpdateRollback({\n branch: args.branch,\n platform: args.platform,\n message: args.message,\n commitTime: args[\"commit-time\"],\n directiveBodyFile: args[\"directive-body-file\"],\n signatureFile: args[\"signature-file\"],\n certificateChainFile: args[\"certificate-chain-file\"],\n });\n\n yield* Console.log(\n `Created rollback group ${result.groupId} on branch \"${result.branch}\" at ${result.commitTime}.`,\n );\n yield* Console.log(\"\");\n yield* printTable(\n [\"Platform\", \"Update ID\", \"Runtime Version\"],\n result.results.map((entry) => [entry.platform, entry.updateId, entry.runtimeVersion]),\n );\n }),\n updateErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../../lib/citty-effect\";\nimport { apiClient } from \"../../../services/api-client\";\nimport { updateErrorExtras } from \"../helpers\";\n\nexport const completeCommand = defineCommand({\n meta: { name: \"complete\", description: \"Complete the rollout for an update\" },\n args: {\n updateId: { type: \"positional\", required: true, description: \"Update ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const result = yield* api.updates.completeRollout({ path: { id: args.updateId } });\n yield* Console.log(\n `Completed rollout for ${args.updateId}. Current rollout is ${String(result.rolloutPercentage)}%.`,\n );\n }),\n updateErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../../lib/citty-effect\";\nimport { apiClient } from \"../../../services/api-client\";\nimport { updateErrorExtras } from \"../helpers\";\n\nexport const revertCommand = defineCommand({\n meta: { name: \"revert\", description: \"Revert the rollout for an update\" },\n args: {\n updateId: { type: \"positional\", required: true, description: \"Update ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const result = yield* api.updates.revertRollout({ path: { id: args.updateId } });\n yield* Console.log(\n `Reverted rollout for ${args.updateId}. Current rollout is ${String(result.rolloutPercentage)}%.`,\n );\n }),\n updateErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../../lib/citty-effect\";\nimport { parseRolloutPercentage } from \"../../../lib/cli-schemas\";\nimport { apiClient } from \"../../../services/api-client\";\nimport { updateErrorExtras } from \"../helpers\";\n\nexport const setCommand = defineCommand({\n meta: { name: \"set\", description: \"Set the rollout percentage for an update\" },\n args: {\n updateId: { type: \"positional\", required: true, description: \"Update ID\" },\n percentage: { type: \"string\", required: true, description: \"Rollout percentage (1-100)\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const percentage = yield* parseRolloutPercentage(args.percentage, \"percentage\");\n const api = yield* apiClient;\n const result = yield* api.updates.editRollout({\n path: { id: args.updateId },\n payload: { percentage },\n });\n\n yield* Console.log(\n `Updated rollout for ${args.updateId} to ${String(result.rolloutPercentage)}%.`,\n );\n }),\n updateErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\n\nimport { completeCommand } from \"./complete\";\nimport { revertCommand } from \"./revert\";\nimport { setCommand } from \"./set\";\n\nexport const rolloutCommand = defineCommand({\n meta: { name: \"rollout\", description: \"Manage per-update rollouts\" },\n subCommands: {\n set: setCommand,\n complete: completeCommand,\n revert: revertCommand,\n },\n});\n","import { defineCommand } from \"citty\";\n\nimport { deleteCommand } from \"./delete\";\nimport { listCommand } from \"./list\";\nimport { promoteCommand } from \"./promote\";\nimport { publishCommand } from \"./publish\";\nimport { rollbackCommand } from \"./rollback\";\nimport { rolloutCommand } from \"./rollout\";\n\nexport const updateCommand = defineCommand({\n meta: { name: \"update\", description: \"Manage OTA updates\" },\n subCommands: {\n publish: publishCommand,\n list: listCommand,\n delete: deleteCommand,\n promote: promoteCommand,\n rollback: rollbackCommand,\n rollout: rolloutCommand,\n },\n});\n","#!/usr/bin/env node\n\nimport { defineCommand, runMain } from \"citty\";\n\nimport pkg from \"../package.json\" with { type: \"json\" };\nimport { analyticsCommand } from \"./commands/analytics\";\nimport { auditLogsCommand } from \"./commands/audit-logs\";\nimport { branchesCommand } from \"./commands/branches\";\nimport { buildCommand } from \"./commands/build\";\nimport { buildsCommand } from \"./commands/builds\";\nimport { channelsCommand } from \"./commands/channels\";\nimport { credentialsCommand } from \"./commands/credentials\";\nimport { envCommand } from \"./commands/env\";\nimport { fingerprintCommand } from \"./commands/fingerprint\";\nimport { initCommand } from \"./commands/init\";\nimport { loginCommand } from \"./commands/login\";\nimport { logoutCommand } from \"./commands/logout\";\nimport { projectsCommand } from \"./commands/projects\";\nimport { statusCommand } from \"./commands/status\";\nimport { updateCommand } from \"./commands/update\";\n\nconst main = defineCommand({\n meta: {\n name: \"better-update\",\n version: pkg.version,\n description: \"Publish OTA updates and builds for Expo apps\",\n },\n subCommands: {\n login: loginCommand,\n logout: logoutCommand,\n init: initCommand,\n status: statusCommand,\n projects: projectsCommand,\n branches: branchesCommand,\n channels: channelsCommand,\n build: buildCommand,\n builds: buildsCommand,\n credentials: credentialsCommand,\n env: envCommand,\n fingerprint: fingerprintCommand,\n update: updateCommand,\n analytics: analyticsCommand,\n \"audit-logs\": auditLogsCommand,\n },\n});\n\nawait runMain(main);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA,MAAa,YAAY,UACvB,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,MAAM;AAEtE,MAAa,YAAY,UACvB,SAAS,MAAM,GAAG,QAAQ;;;;ACA5B,IAAa,oBAAb,cAAuC,KAAK,YAAY,oBAAoB,CAEzE;AAEH,IAAa,wBAAb,cAA2C,KAAK,YAAY,wBAAwB,CAEjF;AAEH,IAAa,oBAAb,cAAuC,KAAK,YAAY,oBAAoB,CAEzE;AAEH,IAAa,oBAAb,cAAuC,KAAK,YAAY,oBAAoB,CAEzE;AAEH,IAAa,sBAAb,cAAyC,KAAK,YAAY,sBAAsB,CAE7E;AAEH,IAAa,0BAAb,cAA6C,KAAK,YAAY,0BAA0B,CAGrF;AAEH,IAAa,mBAAb,cAAsC,KAAK,YAAY,mBAAmB,CAIvE;AAEH,IAAa,eAAb,cAAkC,KAAK,YAAY,eAAe,CAE/D;AAEH,IAAa,gBAAb,cAAmC,KAAK,YAAY,gBAAgB,CAEjE;AAEH,IAAa,2BAAb,cAA8C,KAAK,YAAY,2BAA2B,CAEvF;AAEH,IAAa,wBAAb,cAA2C,KAAK,YAAY,wBAAwB,CAEjF;AAEH,IAAa,gBAAb,cAAmC,KAAK,YAAY,gBAAgB,CAEjE;AAEH,IAAa,oBAAb,cAAuC,KAAK,YAAY,oBAAoB,CAEzE;AAEH,IAAa,iBAAb,cAAoC,KAAK,YAAY,iBAAiB,CAEnE;AAEH,IAAa,qBAAb,cAAwC,KAAK,YAAY,qBAAqB,CAE3E;AAEH,IAAa,sBAAb,cAAyC,KAAK,YAAY,sBAAsB,CAE7E;AAE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,KAAK,YAAY,aAAa;EAE/E,MAAM,SAAS,QAAO,OADH,WACO,QAAQ,YAAY;GAC5C,MAAM,EAAE,IAAI,KAAK,UAAU;GAC3B,SAAS,EAAE,YAAY;GACxB,CAAC;AAEF,SAAO,QAAQ,IACb,uBAAuB,KAAK,SAAS,MAAM,OAAO,OAAO,kBAAkB,CAAC,IAC7E;GACD,EACF,kBACD;CACJ,CAAC;;;;ACxBF,MAAa,iBAAiB,cAAc;CAC1C,MAAM;EAAE,MAAM;EAAW,aAAa;EAA8B;CACpE,aAAa;EACX,KAAK;EACL,UAAU;EACV,QAAQ;EACT;CACF,CAAC;;;;ACJF,MAAa,gBAAgB,cAAc;CACzC,MAAM;EAAE,MAAM;EAAU,aAAa;EAAsB;CAC3D,aAAa;EACX,SAAS;EACT,MAAM;EACN,QAAQ;EACR,SAAS;EACT,UAAU;EACV,SAAS;EACV;CACF,CAAC;;;;AC2BF,MAAM,QAzBO,cAAc;CACzB,MAAM;EACJ,MAAM;EACGC;EACT,aAAa;EACd;CACD,aAAa;EACX,OAAO;EACP,QAAQ;EACR,MAAM;EACN,QAAQ;EACR,UAAU;EACV,UAAU;EACV,UAAU;EACV,OAAO;EACP,QAAQ;EACR,aAAa;EACb,KAAK;EACL,aAAa;EACb,QAAQ;EACR,WAAW;EACX,cAAc;EACf;CACF,CAEiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["idParam","projectIdParam","idParam","idParam","idParam","idParam","idParam","idParam","idParam","projectIdParam","idParam","idParam","idParam","idParam","idParam","idParam","projectIdParam","idParam","process","channelsCommand","channelsCommand","listCommand","listCommand","listCommand","createCommand","renameCommand","deleteCommand","process","asString","process","deleteCommand","getCommand","listCommand","uploadCommand","listCommand","getCommand","deleteCommand","uploadCommand","resolveNamedResourceId","resolveNamedResourceId","resolveNamedResourceIdBase","createCommand","resolveNamedResourceId","deleteCommand","listCommand","completeCommand","createCommand","resolveNamedResourceId","revertCommand","updateCommand","rolloutCommand","createCommand","updateCommand","completeCommand","revertCommand","updateCommand","resolveNamedResourceId","listCommand","createCommand","updateCommand","deleteCommand","rolloutCommand","CREDENTIAL_TYPES","deleteCommand","listCommand","listCommand","deleteCommand","deleteCommand","getCommand","listCommand","setCommand","listCommand","getCommand","setCommand","deleteCommand","asString","listCommand","deleteCommand","resolveNamedResourceIdBase","pkg.version"],"sources":["../package.json","../../../packages/type-guards/src/index.ts","../src/lib/exit-codes.ts","../src/lib/format-error.ts","../src/lib/app-json.ts","../../../packages/api/src/auth/context.ts","../../../packages/api/src/auth/errors.ts","../../../packages/api/src/auth/middleware.ts","../../../packages/api/src/auth/ownership.ts","../../../packages/api/src/domain/common.ts","../../../packages/api/src/domain/analytics.ts","../../../packages/api/src/groups/analytics.ts","../../../packages/api/src/domain/android-application-identifier.ts","../../../packages/api/src/domain/errors.ts","../../../packages/api/src/groups/android-application-identifiers.ts","../../../packages/api/src/domain/android-build-credentials.ts","../../../packages/api/src/groups/android-build-credentials.ts","../../../packages/api/src/domain/android-upload-keystore.ts","../../../packages/api/src/groups/android-upload-keystores.ts","../../../packages/api/src/domain/apple-team.ts","../../../packages/api/src/domain/apple-distribution-certificate.ts","../../../packages/api/src/groups/apple-distribution-certificates.ts","../../../packages/api/src/domain/apple-provisioning-profile.ts","../../../packages/api/src/groups/apple-provisioning-profiles.ts","../../../packages/api/src/domain/apple-push-key.ts","../../../packages/api/src/groups/apple-push-keys.ts","../../../packages/api/src/groups/apple-teams.ts","../../../packages/api/src/domain/asc-api-key.ts","../../../packages/api/src/groups/asc-api-keys.ts","../../../packages/api/src/domain/asset.ts","../../../packages/api/src/groups/assets.ts","../../../packages/api/src/domain/audit-log.ts","../../../packages/api/src/groups/audit-logs.ts","../../../packages/api/src/domain/branch.ts","../../../packages/api/src/groups/branches.ts","../../../packages/api/src/domain/build-credentials.ts","../../../packages/api/src/groups/build-credentials.ts","../../../packages/api/src/domain/build.ts","../../../packages/api/src/domain/build-compatibility.ts","../../../packages/api/src/groups/builds.ts","../../../packages/api/src/domain/channel.ts","../../../packages/api/src/groups/channels.ts","../../../packages/api/src/domain/device.ts","../../../packages/api/src/groups/devices.ts","../../../packages/api/src/domain/env-var.ts","../../../packages/api/src/groups/env-vars.ts","../../../packages/api/src/domain/google-service-account-key.ts","../../../packages/api/src/groups/google-service-account-keys.ts","../../../packages/api/src/domain/ios-bundle-configuration.ts","../../../packages/api/src/groups/ios-bundle-configurations.ts","../../../packages/api/src/domain/project.ts","../../../packages/api/src/groups/projects.ts","../../../packages/api/src/domain/update.ts","../../../packages/api/src/groups/updates.ts","../../../packages/api/src/api.ts","../../../packages/api/src/groups/manifest.ts","../../../packages/api/src/protocol-api.ts","../src/services/cli-runtime.ts","../src/services/auth-store.ts","../src/services/config-store.ts","../src/services/api-client.ts","../../../packages/safe-json/src/index.ts","../src/services/apple-session-store.ts","../src/services/presigned-upload.ts","../src/services/update-asset-uploader.ts","../src/app-layer.ts","../src/application/command-exit.ts","../src/lib/command-errors.ts","../src/lib/citty-effect.ts","../src/lib/output.ts","../src/commands/analytics/adoption.ts","../src/commands/analytics/channels.ts","../src/commands/analytics/platforms.ts","../src/commands/analytics/updates.ts","../src/commands/analytics/index.ts","../src/lib/cli-schemas.ts","../src/commands/audit-logs/list.ts","../src/commands/audit-logs/index.ts","../src/lib/drain-cursor.ts","../src/commands/branches.ts","../src/lib/android-signing-gradle.ts","../src/lib/string-utils.ts","../src/lib/artifact-finder.ts","../../../packages/encoding/src/index.ts","../src/lib/credentials-downloader.ts","../src/lib/sha256.ts","../src/commands/build/run-step.ts","../src/commands/build/android.ts","../src/lib/ios-export-options.ts","../src/lib/ios-keychain.ts","../src/lib/plist.ts","../src/lib/ios-provisioning.ts","../src/lib/post-build-validation.ts","../src/lib/xcpretty-formatter.ts","../src/commands/build/ios.ts","../src/commands/build/reserve-and-upload.ts","../src/lib/build-profile.ts","../src/lib/env-exporter.ts","../src/lib/expo-config.ts","../src/lib/git-context.ts","../src/lib/gradle-config.ts","../src/lib/fingerprint.ts","../src/lib/runtime-version.ts","../src/lib/temp-dir.ts","../src/application/build-workflow.ts","../src/commands/build/index.ts","../src/commands/builds/compatibility-matrix.ts","../src/commands/builds/delete.ts","../src/commands/builds/get.ts","../src/commands/builds/install-link.ts","../src/commands/builds/list.ts","../src/application/upload-workflow.ts","../src/commands/builds/upload.ts","../src/commands/builds/index.ts","../src/lib/resolve-named-resource.ts","../src/commands/channels/helpers.ts","../src/commands/channels/create.ts","../src/commands/channels/delete.ts","../src/commands/channels/list.ts","../src/commands/channels/pause.ts","../src/commands/channels/resume.ts","../src/commands/channels/rollout/complete.ts","../src/commands/channels/rollout/create.ts","../src/commands/channels/rollout/revert.ts","../src/commands/channels/rollout/update.ts","../src/commands/channels/rollout/index.ts","../src/commands/channels/update.ts","../src/commands/channels/index.ts","../src/lib/pkcs12.ts","../src/lib/credentials-manager.ts","../src/commands/credentials/delete.ts","../src/commands/credentials/list.ts","../src/commands/credentials/upload.ts","../src/commands/credentials/index.ts","../src/commands/env/helpers.ts","../src/commands/env/delete.ts","../src/commands/env/export.ts","../src/commands/env/get.ts","../src/commands/env/import.ts","../src/commands/env/list.ts","../src/commands/env/pull.ts","../src/commands/env/set.ts","../src/commands/env/index.ts","../src/commands/fingerprint/compare.ts","../src/commands/fingerprint/generate.ts","../src/commands/fingerprint/index.ts","../src/commands/init.ts","../src/lib/browser-login.ts","../src/lib/prompts.ts","../src/application/login.ts","../src/commands/login.ts","../src/commands/logout.ts","../src/commands/projects.ts","../src/commands/status.ts","../src/commands/update/helpers.ts","../src/commands/update/delete.ts","../src/commands/update/list.ts","../src/lib/signed-payloads.ts","../src/application/update-promote.ts","../src/commands/update/promote.ts","../src/lib/expo-export.ts","../src/lib/update-platforms.ts","../src/application/update-publish.ts","../src/commands/update/publish.ts","../../../packages/expo-protocol/src/index.ts","../src/application/update-rollback.ts","../src/commands/update/rollback.ts","../src/commands/update/rollout/complete.ts","../src/commands/update/rollout/revert.ts","../src/commands/update/rollout/set.ts","../src/commands/update/rollout/index.ts","../src/commands/update/index.ts","../src/index.ts"],"sourcesContent":["","export const isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nexport const asRecord = (value: unknown): Record<string, unknown> | undefined =>\n isRecord(value) ? value : undefined;\n","/* eslint-disable eslint/max-classes-per-file -- dedicated error-taxonomy module: each error class is a small, purpose-built tag used across the CLI for Effect.catchTag */\n\nimport { Data } from \"effect\";\n\nexport class AuthRequiredError extends Data.TaggedError(\"AuthRequiredError\")<{\n readonly message: string;\n}> {}\n\nexport class ProjectNotLinkedError extends Data.TaggedError(\"ProjectNotLinkedError\")<{\n readonly message: string;\n}> {}\n\nexport class UploadFailedError extends Data.TaggedError(\"UploadFailedError\")<{\n readonly message: string;\n}> {}\n\nexport class BuildProfileError extends Data.TaggedError(\"BuildProfileError\")<{\n readonly message: string;\n}> {}\n\nexport class RuntimeVersionError extends Data.TaggedError(\"RuntimeVersionError\")<{\n readonly message: string;\n}> {}\n\nexport class MissingCredentialsError extends Data.TaggedError(\"MissingCredentialsError\")<{\n readonly message: string;\n readonly hint: string;\n}> {}\n\nexport class BuildFailedError extends Data.TaggedError(\"BuildFailedError\")<{\n readonly step: string;\n readonly exitCode: number;\n readonly message: string;\n}> {}\n\nexport class ReserveError extends Data.TaggedError(\"ReserveError\")<{\n readonly message: string;\n}> {}\n\nexport class CompleteError extends Data.TaggedError(\"CompleteError\")<{\n readonly message: string;\n}> {}\n\nexport class PresignedUrlExpiredError extends Data.TaggedError(\"PresignedUrlExpiredError\")<{\n readonly message: string;\n}> {}\n\nexport class ArtifactNotFoundError extends Data.TaggedError(\"ArtifactNotFoundError\")<{\n readonly message: string;\n}> {}\n\nexport class KeychainError extends Data.TaggedError(\"KeychainError\")<{\n readonly message: string;\n}> {}\n\nexport class ProvisioningError extends Data.TaggedError(\"ProvisioningError\")<{\n readonly message: string;\n}> {}\n\nexport class EnvExportError extends Data.TaggedError(\"EnvExportError\")<{\n readonly message: string;\n}> {}\n\nexport class UpdatePublishError extends Data.TaggedError(\"UpdatePublishError\")<{\n readonly message: string;\n}> {}\n\nexport class UpdateRollbackError extends Data.TaggedError(\"UpdateRollbackError\")<{\n readonly message: string;\n}> {}\n\nexport class UpdatePromoteError extends Data.TaggedError(\"UpdatePromoteError\")<{\n readonly message: string;\n}> {}\n\nexport class CredentialValidationError extends Data.TaggedError(\"CredentialValidationError\")<{\n readonly message: string;\n}> {}\n\nexport class AppleAuthError extends Data.TaggedError(\"AppleAuthError\")<{\n readonly message: string;\n}> {}\n\nexport class InvalidArgumentError extends Data.TaggedError(\"InvalidArgumentError\")<{\n readonly message: string;\n}> {}\n","export const formatCause = (cause: unknown): string => {\n if (cause instanceof Error) {\n return cause.message;\n }\n\n if (typeof cause === \"object\" && cause !== null) {\n const tagged = cause as { readonly _tag?: unknown; readonly message?: unknown };\n const tag = typeof tagged._tag === \"string\" ? tagged._tag : undefined;\n const message = typeof tagged.message === \"string\" ? tagged.message : undefined;\n if (tag && message) {\n return `${tag}: ${message}`;\n }\n if (message) {\n return message;\n }\n if (tag) {\n return tag;\n }\n }\n\n return String(cause);\n};\n","import { asRecord, isRecord } from \"@better-update/type-guards\";\nimport { FileSystem } from \"@effect/platform\";\nimport { Effect } from \"effect\";\n\nimport { ProjectNotLinkedError } from \"./exit-codes\";\nimport { formatCause } from \"./format-error\";\n\nexport const readAppJson = Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const content = yield* fs\n .readFileString(\"./app.json\")\n .pipe(\n Effect.mapError(\n () => new ProjectNotLinkedError({ message: \"app.json not found in current directory\" }),\n ),\n );\n const parsed = yield* Effect.try({\n try: (): unknown => JSON.parse(content),\n catch: () => new ProjectNotLinkedError({ message: \"app.json contains malformed JSON\" }),\n });\n if (!isRecord(parsed)) {\n return yield* new ProjectNotLinkedError({ message: \"app.json must be a JSON object\" });\n }\n return parsed;\n});\n\nexport const readProjectId = Effect.gen(function* () {\n const appJson = yield* readAppJson;\n const expo = asRecord(appJson[\"expo\"]);\n const extra = asRecord(expo?.[\"extra\"]);\n const betterUpdate = asRecord(extra?.[\"betterUpdate\"]);\n const projectId = betterUpdate?.[\"projectId\"];\n\n if (typeof projectId !== \"string\") {\n return yield* new ProjectNotLinkedError({\n message:\n \"Project not linked. Run `better-update link` to connect this project, or set expo.extra.betterUpdate.projectId in app.json.\",\n });\n }\n\n return projectId;\n});\n\nexport const readSlug = Effect.gen(function* () {\n const appJson = yield* readAppJson;\n const expo = asRecord(appJson[\"expo\"]);\n const slug = expo?.[\"slug\"];\n\n if (typeof slug !== \"string\") {\n return yield* new ProjectNotLinkedError({\n message: \"Missing expo.slug in app.json. Required to identify the project.\",\n });\n }\n\n return slug;\n});\n\nexport const writeProjectId = (id: string) =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const appJson = yield* readAppJson;\n\n const expo = asRecord(appJson[\"expo\"]) ?? {};\n const extra = asRecord(expo[\"extra\"]) ?? {};\n const betterUpdate = asRecord(extra[\"betterUpdate\"]) ?? {};\n\n betterUpdate[\"projectId\"] = id;\n extra[\"betterUpdate\"] = betterUpdate;\n expo[\"extra\"] = extra;\n appJson[\"expo\"] = expo;\n\n yield* fs.writeFileString(\"./app.json\", `${JSON.stringify(appJson, null, 2)}\\n`);\n }).pipe(\n Effect.mapError((cause) =>\n cause instanceof ProjectNotLinkedError\n ? cause\n : new ProjectNotLinkedError({\n message: `Failed to write project ID to app.json: ${formatCause(cause)}`,\n }),\n ),\n );\n","import { Context } from \"effect\";\n\nexport type Role = \"owner\" | \"admin\" | \"developer\" | \"viewer\";\n\nexport type Resource =\n | \"organization\"\n | \"member\"\n | \"invitation\"\n | \"project\"\n | \"channel\"\n | \"branch\"\n | \"update\"\n | \"rollout\"\n | \"billing\"\n | \"apiKey\"\n | \"build\"\n | \"appleCredential\"\n | \"androidCredential\"\n | \"iosBundleConfiguration\"\n | \"envVar\"\n | \"auditLog\"\n | \"device\";\n\nexport type Action = \"read\" | \"create\" | \"update\" | \"delete\" | \"cancel\" | \"download\";\n\nexport type EffectivePermissions = Partial<Record<Resource, readonly Action[]>>;\n\nexport interface AuthContextShape {\n readonly userId: string | null;\n readonly organizationId: string;\n readonly role: Role | null;\n readonly effectivePermissions: EffectivePermissions;\n readonly source: \"session\" | \"api-key\";\n readonly actorEmail: string;\n}\n\nexport class AuthContext extends Context.Tag(\"api/AuthContext\")<AuthContext, AuthContextShape>() {}\n","import { HttpApiSchema } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nexport class Unauthorized extends Schema.TaggedError<Unauthorized>()(\n \"Unauthorized\",\n { message: Schema.String },\n HttpApiSchema.annotations({ status: 401 }),\n) {}\n\nexport class Forbidden extends Schema.TaggedError<Forbidden>()(\n \"Forbidden\",\n { message: Schema.String },\n HttpApiSchema.annotations({ status: 403 }),\n) {}\n\nexport class OrgRequired extends Schema.TaggedError<OrgRequired>()(\n \"OrgRequired\",\n { message: Schema.String },\n HttpApiSchema.annotations({ status: 400 }),\n) {}\n","import { HttpApiMiddleware, HttpApiSecurity } from \"@effect/platform\";\n\nimport { AuthContext } from \"./context\";\nimport { Unauthorized } from \"./errors\";\n\nconst bearerSecurity = HttpApiSecurity.bearer;\nconst cookieSecurity = HttpApiSecurity.apiKey({\n key: \"__Secure-better-auth.session_token\",\n in: \"cookie\",\n});\n\nexport class Authentication extends HttpApiMiddleware.Tag<Authentication>()(\"api/Authentication\", {\n failure: Unauthorized,\n provides: AuthContext,\n security: { bearer: bearerSecurity, cookie: cookieSecurity },\n}) {}\n","import { HttpApiSchema } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nexport class NotFound extends Schema.TaggedError<NotFound>()(\n \"NotFound\",\n { message: Schema.String },\n HttpApiSchema.annotations({ status: 404 }),\n) {}\n","import { Schema } from \"effect\";\n\nexport const Id = Schema.String.annotations({\n description: \"UUIDv7 identifier\",\n});\n\nexport const DateTimeString = Schema.String.annotations({\n description: \"ISO 8601 datetime\",\n});\n\nexport const Platform = Schema.Literal(\"ios\", \"android\");\n\nexport const PaginationParams = Schema.Struct({\n page: Schema.optional(Schema.NumberFromString),\n limit: Schema.optional(Schema.NumberFromString),\n});\n\nexport const CursorPaginationParams = Schema.Struct({\n cursor: Schema.optional(Schema.String),\n limit: Schema.optional(Schema.NumberFromString),\n});\n\nexport const cursorPageResult = <T, Encoded, R>(itemSchema: Schema.Schema<T, Encoded, R>) =>\n Schema.Struct({\n items: Schema.Array(itemSchema),\n nextCursor: Schema.NullOr(Schema.String),\n });\n\nexport const UpdateRolloutBody = Schema.Struct({\n percentage: Schema.Number.pipe(Schema.int(), Schema.between(1, 100)),\n});\n\nexport const UploadHeaders = Schema.Record({ key: Schema.String, value: Schema.String });\n","import { Schema } from \"effect\";\n\nimport { Id } from \"./common\";\n\n// -- Shared --\n\nexport const PeriodLiteral = Schema.Literal(\"1d\", \"7d\", \"30d\", \"90d\");\nexport const Period = Schema.optional(PeriodLiteral);\n\n// -- Adoption --\n\nexport const AdoptionParams = Schema.Struct({\n projectId: Id,\n period: Period,\n});\n\nconst AdoptionEntry = Schema.Struct({\n updateId: Schema.String,\n devices: Schema.Number,\n firstSeen: Schema.String,\n lastSeen: Schema.String,\n});\n\nexport const AdoptionResult = Schema.Struct({\n updates: Schema.Array(AdoptionEntry),\n});\n\n// -- Update Analytics --\n\nexport const UpdateAnalyticsParams = Schema.Struct({\n projectId: Id,\n updateId: Schema.String,\n period: Period,\n});\n\nconst ResponseTypeBreakdown = Schema.Struct({\n manifest: Schema.Number,\n directive: Schema.Number,\n no_update: Schema.Number,\n});\n\nconst TimeSeriesEntry = Schema.Struct({\n timestamp: Schema.String,\n requests: Schema.Number,\n});\n\nexport const UpdateAnalyticsResult = Schema.Struct({\n updateId: Schema.String,\n totalRequests: Schema.Number,\n uniqueDevices: Schema.Number,\n byResponseType: ResponseTypeBreakdown,\n timeSeries: Schema.Array(TimeSeriesEntry),\n});\n\n// -- Channel Analytics --\n\nexport const ChannelAnalyticsParams = Schema.Struct({\n projectId: Id,\n channel: Schema.String,\n period: Period,\n});\n\nexport const ChannelAnalyticsResult = Schema.Struct({\n channel: Schema.String,\n totalRequests: Schema.Number,\n uniqueDevices: Schema.Number,\n responseTypeDistribution: ResponseTypeBreakdown,\n});\n\n// -- Platform Analytics --\n\nexport const PlatformParams = Schema.Struct({\n projectId: Id,\n period: Period,\n});\n\nconst PlatformEntry = Schema.Struct({\n platform: Schema.String,\n requests: Schema.Number,\n devices: Schema.Number,\n});\n\nexport const PlatformResult = Schema.Struct({\n platforms: Schema.Array(PlatformEntry),\n});\n","import { HttpApiEndpoint, HttpApiGroup, OpenApi } from \"@effect/platform\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n AdoptionParams,\n AdoptionResult,\n ChannelAnalyticsParams,\n ChannelAnalyticsResult,\n PlatformParams,\n PlatformResult,\n UpdateAnalyticsParams,\n UpdateAnalyticsResult,\n} from \"../domain/analytics\";\n\nexport class AnalyticsGroup extends HttpApiGroup.make(\"analytics\")\n .add(\n HttpApiEndpoint.get(\"adoption\", \"/api/analytics/adoption\")\n .setUrlParams(AdoptionParams)\n .addSuccess(AdoptionResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Adoption analytics\",\n description: \"Adoption rate per update for a project\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"updates\", \"/api/analytics/updates\")\n .setUrlParams(UpdateAnalyticsParams)\n .addSuccess(UpdateAnalyticsResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Update analytics\",\n description: \"Request metrics for a specific update\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"channels\", \"/api/analytics/channels\")\n .setUrlParams(ChannelAnalyticsParams)\n .addSuccess(ChannelAnalyticsResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Channel analytics\",\n description: \"Channel-level health metrics\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"platforms\", \"/api/analytics/platforms\")\n .setUrlParams(PlatformParams)\n .addSuccess(PlatformResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Platform analytics\",\n description: \"Device count breakdown by platform\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Analytics\",\n description: \"Deployment analytics endpoints\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id } from \"./common\";\n\nexport const AndroidPackageName = Schema.String.pipe(\n Schema.pattern(/^[A-Za-z][A-Za-z0-9_]*(\\.[A-Za-z][A-Za-z0-9_]*)+$/u, {\n message: () => \"Package name must be reverse-domain style (e.g., com.acme.app)\",\n }),\n);\n\nexport class AndroidApplicationIdentifier extends Schema.Class<AndroidApplicationIdentifier>(\n \"AndroidApplicationIdentifier\",\n)({\n id: Id,\n organizationId: Id,\n projectId: Id,\n packageName: Schema.String,\n createdAt: DateTimeString,\n updatedAt: DateTimeString,\n}) {}\n\nexport const CreateAndroidApplicationIdentifierBody = Schema.Struct({\n packageName: AndroidPackageName,\n});\n\nexport const DeleteAndroidApplicationIdentifierResult = Schema.Struct({\n deleted: Schema.Number,\n});\n","import { HttpApiSchema } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nexport class BadRequest extends Schema.TaggedError<BadRequest>()(\n \"BadRequest\",\n { message: Schema.String },\n HttpApiSchema.annotations({ status: 400 }),\n) {}\n\nexport class Conflict extends Schema.TaggedError<Conflict>()(\n \"Conflict\",\n { message: Schema.String },\n HttpApiSchema.annotations({ status: 409 }),\n) {}\n\nexport class NotAcceptable extends Schema.TaggedError<NotAcceptable>()(\n \"NotAcceptable\",\n { message: Schema.String },\n HttpApiSchema.annotations({ status: 406 }),\n) {}\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n AndroidApplicationIdentifier,\n CreateAndroidApplicationIdentifierBody,\n DeleteAndroidApplicationIdentifierResult,\n} from \"../domain/android-application-identifier\";\nimport { BadRequest, Conflict } from \"../domain/errors\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\nconst projectIdParam = HttpApiSchema.param(\"projectId\", Schema.String);\n\nexport class AndroidApplicationIdentifiersGroup extends HttpApiGroup.make(\n \"androidApplicationIdentifiers\",\n)\n .add(\n HttpApiEndpoint.get(\"list\")`/api/projects/${projectIdParam}/android-application-identifiers`\n .addSuccess(Schema.Struct({ items: Schema.Array(AndroidApplicationIdentifier) }))\n .annotateContext(\n OpenApi.annotations({\n title: \"List Android application identifiers\",\n description: \"List all Android package identifiers for a project\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"create\")`/api/projects/${projectIdParam}/android-application-identifiers`\n .setPayload(CreateAndroidApplicationIdentifierBody)\n .addSuccess(AndroidApplicationIdentifier, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Create Android application identifier\",\n description: \"Register an Android package name for a project\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/android-application-identifiers/${idParam}`\n .addSuccess(DeleteAndroidApplicationIdentifierResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete Android application identifier\",\n description: \"Remove an Android application identifier\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(BadRequest)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Android Application Identifiers\",\n description: \"Manage Android package name registrations per project\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id } from \"./common\";\n\nexport class AndroidBuildCredentials extends Schema.Class<AndroidBuildCredentials>(\n \"AndroidBuildCredentials\",\n)({\n id: Id,\n organizationId: Id,\n androidApplicationIdentifierId: Id,\n androidUploadKeystoreId: Schema.NullOr(Id),\n googleServiceAccountKeyForSubmissionsId: Schema.NullOr(Id),\n googleServiceAccountKeyForFcmV1Id: Schema.NullOr(Id),\n name: Schema.String,\n isDefault: Schema.Boolean,\n createdAt: DateTimeString,\n updatedAt: DateTimeString,\n}) {}\n\nexport const CreateAndroidBuildCredentialsBody = Schema.Struct({\n name: Schema.String.pipe(Schema.minLength(1), Schema.maxLength(120)),\n androidUploadKeystoreId: Schema.optional(Id),\n googleServiceAccountKeyForSubmissionsId: Schema.optional(Id),\n googleServiceAccountKeyForFcmV1Id: Schema.optional(Id),\n isDefault: Schema.optional(Schema.Boolean),\n});\n\nexport const UpdateAndroidBuildCredentialsBody = Schema.Struct({\n name: Schema.optional(Schema.String.pipe(Schema.minLength(1), Schema.maxLength(120))),\n androidUploadKeystoreId: Schema.optional(Schema.NullOr(Id)),\n googleServiceAccountKeyForSubmissionsId: Schema.optional(Schema.NullOr(Id)),\n googleServiceAccountKeyForFcmV1Id: Schema.optional(Schema.NullOr(Id)),\n isDefault: Schema.optional(Schema.Boolean),\n});\n\nexport const DeleteAndroidBuildCredentialsResult = Schema.Struct({ deleted: Schema.Number });\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n AndroidBuildCredentials,\n CreateAndroidBuildCredentialsBody,\n DeleteAndroidBuildCredentialsResult,\n UpdateAndroidBuildCredentialsBody,\n} from \"../domain/android-build-credentials\";\nimport { BadRequest, Conflict } from \"../domain/errors\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\nconst applicationIdentifierIdParam = HttpApiSchema.param(\"applicationIdentifierId\", Schema.String);\n\nexport class AndroidBuildCredentialsGroup extends HttpApiGroup.make(\"androidBuildCredentials\")\n .add(\n HttpApiEndpoint.get(\n \"list\",\n )`/api/android-application-identifiers/${applicationIdentifierIdParam}/build-credentials`\n .addSuccess(Schema.Struct({ items: Schema.Array(AndroidBuildCredentials) }))\n .annotateContext(\n OpenApi.annotations({\n title: \"List Android build credentials\",\n description: \"List named build credential groups for an Android app identifier\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\n \"create\",\n )`/api/android-application-identifiers/${applicationIdentifierIdParam}/build-credentials`\n .setPayload(CreateAndroidBuildCredentialsBody)\n .addSuccess(AndroidBuildCredentials, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Create Android build credentials group\",\n description: \"Create a named build credentials group (Default or custom)\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.put(\"update\")`/api/android-build-credentials/${idParam}`\n .setPayload(UpdateAndroidBuildCredentialsBody)\n .addSuccess(AndroidBuildCredentials)\n .annotateContext(\n OpenApi.annotations({\n title: \"Update Android build credentials\",\n description: \"Rename group, change default flag, or swap bound keystore/keys\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/android-build-credentials/${idParam}`\n .addSuccess(DeleteAndroidBuildCredentialsResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete Android build credentials\",\n description: \"Remove a build credentials group\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(BadRequest)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Android Build Credentials\",\n description: \"Named groups of build credentials per Android application identifier\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id } from \"./common\";\n\nexport class AndroidUploadKeystore extends Schema.Class<AndroidUploadKeystore>(\n \"AndroidUploadKeystore\",\n)({\n id: Id,\n organizationId: Id,\n keyAlias: Schema.String,\n md5Fingerprint: Schema.NullOr(Schema.String),\n sha1Fingerprint: Schema.NullOr(Schema.String),\n sha256Fingerprint: Schema.NullOr(Schema.String),\n createdAt: DateTimeString,\n updatedAt: DateTimeString,\n}) {}\n\nexport const UploadAndroidUploadKeystoreBody = Schema.Struct({\n keystoreBase64: Schema.String.pipe(Schema.minLength(1)),\n keyAlias: Schema.String.pipe(Schema.minLength(1), Schema.maxLength(200)),\n keystorePassword: Schema.String.pipe(Schema.minLength(1)),\n keyPassword: Schema.String.pipe(Schema.minLength(1)),\n md5Fingerprint: Schema.optional(Schema.String.pipe(Schema.maxLength(200))),\n sha1Fingerprint: Schema.optional(Schema.String.pipe(Schema.maxLength(200))),\n sha256Fingerprint: Schema.optional(Schema.String.pipe(Schema.maxLength(200))),\n});\n\nexport const DeleteAndroidUploadKeystoreResult = Schema.Struct({ deleted: Schema.Number });\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n AndroidUploadKeystore,\n DeleteAndroidUploadKeystoreResult,\n UploadAndroidUploadKeystoreBody,\n} from \"../domain/android-upload-keystore\";\nimport { BadRequest, Conflict } from \"../domain/errors\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\n\nexport class AndroidUploadKeystoresGroup extends HttpApiGroup.make(\"androidUploadKeystores\")\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/android/upload-keystores\")\n .addSuccess(Schema.Struct({ items: Schema.Array(AndroidUploadKeystore) }))\n .annotateContext(\n OpenApi.annotations({\n title: \"List Android upload keystores\",\n description: \"List uploaded Android keystores\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"upload\", \"/api/android/upload-keystores\")\n .setPayload(UploadAndroidUploadKeystoreBody)\n .addSuccess(AndroidUploadKeystore, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Upload Android keystore\",\n description: \"Upload a JKS/PKCS12 keystore with key alias + passwords\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/android/upload-keystores/${idParam}`\n .addSuccess(DeleteAndroidUploadKeystoreResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete Android keystore\",\n description: \"Remove a stored Android keystore\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(BadRequest)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Android Upload Keystores\",\n description: \"Manage Android signing keystores\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id } from \"./common\";\n\nexport const AppleTeamType = Schema.Literal(\"IN_HOUSE\", \"COMPANY_ORGANIZATION\", \"INDIVIDUAL\");\nexport type AppleTeamTypeValue = typeof AppleTeamType.Type;\n\nexport const AppleTeamIdentifier = Schema.String.pipe(\n Schema.pattern(/^[A-Z0-9]{10}$/u, {\n message: () => \"Apple Team identifier must be 10 uppercase alphanumeric characters\",\n }),\n);\n\nexport class AppleTeam extends Schema.Class<AppleTeam>(\"AppleTeam\")({\n id: Id,\n organizationId: Id,\n appleTeamId: Schema.String,\n appleTeamType: AppleTeamType,\n name: Schema.NullOr(Schema.String),\n distributionCertificateCount: Schema.Number,\n pushKeyCount: Schema.Number,\n ascApiKeyCount: Schema.Number,\n provisioningProfileCount: Schema.Number,\n deviceCount: Schema.Number,\n createdAt: DateTimeString,\n updatedAt: DateTimeString,\n}) {}\n","import { Schema } from \"effect\";\n\nimport { AppleTeamIdentifier } from \"./apple-team\";\nimport { DateTimeString, Id } from \"./common\";\n\nexport class AppleDistributionCertificate extends Schema.Class<AppleDistributionCertificate>(\n \"AppleDistributionCertificate\",\n)({\n id: Id,\n organizationId: Id,\n appleTeamId: Id,\n serialNumber: Schema.String,\n developerIdIdentifier: Schema.NullOr(Schema.String),\n validFrom: DateTimeString,\n validUntil: DateTimeString,\n createdAt: DateTimeString,\n updatedAt: DateTimeString,\n}) {}\n\nexport const UploadAppleDistributionCertificateBody = Schema.Struct({\n p12Base64: Schema.String.pipe(Schema.minLength(1)),\n p12Password: Schema.String.pipe(Schema.minLength(1)),\n serialNumber: Schema.String.pipe(Schema.minLength(1), Schema.maxLength(200)),\n appleTeamIdentifier: AppleTeamIdentifier,\n appleTeamName: Schema.optional(Schema.String.pipe(Schema.maxLength(200))),\n appleTeamType: Schema.optional(Schema.Literal(\"IN_HOUSE\", \"COMPANY_ORGANIZATION\", \"INDIVIDUAL\")),\n developerIdIdentifier: Schema.optional(Schema.String.pipe(Schema.maxLength(200))),\n validFrom: DateTimeString,\n validUntil: DateTimeString,\n});\n\nexport const DeleteAppleDistributionCertificateResult = Schema.Struct({\n deleted: Schema.Number,\n});\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n AppleDistributionCertificate,\n DeleteAppleDistributionCertificateResult,\n UploadAppleDistributionCertificateBody,\n} from \"../domain/apple-distribution-certificate\";\nimport { BadRequest, Conflict } from \"../domain/errors\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\n\nexport class AppleDistributionCertificatesGroup extends HttpApiGroup.make(\n \"appleDistributionCertificates\",\n)\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/apple/distribution-certificates\")\n .addSuccess(Schema.Struct({ items: Schema.Array(AppleDistributionCertificate) }))\n .annotateContext(\n OpenApi.annotations({\n title: \"List Apple distribution certificates\",\n description: \"List uploaded Apple distribution certificates for the organization\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"upload\", \"/api/apple/distribution-certificates\")\n .setPayload(UploadAppleDistributionCertificateBody)\n .addSuccess(AppleDistributionCertificate, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Upload distribution certificate\",\n description:\n \"Upload a .p12 distribution certificate; auto-derives the Apple team from the provided identifier\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/apple/distribution-certificates/${idParam}`\n .addSuccess(DeleteAppleDistributionCertificateResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete distribution certificate\",\n description: \"Remove a distribution certificate from storage\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(BadRequest)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Apple Distribution Certificates\",\n description: \"Manage .p12 distribution certificates\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id } from \"./common\";\n\nexport const DistributionType = Schema.Literal(\"APP_STORE\", \"AD_HOC\", \"ENTERPRISE\", \"DEVELOPMENT\");\nexport type DistributionTypeValue = typeof DistributionType.Type;\n\nexport const BundleIdentifier = Schema.String.pipe(\n Schema.pattern(/^[A-Za-z0-9.\\-_]{1,200}$/u, {\n message: () => \"Bundle identifier must be reverse-domain style (letters, digits, dot, dash)\",\n }),\n);\n\nexport class AppleProvisioningProfile extends Schema.Class<AppleProvisioningProfile>(\n \"AppleProvisioningProfile\",\n)({\n id: Id,\n organizationId: Id,\n appleTeamId: Id,\n appleDistributionCertificateId: Schema.NullOr(Id),\n bundleIdentifier: Schema.String,\n distributionType: DistributionType,\n developerPortalIdentifier: Schema.NullOr(Schema.String),\n profileName: Schema.NullOr(Schema.String),\n validUntil: Schema.NullOr(DateTimeString),\n createdAt: DateTimeString,\n updatedAt: DateTimeString,\n}) {}\n\nexport const UploadAppleProvisioningProfileBody = Schema.Struct({\n profileBase64: Schema.String.pipe(Schema.minLength(1)),\n appleDistributionCertificateId: Schema.optional(Id),\n});\n\nexport const GenerateAppleProvisioningProfileBody = Schema.Struct({\n ascApiKeyId: Id,\n appleDistributionCertificateId: Id,\n bundleIdentifier: BundleIdentifier,\n distributionType: DistributionType,\n deviceIds: Schema.optional(Schema.Array(Id)),\n});\n\nexport const DeleteAppleProvisioningProfileResult = Schema.Struct({ deleted: Schema.Number });\n\nexport const ListAppleProvisioningProfilesParams = Schema.Struct({\n bundleIdentifier: Schema.optional(BundleIdentifier),\n distributionType: Schema.optional(DistributionType),\n appleTeamId: Schema.optional(Id),\n});\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n AppleProvisioningProfile,\n DeleteAppleProvisioningProfileResult,\n GenerateAppleProvisioningProfileBody,\n ListAppleProvisioningProfilesParams,\n UploadAppleProvisioningProfileBody,\n} from \"../domain/apple-provisioning-profile\";\nimport { BadRequest, Conflict } from \"../domain/errors\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\n\nexport class AppleProvisioningProfilesGroup extends HttpApiGroup.make(\"appleProvisioningProfiles\")\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/apple/provisioning-profiles\")\n .setUrlParams(ListAppleProvisioningProfilesParams)\n .addSuccess(Schema.Struct({ items: Schema.Array(AppleProvisioningProfile) }))\n .annotateContext(\n OpenApi.annotations({\n title: \"List provisioning profiles\",\n description: \"List stored provisioning profiles, optionally filtered by bundle + team\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"upload\", \"/api/apple/provisioning-profiles\")\n .setPayload(UploadAppleProvisioningProfileBody)\n .addSuccess(AppleProvisioningProfile, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Upload provisioning profile\",\n description: \"Upload an existing .mobileprovision; auto-parses the embedded plist\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"generate\", \"/api/apple/provisioning-profiles/generate\")\n .setPayload(GenerateAppleProvisioningProfileBody)\n .addSuccess(AppleProvisioningProfile, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Generate provisioning profile\",\n description: \"Generate + download a new provisioning profile via App Store Connect API\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/apple/provisioning-profiles/${idParam}`\n .addSuccess(DeleteAppleProvisioningProfileResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete provisioning profile\",\n description: \"Remove a stored provisioning profile\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(BadRequest)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Apple Provisioning Profiles\",\n description: \"Manage .mobileprovision profiles (upload or generate)\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { AppleTeamIdentifier } from \"./apple-team\";\nimport { DateTimeString, Id } from \"./common\";\n\nexport const ApplePushKeyId = Schema.String.pipe(\n Schema.pattern(/^[A-Z0-9]{10}$/u, {\n message: () => \"Push Key ID must be 10 uppercase alphanumeric characters\",\n }),\n);\n\nexport class ApplePushKey extends Schema.Class<ApplePushKey>(\"ApplePushKey\")({\n id: Id,\n organizationId: Id,\n appleTeamId: Id,\n keyId: Schema.String,\n createdAt: DateTimeString,\n updatedAt: DateTimeString,\n}) {}\n\nexport const UploadApplePushKeyBody = Schema.Struct({\n keyId: ApplePushKeyId,\n p8Pem: Schema.String.pipe(Schema.minLength(1)),\n appleTeamIdentifier: AppleTeamIdentifier,\n appleTeamName: Schema.optional(Schema.String.pipe(Schema.maxLength(200))),\n appleTeamType: Schema.optional(Schema.Literal(\"IN_HOUSE\", \"COMPANY_ORGANIZATION\", \"INDIVIDUAL\")),\n});\n\nexport const DeleteApplePushKeyResult = Schema.Struct({ deleted: Schema.Number });\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n ApplePushKey,\n DeleteApplePushKeyResult,\n UploadApplePushKeyBody,\n} from \"../domain/apple-push-key\";\nimport { BadRequest, Conflict } from \"../domain/errors\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\n\nexport class ApplePushKeysGroup extends HttpApiGroup.make(\"applePushKeys\")\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/apple/push-keys\")\n .addSuccess(Schema.Struct({ items: Schema.Array(ApplePushKey) }))\n .annotateContext(\n OpenApi.annotations({\n title: \"List Apple push keys\",\n description: \"List APNs push keys for the organization\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"upload\", \"/api/apple/push-keys\")\n .setPayload(UploadApplePushKeyBody)\n .addSuccess(ApplePushKey, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Upload push key\",\n description: \"Upload an APNs .p8 push notification key\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/apple/push-keys/${idParam}`\n .addSuccess(DeleteApplePushKeyResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete push key\",\n description: \"Remove a stored APNs push key\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(BadRequest)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Apple Push Keys\",\n description: \"Manage APNs push notification keys\",\n }),\n ) {}\n","import { HttpApiEndpoint, HttpApiGroup, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { AppleTeam } from \"../domain/apple-team\";\n\nexport class AppleTeamsGroup extends HttpApiGroup.make(\"appleTeams\")\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/apple-teams\")\n .addSuccess(Schema.Struct({ items: Schema.Array(AppleTeam) }))\n .annotateContext(\n OpenApi.annotations({\n title: \"List Apple teams\",\n description:\n \"List Apple developer teams derived from uploaded artifacts (certs, push keys, ASC keys)\",\n }),\n ),\n )\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Apple Teams\",\n description: \"Read-only view of Apple teams auto-created from uploaded credentials\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { AppleTeamIdentifier } from \"./apple-team\";\nimport { DateTimeString, Id } from \"./common\";\n\nexport const AscApiKeyId = Schema.String.pipe(\n Schema.pattern(/^[A-Z0-9]{10}$/u, {\n message: () => \"ASC API Key ID must be 10 uppercase alphanumeric characters\",\n }),\n);\n\nexport const IssuerId = Schema.String.pipe(\n Schema.pattern(/^[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}$/u, {\n message: () => \"Issuer ID must be a UUID (8-4-4-4-12 hex)\",\n }),\n);\n\nexport class AscApiKey extends Schema.Class<AscApiKey>(\"AscApiKey\")({\n id: Id,\n organizationId: Id,\n appleTeamId: Schema.NullOr(Id),\n keyId: Schema.String,\n name: Schema.String,\n roles: Schema.Array(Schema.String),\n createdAt: DateTimeString,\n updatedAt: DateTimeString,\n}) {}\n\nexport const UploadAscApiKeyBody = Schema.Struct({\n name: Schema.String.pipe(Schema.minLength(1), Schema.maxLength(120)),\n keyId: AscApiKeyId,\n issuerId: IssuerId,\n p8Pem: Schema.String.pipe(Schema.minLength(1)),\n appleTeamIdentifier: Schema.optional(AppleTeamIdentifier),\n appleTeamName: Schema.optional(Schema.String.pipe(Schema.maxLength(200))),\n appleTeamType: Schema.optional(Schema.Literal(\"IN_HOUSE\", \"COMPANY_ORGANIZATION\", \"INDIVIDUAL\")),\n roles: Schema.optional(Schema.Array(Schema.String)),\n});\n\nexport const DeleteAscApiKeyResult = Schema.Struct({ deleted: Schema.Number });\n\nexport const SyncedDeviceSummary = Schema.Struct({\n id: Id,\n identifier: Schema.String,\n name: Schema.String,\n deviceClass: Schema.Literal(\"IPHONE\", \"IPAD\", \"MAC\", \"UNKNOWN\"),\n});\n\nexport const SyncDevicesResult = Schema.Struct({\n pulled: Schema.Number,\n pushed: Schema.Number,\n skipped: Schema.Number,\n devices: Schema.Array(SyncedDeviceSummary),\n});\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n AscApiKey,\n DeleteAscApiKeyResult,\n SyncDevicesResult,\n UploadAscApiKeyBody,\n} from \"../domain/asc-api-key\";\nimport { BadRequest, Conflict } from \"../domain/errors\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\n\nexport class AscApiKeysGroup extends HttpApiGroup.make(\"ascApiKeys\")\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/apple/asc-api-keys\")\n .addSuccess(Schema.Struct({ items: Schema.Array(AscApiKey) }))\n .annotateContext(\n OpenApi.annotations({\n title: \"List App Store Connect API keys\",\n description: \"List stored ASC API keys for the organization\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"upload\", \"/api/apple/asc-api-keys\")\n .setPayload(UploadAscApiKeyBody)\n .addSuccess(AscApiKey, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Upload ASC API key\",\n description: \"Upload an App Store Connect API key (.p8 + issuer)\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/apple/asc-api-keys/${idParam}`\n .addSuccess(DeleteAscApiKeyResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete ASC API key\",\n description: \"Remove a stored ASC API key\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"syncDevices\")`/api/apple/asc-api-keys/${idParam}/sync-devices`\n .addSuccess(SyncDevicesResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Sync devices via ASC API key\",\n description:\n \"Pull registered devices from Apple Developer Portal for this key's team; push local devices that aren't yet registered\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(BadRequest)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"App Store Connect API Keys\",\n description: \"Manage ASC API keys used for device + profile sync\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id, UploadHeaders } from \"./common\";\n\nexport class Asset extends Schema.Class<Asset>(\"Asset\")({\n hash: Schema.String,\n contentType: Schema.String,\n fileExt: Schema.String,\n byteSize: Schema.Number,\n r2Key: Schema.String,\n createdAt: DateTimeString,\n}) {}\n\nexport const AssetUploadBody = Schema.Struct({\n projectId: Id,\n assets: Schema.Array(\n Schema.Struct({\n hash: Schema.String,\n contentType: Schema.String,\n fileExt: Schema.String,\n contentChecksum: Schema.optional(Schema.String),\n }),\n ),\n});\n\nexport const AssetUploadResult = Schema.Struct({\n uploaded: Schema.Array(\n Schema.Struct({\n hash: Schema.String,\n uploadMode: Schema.Literal(\"single\"),\n uploadUrl: Schema.String,\n uploadExpiresAt: DateTimeString,\n uploadHeaders: UploadHeaders,\n }),\n ),\n deduplicated: Schema.Array(Schema.String),\n});\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport { Asset, AssetUploadBody, AssetUploadResult } from \"../domain/asset\";\nimport { BadRequest } from \"../domain/errors\";\n\nconst hashParam = HttpApiSchema.param(\"hash\", Schema.String);\n\nexport class AssetsGroup extends HttpApiGroup.make(\"assets\")\n .add(\n HttpApiEndpoint.post(\"upload\", \"/api/assets/upload\")\n .setPayload(AssetUploadBody)\n .addSuccess(AssetUploadResult, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Upload assets\",\n description: \"Upload asset files to R2 storage (deduplicated by content hash)\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"finalize\")`/api/assets/${hashParam}/finalize`\n .addSuccess(Asset)\n .annotateContext(\n OpenApi.annotations({\n title: \"Finalize asset upload\",\n description: \"Verify a directly uploaded asset in R2 and mark it available for updates\",\n }),\n ),\n )\n .addError(BadRequest)\n .addError(NotFound)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Assets\",\n description: \"Asset upload endpoints\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id } from \"./common\";\n\nexport const AuditLogResourceType = Schema.Literal(\n \"project\",\n \"branch\",\n \"channel\",\n \"update\",\n \"build\",\n \"appleCredential\",\n \"androidCredential\",\n \"iosBundleConfiguration\",\n \"envVar\",\n \"device\",\n);\n\nexport const AuditLogSource = Schema.Literal(\"session\", \"api-key\");\n\nexport class AuditLog extends Schema.Class<AuditLog>(\"AuditLog\")({\n id: Id,\n organizationId: Id,\n actorId: Schema.NullOr(Schema.String),\n actorEmail: Schema.String,\n action: Schema.String,\n resourceType: AuditLogResourceType,\n resourceId: Schema.NullOr(Schema.String),\n metadata: Schema.NullOr(Schema.String),\n source: AuditLogSource,\n createdAt: DateTimeString,\n}) {}\n","import { HttpApiEndpoint, HttpApiGroup, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { AuditLog } from \"../domain/audit-log\";\nimport { CursorPaginationParams, cursorPageResult } from \"../domain/common\";\n\nexport class AuditLogsGroup extends HttpApiGroup.make(\"audit-logs\")\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/audit-logs\")\n .setUrlParams(\n Schema.Struct({\n projectId: Schema.optional(Schema.String),\n resourceType: Schema.optional(Schema.String),\n from: Schema.optional(Schema.String),\n to: Schema.optional(Schema.String),\n ...CursorPaginationParams.fields,\n }),\n )\n .addSuccess(cursorPageResult(AuditLog))\n .annotateContext(\n OpenApi.annotations({\n title: \"List audit logs\",\n description: \"List audit log entries with optional filters\",\n }),\n ),\n )\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Audit Logs\",\n description: \"View audit trail for organization actions\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id, PaginationParams } from \"./common\";\n\nexport class Branch extends Schema.Class<Branch>(\"Branch\")({\n id: Id,\n projectId: Id,\n name: Schema.String,\n createdAt: DateTimeString,\n updateCount: Schema.Number,\n}) {}\n\nexport const BranchSortColumn = Schema.Literal(\"name\", \"createdAt\", \"updateCount\");\n\n/**\n * Sort param: column name optionally prefixed with `-` for descending.\n * Example: `name` (asc), `-createdAt` (desc).\n */\nexport const BranchSort = Schema.Union(\n BranchSortColumn,\n Schema.TemplateLiteral(\"-\", BranchSortColumn),\n);\n\nexport const ListBranchesParams = Schema.Struct({\n projectId: Id,\n ...PaginationParams.fields,\n sort: Schema.optional(BranchSort),\n});\n\nexport const CreateBranchBody = Schema.Struct({\n projectId: Id,\n name: Schema.String.pipe(Schema.minLength(1)),\n});\n\nexport const UpdateBranchBody = Schema.Struct({\n name: Schema.String.pipe(Schema.minLength(1)),\n});\n\nexport const DeleteBranchResult = Schema.Struct({ deleted: Schema.Number });\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n Branch,\n CreateBranchBody,\n DeleteBranchResult,\n ListBranchesParams,\n UpdateBranchBody,\n} from \"../domain/branch\";\nimport { Conflict } from \"../domain/errors\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\n\nexport class BranchesGroup extends HttpApiGroup.make(\"branches\")\n .add(\n HttpApiEndpoint.post(\"create\", \"/api/branches\")\n .setPayload(CreateBranchBody)\n .addSuccess(Branch, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Create branch\",\n description: \"Create a new branch within a project\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/branches\")\n .setUrlParams(ListBranchesParams)\n .addSuccess(\n Schema.Struct({\n items: Schema.Array(Branch),\n total: Schema.Number,\n page: Schema.Number,\n limit: Schema.Number,\n }),\n )\n .annotateContext(\n OpenApi.annotations({\n title: \"List branches\",\n description: \"List all branches for a project\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.patch(\"rename\")`/api/branches/${idParam}`\n .setPayload(UpdateBranchBody)\n .addSuccess(Branch)\n .addError(Conflict)\n .annotateContext(\n OpenApi.annotations({\n title: \"Rename branch\",\n description: \"Rename a branch (channels and updates are unaffected)\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/branches/${idParam}`\n .addSuccess(DeleteBranchResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete branch\",\n description: \"Delete a branch and all its updates\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Branches\",\n description: \"Branch management endpoints\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { AndroidPackageName } from \"./android-application-identifier\";\nimport { BundleIdentifier, DistributionType } from \"./apple-provisioning-profile\";\n\nexport const ResolveBuildCredentialsIosBody = Schema.Struct({\n platform: Schema.Literal(\"ios\"),\n bundleIdentifier: BundleIdentifier,\n distributionType: DistributionType,\n});\n\nexport const ResolveBuildCredentialsAndroidBody = Schema.Struct({\n platform: Schema.Literal(\"android\"),\n applicationIdentifier: AndroidPackageName,\n});\n\nexport const ResolveBuildCredentialsBody = Schema.Union(\n ResolveBuildCredentialsIosBody,\n ResolveBuildCredentialsAndroidBody,\n);\n\nexport const IosBuildDistributionCertificate = Schema.Struct({\n p12Base64: Schema.String,\n p12Password: Schema.String,\n});\n\nexport const IosBuildProvisioningProfile = Schema.Struct({\n mobileprovisionBase64: Schema.String,\n uuid: Schema.NullOr(Schema.String),\n name: Schema.NullOr(Schema.String),\n teamId: Schema.String,\n bundleIdentifier: Schema.String,\n distributionType: DistributionType,\n});\n\nexport const IosBuildPushKey = Schema.Struct({\n p8Base64: Schema.String,\n keyId: Schema.String,\n teamId: Schema.String,\n});\n\nexport const ResolveBuildCredentialsIosResult = Schema.Struct({\n platform: Schema.Literal(\"ios\"),\n distributionCertificate: IosBuildDistributionCertificate,\n provisioningProfile: IosBuildProvisioningProfile,\n pushKey: Schema.NullOr(IosBuildPushKey),\n});\n\nexport const AndroidBuildKeystore = Schema.Struct({\n keystoreBase64: Schema.String,\n storePassword: Schema.String,\n keyAlias: Schema.String,\n keyPassword: Schema.String,\n});\n\nexport const ResolveBuildCredentialsAndroidResult = Schema.Struct({\n platform: Schema.Literal(\"android\"),\n keystore: AndroidBuildKeystore,\n});\n\nexport const ResolveBuildCredentialsResult = Schema.Union(\n ResolveBuildCredentialsIosResult,\n ResolveBuildCredentialsAndroidResult,\n);\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n ResolveBuildCredentialsBody,\n ResolveBuildCredentialsResult,\n} from \"../domain/build-credentials\";\nimport { BadRequest } from \"../domain/errors\";\n\nconst projectIdParam = HttpApiSchema.param(\"projectId\", Schema.String);\n\nexport class BuildCredentialsGroup extends HttpApiGroup.make(\"buildCredentials\")\n .add(\n HttpApiEndpoint.post(\"resolve\")`/api/projects/${projectIdParam}/build-credentials/resolve`\n .setPayload(ResolveBuildCredentialsBody)\n .addSuccess(ResolveBuildCredentialsResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Resolve build credentials\",\n description:\n \"Return decrypted signing assets for a project build. Regenerates the iOS provisioning profile via Apple ASC when the registered device roster has changed since the profile was last generated.\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(BadRequest)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Build Credentials\",\n description: \"Materialize signing assets needed by a CLI build run\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id, PaginationParams, Platform, UploadHeaders } from \"./common\";\n\nexport const Distribution = Schema.Literal(\n \"app-store\",\n \"ad-hoc\",\n \"development\",\n \"enterprise\",\n \"simulator\",\n \"play-store\",\n \"direct\",\n);\n\nexport const ArtifactFormat = Schema.Literal(\"ipa\", \"apk\", \"aab\", \"tar.gz\");\nconst Sha256Hex = Schema.String.pipe(Schema.pattern(/^[a-fA-F0-9]{64}$/u), Schema.maxLength(64));\n\nconst CreateBuildCommonFields = {\n projectId: Id,\n profile: Schema.optional(Schema.String),\n runtimeVersion: Schema.optional(Schema.String),\n appVersion: Schema.optional(Schema.String),\n buildNumber: Schema.optional(Schema.String),\n bundleId: Schema.optional(Schema.String),\n gitRef: Schema.optional(Schema.String),\n gitCommit: Schema.optional(Schema.String),\n message: Schema.optional(Schema.String),\n metadata: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Unknown })),\n sha256: Sha256Hex,\n byteSize: Schema.Number.pipe(Schema.nonNegative()),\n} as const;\n\nexport class Build extends Schema.Class<Build>(\"Build\")({\n id: Id,\n projectId: Id,\n platform: Platform,\n profile: Schema.String,\n distribution: Distribution,\n runtimeVersion: Schema.NullOr(Schema.String),\n appVersion: Schema.NullOr(Schema.String),\n buildNumber: Schema.NullOr(Schema.String),\n bundleId: Schema.NullOr(Schema.String),\n gitRef: Schema.NullOr(Schema.String),\n gitCommit: Schema.NullOr(Schema.String),\n message: Schema.NullOr(Schema.String),\n metadataJson: Schema.String,\n createdAt: DateTimeString,\n}) {}\n\nexport class BuildArtifact extends Schema.Class<BuildArtifact>(\"BuildArtifact\")({\n buildId: Id,\n r2Key: Schema.String,\n format: ArtifactFormat,\n contentType: Schema.String,\n byteSize: Schema.Number,\n sha256: Schema.String,\n createdAt: DateTimeString,\n}) {}\n\nexport class BuildWithArtifact extends Build.extend<BuildWithArtifact>(\"BuildWithArtifact\")({\n artifact: Schema.NullOr(\n Schema.Struct({\n r2Key: Schema.String,\n format: ArtifactFormat,\n contentType: Schema.String,\n byteSize: Schema.Number,\n sha256: Schema.String,\n }),\n ),\n}) {}\n\nexport const CreateBuildBody = Schema.Union(\n Schema.Struct({\n ...CreateBuildCommonFields,\n platform: Schema.Literal(\"ios\"),\n distribution: Schema.Literal(\"app-store\", \"ad-hoc\", \"development\", \"enterprise\"),\n artifactFormat: Schema.Literal(\"ipa\"),\n }),\n Schema.Struct({\n ...CreateBuildCommonFields,\n platform: Schema.Literal(\"ios\"),\n distribution: Schema.Literal(\"simulator\"),\n artifactFormat: Schema.Literal(\"tar.gz\"),\n }),\n Schema.Struct({\n ...CreateBuildCommonFields,\n platform: Schema.Literal(\"android\"),\n distribution: Schema.Literal(\"play-store\"),\n artifactFormat: Schema.Literal(\"aab\"),\n }),\n Schema.Struct({\n ...CreateBuildCommonFields,\n platform: Schema.Literal(\"android\"),\n distribution: Schema.Literal(\"direct\"),\n artifactFormat: Schema.Literal(\"apk\"),\n }),\n);\n\nexport const BuildSortColumn = Schema.Literal(\n \"createdAt\",\n \"platform\",\n \"distribution\",\n \"runtimeVersion\",\n \"appVersion\",\n);\n\n/**\n * Sort param: column name optionally prefixed with `-` for descending.\n * Example: `runtimeVersion` (asc), `-createdAt` (desc).\n */\nexport const BuildSort = Schema.Union(\n BuildSortColumn,\n Schema.TemplateLiteral(\"-\", BuildSortColumn),\n);\n\nexport const ListBuildsParams = Schema.Struct({\n projectId: Id,\n platform: Schema.optional(Platform),\n profile: Schema.optional(Schema.String),\n runtimeVersion: Schema.optional(Schema.String),\n distribution: Schema.optional(Distribution),\n ...PaginationParams.fields,\n sort: Schema.optional(BuildSort),\n});\n\nexport const CompleteBuildBody = Schema.Struct({\n sha256: Sha256Hex,\n byteSize: Schema.Number.pipe(Schema.nonNegative()),\n});\n\nexport const ReserveBuildResult = Schema.Struct({\n id: Id,\n uploadMode: Schema.Literal(\"single\"),\n uploadUrl: Schema.String,\n uploadExpiresAt: DateTimeString,\n uploadHeaders: UploadHeaders,\n});\n\nexport const DeleteBuildResult = Schema.Struct({\n deleted: Schema.Number,\n});\n\nexport const InstallLinkResult = Schema.Struct({\n token: Schema.String,\n expires: Schema.Number,\n artifactUrl: Schema.String,\n installUrl: Schema.NullOr(Schema.String),\n});\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id, Platform } from \"./common\";\n\n// Per-runtime channel status — varies per (platform, runtimeVersion).\nexport class BuildCompatibilityChannel extends Schema.Class<BuildCompatibilityChannel>(\n \"BuildCompatibilityChannel\",\n)({\n channelId: Id,\n updateCount: Schema.Number,\n latestUpdateId: Schema.NullOr(Id),\n latestUpdateMessage: Schema.NullOr(Schema.String),\n latestUpdateCreatedAt: Schema.NullOr(DateTimeString),\n}) {}\n\n// Channel-level metadata that does not depend on a specific build's runtime.\nexport class CompatibilityChannelInfo extends Schema.Class<CompatibilityChannelInfo>(\n \"CompatibilityChannelInfo\",\n)({\n channelId: Id,\n channelName: Schema.String,\n isPaused: Schema.Boolean,\n rolloutActive: Schema.Boolean,\n}) {}\n\nexport class MissingRuntimeVersionBuild extends Schema.Class<MissingRuntimeVersionBuild>(\n \"MissingRuntimeVersionBuild\",\n)({\n channelId: Id,\n channelName: Schema.String,\n platform: Platform,\n runtimeVersion: Schema.String,\n updateCount: Schema.Number,\n latestUpdateId: Id,\n latestUpdateMessage: Schema.String,\n latestUpdateCreatedAt: DateTimeString,\n rolloutActive: Schema.Boolean,\n}) {}\n\nexport const BuildCompatibilityMatrixResult = Schema.Struct({\n channels: Schema.Array(CompatibilityChannelInfo),\n channelStatusByKey: Schema.Record({\n key: Schema.String,\n value: Schema.Array(BuildCompatibilityChannel),\n }),\n missingRuntimeVersions: Schema.Array(MissingRuntimeVersionBuild),\n});\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n BuildWithArtifact,\n CompleteBuildBody,\n CreateBuildBody,\n DeleteBuildResult,\n InstallLinkResult,\n ListBuildsParams,\n ReserveBuildResult,\n} from \"../domain/build\";\nimport { BuildCompatibilityMatrixResult } from \"../domain/build-compatibility\";\nimport { Id } from \"../domain/common\";\nimport { BadRequest, Conflict } from \"../domain/errors\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\n\nexport class BuildsGroup extends HttpApiGroup.make(\"builds\")\n .add(\n HttpApiEndpoint.post(\"reserve\", \"/api/builds\")\n .setPayload(CreateBuildBody)\n .addSuccess(ReserveBuildResult, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Reserve build\",\n description: \"Reserve a build ID and get a presigned upload URL\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"complete\")`/api/builds/${idParam}/complete`\n .setPayload(CompleteBuildBody)\n .addSuccess(BuildWithArtifact)\n .addError(Conflict)\n .annotateContext(\n OpenApi.annotations({\n title: \"Complete build\",\n description: \"Finalize a build after artifact upload\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/builds\")\n .setUrlParams(ListBuildsParams)\n .addSuccess(\n Schema.Struct({\n items: Schema.Array(BuildWithArtifact),\n total: Schema.Number,\n page: Schema.Number,\n limit: Schema.Number,\n }),\n )\n .annotateContext(\n OpenApi.annotations({\n title: \"List builds\",\n description: \"List builds for a project with optional filters\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"compatibilityMatrix\", \"/api/builds/compatibility-matrix\")\n .setUrlParams(\n Schema.Struct({\n projectId: Id,\n }),\n )\n .addSuccess(BuildCompatibilityMatrixResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Build compatibility matrix\",\n description: \"List build-to-channel OTA compatibility for a project\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"get\")`/api/builds/${idParam}`\n .addSuccess(BuildWithArtifact)\n .annotateContext(\n OpenApi.annotations({\n title: \"Get build\",\n description: \"Get a build by ID with artifact details\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/builds/${idParam}`\n .addSuccess(DeleteBuildResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete build\",\n description: \"Delete a build and its artifact from storage\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"getInstallLink\")`/api/builds/${idParam}/install-link`\n .addSuccess(InstallLinkResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Get install link\",\n description: \"Generate a signed install link for a build artifact\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Forbidden)\n .addError(BadRequest)\n .annotateContext(\n OpenApi.annotations({\n title: \"Builds\",\n description: \"Build artifact upload, tracking, and download endpoints\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id, PaginationParams } from \"./common\";\n\nexport class Channel extends Schema.Class<Channel>(\"Channel\")({\n id: Id,\n projectId: Id,\n name: Schema.String,\n branchId: Id,\n branchMappingJson: Schema.NullOr(Schema.String),\n cacheVersion: Schema.Number,\n isPaused: Schema.Boolean,\n createdAt: DateTimeString,\n}) {}\n\nexport const ChannelSortColumn = Schema.Literal(\"name\", \"createdAt\");\n\n/**\n * Sort param: column name optionally prefixed with `-` for descending.\n * Example: `name` (asc), `-createdAt` (desc).\n */\nexport const ChannelSort = Schema.Union(\n ChannelSortColumn,\n Schema.TemplateLiteral(\"-\", ChannelSortColumn),\n);\n\nexport const ListChannelsParams = Schema.Struct({\n projectId: Id,\n ...PaginationParams.fields,\n sort: Schema.optional(ChannelSort),\n});\n\nexport const CreateChannelBody = Schema.Struct({\n projectId: Id,\n name: Schema.String.pipe(Schema.minLength(1)),\n branchId: Id,\n});\n\nexport const UpdateChannelBody = Schema.Struct({\n branchId: Id,\n});\n\nexport const CreateBranchRolloutBody = Schema.Struct({\n newBranchId: Id,\n percentage: Schema.Number.pipe(Schema.int(), Schema.between(1, 100)),\n});\n\nexport const DeleteChannelResult = Schema.Struct({ deleted: Schema.Number });\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n Channel,\n CreateBranchRolloutBody,\n CreateChannelBody,\n DeleteChannelResult,\n ListChannelsParams,\n UpdateChannelBody,\n} from \"../domain/channel\";\nimport { UpdateRolloutBody } from \"../domain/common\";\nimport { Conflict } from \"../domain/errors\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\n\nexport class ChannelsGroup extends HttpApiGroup.make(\"channels\")\n .add(\n HttpApiEndpoint.post(\"create\", \"/api/channels\")\n .setPayload(CreateChannelBody)\n .addSuccess(Channel, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Create channel\",\n description: \"Create a new channel linked to a branch\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.patch(\"update\")`/api/channels/${idParam}`\n .setPayload(UpdateChannelBody)\n .addSuccess(Channel)\n .annotateContext(\n OpenApi.annotations({\n title: \"Update channel\",\n description: \"Relink channel to a different branch\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/channels\")\n .setUrlParams(ListChannelsParams)\n .addSuccess(\n Schema.Struct({\n items: Schema.Array(Channel),\n total: Schema.Number,\n page: Schema.Number,\n limit: Schema.Number,\n }),\n )\n .annotateContext(\n OpenApi.annotations({\n title: \"List channels\",\n description: \"List all channels for a project\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"pause\")`/api/channels/${idParam}/pause`\n .addSuccess(Channel)\n .annotateContext(\n OpenApi.annotations({\n title: \"Pause channel\",\n description: \"Pause a channel — manifest requests return 204 No Content\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"resume\")`/api/channels/${idParam}/resume`\n .addSuccess(Channel)\n .annotateContext(\n OpenApi.annotations({\n title: \"Resume channel\",\n description: \"Resume a paused channel\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"createBranchRollout\")`/api/channels/${idParam}/rollout`\n .setPayload(CreateBranchRolloutBody)\n .addSuccess(Channel)\n .annotateContext(\n OpenApi.annotations({\n title: \"Create branch rollout\",\n description: \"Start a gradual rollout to a new branch on this channel\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.patch(\"updateBranchRollout\")`/api/channels/${idParam}/rollout`\n .setPayload(UpdateRolloutBody)\n .addSuccess(Channel)\n .annotateContext(\n OpenApi.annotations({\n title: \"Update branch rollout\",\n description: \"Change the rollout percentage for a branch rollout\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"completeBranchRollout\")`/api/channels/${idParam}/rollout/complete`\n .addSuccess(Channel)\n .annotateContext(\n OpenApi.annotations({\n title: \"Complete branch rollout\",\n description: \"Finalize the rollout — promote the new branch to 100%\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"revertBranchRollout\")`/api/channels/${idParam}/rollout/revert`\n .addSuccess(Channel)\n .annotateContext(\n OpenApi.annotations({\n title: \"Revert branch rollout\",\n description: \"Revert the rollout — restore the original branch\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/channels/${idParam}`\n .addSuccess(DeleteChannelResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete channel\",\n description: \"Delete a channel\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Channels\",\n description: \"Channel management endpoints including pause/resume and branch rollouts\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id, PaginationParams } from \"./common\";\n\nexport const DeviceClass = Schema.Literal(\"IPHONE\", \"IPAD\", \"MAC\", \"UNKNOWN\");\nexport type DeviceClassValue = typeof DeviceClass.Type;\n\nconst IDENTIFIER_PATTERN =\n /^(?:[A-Fa-f0-9]{40}|[A-Fa-f0-9]{8}-[A-Fa-f0-9]{16}|[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12})$/u;\n\nexport const DeviceIdentifier = Schema.String.pipe(\n Schema.pattern(IDENTIFIER_PATTERN, {\n message: () =>\n \"Identifier must be an Apple UDID: 40 hex chars, 8-16 hex, or UUID (8-4-4-4-12 hex)\",\n }),\n);\n\nexport class Device extends Schema.Class<Device>(\"Device\")({\n id: Id,\n organizationId: Id,\n appleTeamId: Schema.NullOr(Id),\n identifier: Schema.String,\n name: Schema.String,\n model: Schema.NullOr(Schema.String),\n deviceClass: DeviceClass,\n enabled: Schema.Boolean,\n appleDevicePortalId: Schema.NullOr(Schema.String),\n createdAt: DateTimeString,\n updatedAt: DateTimeString,\n}) {}\n\nexport const RegisterDeviceBody = Schema.Struct({\n identifier: DeviceIdentifier,\n name: Schema.String.pipe(Schema.minLength(1), Schema.maxLength(120)),\n deviceClass: DeviceClass,\n model: Schema.optional(Schema.String.pipe(Schema.maxLength(120))),\n appleTeamId: Schema.optional(Id),\n});\n\nexport const UpdateDeviceBody = Schema.Struct({\n name: Schema.optional(Schema.String.pipe(Schema.minLength(1), Schema.maxLength(120))),\n enabled: Schema.optional(Schema.Boolean),\n appleTeamId: Schema.optional(Schema.NullOr(Id)),\n});\n\nexport const DeleteDeviceResult = Schema.Struct({ deleted: Schema.Number });\n\nexport const DeviceSortColumn = Schema.Literal(\"name\", \"createdAt\", \"deviceClass\");\n\n/**\n * Sort param: column name optionally prefixed with `-` for descending.\n * Example: `name` (asc), `-createdAt` (desc).\n */\nexport const DeviceSort = Schema.Union(\n DeviceSortColumn,\n Schema.TemplateLiteral(\"-\", DeviceSortColumn),\n);\n\nexport const ListDevicesParams = Schema.Struct({\n ...PaginationParams.fields,\n deviceClass: Schema.optional(DeviceClass),\n appleTeamId: Schema.optional(Id),\n query: Schema.optional(Schema.String),\n sort: Schema.optional(DeviceSort),\n});\n\nexport class DeviceRegistrationRequest extends Schema.Class<DeviceRegistrationRequest>(\n \"DeviceRegistrationRequest\",\n)({\n id: Id,\n organizationId: Id,\n appleTeamId: Schema.NullOr(Id),\n deviceNameHint: Schema.NullOr(Schema.String),\n deviceClassHint: Schema.NullOr(DeviceClass),\n url: Schema.String,\n expiresAt: DateTimeString,\n consumedAt: Schema.NullOr(DateTimeString),\n consumedDeviceId: Schema.NullOr(Id),\n createdAt: DateTimeString,\n}) {}\n\nexport const CreateRegistrationRequestBody = Schema.Struct({\n deviceNameHint: Schema.optional(Schema.String.pipe(Schema.maxLength(120))),\n deviceClassHint: Schema.optional(DeviceClass),\n ttlHours: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.between(1, 168))),\n appleTeamId: Schema.optional(Id),\n});\n\nexport const ListRegistrationRequestsParams = Schema.Struct({\n active: Schema.optional(Schema.Literal(\"true\", \"false\")),\n appleTeamId: Schema.optional(Id),\n});\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport {\n CreateRegistrationRequestBody,\n DeleteDeviceResult,\n Device,\n DeviceRegistrationRequest,\n ListDevicesParams,\n ListRegistrationRequestsParams,\n RegisterDeviceBody,\n UpdateDeviceBody,\n} from \"../domain/device\";\nimport { Conflict } from \"../domain/errors\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\n\nexport class DevicesGroup extends HttpApiGroup.make(\"devices\")\n .add(\n HttpApiEndpoint.post(\"register\", \"/api/devices\")\n .setPayload(RegisterDeviceBody)\n .addSuccess(Device, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Register device\",\n description: \"Register an Apple device UDID in the caller's active organization\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/devices\")\n .setUrlParams(ListDevicesParams)\n .addSuccess(\n Schema.Struct({\n items: Schema.Array(Device),\n total: Schema.Number,\n page: Schema.Number,\n limit: Schema.Number,\n }),\n )\n .annotateContext(\n OpenApi.annotations({\n title: \"List devices\",\n description: \"List registered Apple devices in the caller's active organization\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"get\")`/api/devices/${idParam}`.addSuccess(Device).annotateContext(\n OpenApi.annotations({\n title: \"Get device\",\n description: \"Get a single device by ID\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.patch(\"update\")`/api/devices/${idParam}`\n .setPayload(UpdateDeviceBody)\n .addSuccess(Device)\n .annotateContext(\n OpenApi.annotations({\n title: \"Update device\",\n description: \"Rename a device or toggle its enabled state\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/devices/${idParam}`\n .addSuccess(DeleteDeviceResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete device\",\n description: \"Remove a registered device from the organization\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"createRegistrationRequest\", \"/api/devices/registration-requests\")\n .setPayload(CreateRegistrationRequestBody)\n .addSuccess(DeviceRegistrationRequest, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Create device registration request\",\n description:\n \"Generate a URL + QR code for self-service device enrollment via Safari on iOS\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"listRegistrationRequests\", \"/api/devices/registration-requests\")\n .setUrlParams(ListRegistrationRequestsParams)\n .addSuccess(\n Schema.Struct({\n items: Schema.Array(DeviceRegistrationRequest),\n }),\n )\n .annotateContext(\n OpenApi.annotations({\n title: \"List device registration requests\",\n description: \"List outstanding device registration invites\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Devices\",\n description: \"Apple device management for ad-hoc builds\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id } from \"./common\";\n\nexport const EnvVarVisibility = Schema.Literal(\"plaintext\", \"sensitive\", \"secret\");\n\nexport class EnvVar extends Schema.Class<EnvVar>(\"EnvVar\")({\n id: Id,\n organizationId: Id,\n projectId: Id,\n environment: Schema.String,\n key: Schema.String,\n visibility: EnvVarVisibility,\n value: Schema.NullOr(Schema.String),\n createdAt: DateTimeString,\n updatedAt: DateTimeString,\n}) {}\n\n// Key validation: uppercase letters, digits, underscores. Must start with letter.\nconst EnvVarKey = Schema.String.pipe(Schema.pattern(/^[A-Z][A-Z0-9_]*$/u), Schema.maxLength(256));\n\nconst EnvVarValue = Schema.String.pipe(Schema.maxLength(32_768));\n\nconst EnvVarEnvironment = Schema.String.pipe(Schema.minLength(1), Schema.maxLength(64));\n\nexport const CreateEnvVarBody = Schema.Struct({\n projectId: Id,\n environment: EnvVarEnvironment,\n key: EnvVarKey,\n value: EnvVarValue,\n visibility: EnvVarVisibility,\n});\n\nexport const UpdateEnvVarBody = Schema.Struct({\n value: Schema.optional(EnvVarValue),\n visibility: Schema.optional(EnvVarVisibility),\n});\n\nexport const BulkImportEnvVarsBody = Schema.Struct({\n projectId: Id,\n environment: EnvVarEnvironment,\n content: Schema.String.pipe(Schema.maxLength(4_000_000)),\n visibility: EnvVarVisibility,\n});\n\nexport const BulkImportResult = Schema.Struct({\n created: Schema.Number,\n updated: Schema.Number,\n skipped: Schema.Number,\n});\n\nexport const DeleteEnvVarResult = Schema.Struct({\n id: Id,\n});\n\nexport const EnvVarExportItem = Schema.Struct({\n key: Schema.String,\n value: Schema.String,\n visibility: EnvVarVisibility,\n});\n\nexport const EnvVarExportResult = Schema.Struct({\n items: Schema.Array(EnvVarExportItem),\n environment: Schema.String,\n});\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport { Id, PaginationParams } from \"../domain/common\";\nimport {\n BulkImportEnvVarsBody,\n BulkImportResult,\n CreateEnvVarBody,\n DeleteEnvVarResult,\n EnvVar,\n EnvVarExportResult,\n UpdateEnvVarBody,\n} from \"../domain/env-var\";\nimport { BadRequest, Conflict } from \"../domain/errors\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\n\nexport class EnvVarsGroup extends HttpApiGroup.make(\"env-vars\")\n .add(\n HttpApiEndpoint.post(\"create\", \"/api/env-vars\")\n .setPayload(CreateEnvVarBody)\n .addSuccess(EnvVar, { status: 201 })\n .addError(BadRequest)\n .addError(Conflict)\n .annotateContext(\n OpenApi.annotations({\n title: \"Create environment variable\",\n description: \"Create a new environment variable for a project\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/env-vars\")\n .setUrlParams(\n Schema.Struct({\n projectId: Id,\n environment: Schema.optional(Schema.String),\n ...PaginationParams.fields,\n }),\n )\n .addSuccess(\n Schema.Struct({\n items: Schema.Array(EnvVar),\n }),\n )\n .annotateContext(\n OpenApi.annotations({\n title: \"List environment variables\",\n description: \"List environment variables with optional filters\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"get\")`/api/env-vars/${idParam}`.addSuccess(EnvVar).annotateContext(\n OpenApi.annotations({\n title: \"Get environment variable\",\n description: \"Get an environment variable by ID\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.patch(\"update\")`/api/env-vars/${idParam}`\n .setPayload(UpdateEnvVarBody)\n .addSuccess(EnvVar)\n .addError(BadRequest)\n .annotateContext(\n OpenApi.annotations({\n title: \"Update environment variable\",\n description: \"Update an environment variable's value or visibility\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/env-vars/${idParam}`\n .addSuccess(DeleteEnvVarResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete environment variable\",\n description: \"Delete an environment variable\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"bulkImport\", \"/api/env-vars/bulk-import\")\n .setPayload(BulkImportEnvVarsBody)\n .addSuccess(BulkImportResult)\n .addError(BadRequest)\n .annotateContext(\n OpenApi.annotations({\n title: \"Bulk import environment variables\",\n description:\n \"Import environment variables from a dotenv-formatted string. Supports KEY=VALUE format with # comments. Quoted values (single/double) are unquoted. Multiline values are not supported.\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"export\", \"/api/env-vars/export\")\n .setUrlParams(\n Schema.Struct({\n projectId: Id,\n environment: Schema.String,\n }),\n )\n .addSuccess(EnvVarExportResult)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Export environment variables\",\n description: \"Export environment variables for a project environment\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Forbidden)\n .addError(BadRequest)\n .annotateContext(\n OpenApi.annotations({\n title: \"Environment Variables\",\n description: \"Manage environment variables for project builds and deployments\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id } from \"./common\";\n\nexport class GoogleServiceAccountKey extends Schema.Class<GoogleServiceAccountKey>(\n \"GoogleServiceAccountKey\",\n)({\n id: Id,\n organizationId: Id,\n clientEmail: Schema.String,\n privateKeyId: Schema.String,\n googleProjectId: Schema.String,\n createdAt: DateTimeString,\n updatedAt: DateTimeString,\n}) {}\n\nexport const UploadGoogleServiceAccountKeyBody = Schema.Struct({\n json: Schema.String.pipe(Schema.minLength(1)),\n});\n\nexport const DeleteGoogleServiceAccountKeyResult = Schema.Struct({ deleted: Schema.Number });\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport { BadRequest, Conflict } from \"../domain/errors\";\nimport {\n DeleteGoogleServiceAccountKeyResult,\n GoogleServiceAccountKey,\n UploadGoogleServiceAccountKeyBody,\n} from \"../domain/google-service-account-key\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\n\nexport class GoogleServiceAccountKeysGroup extends HttpApiGroup.make(\"googleServiceAccountKeys\")\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/google/service-account-keys\")\n .addSuccess(Schema.Struct({ items: Schema.Array(GoogleServiceAccountKey) }))\n .annotateContext(\n OpenApi.annotations({\n title: \"List Google service account keys\",\n description: \"List uploaded Google service account JSON keys\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"upload\", \"/api/google/service-account-keys\")\n .setPayload(UploadGoogleServiceAccountKeyBody)\n .addSuccess(GoogleServiceAccountKey, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Upload service account key\",\n description: \"Upload a Google service account JSON key\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/google/service-account-keys/${idParam}`\n .addSuccess(DeleteGoogleServiceAccountKeyResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete service account key\",\n description: \"Remove a stored Google service account key\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(BadRequest)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Google Service Account Keys\",\n description: \"Manage Google Play + FCM service account JSON keys\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { BundleIdentifier, DistributionType } from \"./apple-provisioning-profile\";\nimport { DateTimeString, Id } from \"./common\";\n\nexport class IosBundleConfiguration extends Schema.Class<IosBundleConfiguration>(\n \"IosBundleConfiguration\",\n)({\n id: Id,\n organizationId: Id,\n projectId: Id,\n bundleIdentifier: Schema.String,\n distributionType: DistributionType,\n appleTeamId: Id,\n appleDistributionCertificateId: Schema.NullOr(Id),\n appleProvisioningProfileId: Schema.NullOr(Id),\n applePushKeyId: Schema.NullOr(Id),\n ascApiKeyId: Schema.NullOr(Id),\n createdAt: DateTimeString,\n updatedAt: DateTimeString,\n}) {}\n\nexport const CreateIosBundleConfigurationBody = Schema.Struct({\n bundleIdentifier: BundleIdentifier,\n distributionType: DistributionType,\n appleTeamId: Id,\n appleDistributionCertificateId: Schema.optional(Id),\n appleProvisioningProfileId: Schema.optional(Id),\n applePushKeyId: Schema.optional(Id),\n ascApiKeyId: Schema.optional(Id),\n});\n\nexport const UpdateIosBundleConfigurationBody = Schema.Struct({\n appleDistributionCertificateId: Schema.optional(Schema.NullOr(Id)),\n appleProvisioningProfileId: Schema.optional(Schema.NullOr(Id)),\n applePushKeyId: Schema.optional(Schema.NullOr(Id)),\n ascApiKeyId: Schema.optional(Schema.NullOr(Id)),\n});\n\nexport const DeleteIosBundleConfigurationResult = Schema.Struct({ deleted: Schema.Number });\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport { BadRequest, Conflict } from \"../domain/errors\";\nimport {\n CreateIosBundleConfigurationBody,\n DeleteIosBundleConfigurationResult,\n IosBundleConfiguration,\n UpdateIosBundleConfigurationBody,\n} from \"../domain/ios-bundle-configuration\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\nconst projectIdParam = HttpApiSchema.param(\"projectId\", Schema.String);\n\nexport class IosBundleConfigurationsGroup extends HttpApiGroup.make(\"iosBundleConfigurations\")\n .add(\n HttpApiEndpoint.get(\"list\")`/api/projects/${projectIdParam}/ios-bundle-configurations`\n .addSuccess(Schema.Struct({ items: Schema.Array(IosBundleConfiguration) }))\n .annotateContext(\n OpenApi.annotations({\n title: \"List iOS bundle configurations\",\n description: \"List all iOS bundle configurations for a project\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"create\")`/api/projects/${projectIdParam}/ios-bundle-configurations`\n .setPayload(CreateIosBundleConfigurationBody)\n .addSuccess(IosBundleConfiguration, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Create iOS bundle configuration\",\n description: \"Bind certificate + profile + push + ASC to a bundle identifier\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.put(\"update\")`/api/ios-bundle-configurations/${idParam}`\n .setPayload(UpdateIosBundleConfigurationBody)\n .addSuccess(IosBundleConfiguration)\n .annotateContext(\n OpenApi.annotations({\n title: \"Update iOS bundle configuration\",\n description: \"Change the credentials bound to an iOS bundle configuration\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/ios-bundle-configurations/${idParam}`\n .addSuccess(DeleteIosBundleConfigurationResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete iOS bundle configuration\",\n description: \"Remove an iOS bundle configuration binding\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(BadRequest)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"iOS Bundle Configurations\",\n description: \"Per-project per-bundle credential bindings\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { PaginationParams, DateTimeString, Id } from \"./common\";\n\nexport class Project extends Schema.Class<Project>(\"Project\")({\n id: Id,\n organizationId: Id,\n name: Schema.String,\n slug: Schema.String,\n createdAt: DateTimeString,\n lastActivityAt: DateTimeString,\n branchCount: Schema.Number,\n channelCount: Schema.Number,\n updateCount: Schema.Number,\n}) {}\n\nexport const ProjectSortColumn = Schema.Literal(\n \"lastActivityAt\",\n \"name\",\n \"createdAt\",\n \"branchCount\",\n \"channelCount\",\n \"updateCount\",\n);\n\n/**\n * Sort param: column name optionally prefixed with `-` for descending.\n * Example: `name` (asc), `-lastActivityAt` (desc).\n */\nexport const ProjectSort = Schema.Union(\n ProjectSortColumn,\n Schema.TemplateLiteral(\"-\", ProjectSortColumn),\n);\n\nexport const ListProjectsParams = Schema.Struct({\n ...PaginationParams.fields,\n query: Schema.optional(Schema.String),\n sort: Schema.optional(ProjectSort),\n});\n\nexport const CreateProjectBody = Schema.Struct({\n name: Schema.String.pipe(Schema.minLength(1)),\n slug: Schema.String.pipe(Schema.minLength(1)),\n});\n\nexport const UpdateProjectBody = Schema.Struct({\n name: Schema.String.pipe(Schema.minLength(1)),\n});\n\nexport const DeleteProjectResult = Schema.Struct({ deleted: Schema.Number });\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport { Conflict } from \"../domain/errors\";\nimport {\n CreateProjectBody,\n DeleteProjectResult,\n ListProjectsParams,\n Project,\n UpdateProjectBody,\n} from \"../domain/project\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\nconst slugParam = HttpApiSchema.param(\"slug\", Schema.String);\n\nexport class ProjectsGroup extends HttpApiGroup.make(\"projects\")\n .add(\n HttpApiEndpoint.post(\"create\", \"/api/projects\")\n .setPayload(CreateProjectBody)\n .addSuccess(Project, { status: 201 })\n .annotateContext(\n OpenApi.annotations({\n title: \"Create project\",\n description: \"Create a new project in the caller's active organization\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/projects\")\n .setUrlParams(ListProjectsParams)\n .addSuccess(\n Schema.Struct({\n items: Schema.Array(Project),\n total: Schema.Number,\n page: Schema.Number,\n limit: Schema.Number,\n }),\n )\n .annotateContext(\n OpenApi.annotations({\n title: \"List projects\",\n description: \"List all projects in the caller's active organization\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"get\")`/api/projects/${idParam}`.addSuccess(Project).annotateContext(\n OpenApi.annotations({\n title: \"Get project\",\n description: \"Get a single project by ID\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"getBySlug\")`/api/projects/by-slug/${slugParam}`\n .addSuccess(Project)\n .annotateContext(\n OpenApi.annotations({\n title: \"Get project by slug\",\n description: \"Get a single project by slug within the caller's active organization\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.patch(\"rename\")`/api/projects/${idParam}`\n .setPayload(UpdateProjectBody)\n .addSuccess(Project)\n .annotateContext(\n OpenApi.annotations({\n title: \"Rename project\",\n description: \"Rename a project\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"delete\")`/api/projects/${idParam}`\n .addSuccess(DeleteProjectResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete project\",\n description: \"Delete a project and all its branches, channels, and updates\",\n }),\n ),\n )\n .addError(NotFound)\n .addError(Conflict)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Projects\",\n description: \"Project management endpoints\",\n }),\n ) {}\n","import { Schema } from \"effect\";\n\nimport { DateTimeString, Id, PaginationParams, Platform } from \"./common\";\n\nexport class Update extends Schema.Class<Update>(\"Update\")({\n id: Id,\n branchId: Id,\n runtimeVersion: Schema.String,\n platform: Platform,\n message: Schema.String,\n metadataJson: Schema.String,\n extraJson: Schema.NullOr(Schema.String),\n groupId: Schema.String,\n rolloutPercentage: Schema.Number,\n isRollback: Schema.Boolean,\n signature: Schema.NullOr(Schema.String),\n certificateChain: Schema.NullOr(Schema.String),\n manifestBody: Schema.NullOr(Schema.String),\n directiveBody: Schema.NullOr(Schema.String),\n createdAt: DateTimeString,\n}) {}\n\nexport const UpdateSortColumn = Schema.Literal(\n \"createdAt\",\n \"runtimeVersion\",\n \"platform\",\n \"rolloutPercentage\",\n);\n\n/**\n * Sort param: column name optionally prefixed with `-` for descending.\n * Example: `runtimeVersion` (asc), `-createdAt` (desc).\n */\nexport const UpdateSort = Schema.Union(\n UpdateSortColumn,\n Schema.TemplateLiteral(\"-\", UpdateSortColumn),\n);\n\nexport const ListUpdatesParams = Schema.Struct({\n projectId: Id,\n branchId: Schema.optional(Id),\n platform: Schema.optional(Platform),\n ...PaginationParams.fields,\n sort: Schema.optional(UpdateSort),\n});\n\nexport const AssetRef = Schema.Struct({\n hash: Schema.String,\n key: Schema.String,\n isLaunch: Schema.Boolean,\n contentChecksum: Schema.optional(Schema.String),\n});\n\nexport const CreateUpdateBody = Schema.Struct({\n branch: Schema.String.pipe(Schema.minLength(1)),\n slug: Schema.String.pipe(Schema.minLength(1)),\n runtimeVersion: Schema.String.pipe(Schema.minLength(1)),\n platform: Platform,\n message: Schema.String,\n groupId: Schema.String.pipe(Schema.minLength(1)),\n metadata: Schema.Record({ key: Schema.String, value: Schema.Unknown }),\n extra: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Unknown })),\n assets: Schema.Array(AssetRef),\n manifestBody: Schema.optional(Schema.String),\n directiveBody: Schema.optional(Schema.String),\n isRollback: Schema.optional(Schema.Boolean),\n signature: Schema.optional(Schema.String),\n certificateChain: Schema.optional(Schema.String),\n rolloutPercentage: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.between(1, 100))),\n});\n\nexport const RepublishBody = Schema.Struct({\n sourceUpdateId: Schema.optional(Id),\n sourceGroupId: Schema.optional(Schema.String.pipe(Schema.minLength(1))),\n destinationBranchId: Schema.optional(Id),\n destinationChannel: Schema.optional(Schema.String.pipe(Schema.minLength(1))),\n message: Schema.optional(Schema.String),\n signedUpdates: Schema.optional(\n Schema.Array(\n Schema.Struct({\n sourceUpdateId: Id,\n manifestBody: Schema.String.pipe(Schema.minLength(1)),\n signature: Schema.String.pipe(Schema.minLength(1)),\n certificateChain: Schema.String.pipe(Schema.minLength(1)),\n }),\n ),\n ),\n});\n\nexport const RepublishResult = Schema.Struct({\n updates: Schema.Array(Update),\n});\n\nexport const DeleteUpdateResult = Schema.Struct({\n deleted: Schema.Number,\n});\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { Forbidden } from \"../auth/errors\";\nimport { NotFound } from \"../auth/ownership\";\nimport { UpdateRolloutBody } from \"../domain/common\";\nimport { BadRequest, Conflict } from \"../domain/errors\";\nimport {\n CreateUpdateBody,\n DeleteUpdateResult,\n ListUpdatesParams,\n RepublishBody,\n RepublishResult,\n Update,\n} from \"../domain/update\";\n\nconst idParam = HttpApiSchema.param(\"id\", Schema.String);\nconst groupIdParam = HttpApiSchema.param(\"groupId\", Schema.String);\n\nexport class UpdatesGroup extends HttpApiGroup.make(\"updates\")\n .add(\n HttpApiEndpoint.post(\"create\", \"/api/updates\")\n .setPayload(CreateUpdateBody)\n .addSuccess(Update, { status: 201 })\n .addError(Conflict)\n .annotateContext(\n OpenApi.annotations({\n title: \"Create update\",\n description: \"Publish a new update (manifest + directive) to a branch\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.get(\"list\", \"/api/updates\")\n .setUrlParams(ListUpdatesParams)\n .addSuccess(\n Schema.Struct({\n items: Schema.Array(Update),\n total: Schema.Number,\n page: Schema.Number,\n limit: Schema.Number,\n }),\n )\n .annotateContext(\n OpenApi.annotations({\n title: \"List updates\",\n description: \"List updates for a project, optionally filtered by branch\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.del(\"deleteGroup\")`/api/updates/${groupIdParam}`\n .addSuccess(DeleteUpdateResult)\n .annotateContext(\n OpenApi.annotations({\n title: \"Delete update group\",\n description: \"Delete all updates in a group (paired iOS + Android updates)\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"republish\", \"/api/updates/republish\")\n .setPayload(RepublishBody)\n .addSuccess(RepublishResult)\n .addError(Conflict)\n .annotateContext(\n OpenApi.annotations({\n title: \"Republish update\",\n description: \"Cross-channel republish (promote) an update\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.patch(\"editRollout\")`/api/updates/${idParam}/rollout`\n .setPayload(UpdateRolloutBody)\n .addSuccess(Update)\n .annotateContext(\n OpenApi.annotations({\n title: \"Edit per-update rollout\",\n description: \"Change the rollout percentage for a specific update\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"completeRollout\")`/api/updates/${idParam}/rollout/complete`\n .addSuccess(Update)\n .annotateContext(\n OpenApi.annotations({\n title: \"Complete per-update rollout\",\n description: \"End rollout — make update available to all devices\",\n }),\n ),\n )\n .add(\n HttpApiEndpoint.post(\"revertRollout\")`/api/updates/${idParam}/rollout/revert`\n .addSuccess(Update)\n .annotateContext(\n OpenApi.annotations({\n title: \"Revert per-update rollout\",\n description: \"End rollout — revert to previous update\",\n }),\n ),\n )\n .addError(BadRequest)\n .addError(NotFound)\n .addError(Forbidden)\n .annotateContext(\n OpenApi.annotations({\n title: \"Updates\",\n description: \"Update publishing, deletion, republish, and per-update rollout endpoints\",\n }),\n ) {}\n","import { HttpApi, OpenApi } from \"@effect/platform\";\n\nimport { Authentication } from \"./auth/middleware\";\nimport { AnalyticsGroup } from \"./groups/analytics\";\nimport { AndroidApplicationIdentifiersGroup } from \"./groups/android-application-identifiers\";\nimport { AndroidBuildCredentialsGroup } from \"./groups/android-build-credentials\";\nimport { AndroidUploadKeystoresGroup } from \"./groups/android-upload-keystores\";\nimport { AppleDistributionCertificatesGroup } from \"./groups/apple-distribution-certificates\";\nimport { AppleProvisioningProfilesGroup } from \"./groups/apple-provisioning-profiles\";\nimport { ApplePushKeysGroup } from \"./groups/apple-push-keys\";\nimport { AppleTeamsGroup } from \"./groups/apple-teams\";\nimport { AscApiKeysGroup } from \"./groups/asc-api-keys\";\nimport { AssetsGroup } from \"./groups/assets\";\nimport { AuditLogsGroup } from \"./groups/audit-logs\";\nimport { BranchesGroup } from \"./groups/branches\";\nimport { BuildCredentialsGroup } from \"./groups/build-credentials\";\nimport { BuildsGroup } from \"./groups/builds\";\nimport { ChannelsGroup } from \"./groups/channels\";\nimport { DevicesGroup } from \"./groups/devices\";\nimport { EnvVarsGroup } from \"./groups/env-vars\";\nimport { GoogleServiceAccountKeysGroup } from \"./groups/google-service-account-keys\";\nimport { IosBundleConfigurationsGroup } from \"./groups/ios-bundle-configurations\";\nimport { ProjectsGroup } from \"./groups/projects\";\nimport { UpdatesGroup } from \"./groups/updates\";\n\nexport class ManagementApi extends HttpApi.make(\"management-api\")\n .add(ProjectsGroup)\n .add(BranchesGroup)\n .add(ChannelsGroup)\n .add(UpdatesGroup)\n .add(AssetsGroup)\n .add(AnalyticsGroup)\n .add(BuildsGroup)\n .add(EnvVarsGroup)\n .add(AuditLogsGroup)\n .add(DevicesGroup)\n .add(AppleTeamsGroup)\n .add(AppleDistributionCertificatesGroup)\n .add(ApplePushKeysGroup)\n .add(AscApiKeysGroup)\n .add(AppleProvisioningProfilesGroup)\n .add(GoogleServiceAccountKeysGroup)\n .add(IosBundleConfigurationsGroup)\n .add(AndroidApplicationIdentifiersGroup)\n .add(AndroidUploadKeystoresGroup)\n .add(AndroidBuildCredentialsGroup)\n .add(BuildCredentialsGroup)\n .middleware(Authentication)\n .annotateContext(\n OpenApi.annotations({\n title: \"Better Update Management API\",\n version: \"1.0.0\",\n description: \"Management API for OTA update publishing, deployment, and analytics\",\n }),\n ) {}\n","import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from \"@effect/platform\";\nimport { Schema } from \"effect\";\n\nimport { NotFound } from \"../auth/ownership\";\nimport { BadRequest, NotAcceptable } from \"../domain/errors\";\n\nconst projectIdParam = HttpApiSchema.param(\"projectId\", Schema.String);\n\nexport class ManifestGroup extends HttpApiGroup.make(\"manifest\")\n .add(\n HttpApiEndpoint.get(\"serve\")`/manifest/${projectIdParam}`\n .addError(BadRequest)\n .addError(NotFound)\n .addError(NotAcceptable)\n .annotateContext(\n OpenApi.annotations({\n title: \"Serve manifest\",\n description: \"Expo Updates protocol v1 manifest endpoint\",\n }),\n ),\n )\n .annotateContext(\n OpenApi.annotations({\n title: \"Protocol\",\n description: \"Expo Updates protocol endpoints\",\n }),\n ) {}\n","import { HttpApi, OpenApi } from \"@effect/platform\";\n\nimport { ManifestGroup } from \"./groups/manifest\";\n\n/**\n * Documentation-only contract for OpenAPI/Scalar generation.\n * The manifest endpoint bypasses HttpApiBuilder at runtime because the Expo Updates\n * protocol requires multipart/mixed responses that do not fit the standard pipeline.\n */\nexport class ProtocolApi extends HttpApi.make(\"protocol-api\")\n .add(ManifestGroup)\n .annotateContext(\n OpenApi.annotations({\n title: \"Better Update Protocol API\",\n version: \"1.0.0\",\n description: \"Expo Updates protocol endpoints (unauthenticated)\",\n }),\n ) {}\n","import process from \"node:process\";\n\nimport { Context, Effect, Layer } from \"effect\";\n\nconst definedEnvironment = (): Readonly<Record<string, string>> =>\n Object.fromEntries(\n Object.entries(process.env).flatMap(([key, value]) =>\n typeof value === \"string\" ? [[key, value] as const] : [],\n ),\n );\n\nexport class CliRuntime extends Context.Tag(\"cli/CliRuntime\")<\n CliRuntime,\n {\n readonly argv: readonly string[];\n readonly platform: NodeJS.Platform;\n readonly cwd: Effect.Effect<string>;\n readonly getEnv: (name: string) => Effect.Effect<string | undefined>;\n readonly homeDirectory: Effect.Effect<string>;\n readonly userName: Effect.Effect<string>;\n readonly commandEnvironment: (\n overrides?: Readonly<Record<string, string>>,\n ) => Effect.Effect<Readonly<Record<string, string>>>;\n readonly setExitCode: (code: number) => Effect.Effect<void>;\n }\n>() {}\n\nexport const CliRuntimeLive = Layer.succeed(CliRuntime, {\n argv: [...process.argv],\n platform: process.platform,\n cwd: Effect.sync(() => process.cwd()),\n getEnv: (name: string) => Effect.sync(() => process.env[name]),\n homeDirectory: Effect.sync(\n () => process.env[\"HOME\"] ?? process.env[\"USERPROFILE\"] ?? process.cwd(),\n ),\n userName: Effect.sync(() => process.env[\"USER\"] ?? process.env[\"USERNAME\"] ?? \"better-update\"),\n commandEnvironment: (overrides = {}) =>\n Effect.sync(() => ({\n ...definedEnvironment(),\n ...overrides,\n })),\n setExitCode: (code: number) =>\n Effect.sync(() => {\n process.exitCode = code;\n }),\n});\n","import path from \"node:path\";\n\nimport { isRecord } from \"@better-update/type-guards\";\nimport { FileSystem } from \"@effect/platform\";\nimport { Context, Effect, Layer } from \"effect\";\n\nimport { AuthRequiredError } from \"../lib/exit-codes\";\nimport { formatCause } from \"../lib/format-error\";\nimport { CliRuntime } from \"./cli-runtime\";\n\nexport class AuthStore extends Context.Tag(\"cli/AuthStore\")<\n AuthStore,\n {\n readonly getToken: Effect.Effect<string, AuthRequiredError>;\n readonly saveToken: (token: string) => Effect.Effect<void, AuthRequiredError>;\n readonly clearToken: Effect.Effect<void>;\n }\n>() {}\n\nexport const AuthStoreLive = Layer.effect(\n AuthStore,\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const runtime = yield* CliRuntime;\n const homeDirectory = yield* runtime.homeDirectory;\n const authDir = path.join(homeDirectory, \".better-update\");\n const authFile = path.join(authDir, \"auth.json\");\n\n return {\n getToken: Effect.gen(function* () {\n const envToken = yield* runtime.getEnv(\"BETTER_UPDATE_TOKEN\");\n if (envToken) {\n return envToken;\n }\n\n const content = yield* fs.readFileString(authFile).pipe(\n Effect.mapError(\n () =>\n new AuthRequiredError({\n message: \"Not logged in. Run `better-update login` to authenticate.\",\n }),\n ),\n );\n\n const parsed = yield* Effect.try({\n try: (): unknown => JSON.parse(content),\n catch: () =>\n new AuthRequiredError({\n message: \"Corrupted auth file. Run `better-update login` to re-authenticate.\",\n }),\n });\n if (!isRecord(parsed)) {\n return yield* new AuthRequiredError({\n message: \"Invalid auth file. Run `better-update login` to re-authenticate.\",\n });\n }\n const { token } = parsed;\n if (typeof token !== \"string\") {\n return yield* new AuthRequiredError({\n message: \"Invalid auth file. Run `better-update login` to re-authenticate.\",\n });\n }\n\n return token;\n }),\n\n saveToken: (token: string) =>\n Effect.gen(function* () {\n yield* fs.makeDirectory(authDir, { recursive: true });\n yield* fs.chmod(authDir, 0o700);\n yield* fs.writeFileString(authFile, `${JSON.stringify({ token }, null, 2)}\\n`);\n yield* fs.chmod(authFile, 0o600);\n }).pipe(\n Effect.mapError(\n (cause) =>\n new AuthRequiredError({\n message: `Failed to save auth token: ${formatCause(cause)}`,\n }),\n ),\n ),\n\n clearToken: fs.remove(authFile).pipe(Effect.catchAll(() => Effect.void)),\n };\n }),\n);\n","import path from \"node:path\";\n\nimport { isRecord } from \"@better-update/type-guards\";\nimport { FileSystem } from \"@effect/platform\";\nimport { Context, Data, Effect, Layer } from \"effect\";\n\nimport { CliRuntime } from \"./cli-runtime\";\n\nconst DEFAULT_BASE_URL = \"https://graph.better-update.dev\";\nconst DEFAULT_WEB_URL = \"https://better-update.dev\";\n\nclass ConfigStoreParseError extends Data.TaggedError(\"ConfigStoreParseError\")<{\n readonly message: string;\n readonly cause: unknown;\n}> {}\n\nconst normalizeUrl = (value: string): string => value.replace(/\\/$/u, \"\");\n\nexport class ConfigStore extends Context.Tag(\"cli/ConfigStore\")<\n ConfigStore,\n {\n readonly getBaseUrl: Effect.Effect<string>;\n readonly getWebUrl: Effect.Effect<string>;\n }\n>() {}\n\nexport const ConfigStoreLive = Layer.effect(\n ConfigStore,\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const runtime = yield* CliRuntime;\n const homeDirectory = yield* runtime.homeDirectory;\n const configFile = path.join(homeDirectory, \".better-update\", \"config.json\");\n const readConfig = fs.readFileString(configFile).pipe(\n Effect.catchAll(() => Effect.succeed(\"\")),\n Effect.flatMap((content) =>\n content.length === 0\n ? Effect.succeed(undefined)\n : Effect.try({\n try: (): unknown => JSON.parse(content),\n catch: (cause) =>\n new ConfigStoreParseError({\n message: \"Config file contains invalid JSON\",\n cause,\n }),\n }).pipe(\n Effect.map((parsed) => (isRecord(parsed) ? parsed : undefined)),\n Effect.catchAll(() => Effect.succeed(undefined)),\n ),\n ),\n );\n const resolveBaseUrl = Effect.gen(function* () {\n const envUrl = yield* runtime.getEnv(\"BETTER_UPDATE_URL\");\n if (envUrl) {\n return normalizeUrl(envUrl);\n }\n\n const parsed = yield* readConfig;\n const baseUrl = parsed?.[\"baseUrl\"];\n if (typeof baseUrl === \"string\") {\n return normalizeUrl(baseUrl);\n }\n\n return DEFAULT_BASE_URL;\n });\n\n return {\n getBaseUrl: resolveBaseUrl,\n\n getWebUrl: Effect.gen(function* () {\n const envUrl = yield* runtime.getEnv(\"BETTER_UPDATE_WEB_URL\");\n if (envUrl) {\n return normalizeUrl(envUrl);\n }\n\n const parsed = yield* readConfig;\n const webUrl = parsed?.[\"webUrl\"];\n if (typeof webUrl === \"string\") {\n return normalizeUrl(webUrl);\n }\n\n return DEFAULT_WEB_URL;\n }),\n };\n }),\n);\n","import { ManagementApi } from \"@better-update/api\";\nimport { HttpApiClient, HttpClient, HttpClientRequest } from \"@effect/platform\";\nimport { Context, Effect, Layer } from \"effect\";\n\nimport { AuthStore } from \"./auth-store\";\nimport { ConfigStore } from \"./config-store\";\n\nimport type { AuthRequiredError } from \"../lib/exit-codes\";\n\nconst client = HttpApiClient.make(ManagementApi);\nexport type ApiClient = Effect.Effect.Success<typeof client>;\n\nexport class ApiClientService extends Context.Tag(\"cli/ApiClient\")<\n ApiClientService,\n {\n readonly get: Effect.Effect<ApiClient, AuthRequiredError>;\n }\n>() {}\n\nexport const apiClient: Effect.Effect<ApiClient, AuthRequiredError, ApiClientService> =\n // eslint-disable-next-line unicorn/no-array-method-this-argument -- Effect.flatMap, not Array.prototype.flatMap; the second arg is a continuation, not a thisArg\n Effect.flatMap(ApiClientService, ({ get }) => get);\n\nexport const ApiClientLive = Layer.effect(\n ApiClientService,\n Effect.gen(function* () {\n const clientService = yield* HttpClient.HttpClient;\n const authStore = yield* AuthStore;\n const configStore = yield* ConfigStore;\n\n return {\n get: Effect.gen(function* () {\n const token = yield* authStore.getToken;\n const baseUrl = yield* configStore.getBaseUrl;\n return yield* HttpApiClient.make(ManagementApi, {\n transformClient: HttpClient.mapRequest(HttpClientRequest.bearerToken(token)),\n baseUrl,\n }).pipe(Effect.provideService(HttpClient.HttpClient, clientService));\n }),\n };\n }),\n);\n","export type JsonParseResult =\n | { readonly ok: true; readonly value: unknown }\n | { readonly ok: false };\n\nexport const parseJsonResult = (text: string): JsonParseResult => {\n // eslint-disable-next-line functional/no-try-statements -- JSON.parse exposes syntax errors via throw; this helper converts them to an explicit result value\n try {\n return { ok: true, value: JSON.parse(text) as unknown };\n } catch {\n return { ok: false };\n }\n};\n\nexport const safeJsonParse = (text: string): unknown => {\n const result = parseJsonResult(text);\n return result.ok ? result.value : null;\n};\n","import path from \"node:path\";\n\nimport { safeJsonParse } from \"@better-update/safe-json\";\nimport { isRecord } from \"@better-update/type-guards\";\nimport { FileSystem } from \"@effect/platform\";\nimport { Context, Effect, Layer } from \"effect\";\n\nimport type { Auth } from \"@expo/apple-utils\";\n\nimport { AppleAuthError } from \"../lib/exit-codes\";\nimport { formatCause } from \"../lib/format-error\";\nimport { CliRuntime } from \"./cli-runtime\";\n\n// The cookies payload accepted by @expo/apple-utils Auth.loginWithCookiesAsync.\n// Derived structurally so we don't depend on the un-exported `CookiesJSON` alias.\nexport type AppleSessionCookies = Parameters<typeof Auth.loginWithCookiesAsync>[0][\"cookies\"];\n\nexport interface SerializedAppleSession {\n readonly cookies: AppleSessionCookies;\n readonly teamId: string;\n readonly username: string;\n readonly providerId?: number;\n}\n\nexport class AppleSessionStore extends Context.Tag(\"cli/AppleSessionStore\")<\n AppleSessionStore,\n {\n readonly loadSession: Effect.Effect<SerializedAppleSession | null>;\n readonly saveSession: (session: SerializedAppleSession) => Effect.Effect<void, AppleAuthError>;\n readonly clearSession: Effect.Effect<void>;\n }\n>() {}\n\nexport const AppleSessionStoreLive = Layer.effect(\n AppleSessionStore,\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const runtime = yield* CliRuntime;\n const homeDirectory = yield* runtime.homeDirectory;\n const sessionDir = path.join(homeDirectory, \".better-update\");\n const sessionFile = path.join(sessionDir, \"apple-session.json\");\n\n return {\n loadSession: Effect.gen(function* () {\n const content = yield* fs\n .readFileString(sessionFile)\n .pipe(Effect.catchAll(() => Effect.succeed(null)));\n\n if (!content) {\n return null;\n }\n\n const parsed = safeJsonParse(content);\n if (!isRecord(parsed)) {\n return null;\n }\n\n if (\n typeof parsed[\"teamId\"] !== \"string\" ||\n typeof parsed[\"username\"] !== \"string\" ||\n !parsed[\"cookies\"]\n ) {\n return null;\n }\n\n const providerIdRaw = parsed[\"providerId\"];\n const hasProviderId = typeof providerIdRaw === \"number\" && Number.isInteger(providerIdRaw);\n\n // eslint-disable-next-line typescript/no-unsafe-type-assertion, typescript/no-unsafe-assignment -- AppleSessionCookies is an opaque cookies payload from @expo/apple-utils; round-tripped verbatim from disk\n const cookies = parsed[\"cookies\"] as AppleSessionCookies;\n\n const session: SerializedAppleSession = {\n // eslint-disable-next-line typescript/no-unsafe-assignment -- see disable on the `cookies` declaration above; same opaque value\n cookies,\n teamId: parsed[\"teamId\"],\n username: parsed[\"username\"],\n ...(hasProviderId ? { providerId: providerIdRaw } : {}),\n };\n return session;\n }),\n\n saveSession: (session: SerializedAppleSession) =>\n Effect.gen(function* () {\n yield* fs.makeDirectory(sessionDir, { recursive: true });\n yield* fs.chmod(sessionDir, 0o700);\n yield* fs.writeFileString(sessionFile, `${JSON.stringify(session, null, 2)}\\n`);\n yield* fs.chmod(sessionFile, 0o600);\n }).pipe(\n Effect.mapError(\n (cause) =>\n new AppleAuthError({\n message: `Failed to save Apple session: ${formatCause(cause)}`,\n }),\n ),\n ),\n\n clearSession: fs.remove(sessionFile).pipe(Effect.catchAll(() => Effect.void)),\n };\n }),\n);\n","import { FileSystem, HttpClient, HttpClientRequest } from \"@effect/platform\";\nimport { Context, Effect, Layer } from \"effect\";\n\nimport { PresignedUrlExpiredError, UploadFailedError } from \"../lib/exit-codes\";\n\nconst EXPIRY_SAFETY_MARGIN_MS = 30_000;\n\nexport interface PutToPresignedUrlInput {\n readonly url: string;\n readonly filePath: string;\n readonly byteSize: number;\n readonly expiresAt: string;\n readonly headers?: Record<string, string>;\n}\n\nexport class PresignedUploadClient extends Context.Tag(\"cli/PresignedUploadClient\")<\n PresignedUploadClient,\n {\n readonly putToPresignedUrl: (\n input: PutToPresignedUrlInput,\n ) => Effect.Effect<void, PresignedUrlExpiredError | UploadFailedError>;\n }\n>() {}\n\nexport const PresignedUploadClientLive = Layer.effect(\n PresignedUploadClient,\n Effect.gen(function* () {\n const client = yield* HttpClient.HttpClient;\n const fileSystem = yield* FileSystem.FileSystem;\n\n return {\n putToPresignedUrl: ({\n url,\n filePath,\n byteSize,\n expiresAt,\n headers,\n }: PutToPresignedUrlInput) =>\n Effect.gen(function* () {\n const now = Date.now();\n const expiryMs = new Date(expiresAt).getTime();\n if (Number.isNaN(expiryMs) || now > expiryMs - EXPIRY_SAFETY_MARGIN_MS) {\n return yield* new PresignedUrlExpiredError({\n message: `Presigned upload URL expired or too close to expiry (expiresAt=${expiresAt}).`,\n });\n }\n\n const request = yield* HttpClientRequest.put(url).pipe(\n HttpClientRequest.bodyFile(filePath),\n Effect.provideService(FileSystem.FileSystem, fileSystem),\n Effect.map(\n HttpClientRequest.setHeaders({\n \"content-length\": String(byteSize),\n ...headers,\n }),\n ),\n Effect.mapError(\n (cause) =>\n new UploadFailedError({\n message: `Failed to open artifact for upload: ${String(cause)}`,\n }),\n ),\n );\n\n const response = yield* client.execute(request).pipe(\n Effect.mapError(\n (cause) =>\n new UploadFailedError({\n message: `HTTP request to presigned URL failed: ${String(cause)}`,\n }),\n ),\n );\n\n if (response.status < 200 || response.status >= 300) {\n const body = yield* response.text.pipe(Effect.orElseSucceed(() => \"\"));\n return yield* new UploadFailedError({\n message: `Presigned URL upload failed with status ${response.status}: ${body}`,\n });\n }\n return undefined;\n }),\n };\n }),\n);\n","import { Context, Effect, Layer } from \"effect\";\n\nimport { UpdatePublishError } from \"../lib/exit-codes\";\nimport { formatCause } from \"../lib/format-error\";\nimport { ApiClientService } from \"./api-client\";\nimport { PresignedUploadClient } from \"./presigned-upload\";\n\nexport interface UploadUpdateAssetInput {\n readonly path: string;\n readonly hash: string;\n readonly byteSize: number;\n readonly uploadUrl: string;\n readonly uploadExpiresAt: string;\n readonly uploadHeaders: Record<string, string>;\n}\n\nexport class UpdateAssetUploader extends Context.Tag(\"cli/UpdateAssetUploader\")<\n UpdateAssetUploader,\n {\n readonly uploadAssetBinary: (\n input: UploadUpdateAssetInput,\n ) => Effect.Effect<void, UpdatePublishError>;\n }\n>() {}\n\nexport const UpdateAssetUploaderLive = Layer.effect(\n UpdateAssetUploader,\n Effect.gen(function* () {\n const presignedUploadClient = yield* PresignedUploadClient;\n const apiService = yield* ApiClientService;\n\n return {\n uploadAssetBinary: (asset: UploadUpdateAssetInput) =>\n Effect.gen(function* () {\n const api = yield* apiService.get.pipe(\n Effect.mapError(\n (cause) =>\n new UpdatePublishError({\n message: `Asset upload requires authentication: ${formatCause(cause)}`,\n }),\n ),\n );\n\n yield* presignedUploadClient\n .putToPresignedUrl({\n url: asset.uploadUrl,\n filePath: asset.path,\n byteSize: asset.byteSize,\n expiresAt: asset.uploadExpiresAt,\n headers: asset.uploadHeaders,\n })\n .pipe(\n Effect.mapError(\n (cause) =>\n new UpdatePublishError({\n message: `Asset upload failed for ${asset.hash}: ${formatCause(cause)}`,\n }),\n ),\n );\n\n yield* api.assets.finalize({ path: { hash: asset.hash } }).pipe(\n Effect.mapError(\n (cause) =>\n new UpdatePublishError({\n message: `Asset finalize failed for ${asset.hash}: ${formatCause(cause)}`,\n }),\n ),\n );\n }),\n };\n }),\n);\n","import { FetchHttpClient } from \"@effect/platform\";\nimport { NodeContext } from \"@effect/platform-node\";\nimport { Layer } from \"effect\";\n\nimport { ApiClientLive } from \"./services/api-client\";\nimport { AppleSessionStoreLive } from \"./services/apple-session-store\";\nimport { AuthStoreLive } from \"./services/auth-store\";\nimport { CliRuntimeLive } from \"./services/cli-runtime\";\nimport { ConfigStoreLive } from \"./services/config-store\";\nimport { PresignedUploadClientLive } from \"./services/presigned-upload\";\nimport { UpdateAssetUploaderLive } from \"./services/update-asset-uploader\";\n\nconst CliPlatformLayer = Layer.mergeAll(CliRuntimeLive, NodeContext.layer, FetchHttpClient.layer);\nconst CliStoreLayer = Layer.mergeAll(AuthStoreLive, ConfigStoreLive, AppleSessionStoreLive).pipe(\n Layer.provide(CliPlatformLayer),\n);\nconst CliAdapterDependencies = Layer.mergeAll(CliPlatformLayer, CliStoreLayer);\nconst ApiClientLayer = ApiClientLive.pipe(Layer.provide(CliAdapterDependencies));\nconst PresignedUploadLayer = PresignedUploadClientLive.pipe(Layer.provide(CliPlatformLayer));\nconst UpdateAssetUploaderLayer = UpdateAssetUploaderLive.pipe(\n Layer.provide(Layer.mergeAll(ApiClientLayer, PresignedUploadLayer)),\n);\n\nexport const CliLive = Layer.mergeAll(\n CliAdapterDependencies,\n ApiClientLayer,\n PresignedUploadLayer,\n UpdateAssetUploaderLayer,\n);\n","import { Console, Effect } from \"effect\";\n\nimport { CliRuntime } from \"../services/cli-runtime\";\n\nexport const exitWith = (code: number, message: string): Effect.Effect<void, never, CliRuntime> =>\n Console.error(message).pipe(\n Effect.zipRight(\n Effect.gen(function* () {\n const runtime = yield* CliRuntime;\n yield* runtime.setExitCode(code);\n }),\n ),\n );\n","import { Effect } from \"effect\";\n\nimport { exitWith } from \"../application/command-exit\";\nimport { formatCause } from \"./format-error\";\n\nimport type { CliRuntime } from \"../services/cli-runtime\";\n\ntype ExitCode = 1 | 2 | 3 | 4 | 5 | 6 | 7;\n\ninterface TaggedError {\n readonly message: string;\n}\n\ntype Handler = (error: TaggedError) => Effect.Effect<void, never, CliRuntime>;\n\nconst BASE_TAG_MAP: Record<string, ExitCode> = {\n AuthRequiredError: 3,\n ProjectNotLinkedError: 4,\n NotFound: 1,\n Conflict: 1,\n Forbidden: 1,\n BadRequest: 2,\n InvalidArgumentError: 2,\n};\n\nconst SYSTEM_TAG_MESSAGE: Record<string, (error: TaggedError) => string> = {\n SystemError: (error) => `Filesystem error: ${error.message}`,\n BadArgument: (error) => `Invalid argument: ${error.message}`,\n};\n\nconst SYSTEM_TAG_CODE: Record<string, ExitCode> = {\n SystemError: 6,\n BadArgument: 6,\n};\n\nexport const makeCommandErrorHandler = (\n extras: Record<string, ExitCode> = {},\n): (<Success, Requirements>(\n effect: Effect.Effect<Success, unknown, Requirements>,\n) => Effect.Effect<Success, never, Requirements | CliRuntime>) => {\n const combined = { ...BASE_TAG_MAP, ...extras };\n const handlers: Record<string, Handler> = {};\n for (const [tag, code] of Object.entries(combined)) {\n const systemFormat = SYSTEM_TAG_MESSAGE[tag];\n const resolvedCode = SYSTEM_TAG_CODE[tag] ?? code;\n handlers[tag] = (error) =>\n exitWith(resolvedCode, systemFormat ? systemFormat(error) : error.message);\n }\n\n return <Success, Requirements>(\n effect: Effect.Effect<Success, unknown, Requirements>,\n ): Effect.Effect<Success, never, Requirements | CliRuntime> => {\n const piped = effect.pipe(\n // eslint-disable-next-line typescript/no-unsafe-type-assertion -- Effect.catchTags tag-inference requires a literal object; we accept a dynamic handler map so tags are chosen at runtime\n Effect.catchTags(handlers as never),\n Effect.catchAll((cause) => exitWith(1, formatCause(cause))),\n );\n // eslint-disable-next-line typescript/no-unsafe-type-assertion -- catchTags narrowing lost when handlers is dynamic; re-narrow at the boundary\n return piped as Effect.Effect<Success, never, Requirements | CliRuntime>;\n };\n};\n","import { Effect } from \"effect\";\n\nimport { CliLive } from \"../app-layer\";\nimport { makeCommandErrorHandler } from \"./command-errors\";\n\ntype ExtraExitMap = Parameters<typeof makeCommandErrorHandler>[0];\n\nexport const runEffect = async <Value, Err, Req>(\n effect: Effect.Effect<Value, Err, Req>,\n extras: ExtraExitMap = {},\n): Promise<void> => {\n const handled = makeCommandErrorHandler(extras)(effect);\n // eslint-disable-next-line typescript/no-unsafe-type-assertion -- CliLive provides every service the CLI handlers require; after makeCommandErrorHandler's catch-all the failure channel is `never`\n const provided = handled.pipe(Effect.provide(CliLive)) as Effect.Effect<Value>;\n return Effect.runPromise(provided.pipe(Effect.asVoid));\n};\n","import { Console, Effect } from \"effect\";\n\nexport const printTable = (\n headers: readonly string[],\n rows: readonly (readonly string[])[],\n): Effect.Effect<void> =>\n Effect.gen(function* () {\n const allRows = [headers, ...rows];\n const colWidths = headers.map((_, colIndex) =>\n // eslint-disable-next-line eslint-js/no-restricted-syntax -- table padding for ragged rows; missing cell treated as empty-width\n Math.max(...allRows.map((row) => (row[colIndex] ?? \"\").length)),\n );\n\n const formatRow = (row: readonly string[]): string =>\n row.map((cell, idx) => cell.padEnd(colWidths[idx] ?? 0)).join(\" \");\n\n yield* Console.log(formatRow(headers));\n yield* Console.log(colWidths.map((width) => \"-\".repeat(width)).join(\" \"));\n\n for (const row of rows) {\n yield* Console.log(formatRow(row));\n }\n });\n\nexport const printKeyValue = (pairs: readonly (readonly [string, string])[]): Effect.Effect<void> =>\n Effect.gen(function* () {\n const maxKeyLen = Math.max(...pairs.map(([key]) => key.length));\n\n for (const [key, value] of pairs) {\n yield* Console.log(`${key.padEnd(maxKeyLen)} ${value}`);\n }\n });\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { printTable } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\n\nexport const adoptionCommand = defineCommand({\n meta: { name: \"adoption\", description: \"Show update adoption across devices\" },\n args: {\n period: { type: \"enum\", options: [\"1d\", \"7d\", \"30d\", \"90d\"], description: \"Time window\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const periodFilter = args.period ? { period: args.period } : {};\n\n const result = yield* api.analytics.adoption({\n urlParams: { projectId, ...periodFilter },\n });\n\n if (result.updates.length === 0) {\n yield* Console.log(\"No adoption data found.\");\n return;\n }\n\n yield* printTable(\n [\"Update ID\", \"Devices\", \"First Seen\", \"Last Seen\"],\n result.updates.map((update) => [\n update.updateId,\n String(update.devices),\n update.firstSeen,\n update.lastSeen,\n ]),\n );\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { printKeyValue } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\n\nexport const channelsCommand = defineCommand({\n meta: { name: \"channels\", description: \"Stats for a specific channel\" },\n args: {\n channel: { type: \"string\", required: true, description: \"Channel name\" },\n period: { type: \"enum\", options: [\"1d\", \"7d\", \"30d\", \"90d\"], description: \"Time window\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const periodFilter = args.period ? { period: args.period } : {};\n\n const result = yield* api.analytics.channels({\n urlParams: { projectId, channel: args.channel, ...periodFilter },\n });\n\n yield* printKeyValue([\n [\"Channel\", result.channel],\n [\"Total Requests\", String(result.totalRequests)],\n [\"Unique Devices\", String(result.uniqueDevices)],\n [\"Manifest\", String(result.responseTypeDistribution.manifest)],\n [\"Directive\", String(result.responseTypeDistribution.directive)],\n [\"No Update\", String(result.responseTypeDistribution.no_update)],\n ]);\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { printTable } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\n\nexport const platformsCommand = defineCommand({\n meta: { name: \"platforms\", description: \"Stats by platform\" },\n args: {\n period: { type: \"enum\", options: [\"1d\", \"7d\", \"30d\", \"90d\"], description: \"Time window\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const periodFilter = args.period ? { period: args.period } : {};\n\n const result = yield* api.analytics.platforms({\n urlParams: { projectId, ...periodFilter },\n });\n\n if (result.platforms.length === 0) {\n yield* Console.log(\"No platform data found.\");\n return;\n }\n\n yield* printTable(\n [\"Platform\", \"Requests\", \"Devices\"],\n result.platforms.map((platform) => [\n platform.platform,\n String(platform.requests),\n String(platform.devices),\n ]),\n );\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { printKeyValue } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\n\nexport const updatesCommand = defineCommand({\n meta: { name: \"updates\", description: \"Stats for a specific update\" },\n args: {\n \"update-id\": { type: \"string\", required: true, description: \"Update ID\" },\n period: { type: \"enum\", options: [\"1d\", \"7d\", \"30d\", \"90d\"], description: \"Time window\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const periodFilter = args.period ? { period: args.period } : {};\n\n const result = yield* api.analytics.updates({\n urlParams: { projectId, updateId: args[\"update-id\"], ...periodFilter },\n });\n\n yield* printKeyValue([\n [\"Update ID\", result.updateId],\n [\"Total Requests\", String(result.totalRequests)],\n [\"Unique Devices\", String(result.uniqueDevices)],\n [\"Manifest\", String(result.byResponseType.manifest)],\n [\"Directive\", String(result.byResponseType.directive)],\n [\"No Update\", String(result.byResponseType.no_update)],\n ]);\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\n\nimport { adoptionCommand } from \"./adoption\";\nimport { channelsCommand } from \"./channels\";\nimport { platformsCommand } from \"./platforms\";\nimport { updatesCommand } from \"./updates\";\n\nexport const analyticsCommand = defineCommand({\n meta: { name: \"analytics\", description: \"View deployment analytics\" },\n subCommands: {\n adoption: adoptionCommand,\n updates: updatesCommand,\n channels: channelsCommand,\n platforms: platformsCommand,\n },\n});\n","import { Effect, ParseResult, Schema } from \"effect\";\n\nimport { InvalidArgumentError } from \"./exit-codes\";\n\nexport const RolloutPercentage = Schema.Number.pipe(\n Schema.int(),\n Schema.between(1, 100),\n).annotations({\n message: () => \"Rollout percentage must be between 1 and 100.\",\n identifier: \"RolloutPercentage\",\n});\n\nexport const KeyValuePair = Schema.Struct({\n key: Schema.String,\n value: Schema.String,\n});\nexport type KeyValuePair = Schema.Schema.Type<typeof KeyValuePair>;\n\nexport const KeyValueFromString = Schema.transformOrFail(Schema.String, KeyValuePair, {\n strict: true,\n decode: (input, _options, ast) => {\n const eqIndex = input.indexOf(\"=\");\n if (eqIndex <= 0) {\n return ParseResult.fail(\n new ParseResult.Type(ast, input, \"Invalid format. Use KEY=VALUE (e.g. API_KEY=abc123)\"),\n );\n }\n return ParseResult.succeed({\n key: input.slice(0, eqIndex),\n value: input.slice(eqIndex + 1),\n });\n },\n encode: ({ key, value }) => ParseResult.succeed(`${key}=${value}`),\n});\n\nexport const parseRolloutPercentage = (\n raw: string,\n flag: string,\n): Effect.Effect<number, InvalidArgumentError> =>\n Effect.try({\n try: () => Schema.decodeUnknownSync(RolloutPercentage)(Number(raw)),\n catch: () =>\n new InvalidArgumentError({\n message: `--${flag} must be an integer between 1 and 100, got \"${raw}\".`,\n }),\n });\n\nexport const parseKeyValue = (raw: string): Effect.Effect<KeyValuePair, InvalidArgumentError> =>\n Effect.try({\n try: () => Schema.decodeUnknownSync(KeyValueFromString)(raw),\n catch: () =>\n new InvalidArgumentError({\n message: \"Invalid format. Use KEY=VALUE (e.g. API_KEY=abc123)\",\n }),\n });\n\nexport const parseLimit = (\n raw: string | undefined,\n defaultValue: number,\n): Effect.Effect<number, InvalidArgumentError> => {\n if (raw === undefined) {\n return Effect.succeed(defaultValue);\n }\n const parsed = Number(raw);\n if (!Number.isInteger(parsed) || parsed < 1) {\n return Effect.fail(\n new InvalidArgumentError({ message: `--limit must be a positive integer, got \"${raw}\".` }),\n );\n }\n return Effect.succeed(parsed);\n};\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { parseLimit } from \"../../lib/cli-schemas\";\nimport { printTable } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\n\nexport const listCommand = defineCommand({\n meta: { name: \"list\", description: \"List audit log entries\" },\n args: {\n \"resource-type\": { type: \"string\", description: \"Filter by resource type\" },\n from: { type: \"string\", description: \"ISO timestamp lower bound\" },\n to: { type: \"string\", description: \"ISO timestamp upper bound\" },\n limit: { type: \"string\", default: \"100\", description: \"Max rows (default 100)\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const limit = yield* parseLimit(args.limit, 100);\n const api = yield* apiClient;\n\n const filters: Record<string, string> = {};\n if (args[\"resource-type\"]) {\n filters[\"resourceType\"] = args[\"resource-type\"];\n }\n if (args.from) {\n filters[\"from\"] = args.from;\n }\n if (args.to) {\n filters[\"to\"] = args.to;\n }\n\n const { items } = yield* api[\"audit-logs\"].list({\n urlParams: { ...filters, limit },\n });\n\n if (items.length === 0) {\n yield* Console.log(\"No audit log entries found.\");\n return;\n }\n\n yield* printTable(\n [\"ID\", \"Action\", \"Resource Type\", \"Resource ID\", \"Actor\", \"Source\", \"Created\"],\n items.map((log) => [\n log.id,\n log.action,\n log.resourceType,\n log.resourceId ?? \"-\",\n log.actorEmail,\n log.source,\n log.createdAt,\n ]),\n );\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\n\nimport { listCommand } from \"./list\";\n\nexport const auditLogsCommand = defineCommand({\n meta: { name: \"audit-logs\", description: \"View audit logs\" },\n subCommands: {\n list: listCommand,\n },\n});\n","import { Effect } from \"effect\";\n\ninterface NumberedPage<Item> {\n readonly items: readonly Item[];\n readonly total: number;\n readonly page: number;\n readonly limit: number;\n}\n\nconst MAX_PAGES = 100;\n\n/**\n * Drain a page-numbered list endpoint into a single array. Used by CLI\n * commands that need the full set, not a page slice.\n */\nexport const drainPages = <Item, Err, Req>(\n fetchPage: (page: number) => Effect.Effect<NumberedPage<Item>, Err, Req>,\n): Effect.Effect<readonly Item[], Err, Req> => {\n const loop = (\n accumulator: readonly Item[],\n page: number,\n ): Effect.Effect<readonly Item[], Err, Req> =>\n fetchPage(page).pipe(\n Effect.flatMap((response) => {\n const next = [...accumulator, ...response.items];\n const fetched = page * response.limit;\n const reachedLimit = page >= MAX_PAGES || next.length >= response.total;\n return reachedLimit || fetched >= response.total\n ? Effect.succeed(next)\n : loop(next, page + 1);\n }),\n );\n return loop([], 1);\n};\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../lib/app-json\";\nimport { runEffect } from \"../lib/citty-effect\";\nimport { drainPages } from \"../lib/drain-cursor\";\nimport { printKeyValue, printTable } from \"../lib/output\";\nimport { apiClient } from \"../services/api-client\";\n\nconst listCommand = defineCommand({\n meta: { name: \"list\", description: \"List branches for the linked project\" },\n run: async () =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n const items = yield* drainPages((page) =>\n api.branches.list({\n urlParams: { projectId, limit: 100, page },\n }),\n );\n\n if (items.length === 0) {\n yield* Console.log(\"No branches found.\");\n return;\n }\n\n yield* printTable(\n [\"ID\", \"Name\", \"Created\"],\n items.map((branch) => [branch.id, branch.name, branch.createdAt]),\n );\n }),\n ),\n});\n\nconst createCommand = defineCommand({\n meta: { name: \"create\", description: \"Create a branch\" },\n args: {\n name: { type: \"string\", required: true, description: \"Branch name\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n const branch = yield* api.branches.create({\n payload: { projectId, name: args.name },\n });\n yield* printKeyValue([\n [\"ID\", branch.id],\n [\"Name\", branch.name],\n [\"Created\", branch.createdAt],\n ]);\n }),\n ),\n});\n\nconst renameCommand = defineCommand({\n meta: { name: \"rename\", description: \"Rename a branch\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Branch ID\" },\n name: { type: \"string\", required: true, description: \"New branch name\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const branch = yield* api.branches.rename({\n path: { id: args.id },\n payload: { name: args.name },\n });\n yield* Console.log(`Branch renamed to \"${branch.name}\".`);\n }),\n ),\n});\n\nconst deleteCommand = defineCommand({\n meta: { name: \"delete\", description: \"Delete a branch\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Branch ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n yield* api.branches.delete({ path: { id: args.id } });\n yield* Console.log(`Branch ${args.id} deleted.`);\n }),\n ),\n});\n\nexport const branchesCommand = defineCommand({\n meta: { name: \"branches\", description: \"Manage branches\" },\n subCommands: {\n list: listCommand,\n create: createCommand,\n rename: renameCommand,\n delete: deleteCommand,\n },\n});\n","export interface RenderSigningGradleInput {\n readonly keystorePath: string;\n readonly storePassword: string;\n readonly keyAlias: string;\n readonly keyPassword: string;\n}\n\n/**\n * Escape a Groovy single-quoted string literal: backslashes, single quotes,\n * and `$` (to prevent string interpolation on Groovy double-quoted strings,\n * though we use single quotes everywhere for safety).\n */\nconst escapeGroovySingleQuoted = (value: string): string =>\n value\n .replaceAll(\"\\\\\", String.raw`\\\\`)\n .replaceAll(\"'\", String.raw`\\'`)\n .replaceAll(\"$\", String.raw`\\$`);\n\n/**\n * Render a Gradle init script that injects a `release` signing config into\n * every Android application module after evaluation. This is passed to\n * `./gradlew --init-script <path>` so the keystore never has to live in the\n * project tree.\n */\nexport const renderSigningGradle = ({\n keystorePath,\n storePassword,\n keyAlias,\n keyPassword,\n}: RenderSigningGradleInput): string =>\n `allprojects {\n afterEvaluate { project ->\n if (project.plugins.hasPlugin('com.android.application')) {\n project.android {\n signingConfigs {\n release {\n storeFile file('${escapeGroovySingleQuoted(keystorePath)}')\n storePassword '${escapeGroovySingleQuoted(storePassword)}'\n keyAlias '${escapeGroovySingleQuoted(keyAlias)}'\n keyPassword '${escapeGroovySingleQuoted(keyPassword)}'\n }\n }\n buildTypes {\n release {\n signingConfig signingConfigs.release\n }\n }\n }\n }\n }\n}\n`;\n","export const capitalize = (value: string): string => {\n const [first] = value;\n return first === undefined ? value : `${first.toUpperCase()}${value.slice(1)}`;\n};\n","import path from \"node:path\";\n\nimport { FileSystem } from \"@effect/platform\";\nimport { Effect, Option } from \"effect\";\nimport { maxBy } from \"es-toolkit\";\n\nimport type { PlatformError } from \"@effect/platform/Error\";\n\nimport { ArtifactNotFoundError } from \"./exit-codes\";\nimport { capitalize } from \"./string-utils\";\n\nexport interface FindIosArtifactOptions {\n readonly exportPath: string;\n}\n\nexport interface FindAndroidArtifactOptions {\n readonly projectRoot: string;\n readonly format: \"apk\" | \"aab\";\n readonly flavor?: string;\n readonly buildType: \"debug\" | \"release\";\n /**\n * If provided, only artifacts with mtimeMs >= this value are considered.\n * Used to exclude stale artifacts from previous builds when the current\n * build failed to write an expected output.\n */\n readonly minMtimeMs?: number;\n}\n\ninterface FoundFile {\n readonly path: string;\n readonly mtimeMs: number;\n}\n\nconst walkAndFind = (\n root: string,\n extension: string,\n): Effect.Effect<readonly FoundFile[], PlatformError, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n // No fs.exists pre-check: readDirectory on a missing/non-dir path fails\n // With a PlatformError that we catch into an empty list below.\n const entries = yield* fs.readDirectory(root).pipe(Effect.orElseSucceed(() => []));\n\n const results: FoundFile[] = [];\n for (const entry of entries) {\n const fullPath = path.join(root, entry);\n const stat = yield* fs.stat(fullPath).pipe(Effect.option);\n if (Option.isSome(stat)) {\n const info = stat.value;\n if (info.type === \"Directory\") {\n const nested = yield* walkAndFind(fullPath, extension);\n results.push(...nested);\n } else if (info.type === \"File\" && entry.toLowerCase().endsWith(extension)) {\n results.push({\n path: fullPath,\n mtimeMs: Option.match(info.mtime, {\n onNone: () => 0,\n onSome: (date) => date.getTime(),\n }),\n });\n }\n }\n }\n return results;\n });\n\nconst newest = (files: readonly FoundFile[], minMtimeMs?: number): FoundFile | undefined => {\n const eligible =\n minMtimeMs === undefined ? files : files.filter((file) => file.mtimeMs >= minMtimeMs);\n return maxBy(eligible, (file) => file.mtimeMs);\n};\n\nexport const findIosArtifact = ({\n exportPath,\n}: FindIosArtifactOptions): Effect.Effect<\n string,\n ArtifactNotFoundError | PlatformError,\n FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const files = yield* walkAndFind(exportPath, \".ipa\");\n const picked = newest(files);\n if (!picked) {\n return yield* new ArtifactNotFoundError({\n message: `No .ipa file found under \"${exportPath}\".`,\n });\n }\n return picked.path;\n });\n\nexport const findAndroidArtifact = ({\n projectRoot,\n format,\n flavor,\n buildType,\n minMtimeMs,\n}: FindAndroidArtifactOptions): Effect.Effect<\n string,\n ArtifactNotFoundError | PlatformError,\n FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const outputsRoot = path.join(projectRoot, \"android\", \"app\", \"build\", \"outputs\");\n const subdir = format === \"aab\" ? \"bundle\" : \"apk\";\n const variantDir = flavor ? `${flavor}${capitalize(buildType)}` : buildType;\n const expectedDir = path.join(outputsRoot, subdir, variantDir);\n\n const direct = yield* walkAndFind(expectedDir, `.${format}`);\n const pickedDirect = newest(direct, minMtimeMs);\n if (pickedDirect) {\n return pickedDirect.path;\n }\n\n const fallback = yield* walkAndFind(outputsRoot, `.${format}`);\n const pickedFallback = newest(fallback, minMtimeMs);\n if (!pickedFallback) {\n return yield* new ArtifactNotFoundError({\n message: `No .${format} artifact found under \"${outputsRoot}\"${minMtimeMs === undefined ? \"\" : \" (newer than build start)\"}.`,\n });\n }\n return pickedFallback.path;\n });\n","const asUint8Array = (data: Uint8Array | ArrayBuffer): Uint8Array =>\n data instanceof Uint8Array ? data : new Uint8Array(data);\n\nconst toBinaryString = (data: Uint8Array | ArrayBuffer): string =>\n Array.from(asUint8Array(data), (byte) => String.fromCodePoint(byte)).join(\"\");\n\nconst padBase64 = (value: string): string =>\n value.padEnd(value.length + ((4 - (value.length % 4)) % 4), \"=\");\n\nconst BASE64_PATTERN = /^[A-Za-z0-9+/]*={0,2}$/u;\nconst BASE64_URL_PATTERN = /^[A-Za-z0-9_-]*={0,2}$/u;\nconst HEX_PATTERN = /^(?:[0-9A-Fa-f]{2})*$/u;\n\nconst normalizeBase64 = (value: string): string => {\n const compact = value.replaceAll(/\\s+/gu, \"\");\n if (!BASE64_PATTERN.test(compact) || compact.length % 4 === 1) {\n throw new RangeError(\"Invalid base64 string\");\n }\n return padBase64(compact);\n};\n\nconst normalizeBase64Url = (value: string): string => {\n const compact = value.replaceAll(/\\s+/gu, \"\");\n if (!BASE64_URL_PATTERN.test(compact) || compact.length % 4 === 1) {\n throw new RangeError(\"Invalid base64url string\");\n }\n return compact.replaceAll(\"-\", \"+\").replaceAll(\"_\", \"/\");\n};\n\nexport const toBase64 = (data: Uint8Array | ArrayBuffer): string => btoa(toBinaryString(data));\n\nexport const fromBase64 = (str: string): Uint8Array<ArrayBuffer> => {\n const binary = atob(normalizeBase64(str));\n return Uint8Array.from(binary, (char) => char.codePointAt(0) ?? 0);\n};\n\nexport const toBase64Url = (data: Uint8Array | ArrayBuffer): string =>\n toBase64(data).replaceAll(\"+\", \"-\").replaceAll(\"/\", \"_\").replace(/=+$/u, \"\");\n\nexport const fromBase64Url = (str: string): Uint8Array<ArrayBuffer> =>\n fromBase64(padBase64(normalizeBase64Url(str)));\n\nexport const toHex = (bytes: Uint8Array | ArrayBuffer): string =>\n Array.from(asUint8Array(bytes), (byte) => byte.toString(16).padStart(2, \"0\")).join(\"\");\n\nexport const fromHex = (hex: string): Uint8Array<ArrayBuffer> => {\n if (!HEX_PATTERN.test(hex)) {\n throw new RangeError(\"Invalid hex string\");\n }\n return Uint8Array.from(hex.match(/.{2}/gu) ?? [], (byte) => Number.parseInt(byte, 16));\n};\n","import path from \"node:path\";\n\nimport { fromBase64 } from \"@better-update/encoding\";\nimport { FileSystem } from \"@effect/platform\";\nimport { Effect } from \"effect\";\n\nimport type { PlatformError } from \"@effect/platform/Error\";\n\nimport { MissingCredentialsError } from \"./exit-codes\";\n\nimport type { ApiClient } from \"../services/api-client\";\nimport type { IosDistribution } from \"./build-profile\";\n\nexport interface DownloadIosCredentialsOptions {\n readonly projectId: string;\n readonly bundleIdentifier: string;\n readonly distribution: IosDistribution;\n readonly tempDir: string;\n}\n\nexport interface IosCredentials {\n readonly p12Path: string;\n readonly p12Password: string;\n readonly profilePath: string;\n readonly profileFilename: string;\n readonly teamId: string;\n}\n\nconst IOS_DISTRIBUTION_TO_TYPE = {\n \"app-store\": \"APP_STORE\",\n \"ad-hoc\": \"AD_HOC\",\n development: \"DEVELOPMENT\",\n enterprise: \"ENTERPRISE\",\n} as const satisfies Record<IosDistribution, \"APP_STORE\" | \"AD_HOC\" | \"DEVELOPMENT\" | \"ENTERPRISE\">;\n\nconst bindHint =\n \"Bind the bundle via the dashboard (Credentials → iOS Bundle Configurations) and make sure a distribution certificate, provisioning profile, and ASC API key are attached.\";\n\nconst permissionHint = \"Ask an org admin to grant the build-credentials download permission.\";\n\nconst androidBindHint =\n \"Register the package in the dashboard (Credentials → Android Build Credentials) and bind a keystore to the default group.\";\n\ninterface TaggedCause {\n readonly _tag: string;\n readonly message?: string;\n}\n\nconst hasTag = (cause: unknown): cause is TaggedCause =>\n typeof cause === \"object\" && cause !== null && \"_tag\" in cause;\n\nconst resolveErrorToMissingCredentials = (\n cause: unknown,\n platform: \"ios\" | \"android\",\n): MissingCredentialsError => {\n const tag = hasTag(cause) ? cause._tag : null;\n const message = hasTag(cause) && typeof cause.message === \"string\" ? cause.message : null;\n const platformLabel = platform === \"ios\" ? \"iOS\" : \"Android\";\n const bind = platform === \"ios\" ? bindHint : androidBindHint;\n\n if (tag === \"Forbidden\") {\n return new MissingCredentialsError({\n message: message ?? `Permission denied when resolving ${platformLabel} build credentials`,\n hint: permissionHint,\n });\n }\n if (tag === \"NotFound\") {\n return new MissingCredentialsError({\n message: message ?? `No ${platformLabel} build credentials configured`,\n hint: bind,\n });\n }\n if (tag === \"BadRequest\") {\n return new MissingCredentialsError({\n message: message ?? `${platformLabel} build credentials are misconfigured`,\n hint: bind,\n });\n }\n return new MissingCredentialsError({\n message: message ?? `Failed to resolve ${platformLabel} build credentials`,\n hint: bind,\n });\n};\n\nexport const downloadIosCredentials = (\n api: ApiClient,\n options: DownloadIosCredentialsOptions,\n): Effect.Effect<IosCredentials, MissingCredentialsError | PlatformError, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n\n const resolved = yield* api.buildCredentials\n .resolve({\n path: { projectId: options.projectId },\n payload: {\n platform: \"ios\" as const,\n bundleIdentifier: options.bundleIdentifier,\n distributionType: IOS_DISTRIBUTION_TO_TYPE[options.distribution],\n },\n })\n .pipe(Effect.mapError((cause) => resolveErrorToMissingCredentials(cause, \"ios\")));\n\n if (resolved.platform !== \"ios\") {\n return yield* Effect.fail(\n new MissingCredentialsError({\n message: \"Server returned non-iOS credentials for an iOS build request\",\n hint: bindHint,\n }),\n );\n }\n\n const p12Path = path.join(options.tempDir, \"signing.p12\");\n const profileFilename = `${resolved.provisioningProfile.uuid ?? \"profile\"}.mobileprovision`;\n const profilePath = path.join(options.tempDir, profileFilename);\n\n yield* fs.writeFile(p12Path, fromBase64(resolved.distributionCertificate.p12Base64));\n yield* fs.writeFile(\n profilePath,\n fromBase64(resolved.provisioningProfile.mobileprovisionBase64),\n );\n\n return {\n p12Path,\n p12Password: resolved.distributionCertificate.p12Password,\n profilePath,\n profileFilename,\n teamId: resolved.provisioningProfile.teamId,\n };\n });\n\nexport interface DownloadAndroidCredentialsOptions {\n readonly projectId: string;\n readonly applicationIdentifier: string;\n readonly tempDir: string;\n}\n\nexport interface AndroidCredentials {\n readonly keystorePath: string;\n readonly storePassword: string;\n readonly keyAlias: string;\n readonly keyPassword: string;\n}\n\nexport const downloadAndroidCredentials = (\n api: ApiClient,\n options: DownloadAndroidCredentialsOptions,\n): Effect.Effect<\n AndroidCredentials,\n MissingCredentialsError | PlatformError,\n FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n\n const resolved = yield* api.buildCredentials\n .resolve({\n path: { projectId: options.projectId },\n payload: {\n platform: \"android\" as const,\n applicationIdentifier: options.applicationIdentifier,\n },\n })\n .pipe(Effect.mapError((cause) => resolveErrorToMissingCredentials(cause, \"android\")));\n\n if (resolved.platform !== \"android\") {\n return yield* Effect.fail(\n new MissingCredentialsError({\n message: \"Server returned non-Android credentials for an Android build request\",\n hint: androidBindHint,\n }),\n );\n }\n\n const keystorePath = path.join(options.tempDir, \"upload.keystore\");\n yield* fs.writeFile(keystorePath, fromBase64(resolved.keystore.keystoreBase64));\n\n return {\n keystorePath,\n storePassword: resolved.keystore.storePassword,\n keyAlias: resolved.keystore.keyAlias,\n keyPassword: resolved.keystore.keyPassword,\n };\n });\n","import { createHash } from \"node:crypto\";\nimport { createReadStream } from \"node:fs\";\n\nimport { toBase64Url } from \"@better-update/encoding\";\nimport { Effect } from \"effect\";\n\nimport { BuildFailedError } from \"./exit-codes\";\n\nexport interface Sha256FileResult {\n readonly sha256: string;\n readonly byteSize: number;\n}\n\nexport interface Sha256FileBase64UrlResult {\n readonly sha256Base64Url: string;\n readonly byteSize: number;\n}\n\nconst hashReadError = (message: string) =>\n new BuildFailedError({\n step: \"sha256\",\n exitCode: 1,\n message,\n });\n\nconst hashFile = <TDigest>(\n path: string,\n formatDigest: (digest: Buffer) => TDigest,\n): Effect.Effect<{ digest: TDigest; byteSize: number }, BuildFailedError> =>\n Effect.async<{ digest: TDigest; byteSize: number }, BuildFailedError>((resume) => {\n const hash = createHash(\"sha256\");\n const stream = createReadStream(path);\n let byteSize = 0;\n\n stream.on(\"data\", (chunk) => {\n const buffer = typeof chunk === \"string\" ? Buffer.from(chunk) : chunk;\n byteSize += buffer.byteLength;\n hash.update(buffer);\n });\n stream.on(\"error\", (error) => {\n resume(Effect.fail(hashReadError(`Failed to read file for SHA-256: ${error.message}`)));\n });\n stream.on(\"end\", () => {\n resume(\n Effect.succeed({\n digest: formatDigest(hash.digest()),\n byteSize,\n }),\n );\n });\n });\n\n/**\n * Compute the SHA-256 digest and byte size of a file using Node's streaming\n * hash API. The file is never fully loaded into memory — chunks flow through\n * `createReadStream` into `crypto.createHash(\"sha256\")`.\n */\nexport const sha256File = (path: string): Effect.Effect<Sha256FileResult, BuildFailedError> =>\n hashFile(path, (digest) => digest.toString(\"hex\")).pipe(\n Effect.map(({ digest, byteSize }) => ({ sha256: digest, byteSize })),\n );\n\nexport const sha256FileBase64Url = (\n path: string,\n): Effect.Effect<Sha256FileBase64UrlResult, BuildFailedError> =>\n hashFile(path, toBase64Url).pipe(\n Effect.map(({ digest, byteSize }) => ({ sha256Base64Url: digest, byteSize })),\n );\n\n/**\n * Compute a content-type-namespaced hash: `SHA-256(contentType + '\\0' + SHA-256_hex(fileBytes))`.\n *\n * This prevents hash collisions when identical bytes are served with different\n * MIME types (e.g. same file used as both `application/javascript` and `text/plain`).\n * The raw content hash is still needed separately for R2 upload verification.\n */\nexport const sha256Namespaced = (contentType: string, contentSha256Hex: string): string => {\n const input = `${contentType}\\0${contentSha256Hex}`;\n return toBase64Url(createHash(\"sha256\").update(input).digest());\n};\n","import process from \"node:process\";\n\nimport { Command } from \"@effect/platform\";\nimport { Effect, Fiber, Stream } from \"effect\";\n\nimport type { CommandExecutor } from \"@effect/platform\";\nimport type { Scope } from \"effect\";\n\nimport { BuildFailedError } from \"../../lib/exit-codes\";\n\nimport type { XcodebuildFormatter } from \"../../lib/xcpretty-formatter\";\n\nexport const runStep = (\n cmd: Command.Command,\n step: string,\n): Effect.Effect<void, BuildFailedError, CommandExecutor.CommandExecutor> =>\n Command.exitCode(cmd.pipe(Command.stdout(\"inherit\"), Command.stderr(\"inherit\"))).pipe(\n Effect.mapError(\n (cause) =>\n new BuildFailedError({\n step,\n exitCode: 1,\n message: `${step} failed to spawn: ${String(cause)}`,\n }),\n ),\n Effect.flatMap((code) =>\n code === 0\n ? Effect.void\n : Effect.fail(\n new BuildFailedError({\n step,\n exitCode: code,\n message: `${step} exited with code ${code}`,\n }),\n ),\n ),\n );\n\n/**\n * Run a build step with stdout piped through a formatter (e.g., xcpretty).\n * stderr passes through to the terminal directly.\n */\nexport const runStepFormatted = (\n cmd: Command.Command,\n step: string,\n formatter: XcodebuildFormatter,\n): Effect.Effect<void, BuildFailedError, CommandExecutor.CommandExecutor | Scope.Scope> =>\n Effect.gen(function* () {\n const proc = yield* Command.start(\n cmd.pipe(Command.stdout(\"pipe\"), Command.stderr(\"pipe\")),\n ).pipe(\n Effect.mapError(\n (cause) =>\n new BuildFailedError({\n step,\n exitCode: 1,\n message: `${step} failed to spawn: ${String(cause)}`,\n }),\n ),\n );\n\n const stdoutFiber = yield* proc.stdout.pipe(\n Stream.decodeText(),\n Stream.splitLines,\n Stream.runForEach((line) => {\n const formatted = formatter.pipe(line);\n return formatted.length > 0\n ? Effect.sync(() => {\n for (const output of formatted) {\n process.stdout.write(`${output}\\n`);\n }\n })\n : Effect.void;\n }),\n Effect.mapError(\n (cause) =>\n new BuildFailedError({\n step,\n exitCode: 1,\n message: `${step} stdout stream error: ${String(cause)}`,\n }),\n ),\n Effect.fork,\n );\n\n const stderrFiber = yield* proc.stderr.pipe(\n Stream.decodeText(),\n Stream.splitLines,\n Stream.runForEach((line) => Effect.sync(() => process.stderr.write(`${line}\\n`))),\n Effect.mapError(\n (cause) =>\n new BuildFailedError({\n step,\n exitCode: 1,\n message: `${step} stderr stream error: ${String(cause)}`,\n }),\n ),\n Effect.fork,\n );\n\n // Join fibers concurrently — stream errors are non-fatal, exit code takes precedence.\n yield* Effect.all([Fiber.join(stdoutFiber), Fiber.join(stderrFiber)], {\n concurrency: 2,\n }).pipe(Effect.catchAll(() => Effect.void));\n\n const code = yield* proc.exitCode.pipe(\n Effect.mapError(\n (cause) =>\n new BuildFailedError({\n step,\n exitCode: 1,\n message: `${step} exit code error: ${String(cause)}`,\n }),\n ),\n );\n\n if (code !== 0) {\n // Print build summary on failure for xcpretty diagnostics\n const summary = formatter.getBuildSummary();\n if (summary) {\n process.stderr.write(`${summary}\\n`);\n }\n\n return yield* new BuildFailedError({\n step,\n exitCode: code,\n message: `${step} exited with code ${code}`,\n });\n }\n return undefined;\n });\n","import path from \"node:path\";\n\nimport { Command, FileSystem } from \"@effect/platform\";\nimport { Effect } from \"effect\";\n\nimport type { CommandExecutor } from \"@effect/platform\";\nimport type { PlatformError } from \"@effect/platform/Error\";\n\nimport { renderSigningGradle } from \"../../lib/android-signing-gradle\";\nimport { findAndroidArtifact } from \"../../lib/artifact-finder\";\nimport { downloadAndroidCredentials } from \"../../lib/credentials-downloader\";\nimport { sha256File } from \"../../lib/sha256\";\nimport { capitalize } from \"../../lib/string-utils\";\nimport { CliRuntime } from \"../../services/cli-runtime\";\nimport { runStep } from \"./run-step\";\n\nimport type { AndroidProfile } from \"../../lib/build-profile\";\nimport type {\n ArtifactNotFoundError,\n BuildFailedError,\n MissingCredentialsError,\n} from \"../../lib/exit-codes\";\nimport type { ApiClient } from \"../../services/api-client\";\n\nexport interface RunAndroidBuildInput {\n readonly api: ApiClient;\n readonly tempDir: string;\n readonly projectRoot: string;\n readonly androidProfile: AndroidProfile;\n readonly applicationIdentifier: string;\n readonly envVars: Record<string, string>;\n readonly projectId: string;\n}\n\nexport interface RunAndroidBuildResult {\n readonly artifactPath: string;\n readonly byteSize: number;\n readonly sha256: string;\n}\n\n/**\n * Compose the Gradle task name from flavor, format, and buildType.\n *\n * Gradle naming convention: `<verb><Flavor><Variant>`, e.g.\n * - no flavor + apk + release → `assembleRelease`\n * - no flavor + aab + release → `bundleRelease`\n * - flavor=prod + aab + release → `bundleProdRelease`\n * - flavor=prod + apk + debug → `assembleProdDebug`\n */\nconst gradleTaskName = (\n format: \"apk\" | \"aab\",\n flavor: string | undefined,\n buildType: \"debug\" | \"release\",\n): string => {\n const verb = format === \"aab\" ? \"bundle\" : \"assemble\";\n return flavor\n ? `${verb}${capitalize(flavor)}${capitalize(buildType)}`\n : `${verb}${capitalize(buildType)}`;\n};\n\nexport const runAndroidBuild = (\n input: RunAndroidBuildInput,\n): Effect.Effect<\n RunAndroidBuildResult,\n BuildFailedError | MissingCredentialsError | ArtifactNotFoundError | PlatformError,\n CliRuntime | CommandExecutor.CommandExecutor | FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const { api, tempDir, projectRoot, androidProfile, applicationIdentifier, envVars, projectId } =\n input;\n const runtime = yield* CliRuntime;\n\n // Record build start so artifact-finder can reject stale outputs from\n // Earlier builds that may still live in `android/app/build/outputs/`.\n const buildStartMs = Date.now();\n\n const { format } = androidProfile;\n const { flavor } = androidProfile;\n const buildType = androidProfile.buildType ?? \"release\";\n const androidDir = path.join(projectRoot, \"android\");\n const commandEnv = yield* runtime.commandEnvironment(envVars);\n\n const credentials = yield* downloadAndroidCredentials(api, {\n projectId,\n applicationIdentifier,\n tempDir,\n });\n\n yield* runStep(\n Command.make(\"bunx\", \"expo\", \"prebuild\", \"--platform\", \"android\", \"--clean\").pipe(\n Command.workingDirectory(projectRoot),\n Command.env(commandEnv),\n ),\n \"expo prebuild android\",\n );\n\n const fs = yield* FileSystem.FileSystem;\n const signingGradlePath = path.join(tempDir, \"signing.gradle\");\n yield* fs.writeFileString(\n signingGradlePath,\n renderSigningGradle({\n keystorePath: credentials.keystorePath,\n storePassword: credentials.storePassword,\n keyAlias: credentials.keyAlias,\n keyPassword: credentials.keyPassword,\n }),\n );\n\n const taskName = gradleTaskName(format, flavor, buildType);\n yield* runStep(\n Command.make(\"./gradlew\", \"--init-script\", signingGradlePath, `:app:${taskName}`).pipe(\n Command.workingDirectory(androidDir),\n Command.env(commandEnv),\n ),\n \"gradlew\",\n );\n\n const artifactPath = yield* findAndroidArtifact({\n projectRoot,\n format,\n ...(flavor === undefined ? {} : { flavor }),\n buildType,\n minMtimeMs: buildStartMs,\n });\n\n const { sha256, byteSize } = yield* sha256File(artifactPath);\n\n return { artifactPath, byteSize, sha256 };\n });\n","export type ExportMethod = \"app-store\" | \"ad-hoc\" | \"enterprise\" | \"development\";\n\nexport interface RenderExportOptionsPlistInput {\n readonly method: ExportMethod;\n readonly teamId: string;\n readonly bundleId: string;\n readonly provisioningProfileName: string;\n readonly compileBitcode?: boolean;\n}\n\nconst escapeXml = (value: string): string =>\n value\n .replaceAll(\"&\", \"&\")\n .replaceAll(\"<\", \"<\")\n .replaceAll(\">\", \">\")\n .replaceAll('\"', \""\")\n .replaceAll(\"'\", \"'\");\n\nconst boolTag = (value: boolean): string => (value ? \"<true/>\" : \"<false/>\");\n\n/**\n * Render an Xcode `ExportOptions.plist` for `xcodebuild -exportArchive`.\n *\n * - `signingStyle` is always `manual` (ephemeral keychain + downloaded profile)\n * - `uploadSymbols` is emitted only for `app-store` exports\n * - `provisioningProfiles` dict maps bundleId → profile name\n * - `compileBitcode` defaults to `false`\n */\nexport const renderExportOptionsPlist = ({\n method,\n teamId,\n bundleId,\n provisioningProfileName,\n compileBitcode = false,\n}: RenderExportOptionsPlistInput): string => {\n const lines: string[] = [\n '<?xml version=\"1.0\" encoding=\"UTF-8\"?>',\n '<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">',\n '<plist version=\"1.0\">',\n \"<dict>\",\n \"\\t<key>method</key>\",\n `\\t<string>${escapeXml(method)}</string>`,\n \"\\t<key>teamID</key>\",\n `\\t<string>${escapeXml(teamId)}</string>`,\n \"\\t<key>signingStyle</key>\",\n \"\\t<string>manual</string>\",\n \"\\t<key>compileBitcode</key>\",\n `\\t${boolTag(compileBitcode)}`,\n \"\\t<key>provisioningProfiles</key>\",\n \"\\t<dict>\",\n `\\t\\t<key>${escapeXml(bundleId)}</key>`,\n `\\t\\t<string>${escapeXml(provisioningProfileName)}</string>`,\n \"\\t</dict>\",\n ];\n\n if (method === \"app-store\") {\n lines.push(\"\\t<key>uploadSymbols</key>\", \"\\t<true/>\");\n }\n\n lines.push(\"</dict>\", \"</plist>\", \"\");\n return lines.join(\"\\n\");\n};\n","import { randomBytes, randomUUID } from \"node:crypto\";\nimport path from \"node:path\";\n\nimport { Command } from \"@effect/platform\";\nimport { Effect } from \"effect\";\n\nimport type { CommandExecutor } from \"@effect/platform\";\nimport type { Scope } from \"effect\";\n\nimport { KeychainError } from \"./exit-codes\";\n\nexport interface AcquireKeychainOptions {\n readonly tempDir: string;\n readonly p12Path: string;\n readonly p12Password: string;\n}\n\nexport interface KeychainHandle {\n readonly keychainName: string;\n readonly keychainPath: string;\n readonly signingIdentity: string;\n}\n\n// ── shell helpers ─────────────────────────────────────────────────\n\nconst runOrFail = (\n cmd: Command.Command,\n step: string,\n): Effect.Effect<string, KeychainError, CommandExecutor.CommandExecutor> =>\n Command.string(cmd).pipe(\n Effect.mapError(\n (cause) =>\n new KeychainError({\n message: `keychain ${step} failed: ${String(cause)}`,\n }),\n ),\n );\n\nconst listCurrentKeychains = Effect.gen(function* () {\n // `security list-keychains -d user` returns each keychain path on its own line,\n // Surrounded by double quotes and optionally preceded by whitespace.\n const output = yield* runOrFail(\n Command.make(\"security\", \"list-keychains\", \"-d\", \"user\"),\n \"list-keychains\",\n );\n return output\n .split(\"\\n\")\n .map((line) => line.trim().replace(/^\"/u, \"\").replace(/\"$/u, \"\"))\n .filter((line) => line.length > 0);\n});\n\n// Parse `security find-identity -v <keychain>` output to extract the first\n// Signing identity. Lines look like:\n// 1) 1A2B3C4D... \"Apple Distribution: Your Name (TEAMID)\"\nconst parseSigningIdentity = (output: string): string | undefined => {\n const lines = output.split(\"\\n\");\n for (const line of lines) {\n const match = /\"([^\"]+)\"/u.exec(line);\n if (match?.[1]) {\n return match[1];\n }\n }\n return undefined;\n};\n\n// ── acquireRelease ────────────────────────────────────────────────\n\n/**\n * Acquire an ephemeral macOS keychain, import a `.p12` into it, add it to the\n * user search list, and tear it all down on scope close. The keychain name is\n * namespaced as `better-update-<uuid>` and lives in `$tempDir`, so cleanup is\n * guaranteed under all termination paths.\n */\nexport const acquireKeychain = ({\n tempDir,\n p12Path,\n p12Password,\n}: AcquireKeychainOptions): Effect.Effect<\n KeychainHandle,\n KeychainError,\n CommandExecutor.CommandExecutor | Scope.Scope\n> => {\n const keychainName = `better-update-${randomUUID()}.keychain-db`;\n const keychainPath = path.join(tempDir, keychainName);\n const keychainPassword = randomBytes(32).toString(\"hex\");\n\n return Effect.acquireRelease(\n // ── acquire ─────────────────────────────────────────────────\n Effect.gen(function* () {\n const priorKeychains = yield* listCurrentKeychains;\n\n yield* runOrFail(\n Command.make(\"security\", \"create-keychain\", \"-p\", keychainPassword, keychainPath),\n \"create-keychain\",\n );\n\n yield* runOrFail(\n Command.make(\"security\", \"unlock-keychain\", \"-p\", keychainPassword, keychainPath),\n \"unlock-keychain\",\n );\n\n yield* runOrFail(\n Command.make(\"security\", \"set-keychain-settings\", \"-t\", \"3600\", \"-l\", keychainPath),\n \"set-keychain-settings\",\n );\n\n yield* runOrFail(\n Command.make(\n \"security\",\n \"import\",\n p12Path,\n \"-k\",\n keychainPath,\n \"-P\",\n p12Password,\n \"-T\",\n \"/usr/bin/codesign\",\n ),\n \"import\",\n );\n\n yield* runOrFail(\n Command.make(\n \"security\",\n \"set-key-partition-list\",\n \"-S\",\n \"apple-tool:,apple:,codesign:\",\n \"-s\",\n \"-k\",\n keychainPassword,\n keychainPath,\n ),\n \"set-key-partition-list\",\n );\n\n // Prepend our keychain to the search list while preserving the user's\n // Existing ones.\n yield* runOrFail(\n Command.make(\n \"security\",\n \"list-keychains\",\n \"-d\",\n \"user\",\n \"-s\",\n keychainPath,\n ...priorKeychains,\n ),\n \"list-keychains -s (add)\",\n );\n\n const identitiesOutput = yield* runOrFail(\n Command.make(\"security\", \"find-identity\", \"-v\", \"-p\", \"codesigning\", keychainPath),\n \"find-identity\",\n );\n const signingIdentity = parseSigningIdentity(identitiesOutput);\n if (!signingIdentity) {\n return yield* new KeychainError({\n message: \"No code signing identity found after importing .p12 into ephemeral keychain.\",\n });\n }\n\n return {\n handle: { keychainName, keychainPath, signingIdentity },\n priorKeychains,\n };\n }),\n\n // ── release ─────────────────────────────────────────────────\n ({ priorKeychains }) =>\n Effect.gen(function* () {\n // Restore the original search list first, then delete our keychain.\n yield* Command.string(\n Command.make(\"security\", \"list-keychains\", \"-d\", \"user\", \"-s\", ...priorKeychains),\n ).pipe(Effect.catchAll(() => Effect.void));\n\n yield* Command.string(Command.make(\"security\", \"delete-keychain\", keychainPath)).pipe(\n Effect.catchAll(() => Effect.void),\n );\n }),\n ).pipe(Effect.map(({ handle }) => handle));\n};\n","import plist from \"@expo/plist\";\n\nimport type { PlistObject } from \"@expo/plist\";\n// eslint-disable-next-line import-plugin/no-namespace -- bplist-parser typings have no named export; used only as `typeof BplistParser` for the CJS require result\nimport type * as BplistParser from \"bplist-parser\";\n\nexport type { PlistObject, PlistValue } from \"@expo/plist\";\n\n/**\n * Parse an XML plist string into a typed object.\n * Throws on malformed XML — callers should wrap in Effect.try.\n */\nexport const parsePlistXml = (xml: string): PlistObject =>\n // eslint-disable-next-line typescript/no-unsafe-type-assertion -- @expo/plist.parse returns `any`; PlistObject is the library's declared shape for XML plists\n plist.parse(xml) as PlistObject;\n\n/**\n * Parse a binary plist buffer into a typed object.\n * Uses bplist-parser for Apple's binary plist format.\n */\nexport const parsePlistBinary = (buffer: Buffer): PlistObject => {\n const bplistParser =\n // eslint-disable-next-line typescript/no-unsafe-type-assertion -- CJS require returns `any`; narrow to the package's own typings at the boundary\n require(\"bplist-parser\") as typeof BplistParser;\n // eslint-disable-next-line typescript/no-unsafe-assignment -- bplist-parser typings declare parseBuffer<T>(): T[] with T=any in the shipped .d.ts\n const [result] = bplistParser.parseBuffer(buffer);\n // eslint-disable-next-line typescript/no-unsafe-type-assertion -- bplist-parser typings return `any[]`; PlistObject is the superset shape we consume\n return result as PlistObject;\n};\n\nconst BPLIST_MAGIC = Buffer.from(\"bplist00\");\n\n/**\n * Auto-detect plist format (binary vs XML) and parse accordingly.\n */\nexport const parsePlist = (data: Buffer): PlistObject =>\n data.subarray(0, 8).equals(BPLIST_MAGIC)\n ? parsePlistBinary(data)\n : parsePlistXml(data.toString(\"utf8\"));\n","import os from \"node:os\";\nimport path from \"node:path\";\n\nimport { Command, FileSystem } from \"@effect/platform\";\nimport { Effect } from \"effect\";\n\nimport type { CommandExecutor } from \"@effect/platform\";\nimport type { Scope } from \"effect\";\n\nimport { ProvisioningError } from \"./exit-codes\";\nimport { parsePlistXml } from \"./plist\";\n\nimport type { PlistObject } from \"./plist\";\n\n// ── pure extraction ───────────────────────────────────────────────\n\nexport interface ProvisioningInfo {\n readonly uuid: string;\n readonly name: string;\n readonly teamId: string;\n}\n\nconst getString = (obj: PlistObject, key: string): string | undefined => {\n const value = obj[key];\n return typeof value === \"string\" ? value : undefined;\n};\n\nconst getFirstArrayString = (obj: PlistObject, key: string): string | undefined => {\n const value = obj[key];\n if (Array.isArray(value) && typeof value[0] === \"string\") {\n return value[0];\n }\n return undefined;\n};\n\n/**\n * Extract `UUID`, `Name`, and the first `TeamIdentifier` from the XML plist\n * output of `security cms -D -i <path>`. Returns `ProvisioningError` when any\n * of the three fields are missing.\n */\nexport const extractProvisioningInfo = (\n plistXml: string,\n): Effect.Effect<ProvisioningInfo, ProvisioningError> =>\n Effect.gen(function* () {\n const parsed: PlistObject = yield* Effect.try({\n try: () => parsePlistXml(plistXml),\n catch: (error) =>\n new ProvisioningError({\n message: `Failed to parse provisioning profile plist: ${error instanceof Error ? error.message : String(error)}`,\n }),\n });\n\n const uuid = getString(parsed, \"UUID\");\n const name = getString(parsed, \"Name\");\n const teamId = getFirstArrayString(parsed, \"TeamIdentifier\");\n\n if (!uuid || !name || !teamId) {\n return yield* new ProvisioningError({\n message:\n `Failed to parse provisioning profile: missing ${uuid ? \"\" : \"UUID \"}${name ? \"\" : \"Name \"}${teamId ? \"\" : \"TeamIdentifier \"}`.trim(),\n });\n }\n\n return { uuid, name, teamId };\n });\n\n// ── scoped installation ───────────────────────────────────────────\n\nexport interface InstallProvisioningProfileOptions {\n readonly profilePath: string;\n}\n\nexport interface InstalledProvisioning {\n readonly uuid: string;\n readonly name: string;\n readonly teamId: string;\n readonly installedPath: string;\n}\n\ninterface AcquiredProvisioning extends InstalledProvisioning {\n /**\n * True if we installed the profile (so release should delete it).\n * False if the profile was already present (e.g., installed by Xcode) —\n * in that case we leave it alone on release to avoid breaking the user's\n * other signing operations.\n */\n readonly ownsInstallation: boolean;\n}\n\nconst userProvisioningProfilesDir = (): string =>\n path.join(os.homedir(), \"Library\", \"MobileDevice\", \"Provisioning Profiles\");\n\n/**\n * Scoped installation of a provisioning profile: parses its metadata via\n * `security cms -D -i`, copies it into `~/Library/MobileDevice/Provisioning Profiles`\n * under `<uuid>.mobileprovision`, and removes the copy on scope close — but\n * only if we installed it. If the target file already existed when we arrived\n * (e.g., Xcode had it), we leave both the file and the contents untouched.\n */\nexport const installProvisioningProfile = ({\n profilePath,\n}: InstallProvisioningProfileOptions): Effect.Effect<\n InstalledProvisioning,\n ProvisioningError,\n CommandExecutor.CommandExecutor | FileSystem.FileSystem | Scope.Scope\n> =>\n Effect.acquireRelease(\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n\n const plistXml = yield* Command.string(\n Command.make(\"security\", \"cms\", \"-D\", \"-i\", profilePath),\n ).pipe(\n Effect.mapError(\n (cause) =>\n new ProvisioningError({\n message: `security cms -D failed for ${profilePath}: ${String(cause)}`,\n }),\n ),\n );\n\n const info = yield* extractProvisioningInfo(plistXml);\n const targetDir = userProvisioningProfilesDir();\n const installedPath = path.join(targetDir, `${info.uuid}.mobileprovision`);\n\n yield* fs.makeDirectory(targetDir, { recursive: true }).pipe(\n Effect.catchAll(\n (cause) =>\n new ProvisioningError({\n message: `Failed to create provisioning profiles dir: ${String(cause)}`,\n }),\n ),\n );\n\n const alreadyInstalled = yield* fs\n .exists(installedPath)\n .pipe(Effect.orElseSucceed(() => false));\n\n if (alreadyInstalled) {\n return {\n ...info,\n installedPath,\n ownsInstallation: false,\n } satisfies AcquiredProvisioning;\n }\n\n yield* fs.copyFile(profilePath, installedPath).pipe(\n Effect.catchAll(\n (cause) =>\n new ProvisioningError({\n message: `Failed to copy provisioning profile into ${installedPath}: ${String(cause)}`,\n }),\n ),\n );\n\n return {\n ...info,\n installedPath,\n ownsInstallation: true,\n } satisfies AcquiredProvisioning;\n }),\n (acquired) =>\n Effect.gen(function* () {\n if (!acquired.ownsInstallation) {\n return;\n }\n const fs = yield* FileSystem.FileSystem;\n yield* fs.remove(acquired.installedPath).pipe(Effect.catchAll(() => Effect.void));\n }),\n ).pipe(\n Effect.map<AcquiredProvisioning, InstalledProvisioning>(\n ({ uuid, name, teamId, installedPath }) => ({\n uuid,\n name,\n teamId,\n installedPath,\n }),\n ),\n );\n","import path from \"node:path\";\n\nimport { Command, FileSystem } from \"@effect/platform\";\nimport { Console, Effect } from \"effect\";\n\nimport type { CommandExecutor } from \"@effect/platform\";\n\nimport { parsePlist, parsePlistXml } from \"./plist\";\n\nexport interface IosValidationParams {\n readonly archivePath: string;\n readonly expectedBundleId: string;\n readonly expectedTeamId: string;\n readonly expectedProfileUuid: string;\n}\n\nexport interface ValidationResult {\n readonly passed: boolean;\n readonly warnings: readonly string[];\n}\n\n/**\n * Validate an iOS build after xcodebuild completes. Checks:\n * 1. Bundle ID matches expected value\n * 2. Provisioning profile UUID matches\n * 3. Team ID matches\n *\n * All checks are non-blocking — returns warnings, never fails the build.\n */\nexport const validateIosBuild = (\n params: IosValidationParams,\n): Effect.Effect<\n ValidationResult,\n never,\n CommandExecutor.CommandExecutor | FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const appDir = yield* findAppDirectory(params.archivePath).pipe(\n Effect.catchAll(() => Effect.succeed(undefined)),\n );\n\n if (!appDir) {\n const warnings = [\"Could not locate .app bundle in archive — skipping post-build validation\"];\n return { passed: false, warnings };\n }\n\n const bundleWarning = yield* checkBundleId(appDir, params.expectedBundleId).pipe(\n Effect.catchAll(() => Effect.succeed(undefined)),\n );\n\n const profileWarnings = yield* checkEmbeddedProfile(\n appDir,\n params.expectedProfileUuid,\n params.expectedTeamId,\n ).pipe(Effect.catchAll(() => Effect.succeed([] as readonly string[])));\n\n const warnings: readonly string[] = [\n ...(bundleWarning ? [bundleWarning] : []),\n ...profileWarnings,\n ];\n\n if (warnings.length > 0) {\n yield* Console.warn(\"Post-build validation warnings:\");\n for (const warning of warnings) {\n yield* Console.warn(` - ${warning}`);\n }\n }\n\n return { passed: warnings.length === 0, warnings };\n });\n\n// ── helpers ──────────────────────────────────────────────────────\n\nconst findAppDirectory = (\n archivePath: string,\n): Effect.Effect<string, unknown, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const productsDir = path.join(archivePath, \"Products\", \"Applications\");\n const entries = yield* fs.readDirectory(productsDir);\n const appEntry = entries.find((entry) => entry.endsWith(\".app\"));\n if (!appEntry) {\n return yield* Effect.fail(\"No .app found\");\n }\n return path.join(productsDir, appEntry);\n });\n\nconst checkBundleId = (\n appDir: string,\n expectedBundleId: string,\n): Effect.Effect<string | undefined, unknown, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const plistPath = path.join(appDir, \"Info.plist\");\n const data = yield* fs.readFile(plistPath);\n const parsed = parsePlist(Buffer.from(data));\n const actualBundleId = parsed[\"CFBundleIdentifier\"];\n\n if (typeof actualBundleId === \"string\" && actualBundleId !== expectedBundleId) {\n return `Bundle ID mismatch: expected \"${expectedBundleId}\", got \"${actualBundleId}\"`;\n }\n return undefined;\n });\n\nconst checkEmbeddedProfile = (\n appDir: string,\n expectedUuid: string,\n expectedTeamId: string,\n): Effect.Effect<\n readonly string[],\n unknown,\n CommandExecutor.CommandExecutor | FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const warnings: string[] = [];\n const profilePath = path.join(appDir, \"embedded.mobileprovision\");\n\n // Use security cms to decrypt the profile (it's CMS-signed)\n const plistXml = yield* Command.string(\n Command.make(\"security\", \"cms\", \"-D\", \"-i\", profilePath),\n );\n\n const parsed = parsePlistXml(plistXml);\n\n const actualUuid = parsed[\"UUID\"];\n if (typeof actualUuid === \"string\" && actualUuid !== expectedUuid) {\n warnings.push(`Profile UUID mismatch: expected \"${expectedUuid}\", got \"${actualUuid}\"`);\n }\n\n const teamIdentifiers = parsed[\"TeamIdentifier\"];\n if (Array.isArray(teamIdentifiers)) {\n // eslint-disable-next-line typescript/no-unsafe-assignment -- @expo/plist types array entries as any; narrowed via typeof check below\n const [actualTeamId] = teamIdentifiers;\n if (typeof actualTeamId === \"string\" && actualTeamId !== expectedTeamId) {\n warnings.push(`Team ID mismatch: expected \"${expectedTeamId}\", got \"${actualTeamId}\"`);\n }\n }\n\n // Check expiration\n const expirationDate = parsed[\"ExpirationDate\"];\n if (expirationDate instanceof Date && expirationDate.getTime() < Date.now()) {\n warnings.push(`Embedded provisioning profile expired on ${expirationDate.toISOString()}`);\n }\n\n return warnings;\n });\n","import { ExpoRunFormatter } from \"@expo/xcpretty\";\n\nexport interface XcodebuildFormatter {\n /** Feed a line of raw xcodebuild output. Returns formatted lines (0 or more). */\n readonly pipe: (line: string) => readonly string[];\n /** Get a build summary after the process completes. */\n readonly getBuildSummary: () => string;\n}\n\n/**\n * Create a stateful xcodebuild output formatter backed by `@expo/xcpretty`.\n * Each `pipe(line)` call may return zero or more formatted lines — zero means\n * the line was suppressed (e.g., intermediate compiler invocations).\n */\nexport const createXcodebuildFormatter = (projectRoot: string): XcodebuildFormatter => {\n const formatter = ExpoRunFormatter.create(projectRoot);\n return {\n pipe: (line: string) => formatter.pipe(line),\n getBuildSummary: () => formatter.getBuildSummary(),\n };\n};\n","import path from \"node:path\";\n\nimport { Command, FileSystem } from \"@effect/platform\";\nimport { Effect } from \"effect\";\n\nimport type { CommandExecutor } from \"@effect/platform\";\nimport type { PlatformError } from \"@effect/platform/Error\";\nimport type { Scope } from \"effect\";\n\nimport { findIosArtifact } from \"../../lib/artifact-finder\";\nimport { downloadIosCredentials } from \"../../lib/credentials-downloader\";\nimport { BuildFailedError } from \"../../lib/exit-codes\";\nimport { renderExportOptionsPlist } from \"../../lib/ios-export-options\";\nimport { acquireKeychain } from \"../../lib/ios-keychain\";\nimport { installProvisioningProfile } from \"../../lib/ios-provisioning\";\nimport { validateIosBuild } from \"../../lib/post-build-validation\";\nimport { sha256File } from \"../../lib/sha256\";\nimport { createXcodebuildFormatter } from \"../../lib/xcpretty-formatter\";\nimport { CliRuntime } from \"../../services/cli-runtime\";\nimport { runStep, runStepFormatted } from \"./run-step\";\n\nimport type { IosProfile } from \"../../lib/build-profile\";\nimport type {\n ArtifactNotFoundError,\n KeychainError,\n MissingCredentialsError,\n ProvisioningError,\n} from \"../../lib/exit-codes\";\nimport type { ApiClient } from \"../../services/api-client\";\n\nexport interface RunIosBuildInput {\n readonly api: ApiClient;\n readonly tempDir: string;\n readonly projectRoot: string;\n readonly iosProfile: IosProfile;\n readonly bundleId: string;\n readonly envVars: Record<string, string>;\n readonly projectId: string;\n readonly rawOutput?: boolean | undefined;\n}\n\nexport interface RunIosBuildResult {\n readonly artifactPath: string;\n readonly byteSize: number;\n readonly sha256: string;\n}\n\nconst findXcworkspace = (\n iosDir: string,\n): Effect.Effect<string, BuildFailedError | PlatformError, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const entries = yield* fs.readDirectory(iosDir);\n const workspace = entries.find((entry) => entry.endsWith(\".xcworkspace\"));\n if (!workspace) {\n return yield* new BuildFailedError({\n step: \"detect xcworkspace\",\n exitCode: 1,\n message: `No .xcworkspace found under ${iosDir}. Did \"pod install\" run?`,\n });\n }\n return workspace;\n });\n\nexport const runIosBuild = (\n input: RunIosBuildInput,\n): Effect.Effect<\n RunIosBuildResult,\n | BuildFailedError\n | MissingCredentialsError\n | KeychainError\n | ProvisioningError\n | ArtifactNotFoundError\n | PlatformError,\n CliRuntime | CommandExecutor.CommandExecutor | FileSystem.FileSystem | Scope.Scope\n> =>\n // eslint-disable-next-line eslint/max-statements -- ios build orchestration is inherently sequential (prebuild → pod → credentials → archive → exportArchive → find artifact → sha256); splitting further fragments the pipeline without clarifying it\n Effect.gen(function* () {\n const { api, tempDir, projectRoot, iosProfile, bundleId, envVars, projectId } = input;\n const runtime = yield* CliRuntime;\n\n const iosDir = path.join(projectRoot, \"ios\");\n const { distribution } = iosProfile;\n const commandEnv = yield* runtime.commandEnvironment(envVars);\n\n // 1. Download credentials (p12 + mobileprovision) into tempDir.\n const credentials = yield* downloadIosCredentials(api, {\n projectId,\n bundleIdentifier: bundleId,\n distribution,\n tempDir,\n });\n\n // 2. Expo prebuild (ios).\n yield* runStep(\n Command.make(\"bunx\", \"expo\", \"prebuild\", \"--platform\", \"ios\", \"--clean\").pipe(\n Command.workingDirectory(projectRoot),\n Command.env(commandEnv),\n ),\n \"expo prebuild ios\",\n );\n\n // 3. pod install.\n yield* runStep(\n Command.make(\"pod\", \"install\").pipe(\n Command.workingDirectory(iosDir),\n Command.env(commandEnv),\n ),\n \"pod install\",\n );\n\n // 4. Scoped ephemeral keychain (auto-cleaned on scope close).\n const keychain = yield* acquireKeychain({\n tempDir,\n p12Path: credentials.p12Path,\n p12Password: credentials.p12Password,\n });\n\n // 5. Scoped provisioning profile install.\n const provisioning = yield* installProvisioningProfile({\n profilePath: credentials.profilePath,\n });\n\n // 6. Detect workspace + scheme.\n const workspaceFilename = yield* findXcworkspace(iosDir);\n const scheme = iosProfile.scheme ?? workspaceFilename.replace(/\\.xcworkspace$/u, \"\");\n const configuration = iosProfile.buildConfiguration ?? \"Release\";\n\n // 7. xcodebuild archive.\n const archivePath = path.join(tempDir, \"build.xcarchive\");\n const archiveCmd = Command.make(\n \"xcodebuild\",\n \"-workspace\",\n workspaceFilename,\n \"-scheme\",\n scheme,\n \"-configuration\",\n configuration,\n \"-archivePath\",\n archivePath,\n \"-allowProvisioningUpdates\",\n \"archive\",\n \"CODE_SIGN_STYLE=Manual\",\n `DEVELOPMENT_TEAM=${provisioning.teamId}`,\n `CODE_SIGN_IDENTITY=${keychain.signingIdentity}`,\n `PROVISIONING_PROFILE_SPECIFIER=${provisioning.name}`,\n ).pipe(Command.workingDirectory(iosDir), Command.env(commandEnv));\n\n const formatter = input.rawOutput ? undefined : createXcodebuildFormatter(projectRoot);\n yield* formatter\n ? runStepFormatted(archiveCmd, \"xcodebuild archive\", formatter)\n : runStep(archiveCmd, \"xcodebuild archive\");\n\n const fs = yield* FileSystem.FileSystem;\n const exportOptionsPath = path.join(tempDir, \"ExportOptions.plist\");\n yield* fs.writeFileString(\n exportOptionsPath,\n renderExportOptionsPlist({\n method: distribution,\n teamId: provisioning.teamId,\n bundleId,\n provisioningProfileName: provisioning.name,\n }),\n );\n\n // 9. xcodebuild exportArchive.\n const exportPath = path.join(tempDir, \"export\");\n const exportCmd = Command.make(\n \"xcodebuild\",\n \"-exportArchive\",\n \"-archivePath\",\n archivePath,\n \"-exportPath\",\n exportPath,\n \"-exportOptionsPlist\",\n exportOptionsPath,\n \"-allowProvisioningUpdates\",\n ).pipe(Command.workingDirectory(iosDir), Command.env(commandEnv));\n\n yield* formatter\n ? runStepFormatted(exportCmd, \"xcodebuild exportArchive\", formatter)\n : runStep(exportCmd, \"xcodebuild exportArchive\");\n\n // 10. Post-build validation (non-blocking).\n yield* validateIosBuild({\n archivePath,\n expectedBundleId: bundleId,\n expectedTeamId: provisioning.teamId,\n expectedProfileUuid: provisioning.uuid,\n });\n\n // 11. Locate artifact.\n const artifactPath = yield* findIosArtifact({ exportPath });\n\n // 12. SHA-256 + byte size.\n const { sha256, byteSize } = yield* sha256File(artifactPath);\n\n return { artifactPath, byteSize, sha256 };\n });\n","import { Effect } from \"effect\";\n\nimport { CompleteError, ReserveError } from \"../../lib/exit-codes\";\nimport { formatCause } from \"../../lib/format-error\";\nimport { PresignedUploadClient } from \"../../services/presigned-upload\";\n\nimport type { PresignedUrlExpiredError, UploadFailedError } from \"../../lib/exit-codes\";\nimport type { ApiClient } from \"../../services/api-client\";\n\nexport type BuildTarget =\n | {\n readonly platform: \"ios\";\n readonly distribution: \"app-store\" | \"ad-hoc\" | \"development\" | \"enterprise\";\n readonly artifactFormat: \"ipa\";\n }\n | {\n readonly platform: \"ios\";\n readonly distribution: \"simulator\";\n readonly artifactFormat: \"tar.gz\";\n }\n | {\n readonly platform: \"android\";\n readonly distribution: \"play-store\";\n readonly artifactFormat: \"aab\";\n }\n | {\n readonly platform: \"android\";\n readonly distribution: \"direct\";\n readonly artifactFormat: \"apk\";\n };\n\nexport interface ReserveAndUploadInput {\n readonly target: BuildTarget;\n readonly projectId: string;\n readonly profileName: string;\n readonly runtimeVersion: string;\n readonly appVersion?: string;\n readonly buildNumber?: string;\n readonly bundleId: string;\n readonly gitContext: {\n readonly ref?: string;\n readonly commit?: string;\n readonly dirty: boolean;\n };\n readonly message?: string;\n readonly artifactPath: string;\n readonly sha256: string;\n readonly byteSize: number;\n}\n\nconst buildReserveCommon = (input: ReserveAndUploadInput) =>\n ({\n projectId: input.projectId,\n profile: input.profileName,\n runtimeVersion: input.runtimeVersion,\n bundleId: input.bundleId,\n sha256: input.sha256,\n byteSize: input.byteSize,\n ...(input.appVersion === undefined ? {} : { appVersion: input.appVersion }),\n ...(input.buildNumber === undefined ? {} : { buildNumber: input.buildNumber }),\n ...(input.gitContext.ref === undefined ? {} : { gitRef: input.gitContext.ref }),\n ...(input.gitContext.commit === undefined ? {} : { gitCommit: input.gitContext.commit }),\n ...(input.message === undefined ? {} : { message: input.message }),\n }) as const;\n\nconst callReserve = (api: ApiClient, input: ReserveAndUploadInput) => {\n const common = buildReserveCommon(input);\n const { target } = input;\n if (target.platform === \"ios\") {\n return target.distribution === \"simulator\"\n ? api.builds.reserve({\n payload: {\n ...common,\n platform: \"ios\",\n distribution: \"simulator\",\n artifactFormat: \"tar.gz\",\n },\n })\n : api.builds.reserve({\n payload: {\n ...common,\n platform: \"ios\",\n distribution: target.distribution,\n artifactFormat: \"ipa\",\n },\n });\n }\n return target.distribution === \"play-store\"\n ? api.builds.reserve({\n payload: {\n ...common,\n platform: \"android\",\n distribution: \"play-store\",\n artifactFormat: \"aab\",\n },\n })\n : api.builds.reserve({\n payload: { ...common, platform: \"android\", distribution: \"direct\", artifactFormat: \"apk\" },\n });\n};\n\nexport interface ReserveAndUploadResult {\n readonly id: string;\n readonly status: string;\n}\n\n/**\n * Reserve a build record on the server, upload the artifact to the returned\n * presigned URL, and finalize the build with its sha256 + byteSize.\n */\nexport const reserveAndUpload = (\n api: ApiClient,\n input: ReserveAndUploadInput,\n): Effect.Effect<\n ReserveAndUploadResult,\n ReserveError | UploadFailedError | PresignedUrlExpiredError | CompleteError,\n PresignedUploadClient\n> =>\n Effect.gen(function* () {\n const presignedUploadClient = yield* PresignedUploadClient;\n\n const reserveResult = yield* callReserve(api, input).pipe(\n Effect.mapError(\n (cause) =>\n new ReserveError({\n message: `Failed to reserve build: ${formatCause(cause)}`,\n }),\n ),\n );\n\n yield* presignedUploadClient.putToPresignedUrl({\n url: reserveResult.uploadUrl,\n filePath: input.artifactPath,\n byteSize: input.byteSize,\n expiresAt: reserveResult.uploadExpiresAt,\n headers: reserveResult.uploadHeaders,\n });\n\n const completed = yield* api.builds\n .complete({\n path: { id: reserveResult.id },\n payload: { sha256: input.sha256, byteSize: input.byteSize },\n })\n .pipe(\n Effect.mapError(\n (cause) =>\n new CompleteError({\n message: `Failed to complete build ${reserveResult.id}: ${formatCause(cause)}`,\n }),\n ),\n );\n\n if (!completed.artifact) {\n return yield* new CompleteError({\n message: `Build ${completed.id} completed but server returned no artifact record.`,\n });\n }\n\n return { id: completed.id, status: \"uploaded\" };\n });\n","import { asRecord } from \"@better-update/type-guards\";\nimport { Effect } from \"effect\";\n\nimport { BuildProfileError } from \"./exit-codes\";\n\nexport type Platform = \"ios\" | \"android\";\n\nexport type IosDistribution = \"app-store\" | \"ad-hoc\" | \"development\" | \"enterprise\";\n\nexport interface IosProfile {\n readonly buildConfiguration?: string;\n readonly distribution: IosDistribution;\n readonly scheme?: string;\n}\n\nexport type AndroidDistribution = \"play-store\" | \"direct\";\n\nexport interface AndroidProfile {\n readonly buildType?: \"debug\" | \"release\";\n readonly format: \"apk\" | \"aab\";\n readonly flavor?: string;\n readonly distribution: AndroidDistribution;\n}\n\nexport interface BuildProfile {\n readonly name: string;\n readonly environment: string;\n readonly ios?: IosProfile;\n readonly android?: AndroidProfile;\n}\n\nexport type RawRuntimeVersion = string | { readonly policy: string };\n\nexport interface AppMeta {\n readonly bundleId: string | undefined;\n readonly androidPackage: string | undefined;\n readonly appVersion: string | undefined;\n readonly buildNumber: string | undefined;\n readonly rawRuntimeVersion: RawRuntimeVersion | undefined;\n}\n\nexport interface RuntimeVersionMeta {\n readonly appVersion: string | undefined;\n readonly rawRuntimeVersion: RawRuntimeVersion | undefined;\n}\n\nexport const asString = (value: unknown): string | undefined =>\n typeof value === \"string\" ? value : undefined;\n\nconst getBetterUpdateExtra = (\n appJson: Record<string, unknown>,\n): Record<string, unknown> | undefined => {\n const expo = asRecord(appJson[\"expo\"]);\n const extra = asRecord(expo?.[\"extra\"]);\n return asRecord(extra?.[\"betterUpdate\"]);\n};\n\nconst VALID_IOS_DISTRIBUTIONS: readonly IosDistribution[] = [\n \"app-store\",\n \"ad-hoc\",\n \"development\",\n \"enterprise\",\n];\n\nconst isIosDistribution = (value: string): value is IosDistribution =>\n (VALID_IOS_DISTRIBUTIONS as readonly string[]).includes(value);\n\nconst readIosProfile = (raw: unknown): IosProfile | undefined => {\n const iosRaw = asRecord(raw);\n if (!iosRaw) {\n return undefined;\n }\n const distributionRaw = asString(iosRaw[\"distribution\"]);\n if (!distributionRaw) {\n return undefined;\n }\n if (!isIosDistribution(distributionRaw)) {\n return undefined;\n }\n const distribution: IosDistribution = distributionRaw;\n const buildConfiguration = asString(iosRaw[\"buildConfiguration\"]);\n const scheme = asString(iosRaw[\"scheme\"]);\n return {\n distribution,\n ...(buildConfiguration === undefined ? {} : { buildConfiguration }),\n ...(scheme === undefined ? {} : { scheme }),\n };\n};\n\nconst resolveAndroidDistribution = (\n raw: string | undefined,\n format: \"apk\" | \"aab\",\n): AndroidDistribution => {\n if (raw === \"play-store\" || raw === \"direct\") {\n return raw;\n }\n return format === \"aab\" ? \"play-store\" : \"direct\";\n};\n\nconst readAndroidProfile = (raw: unknown): AndroidProfile | undefined => {\n const androidRaw = asRecord(raw);\n if (!androidRaw) {\n return undefined;\n }\n const formatValue = asString(androidRaw[\"format\"]);\n const format = formatValue === \"apk\" || formatValue === \"aab\" ? formatValue : undefined;\n if (!format) {\n return undefined;\n }\n const buildTypeValue = asString(androidRaw[\"buildType\"]);\n const buildType =\n buildTypeValue === \"debug\" || buildTypeValue === \"release\" ? buildTypeValue : undefined;\n const flavor = asString(androidRaw[\"flavor\"]);\n const distribution = resolveAndroidDistribution(asString(androidRaw[\"distribution\"]), format);\n return {\n format,\n distribution,\n ...(buildType === undefined ? {} : { buildType }),\n ...(flavor === undefined ? {} : { flavor }),\n };\n};\n\nexport const readBuildProfile = (\n appJson: Record<string, unknown>,\n profileName: string,\n): Effect.Effect<BuildProfile, BuildProfileError> =>\n Effect.gen(function* () {\n const betterUpdate = getBetterUpdateExtra(appJson);\n const profiles = asRecord(betterUpdate?.[\"profiles\"]);\n if (!profiles) {\n return yield* new BuildProfileError({\n message: \"No build profiles defined. Add expo.extra.betterUpdate.profiles to app.json.\",\n });\n }\n const profileRaw = asRecord(profiles[profileName]);\n if (!profileRaw) {\n return yield* new BuildProfileError({\n message: `Build profile \"${profileName}\" not found in app.json.`,\n });\n }\n const environment = asString(profileRaw[\"environment\"]) ?? \"production\";\n const ios = readIosProfile(profileRaw[\"ios\"]);\n const android = readAndroidProfile(profileRaw[\"android\"]);\n return {\n name: profileName,\n environment,\n ...(ios === undefined ? {} : { ios }),\n ...(android === undefined ? {} : { android }),\n };\n });\n\nexport const readRuntimeVersionMeta = (\n appJson: Record<string, unknown>,\n): Effect.Effect<RuntimeVersionMeta, BuildProfileError> =>\n Effect.gen(function* () {\n const expo = asRecord(appJson[\"expo\"]);\n if (!expo) {\n return yield* new BuildProfileError({\n message: \"Missing expo section in app.json.\",\n });\n }\n\n return {\n appVersion: asString(expo[\"version\"]),\n rawRuntimeVersion: readRawRuntimeVersion(expo[\"runtimeVersion\"]),\n };\n });\n\nexport const readAppMeta = (\n appJson: Record<string, unknown>,\n platform: Platform,\n): Effect.Effect<AppMeta, BuildProfileError> =>\n Effect.gen(function* () {\n const expo = asRecord(appJson[\"expo\"]);\n if (!expo) {\n return yield* new BuildProfileError({\n message: \"Missing expo section in app.json.\",\n });\n }\n\n if (platform === \"ios\") {\n const ios = asRecord(expo[\"ios\"]);\n if (!ios) {\n return yield* new BuildProfileError({\n message:\n \"Missing expo.ios section in app.json. Required for iOS builds (bundleIdentifier).\",\n });\n }\n } else {\n const android = asRecord(expo[\"android\"]);\n if (!android) {\n return yield* new BuildProfileError({\n message:\n \"Missing expo.android section in app.json. Required for Android builds (package).\",\n });\n }\n }\n\n const iosSection = asRecord(expo[\"ios\"]);\n const androidSection = asRecord(expo[\"android\"]);\n const buildNumber =\n platform === \"ios\"\n ? asString(iosSection?.[\"buildNumber\"])\n : asStringOrNumber(androidSection?.[\"versionCode\"]);\n return {\n bundleId: asString(iosSection?.[\"bundleIdentifier\"]),\n androidPackage: asString(androidSection?.[\"package\"]),\n appVersion: asString(expo[\"version\"]),\n buildNumber,\n rawRuntimeVersion: readRawRuntimeVersion(expo[\"runtimeVersion\"]),\n };\n });\n\nconst asStringOrNumber = (value: unknown): string | undefined => {\n if (typeof value === \"string\") {\n return value;\n }\n if (typeof value === \"number\" && Number.isFinite(value)) {\n return String(value);\n }\n return undefined;\n};\n\nconst readRawRuntimeVersion = (value: unknown): RawRuntimeVersion | undefined => {\n if (typeof value === \"string\") {\n return value;\n }\n const record = asRecord(value);\n const policy = asString(record?.[\"policy\"]);\n if (policy) {\n return { policy };\n }\n return undefined;\n};\n","import { Effect } from \"effect\";\n\nimport { EnvExportError } from \"./exit-codes\";\n\nimport type { ApiClient } from \"../services/api-client\";\n\nexport interface PullEnvVarsOptions {\n readonly projectId: string;\n readonly environment: string;\n}\n\n/**\n * Pull environment variables for a project + environment and flatten them into\n * a key/value map. Returns an empty map when the project has no variables.\n */\nexport const pullEnvVars = (\n api: ApiClient,\n { projectId, environment }: PullEnvVarsOptions,\n): Effect.Effect<Record<string, string>, EnvExportError> =>\n api[\"env-vars\"].export({ urlParams: { projectId, environment } }).pipe(\n Effect.map((result) => Object.fromEntries(result.items.map((item) => [item.key, item.value]))),\n Effect.mapError(\n (cause) =>\n new EnvExportError({\n message: `Failed to export environment variables for \"${environment}\": ${String(cause)}`,\n }),\n ),\n );\n","import process from \"node:process\";\n\nimport { Effect } from \"effect\";\n\nimport { BuildProfileError } from \"./exit-codes\";\n\nimport type { AppMeta, Platform, RawRuntimeVersion } from \"./build-profile\";\n\ninterface ExpoConfig {\n readonly name?: string;\n readonly slug?: string;\n readonly version?: string;\n readonly runtimeVersion?: string | { readonly policy: string };\n readonly ios?: {\n readonly bundleIdentifier?: string;\n readonly buildNumber?: string;\n };\n readonly android?: {\n readonly package?: string;\n readonly versionCode?: number;\n };\n readonly [key: string]: unknown;\n}\n\n/**\n * Resolve the full Expo config using `@expo/config`, which handles\n * `app.json`, `app.config.js`, and `app.config.ts` with plugin evaluation.\n *\n * `envVars` are applied as a scoped overlay on `process.env` for the duration\n * of the call (restored afterwards) so dynamic configs (`app.config.js`)\n * can read them without leaking server-side secrets to child processes.\n *\n * Falls back to undefined if `@expo/config` is not available or fails.\n */\nexport const readExpoConfig = (\n projectRoot: string,\n envVars: Record<string, string> = {},\n): Effect.Effect<ExpoConfig | undefined> =>\n Effect.acquireUseRelease(\n Effect.sync(() => {\n const previous: Record<string, string | undefined> = {};\n for (const [key, value] of Object.entries(envVars)) {\n previous[key] = process.env[key];\n process.env[key] = value;\n }\n return previous;\n }),\n () =>\n Effect.try({\n try: () => {\n const expoConfigCjs =\n // eslint-disable-next-line typescript/no-unsafe-type-assertion -- CJS require returns `any`; narrow to @expo/config's shape at this boundary\n require(\"@expo/config\") as {\n getConfig: (\n projectRoot: string,\n options?: { skipSDKVersionRequirement?: boolean },\n ) => { exp: ExpoConfig };\n };\n const { getConfig } = expoConfigCjs;\n\n const { exp } = getConfig(projectRoot, {\n skipSDKVersionRequirement: true,\n });\n\n return exp;\n },\n catch: () => undefined,\n }).pipe(Effect.catchAll(() => Effect.succeed<ExpoConfig | undefined>(undefined))),\n (previous) =>\n Effect.sync(() => {\n for (const [key, value] of Object.entries(previous)) {\n if (value === undefined) {\n // eslint-disable-next-line typescript/no-dynamic-delete -- restoring previous process.env snapshot; keys are arbitrary env var names we captured earlier\n delete process.env[key];\n } else {\n process.env[key] = value;\n }\n }\n }),\n );\n\nconst extractBuildNumber = (config: ExpoConfig, platform: Platform): string | undefined => {\n if (platform === \"ios\") {\n return config.ios?.buildNumber;\n }\n if (config.android?.versionCode === undefined) {\n return undefined;\n }\n return String(config.android.versionCode);\n};\n\nconst extractRawRuntimeVersion = (config: ExpoConfig): RawRuntimeVersion | undefined => {\n if (typeof config.runtimeVersion === \"string\") {\n return config.runtimeVersion;\n }\n if (typeof config.runtimeVersion === \"object\") {\n return config.runtimeVersion;\n }\n return undefined;\n};\n\n/**\n * Extract AppMeta from a resolved ExpoConfig (from `@expo/config`).\n * Mirrors `readAppMeta` from build-profile.ts but uses the resolved config\n * which handles dynamic configs (`app.config.js`, `app.config.ts`).\n */\nexport const readAppMetaFromConfig = (\n config: ExpoConfig,\n platform: Platform,\n): Effect.Effect<AppMeta, BuildProfileError> =>\n Effect.gen(function* () {\n if (platform === \"ios\" && !config.ios) {\n return yield* new BuildProfileError({\n message: \"Missing expo.ios section in config. Required for iOS builds (bundleIdentifier).\",\n });\n }\n if (platform === \"android\" && !config.android) {\n return yield* new BuildProfileError({\n message: \"Missing expo.android section in config. Required for Android builds (package).\",\n });\n }\n\n return {\n bundleId: config.ios?.bundleIdentifier,\n androidPackage: config.android?.package,\n appVersion: config.version,\n buildNumber: extractBuildNumber(config, platform),\n rawRuntimeVersion: extractRawRuntimeVersion(config),\n };\n });\n","import { Command } from \"@effect/platform\";\nimport { Effect } from \"effect\";\n\nimport type { CommandExecutor } from \"@effect/platform\";\n\nexport interface GitContext {\n readonly ref: string | undefined;\n readonly commit: string | undefined;\n readonly commitMessage: string | undefined;\n readonly dirty: boolean;\n}\n\nconst runString = (\n cmd: Command.Command,\n cwd: string,\n): Effect.Effect<string, unknown, CommandExecutor.CommandExecutor> =>\n Command.string(Command.workingDirectory(cmd, cwd));\n\n/**\n * Best-effort git context extraction. If git is missing, the directory isn't\n * a repo, or any command fails, we silently return undefined fields so the\n * build can still proceed. This is intentional — git context is metadata,\n * not a requirement.\n */\nexport const readGitContext = (\n projectRoot: string,\n): Effect.Effect<GitContext, never, CommandExecutor.CommandExecutor> =>\n Effect.gen(function* () {\n const [commit, ref, commitMessage, status] = yield* Effect.all(\n [\n runString(Command.make(\"git\", \"rev-parse\", \"HEAD\"), projectRoot).pipe(\n Effect.map((output) => output.trim()),\n Effect.catchAll(() => Effect.succeed(\"\")),\n ),\n runString(Command.make(\"git\", \"symbolic-ref\", \"--short\", \"HEAD\"), projectRoot).pipe(\n Effect.map((output) => output.trim()),\n Effect.catchAll(() => Effect.succeed(\"\")),\n ),\n runString(Command.make(\"git\", \"log\", \"-1\", \"--format=%s\"), projectRoot).pipe(\n Effect.map((output) => output.trim()),\n Effect.catchAll(() => Effect.succeed(\"\")),\n ),\n runString(Command.make(\"git\", \"status\", \"--porcelain\"), projectRoot).pipe(\n Effect.catchAll(() => Effect.succeed(\"\")),\n ),\n ],\n { concurrency: \"unbounded\" },\n );\n\n return {\n ref: ref.length > 0 ? ref : undefined,\n commit: commit.length > 0 ? commit : undefined,\n commitMessage: commitMessage.length > 0 ? commitMessage : undefined,\n dirty: status.trim().length > 0,\n };\n });\n","import path from \"node:path\";\n\nimport { asRecord } from \"@better-update/type-guards\";\nimport { FileSystem } from \"@effect/platform\";\nimport { Console, Effect } from \"effect\";\n\nexport interface GradleConfig {\n readonly applicationId?: string;\n readonly versionCode?: number;\n readonly versionName?: string;\n}\n\n/**\n * Parse Groovy `build.gradle` to extract key Android config values.\n * Returns `undefined` if:\n * - Only `build.gradle.kts` exists (Kotlin DSL not supported by gradle-to-js)\n * - No build.gradle found at all\n * - Parse fails\n *\n * Informational only — never blocks the build.\n */\nexport const readGradleConfig = (\n androidDir: string,\n): Effect.Effect<GradleConfig | undefined, never, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const gradlePath = path.join(androidDir, \"app\", \"build.gradle\");\n const ktsPath = path.join(androidDir, \"app\", \"build.gradle.kts\");\n\n const hasGroovy = yield* fs.exists(gradlePath).pipe(Effect.orElseSucceed(() => false));\n const hasKts = yield* fs.exists(ktsPath).pipe(Effect.orElseSucceed(() => false));\n\n if (!hasGroovy && hasKts) {\n // Kotlin DSL — gradle-to-js cannot parse it\n return undefined;\n }\n\n if (!hasGroovy) {\n return undefined;\n }\n\n const content = yield* fs\n .readFileString(gradlePath)\n .pipe(Effect.catchAll(() => Effect.succeed(undefined)));\n if (!content) {\n return undefined;\n }\n\n return yield* Effect.tryPromise({\n try: async () => {\n const gradle =\n // eslint-disable-next-line typescript/no-unsafe-type-assertion -- CJS require returns `any`; narrow to gradle-to-js declared shape\n require(\"gradle-to-js\") as {\n parseText: (text: string) => Promise<Record<string, unknown>>;\n };\n return gradle.parseText(stripGroovyComments(content));\n },\n catch: () => undefined,\n }).pipe(\n Effect.map(extractGradleConfig),\n Effect.catchAll(() => Effect.succeed(undefined)),\n );\n });\n\n/**\n * Log a warning if Gradle applicationId differs from app.json package name.\n */\nexport const warnOnGradleMismatch = (\n gradleConfig: GradleConfig | undefined,\n expectedPackage: string,\n): Effect.Effect<void> => {\n if (!gradleConfig?.applicationId) {\n return Effect.void;\n }\n if (gradleConfig.applicationId === expectedPackage) {\n return Effect.void;\n }\n return Console.warn(\n `Gradle applicationId \"${gradleConfig.applicationId}\" differs from app.json package \"${expectedPackage}\". ` +\n `The Gradle value will be used in the built APK/AAB.`,\n );\n};\n\n// ── helpers ──────────────────────────────────────────────────────\n\n/**\n * Strip Groovy single-line and block comments.\n * gradle-to-js chokes on comments — EAS CLI does this same pre-processing.\n */\nconst stripGroovyComments = (text: string): string =>\n text.replaceAll(/\\/\\/.*$/gmu, \"\").replaceAll(/\\/\\*[\\s\\S]*?\\*\\//gu, \"\");\n\nconst parseVersionCode = (raw: unknown): number | undefined => {\n if (typeof raw === \"number\") {\n return raw;\n }\n if (typeof raw === \"string\") {\n return Number.parseInt(raw, 10) || undefined;\n }\n return undefined;\n};\n\nconst extractGradleConfig = (parsed: Record<string, unknown>): GradleConfig => {\n const android = asRecord(parsed[\"android\"]);\n const defaultConfig = asRecord(android?.[\"defaultConfig\"]);\n\n const applicationId =\n typeof defaultConfig?.[\"applicationId\"] === \"string\"\n ? unquote(defaultConfig[\"applicationId\"])\n : undefined;\n const versionCode = parseVersionCode(defaultConfig?.[\"versionCode\"]);\n const versionName =\n typeof defaultConfig?.[\"versionName\"] === \"string\"\n ? unquote(defaultConfig[\"versionName\"])\n : undefined;\n\n return {\n ...(applicationId === undefined ? {} : { applicationId }),\n ...(versionCode === undefined ? {} : { versionCode }),\n ...(versionName === undefined ? {} : { versionName }),\n };\n};\n\nconst unquote = (input: string): string =>\n input.startsWith('\"') && input.endsWith('\"') ? input.slice(1, -1) : input;\n","import { isRecord } from \"@better-update/type-guards\";\nimport { Command } from \"@effect/platform\";\nimport { Data, Effect } from \"effect\";\n\nimport type { CommandExecutor } from \"@effect/platform\";\n\nexport class FingerprintError extends Data.TaggedError(\"FingerprintError\")<{\n readonly message: string;\n}> {}\n\nexport interface FingerprintSource {\n readonly type: string;\n readonly filePath?: string;\n readonly reasons: readonly string[];\n readonly hash: string | null;\n}\n\nexport interface FingerprintResult {\n readonly hash: string;\n readonly sources: readonly FingerprintSource[];\n}\n\nexport const runFingerprintFull = (\n projectRoot: string,\n): Effect.Effect<FingerprintResult, FingerprintError, CommandExecutor.CommandExecutor> =>\n Effect.gen(function* () {\n const cmd = Command.make(\"bunx\", \"@expo/fingerprint\", projectRoot).pipe(\n Command.workingDirectory(projectRoot),\n );\n const stdout = yield* Command.string(cmd).pipe(\n Effect.mapError(\n (cause) =>\n new FingerprintError({\n message: `Failed to run \"@expo/fingerprint\": ${cause.message}`,\n }),\n ),\n );\n\n const parsed = yield* Effect.try({\n try: (): unknown => JSON.parse(stdout),\n catch: () =>\n new FingerprintError({\n message: \"Failed to parse @expo/fingerprint output as JSON.\",\n }),\n });\n\n if (!isRecord(parsed)) {\n return yield* new FingerprintError({\n message: \"@expo/fingerprint output was not a JSON object.\",\n });\n }\n\n const { hash } = parsed;\n if (typeof hash !== \"string\" || hash.length === 0) {\n return yield* new FingerprintError({\n message: '@expo/fingerprint output did not contain a \"hash\" string field.',\n });\n }\n\n const sourcesRaw = parsed[\"sources\"];\n const sources: readonly FingerprintSource[] = Array.isArray(sourcesRaw)\n ? (sourcesRaw as readonly FingerprintSource[])\n : [];\n\n return { hash, sources };\n });\n","import { Effect } from \"effect\";\n\nimport type { CommandExecutor } from \"@effect/platform\";\n\nimport { RuntimeVersionError } from \"./exit-codes\";\nimport { runFingerprintFull } from \"./fingerprint\";\n\nimport type { RawRuntimeVersion } from \"./build-profile\";\n\nexport interface ResolveRuntimeVersionOptions {\n readonly raw: RawRuntimeVersion | undefined;\n readonly appVersion: string | undefined;\n readonly projectRoot: string;\n}\n\nexport const resolveRuntimeVersion = ({\n raw,\n appVersion,\n projectRoot,\n}: ResolveRuntimeVersionOptions): Effect.Effect<\n string,\n RuntimeVersionError,\n CommandExecutor.CommandExecutor\n> =>\n Effect.gen(function* () {\n if (typeof raw === \"string\") {\n return raw;\n }\n if (raw === undefined) {\n return yield* new RuntimeVersionError({\n message: \"No runtimeVersion configured in expo section of app.json.\",\n });\n }\n\n const { policy } = raw;\n if (policy === \"appVersion\") {\n if (appVersion === undefined) {\n return yield* new RuntimeVersionError({\n message: 'runtimeVersion policy is \"appVersion\" but expo.version is missing in app.json.',\n });\n }\n return appVersion;\n }\n\n if (policy === \"fingerprint\") {\n return yield* runFingerprintFull(projectRoot).pipe(\n Effect.map((result) => result.hash),\n Effect.mapError((cause) => new RuntimeVersionError({ message: cause.message })),\n );\n }\n\n if (policy === \"nativeVersion\") {\n return yield* new RuntimeVersionError({\n message:\n 'runtimeVersion policy \"nativeVersion\" is not supported. Set a static runtimeVersion string in app.json.',\n });\n }\n\n return yield* new RuntimeVersionError({\n message: `Unsupported runtimeVersion policy \"${policy}\". Use a static string, \"appVersion\", or \"fingerprint\".`,\n });\n });\n","import { FileSystem } from \"@effect/platform\";\nimport { Effect } from \"effect\";\n\n/**\n * Create a scoped temp directory prefixed with \"better-update-\" and `chmod 0o700`\n * it so only the current user can read its contents. The directory and all files\n * inside it are removed when the enclosing scope closes.\n */\nexport const acquireBuildTempDir = Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const dir = yield* fs.makeTempDirectoryScoped({ prefix: \"better-update-\" });\n yield* fs.chmod(dir, 0o700);\n return dir;\n});\n","import { Console, Effect } from \"effect\";\n\nimport { runAndroidBuild } from \"../commands/build/android\";\nimport { runIosBuild } from \"../commands/build/ios\";\nimport { reserveAndUpload } from \"../commands/build/reserve-and-upload\";\nimport { readAppJson, readProjectId } from \"../lib/app-json\";\nimport { readAppMeta, readBuildProfile } from \"../lib/build-profile\";\nimport { pullEnvVars } from \"../lib/env-exporter\";\nimport { BuildProfileError } from \"../lib/exit-codes\";\nimport { readAppMetaFromConfig, readExpoConfig } from \"../lib/expo-config\";\nimport { readGitContext } from \"../lib/git-context\";\nimport { readGradleConfig, warnOnGradleMismatch } from \"../lib/gradle-config\";\nimport { printKeyValue } from \"../lib/output\";\nimport { resolveRuntimeVersion } from \"../lib/runtime-version\";\nimport { acquireBuildTempDir } from \"../lib/temp-dir\";\nimport { apiClient } from \"../services/api-client\";\nimport { CliRuntime } from \"../services/cli-runtime\";\n\nimport type { BuildTarget } from \"../commands/build/reserve-and-upload\";\nimport type { Platform } from \"../lib/build-profile\";\n\nexport interface RunBuildWorkflowOptions {\n readonly platform: Platform;\n readonly profileName: string;\n readonly message: string | undefined;\n readonly noUpload: boolean;\n readonly rawOutput?: boolean;\n}\n\ntype AppMeta = Effect.Effect.Success<ReturnType<typeof readAppMeta>>;\ntype BuildProfile = Effect.Effect.Success<ReturnType<typeof readBuildProfile>>;\ntype ApiClient = Effect.Effect.Success<typeof apiClient>;\n\ninterface PlatformBuildInput {\n readonly api: ApiClient;\n readonly options: RunBuildWorkflowOptions;\n readonly profile: BuildProfile;\n readonly appMeta: AppMeta;\n readonly envVars: Record<string, string>;\n readonly projectId: string;\n readonly projectRoot: string;\n readonly tempDir: string;\n}\n\nconst runIosPlatformBuild = (input: PlatformBuildInput) =>\n Effect.gen(function* () {\n const { api, appMeta, envVars, options, profile, projectId, projectRoot, tempDir } = input;\n if (!profile.ios) {\n return yield* new BuildProfileError({\n message: `Profile \"${profile.name}\" has no ios section.`,\n });\n }\n const iosProfile = profile.ios;\n const iosBundleId = appMeta.bundleId;\n if (!iosBundleId) {\n return yield* new BuildProfileError({\n message: \"Missing expo.ios.bundleIdentifier in app.json.\",\n });\n }\n const build = yield* runIosBuild({\n api,\n tempDir,\n projectRoot,\n iosProfile,\n bundleId: iosBundleId,\n envVars,\n projectId,\n rawOutput: options.rawOutput,\n });\n const target: BuildTarget = {\n platform: \"ios\",\n distribution: iosProfile.distribution,\n artifactFormat: \"ipa\",\n };\n return { build, target, bundleId: iosBundleId };\n });\n\nconst runAndroidPlatformBuild = (input: PlatformBuildInput) =>\n Effect.gen(function* () {\n const { api, appMeta, envVars, profile, projectId, projectRoot, tempDir } = input;\n if (!profile.android) {\n return yield* new BuildProfileError({\n message: `Profile \"${profile.name}\" has no android section.`,\n });\n }\n const androidProfile = profile.android;\n const androidBundleId = appMeta.androidPackage;\n if (!androidBundleId) {\n return yield* new BuildProfileError({\n message: \"Missing expo.android.package in app.json.\",\n });\n }\n // Cross-validate Gradle config against app.json (Groovy only). When\n // Gradle resolves a different applicationId, the built APK/AAB is signed\n // Under that id — so the Credential resolver must key off the Gradle value.\n const androidDir = `${projectRoot}/android`;\n const gradleConfig = yield* readGradleConfig(androidDir);\n yield* warnOnGradleMismatch(gradleConfig, androidBundleId);\n const applicationIdentifier = gradleConfig?.applicationId ?? androidBundleId;\n const build = yield* runAndroidBuild({\n api,\n tempDir,\n projectRoot,\n androidProfile,\n applicationIdentifier,\n envVars,\n projectId,\n });\n const target: BuildTarget =\n androidProfile.format === \"aab\"\n ? { platform: \"android\", distribution: \"play-store\", artifactFormat: \"aab\" }\n : { platform: \"android\", distribution: \"direct\", artifactFormat: \"apk\" };\n return { build, target, bundleId: applicationIdentifier };\n });\n\nconst runPlatformBuild = (input: PlatformBuildInput) =>\n input.options.platform === \"ios\" ? runIosPlatformBuild(input) : runAndroidPlatformBuild(input);\n\nexport const runBuildWorkflow = (options: RunBuildWorkflowOptions) =>\n Effect.scoped(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const runtime = yield* CliRuntime;\n const projectRoot = yield* runtime.cwd;\n\n const appJson = yield* readAppJson;\n const projectId = yield* readProjectId;\n\n const profile = yield* readBuildProfile(appJson, options.profileName);\n\n // Load env vars BEFORE resolving dynamic config — app.config.js may read process.env\n const envVars = yield* pullEnvVars(api, {\n projectId,\n environment: profile.environment,\n });\n\n // Try @expo/config for dynamic configs (app.config.js/ts), fall back to static app.json.\n // EnvVars are applied as a scoped process.env overlay inside readExpoConfig and restored\n // After the call so secrets do not leak to child processes spawned later.\n const expoConfig = yield* readExpoConfig(projectRoot, envVars);\n const appMeta = expoConfig\n ? yield* readAppMetaFromConfig(expoConfig, options.platform).pipe(\n Effect.tap(() => Console.log(\"Resolved app config via @expo/config\")),\n Effect.catchAll(() => readAppMeta(appJson, options.platform)),\n )\n : yield* readAppMeta(appJson, options.platform);\n\n const runtimeVersion = yield* resolveRuntimeVersion({\n raw: appMeta.rawRuntimeVersion,\n appVersion: appMeta.appVersion,\n projectRoot,\n });\n\n const tempDir = yield* acquireBuildTempDir;\n\n yield* Console.log(\n `Building ${options.platform} artifact for profile \"${profile.name}\" (runtimeVersion=${runtimeVersion})`,\n );\n\n const outcome = yield* runPlatformBuild({\n api,\n options,\n profile,\n appMeta,\n envVars,\n projectId,\n projectRoot,\n tempDir,\n });\n const { build, target, bundleId } = outcome;\n\n yield* Console.log(`Artifact produced: ${build.artifactPath}`);\n\n if (options.noUpload) {\n yield* printKeyValue([\n [\"Artifact\", build.artifactPath],\n [\"SHA-256\", build.sha256],\n [\"Bytes\", String(build.byteSize)],\n [\"Upload\", \"skipped (--no-upload)\"],\n ]);\n return;\n }\n\n const rawGitContext = yield* readGitContext(projectRoot);\n const gitContext: {\n readonly ref?: string;\n readonly commit?: string;\n readonly dirty: boolean;\n } = {\n ...(rawGitContext.ref === undefined ? {} : { ref: rawGitContext.ref }),\n ...(rawGitContext.commit === undefined ? {} : { commit: rawGitContext.commit }),\n dirty: rawGitContext.dirty,\n };\n\n const result = yield* reserveAndUpload(api, {\n target,\n projectId,\n profileName: profile.name,\n runtimeVersion,\n ...(appMeta.appVersion === undefined ? {} : { appVersion: appMeta.appVersion }),\n ...(appMeta.buildNumber === undefined ? {} : { buildNumber: appMeta.buildNumber }),\n bundleId,\n gitContext,\n ...(options.message === undefined ? {} : { message: options.message }),\n artifactPath: build.artifactPath,\n sha256: build.sha256,\n byteSize: build.byteSize,\n });\n\n yield* Console.log(\"\");\n yield* printKeyValue([\n [\"Build ID\", result.id],\n [\"Status\", result.status],\n [\"Platform\", options.platform],\n [\"Profile\", profile.name],\n [\"Runtime version\", runtimeVersion],\n [\"Artifact\", build.artifactPath],\n [\"SHA-256\", build.sha256],\n [\"Bytes\", String(build.byteSize)],\n ]);\n }),\n );\n","import { defineCommand } from \"citty\";\n\nimport { runBuildWorkflow } from \"../../application/build-workflow\";\nimport { runEffect } from \"../../lib/citty-effect\";\n\nconst BUILD_EXIT_EXTRAS = {\n BuildProfileError: 2,\n RuntimeVersionError: 2,\n MissingCredentialsError: 5,\n BuildFailedError: 6,\n KeychainError: 6,\n ProvisioningError: 6,\n ArtifactNotFoundError: 6,\n ReserveError: 7,\n UploadFailedError: 7,\n PresignedUrlExpiredError: 7,\n CompleteError: 7,\n EnvExportError: 7,\n} as const;\n\nexport const buildCommand = defineCommand({\n meta: { name: \"build\", description: \"Build the app locally and optionally upload\" },\n args: {\n platform: { type: \"enum\", options: [\"ios\", \"android\"], required: true },\n profile: { type: \"string\", default: \"production\", description: \"Build profile name\" },\n message: { type: \"string\", description: \"Optional build message\" },\n upload: {\n type: \"boolean\",\n default: true,\n description: \"Upload the built artifact to better-update\",\n negativeDescription: \"Skip upload (use --no-upload)\",\n },\n \"raw-output\": { type: \"boolean\", description: \"Stream raw Gradle/Xcode output\" },\n },\n run: async ({ args }) =>\n runEffect(\n runBuildWorkflow({\n platform: args.platform,\n profileName: args.profile,\n message: args.message,\n noUpload: !args.upload,\n rawOutput: args[\"raw-output\"] ?? false,\n }),\n BUILD_EXIT_EXTRAS,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { printTable } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\n\nexport const compatibilityMatrixCommand = defineCommand({\n meta: {\n name: \"compatibility-matrix\",\n description: \"Show build-to-channel compatibility and missing runtime versions\",\n },\n run: async () =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n const result = yield* api.builds.compatibilityMatrix({ urlParams: { projectId } });\n\n const matrixKeys = Object.keys(result.channelStatusByKey);\n\n if (matrixKeys.length === 0 && result.missingRuntimeVersions.length === 0) {\n yield* Console.log(\"No compatibility data found.\");\n return;\n }\n\n const channelLookup: Record<string, string> = Object.fromEntries(\n result.channels.map((channel) => [channel.channelId, channel.channelName]),\n );\n\n if (matrixKeys.length > 0) {\n yield* Console.log(\"Channel Status by (Platform / Runtime Version):\");\n yield* printTable(\n [\"Platform / Runtime\", \"Channel\", \"Updates\"],\n matrixKeys.flatMap((key) =>\n (result.channelStatusByKey[key] ?? [])\n .filter((entry) => entry.updateCount > 0)\n .map((entry) => [\n key,\n channelLookup[entry.channelId] ?? entry.channelId,\n String(entry.updateCount),\n ]),\n ),\n );\n }\n\n if (result.missingRuntimeVersions.length > 0) {\n yield* Console.log(\"\\nMissing Runtime Versions:\");\n yield* printTable(\n [\"Channel\", \"Platform\", \"Runtime Version\", \"Updates\"],\n result.missingRuntimeVersions.map((missing) => [\n missing.channelName,\n missing.platform,\n missing.runtimeVersion,\n String(missing.updateCount),\n ]),\n );\n }\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { apiClient } from \"../../services/api-client\";\n\nexport const deleteCommand = defineCommand({\n meta: { name: \"delete\", description: \"Delete a build\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Build ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n yield* api.builds.delete({ path: { id: args.id } });\n yield* Console.log(`Build ${args.id} deleted.`);\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { printKeyValue } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\n\nexport const getCommand = defineCommand({\n meta: { name: \"get\", description: \"Show a build\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Build ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const build = yield* api.builds.get({ path: { id: args.id } });\n yield* printKeyValue([\n [\"ID\", build.id],\n [\"Platform\", build.platform],\n [\"Profile\", build.profile],\n [\"Distribution\", build.distribution],\n [\"Version\", build.appVersion ?? \"-\"],\n [\"Build Number\", build.buildNumber ?? \"-\"],\n [\"Runtime Version\", build.runtimeVersion ?? \"-\"],\n [\"Bundle ID\", build.bundleId ?? \"-\"],\n [\"Git Ref\", build.gitRef ?? \"-\"],\n [\"Message\", build.message ?? \"-\"],\n [\n \"Artifact\",\n build.artifact\n ? `${build.artifact.format} (${String(build.artifact.byteSize)} bytes)`\n : \"none\",\n ],\n [\"Created\", build.createdAt],\n ]);\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { printKeyValue } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\n\nexport const installLinkCommand = defineCommand({\n meta: { name: \"install-link\", description: \"Get install/artifact URLs for a build\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Build ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const result = yield* api.builds.getInstallLink({ path: { id: args.id } });\n yield* printKeyValue([\n [\"Artifact URL\", result.artifactUrl],\n [\"Install URL\", result.installUrl ?? \"-\"],\n [\"Expires\", String(result.expires)],\n ]);\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { parseLimit } from \"../../lib/cli-schemas\";\nimport { printTable } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\n\nexport const listCommand = defineCommand({\n meta: { name: \"list\", description: \"List builds for the linked project\" },\n args: {\n platform: { type: \"enum\", options: [\"ios\", \"android\"], description: \"Filter by platform\" },\n limit: { type: \"string\", default: \"10\", description: \"Max rows (default 10)\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const limit = yield* parseLimit(args.limit, 10);\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const platformFilter = args.platform ? { platform: args.platform } : {};\n\n const { items } = yield* api.builds.list({\n urlParams: { projectId, ...platformFilter, limit },\n });\n\n yield* printTable(\n [\"ID\", \"Platform\", \"Profile\", \"Distribution\", \"Version\", \"Created\"],\n items.map((build) => [\n build.id,\n build.platform,\n build.profile,\n build.distribution,\n build.appVersion ?? \"-\",\n build.createdAt,\n ]),\n );\n }),\n ),\n});\n","import { FileSystem } from \"@effect/platform\";\nimport { Console, Effect } from \"effect\";\n\nimport { reserveAndUpload } from \"../commands/build/reserve-and-upload\";\nimport { readAppJson, readProjectId } from \"../lib/app-json\";\nimport { readAppMeta, readBuildProfile } from \"../lib/build-profile\";\nimport { pullEnvVars } from \"../lib/env-exporter\";\nimport { ArtifactNotFoundError, BuildProfileError } from \"../lib/exit-codes\";\nimport { readAppMetaFromConfig, readExpoConfig } from \"../lib/expo-config\";\nimport { readGitContext } from \"../lib/git-context\";\nimport { readGradleConfig, warnOnGradleMismatch } from \"../lib/gradle-config\";\nimport { printKeyValue } from \"../lib/output\";\nimport { resolveRuntimeVersion } from \"../lib/runtime-version\";\nimport { sha256File } from \"../lib/sha256\";\nimport { apiClient } from \"../services/api-client\";\nimport { CliRuntime } from \"../services/cli-runtime\";\n\nimport type { BuildTarget } from \"../commands/build/reserve-and-upload\";\nimport type { Platform } from \"../lib/build-profile\";\n\nexport interface RunUploadWorkflowOptions {\n readonly platform: Platform;\n readonly profileName: string;\n readonly artifactPath: string;\n readonly message: string | undefined;\n}\n\ninterface ResolvedTarget {\n readonly target: BuildTarget;\n readonly bundleId: string;\n}\n\nconst resolveIosTarget = (\n profile: Effect.Effect.Success<ReturnType<typeof readBuildProfile>>,\n appMeta: Effect.Effect.Success<ReturnType<typeof readAppMeta>>,\n): Effect.Effect<ResolvedTarget, BuildProfileError> =>\n Effect.gen(function* () {\n if (!profile.ios) {\n return yield* new BuildProfileError({\n message: `Profile \"${profile.name}\" has no ios section.`,\n });\n }\n if (!appMeta.bundleId) {\n return yield* new BuildProfileError({\n message: \"Missing expo.ios.bundleIdentifier in app.json.\",\n });\n }\n return {\n target: {\n platform: \"ios\",\n distribution: profile.ios.distribution,\n artifactFormat: \"ipa\",\n },\n bundleId: appMeta.bundleId,\n };\n });\n\nconst resolveAndroidTarget = (\n profile: Effect.Effect.Success<ReturnType<typeof readBuildProfile>>,\n appMeta: Effect.Effect.Success<ReturnType<typeof readAppMeta>>,\n projectRoot: string,\n) =>\n Effect.gen(function* () {\n if (!profile.android) {\n return yield* new BuildProfileError({\n message: `Profile \"${profile.name}\" has no android section.`,\n });\n }\n if (!appMeta.androidPackage) {\n return yield* new BuildProfileError({\n message: \"Missing expo.android.package in app.json.\",\n });\n }\n const gradleConfig = yield* readGradleConfig(`${projectRoot}/android`);\n yield* warnOnGradleMismatch(gradleConfig, appMeta.androidPackage);\n const bundleId = gradleConfig?.applicationId ?? appMeta.androidPackage;\n const target: BuildTarget =\n profile.android.format === \"aab\"\n ? { platform: \"android\", distribution: \"play-store\", artifactFormat: \"aab\" }\n : { platform: \"android\", distribution: \"direct\", artifactFormat: \"apk\" };\n return { target, bundleId };\n });\n\nexport const runUploadWorkflow = (options: RunUploadWorkflowOptions) =>\n Effect.gen(function* () {\n const api = yield* apiClient;\n const runtime = yield* CliRuntime;\n const projectRoot = yield* runtime.cwd;\n\n const fs = yield* FileSystem.FileSystem;\n const artifactExists = yield* fs\n .exists(options.artifactPath)\n .pipe(Effect.orElseSucceed(() => false));\n if (!artifactExists) {\n yield* new ArtifactNotFoundError({\n message: `Artifact not found at ${options.artifactPath}.`,\n });\n }\n\n const appJson = yield* readAppJson;\n const projectId = yield* readProjectId;\n const profile = yield* readBuildProfile(appJson, options.profileName);\n\n const envVars = yield* pullEnvVars(api, {\n projectId,\n environment: profile.environment,\n });\n\n const expoConfig = yield* readExpoConfig(projectRoot, envVars);\n const appMeta = expoConfig\n ? yield* readAppMetaFromConfig(expoConfig, options.platform).pipe(\n Effect.tap(() => Console.log(\"Resolved app config via @expo/config\")),\n Effect.catchAll(() => readAppMeta(appJson, options.platform)),\n )\n : yield* readAppMeta(appJson, options.platform);\n\n const runtimeVersion = yield* resolveRuntimeVersion({\n raw: appMeta.rawRuntimeVersion,\n appVersion: appMeta.appVersion,\n projectRoot,\n });\n\n const { target, bundleId } =\n options.platform === \"ios\"\n ? yield* resolveIosTarget(profile, appMeta)\n : yield* resolveAndroidTarget(profile, appMeta, projectRoot);\n\n yield* Console.log(`Hashing ${options.artifactPath}...`);\n const { sha256, byteSize } = yield* sha256File(options.artifactPath);\n\n const rawGitContext = yield* readGitContext(projectRoot);\n const gitContext: {\n readonly ref?: string;\n readonly commit?: string;\n readonly dirty: boolean;\n } = {\n ...(rawGitContext.ref === undefined ? {} : { ref: rawGitContext.ref }),\n ...(rawGitContext.commit === undefined ? {} : { commit: rawGitContext.commit }),\n dirty: rawGitContext.dirty,\n };\n\n const result = yield* reserveAndUpload(api, {\n target,\n projectId,\n profileName: profile.name,\n runtimeVersion,\n ...(appMeta.appVersion === undefined ? {} : { appVersion: appMeta.appVersion }),\n ...(appMeta.buildNumber === undefined ? {} : { buildNumber: appMeta.buildNumber }),\n bundleId,\n gitContext,\n ...(options.message === undefined ? {} : { message: options.message }),\n artifactPath: options.artifactPath,\n sha256,\n byteSize,\n });\n\n yield* Console.log(\"\");\n yield* printKeyValue([\n [\"Build ID\", result.id],\n [\"Status\", result.status],\n [\"Platform\", options.platform],\n [\"Profile\", profile.name],\n [\"Runtime version\", runtimeVersion],\n [\"Artifact\", options.artifactPath],\n [\"SHA-256\", sha256],\n [\"Bytes\", String(byteSize)],\n ]);\n });\n","import { defineCommand } from \"citty\";\n\nimport { runUploadWorkflow } from \"../../application/upload-workflow\";\nimport { runEffect } from \"../../lib/citty-effect\";\n\nconst UPLOAD_EXIT_EXTRAS = {\n BuildProfileError: 2,\n RuntimeVersionError: 2,\n ArtifactNotFoundError: 6,\n BuildFailedError: 6,\n ReserveError: 7,\n UploadFailedError: 7,\n PresignedUrlExpiredError: 7,\n CompleteError: 7,\n EnvExportError: 7,\n} as const;\n\nexport const uploadCommand = defineCommand({\n meta: { name: \"upload\", description: \"Upload an existing artifact to better-update\" },\n args: {\n \"artifact-path\": { type: \"positional\", required: true, description: \"Path to artifact\" },\n platform: { type: \"enum\", options: [\"ios\", \"android\"], required: true },\n profile: { type: \"string\", default: \"production\", description: \"Build profile name\" },\n message: { type: \"string\", description: \"Optional build message\" },\n },\n run: async ({ args }) =>\n runEffect(\n runUploadWorkflow({\n artifactPath: args[\"artifact-path\"],\n platform: args.platform,\n profileName: args.profile,\n message: args.message,\n }),\n UPLOAD_EXIT_EXTRAS,\n ),\n});\n","import { defineCommand } from \"citty\";\n\nimport { compatibilityMatrixCommand } from \"./compatibility-matrix\";\nimport { deleteCommand } from \"./delete\";\nimport { getCommand } from \"./get\";\nimport { installLinkCommand } from \"./install-link\";\nimport { listCommand } from \"./list\";\nimport { uploadCommand } from \"./upload\";\n\nexport const buildsCommand = defineCommand({\n meta: { name: \"builds\", description: \"Manage builds\" },\n subCommands: {\n list: listCommand,\n get: getCommand,\n delete: deleteCommand,\n \"install-link\": installLinkCommand,\n \"compatibility-matrix\": compatibilityMatrixCommand,\n upload: uploadCommand,\n },\n});\n","import { Effect } from \"effect\";\n\ninterface NamedResource {\n readonly id: string;\n readonly name: string;\n}\n\nexport const resolveNamedResourceId = <Err>(\n params: {\n readonly items: readonly NamedResource[];\n readonly kind: string;\n readonly name: string;\n },\n makeError: (message: string) => Err,\n): Effect.Effect<string, Err> =>\n Effect.gen(function* () {\n const match = params.items.find((item) => item.name === params.name);\n if (match === undefined) {\n return yield* Effect.fail(\n makeError(`${params.kind} \"${params.name}\" not found in the linked project.`),\n );\n }\n return match.id;\n });\n","import { Data } from \"effect\";\n\nimport { resolveNamedResourceId as resolveNamedResourceIdBase } from \"../../lib/resolve-named-resource\";\n\nexport class ChannelCommandError extends Data.TaggedError(\"ChannelCommandError\")<{\n readonly message: string;\n}> {}\n\nexport const channelErrorExtras = { ChannelCommandError: 2 } as const;\n\nexport const resolveNamedResourceId = (params: {\n readonly items: readonly { readonly id: string; readonly name: string }[];\n readonly kind: string;\n readonly name: string;\n}) => resolveNamedResourceIdBase(params, (message) => new ChannelCommandError({ message }));\n","import { defineCommand } from \"citty\";\nimport { Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { drainPages } from \"../../lib/drain-cursor\";\nimport { printKeyValue } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\nimport { channelErrorExtras, resolveNamedResourceId } from \"./helpers\";\n\nexport const createCommand = defineCommand({\n meta: { name: \"create\", description: \"Create a channel\" },\n args: {\n name: { type: \"string\", required: true, description: \"Channel name\" },\n branch: { type: \"string\", required: true, description: \"Initial branch name\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const branches = yield* drainPages((page) =>\n api.branches.list({\n urlParams: { projectId, limit: 100, page },\n }),\n );\n const branchId = yield* resolveNamedResourceId({\n items: branches,\n kind: \"Branch\",\n name: args.branch,\n });\n\n const channel = yield* api.channels.create({\n payload: { projectId, name: args.name, branchId },\n });\n\n yield* printKeyValue([\n [\"ID\", channel.id],\n [\"Name\", channel.name],\n [\"Branch\", args.branch],\n [\"Created\", channel.createdAt],\n ]);\n }),\n channelErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { apiClient } from \"../../services/api-client\";\nimport { channelErrorExtras } from \"./helpers\";\n\nexport const deleteCommand = defineCommand({\n meta: { name: \"delete\", description: \"Delete a channel\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Channel ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n yield* api.channels.delete({ path: { id: args.id } });\n yield* Console.log(`Channel ${args.id} deleted.`);\n }),\n channelErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { drainPages } from \"../../lib/drain-cursor\";\nimport { printTable } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\nimport { channelErrorExtras } from \"./helpers\";\n\nexport const listCommand = defineCommand({\n meta: { name: \"list\", description: \"List channels for the linked project\" },\n run: async () =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const [items, branches] = yield* Effect.all([\n drainPages((page) =>\n api.channels.list({\n urlParams: { projectId, limit: 100, page },\n }),\n ),\n drainPages((page) =>\n api.branches.list({\n urlParams: { projectId, limit: 100, page },\n }),\n ),\n ]);\n\n if (items.length === 0) {\n yield* Console.log(\"No channels found.\");\n return;\n }\n\n const branchNames = new Map(branches.map((branch) => [branch.id, branch.name]));\n\n yield* printTable(\n [\"ID\", \"Name\", \"Branch\", \"Paused\", \"Rollout\", \"Created\"],\n items.map((channel) => [\n channel.id,\n channel.name,\n branchNames.get(channel.branchId) ?? channel.branchId,\n channel.isPaused ? \"yes\" : \"no\",\n channel.branchMappingJson === null ? \"-\" : \"active\",\n channel.createdAt,\n ]),\n );\n }),\n channelErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { apiClient } from \"../../services/api-client\";\nimport { channelErrorExtras } from \"./helpers\";\n\nexport const pauseCommand = defineCommand({\n meta: { name: \"pause\", description: \"Pause a channel\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Channel ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const channel = yield* api.channels.pause({ path: { id: args.id } });\n yield* Console.log(`Channel \"${channel.name}\" paused.`);\n }),\n channelErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { apiClient } from \"../../services/api-client\";\nimport { channelErrorExtras } from \"./helpers\";\n\nexport const resumeCommand = defineCommand({\n meta: { name: \"resume\", description: \"Resume a paused channel\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Channel ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const channel = yield* api.channels.resume({ path: { id: args.id } });\n yield* Console.log(`Channel \"${channel.name}\" resumed.`);\n }),\n channelErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../../lib/citty-effect\";\nimport { apiClient } from \"../../../services/api-client\";\nimport { channelErrorExtras } from \"../helpers\";\n\nexport const completeCommand = defineCommand({\n meta: { name: \"complete\", description: \"Complete the active branch rollout\" },\n args: {\n channelId: { type: \"positional\", required: true, description: \"Channel ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const channel = yield* api.channels.completeBranchRollout({\n path: { id: args.channelId },\n });\n yield* Console.log(`Completed rollout on channel \"${channel.name}\".`);\n }),\n channelErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../../lib/app-json\";\nimport { runEffect } from \"../../../lib/citty-effect\";\nimport { parseRolloutPercentage } from \"../../../lib/cli-schemas\";\nimport { drainPages } from \"../../../lib/drain-cursor\";\nimport { apiClient } from \"../../../services/api-client\";\nimport { channelErrorExtras, resolveNamedResourceId } from \"../helpers\";\n\nexport const createCommand = defineCommand({\n meta: { name: \"create\", description: \"Start a branch rollout on a channel\" },\n args: {\n channelId: { type: \"positional\", required: true, description: \"Channel ID\" },\n branch: { type: \"string\", required: true, description: \"Target branch name\" },\n percentage: {\n type: \"string\",\n required: true,\n description: \"Initial rollout percentage (1-100)\",\n },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const percentage = yield* parseRolloutPercentage(args.percentage, \"percentage\");\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const branches = yield* drainPages((page) =>\n api.branches.list({\n urlParams: { projectId, limit: 100, page },\n }),\n );\n const newBranchId = yield* resolveNamedResourceId({\n items: branches,\n kind: \"Branch\",\n name: args.branch,\n });\n\n const channel = yield* api.channels.createBranchRollout({\n path: { id: args.channelId },\n payload: { newBranchId, percentage },\n });\n\n yield* Console.log(\n `Started rollout on channel \"${channel.name}\" to branch \"${args.branch}\" at ${String(percentage)}%.`,\n );\n }),\n channelErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../../lib/citty-effect\";\nimport { apiClient } from \"../../../services/api-client\";\nimport { channelErrorExtras } from \"../helpers\";\n\nexport const revertCommand = defineCommand({\n meta: { name: \"revert\", description: \"Revert the active branch rollout\" },\n args: {\n channelId: { type: \"positional\", required: true, description: \"Channel ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const channel = yield* api.channels.revertBranchRollout({\n path: { id: args.channelId },\n });\n yield* Console.log(`Reverted rollout on channel \"${channel.name}\".`);\n }),\n channelErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../../lib/citty-effect\";\nimport { parseRolloutPercentage } from \"../../../lib/cli-schemas\";\nimport { apiClient } from \"../../../services/api-client\";\nimport { channelErrorExtras } from \"../helpers\";\n\nexport const updateCommand = defineCommand({\n meta: { name: \"update\", description: \"Update the rollout percentage on a channel\" },\n args: {\n channelId: { type: \"positional\", required: true, description: \"Channel ID\" },\n percentage: { type: \"string\", required: true, description: \"New rollout percentage (1-100)\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const percentage = yield* parseRolloutPercentage(args.percentage, \"percentage\");\n const api = yield* apiClient;\n const channel = yield* api.channels.updateBranchRollout({\n path: { id: args.channelId },\n payload: { percentage },\n });\n\n yield* Console.log(\n `Updated rollout on channel \"${channel.name}\" to ${String(percentage)}%.`,\n );\n }),\n channelErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\n\nimport { completeCommand } from \"./complete\";\nimport { createCommand } from \"./create\";\nimport { revertCommand } from \"./revert\";\nimport { updateCommand } from \"./update\";\n\nexport const rolloutCommand = defineCommand({\n meta: { name: \"rollout\", description: \"Manage channel branch rollouts\" },\n subCommands: {\n create: createCommand,\n update: updateCommand,\n complete: completeCommand,\n revert: revertCommand,\n },\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { drainPages } from \"../../lib/drain-cursor\";\nimport { apiClient } from \"../../services/api-client\";\nimport { channelErrorExtras, resolveNamedResourceId } from \"./helpers\";\n\nexport const updateCommand = defineCommand({\n meta: { name: \"update\", description: \"Relink a channel to a different branch\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Channel ID\" },\n branch: { type: \"string\", required: true, description: \"Target branch name\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const branches = yield* drainPages((page) =>\n api.branches.list({\n urlParams: { projectId, limit: 100, page },\n }),\n );\n const branchId = yield* resolveNamedResourceId({\n items: branches,\n kind: \"Branch\",\n name: args.branch,\n });\n\n const channel = yield* api.channels.update({\n path: { id: args.id },\n payload: { branchId },\n });\n\n yield* Console.log(`Channel \"${channel.name}\" relinked to branch \"${args.branch}\".`);\n }),\n channelErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\n\nimport { createCommand } from \"./create\";\nimport { deleteCommand } from \"./delete\";\nimport { listCommand } from \"./list\";\nimport { pauseCommand } from \"./pause\";\nimport { resumeCommand } from \"./resume\";\nimport { rolloutCommand } from \"./rollout\";\nimport { updateCommand } from \"./update\";\n\nexport const channelsCommand = defineCommand({\n meta: { name: \"channels\", description: \"Manage channels\" },\n subCommands: {\n list: listCommand,\n create: createCommand,\n update: updateCommand,\n pause: pauseCommand,\n resume: resumeCommand,\n delete: deleteCommand,\n rollout: rolloutCommand,\n },\n});\n","/* eslint-disable typescript/no-unsafe-assignment, typescript/no-unsafe-member-access, typescript/no-unsafe-call -- @expo/pkcs12 exports declare node-forge cert shapes as `any`; this file is the narrowing boundary that produces the typed P12Info for the rest of the CLI */\n\nimport { getFormattedSerialNumber, getX509Certificate, parsePKCS12 } from \"@expo/pkcs12\";\nimport { Effect } from \"effect\";\n\nimport { CredentialValidationError } from \"./exit-codes\";\n\nexport interface P12Info {\n readonly serialNumber: string;\n readonly validFrom: Date | undefined;\n readonly expiresAt: Date | undefined;\n readonly subject: string;\n readonly issuerCN: string | undefined;\n readonly signingIdentity: string;\n readonly teamId: string | undefined;\n}\n\nconst APPLE_TEAM_ID_RE = /^[A-Z0-9]{10}$/u;\n\nconst extractTeamId = (params: {\n readonly signingIdentity: string;\n readonly orgUnit: string | undefined;\n}): string | undefined => {\n if (params.orgUnit && APPLE_TEAM_ID_RE.test(params.orgUnit)) {\n return params.orgUnit;\n }\n const parenMatch = /\\(([A-Z0-9]{10})\\)\\s*$/u.exec(params.signingIdentity);\n return parenMatch?.[1];\n};\n\n/**\n * Parse a PKCS#12 (.p12) buffer and extract certificate metadata.\n */\nexport const inspectP12 = (params: {\n readonly data: Buffer;\n readonly password: string;\n}): Effect.Effect<P12Info, CredentialValidationError> =>\n Effect.try({\n try: () => {\n const p12 = parsePKCS12(params.data, params.password);\n const cert = getX509Certificate(p12);\n\n const serialNumber = getFormattedSerialNumber(cert) ?? \"unknown\";\n\n const validFrom =\n cert.validity.notBefore instanceof Date ? cert.validity.notBefore : undefined;\n const expiresAt = cert.validity.notAfter instanceof Date ? cert.validity.notAfter : undefined;\n\n const subjectParts = cert.subject.attributes.map(\n (attr: { shortName?: string; name: string; value: unknown }) =>\n `${attr.shortName ?? attr.name}=${String(attr.value)}`,\n );\n const subject = subjectParts.join(\", \");\n\n const issuerCNValue = cert.issuer.getField(\"CN\")?.value;\n const issuerCN = typeof issuerCNValue === \"string\" ? issuerCNValue : undefined;\n\n // Signing identity = Common Name from subject, e.g. \"Apple Distribution: Name (TEAMID)\"\n const cnValue = cert.subject.getField(\"CN\")?.value;\n const cn = typeof cnValue === \"string\" ? cnValue : undefined;\n const signingIdentity = cn ?? subject;\n const orgUnitValue = cert.subject.getField(\"OU\")?.value;\n const orgUnit = typeof orgUnitValue === \"string\" ? orgUnitValue : undefined;\n\n const teamId = extractTeamId({ signingIdentity, orgUnit });\n\n return { serialNumber, validFrom, expiresAt, subject, issuerCN, signingIdentity, teamId };\n },\n catch: (error) =>\n new CredentialValidationError({\n message: `Failed to parse P12 certificate: ${error instanceof Error ? error.message : String(error)}`,\n }),\n });\n","import { toBase64 } from \"@better-update/encoding\";\nimport { FileSystem } from \"@effect/platform\";\nimport { Effect, Match } from \"effect\";\n\nimport { CredentialValidationError } from \"./exit-codes\";\nimport { inspectP12 } from \"./pkcs12\";\n\nimport type { ApiClient } from \"../services/api-client\";\n\nexport type CliCredentialType =\n | \"distribution-certificate\"\n | \"push-key\"\n | \"asc-api-key\"\n | \"provisioning-profile\"\n | \"keystore\"\n | \"google-service-account-key\";\n\nexport type CliCredentialPlatform = \"ios\" | \"android\";\n\nexport interface CliCredentialRow {\n readonly id: string;\n readonly name: string;\n readonly platform: CliCredentialPlatform;\n readonly type: CliCredentialType;\n readonly distribution: string | null;\n}\n\nconst formatDistribution = (value: string): string => value.toLowerCase().replaceAll(\"_\", \"-\");\n\nexport const listAllCredentials = (api: ApiClient) =>\n Effect.gen(function* () {\n const [certs, pushKeys, ascKeys, profiles, keystores, googleKeys] = yield* Effect.all(\n [\n api.appleDistributionCertificates.list(),\n api.applePushKeys.list(),\n api.ascApiKeys.list(),\n api.appleProvisioningProfiles.list({ urlParams: {} }),\n api.androidUploadKeystores.list(),\n api.googleServiceAccountKeys.list(),\n ],\n { concurrency: \"unbounded\" },\n );\n\n const rows: CliCredentialRow[] = [\n ...certs.items.map(\n (cert): CliCredentialRow => ({\n id: cert.id,\n name: cert.serialNumber,\n platform: \"ios\",\n type: \"distribution-certificate\",\n distribution: null,\n }),\n ),\n ...pushKeys.items.map(\n (key): CliCredentialRow => ({\n id: key.id,\n name: key.keyId,\n platform: \"ios\",\n type: \"push-key\",\n distribution: null,\n }),\n ),\n ...ascKeys.items.map(\n (key): CliCredentialRow => ({\n id: key.id,\n name: key.name,\n platform: \"ios\",\n type: \"asc-api-key\",\n distribution: null,\n }),\n ),\n ...profiles.items.map(\n (profile): CliCredentialRow => ({\n id: profile.id,\n name: profile.profileName ?? profile.bundleIdentifier,\n platform: \"ios\",\n type: \"provisioning-profile\",\n distribution: formatDistribution(profile.distributionType),\n }),\n ),\n ...keystores.items.map(\n (ks): CliCredentialRow => ({\n id: ks.id,\n name: ks.keyAlias,\n platform: \"android\",\n type: \"keystore\",\n distribution: null,\n }),\n ),\n ...googleKeys.items.map(\n (key): CliCredentialRow => ({\n id: key.id,\n name: key.clientEmail,\n platform: \"android\",\n type: \"google-service-account-key\",\n distribution: null,\n }),\n ),\n ];\n\n return rows;\n });\n\nexport const filterCredentials = (\n rows: readonly CliCredentialRow[],\n filter: {\n readonly platform?: CliCredentialPlatform;\n readonly type?: CliCredentialType;\n readonly distribution?: string;\n },\n): CliCredentialRow[] =>\n rows.filter((row) => {\n if (filter.platform && row.platform !== filter.platform) {\n return false;\n }\n if (filter.type && row.type !== filter.type) {\n return false;\n }\n if (filter.distribution && row.distribution !== filter.distribution) {\n return false;\n }\n return true;\n });\n\nexport interface UploadCredentialInput {\n readonly platform: CliCredentialPlatform;\n readonly type: CliCredentialType;\n readonly name: string;\n readonly filePath: string;\n readonly password?: string;\n readonly distribution?: string;\n readonly keyAlias?: string;\n readonly keyPassword?: string;\n readonly keyId?: string;\n readonly issuerId?: string;\n readonly appleTeamIdentifier?: string;\n}\n\nconst toUtf8 = (bytes: Uint8Array): string => new TextDecoder().decode(bytes);\n\nconst missing = (label: string) =>\n new CredentialValidationError({\n message: `Missing --${label} required for the selected credential type.`,\n });\n\nconst uploadIosDistributionCertificate = (\n api: ApiClient,\n input: UploadCredentialInput,\n bytes: Uint8Array,\n) =>\n Effect.gen(function* () {\n if (input.password === undefined) {\n return yield* missing(\"password\");\n }\n const info = yield* inspectP12({ data: Buffer.from(bytes), password: input.password });\n if (!info.teamId) {\n return yield* new CredentialValidationError({\n message:\n \"Could not derive Apple Team ID from certificate subject (expected OU=TEAMID or CN with (TEAMID)).\",\n });\n }\n if (!info.validFrom || !info.expiresAt) {\n return yield* new CredentialValidationError({\n message: \"Certificate is missing notBefore/notAfter dates.\",\n });\n }\n const created = yield* api.appleDistributionCertificates.upload({\n payload: {\n p12Base64: toBase64(bytes),\n p12Password: input.password,\n serialNumber: info.serialNumber,\n appleTeamIdentifier: info.teamId,\n validFrom: info.validFrom.toISOString(),\n validUntil: info.expiresAt.toISOString(),\n },\n });\n return {\n id: created.id,\n name: input.name,\n platform: \"ios\" as const,\n type: \"distribution-certificate\" as const,\n };\n });\n\nconst uploadIosPushKey = (api: ApiClient, input: UploadCredentialInput, bytes: Uint8Array) =>\n Effect.gen(function* () {\n if (!input.keyId) {\n return yield* missing(\"key-id\");\n }\n if (!input.appleTeamIdentifier) {\n return yield* missing(\"apple-team-identifier\");\n }\n const created = yield* api.applePushKeys.upload({\n payload: {\n keyId: input.keyId,\n p8Pem: toUtf8(bytes),\n appleTeamIdentifier: input.appleTeamIdentifier,\n },\n });\n return {\n id: created.id,\n name: input.name,\n platform: \"ios\" as const,\n type: \"push-key\" as const,\n };\n });\n\nconst uploadIosAscApiKey = (api: ApiClient, input: UploadCredentialInput, bytes: Uint8Array) =>\n Effect.gen(function* () {\n if (!input.keyId) {\n return yield* missing(\"key-id\");\n }\n if (!input.issuerId) {\n return yield* missing(\"issuer-id\");\n }\n const created = yield* api.ascApiKeys.upload({\n payload: {\n name: input.name,\n keyId: input.keyId,\n issuerId: input.issuerId,\n p8Pem: toUtf8(bytes),\n ...(input.appleTeamIdentifier === undefined\n ? {}\n : { appleTeamIdentifier: input.appleTeamIdentifier }),\n },\n });\n return {\n id: created.id,\n name: input.name,\n platform: \"ios\" as const,\n type: \"asc-api-key\" as const,\n };\n });\n\nconst uploadIosProvisioningProfile = (\n api: ApiClient,\n input: UploadCredentialInput,\n bytes: Uint8Array,\n) =>\n Effect.gen(function* () {\n const created = yield* api.appleProvisioningProfiles.upload({\n payload: { profileBase64: toBase64(bytes) },\n });\n return {\n id: created.id,\n name: input.name,\n platform: \"ios\" as const,\n type: \"provisioning-profile\" as const,\n };\n });\n\nconst uploadAndroidKeystore = (api: ApiClient, input: UploadCredentialInput, bytes: Uint8Array) =>\n Effect.gen(function* () {\n if (input.password === undefined) {\n return yield* missing(\"password\");\n }\n if (!input.keyAlias) {\n return yield* missing(\"key-alias\");\n }\n if (!input.keyPassword) {\n return yield* missing(\"key-password\");\n }\n const created = yield* api.androidUploadKeystores.upload({\n payload: {\n keystoreBase64: toBase64(bytes),\n keyAlias: input.keyAlias,\n keystorePassword: input.password,\n keyPassword: input.keyPassword,\n },\n });\n return {\n id: created.id,\n name: input.name,\n platform: \"android\" as const,\n type: \"keystore\" as const,\n };\n });\n\nconst uploadAndroidGoogleServiceAccountKey = (\n api: ApiClient,\n input: UploadCredentialInput,\n bytes: Uint8Array,\n) =>\n Effect.gen(function* () {\n const created = yield* api.googleServiceAccountKeys.upload({\n payload: { json: toUtf8(bytes) },\n });\n return {\n id: created.id,\n name: input.name,\n platform: \"android\" as const,\n type: \"google-service-account-key\" as const,\n };\n });\n\nconst uploadHandlers = {\n \"ios:distribution-certificate\": uploadIosDistributionCertificate,\n \"ios:push-key\": uploadIosPushKey,\n \"ios:asc-api-key\": uploadIosAscApiKey,\n \"ios:provisioning-profile\": uploadIosProvisioningProfile,\n \"android:keystore\": uploadAndroidKeystore,\n \"android:google-service-account-key\": uploadAndroidGoogleServiceAccountKey,\n};\n\nexport const uploadCredential = (api: ApiClient, input: UploadCredentialInput) =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const bytes = yield* fs.readFile(input.filePath);\n const key = `${input.platform}:${input.type}`;\n type HandlerKey = keyof typeof uploadHandlers;\n const hasKey = (candidate: string): candidate is HandlerKey =>\n Object.hasOwn(uploadHandlers, candidate);\n const handler = hasKey(key) ? uploadHandlers[key] : undefined;\n if (!handler) {\n return yield* new CredentialValidationError({\n message: `Unsupported credential combination: platform=${input.platform} type=${input.type}`,\n });\n }\n return yield* handler(api, input, bytes);\n });\n\nexport const deleteCredential = (\n api: ApiClient,\n input: {\n readonly id: string;\n readonly platform: CliCredentialPlatform;\n readonly type: CliCredentialType;\n },\n) => {\n const path = { id: input.id };\n return Match.value({ platform: input.platform, type: input.type }).pipe(\n Match.when({ platform: \"ios\", type: \"distribution-certificate\" }, () =>\n api.appleDistributionCertificates.delete({ path }),\n ),\n Match.when({ platform: \"ios\", type: \"push-key\" }, () => api.applePushKeys.delete({ path })),\n Match.when({ platform: \"ios\", type: \"asc-api-key\" }, () => api.ascApiKeys.delete({ path })),\n Match.when({ platform: \"ios\", type: \"provisioning-profile\" }, () =>\n api.appleProvisioningProfiles.delete({ path }),\n ),\n Match.when({ platform: \"android\", type: \"keystore\" }, () =>\n api.androidUploadKeystores.delete({ path }),\n ),\n Match.when({ platform: \"android\", type: \"google-service-account-key\" }, () =>\n api.googleServiceAccountKeys.delete({ path }),\n ),\n Match.orElse(() =>\n Effect.fail(\n new CredentialValidationError({\n message: `Unsupported credential combination: platform=${input.platform} type=${input.type}`,\n }),\n ),\n ),\n );\n};\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { deleteCredential } from \"../../lib/credentials-manager\";\nimport { apiClient } from \"../../services/api-client\";\n\nimport type { CliCredentialType } from \"../../lib/credentials-manager\";\n\nconst CREDENTIAL_TYPES = [\n \"distribution-certificate\",\n \"provisioning-profile\",\n \"push-key\",\n \"asc-api-key\",\n \"keystore\",\n \"google-service-account-key\",\n] as const;\n\nexport const deleteCommand = defineCommand({\n meta: { name: \"delete\", description: \"Delete a credential\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Credential ID\" },\n platform: { type: \"enum\", options: [\"ios\", \"android\"], required: true },\n type: { type: \"enum\", options: [...CREDENTIAL_TYPES], required: true },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n yield* deleteCredential(api, {\n id: args.id,\n platform: args.platform,\n type: args.type as CliCredentialType,\n });\n yield* Console.log(`Credential ${args.id} deleted.`);\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { filterCredentials, listAllCredentials } from \"../../lib/credentials-manager\";\nimport { printTable } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\n\nexport const listCommand = defineCommand({\n meta: { name: \"list\", description: \"List credentials across platforms\" },\n args: {\n platform: { type: \"enum\", options: [\"ios\", \"android\"], description: \"Filter by platform\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const rows = yield* listAllCredentials(api);\n\n const filtered = filterCredentials(rows, args.platform ? { platform: args.platform } : {});\n\n if (filtered.length === 0) {\n yield* Console.log(\"No credentials found.\");\n return;\n }\n\n yield* printTable(\n [\"ID\", \"Name\", \"Platform\", \"Type\", \"Distribution\"],\n filtered.map((row) => [\n row.id,\n row.name,\n row.platform,\n row.type,\n row.distribution ?? \"-\",\n ]),\n );\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { uploadCredential } from \"../../lib/credentials-manager\";\nimport { printKeyValue } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\n\nimport type { CliCredentialType } from \"../../lib/credentials-manager\";\n\nconst CREDENTIAL_TYPES = [\n \"distribution-certificate\",\n \"provisioning-profile\",\n \"push-key\",\n \"asc-api-key\",\n \"keystore\",\n \"google-service-account-key\",\n] as const;\n\nexport const uploadCommand = defineCommand({\n meta: { name: \"upload\", description: \"Upload a credential\" },\n args: {\n platform: { type: \"enum\", options: [\"ios\", \"android\"], required: true },\n type: { type: \"enum\", options: [...CREDENTIAL_TYPES], required: true },\n name: { type: \"string\", required: true, description: \"Display name\" },\n file: { type: \"string\", required: true, description: \"Path to credential file\" },\n password: { type: \"string\", description: \"File password (keystore/p12)\" },\n \"key-alias\": { type: \"string\", description: \"Keystore alias\" },\n \"key-password\": { type: \"string\", description: \"Keystore key password\" },\n \"key-id\": { type: \"string\", description: \"ASC API key ID\" },\n \"issuer-id\": { type: \"string\", description: \"ASC API issuer ID\" },\n \"apple-team-identifier\": { type: \"string\", description: \"Apple Team ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n\n const input: {\n readonly platform: \"ios\" | \"android\";\n readonly type: CliCredentialType;\n readonly name: string;\n readonly filePath: string;\n readonly password?: string;\n readonly keyAlias?: string;\n readonly keyPassword?: string;\n readonly keyId?: string;\n readonly issuerId?: string;\n readonly appleTeamIdentifier?: string;\n } = {\n platform: args.platform,\n type: args.type as CliCredentialType,\n name: args.name,\n filePath: args.file,\n ...(args.password === undefined ? {} : { password: args.password }),\n ...(args[\"key-alias\"] === undefined ? {} : { keyAlias: args[\"key-alias\"] }),\n ...(args[\"key-password\"] === undefined ? {} : { keyPassword: args[\"key-password\"] }),\n ...(args[\"key-id\"] === undefined ? {} : { keyId: args[\"key-id\"] }),\n ...(args[\"issuer-id\"] === undefined ? {} : { issuerId: args[\"issuer-id\"] }),\n ...(args[\"apple-team-identifier\"] === undefined\n ? {}\n : { appleTeamIdentifier: args[\"apple-team-identifier\"] }),\n };\n\n const credential = yield* uploadCredential(api, input);\n\n yield* Console.log(\"Credential uploaded successfully.\");\n yield* Console.log(\"\");\n yield* printKeyValue([\n [\"ID\", credential.id],\n [\"Name\", credential.name],\n [\"Platform\", credential.platform],\n [\"Type\", credential.type],\n ]);\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\n\nimport { deleteCommand } from \"./delete\";\nimport { listCommand } from \"./list\";\nimport { uploadCommand } from \"./upload\";\n\nexport const credentialsCommand = defineCommand({\n meta: { name: \"credentials\", description: \"Manage credentials\" },\n subCommands: {\n list: listCommand,\n upload: uploadCommand,\n delete: deleteCommand,\n },\n});\n","import { Data } from \"effect\";\n\nexport class EnvResourceNotFoundError extends Data.TaggedError(\"EnvResourceNotFoundError\")<{\n readonly message: string;\n}> {}\n\nexport const envErrorExtras = {\n EnvResourceNotFoundError: 1,\n SystemError: 6,\n BadArgument: 6,\n} as const;\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { apiClient } from \"../../services/api-client\";\nimport { EnvResourceNotFoundError, envErrorExtras } from \"./helpers\";\n\nexport const deleteCommand = defineCommand({\n meta: { name: \"delete\", description: \"Delete an environment variable by key\" },\n args: {\n key: { type: \"positional\", required: true, description: \"Env var key\" },\n environment: { type: \"string\", default: \"production\", description: \"Target environment\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const existing = yield* api[\"env-vars\"].list({\n urlParams: { projectId, environment: args.environment },\n });\n\n const match = existing.items.find((item) => item.key === args.key);\n\n if (!match) {\n return yield* new EnvResourceNotFoundError({\n message: `Environment variable ${args.key} not found in ${args.environment}`,\n });\n }\n\n yield* api[\"env-vars\"].delete({ path: { id: match.id } });\n yield* Console.log(`Deleted ${args.key} from ${args.environment}`);\n return undefined;\n }),\n envErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { apiClient } from \"../../services/api-client\";\nimport { envErrorExtras } from \"./helpers\";\n\nexport const exportCommand = defineCommand({\n meta: { name: \"export\", description: \"Print env vars in KEY='value' format\" },\n args: {\n environment: { type: \"string\", default: \"production\", description: \"Target environment\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const result = yield* api[\"env-vars\"].export({\n urlParams: { projectId, environment: args.environment },\n });\n\n for (const item of result.items) {\n const escaped = item.value.replaceAll(\"'\", String.raw`'\\''`);\n yield* Console.log(`${item.key}='${escaped}'`);\n }\n }),\n envErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { printKeyValue } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\nimport { envErrorExtras } from \"./helpers\";\n\nexport const getCommand = defineCommand({\n meta: { name: \"get\", description: \"Show an environment variable\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Env var ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const envVar = yield* api[\"env-vars\"].get({ path: { id: args.id } });\n yield* printKeyValue([\n [\"ID\", envVar.id],\n [\"Key\", envVar.key],\n [\"Environment\", envVar.environment],\n [\"Visibility\", envVar.visibility],\n // eslint-disable-next-line eslint-js/no-restricted-syntax -- EnvVar.value nullable at storage; display empty when absent\n [\"Value\", envVar.visibility === \"plaintext\" ? (envVar.value ?? \"\") : \"******\"],\n [\"Created\", envVar.createdAt],\n [\"Updated\", envVar.updatedAt],\n ]);\n }),\n envErrorExtras,\n ),\n});\n","import { FileSystem } from \"@effect/platform\";\nimport { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { apiClient } from \"../../services/api-client\";\nimport { envErrorExtras } from \"./helpers\";\n\nexport const importCommand = defineCommand({\n meta: { name: \"import\", description: \"Bulk-import env vars from a dotenv file\" },\n args: {\n file: { type: \"positional\", required: true, description: \"Path to .env file\" },\n environment: { type: \"string\", default: \"production\", description: \"Target environment\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const content = yield* fs.readFileString(args.file);\n\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const result = yield* api[\"env-vars\"].bulkImport({\n payload: { projectId, environment: args.environment, content, visibility: \"plaintext\" },\n });\n\n yield* Console.log(\n `Imported: ${String(result.created)} created, ${String(result.updated)} updated, ${String(result.skipped)} skipped`,\n );\n }),\n envErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { printTable } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\nimport { envErrorExtras } from \"./helpers\";\n\nexport const listCommand = defineCommand({\n meta: { name: \"list\", description: \"List environment variables\" },\n args: {\n environment: { type: \"string\", description: \"Filter by environment\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const envFilter = args.environment ? { environment: args.environment } : {};\n\n const result = yield* api[\"env-vars\"].list({\n urlParams: { projectId, ...envFilter },\n });\n\n if (result.items.length === 0) {\n yield* Console.log(\"No environment variables found.\");\n return;\n }\n\n yield* printTable(\n [\"Key\", \"Environment\", \"Visibility\", \"Value\"],\n result.items.map((item) => [\n item.key,\n item.environment,\n item.visibility,\n // eslint-disable-next-line eslint-js/no-restricted-syntax -- EnvVar.value nullable at storage; display empty when absent\n item.visibility === \"plaintext\" ? (item.value ?? \"\") : \"••••••\",\n ]),\n );\n }),\n envErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { apiClient } from \"../../services/api-client\";\nimport { envErrorExtras } from \"./helpers\";\n\nexport const pullCommand = defineCommand({\n meta: { name: \"pull\", description: \"Print env vars in `export KEY='value'` format\" },\n args: {\n environment: { type: \"string\", default: \"production\", description: \"Target environment\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const result = yield* api[\"env-vars\"].export({\n urlParams: { projectId, environment: args.environment },\n });\n\n for (const item of result.items) {\n const escaped = item.value.replaceAll(\"'\", String.raw`'\\''`);\n yield* Console.log(`export ${item.key}='${escaped}'`);\n }\n }),\n envErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { parseKeyValue } from \"../../lib/cli-schemas\";\nimport { apiClient } from \"../../services/api-client\";\nimport { envErrorExtras } from \"./helpers\";\n\nexport const setCommand = defineCommand({\n meta: { name: \"set\", description: \"Create or update an environment variable\" },\n args: {\n keyValue: {\n type: \"positional\",\n required: true,\n description: \"KEY=VALUE pair (e.g. API_KEY=abc123)\",\n },\n environment: { type: \"string\", default: \"production\", description: \"Target environment\" },\n visibility: {\n type: \"enum\",\n options: [\"plaintext\", \"sensitive\", \"secret\"],\n default: \"plaintext\",\n description: \"Value visibility\",\n },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const { key, value } = yield* parseKeyValue(args.keyValue);\n const { environment } = args;\n const { visibility } = args;\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const existing = yield* api[\"env-vars\"].list({\n urlParams: { projectId, environment },\n });\n\n const match = existing.items.find((item) => item.key === key);\n\n if (match) {\n yield* api[\"env-vars\"].update({\n path: { id: match.id },\n payload: { value, visibility },\n });\n yield* Console.log(`Updated ${key} in ${environment}`);\n } else {\n yield* api[\"env-vars\"].create({\n payload: { projectId, environment, key, value, visibility },\n });\n yield* Console.log(`Created ${key} in ${environment}`);\n }\n }),\n envErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\n\nimport { deleteCommand } from \"./delete\";\nimport { exportCommand } from \"./export\";\nimport { getCommand } from \"./get\";\nimport { importCommand } from \"./import\";\nimport { listCommand } from \"./list\";\nimport { pullCommand } from \"./pull\";\nimport { setCommand } from \"./set\";\n\nexport const envCommand = defineCommand({\n meta: { name: \"env\", description: \"Manage environment variables\" },\n subCommands: {\n list: listCommand,\n get: getCommand,\n set: setCommand,\n delete: deleteCommand,\n import: importCommand,\n export: exportCommand,\n pull: pullCommand,\n },\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { exitWith } from \"../../application/command-exit\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { runFingerprintFull } from \"../../lib/fingerprint\";\nimport { CliRuntime } from \"../../services/cli-runtime\";\n\nexport const compareCommand = defineCommand({\n meta: { name: \"compare\", description: \"Compare a fingerprint hash against the current project\" },\n args: {\n hash: { type: \"positional\", required: true, description: \"Fingerprint hash to compare\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const runtime = yield* CliRuntime;\n const projectRoot = yield* runtime.cwd;\n const result = yield* runFingerprintFull(projectRoot);\n\n if (result.hash === args.hash) {\n yield* Console.log(\"Fingerprints match.\");\n return undefined;\n }\n yield* Console.log(\"Fingerprints differ.\");\n yield* Console.log(` Local: ${result.hash}`);\n yield* Console.log(` Provided: ${args.hash}`);\n return yield* exitWith(1, \"Fingerprint mismatch\");\n }),\n { FingerprintError: 2 },\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { runFingerprintFull } from \"../../lib/fingerprint\";\nimport { CliRuntime } from \"../../services/cli-runtime\";\n\nexport const generateCommand = defineCommand({\n meta: { name: \"generate\", description: \"Compute a fingerprint for the current project\" },\n run: async () =>\n runEffect(\n Effect.gen(function* () {\n const runtime = yield* CliRuntime;\n const projectRoot = yield* runtime.cwd;\n const result = yield* runFingerprintFull(projectRoot);\n yield* Console.log(result.hash);\n if (result.sources.length > 0) {\n yield* Console.log(`${result.sources.length} sources`);\n }\n }),\n { FingerprintError: 2 },\n ),\n});\n","import { defineCommand } from \"citty\";\n\nimport { compareCommand } from \"./compare\";\nimport { generateCommand } from \"./generate\";\n\nexport const fingerprintCommand = defineCommand({\n meta: { name: \"fingerprint\", description: \"Fingerprint utilities\" },\n subCommands: {\n generate: generateCommand,\n compare: compareCommand,\n },\n});\n","import { asRecord } from \"@better-update/type-guards\";\nimport { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readAppJson, readSlug, writeProjectId } from \"../lib/app-json\";\nimport { asString } from \"../lib/build-profile\";\nimport { runEffect } from \"../lib/citty-effect\";\nimport { apiClient } from \"../services/api-client\";\n\nexport const initCommand = defineCommand({\n meta: { name: \"init\", description: \"Link the local Expo project to a better-update project\" },\n run: async () =>\n runEffect(\n Effect.gen(function* () {\n const appJson = yield* readAppJson;\n const expo = asRecord(appJson[\"expo\"]);\n const name = asString(expo?.[\"name\"]) ?? asString(expo?.[\"slug\"]) ?? \"untitled\";\n const slug = yield* readSlug;\n\n yield* Console.log(`Linking project: ${name} (${slug})`);\n\n const api = yield* apiClient;\n const { items } = yield* api.projects.list({ urlParams: { page: 1, limit: 100 } });\n\n const existing = items.find((project) => project.slug === slug);\n\n if (existing) {\n yield* Console.log(`Found existing project: ${existing.name} (${existing.id})`);\n yield* writeProjectId(existing.id);\n } else {\n yield* Console.log(\"No existing project found. Creating new project...\");\n const project = yield* api.projects.create({ payload: { name, slug } });\n yield* Console.log(`Created project: ${project.name} (${project.id})`);\n yield* writeProjectId(project.id);\n }\n\n yield* Console.log(\"Project linked successfully. ID saved to app.json.\");\n }),\n ),\n});\n","import { once } from \"node:events\";\nimport { createServer } from \"node:http\";\nimport type { IncomingMessage, Server, ServerResponse } from \"node:http\";\n\nimport { isRecord } from \"@better-update/type-guards\";\nimport { Data, Deferred, Duration, Effect } from \"effect\";\n\nexport class BrowserLoginTimeoutError extends Data.TaggedError(\"BrowserLoginTimeoutError\")<{\n readonly message: string;\n}> {}\n\nexport class BrowserLoginSessionClosedError extends Data.TaggedError(\n \"BrowserLoginSessionClosedError\",\n)<{\n readonly message: string;\n}> {}\n\nexport type BrowserLoginError = BrowserLoginSessionClosedError | BrowserLoginTimeoutError;\n\nexport const CALLBACK_PAGE = `<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <title>better-update CLI Login</title>\n <style>\n :root { color-scheme: light dark; font-family: ui-sans-serif, system-ui, sans-serif; }\n body { margin: 0; min-height: 100vh; display: grid; place-items: center; padding: 24px; }\n main { max-width: 32rem; line-height: 1.5; }\n code { font-family: ui-monospace, SFMono-Regular, monospace; }\n </style>\n </head>\n <body>\n <main>\n <h1>Completing CLI login...</h1>\n <p id=\"message\">Finalizing the local session. You can keep this tab open.</p>\n </main>\n <script>\n const message = document.getElementById(\"message\");\n const render = (text) => {\n if (message) message.textContent = text;\n };\n\n const params = new URLSearchParams(window.location.hash.slice(1));\n const token = params.get(\"token\");\n\n if (!token) {\n render(\"Missing token. Return to the CLI and run login again.\");\n } else {\n fetch(\"/callback/token\", {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ token }),\n })\n .then(async (response) => {\n if (!response.ok) {\n const body = await response.text();\n throw new Error(body || \"Callback failed\");\n }\n window.history.replaceState({}, document.title, window.location.pathname);\n render(\"CLI login complete. You can close this tab.\");\n setTimeout(() => window.close(), 300);\n })\n .catch((error) => {\n render(error instanceof Error ? error.message : \"Callback failed.\");\n });\n }\n </script>\n </body>\n</html>`;\n\nexport interface BrowserLoginServer {\n readonly callbackUrl: string;\n readonly waitForToken: Effect.Effect<string, BrowserLoginError>;\n readonly stop: () => void;\n}\n\nexport interface BrowserLoginSession {\n readonly callbackPath: string;\n readonly waitForToken: Effect.Effect<string, BrowserLoginError>;\n readonly handleRequest: (request: Request) => Promise<Response>;\n readonly dispose: () => void;\n}\n\nexport interface CreateBrowserLoginServerOptions {\n readonly timeoutMs?: number;\n}\n\nexport const createBrowserLoginSession = (\n options: CreateBrowserLoginServerOptions = {},\n): BrowserLoginSession => {\n const tokenDeferred = Effect.runSync(Deferred.make<string, BrowserLoginSessionClosedError>());\n const waitForToken = Deferred.await(tokenDeferred).pipe(\n Effect.timeoutFail({\n duration:\n options.timeoutMs === undefined ? Duration.minutes(5) : Duration.millis(options.timeoutMs),\n onTimeout: () =>\n new BrowserLoginTimeoutError({\n message: \"Timed out waiting for browser login to complete.\",\n }),\n }),\n );\n\n const dispose = () => {\n Effect.runSync(\n Deferred.fail(\n tokenDeferred,\n new BrowserLoginSessionClosedError({\n message: \"Browser login session closed.\",\n }),\n ),\n );\n };\n\n return {\n callbackPath: \"/callback\",\n waitForToken,\n handleRequest: async (request) => {\n const url = new URL(request.url);\n\n if (request.method === \"GET\" && url.pathname === \"/callback\") {\n return new Response(CALLBACK_PAGE, {\n headers: { \"content-type\": \"text/html; charset=utf-8\" },\n });\n }\n\n if (request.method === \"POST\" && url.pathname === \"/callback/token\") {\n try {\n const body: unknown = await request.json();\n if (!isRecord(body)) {\n return new Response(\"Invalid callback payload\", { status: 400 });\n }\n const token = typeof body[\"token\"] === \"string\" ? body[\"token\"].trim() : \"\";\n if (token.length === 0) {\n return new Response(\"Missing token\", { status: 400 });\n }\n\n Effect.runSync(Deferred.succeed(tokenDeferred, token));\n return Response.json({ ok: true });\n } catch {\n return new Response(\"Invalid callback payload\", { status: 400 });\n }\n }\n\n return new Response(\"Not found\", { status: 404 });\n },\n dispose,\n };\n};\n\nconst readBody = async (req: IncomingMessage): Promise<Buffer> => {\n const chunks: Buffer[] = [];\n for await (const chunk of req as AsyncIterable<Buffer>) {\n chunks.push(chunk);\n }\n return Buffer.concat(chunks);\n};\n\nconst toFetchRequest = async (req: IncomingMessage, origin: string): Promise<Request> => {\n const url = new URL(req.url ?? \"/\", origin);\n const method = req.method ?? \"GET\";\n const headers = new Headers();\n for (const [key, value] of Object.entries(req.headers)) {\n if (value === undefined) {\n // eslint-disable-next-line no-continue -- forEach would require push-style state mutation; continue keeps the filter inline\n continue;\n }\n if (Array.isArray(value)) {\n for (const entry of value) {\n headers.append(key, entry);\n }\n } else {\n headers.append(key, value);\n }\n }\n const init: RequestInit = { method, headers };\n if (method !== \"GET\" && method !== \"HEAD\") {\n const body = await readBody(req);\n init.body = new Uint8Array(body);\n }\n return new Request(url, init);\n};\n\nconst writeFetchResponse = async (res: ServerResponse, response: Response): Promise<void> => {\n res.statusCode = response.status;\n response.headers.forEach((value, key) => {\n res.setHeader(key, value);\n });\n const body = await response.arrayBuffer();\n res.end(Buffer.from(body));\n};\n\nconst handleIncoming = async (\n req: IncomingMessage,\n res: ServerResponse,\n session: BrowserLoginSession,\n): Promise<void> => {\n try {\n const request = await toFetchRequest(req, \"http://127.0.0.1\");\n const response = await session.handleRequest(request);\n await writeFetchResponse(res, response);\n } catch {\n res.statusCode = 500;\n res.end(\"Local callback failed\");\n }\n};\n\nexport const createBrowserLoginServer = async (\n options: CreateBrowserLoginServerOptions = {},\n): Promise<BrowserLoginServer> => {\n const session = createBrowserLoginSession(options);\n const server: Server = createServer((req, res) => {\n // eslint-disable-next-line promise/prefer-await-to-then -- node createServer callback is sync; rejections already swallowed inside handleIncoming, so .catch here is a safety net, not a control-flow then()\n handleIncoming(req, res, session).catch(() => undefined);\n });\n\n server.listen(0, \"127.0.0.1\");\n await once(server, \"listening\");\n const address = server.address();\n const port = address !== null && typeof address === \"object\" ? address.port : 0;\n\n return {\n callbackUrl: `http://127.0.0.1:${port}${session.callbackPath}`,\n waitForToken: session.waitForToken,\n stop: () => {\n session.dispose();\n server.close();\n },\n };\n};\n","import { cancel, isCancel, password, select } from \"@clack/prompts\";\n\nexport const promptPassword = async (message: string): Promise<string> => {\n const value = await password({ message });\n if (isCancel(value)) {\n cancel(\"Operation cancelled.\");\n // eslint-disable-next-line eslint-plugin-unicorn/no-process-exit -- SIGINT at a CLI prompt must terminate the process; throwing would leave Effect runtime stuck\n process.exit(130);\n }\n return value;\n};\n\ntype SelectOption<T> = Parameters<typeof select<T>>[0][\"options\"][number];\n\nexport const promptSelect = async <T>(\n message: string,\n options: readonly SelectOption<T>[],\n): Promise<T> => {\n const value = await select<T>({ message, options: [...options] });\n if (isCancel(value)) {\n cancel(\"Operation cancelled.\");\n // eslint-disable-next-line eslint-plugin-unicorn/no-process-exit -- SIGINT at a CLI prompt must terminate the process; throwing would leave Effect runtime stuck\n process.exit(130);\n }\n return value;\n};\n","import { Command } from \"@effect/platform\";\nimport { Console, Effect } from \"effect\";\n\nimport type { CommandExecutor } from \"@effect/platform\";\n\nimport { createBrowserLoginServer } from \"../lib/browser-login\";\nimport { promptPassword } from \"../lib/prompts\";\nimport { AuthStore } from \"../services/auth-store\";\nimport { CliRuntime } from \"../services/cli-runtime\";\nimport { ConfigStore } from \"../services/config-store\";\n\nconst buildOpenBrowserCommand = (platform: NodeJS.Platform, url: string) => {\n if (platform === \"darwin\") {\n return Command.make(\"open\", url);\n }\n if (platform === \"win32\") {\n return Command.make(\"cmd\", \"/c\", \"start\", \"\", url);\n }\n return Command.make(\"xdg-open\", url);\n};\n\nconst openBrowser = (\n url: string,\n): Effect.Effect<void, never, CliRuntime | CommandExecutor.CommandExecutor> =>\n Effect.gen(function* () {\n const runtime = yield* CliRuntime;\n const command = buildOpenBrowserCommand(runtime.platform, url);\n\n const opened = yield* Command.exitCode(command).pipe(\n Effect.map((code) => code === 0),\n Effect.catchAll(() => Effect.succeed(false)),\n );\n\n if (!opened) {\n yield* Console.log(`Open this URL manually:\\n${url}`);\n }\n });\n\nconst browserLogin = Effect.scoped(\n Effect.gen(function* () {\n const configStore = yield* ConfigStore;\n const authStore = yield* AuthStore;\n const webUrl = yield* configStore.getWebUrl;\n\n const loginServer = yield* Effect.acquireRelease(\n Effect.promise(async () => createBrowserLoginServer()),\n (server) => Effect.sync(server.stop),\n );\n\n const loginUrl = `${webUrl}/auth/cli-login?callbackUrl=${encodeURIComponent(loginServer.callbackUrl)}`;\n\n yield* Console.log(\"Opening browser for better-update login...\");\n yield* Console.log(\"\");\n yield* openBrowser(loginUrl);\n\n const token = yield* loginServer.waitForToken;\n yield* authStore.saveToken(token);\n yield* Console.log(\"\");\n yield* Console.log(\"Logged in successfully. Token saved to ~/.better-update/auth.json\");\n }),\n);\n\nconst manualLogin = Effect.gen(function* () {\n yield* Console.log(\"Log in to better-update with an existing API key\");\n yield* Console.log(\"Get your API key from the dashboard > API Keys page\");\n yield* Console.log(\"\");\n\n const token = yield* Effect.promise(async () =>\n promptPassword(\"Paste your API key (from dashboard > API Keys):\"),\n );\n const authStore = yield* AuthStore;\n yield* authStore.saveToken(token);\n yield* Console.log(\"\");\n yield* Console.log(\"Logged in successfully. Token saved to ~/.better-update/auth.json\");\n});\n\nexport const runLogin = (options: { readonly manualApiKey: boolean }) =>\n Effect.gen(function* () {\n if (options.manualApiKey) {\n yield* manualLogin;\n return;\n }\n\n yield* browserLogin;\n });\n","import { defineCommand } from \"citty\";\n\nimport { runLogin } from \"../application/login\";\nimport { runEffect } from \"../lib/citty-effect\";\n\nexport const loginCommand = defineCommand({\n meta: { name: \"login\", description: \"Log in to better-update\" },\n args: {\n \"api-key\": {\n type: \"boolean\",\n description: \"Paste an API key manually instead of opening the browser\",\n },\n },\n run: async ({ args }) => runEffect(runLogin({ manualApiKey: args[\"api-key\"] ?? false })),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../lib/citty-effect\";\nimport { AuthStore } from \"../services/auth-store\";\n\nexport const logoutCommand = defineCommand({\n meta: { name: \"logout\", description: \"Remove the stored auth token\" },\n run: async () =>\n runEffect(\n Effect.gen(function* () {\n const authStore = yield* AuthStore;\n yield* authStore.clearToken;\n yield* Console.log(\"Logged out. Auth token removed.\");\n }),\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../lib/citty-effect\";\nimport { printKeyValue, printTable } from \"../lib/output\";\nimport { apiClient } from \"../services/api-client\";\n\nconst listCommand = defineCommand({\n meta: { name: \"list\", description: \"List projects (most recently active first)\" },\n args: {\n query: { type: \"string\", description: \"Substring search on name or slug\" },\n sort: {\n type: \"string\",\n description: \"Sort key: lastActivityAt (default) or name\",\n default: \"lastActivityAt\",\n },\n limit: { type: \"string\", description: \"Page size (default 50, max 100)\", default: \"50\" },\n page: { type: \"string\", description: \"1-based page number\", default: \"1\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const sort = args.sort === \"name\" ? \"name\" : \"lastActivityAt\";\n const { items, total, page } = yield* api.projects.list({\n urlParams: {\n page: Number(args.page),\n limit: Number(args.limit),\n sort,\n ...(args.query ? { query: args.query } : {}),\n },\n });\n\n if (items.length === 0) {\n yield* Console.log(\"No projects found.\");\n return;\n }\n\n yield* printTable(\n [\"ID\", \"Name\", \"Slug\", \"Last activity\"],\n items.map((project) => [project.id, project.name, project.slug, project.lastActivityAt]),\n );\n yield* Console.log(`Page ${page} · ${items.length} of ${total} project(s)`);\n }),\n ),\n});\n\nconst createCommand = defineCommand({\n meta: { name: \"create\", description: \"Create a new project\" },\n args: {\n name: { type: \"string\", required: true, description: \"Display name\" },\n slug: { type: \"string\", required: true, description: \"URL-safe slug\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const project = yield* api.projects.create({\n payload: { name: args.name, slug: args.slug },\n });\n yield* printKeyValue([\n [\"ID\", project.id],\n [\"Name\", project.name],\n [\"Slug\", project.slug],\n [\"Created\", project.createdAt],\n ]);\n }),\n ),\n});\n\nconst getCommand = defineCommand({\n meta: { name: \"get\", description: \"Show a project\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Project ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const project = yield* api.projects.get({ path: { id: args.id } });\n yield* printKeyValue([\n [\"ID\", project.id],\n [\"Name\", project.name],\n [\"Slug\", project.slug],\n [\"Created\", project.createdAt],\n ]);\n }),\n ),\n});\n\nconst renameCommand = defineCommand({\n meta: { name: \"rename\", description: \"Rename a project\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Project ID\" },\n name: { type: \"string\", required: true, description: \"New display name\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const project = yield* api.projects.rename({\n path: { id: args.id },\n payload: { name: args.name },\n });\n yield* Console.log(`Project renamed to \"${project.name}\".`);\n }),\n ),\n});\n\nconst deleteCommand = defineCommand({\n meta: { name: \"delete\", description: \"Delete a project\" },\n args: {\n id: { type: \"positional\", required: true, description: \"Project ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n yield* api.projects.delete({ path: { id: args.id } });\n yield* Console.log(`Project ${args.id} deleted.`);\n }),\n ),\n});\n\nexport const projectsCommand = defineCommand({\n meta: { name: \"projects\", description: \"Manage projects\" },\n subCommands: {\n list: listCommand,\n create: createCommand,\n get: getCommand,\n rename: renameCommand,\n delete: deleteCommand,\n },\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../lib/app-json\";\nimport { runEffect } from \"../lib/citty-effect\";\nimport { listAllCredentials } from \"../lib/credentials-manager\";\nimport { printKeyValue } from \"../lib/output\";\nimport { apiClient } from \"../services/api-client\";\n\nexport const statusCommand = defineCommand({\n meta: { name: \"status\", description: \"Show project status (credentials, builds)\" },\n run: async () =>\n runEffect(\n Effect.gen(function* () {\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n\n const { project, credentials, builds } = yield* Effect.all(\n {\n project: api.projects.get({ path: { id: projectId } }),\n credentials: listAllCredentials(api),\n builds: api.builds.list({ urlParams: { projectId } }),\n },\n { concurrency: \"unbounded\" },\n );\n\n yield* Console.log(\"Project\");\n yield* Console.log(\"-------\");\n yield* printKeyValue([\n [\"Name\", project.name],\n [\"ID\", project.id],\n [\"Slug\", project.slug],\n [\"Created\", project.createdAt],\n ]);\n\n yield* Console.log(\"\");\n yield* Console.log(\"Credentials\");\n yield* Console.log(\"-----------\");\n const iosCreds = credentials.filter((cred) => cred.platform === \"ios\").length;\n const androidCreds = credentials.filter((cred) => cred.platform === \"android\").length;\n yield* printKeyValue([\n [\"iOS\", String(iosCreds)],\n [\"Android\", String(androidCreds)],\n [\"Total\", String(credentials.length)],\n ]);\n\n yield* Console.log(\"\");\n yield* Console.log(\"Builds\");\n yield* Console.log(\"------\");\n const moreSuffix = builds.items.length < builds.total ? \"+\" : \"\";\n yield* printKeyValue([\n [\"Recent\", `${String(builds.items.length)}${moreSuffix}`],\n [\"Total\", String(builds.total)],\n ]);\n }),\n ),\n});\n","import { Data } from \"effect\";\n\nimport { resolveNamedResourceId as resolveNamedResourceIdBase } from \"../../lib/resolve-named-resource\";\n\nexport class UpdateCommandError extends Data.TaggedError(\"UpdateCommandError\")<{\n readonly message: string;\n}> {}\n\nexport const updateErrorExtras = {\n UpdateCommandError: 2,\n BuildProfileError: 2,\n RuntimeVersionError: 2,\n UpdateRollbackError: 2,\n UpdatePromoteError: 2,\n} as const;\n\nexport const resolveNamedResourceId = (params: {\n readonly items: readonly { readonly id: string; readonly name: string }[];\n readonly kind: string;\n readonly name: string;\n}) => resolveNamedResourceIdBase(params, (message) => new UpdateCommandError({ message }));\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { apiClient } from \"../../services/api-client\";\nimport { updateErrorExtras } from \"./helpers\";\n\nexport const deleteCommand = defineCommand({\n meta: { name: \"delete\", description: \"Delete an update group\" },\n args: {\n groupId: { type: \"positional\", required: true, description: \"Update group ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const result = yield* api.updates.deleteGroup({ path: { groupId: args.groupId } });\n yield* Console.log(\n `Deleted ${String(result.deleted)} update(s) from group ${args.groupId}.`,\n );\n }),\n updateErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { readProjectId } from \"../../lib/app-json\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { parseLimit } from \"../../lib/cli-schemas\";\nimport { drainPages } from \"../../lib/drain-cursor\";\nimport { printTable } from \"../../lib/output\";\nimport { apiClient } from \"../../services/api-client\";\nimport { resolveNamedResourceId, updateErrorExtras } from \"./helpers\";\n\nexport const listCommand = defineCommand({\n meta: { name: \"list\", description: \"List recent updates\" },\n args: {\n branch: { type: \"string\", description: \"Filter by branch name\" },\n limit: { type: \"string\", default: \"20\", description: \"Max rows (default 20)\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const limit = yield* parseLimit(args.limit, 20);\n const projectId = yield* readProjectId;\n const api = yield* apiClient;\n const branches = yield* drainPages((page) =>\n api.branches.list({\n urlParams: { projectId, limit: 100, page },\n }),\n );\n\n const branchId = args.branch\n ? yield* resolveNamedResourceId({\n items: branches,\n kind: \"Branch\",\n name: args.branch,\n })\n : undefined;\n\n const { items } = yield* api.updates.list({\n urlParams: {\n projectId,\n ...(branchId === undefined ? {} : { branchId }),\n limit,\n },\n });\n\n if (items.length === 0) {\n yield* Console.log(\"No updates found.\");\n return;\n }\n\n const branchNames = new Map(branches.map((item) => [item.id, item.name]));\n\n yield* printTable(\n [\"Update ID\", \"Group\", \"Branch\", \"Platform\", \"Runtime\", \"Rollout\", \"Rollback\", \"Created\"],\n items.map((item) => [\n item.id,\n item.groupId,\n branchNames.get(item.branchId) ?? item.branchId,\n item.platform,\n item.runtimeVersion,\n `${String(item.rolloutPercentage)}%`,\n item.isRollback ? \"yes\" : \"no\",\n item.createdAt,\n ]),\n );\n }),\n updateErrorExtras,\n ),\n});\n","import { FileSystem } from \"@effect/platform\";\nimport { Effect } from \"effect\";\n\nimport { formatCause } from \"./format-error\";\n\nimport type { Platform } from \"./build-profile\";\n\nexport interface SignedPayload {\n readonly manifestBody: string;\n readonly signature: string;\n readonly certificateChain: string;\n}\n\nexport interface SignedPayloadFileSet {\n readonly manifestBodyFile: string | undefined;\n readonly signatureFile: string | undefined;\n readonly certificateChainFile: string | undefined;\n}\n\nconst emptySignedPayloadFileSet = {\n manifestBodyFile: undefined,\n signatureFile: undefined,\n certificateChainFile: undefined,\n} as const satisfies SignedPayloadFileSet;\n\nconst hasAnySignedPayloadFile = (files: SignedPayloadFileSet) =>\n files.manifestBodyFile !== undefined ||\n files.signatureFile !== undefined ||\n files.certificateChainFile !== undefined;\n\nconst loadSignedPayloadFromFiles = <Err>(params: {\n readonly files: SignedPayloadFileSet;\n readonly label: string;\n readonly makeError: (message: string) => Err;\n}): Effect.Effect<SignedPayload | null, Err, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fileSystem = yield* FileSystem.FileSystem;\n if (!hasAnySignedPayloadFile(params.files)) {\n return null;\n }\n\n if (\n !params.files.manifestBodyFile ||\n !params.files.signatureFile ||\n !params.files.certificateChainFile\n ) {\n return yield* Effect.fail(\n params.makeError(\n `${params.label} requires ${[\n params.files.manifestBodyFile ? null : \"manifest body\",\n params.files.signatureFile ? null : \"signature\",\n params.files.certificateChainFile ? null : \"certificate chain\",\n ]\n .filter(Boolean)\n .join(\", \")} file inputs to be provided as a complete triplet.`,\n ),\n );\n }\n\n const [manifestBody, signature, certificateChain] = yield* Effect.all(\n [\n fileSystem.readFileString(params.files.manifestBodyFile),\n fileSystem.readFileString(params.files.signatureFile),\n fileSystem.readFileString(params.files.certificateChainFile),\n ],\n { concurrency: \"unbounded\" },\n ).pipe(\n Effect.mapError((cause) =>\n params.makeError(`${params.label} failed to read signed inputs: ${formatCause(cause)}`),\n ),\n );\n\n return {\n manifestBody,\n signature: signature.trim(),\n certificateChain: certificateChain.trimEnd(),\n } as const satisfies SignedPayload;\n });\n\nexport const loadOptionalSignedPayload = loadSignedPayloadFromFiles;\n\nexport const loadSignedPublishPayloads = <Err>(params: {\n readonly platforms: readonly Platform[];\n readonly globalFiles: SignedPayloadFileSet;\n readonly platformFiles: Partial<Record<Platform, SignedPayloadFileSet>>;\n readonly makeError: (message: string) => Err;\n}): Effect.Effect<Partial<Record<Platform, SignedPayload>>, Err, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const targetedPlatforms = new Set(params.platforms);\n const nonTargetedPlatforms = ([\"ios\", \"android\"] as const).filter(\n (platform) =>\n !targetedPlatforms.has(platform) &&\n hasAnySignedPayloadFile(params.platformFiles[platform] ?? emptySignedPayloadFileSet),\n );\n if (nonTargetedPlatforms.length > 0) {\n return yield* Effect.fail(\n params.makeError(\n `Signed publish inputs were provided for non-targeted platform(s): ${nonTargetedPlatforms.join(\", \")}.`,\n ),\n );\n }\n\n const hasGlobalFiles = hasAnySignedPayloadFile(params.globalFiles);\n if (\n !hasGlobalFiles &&\n Object.values(params.platformFiles).every((files) => !hasAnySignedPayloadFile(files))\n ) {\n return {};\n }\n\n if (params.platforms.length > 1 && hasGlobalFiles) {\n return yield* Effect.fail(\n params.makeError(\n \"Signed multi-platform publish requires per-platform file sets. Use the --*-ios and --*-android options.\",\n ),\n );\n }\n\n if (params.platforms.length === 1 && hasGlobalFiles) {\n const [platform] = params.platforms;\n if (!platform) {\n return {};\n }\n if (hasAnySignedPayloadFile(params.platformFiles[platform] ?? emptySignedPayloadFileSet)) {\n return yield* Effect.fail(\n params.makeError(\n `Signed publish for ${platform} is ambiguous. Use either the generic file options or the ${platform}-specific file options, not both.`,\n ),\n );\n }\n\n const globalPayload = yield* loadSignedPayloadFromFiles({\n files: params.globalFiles,\n label: \"Signed publish\",\n makeError: params.makeError,\n });\n return globalPayload === null ? {} : { [platform]: globalPayload };\n }\n\n const platformPayloadEntries = yield* Effect.forEach(\n params.platforms,\n (platform) =>\n Effect.gen(function* () {\n const payload = yield* loadSignedPayloadFromFiles({\n files: params.platformFiles[platform] ?? emptySignedPayloadFileSet,\n label: `Signed publish for ${platform}`,\n makeError: params.makeError,\n });\n\n if (payload === null) {\n return yield* Effect.fail(\n params.makeError(\n `Signed multi-platform publish requires a signed payload for ${platform}.`,\n ),\n );\n }\n\n return [platform, payload] as const;\n }),\n { concurrency: 1 },\n );\n\n return Object.fromEntries(platformPayloadEntries) as Partial<Record<Platform, SignedPayload>>;\n });\n","import { Effect } from \"effect\";\n\nimport type { FileSystem } from \"@effect/platform\";\n\nimport { UpdatePromoteError } from \"../lib/exit-codes\";\nimport { formatCause } from \"../lib/format-error\";\nimport { loadOptionalSignedPayload } from \"../lib/signed-payloads\";\nimport { apiClient } from \"../services/api-client\";\n\nimport type { AuthRequiredError } from \"../lib/exit-codes\";\nimport type { ApiClientService } from \"../services/api-client\";\n\nexport interface RunUpdatePromoteOptions {\n readonly updateId: string;\n readonly channel: string;\n readonly manifestBodyFile: string | undefined;\n readonly signatureFile: string | undefined;\n readonly certificateChainFile: string | undefined;\n}\n\nexport interface UpdatePromoteResult {\n readonly sourceUpdateId: string;\n readonly channel: string;\n readonly updateId: string;\n}\n\nexport const runUpdatePromote = (\n options: RunUpdatePromoteOptions,\n): Effect.Effect<\n UpdatePromoteResult,\n AuthRequiredError | UpdatePromoteError,\n ApiClientService | FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const api = yield* apiClient;\n const signedPayload = yield* loadOptionalSignedPayload({\n files: {\n manifestBodyFile: options.manifestBodyFile,\n signatureFile: options.signatureFile,\n certificateChainFile: options.certificateChainFile,\n },\n label: \"Signed promote\",\n makeError: (message) => new UpdatePromoteError({ message }),\n });\n\n const result = yield* api.updates\n .republish({\n payload: {\n sourceUpdateId: options.updateId,\n destinationChannel: options.channel,\n ...(signedPayload\n ? {\n signedUpdates: [\n {\n sourceUpdateId: options.updateId,\n manifestBody: signedPayload.manifestBody,\n signature: signedPayload.signature,\n certificateChain: signedPayload.certificateChain,\n },\n ],\n }\n : {}),\n },\n })\n .pipe(\n Effect.catchIf(\n (cause): cause is Exclude<typeof cause, AuthRequiredError> =>\n (cause as { readonly _tag?: string })._tag !== \"AuthRequiredError\",\n (cause) =>\n new UpdatePromoteError({\n message: `Failed to promote update: ${formatCause(cause)}`,\n }),\n ),\n );\n\n const [promotedUpdate] = result.updates;\n if (!promotedUpdate) {\n return yield* new UpdatePromoteError({\n message: \"Promote completed without returning a promoted update.\",\n });\n }\n\n return {\n sourceUpdateId: options.updateId,\n channel: options.channel,\n updateId: promotedUpdate.id,\n } as const satisfies UpdatePromoteResult;\n });\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runUpdatePromote } from \"../../application/update-promote\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { updateErrorExtras } from \"./helpers\";\n\nexport const promoteCommand = defineCommand({\n meta: { name: \"promote\", description: \"Promote an existing update to a channel\" },\n args: {\n updateId: { type: \"positional\", required: true, description: \"Source update ID\" },\n channel: { type: \"string\", required: true, description: \"Target channel name\" },\n \"manifest-body-file\": { type: \"string\" },\n \"signature-file\": { type: \"string\" },\n \"certificate-chain-file\": { type: \"string\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const result = yield* runUpdatePromote({\n updateId: args.updateId,\n channel: args.channel,\n manifestBodyFile: args[\"manifest-body-file\"],\n signatureFile: args[\"signature-file\"],\n certificateChainFile: args[\"certificate-chain-file\"],\n });\n\n yield* Console.log(\n `Promoted update ${result.sourceUpdateId} to channel \"${result.channel}\" as update ${result.updateId}.`,\n );\n }),\n updateErrorExtras,\n ),\n});\n","import path from \"node:path\";\n\nimport { asRecord } from \"@better-update/type-guards\";\nimport { Command, FileSystem } from \"@effect/platform\";\nimport { Effect } from \"effect\";\n\nimport type { CommandExecutor } from \"@effect/platform\";\n\nimport { CliRuntime } from \"../services/cli-runtime\";\nimport { BuildFailedError, UpdatePublishError } from \"./exit-codes\";\n\nimport type { Platform } from \"./build-profile\";\n\nexport interface ExportedUpdateAssetFile {\n readonly path: string;\n readonly key: string;\n readonly fileExt: string;\n readonly contentType: string;\n readonly isLaunch: boolean;\n}\n\ninterface ReadExpoPublicConfigOptions {\n readonly projectRoot: string;\n readonly envVars: Record<string, string>;\n}\n\ninterface RunExpoExportOptions extends ReadExpoPublicConfigOptions {\n readonly exportDir: string;\n readonly platform: Platform;\n readonly clear: boolean;\n}\n\ninterface ReadExpoExportAssetsOptions {\n readonly exportDir: string;\n readonly platform: Platform;\n}\n\nconst asString = (value: unknown): string | undefined =>\n typeof value === \"string\" ? value : undefined;\n\nconst normalizeExtension = (value: string | undefined): string | undefined => {\n if (!value) {\n return undefined;\n }\n return value.startsWith(\".\") ? value.slice(1) : value;\n};\n\nconst inferContentType = (fileExt: string, isLaunch: boolean): string => {\n const normalized = fileExt.toLowerCase();\n if (isLaunch || normalized === \"js\" || normalized === \"hbc\" || normalized === \"bundle\") {\n return \"application/javascript\";\n }\n\n switch (normalized) {\n case \"png\": {\n return \"image/png\";\n }\n case \"jpg\":\n case \"jpeg\": {\n return \"image/jpeg\";\n }\n case \"webp\": {\n return \"image/webp\";\n }\n case \"gif\": {\n return \"image/gif\";\n }\n case \"svg\": {\n return \"image/svg+xml\";\n }\n case \"json\": {\n return \"application/json\";\n }\n case \"mp4\": {\n return \"video/mp4\";\n }\n case \"mp3\": {\n return \"audio/mpeg\";\n }\n case \"wav\": {\n return \"audio/wav\";\n }\n case \"ttf\": {\n return \"font/ttf\";\n }\n case \"otf\": {\n return \"font/otf\";\n }\n case \"woff\": {\n return \"font/woff\";\n }\n case \"woff2\": {\n return \"font/woff2\";\n }\n default: {\n return \"application/octet-stream\";\n }\n }\n};\n\nconst makeBunxCommand = (...args: readonly string[]): Command.Command =>\n Command.make(\"bunx\", ...args);\n\nconst runCommand = (\n cmd: Command.Command,\n step: string,\n): Effect.Effect<void, BuildFailedError, CommandExecutor.CommandExecutor> =>\n Command.exitCode(cmd.pipe(Command.stdout(\"inherit\"), Command.stderr(\"inherit\"))).pipe(\n Effect.mapError(\n (cause) =>\n new BuildFailedError({\n step,\n exitCode: 1,\n message: `${step} failed to spawn: ${String(cause)}`,\n }),\n ),\n Effect.flatMap((code) =>\n code === 0\n ? Effect.void\n : Effect.fail(\n new BuildFailedError({\n step,\n exitCode: code,\n message: `${step} exited with code ${code}`,\n }),\n ),\n ),\n );\n\nexport const readExpoPublicConfig = ({\n projectRoot,\n envVars,\n}: ReadExpoPublicConfigOptions): Effect.Effect<\n Record<string, unknown>,\n UpdatePublishError,\n CliRuntime | CommandExecutor.CommandExecutor\n> =>\n Effect.gen(function* () {\n const runtime = yield* CliRuntime;\n const commandEnv = yield* runtime.commandEnvironment(envVars);\n const stdout = yield* Command.string(\n makeBunxCommand(\"expo\", \"config\", \"--type\", \"public\", \"--json\").pipe(\n Command.workingDirectory(projectRoot),\n Command.env(commandEnv),\n ),\n ).pipe(\n Effect.mapError(\n (cause) =>\n new UpdatePublishError({\n message: `Failed to read Expo public config: ${String(cause)}`,\n }),\n ),\n );\n\n const parsed = yield* Effect.try({\n try: () => JSON.parse(stdout) as unknown,\n catch: () =>\n new UpdatePublishError({\n message: \"Expo public config output was not valid JSON.\",\n }),\n });\n\n const config = asRecord(parsed);\n if (!config) {\n return yield* new UpdatePublishError({\n message: \"Expo public config did not decode to a JSON object.\",\n });\n }\n\n return config;\n });\n\nexport const runExpoExport = ({\n projectRoot,\n exportDir,\n platform,\n envVars,\n clear,\n}: RunExpoExportOptions): Effect.Effect<\n void,\n BuildFailedError,\n CliRuntime | CommandExecutor.CommandExecutor\n> =>\n Effect.gen(function* () {\n const runtime = yield* CliRuntime;\n const commandEnv = yield* runtime.commandEnvironment(envVars);\n const args = [\n \"expo\",\n \"export\",\n \"--platform\",\n platform,\n \"--output-dir\",\n exportDir,\n \"--dump-assetmap\",\n ];\n if (clear) {\n args.push(\"--clear\");\n }\n\n return yield* runCommand(\n makeBunxCommand(...args).pipe(Command.workingDirectory(projectRoot), Command.env(commandEnv)),\n `expo export ${platform}`,\n );\n });\n\nexport const readExpoExportAssets = ({\n exportDir,\n platform,\n}: ReadExpoExportAssetsOptions): Effect.Effect<\n readonly ExportedUpdateAssetFile[],\n UpdatePublishError,\n FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const metadataPath = path.join(exportDir, \"metadata.json\");\n const metadataText = yield* fs.readFileString(metadataPath).pipe(\n Effect.mapError(\n () =>\n new UpdatePublishError({\n message: `Expected Expo export metadata at ${metadataPath}.`,\n }),\n ),\n );\n\n const metadata = yield* Effect.try({\n try: () => JSON.parse(metadataText) as unknown,\n catch: () =>\n new UpdatePublishError({\n message: `Failed to parse ${metadataPath} as JSON.`,\n }),\n });\n\n const platformMetadata = asRecord(asRecord(asRecord(metadata)?.[\"fileMetadata\"])?.[platform]);\n const bundlePath = asString(platformMetadata?.[\"bundle\"]);\n if (!bundlePath) {\n return yield* new UpdatePublishError({\n message: `Expo export did not contain a bundle path for platform \"${platform}\".`,\n });\n }\n\n const bundleExt = normalizeExtension(path.extname(bundlePath)) ?? \"js\";\n const rawAssets = Array.isArray(platformMetadata?.[\"assets\"]) ? platformMetadata[\"assets\"] : [];\n\n // eslint-disable-next-line unicorn/no-array-method-this-argument -- Effect.forEach, not Array.prototype.forEach; the second arg is a mapping effect, not a thisArg\n const assets = yield* Effect.forEach(rawAssets, (rawAsset, index) =>\n Effect.gen(function* () {\n const asset = asRecord(rawAsset);\n const assetPath = asString(asset?.[\"path\"]);\n if (!assetPath) {\n return yield* new UpdatePublishError({\n message: `Expo export asset #${String(index + 1)} is missing its \"path\" field.`,\n });\n }\n\n const fileExt =\n normalizeExtension(asString(asset?.[\"ext\"])) ??\n normalizeExtension(path.extname(assetPath)) ??\n \"bin\";\n\n return {\n path: path.join(exportDir, assetPath),\n key: path.posix.basename(assetPath),\n fileExt,\n contentType: inferContentType(fileExt, false),\n isLaunch: false,\n } as const satisfies ExportedUpdateAssetFile;\n }),\n );\n\n return [\n {\n path: path.join(exportDir, bundlePath),\n key: path.posix.basename(bundlePath),\n fileExt: bundleExt,\n contentType: inferContentType(bundleExt, true),\n isLaunch: true,\n } as const satisfies ExportedUpdateAssetFile,\n ...assets,\n ] as const;\n });\n","import { asRecord } from \"@better-update/type-guards\";\n\nimport type { Platform } from \"./build-profile\";\n\nexport type UpdatePlatformOption = Platform | \"all\";\n\nexport const resolveUpdatePlatforms = (\n appJson: Record<string, unknown>,\n requestedPlatform: UpdatePlatformOption,\n): readonly Platform[] => {\n if (requestedPlatform !== \"all\") {\n return [requestedPlatform] as const;\n }\n\n const expo = asRecord(appJson[\"expo\"]);\n return ([\"ios\", \"android\"] as const).filter(\n (platform) => asRecord(expo?.[platform]) !== undefined,\n );\n};\n","import { randomUUID } from \"node:crypto\";\nimport path from \"node:path\";\n\nimport { fromHex, toBase64Url } from \"@better-update/encoding\";\nimport { Effect } from \"effect\";\nimport { uniqBy } from \"es-toolkit\";\n\nimport type { CommandExecutor, FileSystem } from \"@effect/platform\";\n\nimport { readAppJson, readProjectId, readSlug } from \"../lib/app-json\";\nimport { readRuntimeVersionMeta } from \"../lib/build-profile\";\nimport { pullEnvVars } from \"../lib/env-exporter\";\nimport { UpdatePublishError } from \"../lib/exit-codes\";\nimport { readExpoExportAssets, readExpoPublicConfig, runExpoExport } from \"../lib/expo-export\";\nimport { formatCause } from \"../lib/format-error\";\nimport { readGitContext } from \"../lib/git-context\";\nimport { resolveRuntimeVersion } from \"../lib/runtime-version\";\nimport { sha256File, sha256Namespaced } from \"../lib/sha256\";\nimport { loadSignedPublishPayloads } from \"../lib/signed-payloads\";\nimport { acquireBuildTempDir } from \"../lib/temp-dir\";\nimport { resolveUpdatePlatforms } from \"../lib/update-platforms\";\nimport { apiClient } from \"../services/api-client\";\nimport { CliRuntime } from \"../services/cli-runtime\";\nimport { UpdateAssetUploader } from \"../services/update-asset-uploader\";\n\nimport type { Platform } from \"../lib/build-profile\";\nimport type {\n AuthRequiredError,\n BuildProfileError,\n BuildFailedError,\n ProjectNotLinkedError,\n EnvExportError,\n RuntimeVersionError,\n} from \"../lib/exit-codes\";\nimport type { SignedPayload } from \"../lib/signed-payloads\";\nimport type { ApiClientService } from \"../services/api-client\";\n\nexport interface RunUpdatePublishOptions {\n readonly branch: string | undefined;\n readonly platform: Platform | \"all\";\n readonly message: string | undefined;\n readonly auto: boolean;\n readonly environment: string;\n readonly clear: boolean;\n readonly rolloutPercentage: number | undefined;\n readonly manifestBodyFile: string | undefined;\n readonly signatureFile: string | undefined;\n readonly certificateChainFile: string | undefined;\n readonly manifestBodyFileIos: string | undefined;\n readonly signatureFileIos: string | undefined;\n readonly certificateChainFileIos: string | undefined;\n readonly manifestBodyFileAndroid: string | undefined;\n readonly signatureFileAndroid: string | undefined;\n readonly certificateChainFileAndroid: string | undefined;\n}\n\nexport interface PublishedPlatformResult {\n readonly platform: Platform;\n readonly updateId: string;\n readonly runtimeVersion: string;\n readonly uploadedAssets: number;\n readonly deduplicatedAssets: number;\n}\n\nexport interface PublishUpdatesResult {\n readonly groupId: string;\n readonly branch: string;\n readonly results: readonly PublishedPlatformResult[];\n}\n\ninterface PreparedAsset {\n readonly path: string;\n readonly key: string;\n readonly hash: string;\n readonly contentChecksum: string;\n readonly byteSize: number;\n readonly contentType: string;\n readonly fileExt: string;\n readonly isLaunch: boolean;\n}\n\nconst buildUpdateExtra = (\n expoClient: Record<string, unknown>,\n projectId: string,\n environment: string,\n) => ({\n expoClient,\n eas: { projectId },\n environment,\n});\n\nconst dedupeAssetsByHash = (assets: readonly PreparedAsset[]): readonly PreparedAsset[] =>\n uniqBy(assets, (asset) => asset.hash);\n\nconst preparePlatformAssets = ({\n exportDir,\n platform,\n}: {\n readonly exportDir: string;\n readonly platform: Platform;\n}): Effect.Effect<\n readonly PreparedAsset[],\n UpdatePublishError | BuildFailedError,\n FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const exportedAssets = yield* readExpoExportAssets({ exportDir, platform });\n return yield* Effect.forEach(\n exportedAssets,\n (asset) =>\n sha256File(asset.path).pipe(\n Effect.map(({ sha256: contentSha256Hex, byteSize }) => ({\n ...asset,\n hash: sha256Namespaced(asset.contentType, contentSha256Hex),\n contentChecksum: toBase64Url(fromHex(contentSha256Hex)),\n byteSize,\n })),\n ),\n { concurrency: 4 },\n );\n });\n\nconst publishPlatform = (params: {\n readonly projectRoot: string;\n readonly exportDir: string;\n readonly projectId: string;\n readonly slug: string;\n readonly branch: string;\n readonly groupId: string;\n readonly message: string;\n readonly environment: string;\n readonly environmentVars: Record<string, string>;\n readonly expoClientConfig: Record<string, unknown>;\n readonly clear: boolean;\n readonly appJson: Record<string, unknown>;\n readonly platform: Platform;\n readonly signedPayload: SignedPayload | null;\n readonly rolloutPercentage: number | undefined;\n}): Effect.Effect<\n PublishedPlatformResult,\n | AuthRequiredError\n | UpdatePublishError\n | BuildProfileError\n | BuildFailedError\n | RuntimeVersionError,\n | ApiClientService\n | CliRuntime\n | UpdateAssetUploader\n | CommandExecutor.CommandExecutor\n | FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const api = yield* apiClient;\n const assetUploader = yield* UpdateAssetUploader;\n\n const runtimeVersionMeta = yield* readRuntimeVersionMeta(params.appJson);\n const runtimeVersion = yield* resolveRuntimeVersion({\n raw: runtimeVersionMeta.rawRuntimeVersion,\n appVersion: runtimeVersionMeta.appVersion,\n projectRoot: params.projectRoot,\n });\n\n yield* runExpoExport({\n projectRoot: params.projectRoot,\n exportDir: params.exportDir,\n platform: params.platform,\n envVars: params.environmentVars,\n clear: params.clear,\n });\n\n const preparedAssets = yield* preparePlatformAssets({\n exportDir: params.exportDir,\n platform: params.platform,\n });\n const uniqueAssets = dedupeAssetsByHash(preparedAssets);\n\n const assetRegistration = yield* api.assets\n .upload({\n payload: {\n projectId: params.projectId,\n assets: uniqueAssets.map((asset) => ({\n hash: asset.hash,\n contentType: asset.contentType,\n fileExt: asset.fileExt,\n contentChecksum: asset.contentChecksum,\n })),\n },\n })\n .pipe(\n Effect.mapError(\n (cause) =>\n new UpdatePublishError({\n message: `Failed to register ${params.platform} assets: ${formatCause(cause)}`,\n }),\n ),\n );\n\n const uploadDetailsByHash = new Map(\n assetRegistration.uploaded.map((asset) => [asset.hash, asset] as const),\n );\n yield* Effect.forEach(\n uniqueAssets.filter((asset) => uploadDetailsByHash.has(asset.hash)),\n (asset) =>\n Effect.gen(function* () {\n const detail = uploadDetailsByHash.get(asset.hash);\n if (!detail) {\n return yield* Effect.fail(\n new UpdatePublishError({\n message: `Missing upload details for asset ${asset.hash}`,\n }),\n );\n }\n return yield* assetUploader.uploadAssetBinary({\n path: asset.path,\n hash: asset.hash,\n byteSize: asset.byteSize,\n uploadUrl: detail.uploadUrl,\n uploadExpiresAt: detail.uploadExpiresAt,\n uploadHeaders: detail.uploadHeaders,\n });\n }),\n { concurrency: 4 },\n );\n\n const update = yield* api.updates\n .create({\n payload: {\n branch: params.branch,\n slug: params.slug,\n runtimeVersion,\n platform: params.platform,\n message: params.message,\n groupId: params.groupId,\n metadata: {},\n extra: buildUpdateExtra(params.expoClientConfig, params.projectId, params.environment),\n assets: preparedAssets.map((asset) => ({\n hash: asset.hash,\n key: asset.key,\n isLaunch: asset.isLaunch,\n contentChecksum: asset.contentChecksum,\n })),\n ...(params.signedPayload\n ? {\n manifestBody: params.signedPayload.manifestBody,\n signature: params.signedPayload.signature,\n certificateChain: params.signedPayload.certificateChain,\n }\n : {}),\n ...(params.rolloutPercentage === undefined\n ? {}\n : { rolloutPercentage: params.rolloutPercentage }),\n },\n })\n .pipe(\n Effect.mapError(\n (cause) =>\n new UpdatePublishError({\n message: `Failed to publish ${params.platform} update: ${formatCause(cause)}`,\n }),\n ),\n );\n\n return {\n platform: params.platform,\n updateId: update.id,\n runtimeVersion,\n uploadedAssets: assetRegistration.uploaded.length,\n deduplicatedAssets: assetRegistration.deduplicated.length,\n } as const satisfies PublishedPlatformResult;\n });\n\nexport const runUpdatePublish = (\n options: RunUpdatePublishOptions,\n): Effect.Effect<\n PublishUpdatesResult,\n | AuthRequiredError\n | UpdatePublishError\n | ProjectNotLinkedError\n | BuildProfileError\n | RuntimeVersionError\n | EnvExportError\n | BuildFailedError,\n | ApiClientService\n | CliRuntime\n | UpdateAssetUploader\n | CommandExecutor.CommandExecutor\n | FileSystem.FileSystem\n> =>\n Effect.scoped(\n // eslint-disable-next-line eslint/max-statements -- update publish orchestration is inherently sequential (read config → resolve runtime version → expo export → register assets → publish per platform); splitting further fragments the pipeline without improving readability\n Effect.gen(function* () {\n const runtime = yield* CliRuntime;\n const projectRoot = yield* runtime.cwd;\n const api = yield* apiClient;\n\n const projectId = yield* readProjectId;\n const slug = yield* readSlug;\n const appJson = yield* readAppJson;\n const platforms = resolveUpdatePlatforms(appJson, options.platform);\n if (platforms.length === 0) {\n return yield* new UpdatePublishError({\n message:\n 'No publishable platforms found in app.json. Add an \"expo.ios\" or \"expo.android\" section, or pass --platform explicitly.',\n });\n }\n\n const environmentVars = yield* pullEnvVars(api, {\n projectId,\n environment: options.environment,\n });\n const expoClientConfig = yield* readExpoPublicConfig({\n projectRoot,\n envVars: environmentVars,\n });\n const tempDir = yield* acquireBuildTempDir.pipe(\n Effect.mapError(\n (cause) =>\n new UpdatePublishError({\n message: `Failed to create a temporary export directory: ${formatCause(cause)}`,\n }),\n ),\n );\n let resolvedBranch = options.branch;\n let resolvedMessage = options.message;\n\n if (options.auto) {\n const gitContext = yield* readGitContext(projectRoot);\n if (!resolvedBranch) {\n if (!gitContext.ref) {\n return yield* new UpdatePublishError({\n message:\n \"Cannot infer branch from git. Ensure you are in a git repo with a checked-out branch, or provide --branch explicitly.\",\n });\n }\n resolvedBranch = gitContext.ref;\n }\n if (!resolvedMessage && gitContext.commitMessage) {\n resolvedMessage = gitContext.commitMessage;\n }\n }\n\n if (!resolvedBranch) {\n return yield* new UpdatePublishError({\n message: \"Missing --branch. Provide it explicitly or use --auto to infer from git.\",\n });\n }\n\n const branch = resolvedBranch;\n const groupId = randomUUID();\n const message = resolvedMessage ?? \"Publish via better-update CLI\";\n const signedPayloads = yield* loadSignedPublishPayloads({\n platforms,\n globalFiles: {\n manifestBodyFile: options.manifestBodyFile,\n signatureFile: options.signatureFile,\n certificateChainFile: options.certificateChainFile,\n },\n platformFiles: {\n ios: {\n manifestBodyFile: options.manifestBodyFileIos,\n signatureFile: options.signatureFileIos,\n certificateChainFile: options.certificateChainFileIos,\n },\n android: {\n manifestBodyFile: options.manifestBodyFileAndroid,\n signatureFile: options.signatureFileAndroid,\n certificateChainFile: options.certificateChainFileAndroid,\n },\n },\n makeError: (errorMessage) => new UpdatePublishError({ message: errorMessage }),\n });\n const results = yield* Effect.forEach(\n platforms,\n (platform) =>\n publishPlatform({\n projectRoot,\n exportDir: path.join(tempDir, `export-${platform}`),\n projectId,\n slug,\n branch,\n groupId,\n message,\n environment: options.environment,\n environmentVars,\n expoClientConfig,\n clear: options.clear,\n appJson,\n platform,\n // eslint-disable-next-line eslint-js/no-restricted-syntax -- signedPayload absence means unsigned; null is correct downstream\n signedPayload: signedPayloads[platform] ?? null,\n rolloutPercentage: options.rolloutPercentage,\n }),\n { concurrency: 1 },\n );\n\n return {\n groupId,\n branch,\n results,\n } as const satisfies PublishUpdatesResult;\n }),\n );\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runUpdatePublish } from \"../../application/update-publish\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { parseRolloutPercentage } from \"../../lib/cli-schemas\";\nimport { printTable } from \"../../lib/output\";\n\nconst PUBLISH_EXIT_EXTRAS = {\n BuildProfileError: 2,\n RuntimeVersionError: 2,\n EnvExportError: 7,\n BuildFailedError: 6,\n UpdatePublishError: 7,\n} as const;\n\nexport const publishCommand = defineCommand({\n meta: { name: \"publish\", description: \"Publish a new OTA update group\" },\n args: {\n branch: { type: \"string\", description: \"Target branch name\" },\n platform: {\n type: \"enum\",\n options: [\"ios\", \"android\", \"all\"],\n default: \"all\",\n description: \"Platform(s) to publish\",\n },\n message: { type: \"string\", description: \"Optional update message\" },\n environment: { type: \"string\", default: \"production\", description: \"Env vars scope\" },\n auto: { type: \"boolean\", description: \"Skip prompts (for CI)\" },\n clear: { type: \"boolean\", description: \"Drop existing assets before upload\" },\n \"rollout-percentage\": { type: \"string\", description: \"Initial rollout percentage (1-100)\" },\n \"manifest-body-file\": { type: \"string\" },\n \"signature-file\": { type: \"string\" },\n \"certificate-chain-file\": { type: \"string\" },\n \"manifest-body-file-ios\": { type: \"string\" },\n \"signature-file-ios\": { type: \"string\" },\n \"certificate-chain-file-ios\": { type: \"string\" },\n \"manifest-body-file-android\": { type: \"string\" },\n \"signature-file-android\": { type: \"string\" },\n \"certificate-chain-file-android\": { type: \"string\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const rolloutPercentage = args[\"rollout-percentage\"]\n ? yield* parseRolloutPercentage(args[\"rollout-percentage\"], \"rollout-percentage\")\n : undefined;\n\n const result = yield* runUpdatePublish({\n branch: args.branch,\n platform: args.platform,\n message: args.message,\n auto: args.auto ?? false,\n environment: args.environment,\n clear: args.clear ?? false,\n rolloutPercentage,\n manifestBodyFile: args[\"manifest-body-file\"],\n signatureFile: args[\"signature-file\"],\n certificateChainFile: args[\"certificate-chain-file\"],\n manifestBodyFileIos: args[\"manifest-body-file-ios\"],\n signatureFileIos: args[\"signature-file-ios\"],\n certificateChainFileIos: args[\"certificate-chain-file-ios\"],\n manifestBodyFileAndroid: args[\"manifest-body-file-android\"],\n signatureFileAndroid: args[\"signature-file-android\"],\n certificateChainFileAndroid: args[\"certificate-chain-file-android\"],\n });\n\n yield* Console.log(\n `Published update group ${result.groupId} to branch \"${result.branch}\".`,\n );\n yield* Console.log(\"\");\n yield* printTable(\n [\"Platform\", \"Update ID\", \"Runtime Version\", \"Uploaded\", \"Reused\"],\n result.results.map((entry) => [\n entry.platform,\n entry.updateId,\n entry.runtimeVersion,\n String(entry.uploadedAssets),\n String(entry.deduplicatedAssets),\n ]),\n );\n }),\n PUBLISH_EXIT_EXTRAS,\n ),\n});\n","export const buildRollbackDirectiveBody = (commitTime: string): string =>\n JSON.stringify({\n type: \"rollBackToEmbedded\",\n parameters: {\n commitTime,\n },\n });\n","import { randomUUID } from \"node:crypto\";\n\nimport { buildRollbackDirectiveBody } from \"@better-update/expo-protocol\";\nimport { isRecord } from \"@better-update/type-guards\";\nimport { FileSystem } from \"@effect/platform\";\nimport { Effect } from \"effect\";\n\nimport type { CommandExecutor } from \"@effect/platform\";\n\nimport { readAppJson, readProjectId, readSlug } from \"../lib/app-json\";\nimport { readRuntimeVersionMeta } from \"../lib/build-profile\";\nimport { UpdateRollbackError } from \"../lib/exit-codes\";\nimport { formatCause } from \"../lib/format-error\";\nimport { resolveRuntimeVersion } from \"../lib/runtime-version\";\nimport { resolveUpdatePlatforms } from \"../lib/update-platforms\";\nimport { apiClient } from \"../services/api-client\";\nimport { CliRuntime } from \"../services/cli-runtime\";\n\nimport type { Platform } from \"../lib/build-profile\";\nimport type {\n AuthRequiredError,\n BuildProfileError,\n ProjectNotLinkedError,\n RuntimeVersionError,\n} from \"../lib/exit-codes\";\nimport type { UpdatePlatformOption } from \"../lib/update-platforms\";\nimport type { ApiClientService } from \"../services/api-client\";\n\ninterface CreateRollbackParams {\n readonly branch: string;\n readonly projectSlug: string;\n readonly runtimeVersion: string;\n readonly platform: Platform;\n readonly message: string;\n readonly groupId: string;\n readonly directiveBody: string;\n readonly signature: string | undefined;\n readonly certificateChain: string | undefined;\n}\n\nexport interface RollbackResultItem {\n readonly platform: Platform;\n readonly updateId: string;\n readonly runtimeVersion: string;\n}\n\nexport interface RunUpdateRollbackOptions {\n readonly branch: string;\n readonly platform: UpdatePlatformOption;\n readonly message: string | undefined;\n readonly commitTime: string | undefined;\n readonly directiveBodyFile: string | undefined;\n readonly signatureFile: string | undefined;\n readonly certificateChainFile: string | undefined;\n}\n\nexport interface UpdateRollbackResult {\n readonly groupId: string;\n readonly branch: string;\n readonly commitTime: string;\n readonly results: readonly RollbackResultItem[];\n}\n\ninterface SignedRollbackPayload {\n readonly directiveBody: string;\n readonly signature: string;\n readonly certificateChain: string;\n}\n\nconst resolveCommitTime = (input: string | undefined): Effect.Effect<string, UpdateRollbackError> =>\n Effect.gen(function* () {\n const commitTime = input ?? new Date().toISOString();\n if (Number.isNaN(Date.parse(commitTime))) {\n return yield* new UpdateRollbackError({\n message: \"commitTime must be a valid ISO 8601 timestamp.\",\n });\n }\n return commitTime;\n });\n\nconst extractDirectiveCommitTime = (\n directiveBody: string,\n): Effect.Effect<string, UpdateRollbackError> =>\n Effect.gen(function* () {\n const directive = yield* Effect.try({\n try: (): unknown => JSON.parse(directiveBody),\n catch: () =>\n new UpdateRollbackError({\n message: \"directiveBody must be valid JSON.\",\n }),\n });\n\n if (!isRecord(directive)) {\n return yield* new UpdateRollbackError({\n message: \"directiveBody must decode to a JSON object.\",\n });\n }\n\n if (directive[\"type\"] !== \"rollBackToEmbedded\") {\n return yield* new UpdateRollbackError({\n message: 'directiveBody.type must be \"rollBackToEmbedded\".',\n });\n }\n\n const { parameters } = directive;\n if (!isRecord(parameters)) {\n return yield* new UpdateRollbackError({\n message: \"directiveBody.parameters must be an object.\",\n });\n }\n\n const { commitTime } = parameters;\n if (typeof commitTime !== \"string\" || Number.isNaN(Date.parse(commitTime))) {\n return yield* new UpdateRollbackError({\n message: \"directiveBody.parameters.commitTime must be a valid ISO 8601 timestamp.\",\n });\n }\n\n return commitTime;\n });\n\nconst loadOptionalSignedRollbackPayload = (\n options: RunUpdateRollbackOptions,\n): Effect.Effect<SignedRollbackPayload | null, UpdateRollbackError, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fileSystem = yield* FileSystem.FileSystem;\n const hasAnySigningInput =\n options.directiveBodyFile !== undefined ||\n options.signatureFile !== undefined ||\n options.certificateChainFile !== undefined;\n\n if (!hasAnySigningInput) {\n return null;\n }\n\n if (!options.directiveBodyFile || !options.signatureFile || !options.certificateChainFile) {\n return yield* new UpdateRollbackError({\n message:\n \"Signed rollback requires --directive-body-file, --signature-file, and --certificate-chain-file together.\",\n });\n }\n\n const [directiveBody, signature, certificateChain] = yield* Effect.all(\n [\n fileSystem.readFileString(options.directiveBodyFile),\n fileSystem.readFileString(options.signatureFile),\n fileSystem.readFileString(options.certificateChainFile),\n ],\n { concurrency: \"unbounded\" },\n ).pipe(\n Effect.mapError(\n (cause) =>\n new UpdateRollbackError({\n message: `Failed to read signed rollback inputs: ${formatCause(cause)}`,\n }),\n ),\n );\n\n return {\n directiveBody,\n signature: signature.trim(),\n certificateChain: certificateChain.trimEnd(),\n } satisfies SignedRollbackPayload;\n });\n\nconst createRollbackForPlatform = (\n params: CreateRollbackParams,\n): Effect.Effect<RollbackResultItem, AuthRequiredError | UpdateRollbackError, ApiClientService> =>\n Effect.gen(function* () {\n const api = yield* apiClient;\n const update = yield* api.updates\n .create({\n payload: {\n branch: params.branch,\n slug: params.projectSlug,\n runtimeVersion: params.runtimeVersion,\n platform: params.platform,\n message: params.message,\n groupId: params.groupId,\n metadata: {},\n assets: [],\n isRollback: true,\n directiveBody: params.directiveBody,\n ...(params.signature ? { signature: params.signature } : {}),\n ...(params.certificateChain ? { certificateChain: params.certificateChain } : {}),\n },\n })\n .pipe(\n Effect.mapError(\n (cause) =>\n new UpdateRollbackError({\n message: `Failed to create ${params.platform} rollback: ${formatCause(cause)}`,\n }),\n ),\n );\n\n return {\n platform: params.platform,\n updateId: update.id,\n runtimeVersion: params.runtimeVersion,\n } as const satisfies RollbackResultItem;\n });\n\nexport const runUpdateRollback = (\n options: RunUpdateRollbackOptions,\n): Effect.Effect<\n UpdateRollbackResult,\n | AuthRequiredError\n | ProjectNotLinkedError\n | BuildProfileError\n | RuntimeVersionError\n | UpdateRollbackError,\n ApiClientService | CliRuntime | CommandExecutor.CommandExecutor | FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const runtime = yield* CliRuntime;\n const projectRoot = yield* runtime.cwd;\n yield* readProjectId;\n const projectSlug = yield* readSlug;\n const appJson = yield* readAppJson;\n const platforms = resolveUpdatePlatforms(appJson, options.platform);\n if (platforms.length === 0) {\n return yield* new UpdateRollbackError({\n message:\n 'No publishable platforms found in app.json. Add an \"expo.ios\" or \"expo.android\" section, or pass --platform explicitly.',\n });\n }\n\n const { appVersion, rawRuntimeVersion } = yield* readRuntimeVersionMeta(appJson);\n const runtimeVersion = yield* resolveRuntimeVersion({\n raw: rawRuntimeVersion,\n appVersion,\n projectRoot,\n });\n const signedPayload = yield* loadOptionalSignedRollbackPayload(options);\n const commitTime = signedPayload\n ? yield* Effect.gen(function* () {\n const directiveCommitTime = yield* extractDirectiveCommitTime(\n signedPayload.directiveBody,\n );\n if (options.commitTime && options.commitTime !== directiveCommitTime) {\n return yield* new UpdateRollbackError({\n message: \"commitTime must match directiveBody.parameters.commitTime in signed mode.\",\n });\n }\n return directiveCommitTime;\n })\n : yield* resolveCommitTime(options.commitTime);\n const groupId = randomUUID();\n const message = options.message ?? \"Rollback to embedded via better-update CLI\";\n\n const results = yield* Effect.forEach(\n platforms,\n (platform) =>\n createRollbackForPlatform({\n branch: options.branch,\n projectSlug,\n runtimeVersion,\n platform,\n message,\n groupId,\n directiveBody: signedPayload?.directiveBody ?? buildRollbackDirectiveBody(commitTime),\n signature: signedPayload?.signature,\n certificateChain: signedPayload?.certificateChain,\n }),\n { concurrency: 1 },\n );\n\n return {\n groupId,\n branch: options.branch,\n commitTime,\n results,\n } as const satisfies UpdateRollbackResult;\n });\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runUpdateRollback } from \"../../application/update-rollback\";\nimport { runEffect } from \"../../lib/citty-effect\";\nimport { printTable } from \"../../lib/output\";\nimport { updateErrorExtras } from \"./helpers\";\n\nexport const rollbackCommand = defineCommand({\n meta: { name: \"rollback\", description: \"Roll back updates on a branch\" },\n args: {\n branch: { type: \"string\", required: true, description: \"Branch to roll back\" },\n platform: {\n type: \"enum\",\n options: [\"ios\", \"android\", \"all\"],\n default: \"all\",\n description: \"Platform(s) to roll back\",\n },\n message: { type: \"string\" },\n \"commit-time\": { type: \"string\" },\n \"directive-body-file\": { type: \"string\" },\n \"signature-file\": { type: \"string\" },\n \"certificate-chain-file\": { type: \"string\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const result = yield* runUpdateRollback({\n branch: args.branch,\n platform: args.platform,\n message: args.message,\n commitTime: args[\"commit-time\"],\n directiveBodyFile: args[\"directive-body-file\"],\n signatureFile: args[\"signature-file\"],\n certificateChainFile: args[\"certificate-chain-file\"],\n });\n\n yield* Console.log(\n `Created rollback group ${result.groupId} on branch \"${result.branch}\" at ${result.commitTime}.`,\n );\n yield* Console.log(\"\");\n yield* printTable(\n [\"Platform\", \"Update ID\", \"Runtime Version\"],\n result.results.map((entry) => [entry.platform, entry.updateId, entry.runtimeVersion]),\n );\n }),\n updateErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../../lib/citty-effect\";\nimport { apiClient } from \"../../../services/api-client\";\nimport { updateErrorExtras } from \"../helpers\";\n\nexport const completeCommand = defineCommand({\n meta: { name: \"complete\", description: \"Complete the rollout for an update\" },\n args: {\n updateId: { type: \"positional\", required: true, description: \"Update ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const result = yield* api.updates.completeRollout({ path: { id: args.updateId } });\n yield* Console.log(\n `Completed rollout for ${args.updateId}. Current rollout is ${String(result.rolloutPercentage)}%.`,\n );\n }),\n updateErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../../lib/citty-effect\";\nimport { apiClient } from \"../../../services/api-client\";\nimport { updateErrorExtras } from \"../helpers\";\n\nexport const revertCommand = defineCommand({\n meta: { name: \"revert\", description: \"Revert the rollout for an update\" },\n args: {\n updateId: { type: \"positional\", required: true, description: \"Update ID\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const api = yield* apiClient;\n const result = yield* api.updates.revertRollout({ path: { id: args.updateId } });\n yield* Console.log(\n `Reverted rollout for ${args.updateId}. Current rollout is ${String(result.rolloutPercentage)}%.`,\n );\n }),\n updateErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\nimport { Console, Effect } from \"effect\";\n\nimport { runEffect } from \"../../../lib/citty-effect\";\nimport { parseRolloutPercentage } from \"../../../lib/cli-schemas\";\nimport { apiClient } from \"../../../services/api-client\";\nimport { updateErrorExtras } from \"../helpers\";\n\nexport const setCommand = defineCommand({\n meta: { name: \"set\", description: \"Set the rollout percentage for an update\" },\n args: {\n updateId: { type: \"positional\", required: true, description: \"Update ID\" },\n percentage: { type: \"string\", required: true, description: \"Rollout percentage (1-100)\" },\n },\n run: async ({ args }) =>\n runEffect(\n Effect.gen(function* () {\n const percentage = yield* parseRolloutPercentage(args.percentage, \"percentage\");\n const api = yield* apiClient;\n const result = yield* api.updates.editRollout({\n path: { id: args.updateId },\n payload: { percentage },\n });\n\n yield* Console.log(\n `Updated rollout for ${args.updateId} to ${String(result.rolloutPercentage)}%.`,\n );\n }),\n updateErrorExtras,\n ),\n});\n","import { defineCommand } from \"citty\";\n\nimport { completeCommand } from \"./complete\";\nimport { revertCommand } from \"./revert\";\nimport { setCommand } from \"./set\";\n\nexport const rolloutCommand = defineCommand({\n meta: { name: \"rollout\", description: \"Manage per-update rollouts\" },\n subCommands: {\n set: setCommand,\n complete: completeCommand,\n revert: revertCommand,\n },\n});\n","import { defineCommand } from \"citty\";\n\nimport { deleteCommand } from \"./delete\";\nimport { listCommand } from \"./list\";\nimport { promoteCommand } from \"./promote\";\nimport { publishCommand } from \"./publish\";\nimport { rollbackCommand } from \"./rollback\";\nimport { rolloutCommand } from \"./rollout\";\n\nexport const updateCommand = defineCommand({\n meta: { name: \"update\", description: \"Manage OTA updates\" },\n subCommands: {\n publish: publishCommand,\n list: listCommand,\n delete: deleteCommand,\n promote: promoteCommand,\n rollback: rollbackCommand,\n rollout: rolloutCommand,\n },\n});\n","#!/usr/bin/env node\n\nimport { defineCommand, runMain } from \"citty\";\n\nimport pkg from \"../package.json\" with { type: \"json\" };\nimport { analyticsCommand } from \"./commands/analytics\";\nimport { auditLogsCommand } from \"./commands/audit-logs\";\nimport { branchesCommand } from \"./commands/branches\";\nimport { buildCommand } from \"./commands/build\";\nimport { buildsCommand } from \"./commands/builds\";\nimport { channelsCommand } from \"./commands/channels\";\nimport { credentialsCommand } from \"./commands/credentials\";\nimport { envCommand } from \"./commands/env\";\nimport { fingerprintCommand } from \"./commands/fingerprint\";\nimport { initCommand } from \"./commands/init\";\nimport { loginCommand } from \"./commands/login\";\nimport { logoutCommand } from \"./commands/logout\";\nimport { projectsCommand } from \"./commands/projects\";\nimport { statusCommand } from \"./commands/status\";\nimport { updateCommand } from \"./commands/update\";\n\nconst main = defineCommand({\n meta: {\n name: \"better-update\",\n version: pkg.version,\n description: \"Publish OTA updates and builds for Expo apps\",\n },\n subCommands: {\n login: loginCommand,\n logout: logoutCommand,\n init: initCommand,\n status: statusCommand,\n projects: projectsCommand,\n branches: branchesCommand,\n channels: channelsCommand,\n build: buildCommand,\n builds: buildsCommand,\n credentials: credentialsCommand,\n env: envCommand,\n fingerprint: fingerprintCommand,\n update: updateCommand,\n analytics: analyticsCommand,\n \"audit-logs\": auditLogsCommand,\n },\n});\n\nawait runMain(main);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA,MAAa,YAAY,UACvB,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,MAAM;AAEtE,MAAa,YAAY,UACvB,SAAS,MAAM,GAAG,QAAQ;;;;ACA5B,IAAa,oBAAb,cAAuC,KAAK,YAAY,oBAAoB,CAEzE;AAEH,IAAa,wBAAb,cAA2C,KAAK,YAAY,wBAAwB,CAEjF;AAEH,IAAa,oBAAb,cAAuC,KAAK,YAAY,oBAAoB,CAEzE;AAEH,IAAa,oBAAb,cAAuC,K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