@capgo/cli 8.81.0 → 8.82.0
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/src/sdk.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as yC0}from"node:module";var module={exports:{}};var PC0=Object.create;var{getPrototypeOf:SC0,defineProperty:tG,getOwnPropertyNames:$m}=Object;var QR=Object.prototype.hasOwnProperty;function XR($){return this[$]}var V0=($,D,Q)=>{var X=$m(D);for(let J of X)if(!QR.call($,J)&&J!=="default")tG($,J,{get:XR.bind(D,J),enumerable:!0});if(Q){for(let J of X)if(!QR.call(Q,J)&&J!=="default")tG(Q,J,{get:XR.bind(D,J),enumerable:!0});return Q}},_C0,vC0,f$=($,D,Q)=>{var X=$!=null&&typeof $==="object";if(X){var J=D?_C0??=new WeakMap:vC0??=new WeakMap,Y=J.get($);if(Y)return Y}Q=$!=null?PC0(SC0($)):{};let Z=D||!$||!$.__esModule?tG(Q,"default",{value:$,enumerable:!0}):Q;for(let F of $m($))if(!QR.call(Z,F))tG(Z,F,{get:XR.bind($,F),enumerable:!0});if(X)J.set($,Z);return Z};var E=($,D)=>()=>(D||$((D={exports:{}}).exports,D),D.exports);var xC0=($)=>$;function kC0($,D){this[$]=xC0.bind(null,D)}var VD=($,D)=>{for(var Q in D)tG($,Q,{get:D[Q],enumerable:!0,configurable:!0,set:kC0.bind(D,Q)})};var r=($,D)=>()=>($&&(D=$($=0)),D);var X0=yC0(import.meta.url);var Q6;var E8=r(()=>{Q6={name:"@capgo/cli",type:"module",version:"8.81.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/capgo/tree/main/cli#readme",repository:{type:"git",url:"https://github.com/Cap-go/capgo.app",directory:"cli"},bugs:{url:"https://github.com/Cap-go/capgo/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"bunx --bun supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsgo --project tsconfig.tsgo.json --noEmit",lint:"bun run lint:ox","lint:ox":"oxlint --config ../.oxlintrc.json src","lint:fix":"oxlint --config ../.oxlintrc.json --fix src","check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:notify-app-ready-background":"bun test ./test/test-notify-app-ready-background.mjs ./test/test-background-check-shutdown.mjs","test:bundle":"bun test/test-bundle.mjs","test:bundle-validation":"bun test test/bundle/","test:prescan":"bun test test/prescan/","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:fail-on-incompatible":"bun test/test-fail-on-incompatible.mjs","test:native-dependencies":"bun test/test-native-dependencies.mjs && bun test/test-get-remote-dependencies.mjs","test:package-json-guard":"bun test/test-package-json-guard.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-export":"bun test/test-credentials-export.mjs","test:asc-key-protocol":"bun test/test-asc-key-protocol.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:android-service-account-validation":"bun test/test-android-service-account-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:build-needed":"bun test/test-build-needed.mjs","test:cli-help":"bun test/test-cli-help.mjs","test:build-cache-payload":"bun test/test-build-cache-payload.mjs","test:build-cancellation":"bun test/test-build-cancellation.mjs","test:ci-prompts":"bun test/test-ci-prompts.mjs","test:capgo-app-id-prompt":"bun test/test-capgo-app-id-prompt.mjs","test:ci-secrets":"bun test/test-ci-secrets.mjs","test:android-onboarding-progress":"bun test/test-android-onboarding-progress.mjs && bun test/test-android-select-guard.mjs","test:android-keystore-action":"bun test/test-android-keystore-action.mjs","test:android-google-play-action":"bun test/test-android-google-play-action.mjs","test:onboarding-telemetry":"bun test/test-onboarding-telemetry.mjs","test:v2-event-migration":"bun test/test-v2-event-migration.mjs","test:analytics":"bun test/test-analytics.mjs","test:cli-headers":"bun test/test-cli-headers.mjs","test:min-cli-version":"bun test/test-min-cli-version.mjs","test:authenticated-command-invocation":"bun test/test-authenticated-command-invocation.mjs","test:analytics-error-category":"bun test/test-analytics-error-category.mjs","test:analytics-org-resolver":"bun test/test-analytics-org-resolver.mjs","test:supabase-perf":"bun test/test-supabase-perf.mjs","test:preview-qr":"bun test/test-preview-qr.mjs","test:bundle-pages":"bun test test/test-bundle-pages.test.ts","test:mcp-analytics":"bun test/test-mcp-analytics.mjs","test:mcp-instructions":"bun test/test-mcp-instructions.mjs","test:mcp-stdout-guard":"bun test/test-mcp-stdout-guard.mjs","test:mcp-platform-select":"bun test/test-mcp-platform-select.mjs","test:mcp-explain-scopes":"bun test/test-mcp-explain-scopes.mjs","test:mcp-oauth-reopen":"bun test/test-mcp-oauth-reopen.mjs","test:mcp-broker-oauth":"bun test/test-mcp-broker-oauth.mjs","test:mcp-broker-session":"bun test/test-mcp-broker-session.mjs","test:mcp-credentials-manage":"bun test/test-mcp-credentials-manage.mjs","test:mcp-resume-prompt":"bun test/test-mcp-resume-prompt.mjs","test:mcp-build-job":"bun test/test-mcp-build-job.mjs","test:mcp-build-tools":"bun test/test-mcp-build-tools.mjs","test:app-created-source":"bun test/test-app-created-source.mjs","test:app-add-exists":"bun test/test-app-add-exists.mjs","test:app-add-getting-started":"bun test/test-app-add-getting-started.mjs","test:app-list-output-text":"bun test/test-app-list-output-text.mjs","test:app-todo":"bun test/test-app-todo.mjs","test:doctor-analytics":"bun test/test-doctor-analytics.mjs","test:posthog-exception":"bun test/test-posthog-exception.mjs","test:cli-recovery":"bun test/test-cli-recovery.mjs","test:create-supabase-client":"bun test/test-create-supabase-client.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.mjs","test:onboarding-progress":"bun test/test-onboarding-progress.mjs","test:onboarding-run-targets":"bun test/test-onboarding-run-targets.mjs","test:run-device-command":"bun test/test-run-device-command.mjs","test:init-app-conflict":"bun test/test-init-app-conflict.mjs","test:channel-add-exists":"bun test/test-channel-add-exists.mjs","test:wait-log":"bun test/test-wait-log.mjs","test:init-guardrails":"bun test/test-init-guardrails.mjs","test:init-upload-recovery":"bun test/test-init-upload-error-gate.mjs && bun test/test-init-upload-monorepo-recovery.mjs","test:init-replay":"bun test/test-init-replay.mjs","test:init-telemetry":"bun test/test-init-telemetry.mjs","test:capacitor-config-target":"bun test/test-capacitor-config-target.mjs","test:builder-app-id-config":"bun test/test-builder-app-id-config.mjs","test:capacitor-config-typescript7":"bun test/test-capacitor-config-typescript7.mjs","test:capacitor-config-native-import":"bun test/test-capacitor-config-native-import.mjs","test:cli-user-error-config":"bun test/test-cli-user-error-config.mjs","test:cordova-upload-mode":"bun test/test-cordova-upload-mode.mjs","test:init-monorepo-targeting":"bun run test:capacitor-config-target && bun run test:builder-app-id-config && bun run test:capacitor-config-typescript7 && bun run test:capacitor-config-native-import && bun run test:cli-user-error-config && bun test/test-init-monorepo-targeting.mjs","test:prompt-preferences":"bun test/test-prompt-preferences.mjs","test:esm-sdk":"node test/test-sdk-esm.mjs","test:auth-session":"bun test/test-auth-session.mjs","test:mcp":"node test/test-mcp.mjs","test:mcp-no-key-handshake":"node test/test-mcp-no-key-handshake.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh","test:platform-paths":"bun test/test-platform-paths.mjs","test:project-type-detection":"bun test/test-project-type-detection.mjs","test:payload-split":"bun test/test-payload-split.mjs","test:macos-signing":"bun test/test-macos-signing.mjs","test:helper-dce":"bash scripts/check-helper-dce.sh","test:apple-api-import-helpers":"bun test/test-apple-api-import-helpers.mjs","test:apple-api-verify-key":"bun test/test-apple-api-verify-key.mjs","test:bundle-id-detector":"bun test/test-bundle-id-detector.mjs","test:apple-api-app-list":"bun test/test-apple-api-app-list.mjs","test:apple-api-cert-create":"bun test/test-apple-api-cert-create.mjs","test:app-verification":"bun test/test-app-verification.mjs","test:pbxproj-parser":"bun test/test-pbxproj-parser.mjs","test:self-update":"bun test/test-self-update.mjs","test:update-prompt":"bun test/test-update-prompt.mjs","test:android-tail-engine":"bun test/test-android-tail-engine.mjs","test:android-tail-render":"bun test/test-android-tail-render.mjs","test:android-tail-routing":"bun test/test-android-tail-routing.mjs","test:dev-gate-stripped":"bun test/test-dev-gate-stripped.mjs","test:frame-fit-ios-shared":"bun test/test-frame-fit-ios-shared.mjs","test:ios-confirm-app-id":"bun test/test-ios-confirm-app-id.mjs","test:ios-create-new":"bun test/test-ios-create-new.mjs","test:ios-certificate-action":"bun test/test-ios-certificate-action.mjs","test:ios-profile-action":"bun test/test-ios-profile-action.mjs","test:ios-credential-action":"bun test/test-ios-credential-action.mjs","test:ios-e2e":"bun test/test-ios-e2e.mjs","test:ios-flow-contract":"bun test/test-ios-flow-contract.mjs","test:ios-import-discovery":"bun test/test-ios-import-discovery.mjs","test:ios-import-export":"bun test/test-ios-import-export.mjs","test:ios-import-pickers":"bun test/test-ios-import-pickers.mjs","test:ios-import-recovery":"bun test/test-ios-import-recovery.mjs","test:ios-recovery":"bun test/test-ios-recovery.mjs","test:ios-resume":"bun test/test-ios-resume.mjs","test:ios-tail-handoff":"bun test/test-ios-tail-handoff.mjs","test:ios-tui-render":"bun test/test-ios-tui-render.mjs","test:p8-error":"bun test/test-p8-error.mjs","test:ios-tui-routing":"bun test/test-ios-tui-routing.mjs","test:ios-updater-sync-validation":"bun test/test-ios-updater-sync-validation.mjs","test:ios-verify-app":"bun test/test-ios-verify-app.mjs","test:ios-marketing-version":"bun test/test-ios-marketing-version.mjs","test:android-version":"bun test/test-android-version.mjs","test:platform-flow-contract":"bun test/test-platform-flow-contract.mjs","test:tail-engine-shared":"bun test/test-tail-engine-shared.mjs",test:"bun run build && bun scripts/run-test-suite.ts","test:run":"bun scripts/run-test-suite.ts","test:serial":"bun run build && bun scripts/run-test-suite.ts --serial","test:suite":"bun run test:helper-dce && bun run test:version-detection:setup && bun run test:bundle && bun run test:notify-app-ready-background && bun run test:bundle-validation && bun run test:functional && bun run test:semver && bun run test:auto-bump-version && bun run test:auto-bump-ai-diff && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:cordova-upload-mode && bun run test:fail-on-incompatible && bun run test:native-dependencies && bun run test:package-json-guard && bun run test:credentials && bun run test:credentials-export && bun run test:ios-provisioning-map && bun run test:ios-provisioning-command && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:cli-help && bun run test:build-cache-payload && bun run test:build-cancellation && bun run test:ci-prompts && bun run test:capgo-app-id-prompt && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:android-keystore-action && bun run test:android-google-play-action && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:analytics && bun run test:cli-headers && bun run test:min-cli-version && bun run test:authenticated-command-invocation && bun run test:analytics-error-category && bun run test:analytics-org-resolver && bun run test:supabase-perf && bun run test:preview-qr && bun run test:bundle-pages && bun run test:app-set-options && bun run test:mcp-analytics && bun run test:mcp-instructions && bun run test:mcp-live-update-onboarding && bun run test:mcp-stdout-guard && bun run test:mcp-platform-select && bun run test:mcp-explain-scopes && bun run test:mcp-oauth-reopen && bun run test:mcp-broker-oauth && bun run test:mcp-broker-session && bun run test:mcp-credentials-manage && bun run test:mcp-resume-prompt && bun run test:mcp-build-job && bun run test:mcp-build-tools && bun run test:app-created-source && bun run test:app-add-exists && bun run test:app-add-getting-started && bun run test:app-list-output-text && bun run test:app-todo && bun run test:doctor-analytics && bun run test:posthog-exception && bun run test:cli-recovery && bun run test:create-supabase-client && bun run test:build-platform-selection && bun run test:builder-project-discovery && bun run test:builder-app-selection && bun run test:builder-login-gate && bun run test:onboarding-recovery && bun run test:onboarding-progress && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-monorepo-targeting && bun run test:init-app-conflict && bun run test:channel-list && bun run test:channel-add-exists && bun run test:wait-log && bun run test:init-guardrails && bun run test:init-upload-recovery && bun run test:init-replay && bun run test:init-telemetry && bun run test:prompt-preferences && bun run test:esm-sdk && bun run test:mcp && bun run test:mcp-no-key-handshake && bun run test:auth-session && bun run test:version-detection && bun run test:platform-paths && bun run test:project-type-detection && bun run test:payload-split && bun run test:macos-signing && bun run test:asc-key-protocol && bun run test:apple-api-import-helpers && bun run test:apple-api-verify-key && bun run test:bundle-id-detector && bun run test:apple-api-app-list && bun run test:app-verification && bun run test:pbxproj-parser && bun run test:ai-log-capture && bun run test:ai-analyze-flow && bun run test:cicd-failure-help && bun run test:ai-sse-parser && bun run test:ai-render-markdown && bun run test:ai-stream-markdown && bun run test:ai-onboarding-mode && bun run test:ai-fit && bun run test:platform-layout && bun run test:frame-fit && bun run test:onboarding-min-size && bun run test:min-size-gate && bun run test:shell-size-gate && bun run test:build-log-sanitize && bun run test:build-output-viewport && bun run test:diff-viewer-viewport && bun run test:build-complete-exit && bun run test:ai-analyze-stream && bun run test:support-mailto && bun run test:support-redact && bun run test:support-internal-log && bun run test:support-help-menu && bun run test:support-contact && bun run test:support-upload-prompt && bun run test:support-bundle-files && bun run test:self-update && bun run test:update-prompt && bun run test:apple-api-cert-create && bun run test:android-tail-engine && bun run test:android-tail-render && bun run test:android-tail-routing && bun run test:dev-gate-stripped && bun run test:frame-fit-ios-shared && bun run test:ios-confirm-app-id && bun run test:ios-create-new && bun run test:ios-certificate-action && bun run test:ios-profile-action && bun run test:ios-credential-action && bun run test:ios-e2e && bun run test:ios-flow-contract && bun run test:ios-import-discovery && bun run test:ios-import-export && bun run test:ios-import-pickers && bun run test:ios-import-recovery && bun run test:ios-recovery && bun run test:ios-resume && bun run test:ios-tail-handoff && bun run test:ios-tui-render && bun run test:p8-error && bun run test:ios-tui-routing && bun run test:ios-updater-sync-validation && bun run test:ios-verify-app && bun run test:ios-marketing-version && bun run test:android-version && bun run test:platform-flow-contract && bun run test:tail-engine-shared && bun run test:prescan && bun run test:android-reporting-api && bun run test:android-gcp && bun run test:android-app-verification && bun run test:android-rename && bun run test:appflow-auth && bun run test:appflow-api-map && bun run test:appflow-validate && bun run test:appflow-flow && bun run test:appflow-gapfill && bun run test:appflow-engine && bun run test:appflow-tail && bun run test:appflow-fetch && bun run test:appflow-sa-decode && bun run test:app-permission-helper && bun run test:2fa-compliance-network && bun run test:organization-set-api-host && bun run test:trial-warning && bun run test:plan-validation","test:build-platform-selection":"bun test/test-build-platform-selection.mjs","test:builder-project-discovery":"bun test/test-builder-project-discovery.mjs","test:builder-app-selection":"bun test/test-builder-app-selection.mjs","test:builder-login-gate":"bun test/test-builder-login-gate.mjs","test:ai-log-capture":"bun test/test-ai-log-capture.mjs","test:ai-analyze-flow":"bun test/test-ai-analyze-flow.mjs","test:cicd-failure-help":"bun test/test-cicd-failure-help.mjs","test:ai-analyze-stream":"bun test/test-ai-analyze-stream.mjs","test:ai-sse-parser":"bun test/test-ai-sse-parser.mjs","test:ai-render-markdown":"bun test/test-ai-render-markdown.mjs","test:ai-onboarding-mode":"bun test/test-ai-onboarding-mode.mjs","test:ai-fit":"bun test/test-ai-fit.mjs","test:platform-layout":"bun test/test-platform-layout.mjs","test:frame-fit":"bun test/run-frame-fit.mjs","test:onboarding-min-size":"bun test/test-onboarding-min-size.mjs","test:min-size-gate":"bun test/test-min-size-gate.mjs","test:shell-size-gate":"bun test/test-shell-size-gate.mjs","test:build-log-sanitize":"bun test/test-build-log-sanitize.mjs","test:build-output-viewport":"bun test/test-build-output-viewport.mjs","test:diff-viewer-viewport":"bun test/test-diff-viewer-viewport.mjs","test:build-complete-exit":"bun test/test-build-complete-exit.mjs","test:ai-stream-markdown":"bun test/test-ai-stream-markdown.mjs","test:support-mailto":"bun test/test-support-mailto.mjs","test:support-redact":"bun test/test-support-redact.mjs","test:support-internal-log":"bun test/test-support-internal-log.mjs","test:support-help-menu":"bun test/test-support-help-menu.mjs","test:support-contact":"bun test/test-support-contact.mjs","test:support-upload-prompt":"bun test/test-support-upload-prompt.mjs","test:support-bundle-files":"bun test/test-support-bundle-files.mjs","test:mcp-live-update-onboarding":"bun test/test-mcp-live-update-onboarding.mjs","test:app-set-options":"bun test/test-app-set-options.mjs && bun test/test-app-list-options.mjs","test:android-reporting-api":"bun test/test-android-reporting-api.mjs","test:android-gcp":"bun test/test-android-gcp.mjs","test:android-app-verification":"bun test/test-android-app-verification.mjs","test:android-rename":"bun test/test-android-rename.mjs","test:appflow-auth":"bun test/test-appflow-auth.mjs","test:appflow-api-map":"bun test/test-appflow-api-map.mjs","test:appflow-validate":"bun test/test-appflow-validate.mjs","test:appflow-flow":"bun test/test-appflow-flow.mjs","test:appflow-gapfill":"bun test/test-appflow-gapfill.mjs","test:appflow-engine":"bun test/test-appflow-engine.mjs","test:appflow-tail":"bun test/test-appflow-tail.mjs","test:appflow-fetch":"bun test/test-appflow-fetch.mjs","test:appflow-sa-decode":"bun test/test-appflow-sa-decode.mjs","test:app-permission-helper":"bun test/test-app-permission-helper.mjs","test:2fa-compliance-network":"bun test/test-2fa-compliance-network.mjs","test:organization-set-api-host":"bun test/test-organization-set-api-host.mjs","test:trial-warning":"bun test/test-trial-warning.mjs","test:plan-validation":"bun test/test-plan-validation.mjs","test:auto-bump-version":"bun test/test-auto-bump-version.mjs","test:auto-bump-ai-diff":"bun test/test-auto-bump-ai-diff.mjs","test:ios-provisioning-map":"bun test/test-ios-provisioning-map.mjs","test:ios-provisioning-command":"bun test/test-ios-provisioning-command.mjs","test:channel-list":"bun test/test-channel-list.mjs"},dependencies:{"@inkjs/ui":"^2.0.0","@manypkg/tools":"^2.1.2","@rrweb/types":"^2.1.1","@standard-schema/spec":"^1.1.0","@xmldom/xmldom":"^0.9.10","@xterm/addon-serialize":"^0.14.0","@xterm/headless":"^6.0.0","agent-cli-detector":"^0.1.6","happy-dom":"^20.11.0",ink:"^7.1.1","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.4.0",qrcode:"^1.5.4",react:"^19.2.8","rrweb-snapshot":"^2.1.1","string-width":"^8.2.2",typescript:"6.0.3",zod:"^4.5.4"},optionalDependencies:{"@capgo/cli-helper-darwin-arm64":"^1.1.1","@capgo/cli-helper-darwin-x64":"^1.1.1","node-pty":"^1.1.0"},devDependencies:{"@antfu/eslint-config":"^9.2.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.6","@capacitor/cli":"^8.4.2","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.7.0","@modelcontextprotocol/client":"^2.0.0-beta.5","@modelcontextprotocol/server":"^2.0.0-beta.5","@sauber/table":"npm:@jsr/sauber__table","@sinonjs/fake-timers":"15.4.0","@std/semver":"npm:@jsr/std__semver@1.0.8","@supabase/supabase-js":"^2.110.8","@tanstack/intent":"^0.3.6","@types/adm-zip":"^0.5.8","@types/jsonwebtoken":"^9.0.10","@types/node":"^26.1.1","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/qrcode":"^1.5.6","@types/react":"^19.2.17","@types/tmp":"^0.2.6","@types/ws":"^8.18.1","@typescript/native-preview":"7.0.0-dev.20260707.2","@vercel/ncc":"^0.44.1","@vue/compiler-dom":"3.5.40","@xterm/headless":"^6.0.0","adm-zip":"^0.6.0","ci-info":"^4.4.0",commander:"^15.0.0",eslint:"^10.7.0","git-format-staged":"4.0.2",husky:"^9.1.7","is-wsl":"^3.1.1",micromatch:"^4.0.8",open:"^11.0.0",oxlint:"^1.75.0",partysocket:"^1.3.0",prettyjson:"^1.2.5",tmp:"^0.2.7","tus-js-client":"^4.3.1",ws:"^8.21.1"}}});var Z0;var w$=r(()=>{Z0=class Z0 extends Error{context;constructor($,D){super($);this.name="CliUserError",this.context=D}}});import{platform as uC0}from"node:os";import{version as bC0}from"node:process";function mC0($){for(let D=0;D<$.length;D++)if($.charCodeAt(D)>255)return!1;return!0}function Dm($){if($.toLowerCase()==="x-capgo-log-token")return"Build log token is missing. Re-run the build command or pass a valid log token.";return"Capgo API key is missing. Run `npx -y @capgo/cli@latest login` or pass `--apikey`."}function dC0($){if($.toLowerCase()==="x-capgo-log-token")return"Build log token contains invalid characters (only ASCII is allowed). Re-run the build command to get a fresh token.";if($.toLowerCase()==="authorization")return"Authorization header contains invalid characters (only ASCII is allowed). Check your Capgo API key or Supabase anon key configuration.";return"Capgo API key contains invalid characters (only ASCII is allowed). Copy the key from the Capgo dashboard."}function YR($,D){if(D===void 0||D===null){if(JR.has($.toLowerCase()))throw new Z0(Dm($));throw new Z0(`HTTP header "${$}" is missing or invalid.`)}if(typeof D!=="string"){if(JR.has($.toLowerCase()))throw new Z0(Dm($));throw new Z0(`HTTP header "${$}" is missing or invalid.`)}if(!mC0(D)){if(JR.has($.toLowerCase()))throw new Z0(dC0($));throw new Z0(`HTTP header "${$}" contains invalid characters (only ASCII is allowed).`)}return D}function s$($){let D={capgo_api:hC0,"x-cli-version":Q6.version,"x-cli-command":gC0,"x-cli-node":bC0,"x-cli-os":uC0()};if($)for(let[Q,X]of Object.entries($))D[Q]=YR(Q,X);return D}var hC0="2025-10-01",gC0="",JR;var V4=r(()=>{E8();w$();JR=new Set(["authorization","capgkey","x-capgo-log-token"])});var Qm,Xm=($)=>{return $===12288||$>=65281&&$<=65376||$>=65504&&$<=65510},Jm=($)=>{return $===8987||$===9001||$>=12272&&$<=12287||$>=12289&&$<=12350||$>=12441&&$<=12543||$>=12549&&$<=12591||$>=12593&&$<=12686||$>=12688&&$<=12771||$>=12783&&$<=12830||$>=12832&&$<=12871||$>=12880&&$<=19903||$>=65040&&$<=65049||$>=65072&&$<=65106||$>=65108&&$<=65126||$>=65128&&$<=65131||$>=127488&&$<=127490||$>=127504&&$<=127547||$>=127552&&$<=127560||$>=131072&&$<=196605||$>=196608&&$<=262141};var Ym=r(()=>{Qm=(()=>{let $=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return(D)=>{let Q=0;$.lastIndex=0;while($.test(D))Q+=1;return D.length-Q}})()});var cC0,lC0,Zm,nC0,Fm,iC0,pC0,rC0,Gm=($,D={},Q={})=>{let X=D.limit??1/0,J=D.ellipsis??"",Y=D?.ellipsisWidth??(J?Gm(J,rC0,Q).width:0),Z=0,F=Q.controlWidth??0,G=Q.tabWidth??8,q=Q.emojiWidth??2,W=2,U=Q.regularWidth??1,H=Q.wideWidth??2,K=[[iC0,U],[cC0,0],[lC0,F],[nC0,G],[Fm,q],[Zm,H]],O=0,z=0,V=$.length,N=0,w=!1,M=V,L=Math.max(0,X-Y),B=0,R=0,_=0,v=0;$:while(!0){if(R>B||z>=V&&z>O){let j=$.slice(B,R)||$.slice(O,z);N=0;for(let k of j.replaceAll(pC0,"")){let x=k.codePointAt(0)||0;if(Xm(x))v=2;else if(Jm(x))v=H;else v=U;if(_+v>L)M=Math.min(M,Math.max(B,O)+N);if(_+v>X){w=!0;break $}N+=k.length,_+=v}B=R=0}if(z>=V)break $;for(let j=0,k=K.length;j<k;j++){let[x,m]=K[j];if(x.lastIndex=z,x.test($)){if(N=x===Zm?Qm($.slice(z,x.lastIndex)):x===Fm?1:x.lastIndex-z,v=N*m,_+v>L)M=Math.min(M,z+Math.floor((L-_)/m));if(_+v>X){w=!0;break $}_+=v,B=O,R=z,z=O=x.lastIndex;continue $}}z+=1}return{width:w?L:_,index:w?M:V,truncated:w,ellipsed:w&&X>=Y}},qm;var Wm=r(()=>{Ym();cC0=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,lC0=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Zm=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,nC0=/\t{1,1000}/y,Fm=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,iC0=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,pC0=/\p{M}+/gu,rC0={limit:1/0,ellipsis:""},qm=Gm});var oC0,tC0=($,D={})=>{return qm($,oC0,D).width},s8;var ZR=r(()=>{Wm();oC0={limit:1/0,ellipsis:"",ellipsisWidth:0},s8=tC0});function t5($,D,Q){return String($).normalize().split(DP0).map((X)=>$P0(X,D,Q)).join(`
|
|
1
|
+
import{createRequire as yC0}from"node:module";var module={exports:{}};var PC0=Object.create;var{getPrototypeOf:SC0,defineProperty:tG,getOwnPropertyNames:$m}=Object;var QR=Object.prototype.hasOwnProperty;function XR($){return this[$]}var V0=($,D,Q)=>{var X=$m(D);for(let J of X)if(!QR.call($,J)&&J!=="default")tG($,J,{get:XR.bind(D,J),enumerable:!0});if(Q){for(let J of X)if(!QR.call(Q,J)&&J!=="default")tG(Q,J,{get:XR.bind(D,J),enumerable:!0});return Q}},_C0,vC0,f$=($,D,Q)=>{var X=$!=null&&typeof $==="object";if(X){var J=D?_C0??=new WeakMap:vC0??=new WeakMap,Y=J.get($);if(Y)return Y}Q=$!=null?PC0(SC0($)):{};let Z=D||!$||!$.__esModule?tG(Q,"default",{value:$,enumerable:!0}):Q;for(let F of $m($))if(!QR.call(Z,F))tG(Z,F,{get:XR.bind($,F),enumerable:!0});if(X)J.set($,Z);return Z};var E=($,D)=>()=>(D||$((D={exports:{}}).exports,D),D.exports);var xC0=($)=>$;function kC0($,D){this[$]=xC0.bind(null,D)}var VD=($,D)=>{for(var Q in D)tG($,Q,{get:D[Q],enumerable:!0,configurable:!0,set:kC0.bind(D,Q)})};var r=($,D)=>()=>($&&(D=$($=0)),D);var X0=yC0(import.meta.url);var Q6;var E8=r(()=>{Q6={name:"@capgo/cli",type:"module",version:"8.82.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/capgo/tree/main/cli#readme",repository:{type:"git",url:"https://github.com/Cap-go/capgo.app",directory:"cli"},bugs:{url:"https://github.com/Cap-go/capgo/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"bunx --bun supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsgo --project tsconfig.tsgo.json --noEmit",lint:"bun run lint:ox","lint:ox":"oxlint --config ../.oxlintrc.json src","lint:fix":"oxlint --config ../.oxlintrc.json --fix src","check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:notify-app-ready-background":"bun test ./test/test-notify-app-ready-background.mjs ./test/test-background-check-shutdown.mjs","test:bundle":"bun test/test-bundle.mjs","test:bundle-validation":"bun test test/bundle/","test:prescan":"bun test test/prescan/","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:fail-on-incompatible":"bun test/test-fail-on-incompatible.mjs","test:native-dependencies":"bun test/test-native-dependencies.mjs && bun test/test-get-remote-dependencies.mjs","test:package-json-guard":"bun test/test-package-json-guard.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-export":"bun test/test-credentials-export.mjs","test:asc-key-protocol":"bun test/test-asc-key-protocol.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:android-service-account-validation":"bun test/test-android-service-account-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:build-needed":"bun test/test-build-needed.mjs","test:cli-help":"bun test/test-cli-help.mjs","test:build-cache-payload":"bun test/test-build-cache-payload.mjs","test:build-cancellation":"bun test/test-build-cancellation.mjs","test:ci-prompts":"bun test/test-ci-prompts.mjs","test:capgo-app-id-prompt":"bun test/test-capgo-app-id-prompt.mjs","test:ci-secrets":"bun test/test-ci-secrets.mjs","test:android-onboarding-progress":"bun test/test-android-onboarding-progress.mjs && bun test/test-android-select-guard.mjs","test:android-keystore-action":"bun test/test-android-keystore-action.mjs","test:android-google-play-action":"bun test/test-android-google-play-action.mjs","test:onboarding-telemetry":"bun test/test-onboarding-telemetry.mjs","test:v2-event-migration":"bun test/test-v2-event-migration.mjs","test:analytics":"bun test/test-analytics.mjs","test:cli-headers":"bun test/test-cli-headers.mjs","test:min-cli-version":"bun test/test-min-cli-version.mjs","test:authenticated-command-invocation":"bun test/test-authenticated-command-invocation.mjs","test:analytics-error-category":"bun test/test-analytics-error-category.mjs","test:analytics-org-resolver":"bun test/test-analytics-org-resolver.mjs","test:supabase-perf":"bun test/test-supabase-perf.mjs","test:preview-qr":"bun test/test-preview-qr.mjs","test:bundle-pages":"bun test test/test-bundle-pages.test.ts","test:mcp-analytics":"bun test/test-mcp-analytics.mjs","test:mcp-instructions":"bun test/test-mcp-instructions.mjs","test:mcp-stdout-guard":"bun test/test-mcp-stdout-guard.mjs","test:mcp-platform-select":"bun test/test-mcp-platform-select.mjs","test:mcp-explain-scopes":"bun test/test-mcp-explain-scopes.mjs","test:mcp-oauth-reopen":"bun test/test-mcp-oauth-reopen.mjs","test:mcp-broker-oauth":"bun test/test-mcp-broker-oauth.mjs","test:mcp-broker-session":"bun test/test-mcp-broker-session.mjs","test:mcp-credentials-manage":"bun test/test-mcp-credentials-manage.mjs","test:mcp-resume-prompt":"bun test/test-mcp-resume-prompt.mjs","test:mcp-build-job":"bun test/test-mcp-build-job.mjs","test:mcp-build-tools":"bun test/test-mcp-build-tools.mjs","test:app-created-source":"bun test/test-app-created-source.mjs","test:app-add-exists":"bun test/test-app-add-exists.mjs","test:app-add-getting-started":"bun test/test-app-add-getting-started.mjs","test:app-list-output-text":"bun test/test-app-list-output-text.mjs","test:app-todo":"bun test/test-app-todo.mjs","test:doctor-analytics":"bun test/test-doctor-analytics.mjs","test:posthog-exception":"bun test/test-posthog-exception.mjs","test:cli-recovery":"bun test/test-cli-recovery.mjs","test:create-supabase-client":"bun test/test-create-supabase-client.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.mjs","test:onboarding-progress":"bun test/test-onboarding-progress.mjs","test:onboarding-run-targets":"bun test/test-onboarding-run-targets.mjs","test:run-device-command":"bun test/test-run-device-command.mjs","test:init-app-conflict":"bun test/test-init-app-conflict.mjs","test:channel-add-exists":"bun test/test-channel-add-exists.mjs","test:wait-log":"bun test/test-wait-log.mjs","test:init-guardrails":"bun test/test-init-guardrails.mjs","test:init-upload-recovery":"bun test/test-init-upload-error-gate.mjs && bun test/test-init-upload-monorepo-recovery.mjs","test:init-replay":"bun test/test-init-replay.mjs","test:init-telemetry":"bun test/test-init-telemetry.mjs","test:capacitor-config-target":"bun test/test-capacitor-config-target.mjs","test:builder-app-id-config":"bun test/test-builder-app-id-config.mjs","test:capacitor-config-typescript7":"bun test/test-capacitor-config-typescript7.mjs","test:capacitor-config-native-import":"bun test/test-capacitor-config-native-import.mjs","test:cli-user-error-config":"bun test/test-cli-user-error-config.mjs","test:cordova-upload-mode":"bun test/test-cordova-upload-mode.mjs","test:init-monorepo-targeting":"bun run test:capacitor-config-target && bun run test:builder-app-id-config && bun run test:capacitor-config-typescript7 && bun run test:capacitor-config-native-import && bun run test:cli-user-error-config && bun test/test-init-monorepo-targeting.mjs","test:prompt-preferences":"bun test/test-prompt-preferences.mjs","test:esm-sdk":"node test/test-sdk-esm.mjs","test:auth-session":"bun test/test-auth-session.mjs","test:mcp":"node test/test-mcp.mjs","test:mcp-no-key-handshake":"node test/test-mcp-no-key-handshake.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh","test:platform-paths":"bun test/test-platform-paths.mjs","test:project-type-detection":"bun test/test-project-type-detection.mjs","test:payload-split":"bun test/test-payload-split.mjs","test:macos-signing":"bun test/test-macos-signing.mjs","test:helper-dce":"bash scripts/check-helper-dce.sh","test:apple-api-import-helpers":"bun test/test-apple-api-import-helpers.mjs","test:apple-api-verify-key":"bun test/test-apple-api-verify-key.mjs","test:bundle-id-detector":"bun test/test-bundle-id-detector.mjs","test:apple-api-app-list":"bun test/test-apple-api-app-list.mjs","test:apple-api-cert-create":"bun test/test-apple-api-cert-create.mjs","test:app-verification":"bun test/test-app-verification.mjs","test:pbxproj-parser":"bun test/test-pbxproj-parser.mjs","test:self-update":"bun test/test-self-update.mjs","test:update-prompt":"bun test/test-update-prompt.mjs","test:android-tail-engine":"bun test/test-android-tail-engine.mjs","test:android-tail-render":"bun test/test-android-tail-render.mjs","test:android-tail-routing":"bun test/test-android-tail-routing.mjs","test:dev-gate-stripped":"bun test/test-dev-gate-stripped.mjs","test:frame-fit-ios-shared":"bun test/test-frame-fit-ios-shared.mjs","test:ios-confirm-app-id":"bun test/test-ios-confirm-app-id.mjs","test:ios-create-new":"bun test/test-ios-create-new.mjs","test:ios-certificate-action":"bun test/test-ios-certificate-action.mjs","test:ios-profile-action":"bun test/test-ios-profile-action.mjs","test:ios-credential-action":"bun test/test-ios-credential-action.mjs","test:ios-e2e":"bun test/test-ios-e2e.mjs","test:ios-flow-contract":"bun test/test-ios-flow-contract.mjs","test:ios-import-discovery":"bun test/test-ios-import-discovery.mjs","test:ios-import-export":"bun test/test-ios-import-export.mjs","test:ios-import-pickers":"bun test/test-ios-import-pickers.mjs","test:ios-import-recovery":"bun test/test-ios-import-recovery.mjs","test:ios-recovery":"bun test/test-ios-recovery.mjs","test:ios-resume":"bun test/test-ios-resume.mjs","test:ios-tail-handoff":"bun test/test-ios-tail-handoff.mjs","test:ios-tui-render":"bun test/test-ios-tui-render.mjs","test:p8-error":"bun test/test-p8-error.mjs","test:ios-tui-routing":"bun test/test-ios-tui-routing.mjs","test:ios-updater-sync-validation":"bun test/test-ios-updater-sync-validation.mjs","test:ios-verify-app":"bun test/test-ios-verify-app.mjs","test:ios-marketing-version":"bun test/test-ios-marketing-version.mjs","test:android-version":"bun test/test-android-version.mjs","test:platform-flow-contract":"bun test/test-platform-flow-contract.mjs","test:tail-engine-shared":"bun test/test-tail-engine-shared.mjs",test:"bun run build && bun scripts/run-test-suite.ts","test:run":"bun scripts/run-test-suite.ts","test:serial":"bun run build && bun scripts/run-test-suite.ts --serial","test:suite":"bun run test:helper-dce && bun run test:version-detection:setup && bun run test:bundle && bun run test:notify-app-ready-background && bun run test:bundle-validation && bun run test:functional && bun run test:semver && bun run test:auto-bump-version && bun run test:auto-bump-ai-diff && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:cordova-upload-mode && bun run test:fail-on-incompatible && bun run test:native-dependencies && bun run test:package-json-guard && bun run test:credentials && bun run test:credentials-export && bun run test:ios-provisioning-map && bun run test:ios-provisioning-command && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:cli-help && bun run test:build-cache-payload && bun run test:build-cancellation && bun run test:ci-prompts && bun run test:capgo-app-id-prompt && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:android-keystore-action && bun run test:android-google-play-action && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:analytics && bun run test:cli-headers && bun run test:min-cli-version && bun run test:authenticated-command-invocation && bun run test:analytics-error-category && bun run test:analytics-org-resolver && bun run test:supabase-perf && bun run test:preview-qr && bun run test:bundle-pages && bun run test:app-set-options && bun run test:mcp-analytics && bun run test:mcp-instructions && bun run test:mcp-live-update-onboarding && bun run test:mcp-stdout-guard && bun run test:mcp-platform-select && bun run test:mcp-explain-scopes && bun run test:mcp-oauth-reopen && bun run test:mcp-broker-oauth && bun run test:mcp-broker-session && bun run test:mcp-credentials-manage && bun run test:mcp-resume-prompt && bun run test:mcp-build-job && bun run test:mcp-build-tools && bun run test:app-created-source && bun run test:app-add-exists && bun run test:app-add-getting-started && bun run test:app-list-output-text && bun run test:app-todo && bun run test:doctor-analytics && bun run test:posthog-exception && bun run test:cli-recovery && bun run test:create-supabase-client && bun run test:build-platform-selection && bun run test:builder-project-discovery && bun run test:builder-app-selection && bun run test:builder-login-gate && bun run test:onboarding-recovery && bun run test:onboarding-progress && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-monorepo-targeting && bun run test:init-app-conflict && bun run test:channel-list && bun run test:channel-add-exists && bun run test:wait-log && bun run test:init-guardrails && bun run test:init-upload-recovery && bun run test:init-replay && bun run test:init-telemetry && bun run test:prompt-preferences && bun run test:esm-sdk && bun run test:mcp && bun run test:mcp-no-key-handshake && bun run test:auth-session && bun run test:version-detection && bun run test:platform-paths && bun run test:project-type-detection && bun run test:payload-split && bun run test:macos-signing && bun run test:asc-key-protocol && bun run test:apple-api-import-helpers && bun run test:apple-api-verify-key && bun run test:bundle-id-detector && bun run test:apple-api-app-list && bun run test:app-verification && bun run test:pbxproj-parser && bun run test:ai-log-capture && bun run test:ai-analyze-flow && bun run test:cicd-failure-help && bun run test:ai-sse-parser && bun run test:ai-render-markdown && bun run test:ai-stream-markdown && bun run test:ai-onboarding-mode && bun run test:ai-fit && bun run test:platform-layout && bun run test:frame-fit && bun run test:onboarding-min-size && bun run test:min-size-gate && bun run test:shell-size-gate && bun run test:build-log-sanitize && bun run test:build-output-viewport && bun run test:diff-viewer-viewport && bun run test:build-complete-exit && bun run test:ai-analyze-stream && bun run test:support-mailto && bun run test:support-redact && bun run test:support-internal-log && bun run test:support-help-menu && bun run test:support-contact && bun run test:support-upload-prompt && bun run test:support-bundle-files && bun run test:self-update && bun run test:update-prompt && bun run test:apple-api-cert-create && bun run test:android-tail-engine && bun run test:android-tail-render && bun run test:android-tail-routing && bun run test:dev-gate-stripped && bun run test:frame-fit-ios-shared && bun run test:ios-confirm-app-id && bun run test:ios-create-new && bun run test:ios-certificate-action && bun run test:ios-profile-action && bun run test:ios-credential-action && bun run test:ios-e2e && bun run test:ios-flow-contract && bun run test:ios-import-discovery && bun run test:ios-import-export && bun run test:ios-import-pickers && bun run test:ios-import-recovery && bun run test:ios-recovery && bun run test:ios-resume && bun run test:ios-tail-handoff && bun run test:ios-tui-render && bun run test:p8-error && bun run test:ios-tui-routing && bun run test:ios-updater-sync-validation && bun run test:ios-verify-app && bun run test:ios-marketing-version && bun run test:android-version && bun run test:platform-flow-contract && bun run test:tail-engine-shared && bun run test:prescan && bun run test:android-reporting-api && bun run test:android-gcp && bun run test:android-app-verification && bun run test:android-rename && bun run test:appflow-auth && bun run test:appflow-api-map && bun run test:appflow-validate && bun run test:appflow-flow && bun run test:appflow-gapfill && bun run test:appflow-engine && bun run test:appflow-tail && bun run test:appflow-fetch && bun run test:appflow-sa-decode && bun run test:app-permission-helper && bun run test:2fa-compliance-network && bun run test:organization-set-api-host && bun run test:trial-warning && bun run test:plan-validation","test:build-platform-selection":"bun test/test-build-platform-selection.mjs","test:builder-project-discovery":"bun test/test-builder-project-discovery.mjs","test:builder-app-selection":"bun test/test-builder-app-selection.mjs","test:builder-login-gate":"bun test/test-builder-login-gate.mjs","test:ai-log-capture":"bun test/test-ai-log-capture.mjs","test:ai-analyze-flow":"bun test/test-ai-analyze-flow.mjs","test:cicd-failure-help":"bun test/test-cicd-failure-help.mjs","test:ai-analyze-stream":"bun test/test-ai-analyze-stream.mjs","test:ai-sse-parser":"bun test/test-ai-sse-parser.mjs","test:ai-render-markdown":"bun test/test-ai-render-markdown.mjs","test:ai-onboarding-mode":"bun test/test-ai-onboarding-mode.mjs","test:ai-fit":"bun test/test-ai-fit.mjs","test:platform-layout":"bun test/test-platform-layout.mjs","test:frame-fit":"bun test/run-frame-fit.mjs","test:onboarding-min-size":"bun test/test-onboarding-min-size.mjs","test:min-size-gate":"bun test/test-min-size-gate.mjs","test:shell-size-gate":"bun test/test-shell-size-gate.mjs","test:build-log-sanitize":"bun test/test-build-log-sanitize.mjs","test:build-output-viewport":"bun test/test-build-output-viewport.mjs","test:diff-viewer-viewport":"bun test/test-diff-viewer-viewport.mjs","test:build-complete-exit":"bun test/test-build-complete-exit.mjs","test:ai-stream-markdown":"bun test/test-ai-stream-markdown.mjs","test:support-mailto":"bun test/test-support-mailto.mjs","test:support-redact":"bun test/test-support-redact.mjs","test:support-internal-log":"bun test/test-support-internal-log.mjs","test:support-help-menu":"bun test/test-support-help-menu.mjs","test:support-contact":"bun test/test-support-contact.mjs","test:support-upload-prompt":"bun test/test-support-upload-prompt.mjs","test:support-bundle-files":"bun test/test-support-bundle-files.mjs","test:mcp-live-update-onboarding":"bun test/test-mcp-live-update-onboarding.mjs","test:app-set-options":"bun test/test-app-set-options.mjs && bun test/test-app-list-options.mjs","test:android-reporting-api":"bun test/test-android-reporting-api.mjs","test:android-gcp":"bun test/test-android-gcp.mjs","test:android-app-verification":"bun test/test-android-app-verification.mjs","test:android-rename":"bun test/test-android-rename.mjs","test:appflow-auth":"bun test/test-appflow-auth.mjs","test:appflow-api-map":"bun test/test-appflow-api-map.mjs","test:appflow-validate":"bun test/test-appflow-validate.mjs","test:appflow-flow":"bun test/test-appflow-flow.mjs","test:appflow-gapfill":"bun test/test-appflow-gapfill.mjs","test:appflow-engine":"bun test/test-appflow-engine.mjs","test:appflow-tail":"bun test/test-appflow-tail.mjs","test:appflow-fetch":"bun test/test-appflow-fetch.mjs","test:appflow-sa-decode":"bun test/test-appflow-sa-decode.mjs","test:app-permission-helper":"bun test/test-app-permission-helper.mjs","test:2fa-compliance-network":"bun test/test-2fa-compliance-network.mjs","test:organization-set-api-host":"bun test/test-organization-set-api-host.mjs","test:trial-warning":"bun test/test-trial-warning.mjs","test:plan-validation":"bun test/test-plan-validation.mjs","test:auto-bump-version":"bun test/test-auto-bump-version.mjs","test:auto-bump-ai-diff":"bun test/test-auto-bump-ai-diff.mjs","test:ios-provisioning-map":"bun test/test-ios-provisioning-map.mjs","test:ios-provisioning-command":"bun test/test-ios-provisioning-command.mjs","test:channel-list":"bun test/test-channel-list.mjs"},dependencies:{"@inkjs/ui":"^2.0.0","@manypkg/tools":"^2.1.2","@rrweb/types":"^2.1.1","@standard-schema/spec":"^1.1.0","@xmldom/xmldom":"^0.9.10","@xterm/addon-serialize":"^0.14.0","@xterm/headless":"^6.0.0","agent-cli-detector":"^0.1.6","happy-dom":"^20.11.0",ink:"^7.1.1","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.4.0",qrcode:"^1.5.4",react:"^19.2.8","rrweb-snapshot":"^2.1.1","string-width":"^8.2.2",typescript:"6.0.3",zod:"^4.5.4"},optionalDependencies:{"@capgo/cli-helper-darwin-arm64":"^1.1.1","@capgo/cli-helper-darwin-x64":"^1.1.1","node-pty":"^1.1.0"},devDependencies:{"@antfu/eslint-config":"^9.2.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.6","@capacitor/cli":"^8.4.2","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.7.0","@modelcontextprotocol/client":"^2.0.0-beta.5","@modelcontextprotocol/server":"^2.0.0-beta.5","@sauber/table":"npm:@jsr/sauber__table","@sinonjs/fake-timers":"15.4.0","@std/semver":"npm:@jsr/std__semver@1.0.8","@supabase/supabase-js":"^2.110.8","@tanstack/intent":"^0.3.6","@types/adm-zip":"^0.5.8","@types/jsonwebtoken":"^9.0.10","@types/node":"^26.1.1","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/qrcode":"^1.5.6","@types/react":"^19.2.17","@types/tmp":"^0.2.6","@types/ws":"^8.18.1","@typescript/native-preview":"7.0.0-dev.20260707.2","@vercel/ncc":"^0.44.1","@vue/compiler-dom":"3.5.40","@xterm/headless":"^6.0.0","adm-zip":"^0.6.0","ci-info":"^4.4.0",commander:"^15.0.0",eslint:"^10.7.0","git-format-staged":"4.0.2",husky:"^9.1.7","is-wsl":"^3.1.1",micromatch:"^4.0.8",open:"^11.0.0",oxlint:"^1.75.0",partysocket:"^1.3.0",prettyjson:"^1.2.5",tmp:"^0.2.7","tus-js-client":"^4.3.1",ws:"^8.21.1"}}});var Z0;var w$=r(()=>{Z0=class Z0 extends Error{context;constructor($,D){super($);this.name="CliUserError",this.context=D}}});import{platform as uC0}from"node:os";import{version as bC0}from"node:process";function mC0($){for(let D=0;D<$.length;D++)if($.charCodeAt(D)>255)return!1;return!0}function Dm($){if($.toLowerCase()==="x-capgo-log-token")return"Build log token is missing. Re-run the build command or pass a valid log token.";return"Capgo API key is missing. Run `npx -y @capgo/cli@latest login` or pass `--apikey`."}function dC0($){if($.toLowerCase()==="x-capgo-log-token")return"Build log token contains invalid characters (only ASCII is allowed). Re-run the build command to get a fresh token.";if($.toLowerCase()==="authorization")return"Authorization header contains invalid characters (only ASCII is allowed). Check your Capgo API key or Supabase anon key configuration.";return"Capgo API key contains invalid characters (only ASCII is allowed). Copy the key from the Capgo dashboard."}function YR($,D){if(D===void 0||D===null){if(JR.has($.toLowerCase()))throw new Z0(Dm($));throw new Z0(`HTTP header "${$}" is missing or invalid.`)}if(typeof D!=="string"){if(JR.has($.toLowerCase()))throw new Z0(Dm($));throw new Z0(`HTTP header "${$}" is missing or invalid.`)}if(!mC0(D)){if(JR.has($.toLowerCase()))throw new Z0(dC0($));throw new Z0(`HTTP header "${$}" contains invalid characters (only ASCII is allowed).`)}return D}function s$($){let D={capgo_api:hC0,"x-cli-version":Q6.version,"x-cli-command":gC0,"x-cli-node":bC0,"x-cli-os":uC0()};if($)for(let[Q,X]of Object.entries($))D[Q]=YR(Q,X);return D}var hC0="2025-10-01",gC0="",JR;var V4=r(()=>{E8();w$();JR=new Set(["authorization","capgkey","x-capgo-log-token"])});var Qm,Xm=($)=>{return $===12288||$>=65281&&$<=65376||$>=65504&&$<=65510},Jm=($)=>{return $===8987||$===9001||$>=12272&&$<=12287||$>=12289&&$<=12350||$>=12441&&$<=12543||$>=12549&&$<=12591||$>=12593&&$<=12686||$>=12688&&$<=12771||$>=12783&&$<=12830||$>=12832&&$<=12871||$>=12880&&$<=19903||$>=65040&&$<=65049||$>=65072&&$<=65106||$>=65108&&$<=65126||$>=65128&&$<=65131||$>=127488&&$<=127490||$>=127504&&$<=127547||$>=127552&&$<=127560||$>=131072&&$<=196605||$>=196608&&$<=262141};var Ym=r(()=>{Qm=(()=>{let $=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return(D)=>{let Q=0;$.lastIndex=0;while($.test(D))Q+=1;return D.length-Q}})()});var cC0,lC0,Zm,nC0,Fm,iC0,pC0,rC0,Gm=($,D={},Q={})=>{let X=D.limit??1/0,J=D.ellipsis??"",Y=D?.ellipsisWidth??(J?Gm(J,rC0,Q).width:0),Z=0,F=Q.controlWidth??0,G=Q.tabWidth??8,q=Q.emojiWidth??2,W=2,U=Q.regularWidth??1,H=Q.wideWidth??2,K=[[iC0,U],[cC0,0],[lC0,F],[nC0,G],[Fm,q],[Zm,H]],O=0,z=0,V=$.length,N=0,w=!1,M=V,L=Math.max(0,X-Y),B=0,R=0,_=0,v=0;$:while(!0){if(R>B||z>=V&&z>O){let j=$.slice(B,R)||$.slice(O,z);N=0;for(let k of j.replaceAll(pC0,"")){let x=k.codePointAt(0)||0;if(Xm(x))v=2;else if(Jm(x))v=H;else v=U;if(_+v>L)M=Math.min(M,Math.max(B,O)+N);if(_+v>X){w=!0;break $}N+=k.length,_+=v}B=R=0}if(z>=V)break $;for(let j=0,k=K.length;j<k;j++){let[x,m]=K[j];if(x.lastIndex=z,x.test($)){if(N=x===Zm?Qm($.slice(z,x.lastIndex)):x===Fm?1:x.lastIndex-z,v=N*m,_+v>L)M=Math.min(M,z+Math.floor((L-_)/m));if(_+v>X){w=!0;break $}_+=v,B=O,R=z,z=O=x.lastIndex;continue $}}z+=1}return{width:w?L:_,index:w?M:V,truncated:w,ellipsed:w&&X>=Y}},qm;var Wm=r(()=>{Ym();cC0=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,lC0=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Zm=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,nC0=/\t{1,1000}/y,Fm=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,iC0=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,pC0=/\p{M}+/gu,rC0={limit:1/0,ellipsis:""},qm=Gm});var oC0,tC0=($,D={})=>{return qm($,oC0,D).width},s8;var ZR=r(()=>{Wm();oC0={limit:1/0,ellipsis:"",ellipsisWidth:0},s8=tC0});function t5($,D,Q){return String($).normalize().split(DP0).map((X)=>$P0(X,D,Q)).join(`
|
|
2
2
|
`)}var NK="\x1B",zm="",aC0=39,GR="\x07",Vm="[",sC0="]",Mm="m",qR,Um,Hm=($)=>{if($>=30&&$<=37)return 39;if($>=90&&$<=97)return 39;if($>=40&&$<=47)return 49;if($>=100&&$<=107)return 49;if($===1||$===2)return 22;if($===3)return 23;if($===4)return 24;if($===7)return 27;if($===8)return 28;if($===9)return 29;if($===0)return 0;return},Km=($)=>`${NK}${Vm}${$}${Mm}`,Om=($)=>`${NK}${qR}${$}${GR}`,FR=($,D,Q)=>{let X=D[Symbol.iterator](),J=!1,Y=!1,Z=$.at(-1),F=Z===void 0?0:s8(Z),G=X.next(),q=X.next(),W=0;while(!G.done){let U=G.value,H=s8(U);if(F+H<=Q)$[$.length-1]+=U;else $.push(U),F=0;if(U===NK||U===zm)J=!0,Y=D.startsWith(qR,W+1);if(J){if(Y){if(U===GR)J=!1,Y=!1}else if(U===Mm)J=!1}else if(F+=H,F===Q&&!q.done)$.push(""),F=0;G=q,q=X.next(),W+=U.length}if(Z=$.at(-1),!F&&Z!==void 0&&Z.length&&$.length>1)$[$.length-2]+=$.pop()},eC0=($)=>{let D=$.split(" "),Q=D.length;while(Q){if(s8(D[Q-1]))break;Q--}if(Q===D.length)return $;return D.slice(0,Q).join(" ")+D.slice(Q).join("")},$P0=($,D,Q={})=>{if(Q.trim!==!1&&$.trim()==="")return"";let X="",J,Y,Z=$.split(" "),F=[""],G=0;for(let U=0;U<Z.length;U++){let H=Z[U];if(Q.trim!==!1){let O=F.at(-1)??"",z=O.trimStart();if(O.length!==z.length)F[F.length-1]=z,G=s8(z)}if(U!==0){if(G>=D&&(Q.wordWrap===!1||Q.trim===!1))F.push(""),G=0;if(G||Q.trim===!1)F[F.length-1]+=" ",G++}let K=s8(H);if(Q.hard&&K>D){let O=D-G,z=1+Math.floor((K-O-1)/D);if(Math.floor((K-1)/D)<z)F.push("");FR(F,H,D),G=s8(F.at(-1)??"");continue}if(G+K>D&&G&&K){if(Q.wordWrap===!1&&G<D){FR(F,H,D),G=s8(F.at(-1)??"");continue}F.push(""),G=0}if(G+K>D&&Q.wordWrap===!1){FR(F,H,D),G=s8(F.at(-1)??"");continue}F[F.length-1]+=H,G+=K}if(Q.trim!==!1)F=F.map((U)=>eC0(U));let q=F.join(`
|
|
3
3
|
`),W=!1;for(let U=0;U<q.length;U++){let H=q[U];if(X+=H,!W){if(W=H>="\uD800"&&H<="\uDBFF",W)continue}else W=!1;if(H===NK||H===zm){Um.lastIndex=U+1;let O=Um.exec(q)?.groups;if(O?.code!==void 0){let z=Number.parseFloat(O.code);J=z===aC0?void 0:z}else if(O?.uri!==void 0)Y=O.uri.length===0?void 0:O.uri}if(q[U+1]===`
|
|
4
4
|
`){if(Y)X+=Om("");let K=J?Hm(J):void 0;if(J&&K)X+=Km(K)}else if(H===`
|
|
@@ -622,7 +622,7 @@ Reference: ${$}`:"Logs uploaded — Capgo support will be in touch by email."}as
|
|
|
622
622
|
`);return rz0({kind:"build-request",appId:$.appId,error:`Cloud build ${$.jobId} failed`,logs:X,sections:Q.length>0?[{title:"Internal log",lines:Q}]:[]},$.outputDir)}i0();function uN$($){if(!$||typeof $!=="object")return;let D=$.originalResponse?.getStatus?.();return typeof D==="number"?D:void 0}function bN$($){let D=uN$($);if(D===401||D===403)return"unauthorized";if(D===413)return"payload_too_large";if(D!==void 0&&D>=500&&D<600)return"storage_failure";if(D===void 0||D===0)return"network_error";return"unknown"}var hN$={started:"Builder Upload Started",succeeded:"Builder Upload Succeeded",failed:"Builder Upload Failed"};async function r2($){let D={app_id:$.appId,platform:$.platform,build_mode:$.buildMode,job_id:$.jobId,upload_size_bytes:String($.sizeBytes)};if(typeof $.durationSeconds==="number"&&Number.isFinite($.durationSeconds))D.upload_duration_seconds=String(Math.round($.durationSeconds));if($.phase==="failed"&&$.error!==void 0)D.failure_category=bN$($.error);try{await $$($.apikey,{event:hN$[$.phase],channel:"build-lifecycle",org_id:$.orgId,tracking_version:2,tags:D})}catch{}}async function a_$(){return f1({message:"No platform selected. Which platform do you want to build?",options:[{value:"ios",label:"iOS"},{value:"android",label:"Android"}]})}async function s_$($,{silent:D=!1,interactive:Q=a6({silent:D}),promptPlatform:X=a_$}={}){if($==="ios"||$==="android")return $;if($)throw Error(`Invalid platform "${$}". Must be "ios" or "android"`);if(!Q)throw Error("Missing required argument: --platform <ios|android>. In an interactive terminal, you can omit --platform and choose one when prompted.");let J=await X();if(r0(J))throw T.warn("Build request canceled."),new Z0("Build request canceled.");if(J!=="ios"&&J!=="android")throw Error("Build request canceled.");return J}function e_$($){return{info:(D)=>{if(!$)T.info(D)},error:(D)=>{if(!$)T.error(D)},warn:(D)=>{if(!$)T.warn(D)},success:(D)=>{if(!$)T.success(D)},buildLog:(D)=>{if(!$)console.log(D)},uploadProgress:(()=>{let D=$?null:c1(),Q=!1;return(X)=>{if($||!D)return;if(!Q)D.start("Uploading bundle"),Q=!0;if(X>=100)D.stop("Upload complete!");else D.message(`Uploading ${X.toFixed(0)}%`)}})(),customMsg:async(D,Q)=>{if(!$)await Hu(D,Q,(X)=>console.log(X),(X)=>T.warn(X))}}}function $v$($){try{let D=JSON.parse($);if(!D||typeof D!=="object")return null;return D}catch{return null}}async function Hj0($,D,Q,X){if($!==429)return;let J=$v$(D),Y=J?.error;if(Y!=="native_build_concurrency_limit_exceeded"&&Y!=="need_plan_upgrade")return;let Z=await rX(),F=J?.moreInfo?.upgrade_url||`${Z.hostWeb}/settings/organization/plans`,G=J?.message||(Y==="native_build_concurrency_limit_exceeded"?`Native build concurrency limit reached for your plan. Upgrade here: ${F}`:`Cannot ${Q} native build, upgrade plan to continue: ${F}`);if(X.error(G),!G.includes(F))X.error(`Upgrade here: ${F}`);try{await(await Promise.resolve().then(() => (eZ(),KU))).default(F)}catch{}throw Error(G)}async function Dv$($,D,Q=3,X){let J=[1000,3000,5000];for(let Y=1;Y<=Q;Y++)try{let Z=await fetch($,D);if(Z.ok||Z.status>=400&&Z.status<500)return Z;let F=await Z.text().catch(()=>"unknown error");if(X?.warn(`Build request attempt ${Y}/${Q} failed: ${Z.status} - ${F}`),Y<Q){let G=J[Y-1]||5000;X?.info(`Retrying in ${G/1000}s...`),await new Promise((q)=>setTimeout(q,G))}else throw Error(`Failed to request build after ${Q} attempts: ${Z.status} - ${F}`)}catch(Z){let F=Z instanceof Error?Z.message:String(Z);if(F.startsWith("Failed to request build after"))throw Z;if(X?.warn(`Build request attempt ${Y}/${Q} failed: ${F}`),Y<Q){let G=J[Y-1]||5000;X?.info(`Retrying in ${G/1000}s...`),await new Promise((q)=>setTimeout(q,G))}else throw Error(`Failed to request build after ${Q} attempts: ${F}`)}throw Error("Unexpected error in fetchWithRetry")}function Kj0($){let D={};if($?.cache===!1)D.cache_enabled=!1;let Q=$?.cacheKey?.trim();if(Q)D.cache_key=Q,D.cache_fingerprint_extra=Q;return D}var Qv$="Tip: if this looks cache-related (stale artifacts between RC/PROD or branches), retry with --cache-key <env> to isolate compilation cache, or --no-cache to skip cache restore.";function Xv$($){return $.cache!==!1&&!$.cacheKey?.trim()&&$.aiAnalysisMode!=="caller-handled"}var Jv$=["succeeded","failed","expired","released","cancelled"],Nw=new Set(Jv$);function Yv$($){if(typeof $.data==="string")return $.data;if($.data instanceof ArrayBuffer)return new TextDecoder().decode($.data);if(ArrayBuffer.isView($.data)){let D=$.data;return new TextDecoder().decode(new Uint8Array(D.buffer,D.byteOffset,D.byteLength))}if($.data&&typeof $.data.toString==="function")return $.data.toString();return""}function Vj0($,D,Q){if(D)D.warn($);else if(!Q)T.warn($)}async function Zv$($,D,Q,X){try{if(Q)await Q.customMsg($,D);else if(!X)await Hu($,D,(J)=>console.log(J),(J)=>T.warn(J))}catch(J){Vj0(`Custom message handler encountered an error, continuing... ${String(J)}`,Q,X)}}async function Fv$($,D=!1,Q,X,J,Y,Z,F){if($&&!F)return null;let G=null,q=!1,W=(H)=>{if(!H.trim())return;if(G)return;if(!q)if(q=!0,F)F.buildLog("");else console.log("");if(F)F.buildLog(H);else console.log(H)},U=async()=>{if(!Q||!X)return null;let H=e8(Q),K=`${H}/start`,z=`${H}/stream?token=${encodeURIComponent(X)}`.replace(/^https:/,"wss:").replace(/^http:/,"ws:");if(F)F.info("Connecting to log streaming...");else if(!$)console.log("Connecting to log streaming...");let V=await fetch(K,{method:"POST",headers:s$({"x-capgo-log-token":X})});if(!V.ok){let N=await V.text().catch(()=>"unknown error");if(F)F.warn(`Could not start log session (${V.status}): ${N}`);else if(!$)console.warn(`Could not start log session (${V.status}): ${N}`);return null}return await new Promise((N)=>{let w=!1,M=10,L=0,B=!1,R=new jU(z,void 0,{maxRetries:M,WebSocket:wU0}),_=null,v=0,j=Date.now(),k=!1,x=2000,m=4,n=Nw,o=null,h=null,A=(c)=>{if(w)return;if(w=!0,h)clearTimeout(h),h=null;if(_)clearInterval(_),_=null;if(Y&&o)Y.removeEventListener("abort",o),o=null;try{R.close()}catch(d){S4(`ws.close failed during cleanup (ignored): ${d instanceof Error?d.message:String(d)}`)}N(c)};h=setTimeout(()=>{if(!w){if(F)F.warn("Log streaming timed out after 3 hours");else if(!$)console.warn("Log streaming timed out after 3 hours");A(null)}},10800000);let P=()=>{if(_)return;_=setInterval(async()=>{try{if(R.readyState===jU.OPEN)R.send(JSON.stringify({type:"heartbeat",lastId:v}));let c=Date.now();if(J&&!k&&c-j>=x*m){k=!0;try{let d=await J();if(d&&n.has(d))G=d,A(G)}finally{k=!1}}}catch(c){if(F)F.warn(`Heartbeat encountered an error, continuing... ${String(c)}`);else if(!$)T.warn(`Heartbeat encountered an error, continuing... ${String(c)}`)}},x)},y=async(c)=>{if(c.type==="custom_msg"&&typeof c.kind==="string"&&c.data){j=Date.now(),await Zv$(c.kind,c.data,F,$);return}if(c.type==="status"&&typeof c.status==="string"){let d=c.status.toLowerCase();if(j=Date.now(),n.has(d))G=d;return}if(c.type==="log"&&typeof c.message==="string"){j=Date.now(),W(c.message);return}if(typeof c.message==="string")j=Date.now(),W(c.message)},g=(c)=>{if(R.readyState!==jU.OPEN)return;try{R.send(JSON.stringify({type:"confirmed_received",lastId:c}))}catch(d){Vj0(`Failed to send log confirmation, continuing... ${String(d)}`,F,$)}};if(P(),Y){if(o=()=>{if(!w)A("cancelled")},Y.aborted){A("cancelled");return}Y.addEventListener("abort",o)}R.addEventListener("message",async(c)=>{let d=Yv$(c),q0=null;try{q0=JSON.parse(d)}catch{q0=null}if(q0?.type==="heartbeat_response")return;if(q0?.type==="batch_messages"&&Array.isArray(q0.messages)){let s=v;for(let $0 of q0.messages)if(await y($0),typeof $0.id==="number")s=Math.max(s,$0.id);if(s>v)v=s,g(s)}else{if(q0)await y(q0);else if(d)j=Date.now(),W(d);if(q0&&typeof q0.id==="number"&&q0.id>v)v=q0.id,g(q0.id)}if(G)A(G)}),R.addEventListener("error",()=>{if(L+=1,F)F.warn(`Log stream encountered an error, retrying (${L}/${M})...`);else if(!$)console.warn(`Log stream encountered an error, retrying (${L}/${M})...`);if(!B&&L>=M){if(B=!0,F)F.warn("Log stream retry limit reached. Falling back to status checks.");else if(!$)T.warn("Log stream retry limit reached. Falling back to status checks.");if(Z)Z();A(null)}}),R.addEventListener("close",()=>{if(w)return;if(G){A(G);return}if(F)F.warn("Log stream closed, waiting for reconnect...");else if(!$)T.warn("Log stream closed, waiting for reconnect...")})})};try{let H=await U();if(H||G)return H||G}catch(H){if(F)F.warn(`Direct log streaming failed${H instanceof Error?`: ${H.message}`:""}`);else if(!$)T.warn(`Direct log streaming failed${H instanceof Error?`: ${H.message}`:""}`)}return G}async function Gv$($,D,Q,X,J,Y,Z=!1,F,G){let W=0;while(W<120){if(F?.aborted)return"cancelled";try{let U=await fetch(`${$}/build/status?job_id=${encodeURIComponent(D)}&app_id=${encodeURIComponent(Q)}&platform=${X}`,{headers:s$({authorization:J}),signal:F});if(!U.ok){G?.warn(`Status check failed: ${U.status}`),await new Promise((O)=>setTimeout(O,5000)),W++;continue}let H=await U.json(),K=H.status?.toLowerCase?.()??"";if(Z)G?.info(`Build status: ${K||H.status}`);if(Nw.has(K))return K;await new Promise((O)=>setTimeout(O,5000)),W++}catch(U){if(F?.aborted)return"cancelled";G?.warn(`Status check error: ${U}`),await new Promise((H)=>setTimeout(H,5000)),W++}}return G?.warn("Build status polling timed out"),"timeout"}async function qv$($,D,Q){let X=new Set,J=new Set,Y=!1,Z=!1;if(D==="ios"){let F=YD($,Q,"App","CapApp-SPM","Package.swift");if(w8(F)){Y=!0;let W=(await Lw(F,"utf-8")).matchAll(/\.package\s*\([^)]*path:\s*["'](?:\.\.[\\/])*node_modules[\\/]([^"']+)["']\s*\)/g);for(let U of W){let H=U[1].replace(/\\/g,"/"),K=H.lastIndexOf("node_modules/");if(K!==-1)H=H.substring(K+13);X.add(H)}}let G=YD($,Q);if(w8(G)){let q=[YD(G,"App","Podfile"),YD(G,"Podfile")];for(let U of yh(G,{withFileTypes:!0}))if(U.isDirectory())q.push(YD(G,U.name,"Podfile"));let W=[...new Set(q)].filter((U)=>w8(U));if(W.length>0)Z=!0;for(let U of W){let K=(await Lw(U,"utf-8")).matchAll(/pod\s+['"][^'"]+['"],\s*:path\s*=>\s*['"](?:\.\.[\\/])+node_modules[\\/]([^'"]+)['"]/g);for(let O of K){let z=O[1],V=z.lastIndexOf("node_modules/");if(V!==-1)z=z.substring(V+13);X.add(z)}}}}else if(D==="android"){let F=YD($,Q,"capacitor.settings.gradle");if(w8(F)){let W=(await Lw(F,"utf-8")).matchAll(/new\s+File\s*\(\s*['"]\.\.[\\/]node_modules[\\/]([^'"]+)['"]\s*\)/g);for(let U of W){let H=U[1].replace(/\\/g,"/"),K=H.lastIndexOf("node_modules/");if(K!==-1)H=H.substring(K+13);let O=H.replace(/\/(android|capacitor)$/,"");X.add(O)}}let G=YD($,Q,"capacitor-cordova-android-plugins","build.gradle");if(w8(G)){let W=(await Lw(G,"utf-8")).matchAll(/apply\s+from\s*:\s*["'](?:\.\.\/)+node_modules\/([^"']+)["']/g);for(let U of W){let H=U[1],K=H.lastIndexOf("node_modules/");if(K!==-1)H=H.substring(K+13);let O=H.split("/"),z=O[0].startsWith("@")&&O.length>=2?`${O[0]}/${O[1]}`:O[0];J.add(z)}}}return{packages:X,cordovaPackages:J,usesSPM:Y,usesCocoaPods:Z}}function Wv$($,D){let Q=YD($,D,"App");if(w8(YD(Q,"Podfile")))return"cocoapods";if(w8(YD(Q,"CapApp-SPM","Package.swift")))return"spm";return}function Oj0($,D,Q,X){let J=$.replace(/\\/g,"/");if(J.startsWith(`${X}/`))return!0;if(J==="package.json"||J==="package-lock.json"||J.startsWith("capacitor.config."))return!0;if(J.startsWith("resources/"))return!0;if(D==="ios"&&J.startsWith("node_modules/@capacitor/ios/"))return!0;if(D==="android"&&J.startsWith("node_modules/@capacitor/android/"))return!0;if(D==="android")for(let Y of Q.cordovaPackages){let Z=`node_modules/${Y}/`;if(J===`node_modules/${Y}/package.json`)return!0;if(J.startsWith(Z)){let F=J.slice(Z.length);if(F==="node_modules"||F.startsWith("node_modules/"))continue;return!0}}for(let Y of Q.packages){let Z=`node_modules/${Y}/`;if(J===`${Z}package.json`)return!0;if(D==="android"){if(J.startsWith(`${Z}android/`))return!0}else if(D==="ios"){if(J.startsWith(`${Z}ios/`))return!0;if(Q.usesSPM){if(J===`${Z}Package.swift`)return!0}if(Q.usesCocoaPods||!Q.usesSPM){if(J.startsWith(Z)&&J.endsWith(".podspec"))return!0}}}return!1}function QK($,D,Q,X,J,Y){let Z=yh(D);for(let F of Z){let G=YD(D,F),q=Q?`${Q}/${F}`:F,W=n_$(G);if(W.isDirectory()){if(F===".git"||F==="dist"||F==="build"||F===".angular"||F===".vite"||F===".gradle"||F===".idea"||F===".swiftpm")continue;if(F==="node_modules"){QK($,G,q,X,J,Y);continue}if(F==="resources"){QK($,G,q,X,J,Y);continue}let U=q.replace(/\\/g,"/"),H=[...J.packages,...J.cordovaPackages];if(Oj0(q,X,J,Y)||Y===U||Y.startsWith(`${U}/`)||H.some((O)=>{return`node_modules/${O}/`.startsWith(`${U}/`)||U.startsWith(`node_modules/${O}`)}))QK($,G,q,X,J,Y)}else if(W.isFile()){if(F===".DS_Store"||F.endsWith(".log"))continue;if(Oj0(q,X,J,Y))Uv$($,G,q)}}}function Uv$($,D,Q){let X=Q.replace(/\\/g,"/");if($.getEntry(X))return;let J=X.lastIndexOf("/"),Y=J===-1?void 0:X.slice(0,J);$.addLocalFile(D,Y)}function Hv$($){if(!$)return[];let D=$.split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>kh(Q));return[...new Set(D)]}function Kv$($,D){let Q=new Set([...D.packages,...D.cordovaPackages]);return Q.add($==="ios"?"@capacitor/ios":"@capacitor/android"),Q}function Ov$($,D){let Q=YD($,...D.split("/"));if(w8(Q))return Q;let X=YD($,".pnpm");if(!w8(X))return;let J=D.replace("/","+"),Y=yh(X,{withFileTypes:!0}).filter((Z)=>Z.isDirectory()).map((Z)=>Z.name).filter((Z)=>Z.startsWith(`${J}@`)).sort();if(Y.length>1)throw Error(`Multiple pnpm store entries found for ${D} in ${X}; provide the app-specific node_modules path so the native build archive can use the exact resolved package.`);for(let Z of Y){let F=YD(X,Z,"node_modules",...D.split("/"));if(w8(F))return F}return}function zv$($,D,Q,X,J){if(D.length===0)return;let Y=D.filter((Z)=>!w8(Z));if(Y.length>0)throw Error(`Missing node_modules folder at ${Y.join(", ")}`);for(let Z of D)for(let F of Kv$(Q,X)){let G=Ov$(Z,F);if(!G)continue;QK($,G,`node_modules/${F}`,Q,X,J)}}async function Vv$($,D,Q,X,J={}){let Y=OJ(X,Q),Z=await qv$($,Q,Y),F=new zj0.default;QK(F,$,"",Q,Z,Y),zv$(F,Hv$(J.nodeModules),Q,Z,Y);let G=/node_modules\/\.pnpm\/[^/\n\r]+(?:\/[^/\n\r]+)*\/node_modules\//g,q=/node_modules\/\.bun\/[^/\n\r]+(?:\/[^/\n\r]+)*\/node_modules\//g,W=new Set(["",".gradle",".swift",".json",".lock",".xml",".properties",".pbxproj",".xcconfig",".plist",".podspec",".rb",".yaml",".yml"]);for(let H of F.getEntries()){if(H.isDirectory)continue;let K=H.entryName.includes(".")?`.${H.entryName.split(".").pop()}`:"",O=H.entryName.split("/").pop()||"";if(!W.has(K)&&O!=="Podfile")continue;let z=H.getData().toString("utf-8"),V=dz0(z);if(V=V.replace(G,"node_modules/").replace(q,"node_modules/"),Q==="ios"){let N="../".repeat(H.entryName.split("/").length-1);V=V.replace(/(?:\.\.\/){4,}(ios\/|node_modules\/)/g,(w,M)=>`${N}${M}`)}if(V!==z)F.updateFile(H.entryName,qj0.from(V,"utf-8"))}let U=YD($,"capacitor.config.json");if(X&&!w8(U)){let H=`${JSON.stringify(X,null,2)}
|
|
623
623
|
`;F.addFile("capacitor.config.json",qj0.from(H,"utf-8"))}await o_$(D,F.toBuffer())}function Mv$($){let D=$.trim().replace(/^xcode\s*/i,"");return/^\d{1,3}(?:\.\d{1,3}){0,2}$/.test(D)?D:void 0}var Lv$=new Set(["CAPGO_IOS_SCHEME","CAPGO_IOS_TARGET","CAPGO_IOS_DISTRIBUTION","CAPGO_IOS_XCODE_VERSION","BUILD_OUTPUT_UPLOAD_ENABLED","BUILD_OUTPUT_RETENTION_SECONDS","SKIP_BUILD_NUMBER_BUMP","SKIP_MARKETING_VERSION_BUMP","CAPGO_STORE_SUBMIT_REVIEW","CAPGO_STORE_RELEASE_NAME","CAPGO_STORE_RELEASE_NOTES","CAPGO_STORE_RELEASE_NOTES_LOCALIZED","CAPGO_IOS_AUTOMATIC_RELEASE","CAPGO_IOS_TESTFLIGHT_GROUPS","CAPGO_IOS_SOURCE_DIR","CAPGO_IOS_APP_DIR","CAPGO_IOS_PROJECT_DIR","IOS_PROJECT_DIR","CAPGO_ANDROID_SOURCE_DIR","CAPGO_ANDROID_APP_DIR","CAPGO_ANDROID_PROJECT_DIR","ANDROID_PROJECT_DIR","CAPGO_ANDROID_FLAVOR"]);function Nv$($){if(!$||$.length===0)return;let D={};for(let Q of $){let X=Q.indexOf("=");if(X<=0)throw Error('--store-release-notes-locale must use locale=notes format, for example: --store-release-notes-locale en-US="Bug fixes"');let J=Q.slice(0,X).trim(),Y=Q.slice(X+1).trim();if(!J||!Y)throw Error("--store-release-notes-locale requires both a locale and non-empty release notes");D[J]=Y}return Object.keys(D).length>0?D:void 0}function ww($){let D=$?.trim();if(!D)return;let Q;try{Q=JSON.parse(D)}catch(J){throw Error(`CAPGO_STORE_RELEASE_NOTES_LOCALIZED must be valid JSON: ${J instanceof Error?J.message:String(J)}`)}if(!Q||typeof Q!=="object"||Array.isArray(Q))throw Error('CAPGO_STORE_RELEASE_NOTES_LOCALIZED must be a JSON object like {"en-US":"Bug fixes"}');let X={};for(let[J,Y]of Object.entries(Q)){let Z=J.trim();if(typeof Y!=="string"||!Y.trim())throw Error(`CAPGO_STORE_RELEASE_NOTES_LOCALIZED.${Z||J} must be a non-empty string`);if(!Z)throw Error("CAPGO_STORE_RELEASE_NOTES_LOCALIZED cannot contain an empty locale key");X[Z]=Y.trim()}return Object.keys(X).length>0?X:void 0}function Bv$($,D,Q,X){let J=ww($.CAPGO_STORE_RELEASE_NOTES_LOCALIZED),Y=$.CAPGO_IOS_AUTOMATIC_RELEASE===void 0?void 0:$.CAPGO_IOS_AUTOMATIC_RELEASE==="true",Z={platform:D,buildMode:Q,cliVersion:X,iosScheme:$.CAPGO_IOS_SCHEME,iosTarget:$.CAPGO_IOS_TARGET,iosDistribution:$.CAPGO_IOS_DISTRIBUTION,iosXcodeVersion:D==="ios"?$.CAPGO_IOS_XCODE_VERSION:void 0,iosSourceDir:$.CAPGO_IOS_SOURCE_DIR,iosAppDir:$.CAPGO_IOS_APP_DIR,iosProjectDir:$.CAPGO_IOS_PROJECT_DIR,androidSourceDir:$.CAPGO_ANDROID_SOURCE_DIR,androidAppDir:$.CAPGO_ANDROID_APP_DIR,androidProjectDir:$.CAPGO_ANDROID_PROJECT_DIR,androidFlavor:$.CAPGO_ANDROID_FLAVOR,outputUploadEnabled:$.BUILD_OUTPUT_UPLOAD_ENABLED==="true",outputRetentionSeconds:$.BUILD_OUTPUT_RETENTION_SECONDS?Number.parseInt($.BUILD_OUTPUT_RETENTION_SECONDS,10)||ZJ:ZJ,skipBuildNumberBump:$.SKIP_BUILD_NUMBER_BUMP==="true",skipMarketingVersionBump:$.SKIP_MARKETING_VERSION_BUMP==="true",submitToStoreReview:$.CAPGO_STORE_SUBMIT_REVIEW==="true",storeReleaseName:$.CAPGO_STORE_RELEASE_NAME,storeReleaseNotes:$.CAPGO_STORE_RELEASE_NOTES,storeReleaseNotesLocalized:J,iosTestflightGroups:$.CAPGO_IOS_TESTFLIGHT_GROUPS,iosAutomaticRelease:Y},F={};for(let[G,q]of Object.entries($))if(!Lv$.has(G)&&q!==void 0)F[G]=q;return{buildOptions:Z,buildCredentials:F}}async function Mj0($,D,Q=!1,X){if(!by())oU0($);S4(`build request: started for ${$} (platform ${D.platform??"auto"})`);let J=Date.now(),Y=D.verbose??!1,Z=X||e_$(Q),F=null,G=D.outputRecord?{...Z,customMsg:async(q,W)=>{if(q==="qr_download_link"&&typeof W.url==="string")F=W.url;await Z.customMsg(q,W)}}:Z;try{if(D.prescan===!0){let{validateFlags:$0}=await Promise.resolve().then(() => (xh(),vh));$0({ignoreFatal:D.prescanIgnoreFatal,failOnWarnings:D.failOnWarnings})}D.apikey=D.apikey||y0(Q);let q=kh(D.path||Uj0()),W=await M2(q,()=>M$());if($=aX($,W?.config,"native")||"",!$)throw Error("Missing argument, you need to provide a appId, or be in a capacitor project");let U=await s_$(D.platform,{silent:Q});if(U==="ios"&&D.syncIosVersion){let $0=PK0({path:q});G.info($0.changed?`Synced iOS app version to ${$0.marketingVersion}`:`iOS app version is already ${$0.marketingVersion}`)}if(U==="android"&&D.syncAndroidVersion){let $0=eU0({path:q});G.info($0.changed?`Synced Android app version to ${$0.packageVersion}`:`Android app version is already ${$0.packageVersion}`)}let H=D.supaHost||"https://api.capgo.app",K=await H$(D.apikey,D.supaHost,D.supaAnon),O="";try{O=await _6(D.apikey,$,{supaHost:D.supaHost,supaAnon:D.supaAnon})}catch{}if(G.info(`Requesting native build for ${$}`),G.info(`Platform: ${U}`),G.info(`Project: ${q}`),G.info(`
|
|
624
624
|
\uD83D\uDD12 Security: Credentials are never stored on Capgo servers`),G.info(" They are used only during build and deleted after"),G.info(` Build outputs can optionally be uploaded for time-limited download links
|
|
625
|
-
`),Y)G.info(`API host: ${H}`);let z={},V={...D.storeReleaseNotesLocalized??{},...Nv$(D.storeReleaseNotesLocale)??{}},N=Object.keys(V).length>0;if(D.buildCertificateBase64)z.BUILD_CERTIFICATE_BASE64=D.buildCertificateBase64;if(D.p12Password)z.P12_PASSWORD=D.p12Password;if(D.appleKeyId)z.APPLE_KEY_ID=D.appleKeyId;if(D.appleIssuerId)z.APPLE_ISSUER_ID=D.appleIssuerId;if(D.appleKeyContent)z.APPLE_KEY_CONTENT=D.appleKeyContent;if(D.appStoreConnectTeamId)z.APP_STORE_CONNECT_TEAM_ID=D.appStoreConnectTeamId;if(D.appleId)z.FASTLANE_USER=D.appleId;if(D.appleAppSpecificPassword)z.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD=D.appleAppSpecificPassword;if(D.appleAppId)z.APPLE_APP_ID=D.appleAppId;if(D.iosScheme)z.CAPGO_IOS_SCHEME=D.iosScheme;if(D.iosTarget)z.CAPGO_IOS_TARGET=D.iosTarget;if(D.iosDistribution)z.CAPGO_IOS_DISTRIBUTION=D.iosDistribution;if(D.xcodeVersion)z.CAPGO_IOS_XCODE_VERSION=D.xcodeVersion;if(D.iosProvisioningProfile&&D.iosProvisioningProfile.length>0){let $0=zH0(D.iosProvisioningProfile,kh(D.path||Uj0()));z.CAPGO_IOS_PROVISIONING_MAP=JSON.stringify($0)}if(D.iosProvisioningMap)z.CAPGO_IOS_PROVISIONING_MAP=D.iosProvisioningMap;if(D.androidKeystoreFile)z.ANDROID_KEYSTORE_FILE=D.androidKeystoreFile;if(D.keystoreKeyAlias)z.KEYSTORE_KEY_ALIAS=D.keystoreKeyAlias;let w=!!D.keystoreKeyPassword,M=!!D.keystoreStorePassword;if(w&&!M)z.KEYSTORE_KEY_PASSWORD=D.keystoreKeyPassword,z.KEYSTORE_STORE_PASSWORD=D.keystoreKeyPassword;else if(!w&&M)z.KEYSTORE_KEY_PASSWORD=D.keystoreStorePassword,z.KEYSTORE_STORE_PASSWORD=D.keystoreStorePassword;else if(w&&M)z.KEYSTORE_KEY_PASSWORD=D.keystoreKeyPassword,z.KEYSTORE_STORE_PASSWORD=D.keystoreStorePassword;if(typeof D.androidFlavor==="string"){let $0=D.androidFlavor.trim();if($0)z.CAPGO_ANDROID_FLAVOR=$0}if(D.playConfigJson)z.PLAY_CONFIG_JSON=D.playConfigJson;if(typeof D.androidTrack==="string"&&D.androidTrack.trim())z.PLAY_STORE_TRACK=cy(D.androidTrack);if(typeof D.androidReleaseStatus==="string"&&D.androidReleaseStatus.trim())z.PLAY_STORE_RELEASE_STATUS=ly(D.androidReleaseStatus);if(D.inAppUpdatePriority!==void 0)z.PLAY_STORE_IN_APP_UPDATE_PRIORITY=String(K2(D.inAppUpdatePriority));if(D.outputUpload!==void 0)z.BUILD_OUTPUT_UPLOAD_ENABLED=D8(D.outputUpload)?"true":"false";if(D.outputRetention)z.BUILD_OUTPUT_RETENTION_SECONDS=String(H2(D.outputRetention));if(D.skipBuildNumberBump!==void 0)z.SKIP_BUILD_NUMBER_BUMP=D8(D.skipBuildNumberBump)?"true":"false";if(D.skipMarketingVersionBump!==void 0)z.SKIP_MARKETING_VERSION_BUMP=D8(D.skipMarketingVersionBump)?"true":"false";if(D.submitToStoreReview!==void 0)z.CAPGO_STORE_SUBMIT_REVIEW=D8(D.submitToStoreReview)?"true":"false";if(typeof D.storeReleaseName==="string"&&D.storeReleaseName.trim())z.CAPGO_STORE_RELEASE_NAME=D.storeReleaseName.trim();if(typeof D.storeReleaseNotes==="string"&&D.storeReleaseNotes.trim())z.CAPGO_STORE_RELEASE_NOTES=D.storeReleaseNotes.trim();if(typeof D.iosTestflightGroups==="string"&&D.iosTestflightGroups.trim())z.CAPGO_IOS_TESTFLIGHT_GROUPS=D.iosTestflightGroups.trim();if(D.iosAutomaticRelease!==void 0)z.CAPGO_IOS_AUTOMATIC_RELEASE=D8(D.iosAutomaticRelease)?"true":"false";let L=await z2($,U,Object.keys(z).length>0?z:void 0);if(L&&N){let $0=ww(L.CAPGO_STORE_RELEASE_NOTES_LOCALIZED)??{};L.CAPGO_STORE_RELEASE_NOTES_LOCALIZED=JSON.stringify({...$0,...V})}if(D.playstoreUpload===!1&&L)delete L.PLAY_CONFIG_JSON,G.info("ℹ️ --no-playstore-upload specified, Play Store upload disabled for this build");let B=OJ(W?.config,U);if(L&&B)if(U==="ios")L.CAPGO_IOS_SOURCE_DIR=B,L.CAPGO_IOS_APP_DIR=B,L.CAPGO_IOS_PROJECT_DIR=B,L.IOS_PROJECT_DIR=B;else L.CAPGO_ANDROID_SOURCE_DIR=B,L.CAPGO_ANDROID_APP_DIR=B,L.CAPGO_ANDROID_PROJECT_DIR=B,L.ANDROID_PROJECT_DIR=B;if(!L)throw G.error("❌ No credentials found for this app and platform"),G.error(""),G.error("You must provide credentials via:"),G.error(" 1. CLI arguments (--apple-key-id, --p12-password, etc.)"),G.error(" 2. Environment variables (APPLE_KEY_ID, P12_PASSWORD, etc.)"),G.error(" 3. Saved credentials file:"),G.error(` npx @capgo/cli build credentials save --appId ${$} --platform ${U}`),G.error(""),G.error("Documentation:"),G.error(" https://capgo.app/docs/cli/cloud-build/credentials/"),Error("No credentials found. Please provide credentials before building.");let R=[];if(U==="ios"){let $0=L.CAPGO_IOS_DISTRIBUTION,E0=["app_store","ad_hoc"];if($0&&!E0.includes($0))R.push(`Invalid CAPGO_IOS_DISTRIBUTION value: '${$0}'. Must be one of: ${E0.join(", ")}`);let F0=$0&&E0.includes($0)?$0:"app_store";if(!$0)G.info("ℹ️ --ios-distribution not specified, defaulting to app_store");L.CAPGO_IOS_DISTRIBUTION=F0;let v0=L.CAPGO_IOS_XCODE_VERSION;if(v0!==void 0&&!v0.trim())delete L.CAPGO_IOS_XCODE_VERSION;else if(v0!==void 0){let O0=Mv$(v0);if(O0)L.CAPGO_IOS_XCODE_VERSION=O0,G.info(`ℹ️ Building on a machine with Xcode ${O0}`);else R.push(`Invalid --xcode-version / CAPGO_IOS_XCODE_VERSION value: '${v0}'. Use a version like 26, 26.1 or 16.4.1`)}if(L.CAPGO_STORE_SUBMIT_REVIEW==="true"&&F0!=="app_store")R.push("--submit-to-store-review on iOS requires --ios-distribution app_store");if(!L.BUILD_CERTIFICATE_BASE64)R.push("BUILD_CERTIFICATE_BASE64 (or --build-certificate-base64)");if(!L.P12_PASSWORD)G.warn("⚠️ P12_PASSWORD not provided - assuming certificate has no password"),G.warn(" If your certificate requires a password, provide it with --p12-password");if(!!(L.BUILD_PROVISION_PROFILE_BASE64||L.APPLE_PROFILE_NAME)&&!L.CAPGO_IOS_PROVISIONING_MAP)throw G.error("❌ Legacy provisioning profile format detected. Run:"),G.error(" npx @capgo/cli build credentials migrate --platform ios"),G.error(""),G.error(" This will convert your existing provisioning profile to the new multi-target format."),Error("Legacy provisioning profile format detected. Run: npx @capgo/cli build credentials migrate --platform ios");if(!L.CAPGO_IOS_PROVISIONING_MAP)R.push('CAPGO_IOS_PROVISIONING_MAP (use --ios-provisioning-profile or save via "build credentials save")');if(F0==="app_store"){let O0=!!L.APPLE_KEY_ID,c0=!!L.APPLE_ISSUER_ID,S=!!L.APPLE_KEY_CONTENT,I=O0||c0||S,t=O0&&c0&&S,l=!!L.FASTLANE_USER,A0=!!L.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD,Y0=!!L.APPLE_APP_ID,S$=l||A0||Y0,X$=l&&A0&&Y0;if(L.CAPGO_STORE_SUBMIT_REVIEW==="true"&&!t)R.push("App Store Connect API key (APPLE_KEY_ID/APPLE_ISSUER_ID/APPLE_KEY_CONTENT) is required for --submit-to-store-review on iOS");if(Y0&&!/^\d+$/.test(String(L.APPLE_APP_ID).trim()))R.push("APPLE_APP_ID must be the app's numeric App Store Connect id (digits only, e.g. 1234567890)");if(t);else if(X$){if(G.info("\uD83D\uDD11 Using Apple ID + app-specific password for TestFlight upload (no App Store Connect API key)"),G.info(" Build number will use a timestamp-based fallback (App Store Connect is not queried)"),!D.builderJourneyId)G.warn("⚠️ App-specific password authentication is not recommended; it exists as an Ionic Appflow migration fallback."),G.warn(" Prefer an App Store Connect API key (.p8): https://capgo.app/docs/builder/configuration/")}else if(S$){let z$=[];if(!l)z$.push("FASTLANE_USER (or --apple-id)");if(!A0)z$.push("FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD (or --apple-app-specific-password)");if(!Y0)z$.push("APPLE_APP_ID (or --apple-app-id)");R.push(`Incomplete app-specific password credentials - missing: ${z$.join(", ")}`)}else if(I){let z$=[];if(!O0)z$.push("APPLE_KEY_ID (or --apple-key-id)");if(!c0)z$.push("APPLE_ISSUER_ID (or --apple-issuer-id)");if(!S)z$.push("APPLE_KEY_CONTENT (or --apple-key-content)");R.push(`Incomplete App Store Connect API key - missing: ${z$.join(", ")}`)}else if(L.BUILD_OUTPUT_UPLOAD_ENABLED!=="true")R.push("App Store Connect API key (APPLE_KEY_ID/APPLE_ISSUER_ID/APPLE_KEY_CONTENT) or app-specific password (FASTLANE_USER + FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD + APPLE_APP_ID) or BUILD_OUTPUT_UPLOAD_ENABLED=true (or --output-upload) (build has no output destination - enable either TestFlight upload or Capgo download link)");else if(L.SKIP_BUILD_NUMBER_BUMP!=="true"||L.SKIP_MARKETING_VERSION_BUMP!=="true")R.push("App Store Connect API key (APPLE_KEY_ID/APPLE_ISSUER_ID/APPLE_KEY_CONTENT) or app-specific password or --skip-build-number-bump and --skip-marketing-version-bump (iOS versions cannot be auto-incremented without App Store Connect credentials)");else G.warn("⚠️ No App Store Connect API key or app-specific password provided - build will succeed but cannot auto-upload to TestFlight")}else if(F0==="ad_hoc")G.info("\uD83D\uDCE6 Ad-hoc distribution mode: App Store Connect API key not required"),G.info(" Build number will use timestamp-based fallback");if(!L.APP_STORE_CONNECT_TEAM_ID)R.push("APP_STORE_CONNECT_TEAM_ID (or --app-store-connect-team-id)")}else if(U==="android"){if(!L.ANDROID_KEYSTORE_FILE)R.push("ANDROID_KEYSTORE_FILE (or --android-keystore-file)");if(!L.KEYSTORE_KEY_ALIAS)R.push("KEYSTORE_KEY_ALIAS (or --keystore-key-alias)");if(!L.KEYSTORE_KEY_PASSWORD&&!L.KEYSTORE_STORE_PASSWORD)R.push("KEYSTORE_KEY_PASSWORD or KEYSTORE_STORE_PASSWORD (at least one password required)");if(!L.PLAY_CONFIG_JSON)if(L.CAPGO_STORE_SUBMIT_REVIEW==="true")R.push("PLAY_CONFIG_JSON is required for --submit-to-store-review on Android");else if(L.BUILD_OUTPUT_UPLOAD_ENABLED!=="true")R.push("PLAY_CONFIG_JSON or BUILD_OUTPUT_UPLOAD_ENABLED=true (build has no output destination - enable either Play Store upload or Capgo download link)");else G.warn("⚠️ PLAY_CONFIG_JSON not provided - build will succeed but cannot auto-upload to Play Store")}if(R.length>0){G.error(`❌ Missing required credentials for ${U}:`),G.error("");for(let $0 of R)G.error(` • ${$0}`);throw G.error(""),G.error("Provide credentials via:"),G.error(` 1. CLI arguments: npx @capgo/cli build request --platform ${U} ${U==="ios"?'--apple-key-id "..." --apple-issuer-id "..." --apple-key-content "..."':'--android-keystore-file "..." --keystore-key-alias "..."'}`),G.error(` 2. Environment variables: ${U==="ios"?'export APPLE_KEY_ID="..." APPLE_ISSUER_ID="..." APPLE_KEY_CONTENT="..."':'export ANDROID_KEYSTORE_FILE="..." KEYSTORE_KEY_ALIAS="..."'}`),G.error(` 3. Saved credentials: npx @capgo/cli build credentials save --platform ${U} ...`),G.error(""),G.error("Documentation:"),G.error(` https://capgo.app/docs/cli/cloud-build/${U}/`),Error(`Missing required credentials for ${U}: ${R.join(", ")}`)}if(!D.buildMode)G.info("ℹ️ --build-mode not specified, defaulting to release");if(!L.BUILD_OUTPUT_UPLOAD_ENABLED)G.info("ℹ️ --output-upload not specified, defaulting to false (no Capgo download link)");if(!L.BUILD_OUTPUT_RETENTION_SECONDS)G.info(`ℹ️ --output-retention not specified, defaulting to ${ZJ}s (1 hour)`);let _=U==="ios"&&!(L.APPLE_KEY_ID&&L.APPLE_ISSUER_ID&&L.APPLE_KEY_CONTENT);if(!L.SKIP_BUILD_NUMBER_BUMP&&!_)G.info("ℹ️ --skip-build-number-bump not specified, build number will be auto-incremented (default)");if(!L.SKIP_MARKETING_VERSION_BUMP&&U==="ios"&&!_)G.info("ℹ️ --skip-marketing-version-bump not specified, marketing version will be auto-bumped when already released (default)");let{buildOptions:v,buildCredentials:j}=Bv$(L,U,D.buildMode||"release",Q6.version),k=U==="ios"?Wv$(q,B):void 0,x={app_id:$,platform:U,build_mode:D.buildMode||"release",build_options:v,build_credentials:j,...k?{ios_dependency_manager:k}:{},...Kj0({cache:D.cache,cacheKey:D.cacheKey})};if(D.cache===!1)G.info(`ℹ️ --no-cache specified, compilation cache disabled for this ${U} build`);else if(D.cacheKey?.trim())G.info(`ℹ️ --cache-key "${D.cacheKey.trim()}" specified for this ${U} build`);if(G.info("✓ Using credentials (merged from CLI args, env vars, and saved file)"),Y){let $0=Object.keys(j);G.info(`Credentials provided: ${$0.join(", ")}`),G.info(`Build options: platform=${v.platform}, mode=${v.buildMode}, cliVersion=${v.cliVersion}`)}if(D.prescan===!0){let{executePrescan:$0,runPrescanGate:E0}=await Promise.resolve().then(() => (xh(),vh)),{enforcedCounts:F0}=await Promise.resolve().then(() => sz0),{decision:v0,report:O$,crashed:O0,informationOnlyFindings:c0}=await E0({enabled:!0,ignoreFatal:D.prescanIgnoreFatal,failOnWarnings:D.failOnWarnings,silent:Q,print:(S)=>G.info(S),warn:(S)=>G.warn(S)},async()=>(await $0($,{platform:U,path:q,apikey:D.apikey,credentials:L,androidFlavor:D.androidFlavor,iosDist:D.iosDistribution,skip:D.prescanSkip,warn:D.prescanWarn,supaHost:D.supaHost,supaAnon:D.supaAnon})).report);{let S=O$?.counts,I=O$?F0(O$):void 0,t=O0?"crashed":!S?"skipped":v0==="block"?"blocked":D.prescanIgnoreFatal&&(I?.error??S.error)>0?"bypassed":c0>0?"information-only":(I?.warning??S.warning)>0?"warned":"clean";await $$(D.apikey,{channel:"native-builder",event:"Prescan run",org_id:O,tracking_version:2,tags:{source:"build-request",result:t,"app-id":$,platform:U,errors:String(S?.error??0),warnings:String(S?.warning??0),"finding-ids":O$?O$.findings.filter((l)=>l.severity!=="info").map((l)=>l.id).join(",").slice(0,200):"",bypassed:String(t==="bypassed"),"information-only-findings":String(c0)}}).catch(()=>{})}if(v0==="block")throw Error("Prescan found blocking problems — the build was not requested and nothing was uploaded. Fix the errors above or re-run with --prescan-ignore-fatal / --no-prescan.")}await BU(K,D.apikey,"app.build_native",{appId:$},{message:`Capgo rejected this API key: missing app.build_native permission for app ${$}.`,silent:Q}),G.info("Requesting build from Capgo...");let m=3,n=await Dv$(`${H}/build/request`,{method:"POST",headers:s$({"Content-Type":"application/json",authorization:D.apikey}),body:JSON.stringify(x)},m,G);if(!n.ok){let $0=await n.text();if(await Hj0(n.status,$0,"request",G),$0.includes("build_machine_version_unavailable")){let F0=$0;try{F0=JSON.parse($0).message||$0}catch{}throw Error(`${F0} Change or drop --xcode-version.`)}let E0=n.status===401||n.status===403||/invalid_apikey|unauthorized|no_key_provided|invalid_jwt|no_jwt/i.test($0);throw Error(E0?`Capgo rejected the build request (HTTP ${n.status}): ${$0}`:`Capgo build request failed (HTTP ${n.status}): ${$0}`)}let o=await n.json();if(G.success(`Build job created: ${o.job_id}`),G.info(`Status: ${o.status}`),Y)G.info(`Upload URL: ${o.upload_url}`),G.info(`Upload expires: ${o.upload_expires_at}`);let h=D.aiAnalysisMode??"auto-prompt",A=D.sendLogsToSupport===!0||D.sendLogs===!0,P=(AU0()||D.aiAnalytics===!0||A||h==="caller-handled")&&h!=="skip",y=null,g=!1,c;if(P&&o.job_id)y=o.job_id,await IU0(o.job_id),PU0(o.job_id,()=>g);let d={...G,buildLog:($0)=>{if(G.buildLog($0),P&&y)TU0(y,$0)}};await $$(D.apikey,{channel:"native-builder",event:"Build requested",org_id:O,tracking_version:2,tags:{"app-id":$,platform:U,...D.builderJourneyId?{journey_id:D.builderJourneyId}:{}}}).catch();let q0=YD(t_$(),`capgo-build-${Date.now()}`);await i_$(q0,{recursive:!0});let s=YD(q0,`${Wj0(q)}.zip`);try{G.info(`Zipping ${U} project from ${q}...`),await Vv$(q,s,U,W?.config,{nodeModules:D.nodeModules});let $0=await r_$(s),E0=($0.size/1024/1024).toFixed(2);if(G.success(`Created zip: ${s} (${E0} MB)`),G.info("Uploading to builder..."),Y)G.info(`Upload endpoint: ${o.upload_url}`),G.info(`File size: ${E0} MB`),G.info(`Job ID: ${o.job_id}`);let F0=l_$(s);G.uploadProgress(0);let v0=Date.now(),O$=D.buildMode||"release";r2({apikey:D.apikey,appId:$,orgId:O,platform:U,buildMode:O$,jobId:o.job_id,sizeBytes:$0.size,phase:"started"}),await new Promise((X$,z$)=>{let P0=new Bw.Upload(F0,{endpoint:o.upload_url,chunkSize:5242880,retryDelays:[...ZF],metadata:{filename:Wj0(s),filetype:"application/zip"},headers:s$({authorization:D.apikey}),onBeforeRequest(p0){if(Y){G.info(`[TUS] ${p0.getMethod()} ${p0.getURL()}`);let V$=p0.getHeader("authorization");G.info(`[TUS] Authorization header present: ${!!V$}`)}},onAfterResponse(p0,V$){if(Y){G.info(`[TUS] Response status: ${V$.getStatus()}`);let l$=V$.getHeader("upload-offset"),N0=V$.getHeader("tus-resumable");G.info(`[TUS] Upload-Offset: ${l$}, Tus-Resumable: ${N0}`)}},async onError(p0){if(await r2({apikey:D.apikey,appId:$,orgId:O,platform:U,buildMode:O$,jobId:o.job_id,sizeBytes:$0.size,phase:"failed",durationSeconds:(Date.now()-v0)/1000,error:p0}),G.error(`Upload error: ${p0.message}`),p0 instanceof Bw.DetailedError){let V$=p0.originalResponse?.getBody(),l$=p0.originalResponse?.getStatus(),N0=p0.originalRequest?.getURL();if(Y)G.error(`[TUS] Request URL: ${N0}`),G.error(`[TUS] Response status: ${l$}`),G.error(`[TUS] Response body: ${V$}`);let n0=(()=>{try{let d$=JSON.parse(V$||'{"error": "unknown error"}');return d$.status||d$.error||d$.message||"unknown error"}catch{return V$||p0.message}})();z$(Error(`TUS upload failed: ${n0}`))}else z$(Error(`TUS upload failed: ${p0.message||p0.toString()}`))},onProgress(p0,V$){let l$=Number.parseFloat((p0/V$*100).toFixed(2));G.uploadProgress(l$)},onSuccess(){if(r2({apikey:D.apikey,appId:$,orgId:O,platform:U,buildMode:O$,jobId:o.job_id,sizeBytes:$0.size,phase:"succeeded",durationSeconds:(Date.now()-v0)/1000}),G.uploadProgress(100),Y)G.success("TUS upload completed successfully");X$()}});if(Y)G.info("[TUS] Starting upload...");P0.start()}),G.info("Starting build job...");let O0=await fetch(`${H}/build/start/${o.job_id}`,{method:"POST",headers:s$({"Content-Type":"application/json",authorization:D.apikey}),body:JSON.stringify({app_id:$,...Kj0({cache:D.cache,cacheKey:D.cacheKey})})});if(!O0.ok){let X$=await O0.text();throw await Hj0(O0.status,X$,"start",G),Error(`Failed to start build: ${O0.status} - ${X$}`)}let c0=await O0.json();G.success("Build started!"),G.info("Streaming build logs...");let S=new AbortController,I=DH0({requestCancellation:()=>$H0({url:`${H}/build/cancel/${o.job_id}`,headers:s$({"Content-Type":"application/json",authorization:D.apikey}),appId:$}),onCancellationStarted:()=>{G.warn("Canceling build... (press Ctrl+C again to force quit)")},onCancellationResult:(X$)=>{if(X$.ok){G.success("Build cancellation requested.");return}S4(X$.message),G.warn(`${X$.message}. The remote build may still be running.`)},abortLogStream:()=>S.abort(),forceExit:(X$)=>D6.exit(X$)});D6.on("SIGINT",I);let t,l=!1,A0=async()=>{try{let X$=await fetch(`${H}/build/status?job_id=${encodeURIComponent(o.job_id)}&app_id=${encodeURIComponent($)}&platform=${U}`,{headers:s$({authorization:D.apikey})});if(!X$.ok)return null;let z$=await X$.json(),P0=z$.status?.toLowerCase?.()??"";if(l)G.info(`Build status: ${P0||z$.status}`);if(Nw.has(P0))return P0;return null}catch{return null}},Y0=null;try{Y0=await Fv$(Q,Y,c0.logs_url,c0.logs_token,A0,S.signal,()=>{l=!0},Q&&!X&&!D.outputRecord?void 0:d)}finally{D6.removeListener("SIGINT",I)}if(Y0){if(t=Y0,Nw.has(Y0))await A0().catch(()=>{})}else t=await Gv$(H,o.job_id,$,U,D.apikey,Q,l,S.signal,G);if(t==="succeeded")G.success("Build completed successfully!");else if(t==="failed"){if(G.error("Build failed"),Xv$({cache:D.cache,cacheKey:D.cacheKey,aiAnalysisMode:h}))G.info(Qv$);if(kU0({isTTY:D6.stdout.isTTY===!0,aiAnalytics:D.aiAnalytics===!0,sendLogs:A}))D6.stderr.write(`${Sy}
|
|
625
|
+
`),Y)G.info(`API host: ${H}`);let z={},V={...D.storeReleaseNotesLocalized??{},...Nv$(D.storeReleaseNotesLocale)??{}},N=Object.keys(V).length>0;if(D.buildCertificateBase64)z.BUILD_CERTIFICATE_BASE64=D.buildCertificateBase64;if(D.p12Password)z.P12_PASSWORD=D.p12Password;if(D.appleKeyId)z.APPLE_KEY_ID=D.appleKeyId;if(D.appleIssuerId)z.APPLE_ISSUER_ID=D.appleIssuerId;if(D.appleKeyContent)z.APPLE_KEY_CONTENT=D.appleKeyContent;if(D.appStoreConnectTeamId)z.APP_STORE_CONNECT_TEAM_ID=D.appStoreConnectTeamId;if(D.appleId)z.FASTLANE_USER=D.appleId;if(D.appleAppSpecificPassword)z.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD=D.appleAppSpecificPassword;if(D.appleAppId)z.APPLE_APP_ID=D.appleAppId;if(D.iosScheme)z.CAPGO_IOS_SCHEME=D.iosScheme;if(D.iosTarget)z.CAPGO_IOS_TARGET=D.iosTarget;if(D.iosDistribution)z.CAPGO_IOS_DISTRIBUTION=D.iosDistribution;if(D.xcodeVersion)z.CAPGO_IOS_XCODE_VERSION=D.xcodeVersion;if(D.iosProvisioningProfile&&D.iosProvisioningProfile.length>0){let $0=zH0(D.iosProvisioningProfile,kh(D.path||Uj0()));z.CAPGO_IOS_PROVISIONING_MAP=JSON.stringify($0)}if(D.iosProvisioningMap)z.CAPGO_IOS_PROVISIONING_MAP=D.iosProvisioningMap;if(D.androidKeystoreFile)z.ANDROID_KEYSTORE_FILE=D.androidKeystoreFile;if(D.keystoreKeyAlias)z.KEYSTORE_KEY_ALIAS=D.keystoreKeyAlias;let w=!!D.keystoreKeyPassword,M=!!D.keystoreStorePassword;if(w&&!M)z.KEYSTORE_KEY_PASSWORD=D.keystoreKeyPassword,z.KEYSTORE_STORE_PASSWORD=D.keystoreKeyPassword;else if(!w&&M)z.KEYSTORE_KEY_PASSWORD=D.keystoreStorePassword,z.KEYSTORE_STORE_PASSWORD=D.keystoreStorePassword;else if(w&&M)z.KEYSTORE_KEY_PASSWORD=D.keystoreKeyPassword,z.KEYSTORE_STORE_PASSWORD=D.keystoreStorePassword;if(typeof D.androidFlavor==="string"){let $0=D.androidFlavor.trim();if($0)z.CAPGO_ANDROID_FLAVOR=$0}if(D.playConfigJson)z.PLAY_CONFIG_JSON=D.playConfigJson;if(typeof D.androidTrack==="string"&&D.androidTrack.trim())z.PLAY_STORE_TRACK=cy(D.androidTrack);if(typeof D.androidReleaseStatus==="string"&&D.androidReleaseStatus.trim())z.PLAY_STORE_RELEASE_STATUS=ly(D.androidReleaseStatus);if(D.inAppUpdatePriority!==void 0)z.PLAY_STORE_IN_APP_UPDATE_PRIORITY=String(K2(D.inAppUpdatePriority));if(D.outputUpload!==void 0)z.BUILD_OUTPUT_UPLOAD_ENABLED=D8(D.outputUpload)?"true":"false";if(D.outputRetention)z.BUILD_OUTPUT_RETENTION_SECONDS=String(H2(D.outputRetention));if(D.skipBuildNumberBump!==void 0)z.SKIP_BUILD_NUMBER_BUMP=D8(D.skipBuildNumberBump)?"true":"false";if(D.skipMarketingVersionBump!==void 0)z.SKIP_MARKETING_VERSION_BUMP=D8(D.skipMarketingVersionBump)?"true":"false";if(D.submitToStoreReview!==void 0)z.CAPGO_STORE_SUBMIT_REVIEW=D8(D.submitToStoreReview)?"true":"false";if(typeof D.storeReleaseName==="string"&&D.storeReleaseName.trim())z.CAPGO_STORE_RELEASE_NAME=D.storeReleaseName.trim();if(typeof D.storeReleaseNotes==="string"&&D.storeReleaseNotes.trim())z.CAPGO_STORE_RELEASE_NOTES=D.storeReleaseNotes.trim();if(typeof D.iosTestflightGroups==="string"&&D.iosTestflightGroups.trim())z.CAPGO_IOS_TESTFLIGHT_GROUPS=D.iosTestflightGroups.trim();if(D.iosAutomaticRelease!==void 0)z.CAPGO_IOS_AUTOMATIC_RELEASE=D8(D.iosAutomaticRelease)?"true":"false";let L=await z2($,U,Object.keys(z).length>0?z:void 0);if(L&&N){let $0=ww(L.CAPGO_STORE_RELEASE_NOTES_LOCALIZED)??{};L.CAPGO_STORE_RELEASE_NOTES_LOCALIZED=JSON.stringify({...$0,...V})}if(D.playstoreUpload===!1&&L)delete L.PLAY_CONFIG_JSON,G.info("ℹ️ --no-playstore-upload specified, Play Store upload disabled for this build");let B=OJ(W?.config,U);if(L&&B)if(U==="ios")L.CAPGO_IOS_SOURCE_DIR=B,L.CAPGO_IOS_APP_DIR=B,L.CAPGO_IOS_PROJECT_DIR=B,L.IOS_PROJECT_DIR=B;else L.CAPGO_ANDROID_SOURCE_DIR=B,L.CAPGO_ANDROID_APP_DIR=B,L.CAPGO_ANDROID_PROJECT_DIR=B,L.ANDROID_PROJECT_DIR=B;if(!L)throw G.error("❌ No credentials found for this app and platform"),G.error(""),G.error("You must provide credentials via:"),G.error(" 1. CLI arguments (--apple-key-id, --p12-password, etc.)"),G.error(" 2. Environment variables (APPLE_KEY_ID, P12_PASSWORD, etc.)"),G.error(" 3. Saved credentials file:"),G.error(` npx @capgo/cli build credentials save --appId ${$} --platform ${U}`),G.error(""),G.error("Documentation:"),G.error(" https://capgo.app/docs/cli/cloud-build/credentials/"),Error("No credentials found. Please provide credentials before building.");let R=[];if(U==="ios"){let $0=L.CAPGO_IOS_DISTRIBUTION,E0=["app_store","ad_hoc"];if($0&&!E0.includes($0))R.push(`Invalid CAPGO_IOS_DISTRIBUTION value: '${$0}'. Must be one of: ${E0.join(", ")}`);let F0=$0&&E0.includes($0)?$0:"app_store";if(!$0)G.info("ℹ️ --ios-distribution not specified, defaulting to app_store");L.CAPGO_IOS_DISTRIBUTION=F0;let v0=L.CAPGO_IOS_XCODE_VERSION;if(v0!==void 0&&!v0.trim())delete L.CAPGO_IOS_XCODE_VERSION;else if(v0!==void 0){let O0=Mv$(v0);if(O0)L.CAPGO_IOS_XCODE_VERSION=O0,G.info(`ℹ️ Building on a machine with Xcode ${O0}`);else R.push(`Invalid --xcode-version / CAPGO_IOS_XCODE_VERSION value: '${v0}'. Use a version like 26, 26.1 or 16.4.1`)}if(L.CAPGO_STORE_SUBMIT_REVIEW==="true"&&F0!=="app_store")R.push("--submit-to-store-review on iOS requires --ios-distribution app_store");if(!L.BUILD_CERTIFICATE_BASE64)R.push("BUILD_CERTIFICATE_BASE64 (or --build-certificate-base64)");if(!L.P12_PASSWORD)G.warn("⚠️ P12_PASSWORD not provided - assuming certificate has no password"),G.warn(" If your certificate requires a password, provide it with --p12-password");if(!!(L.BUILD_PROVISION_PROFILE_BASE64||L.APPLE_PROFILE_NAME)&&!L.CAPGO_IOS_PROVISIONING_MAP)throw G.error("❌ Legacy provisioning profile format detected. Run:"),G.error(" npx @capgo/cli build credentials migrate --platform ios"),G.error(""),G.error(" This will convert your existing provisioning profile to the new multi-target format."),Error("Legacy provisioning profile format detected. Run: npx @capgo/cli build credentials migrate --platform ios");if(!L.CAPGO_IOS_PROVISIONING_MAP)R.push('CAPGO_IOS_PROVISIONING_MAP (use --ios-provisioning-profile or save via "build credentials save")');if(F0==="app_store"){let O0=!!L.APPLE_KEY_ID,c0=!!L.APPLE_ISSUER_ID,S=!!L.APPLE_KEY_CONTENT,I=O0||c0||S,t=O0&&c0&&S,l=!!L.FASTLANE_USER,A0=!!L.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD,Y0=!!L.APPLE_APP_ID,S$=l||A0||Y0,X$=l&&A0&&Y0;if(L.CAPGO_STORE_SUBMIT_REVIEW==="true"&&!t)R.push("App Store Connect API key (APPLE_KEY_ID/APPLE_ISSUER_ID/APPLE_KEY_CONTENT) is required for --submit-to-store-review on iOS");if(Y0&&!/^\d+$/.test(String(L.APPLE_APP_ID).trim()))R.push("APPLE_APP_ID must be the app's numeric App Store Connect id (digits only, e.g. 1234567890)");if(t);else if(X$){if(G.info("\uD83D\uDD11 Using Apple ID + app-specific password for TestFlight upload (no App Store Connect API key)"),G.info(" Build number will use a timestamp-based fallback (App Store Connect is not queried)"),!D.builderJourneyId)G.warn("⚠️ App-specific password authentication is not recommended; it exists as an Ionic Appflow migration fallback."),G.warn(" Prefer an App Store Connect API key (.p8): https://capgo.app/docs/builder/configuration/")}else if(S$){let z$=[];if(!l)z$.push("FASTLANE_USER (or --apple-id)");if(!A0)z$.push("FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD (or --apple-app-specific-password)");if(!Y0)z$.push("APPLE_APP_ID (or --apple-app-id)");R.push(`Incomplete app-specific password credentials - missing: ${z$.join(", ")}`)}else if(I){let z$=[];if(!O0)z$.push("APPLE_KEY_ID (or --apple-key-id)");if(!c0)z$.push("APPLE_ISSUER_ID (or --apple-issuer-id)");if(!S)z$.push("APPLE_KEY_CONTENT (or --apple-key-content)");R.push(`Incomplete App Store Connect API key - missing: ${z$.join(", ")}`)}else if(L.BUILD_OUTPUT_UPLOAD_ENABLED!=="true")R.push("App Store Connect API key (APPLE_KEY_ID/APPLE_ISSUER_ID/APPLE_KEY_CONTENT) or app-specific password (FASTLANE_USER + FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD + APPLE_APP_ID) or BUILD_OUTPUT_UPLOAD_ENABLED=true (or --output-upload) (build has no output destination - enable either TestFlight upload or Capgo download link)");else if(L.SKIP_BUILD_NUMBER_BUMP!=="true"||L.SKIP_MARKETING_VERSION_BUMP!=="true")R.push("App Store Connect API key (APPLE_KEY_ID/APPLE_ISSUER_ID/APPLE_KEY_CONTENT) or app-specific password or --skip-build-number-bump and --skip-marketing-version-bump (iOS versions cannot be auto-incremented without App Store Connect credentials)");else G.warn("⚠️ No App Store Connect API key or app-specific password provided - build will succeed but cannot auto-upload to TestFlight")}else if(F0==="ad_hoc")G.info("\uD83D\uDCE6 Ad-hoc distribution mode: App Store Connect API key not required"),G.info(" Build number will use timestamp-based fallback");if(!L.APP_STORE_CONNECT_TEAM_ID)R.push("APP_STORE_CONNECT_TEAM_ID (or --app-store-connect-team-id)")}else if(U==="android"){if(!L.ANDROID_KEYSTORE_FILE)R.push("ANDROID_KEYSTORE_FILE (or --android-keystore-file)");if(!L.KEYSTORE_KEY_ALIAS)R.push("KEYSTORE_KEY_ALIAS (or --keystore-key-alias)");if(!L.KEYSTORE_KEY_PASSWORD&&!L.KEYSTORE_STORE_PASSWORD)R.push("KEYSTORE_KEY_PASSWORD or KEYSTORE_STORE_PASSWORD (at least one password required)");if(!L.PLAY_CONFIG_JSON)if(L.CAPGO_STORE_SUBMIT_REVIEW==="true")R.push("PLAY_CONFIG_JSON is required for --submit-to-store-review on Android");else if(L.BUILD_OUTPUT_UPLOAD_ENABLED!=="true")R.push("PLAY_CONFIG_JSON or BUILD_OUTPUT_UPLOAD_ENABLED=true (build has no output destination - enable either Play Store upload or Capgo download link)");else G.warn("⚠️ PLAY_CONFIG_JSON not provided - build will succeed but cannot auto-upload to Play Store")}if(R.length>0){G.error(`❌ Missing required credentials for ${U}:`),G.error("");for(let $0 of R)G.error(` • ${$0}`);throw G.error(""),G.error("Provide credentials via:"),G.error(` 1. CLI arguments: npx @capgo/cli build request --platform ${U} ${U==="ios"?'--apple-key-id "..." --apple-issuer-id "..." --apple-key-content "..."':'--android-keystore-file "..." --keystore-key-alias "..."'}`),G.error(` 2. Environment variables: ${U==="ios"?'export APPLE_KEY_ID="..." APPLE_ISSUER_ID="..." APPLE_KEY_CONTENT="..."':'export ANDROID_KEYSTORE_FILE="..." KEYSTORE_KEY_ALIAS="..."'}`),G.error(` 3. Saved credentials: npx @capgo/cli build credentials save --platform ${U} ...`),G.error(""),G.error("Documentation:"),G.error(` https://capgo.app/docs/cli/cloud-build/${U}/`),Error(`Missing required credentials for ${U}: ${R.join(", ")}`)}if(!D.buildMode)G.info("ℹ️ --build-mode not specified, defaulting to release");if(!L.BUILD_OUTPUT_UPLOAD_ENABLED)G.info("ℹ️ --output-upload not specified, defaulting to false (no Capgo download link)");if(!L.BUILD_OUTPUT_RETENTION_SECONDS)G.info(`ℹ️ --output-retention not specified, defaulting to ${ZJ}s (1 hour)`);let _=U==="ios"&&!(L.APPLE_KEY_ID&&L.APPLE_ISSUER_ID&&L.APPLE_KEY_CONTENT);if(!L.SKIP_BUILD_NUMBER_BUMP&&!_)G.info("ℹ️ --skip-build-number-bump not specified, build number will be auto-incremented (default)");if(!L.SKIP_MARKETING_VERSION_BUMP&&U==="ios"&&!_)G.info("ℹ️ --skip-marketing-version-bump not specified, marketing version will be auto-bumped when already released (default)");let{buildOptions:v,buildCredentials:j}=Bv$(L,U,D.buildMode||"release",Q6.version),k=U==="ios"?Wv$(q,B):void 0;if(k==="cocoapods")G.warn("⚠️ This iOS project uses CocoaPods. The CocoaPods trunk becomes read-only on December 2, 2026: your pods will stop getting updates and security fixes. Capgo iOS 27 SDK builds are Swift Package Manager only and become the default on January 1, 2027. Moving to Swift Package Manager takes a few minutes: https://capacitorjs.com/docs/ios/spm");let x={app_id:$,platform:U,build_mode:D.buildMode||"release",build_options:v,build_credentials:j,...k?{ios_dependency_manager:k}:{},...Kj0({cache:D.cache,cacheKey:D.cacheKey})};if(D.cache===!1)G.info(`ℹ️ --no-cache specified, compilation cache disabled for this ${U} build`);else if(D.cacheKey?.trim())G.info(`ℹ️ --cache-key "${D.cacheKey.trim()}" specified for this ${U} build`);if(G.info("✓ Using credentials (merged from CLI args, env vars, and saved file)"),Y){let $0=Object.keys(j);G.info(`Credentials provided: ${$0.join(", ")}`),G.info(`Build options: platform=${v.platform}, mode=${v.buildMode}, cliVersion=${v.cliVersion}`)}if(D.prescan===!0){let{executePrescan:$0,runPrescanGate:E0}=await Promise.resolve().then(() => (xh(),vh)),{enforcedCounts:F0}=await Promise.resolve().then(() => sz0),{decision:v0,report:O$,crashed:O0,informationOnlyFindings:c0}=await E0({enabled:!0,ignoreFatal:D.prescanIgnoreFatal,failOnWarnings:D.failOnWarnings,silent:Q,print:(S)=>G.info(S),warn:(S)=>G.warn(S)},async()=>(await $0($,{platform:U,path:q,apikey:D.apikey,credentials:L,androidFlavor:D.androidFlavor,iosDist:D.iosDistribution,skip:D.prescanSkip,warn:D.prescanWarn,supaHost:D.supaHost,supaAnon:D.supaAnon})).report);{let S=O$?.counts,I=O$?F0(O$):void 0,t=O0?"crashed":!S?"skipped":v0==="block"?"blocked":D.prescanIgnoreFatal&&(I?.error??S.error)>0?"bypassed":c0>0?"information-only":(I?.warning??S.warning)>0?"warned":"clean";await $$(D.apikey,{channel:"native-builder",event:"Prescan run",org_id:O,tracking_version:2,tags:{source:"build-request",result:t,"app-id":$,platform:U,errors:String(S?.error??0),warnings:String(S?.warning??0),"finding-ids":O$?O$.findings.filter((l)=>l.severity!=="info").map((l)=>l.id).join(",").slice(0,200):"",bypassed:String(t==="bypassed"),"information-only-findings":String(c0)}}).catch(()=>{})}if(v0==="block")throw Error("Prescan found blocking problems — the build was not requested and nothing was uploaded. Fix the errors above or re-run with --prescan-ignore-fatal / --no-prescan.")}await BU(K,D.apikey,"app.build_native",{appId:$},{message:`Capgo rejected this API key: missing app.build_native permission for app ${$}.`,silent:Q}),G.info("Requesting build from Capgo...");let m=3,n=await Dv$(`${H}/build/request`,{method:"POST",headers:s$({"Content-Type":"application/json",authorization:D.apikey}),body:JSON.stringify(x)},m,G);if(!n.ok){let $0=await n.text();if(await Hj0(n.status,$0,"request",G),$0.includes("build_machine_version_unavailable")){let F0=$0;try{F0=JSON.parse($0).message||$0}catch{}throw Error(`${F0} Change or drop --xcode-version.`)}let E0=n.status===401||n.status===403||/invalid_apikey|unauthorized|no_key_provided|invalid_jwt|no_jwt/i.test($0);throw Error(E0?`Capgo rejected the build request (HTTP ${n.status}): ${$0}`:`Capgo build request failed (HTTP ${n.status}): ${$0}`)}let o=await n.json();if(G.success(`Build job created: ${o.job_id}`),G.info(`Status: ${o.status}`),Y)G.info(`Upload URL: ${o.upload_url}`),G.info(`Upload expires: ${o.upload_expires_at}`);let h=D.aiAnalysisMode??"auto-prompt",A=D.sendLogsToSupport===!0||D.sendLogs===!0,P=(AU0()||D.aiAnalytics===!0||A||h==="caller-handled")&&h!=="skip",y=null,g=!1,c;if(P&&o.job_id)y=o.job_id,await IU0(o.job_id),PU0(o.job_id,()=>g);let d={...G,buildLog:($0)=>{if(G.buildLog($0),P&&y)TU0(y,$0)}};await $$(D.apikey,{channel:"native-builder",event:"Build requested",org_id:O,tracking_version:2,tags:{"app-id":$,platform:U,...D.builderJourneyId?{journey_id:D.builderJourneyId}:{}}}).catch();let q0=YD(t_$(),`capgo-build-${Date.now()}`);await i_$(q0,{recursive:!0});let s=YD(q0,`${Wj0(q)}.zip`);try{G.info(`Zipping ${U} project from ${q}...`),await Vv$(q,s,U,W?.config,{nodeModules:D.nodeModules});let $0=await r_$(s),E0=($0.size/1024/1024).toFixed(2);if(G.success(`Created zip: ${s} (${E0} MB)`),G.info("Uploading to builder..."),Y)G.info(`Upload endpoint: ${o.upload_url}`),G.info(`File size: ${E0} MB`),G.info(`Job ID: ${o.job_id}`);let F0=l_$(s);G.uploadProgress(0);let v0=Date.now(),O$=D.buildMode||"release";r2({apikey:D.apikey,appId:$,orgId:O,platform:U,buildMode:O$,jobId:o.job_id,sizeBytes:$0.size,phase:"started"}),await new Promise((X$,z$)=>{let P0=new Bw.Upload(F0,{endpoint:o.upload_url,chunkSize:5242880,retryDelays:[...ZF],metadata:{filename:Wj0(s),filetype:"application/zip"},headers:s$({authorization:D.apikey}),onBeforeRequest(p0){if(Y){G.info(`[TUS] ${p0.getMethod()} ${p0.getURL()}`);let V$=p0.getHeader("authorization");G.info(`[TUS] Authorization header present: ${!!V$}`)}},onAfterResponse(p0,V$){if(Y){G.info(`[TUS] Response status: ${V$.getStatus()}`);let l$=V$.getHeader("upload-offset"),N0=V$.getHeader("tus-resumable");G.info(`[TUS] Upload-Offset: ${l$}, Tus-Resumable: ${N0}`)}},async onError(p0){if(await r2({apikey:D.apikey,appId:$,orgId:O,platform:U,buildMode:O$,jobId:o.job_id,sizeBytes:$0.size,phase:"failed",durationSeconds:(Date.now()-v0)/1000,error:p0}),G.error(`Upload error: ${p0.message}`),p0 instanceof Bw.DetailedError){let V$=p0.originalResponse?.getBody(),l$=p0.originalResponse?.getStatus(),N0=p0.originalRequest?.getURL();if(Y)G.error(`[TUS] Request URL: ${N0}`),G.error(`[TUS] Response status: ${l$}`),G.error(`[TUS] Response body: ${V$}`);let n0=(()=>{try{let d$=JSON.parse(V$||'{"error": "unknown error"}');return d$.status||d$.error||d$.message||"unknown error"}catch{return V$||p0.message}})();z$(Error(`TUS upload failed: ${n0}`))}else z$(Error(`TUS upload failed: ${p0.message||p0.toString()}`))},onProgress(p0,V$){let l$=Number.parseFloat((p0/V$*100).toFixed(2));G.uploadProgress(l$)},onSuccess(){if(r2({apikey:D.apikey,appId:$,orgId:O,platform:U,buildMode:O$,jobId:o.job_id,sizeBytes:$0.size,phase:"succeeded",durationSeconds:(Date.now()-v0)/1000}),G.uploadProgress(100),Y)G.success("TUS upload completed successfully");X$()}});if(Y)G.info("[TUS] Starting upload...");P0.start()}),G.info("Starting build job...");let O0=await fetch(`${H}/build/start/${o.job_id}`,{method:"POST",headers:s$({"Content-Type":"application/json",authorization:D.apikey}),body:JSON.stringify({app_id:$,...Kj0({cache:D.cache,cacheKey:D.cacheKey})})});if(!O0.ok){let X$=await O0.text();throw await Hj0(O0.status,X$,"start",G),Error(`Failed to start build: ${O0.status} - ${X$}`)}let c0=await O0.json();G.success("Build started!"),G.info("Streaming build logs...");let S=new AbortController,I=DH0({requestCancellation:()=>$H0({url:`${H}/build/cancel/${o.job_id}`,headers:s$({"Content-Type":"application/json",authorization:D.apikey}),appId:$}),onCancellationStarted:()=>{G.warn("Canceling build... (press Ctrl+C again to force quit)")},onCancellationResult:(X$)=>{if(X$.ok){G.success("Build cancellation requested.");return}S4(X$.message),G.warn(`${X$.message}. The remote build may still be running.`)},abortLogStream:()=>S.abort(),forceExit:(X$)=>D6.exit(X$)});D6.on("SIGINT",I);let t,l=!1,A0=async()=>{try{let X$=await fetch(`${H}/build/status?job_id=${encodeURIComponent(o.job_id)}&app_id=${encodeURIComponent($)}&platform=${U}`,{headers:s$({authorization:D.apikey})});if(!X$.ok)return null;let z$=await X$.json(),P0=z$.status?.toLowerCase?.()??"";if(l)G.info(`Build status: ${P0||z$.status}`);if(Nw.has(P0))return P0;return null}catch{return null}},Y0=null;try{Y0=await Fv$(Q,Y,c0.logs_url,c0.logs_token,A0,S.signal,()=>{l=!0},Q&&!X&&!D.outputRecord?void 0:d)}finally{D6.removeListener("SIGINT",I)}if(Y0){if(t=Y0,Nw.has(Y0))await A0().catch(()=>{})}else t=await Gv$(H,o.job_id,$,U,D.apikey,Q,l,S.signal,G);if(t==="succeeded")G.success("Build completed successfully!");else if(t==="failed"){if(G.error("Build failed"),Xv$({cache:D.cache,cacheKey:D.cacheKey,aiAnalysisMode:h}))G.info(Qv$);if(kU0({isTTY:D6.stdout.isTTY===!0,aiAnalytics:D.aiAnalytics===!0,sendLogs:A}))D6.stderr.write(`${Sy}
|
|
626
626
|
`)}else G.warn(`Build finished with status: ${t}`);if(D.outputRecord&&t==="succeeded")try{let X$=await mz0(D.outputRecord,{jobId:o.job_id,appId:$,platform:U,buildMode:D.buildMode??"release",status:t,outputUrl:F},(z$)=>G.warn(z$));if(G.success(`Build output record written to ${D.outputRecord}`),!X$.outputUrl)G.info("ℹ️ Record contains no download URL — pass --output-upload to publish one.");if(X$.qrCodePngPath)G.info(`ℹ️ QR code PNG written to ${X$.qrCodePngPath}`)}catch(X$){G.warn(`Failed to write build output record to ${D.outputRecord}: ${X$ instanceof Error?X$.message:String(X$)}`)}if(t==="failed"&&P&&y&&h==="caller-handled")try{await Y2(y),g=!0;let X$=`${D6.env.CAPGO_AI_LOG_BASE_DIR||"/tmp/capgo-builds"}/${y}.log`;c={jobId:y,capturedLogPath:X$,ready:!0}}catch(X$){let z$=X$ instanceof Error?X$.message:String(X$);D6.stderr.write(`AI analysis unavailable because the captured Builder log could not be finalized: ${z$}
|
|
627
627
|
`)}else if(t==="failed"&&P&&y&&h==="auto-prompt"){let X$=y,z$=vU0({isTTY:D6.stdout.isTTY===!0,aiAnalyticsFlag:D.aiAnalytics===!0,sendLogsFlag:A}),P0="⚠ AI can make mistakes. Always verify the diagnosis against the full log before applying the suggested fix.",p0=async()=>oz0({appId:$,jobId:X$,internalLogPath:by()}),V$=async(N$,U1)=>{if(await Z2({apikey:D.apikey,orgId:O,appId:$,platform:U,jobId:y,choice:N$,triggeredBy:U1}),U1==="menu")await tU0({confirm:async(d6)=>{return await y$({message:d6,initialValue:!0})===!0},buildFiles:async()=>{let d6=c1();d6.start("Preparing your logs to send to Capgo support…");try{let u4=await p0();return d6.stop(u4?"Logs ready.":"Couldn't prepare logs."),u4}catch(u4){d6.stop("Couldn't prepare logs.");let LK=u4 instanceof Error?u4.message:String(u4);return D6.stderr.write(`Could not prepare support logs because the captured Builder log is unavailable: ${LK}
|
|
628
628
|
`),null}},upload:async(d6)=>{let u4=c1();u4.start("Uploading your logs to Capgo support…");let LK=await G2({apiHost:H,apikey:D.apikey,appId:$,jobId:y??void 0,gzPath:d6});return u4.stop(LK?"Logs uploaded.":"Logs upload unavailable."),LK},print:(d6)=>T.info(d6)});let P6=`${D6.env.CAPGO_AI_LOG_BASE_DIR||"/tmp/capgo-builds"}/${y}.log`,bJ="";try{bJ=await wF(X$)}catch(d6){let u4=d6 instanceof Error?d6.message:String(d6);D6.stderr.write(`AI analysis skipped: could not read captured log at ${P6}: ${u4}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as CC}from"node:module";var jC=Object.create;var{getPrototypeOf:AC,defineProperty:E2,getOwnPropertyNames:XH,getOwnPropertyDescriptor:RC}=Object,QH=Object.prototype.hasOwnProperty;function YH(D){return this[D]}var SC,TC,h$=(D,$,U)=>{var I=D!=null&&typeof D==="object";if(I){var F=$?SC??=new WeakMap:TC??=new WeakMap,J=F.get(D);if(J)return J}U=D!=null?jC(AC(D)):{};let X=$||!D||!D.__esModule?E2(U,"default",{value:D,enumerable:!0}):U;for(let Q of XH(D))if(!QH.call(X,Q))E2(X,Q,{get:YH.bind(D,Q),enumerable:!0});if(I)F.set(D,X);return X},x0=(D)=>{var $=(JH??=new WeakMap).get(D),U;if($)return $;if($=E2({},"__esModule",{value:!0}),D&&typeof D==="object"||typeof D==="function"){for(var I of XH(D))if(!QH.call($,I))E2($,I,{get:YH.bind(D,I),enumerable:!(U=RC(D,I))||U.enumerable})}return JH.set(D,$),$},JH,C=(D,$)=>()=>($||D(($={exports:{}}).exports,$),$.exports);var bC=(D)=>D;function PC(D,$){this[D]=bC.bind(null,$)}var X$=(D,$)=>{for(var U in $)E2(D,U,{get:$[U],enumerable:!0,configurable:!0,set:PC.bind($,U)})};var T=(D,$)=>()=>(D&&($=D(D=0)),$);var o=CC(import.meta.url);var t$;var A1=T(()=>{t$={name:"@capgo/cli",type:"module",version:"8.81.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/capgo/tree/main/cli#readme",repository:{type:"git",url:"https://github.com/Cap-go/capgo.app",directory:"cli"},bugs:{url:"https://github.com/Cap-go/capgo/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"bunx --bun supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsgo --project tsconfig.tsgo.json --noEmit",lint:"bun run lint:ox","lint:ox":"oxlint --config ../.oxlintrc.json src","lint:fix":"oxlint --config ../.oxlintrc.json --fix src","check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:notify-app-ready-background":"bun test ./test/test-notify-app-ready-background.mjs ./test/test-background-check-shutdown.mjs","test:bundle":"bun test/test-bundle.mjs","test:bundle-validation":"bun test test/bundle/","test:prescan":"bun test test/prescan/","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:fail-on-incompatible":"bun test/test-fail-on-incompatible.mjs","test:native-dependencies":"bun test/test-native-dependencies.mjs && bun test/test-get-remote-dependencies.mjs","test:package-json-guard":"bun test/test-package-json-guard.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-export":"bun test/test-credentials-export.mjs","test:asc-key-protocol":"bun test/test-asc-key-protocol.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:android-service-account-validation":"bun test/test-android-service-account-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:build-needed":"bun test/test-build-needed.mjs","test:cli-help":"bun test/test-cli-help.mjs","test:build-cache-payload":"bun test/test-build-cache-payload.mjs","test:build-cancellation":"bun test/test-build-cancellation.mjs","test:ci-prompts":"bun test/test-ci-prompts.mjs","test:capgo-app-id-prompt":"bun test/test-capgo-app-id-prompt.mjs","test:ci-secrets":"bun test/test-ci-secrets.mjs","test:android-onboarding-progress":"bun test/test-android-onboarding-progress.mjs && bun test/test-android-select-guard.mjs","test:android-keystore-action":"bun test/test-android-keystore-action.mjs","test:android-google-play-action":"bun test/test-android-google-play-action.mjs","test:onboarding-telemetry":"bun test/test-onboarding-telemetry.mjs","test:v2-event-migration":"bun test/test-v2-event-migration.mjs","test:analytics":"bun test/test-analytics.mjs","test:cli-headers":"bun test/test-cli-headers.mjs","test:min-cli-version":"bun test/test-min-cli-version.mjs","test:authenticated-command-invocation":"bun test/test-authenticated-command-invocation.mjs","test:analytics-error-category":"bun test/test-analytics-error-category.mjs","test:analytics-org-resolver":"bun test/test-analytics-org-resolver.mjs","test:supabase-perf":"bun test/test-supabase-perf.mjs","test:preview-qr":"bun test/test-preview-qr.mjs","test:bundle-pages":"bun test test/test-bundle-pages.test.ts","test:mcp-analytics":"bun test/test-mcp-analytics.mjs","test:mcp-instructions":"bun test/test-mcp-instructions.mjs","test:mcp-stdout-guard":"bun test/test-mcp-stdout-guard.mjs","test:mcp-platform-select":"bun test/test-mcp-platform-select.mjs","test:mcp-explain-scopes":"bun test/test-mcp-explain-scopes.mjs","test:mcp-oauth-reopen":"bun test/test-mcp-oauth-reopen.mjs","test:mcp-broker-oauth":"bun test/test-mcp-broker-oauth.mjs","test:mcp-broker-session":"bun test/test-mcp-broker-session.mjs","test:mcp-credentials-manage":"bun test/test-mcp-credentials-manage.mjs","test:mcp-resume-prompt":"bun test/test-mcp-resume-prompt.mjs","test:mcp-build-job":"bun test/test-mcp-build-job.mjs","test:mcp-build-tools":"bun test/test-mcp-build-tools.mjs","test:app-created-source":"bun test/test-app-created-source.mjs","test:app-add-exists":"bun test/test-app-add-exists.mjs","test:app-add-getting-started":"bun test/test-app-add-getting-started.mjs","test:app-list-output-text":"bun test/test-app-list-output-text.mjs","test:app-todo":"bun test/test-app-todo.mjs","test:doctor-analytics":"bun test/test-doctor-analytics.mjs","test:posthog-exception":"bun test/test-posthog-exception.mjs","test:cli-recovery":"bun test/test-cli-recovery.mjs","test:create-supabase-client":"bun test/test-create-supabase-client.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.mjs","test:onboarding-progress":"bun test/test-onboarding-progress.mjs","test:onboarding-run-targets":"bun test/test-onboarding-run-targets.mjs","test:run-device-command":"bun test/test-run-device-command.mjs","test:init-app-conflict":"bun test/test-init-app-conflict.mjs","test:channel-add-exists":"bun test/test-channel-add-exists.mjs","test:wait-log":"bun test/test-wait-log.mjs","test:init-guardrails":"bun test/test-init-guardrails.mjs","test:init-upload-recovery":"bun test/test-init-upload-error-gate.mjs && bun test/test-init-upload-monorepo-recovery.mjs","test:init-replay":"bun test/test-init-replay.mjs","test:init-telemetry":"bun test/test-init-telemetry.mjs","test:capacitor-config-target":"bun test/test-capacitor-config-target.mjs","test:builder-app-id-config":"bun test/test-builder-app-id-config.mjs","test:capacitor-config-typescript7":"bun test/test-capacitor-config-typescript7.mjs","test:capacitor-config-native-import":"bun test/test-capacitor-config-native-import.mjs","test:cli-user-error-config":"bun test/test-cli-user-error-config.mjs","test:cordova-upload-mode":"bun test/test-cordova-upload-mode.mjs","test:init-monorepo-targeting":"bun run test:capacitor-config-target && bun run test:builder-app-id-config && bun run test:capacitor-config-typescript7 && bun run test:capacitor-config-native-import && bun run test:cli-user-error-config && bun test/test-init-monorepo-targeting.mjs","test:prompt-preferences":"bun test/test-prompt-preferences.mjs","test:esm-sdk":"node test/test-sdk-esm.mjs","test:auth-session":"bun test/test-auth-session.mjs","test:mcp":"node test/test-mcp.mjs","test:mcp-no-key-handshake":"node test/test-mcp-no-key-handshake.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh","test:platform-paths":"bun test/test-platform-paths.mjs","test:project-type-detection":"bun test/test-project-type-detection.mjs","test:payload-split":"bun test/test-payload-split.mjs","test:macos-signing":"bun test/test-macos-signing.mjs","test:helper-dce":"bash scripts/check-helper-dce.sh","test:apple-api-import-helpers":"bun test/test-apple-api-import-helpers.mjs","test:apple-api-verify-key":"bun test/test-apple-api-verify-key.mjs","test:bundle-id-detector":"bun test/test-bundle-id-detector.mjs","test:apple-api-app-list":"bun test/test-apple-api-app-list.mjs","test:apple-api-cert-create":"bun test/test-apple-api-cert-create.mjs","test:app-verification":"bun test/test-app-verification.mjs","test:pbxproj-parser":"bun test/test-pbxproj-parser.mjs","test:self-update":"bun test/test-self-update.mjs","test:update-prompt":"bun test/test-update-prompt.mjs","test:android-tail-engine":"bun test/test-android-tail-engine.mjs","test:android-tail-render":"bun test/test-android-tail-render.mjs","test:android-tail-routing":"bun test/test-android-tail-routing.mjs","test:dev-gate-stripped":"bun test/test-dev-gate-stripped.mjs","test:frame-fit-ios-shared":"bun test/test-frame-fit-ios-shared.mjs","test:ios-confirm-app-id":"bun test/test-ios-confirm-app-id.mjs","test:ios-create-new":"bun test/test-ios-create-new.mjs","test:ios-certificate-action":"bun test/test-ios-certificate-action.mjs","test:ios-profile-action":"bun test/test-ios-profile-action.mjs","test:ios-credential-action":"bun test/test-ios-credential-action.mjs","test:ios-e2e":"bun test/test-ios-e2e.mjs","test:ios-flow-contract":"bun test/test-ios-flow-contract.mjs","test:ios-import-discovery":"bun test/test-ios-import-discovery.mjs","test:ios-import-export":"bun test/test-ios-import-export.mjs","test:ios-import-pickers":"bun test/test-ios-import-pickers.mjs","test:ios-import-recovery":"bun test/test-ios-import-recovery.mjs","test:ios-recovery":"bun test/test-ios-recovery.mjs","test:ios-resume":"bun test/test-ios-resume.mjs","test:ios-tail-handoff":"bun test/test-ios-tail-handoff.mjs","test:ios-tui-render":"bun test/test-ios-tui-render.mjs","test:p8-error":"bun test/test-p8-error.mjs","test:ios-tui-routing":"bun test/test-ios-tui-routing.mjs","test:ios-updater-sync-validation":"bun test/test-ios-updater-sync-validation.mjs","test:ios-verify-app":"bun test/test-ios-verify-app.mjs","test:ios-marketing-version":"bun test/test-ios-marketing-version.mjs","test:android-version":"bun test/test-android-version.mjs","test:platform-flow-contract":"bun test/test-platform-flow-contract.mjs","test:tail-engine-shared":"bun test/test-tail-engine-shared.mjs",test:"bun run build && bun scripts/run-test-suite.ts","test:run":"bun scripts/run-test-suite.ts","test:serial":"bun run build && bun scripts/run-test-suite.ts --serial","test:suite":"bun run test:helper-dce && bun run test:version-detection:setup && bun run test:bundle && bun run test:notify-app-ready-background && bun run test:bundle-validation && bun run test:functional && bun run test:semver && bun run test:auto-bump-version && bun run test:auto-bump-ai-diff && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:cordova-upload-mode && bun run test:fail-on-incompatible && bun run test:native-dependencies && bun run test:package-json-guard && bun run test:credentials && bun run test:credentials-export && bun run test:ios-provisioning-map && bun run test:ios-provisioning-command && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:cli-help && bun run test:build-cache-payload && bun run test:build-cancellation && bun run test:ci-prompts && bun run test:capgo-app-id-prompt && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:android-keystore-action && bun run test:android-google-play-action && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:analytics && bun run test:cli-headers && bun run test:min-cli-version && bun run test:authenticated-command-invocation && bun run test:analytics-error-category && bun run test:analytics-org-resolver && bun run test:supabase-perf && bun run test:preview-qr && bun run test:bundle-pages && bun run test:app-set-options && bun run test:mcp-analytics && bun run test:mcp-instructions && bun run test:mcp-live-update-onboarding && bun run test:mcp-stdout-guard && bun run test:mcp-platform-select && bun run test:mcp-explain-scopes && bun run test:mcp-oauth-reopen && bun run test:mcp-broker-oauth && bun run test:mcp-broker-session && bun run test:mcp-credentials-manage && bun run test:mcp-resume-prompt && bun run test:mcp-build-job && bun run test:mcp-build-tools && bun run test:app-created-source && bun run test:app-add-exists && bun run test:app-add-getting-started && bun run test:app-list-output-text && bun run test:app-todo && bun run test:doctor-analytics && bun run test:posthog-exception && bun run test:cli-recovery && bun run test:create-supabase-client && bun run test:build-platform-selection && bun run test:builder-project-discovery && bun run test:builder-app-selection && bun run test:builder-login-gate && bun run test:onboarding-recovery && bun run test:onboarding-progress && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-monorepo-targeting && bun run test:init-app-conflict && bun run test:channel-list && bun run test:channel-add-exists && bun run test:wait-log && bun run test:init-guardrails && bun run test:init-upload-recovery && bun run test:init-replay && bun run test:init-telemetry && bun run test:prompt-preferences && bun run test:esm-sdk && bun run test:mcp && bun run test:mcp-no-key-handshake && bun run test:auth-session && bun run test:version-detection && bun run test:platform-paths && bun run test:project-type-detection && bun run test:payload-split && bun run test:macos-signing && bun run test:asc-key-protocol && bun run test:apple-api-import-helpers && bun run test:apple-api-verify-key && bun run test:bundle-id-detector && bun run test:apple-api-app-list && bun run test:app-verification && bun run test:pbxproj-parser && bun run test:ai-log-capture && bun run test:ai-analyze-flow && bun run test:cicd-failure-help && bun run test:ai-sse-parser && bun run test:ai-render-markdown && bun run test:ai-stream-markdown && bun run test:ai-onboarding-mode && bun run test:ai-fit && bun run test:platform-layout && bun run test:frame-fit && bun run test:onboarding-min-size && bun run test:min-size-gate && bun run test:shell-size-gate && bun run test:build-log-sanitize && bun run test:build-output-viewport && bun run test:diff-viewer-viewport && bun run test:build-complete-exit && bun run test:ai-analyze-stream && bun run test:support-mailto && bun run test:support-redact && bun run test:support-internal-log && bun run test:support-help-menu && bun run test:support-contact && bun run test:support-upload-prompt && bun run test:support-bundle-files && bun run test:self-update && bun run test:update-prompt && bun run test:apple-api-cert-create && bun run test:android-tail-engine && bun run test:android-tail-render && bun run test:android-tail-routing && bun run test:dev-gate-stripped && bun run test:frame-fit-ios-shared && bun run test:ios-confirm-app-id && bun run test:ios-create-new && bun run test:ios-certificate-action && bun run test:ios-profile-action && bun run test:ios-credential-action && bun run test:ios-e2e && bun run test:ios-flow-contract && bun run test:ios-import-discovery && bun run test:ios-import-export && bun run test:ios-import-pickers && bun run test:ios-import-recovery && bun run test:ios-recovery && bun run test:ios-resume && bun run test:ios-tail-handoff && bun run test:ios-tui-render && bun run test:p8-error && bun run test:ios-tui-routing && bun run test:ios-updater-sync-validation && bun run test:ios-verify-app && bun run test:ios-marketing-version && bun run test:android-version && bun run test:platform-flow-contract && bun run test:tail-engine-shared && bun run test:prescan && bun run test:android-reporting-api && bun run test:android-gcp && bun run test:android-app-verification && bun run test:android-rename && bun run test:appflow-auth && bun run test:appflow-api-map && bun run test:appflow-validate && bun run test:appflow-flow && bun run test:appflow-gapfill && bun run test:appflow-engine && bun run test:appflow-tail && bun run test:appflow-fetch && bun run test:appflow-sa-decode && bun run test:app-permission-helper && bun run test:2fa-compliance-network && bun run test:organization-set-api-host && bun run test:trial-warning && bun run test:plan-validation","test:build-platform-selection":"bun test/test-build-platform-selection.mjs","test:builder-project-discovery":"bun test/test-builder-project-discovery.mjs","test:builder-app-selection":"bun test/test-builder-app-selection.mjs","test:builder-login-gate":"bun test/test-builder-login-gate.mjs","test:ai-log-capture":"bun test/test-ai-log-capture.mjs","test:ai-analyze-flow":"bun test/test-ai-analyze-flow.mjs","test:cicd-failure-help":"bun test/test-cicd-failure-help.mjs","test:ai-analyze-stream":"bun test/test-ai-analyze-stream.mjs","test:ai-sse-parser":"bun test/test-ai-sse-parser.mjs","test:ai-render-markdown":"bun test/test-ai-render-markdown.mjs","test:ai-onboarding-mode":"bun test/test-ai-onboarding-mode.mjs","test:ai-fit":"bun test/test-ai-fit.mjs","test:platform-layout":"bun test/test-platform-layout.mjs","test:frame-fit":"bun test/run-frame-fit.mjs","test:onboarding-min-size":"bun test/test-onboarding-min-size.mjs","test:min-size-gate":"bun test/test-min-size-gate.mjs","test:shell-size-gate":"bun test/test-shell-size-gate.mjs","test:build-log-sanitize":"bun test/test-build-log-sanitize.mjs","test:build-output-viewport":"bun test/test-build-output-viewport.mjs","test:diff-viewer-viewport":"bun test/test-diff-viewer-viewport.mjs","test:build-complete-exit":"bun test/test-build-complete-exit.mjs","test:ai-stream-markdown":"bun test/test-ai-stream-markdown.mjs","test:support-mailto":"bun test/test-support-mailto.mjs","test:support-redact":"bun test/test-support-redact.mjs","test:support-internal-log":"bun test/test-support-internal-log.mjs","test:support-help-menu":"bun test/test-support-help-menu.mjs","test:support-contact":"bun test/test-support-contact.mjs","test:support-upload-prompt":"bun test/test-support-upload-prompt.mjs","test:support-bundle-files":"bun test/test-support-bundle-files.mjs","test:mcp-live-update-onboarding":"bun test/test-mcp-live-update-onboarding.mjs","test:app-set-options":"bun test/test-app-set-options.mjs && bun test/test-app-list-options.mjs","test:android-reporting-api":"bun test/test-android-reporting-api.mjs","test:android-gcp":"bun test/test-android-gcp.mjs","test:android-app-verification":"bun test/test-android-app-verification.mjs","test:android-rename":"bun test/test-android-rename.mjs","test:appflow-auth":"bun test/test-appflow-auth.mjs","test:appflow-api-map":"bun test/test-appflow-api-map.mjs","test:appflow-validate":"bun test/test-appflow-validate.mjs","test:appflow-flow":"bun test/test-appflow-flow.mjs","test:appflow-gapfill":"bun test/test-appflow-gapfill.mjs","test:appflow-engine":"bun test/test-appflow-engine.mjs","test:appflow-tail":"bun test/test-appflow-tail.mjs","test:appflow-fetch":"bun test/test-appflow-fetch.mjs","test:appflow-sa-decode":"bun test/test-appflow-sa-decode.mjs","test:app-permission-helper":"bun test/test-app-permission-helper.mjs","test:2fa-compliance-network":"bun test/test-2fa-compliance-network.mjs","test:organization-set-api-host":"bun test/test-organization-set-api-host.mjs","test:trial-warning":"bun test/test-trial-warning.mjs","test:plan-validation":"bun test/test-plan-validation.mjs","test:auto-bump-version":"bun test/test-auto-bump-version.mjs","test:auto-bump-ai-diff":"bun test/test-auto-bump-ai-diff.mjs","test:ios-provisioning-map":"bun test/test-ios-provisioning-map.mjs","test:ios-provisioning-command":"bun test/test-ios-provisioning-command.mjs","test:channel-list":"bun test/test-channel-list.mjs"},dependencies:{"@inkjs/ui":"^2.0.0","@manypkg/tools":"^2.1.2","@rrweb/types":"^2.1.1","@standard-schema/spec":"^1.1.0","@xmldom/xmldom":"^0.9.10","@xterm/addon-serialize":"^0.14.0","@xterm/headless":"^6.0.0","agent-cli-detector":"^0.1.6","happy-dom":"^20.11.0",ink:"^7.1.1","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.4.0",qrcode:"^1.5.4",react:"^19.2.8","rrweb-snapshot":"^2.1.1","string-width":"^8.2.2",typescript:"6.0.3",zod:"^4.5.4"},optionalDependencies:{"@capgo/cli-helper-darwin-arm64":"^1.1.1","@capgo/cli-helper-darwin-x64":"^1.1.1","node-pty":"^1.1.0"},devDependencies:{"@antfu/eslint-config":"^9.2.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.6","@capacitor/cli":"^8.4.2","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.7.0","@modelcontextprotocol/client":"^2.0.0-beta.5","@modelcontextprotocol/server":"^2.0.0-beta.5","@sauber/table":"npm:@jsr/sauber__table","@sinonjs/fake-timers":"15.4.0","@std/semver":"npm:@jsr/std__semver@1.0.8","@supabase/supabase-js":"^2.110.8","@tanstack/intent":"^0.3.6","@types/adm-zip":"^0.5.8","@types/jsonwebtoken":"^9.0.10","@types/node":"^26.1.1","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/qrcode":"^1.5.6","@types/react":"^19.2.17","@types/tmp":"^0.2.6","@types/ws":"^8.18.1","@typescript/native-preview":"7.0.0-dev.20260707.2","@vercel/ncc":"^0.44.1","@vue/compiler-dom":"3.5.40","@xterm/headless":"^6.0.0","adm-zip":"^0.6.0","ci-info":"^4.4.0",commander:"^15.0.0",eslint:"^10.7.0","git-format-staged":"4.0.2",husky:"^9.1.7","is-wsl":"^3.1.1",micromatch:"^4.0.8",open:"^11.0.0",oxlint:"^1.75.0",partysocket:"^1.3.0",prettyjson:"^1.2.5",tmp:"^0.2.7","tus-js-client":"^4.3.1",ws:"^8.21.1"}}});var ZD;var Z6=T(()=>{ZD=class ZD extends Error{context;constructor(D,$){super(D);this.name="CliUserError",this.context=$}}});import{platform as kC}from"node:os";import{version as _C}from"node:process";function KH(D){BH=D}function gC(D){for(let $=0;$<D.length;$++)if(D.charCodeAt($)>255)return!1;return!0}function WH(D){if(D.toLowerCase()==="x-capgo-log-token")return"Build log token is missing. Re-run the build command or pass a valid log token.";return"Capgo API key is missing. Run `npx -y @capgo/cli@latest login` or pass `--apikey`."}function fC(D){if(D.toLowerCase()==="x-capgo-log-token")return"Build log token contains invalid characters (only ASCII is allowed). Re-run the build command to get a fresh token.";if(D.toLowerCase()==="authorization")return"Authorization header contains invalid characters (only ASCII is allowed). Check your Capgo API key or Supabase anon key configuration.";return"Capgo API key contains invalid characters (only ASCII is allowed). Copy the key from the Capgo dashboard."}function HF(D,$){if($===void 0||$===null){if(qF.has(D.toLowerCase()))throw new ZD(WH(D));throw new ZD(`HTTP header "${D}" is missing or invalid.`)}if(typeof $!=="string"){if(qF.has(D.toLowerCase()))throw new ZD(WH(D));throw new ZD(`HTTP header "${D}" is missing or invalid.`)}if(!gC($)){if(qF.has(D.toLowerCase()))throw new ZD(fC(D));throw new ZD(`HTTP header "${D}" contains invalid characters (only ASCII is allowed).`)}return $}function J0(D){let $={capgo_api:xC,"x-cli-version":t$.version,"x-cli-command":BH,"x-cli-node":_C,"x-cli-os":kC()};if(D)for(let[U,I]of Object.entries(D))$[U]=HF(U,I);return $}var xC="2025-10-01",BH="",qF;var d3=T(()=>{A1();Z6();qF=new Set(["authorization","capgkey","x-capgo-log-token"])});import{existsSync as V$}from"fs";var v2=(D=".",$="unknown")=>{let U=`${D}/bun.lockb`,I=`${D}/bun.lock`,F=`${D}/pnpm-lock.yaml`,J=`${D}/shrinkwrap.yaml`,X=`${D}/yarn.lock`,Q=`${D}/package-lock.json`,Y=`${D}/npm-shrinkwrap.json`;if(V$(U)||V$(I))return"bun";if(V$(F)||V$(J))return"pnpm";if(V$(X))return"yarn";if(V$(Q)||V$(Y))return"npm";return $},c3=(D=v2(),$=!1)=>{switch(D){case"bun":return $?"bun install":"install";case"pnpm":return $?"pnpm install":"install";case"yarn":return $?"yarn install":"install";case"npm":return $?"npm install":"install";case"unknown":return $?"unknown unknown":"unknown";default:return $?"npm install":"install"}},GH=(D=".",$="npx")=>{let U=`${D}/bun.lockb`,I=`${D}/bun.lock`,F=`${D}/pnpm-lock.yaml`,J=`${D}/shrinkwrap.yaml`,X=`${D}/yarn.lock`,Q=`${D}/package-lock.json`,Y=`${D}/npm-shrinkwrap.json`;if(V$(U)||V$(I))return"bunx";if(V$(F)||V$(J))return"pnpm exec";if(V$(X))return"yarn dlx";if(V$(Q)||V$(Y))return"npx";return $};var qH=()=>{};var HH,NH=(D)=>{return D===12288||D>=65281&&D<=65376||D>=65504&&D<=65510},zH=(D)=>{return D===8987||D===9001||D>=12272&&D<=12287||D>=12289&&D<=12350||D>=12441&&D<=12543||D>=12549&&D<=12591||D>=12593&&D<=12686||D>=12688&&D<=12771||D>=12783&&D<=12830||D>=12832&&D<=12871||D>=12880&&D<=19903||D>=65040&&D<=65049||D>=65072&&D<=65106||D>=65108&&D<=65126||D>=65128&&D<=65131||D>=127488&&D<=127490||D>=127504&&D<=127547||D>=127552&&D<=127560||D>=131072&&D<=196605||D>=196608&&D<=262141};var LH=T(()=>{HH=(()=>{let D=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return($)=>{let U=0;D.lastIndex=0;while(D.test($))U+=1;return $.length-U}})()});var yC,mC,wH,hC,ZH,nC,iC,lC,MH=(D,$={},U={})=>{let I=$.limit??1/0,F=$.ellipsis??"",J=$?.ellipsisWidth??(F?MH(F,lC,U).width:0),X=0,Q=U.controlWidth??0,Y=U.tabWidth??8,W=U.emojiWidth??2,B=2,K=U.regularWidth??1,q=U.wideWidth??2,H=[[nC,K],[yC,0],[mC,Q],[hC,Y],[ZH,W],[wH,q]],G=0,z=0,N=D.length,M=0,Z=!1,L=N,v=Math.max(0,I-J),A=0,V=0,b=0,y=0;D:while(!0){if(V>A||z>=N&&z>G){let _=D.slice(A,V)||D.slice(G,z);M=0;for(let n of _.replaceAll(iC,"")){let m=n.codePointAt(0)||0;if(NH(m))y=2;else if(zH(m))y=q;else y=K;if(b+y>v)L=Math.min(L,Math.max(A,G)+M);if(b+y>I){Z=!0;break D}M+=n.length,b+=y}A=V=0}if(z>=N)break D;for(let _=0,n=H.length;_<n;_++){let[m,UD]=H[_];if(m.lastIndex=z,m.test(D)){if(M=m===wH?HH(D.slice(z,m.lastIndex)):m===ZH?1:m.lastIndex-z,y=M*UD,b+y>v)L=Math.min(L,z+Math.floor((v-b)/UD));if(b+y>I){Z=!0;break D}b+=y,A=G,V=z,z=G=m.lastIndex;continue D}}z+=1}return{width:Z?v:b,index:Z?L:N,truncated:Z,ellipsed:Z&&I>=J}},OH;var EH=T(()=>{LH();yC=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,mC=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,wH=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,hC=/\t{1,1000}/y,ZH=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,nC=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,iC=/\p{M}+/gu,lC={limit:1/0,ellipsis:""},OH=MH});var dC,cC=(D,$={})=>{return OH(D,dC,$).width},X0;var NF=T(()=>{EH();dC={limit:1/0,ellipsis:"",ellipsisWidth:0},X0=cC});function g0(D,$,U){return String(D).normalize().split(aC).map((I)=>tC(I,$,U)).join(`
|
|
1
|
+
import{createRequire as CC}from"node:module";var jC=Object.create;var{getPrototypeOf:AC,defineProperty:E2,getOwnPropertyNames:XH,getOwnPropertyDescriptor:RC}=Object,QH=Object.prototype.hasOwnProperty;function YH(D){return this[D]}var SC,TC,h$=(D,$,U)=>{var I=D!=null&&typeof D==="object";if(I){var F=$?SC??=new WeakMap:TC??=new WeakMap,J=F.get(D);if(J)return J}U=D!=null?jC(AC(D)):{};let X=$||!D||!D.__esModule?E2(U,"default",{value:D,enumerable:!0}):U;for(let Q of XH(D))if(!QH.call(X,Q))E2(X,Q,{get:YH.bind(D,Q),enumerable:!0});if(I)F.set(D,X);return X},x0=(D)=>{var $=(JH??=new WeakMap).get(D),U;if($)return $;if($=E2({},"__esModule",{value:!0}),D&&typeof D==="object"||typeof D==="function"){for(var I of XH(D))if(!QH.call($,I))E2($,I,{get:YH.bind(D,I),enumerable:!(U=RC(D,I))||U.enumerable})}return JH.set(D,$),$},JH,C=(D,$)=>()=>($||D(($={exports:{}}).exports,$),$.exports);var bC=(D)=>D;function PC(D,$){this[D]=bC.bind(null,$)}var X$=(D,$)=>{for(var U in $)E2(D,U,{get:$[U],enumerable:!0,configurable:!0,set:PC.bind($,U)})};var T=(D,$)=>()=>(D&&($=D(D=0)),$);var o=CC(import.meta.url);var t$;var A1=T(()=>{t$={name:"@capgo/cli",type:"module",version:"8.82.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/capgo/tree/main/cli#readme",repository:{type:"git",url:"https://github.com/Cap-go/capgo.app",directory:"cli"},bugs:{url:"https://github.com/Cap-go/capgo/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"bunx --bun supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsgo --project tsconfig.tsgo.json --noEmit",lint:"bun run lint:ox","lint:ox":"oxlint --config ../.oxlintrc.json src","lint:fix":"oxlint --config ../.oxlintrc.json --fix src","check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:notify-app-ready-background":"bun test ./test/test-notify-app-ready-background.mjs ./test/test-background-check-shutdown.mjs","test:bundle":"bun test/test-bundle.mjs","test:bundle-validation":"bun test test/bundle/","test:prescan":"bun test test/prescan/","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:fail-on-incompatible":"bun test/test-fail-on-incompatible.mjs","test:native-dependencies":"bun test/test-native-dependencies.mjs && bun test/test-get-remote-dependencies.mjs","test:package-json-guard":"bun test/test-package-json-guard.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-export":"bun test/test-credentials-export.mjs","test:asc-key-protocol":"bun test/test-asc-key-protocol.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:android-service-account-validation":"bun test/test-android-service-account-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:build-needed":"bun test/test-build-needed.mjs","test:cli-help":"bun test/test-cli-help.mjs","test:build-cache-payload":"bun test/test-build-cache-payload.mjs","test:build-cancellation":"bun test/test-build-cancellation.mjs","test:ci-prompts":"bun test/test-ci-prompts.mjs","test:capgo-app-id-prompt":"bun test/test-capgo-app-id-prompt.mjs","test:ci-secrets":"bun test/test-ci-secrets.mjs","test:android-onboarding-progress":"bun test/test-android-onboarding-progress.mjs && bun test/test-android-select-guard.mjs","test:android-keystore-action":"bun test/test-android-keystore-action.mjs","test:android-google-play-action":"bun test/test-android-google-play-action.mjs","test:onboarding-telemetry":"bun test/test-onboarding-telemetry.mjs","test:v2-event-migration":"bun test/test-v2-event-migration.mjs","test:analytics":"bun test/test-analytics.mjs","test:cli-headers":"bun test/test-cli-headers.mjs","test:min-cli-version":"bun test/test-min-cli-version.mjs","test:authenticated-command-invocation":"bun test/test-authenticated-command-invocation.mjs","test:analytics-error-category":"bun test/test-analytics-error-category.mjs","test:analytics-org-resolver":"bun test/test-analytics-org-resolver.mjs","test:supabase-perf":"bun test/test-supabase-perf.mjs","test:preview-qr":"bun test/test-preview-qr.mjs","test:bundle-pages":"bun test test/test-bundle-pages.test.ts","test:mcp-analytics":"bun test/test-mcp-analytics.mjs","test:mcp-instructions":"bun test/test-mcp-instructions.mjs","test:mcp-stdout-guard":"bun test/test-mcp-stdout-guard.mjs","test:mcp-platform-select":"bun test/test-mcp-platform-select.mjs","test:mcp-explain-scopes":"bun test/test-mcp-explain-scopes.mjs","test:mcp-oauth-reopen":"bun test/test-mcp-oauth-reopen.mjs","test:mcp-broker-oauth":"bun test/test-mcp-broker-oauth.mjs","test:mcp-broker-session":"bun test/test-mcp-broker-session.mjs","test:mcp-credentials-manage":"bun test/test-mcp-credentials-manage.mjs","test:mcp-resume-prompt":"bun test/test-mcp-resume-prompt.mjs","test:mcp-build-job":"bun test/test-mcp-build-job.mjs","test:mcp-build-tools":"bun test/test-mcp-build-tools.mjs","test:app-created-source":"bun test/test-app-created-source.mjs","test:app-add-exists":"bun test/test-app-add-exists.mjs","test:app-add-getting-started":"bun test/test-app-add-getting-started.mjs","test:app-list-output-text":"bun test/test-app-list-output-text.mjs","test:app-todo":"bun test/test-app-todo.mjs","test:doctor-analytics":"bun test/test-doctor-analytics.mjs","test:posthog-exception":"bun test/test-posthog-exception.mjs","test:cli-recovery":"bun test/test-cli-recovery.mjs","test:create-supabase-client":"bun test/test-create-supabase-client.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.mjs","test:onboarding-progress":"bun test/test-onboarding-progress.mjs","test:onboarding-run-targets":"bun test/test-onboarding-run-targets.mjs","test:run-device-command":"bun test/test-run-device-command.mjs","test:init-app-conflict":"bun test/test-init-app-conflict.mjs","test:channel-add-exists":"bun test/test-channel-add-exists.mjs","test:wait-log":"bun test/test-wait-log.mjs","test:init-guardrails":"bun test/test-init-guardrails.mjs","test:init-upload-recovery":"bun test/test-init-upload-error-gate.mjs && bun test/test-init-upload-monorepo-recovery.mjs","test:init-replay":"bun test/test-init-replay.mjs","test:init-telemetry":"bun test/test-init-telemetry.mjs","test:capacitor-config-target":"bun test/test-capacitor-config-target.mjs","test:builder-app-id-config":"bun test/test-builder-app-id-config.mjs","test:capacitor-config-typescript7":"bun test/test-capacitor-config-typescript7.mjs","test:capacitor-config-native-import":"bun test/test-capacitor-config-native-import.mjs","test:cli-user-error-config":"bun test/test-cli-user-error-config.mjs","test:cordova-upload-mode":"bun test/test-cordova-upload-mode.mjs","test:init-monorepo-targeting":"bun run test:capacitor-config-target && bun run test:builder-app-id-config && bun run test:capacitor-config-typescript7 && bun run test:capacitor-config-native-import && bun run test:cli-user-error-config && bun test/test-init-monorepo-targeting.mjs","test:prompt-preferences":"bun test/test-prompt-preferences.mjs","test:esm-sdk":"node test/test-sdk-esm.mjs","test:auth-session":"bun test/test-auth-session.mjs","test:mcp":"node test/test-mcp.mjs","test:mcp-no-key-handshake":"node test/test-mcp-no-key-handshake.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh","test:platform-paths":"bun test/test-platform-paths.mjs","test:project-type-detection":"bun test/test-project-type-detection.mjs","test:payload-split":"bun test/test-payload-split.mjs","test:macos-signing":"bun test/test-macos-signing.mjs","test:helper-dce":"bash scripts/check-helper-dce.sh","test:apple-api-import-helpers":"bun test/test-apple-api-import-helpers.mjs","test:apple-api-verify-key":"bun test/test-apple-api-verify-key.mjs","test:bundle-id-detector":"bun test/test-bundle-id-detector.mjs","test:apple-api-app-list":"bun test/test-apple-api-app-list.mjs","test:apple-api-cert-create":"bun test/test-apple-api-cert-create.mjs","test:app-verification":"bun test/test-app-verification.mjs","test:pbxproj-parser":"bun test/test-pbxproj-parser.mjs","test:self-update":"bun test/test-self-update.mjs","test:update-prompt":"bun test/test-update-prompt.mjs","test:android-tail-engine":"bun test/test-android-tail-engine.mjs","test:android-tail-render":"bun test/test-android-tail-render.mjs","test:android-tail-routing":"bun test/test-android-tail-routing.mjs","test:dev-gate-stripped":"bun test/test-dev-gate-stripped.mjs","test:frame-fit-ios-shared":"bun test/test-frame-fit-ios-shared.mjs","test:ios-confirm-app-id":"bun test/test-ios-confirm-app-id.mjs","test:ios-create-new":"bun test/test-ios-create-new.mjs","test:ios-certificate-action":"bun test/test-ios-certificate-action.mjs","test:ios-profile-action":"bun test/test-ios-profile-action.mjs","test:ios-credential-action":"bun test/test-ios-credential-action.mjs","test:ios-e2e":"bun test/test-ios-e2e.mjs","test:ios-flow-contract":"bun test/test-ios-flow-contract.mjs","test:ios-import-discovery":"bun test/test-ios-import-discovery.mjs","test:ios-import-export":"bun test/test-ios-import-export.mjs","test:ios-import-pickers":"bun test/test-ios-import-pickers.mjs","test:ios-import-recovery":"bun test/test-ios-import-recovery.mjs","test:ios-recovery":"bun test/test-ios-recovery.mjs","test:ios-resume":"bun test/test-ios-resume.mjs","test:ios-tail-handoff":"bun test/test-ios-tail-handoff.mjs","test:ios-tui-render":"bun test/test-ios-tui-render.mjs","test:p8-error":"bun test/test-p8-error.mjs","test:ios-tui-routing":"bun test/test-ios-tui-routing.mjs","test:ios-updater-sync-validation":"bun test/test-ios-updater-sync-validation.mjs","test:ios-verify-app":"bun test/test-ios-verify-app.mjs","test:ios-marketing-version":"bun test/test-ios-marketing-version.mjs","test:android-version":"bun test/test-android-version.mjs","test:platform-flow-contract":"bun test/test-platform-flow-contract.mjs","test:tail-engine-shared":"bun test/test-tail-engine-shared.mjs",test:"bun run build && bun scripts/run-test-suite.ts","test:run":"bun scripts/run-test-suite.ts","test:serial":"bun run build && bun scripts/run-test-suite.ts --serial","test:suite":"bun run test:helper-dce && bun run test:version-detection:setup && bun run test:bundle && bun run test:notify-app-ready-background && bun run test:bundle-validation && bun run test:functional && bun run test:semver && bun run test:auto-bump-version && bun run test:auto-bump-ai-diff && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:cordova-upload-mode && bun run test:fail-on-incompatible && bun run test:native-dependencies && bun run test:package-json-guard && bun run test:credentials && bun run test:credentials-export && bun run test:ios-provisioning-map && bun run test:ios-provisioning-command && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:cli-help && bun run test:build-cache-payload && bun run test:build-cancellation && bun run test:ci-prompts && bun run test:capgo-app-id-prompt && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:android-keystore-action && bun run test:android-google-play-action && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:analytics && bun run test:cli-headers && bun run test:min-cli-version && bun run test:authenticated-command-invocation && bun run test:analytics-error-category && bun run test:analytics-org-resolver && bun run test:supabase-perf && bun run test:preview-qr && bun run test:bundle-pages && bun run test:app-set-options && bun run test:mcp-analytics && bun run test:mcp-instructions && bun run test:mcp-live-update-onboarding && bun run test:mcp-stdout-guard && bun run test:mcp-platform-select && bun run test:mcp-explain-scopes && bun run test:mcp-oauth-reopen && bun run test:mcp-broker-oauth && bun run test:mcp-broker-session && bun run test:mcp-credentials-manage && bun run test:mcp-resume-prompt && bun run test:mcp-build-job && bun run test:mcp-build-tools && bun run test:app-created-source && bun run test:app-add-exists && bun run test:app-add-getting-started && bun run test:app-list-output-text && bun run test:app-todo && bun run test:doctor-analytics && bun run test:posthog-exception && bun run test:cli-recovery && bun run test:create-supabase-client && bun run test:build-platform-selection && bun run test:builder-project-discovery && bun run test:builder-app-selection && bun run test:builder-login-gate && bun run test:onboarding-recovery && bun run test:onboarding-progress && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-monorepo-targeting && bun run test:init-app-conflict && bun run test:channel-list && bun run test:channel-add-exists && bun run test:wait-log && bun run test:init-guardrails && bun run test:init-upload-recovery && bun run test:init-replay && bun run test:init-telemetry && bun run test:prompt-preferences && bun run test:esm-sdk && bun run test:mcp && bun run test:mcp-no-key-handshake && bun run test:auth-session && bun run test:version-detection && bun run test:platform-paths && bun run test:project-type-detection && bun run test:payload-split && bun run test:macos-signing && bun run test:asc-key-protocol && bun run test:apple-api-import-helpers && bun run test:apple-api-verify-key && bun run test:bundle-id-detector && bun run test:apple-api-app-list && bun run test:app-verification && bun run test:pbxproj-parser && bun run test:ai-log-capture && bun run test:ai-analyze-flow && bun run test:cicd-failure-help && bun run test:ai-sse-parser && bun run test:ai-render-markdown && bun run test:ai-stream-markdown && bun run test:ai-onboarding-mode && bun run test:ai-fit && bun run test:platform-layout && bun run test:frame-fit && bun run test:onboarding-min-size && bun run test:min-size-gate && bun run test:shell-size-gate && bun run test:build-log-sanitize && bun run test:build-output-viewport && bun run test:diff-viewer-viewport && bun run test:build-complete-exit && bun run test:ai-analyze-stream && bun run test:support-mailto && bun run test:support-redact && bun run test:support-internal-log && bun run test:support-help-menu && bun run test:support-contact && bun run test:support-upload-prompt && bun run test:support-bundle-files && bun run test:self-update && bun run test:update-prompt && bun run test:apple-api-cert-create && bun run test:android-tail-engine && bun run test:android-tail-render && bun run test:android-tail-routing && bun run test:dev-gate-stripped && bun run test:frame-fit-ios-shared && bun run test:ios-confirm-app-id && bun run test:ios-create-new && bun run test:ios-certificate-action && bun run test:ios-profile-action && bun run test:ios-credential-action && bun run test:ios-e2e && bun run test:ios-flow-contract && bun run test:ios-import-discovery && bun run test:ios-import-export && bun run test:ios-import-pickers && bun run test:ios-import-recovery && bun run test:ios-recovery && bun run test:ios-resume && bun run test:ios-tail-handoff && bun run test:ios-tui-render && bun run test:p8-error && bun run test:ios-tui-routing && bun run test:ios-updater-sync-validation && bun run test:ios-verify-app && bun run test:ios-marketing-version && bun run test:android-version && bun run test:platform-flow-contract && bun run test:tail-engine-shared && bun run test:prescan && bun run test:android-reporting-api && bun run test:android-gcp && bun run test:android-app-verification && bun run test:android-rename && bun run test:appflow-auth && bun run test:appflow-api-map && bun run test:appflow-validate && bun run test:appflow-flow && bun run test:appflow-gapfill && bun run test:appflow-engine && bun run test:appflow-tail && bun run test:appflow-fetch && bun run test:appflow-sa-decode && bun run test:app-permission-helper && bun run test:2fa-compliance-network && bun run test:organization-set-api-host && bun run test:trial-warning && bun run test:plan-validation","test:build-platform-selection":"bun test/test-build-platform-selection.mjs","test:builder-project-discovery":"bun test/test-builder-project-discovery.mjs","test:builder-app-selection":"bun test/test-builder-app-selection.mjs","test:builder-login-gate":"bun test/test-builder-login-gate.mjs","test:ai-log-capture":"bun test/test-ai-log-capture.mjs","test:ai-analyze-flow":"bun test/test-ai-analyze-flow.mjs","test:cicd-failure-help":"bun test/test-cicd-failure-help.mjs","test:ai-analyze-stream":"bun test/test-ai-analyze-stream.mjs","test:ai-sse-parser":"bun test/test-ai-sse-parser.mjs","test:ai-render-markdown":"bun test/test-ai-render-markdown.mjs","test:ai-onboarding-mode":"bun test/test-ai-onboarding-mode.mjs","test:ai-fit":"bun test/test-ai-fit.mjs","test:platform-layout":"bun test/test-platform-layout.mjs","test:frame-fit":"bun test/run-frame-fit.mjs","test:onboarding-min-size":"bun test/test-onboarding-min-size.mjs","test:min-size-gate":"bun test/test-min-size-gate.mjs","test:shell-size-gate":"bun test/test-shell-size-gate.mjs","test:build-log-sanitize":"bun test/test-build-log-sanitize.mjs","test:build-output-viewport":"bun test/test-build-output-viewport.mjs","test:diff-viewer-viewport":"bun test/test-diff-viewer-viewport.mjs","test:build-complete-exit":"bun test/test-build-complete-exit.mjs","test:ai-stream-markdown":"bun test/test-ai-stream-markdown.mjs","test:support-mailto":"bun test/test-support-mailto.mjs","test:support-redact":"bun test/test-support-redact.mjs","test:support-internal-log":"bun test/test-support-internal-log.mjs","test:support-help-menu":"bun test/test-support-help-menu.mjs","test:support-contact":"bun test/test-support-contact.mjs","test:support-upload-prompt":"bun test/test-support-upload-prompt.mjs","test:support-bundle-files":"bun test/test-support-bundle-files.mjs","test:mcp-live-update-onboarding":"bun test/test-mcp-live-update-onboarding.mjs","test:app-set-options":"bun test/test-app-set-options.mjs && bun test/test-app-list-options.mjs","test:android-reporting-api":"bun test/test-android-reporting-api.mjs","test:android-gcp":"bun test/test-android-gcp.mjs","test:android-app-verification":"bun test/test-android-app-verification.mjs","test:android-rename":"bun test/test-android-rename.mjs","test:appflow-auth":"bun test/test-appflow-auth.mjs","test:appflow-api-map":"bun test/test-appflow-api-map.mjs","test:appflow-validate":"bun test/test-appflow-validate.mjs","test:appflow-flow":"bun test/test-appflow-flow.mjs","test:appflow-gapfill":"bun test/test-appflow-gapfill.mjs","test:appflow-engine":"bun test/test-appflow-engine.mjs","test:appflow-tail":"bun test/test-appflow-tail.mjs","test:appflow-fetch":"bun test/test-appflow-fetch.mjs","test:appflow-sa-decode":"bun test/test-appflow-sa-decode.mjs","test:app-permission-helper":"bun test/test-app-permission-helper.mjs","test:2fa-compliance-network":"bun test/test-2fa-compliance-network.mjs","test:organization-set-api-host":"bun test/test-organization-set-api-host.mjs","test:trial-warning":"bun test/test-trial-warning.mjs","test:plan-validation":"bun test/test-plan-validation.mjs","test:auto-bump-version":"bun test/test-auto-bump-version.mjs","test:auto-bump-ai-diff":"bun test/test-auto-bump-ai-diff.mjs","test:ios-provisioning-map":"bun test/test-ios-provisioning-map.mjs","test:ios-provisioning-command":"bun test/test-ios-provisioning-command.mjs","test:channel-list":"bun test/test-channel-list.mjs"},dependencies:{"@inkjs/ui":"^2.0.0","@manypkg/tools":"^2.1.2","@rrweb/types":"^2.1.1","@standard-schema/spec":"^1.1.0","@xmldom/xmldom":"^0.9.10","@xterm/addon-serialize":"^0.14.0","@xterm/headless":"^6.0.0","agent-cli-detector":"^0.1.6","happy-dom":"^20.11.0",ink:"^7.1.1","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.4.0",qrcode:"^1.5.4",react:"^19.2.8","rrweb-snapshot":"^2.1.1","string-width":"^8.2.2",typescript:"6.0.3",zod:"^4.5.4"},optionalDependencies:{"@capgo/cli-helper-darwin-arm64":"^1.1.1","@capgo/cli-helper-darwin-x64":"^1.1.1","node-pty":"^1.1.0"},devDependencies:{"@antfu/eslint-config":"^9.2.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.6","@capacitor/cli":"^8.4.2","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.7.0","@modelcontextprotocol/client":"^2.0.0-beta.5","@modelcontextprotocol/server":"^2.0.0-beta.5","@sauber/table":"npm:@jsr/sauber__table","@sinonjs/fake-timers":"15.4.0","@std/semver":"npm:@jsr/std__semver@1.0.8","@supabase/supabase-js":"^2.110.8","@tanstack/intent":"^0.3.6","@types/adm-zip":"^0.5.8","@types/jsonwebtoken":"^9.0.10","@types/node":"^26.1.1","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/qrcode":"^1.5.6","@types/react":"^19.2.17","@types/tmp":"^0.2.6","@types/ws":"^8.18.1","@typescript/native-preview":"7.0.0-dev.20260707.2","@vercel/ncc":"^0.44.1","@vue/compiler-dom":"3.5.40","@xterm/headless":"^6.0.0","adm-zip":"^0.6.0","ci-info":"^4.4.0",commander:"^15.0.0",eslint:"^10.7.0","git-format-staged":"4.0.2",husky:"^9.1.7","is-wsl":"^3.1.1",micromatch:"^4.0.8",open:"^11.0.0",oxlint:"^1.75.0",partysocket:"^1.3.0",prettyjson:"^1.2.5",tmp:"^0.2.7","tus-js-client":"^4.3.1",ws:"^8.21.1"}}});var ZD;var Z6=T(()=>{ZD=class ZD extends Error{context;constructor(D,$){super(D);this.name="CliUserError",this.context=$}}});import{platform as kC}from"node:os";import{version as _C}from"node:process";function KH(D){BH=D}function gC(D){for(let $=0;$<D.length;$++)if(D.charCodeAt($)>255)return!1;return!0}function WH(D){if(D.toLowerCase()==="x-capgo-log-token")return"Build log token is missing. Re-run the build command or pass a valid log token.";return"Capgo API key is missing. Run `npx -y @capgo/cli@latest login` or pass `--apikey`."}function fC(D){if(D.toLowerCase()==="x-capgo-log-token")return"Build log token contains invalid characters (only ASCII is allowed). Re-run the build command to get a fresh token.";if(D.toLowerCase()==="authorization")return"Authorization header contains invalid characters (only ASCII is allowed). Check your Capgo API key or Supabase anon key configuration.";return"Capgo API key contains invalid characters (only ASCII is allowed). Copy the key from the Capgo dashboard."}function HF(D,$){if($===void 0||$===null){if(qF.has(D.toLowerCase()))throw new ZD(WH(D));throw new ZD(`HTTP header "${D}" is missing or invalid.`)}if(typeof $!=="string"){if(qF.has(D.toLowerCase()))throw new ZD(WH(D));throw new ZD(`HTTP header "${D}" is missing or invalid.`)}if(!gC($)){if(qF.has(D.toLowerCase()))throw new ZD(fC(D));throw new ZD(`HTTP header "${D}" contains invalid characters (only ASCII is allowed).`)}return $}function J0(D){let $={capgo_api:xC,"x-cli-version":t$.version,"x-cli-command":BH,"x-cli-node":_C,"x-cli-os":kC()};if(D)for(let[U,I]of Object.entries(D))$[U]=HF(U,I);return $}var xC="2025-10-01",BH="",qF;var d3=T(()=>{A1();Z6();qF=new Set(["authorization","capgkey","x-capgo-log-token"])});import{existsSync as V$}from"fs";var v2=(D=".",$="unknown")=>{let U=`${D}/bun.lockb`,I=`${D}/bun.lock`,F=`${D}/pnpm-lock.yaml`,J=`${D}/shrinkwrap.yaml`,X=`${D}/yarn.lock`,Q=`${D}/package-lock.json`,Y=`${D}/npm-shrinkwrap.json`;if(V$(U)||V$(I))return"bun";if(V$(F)||V$(J))return"pnpm";if(V$(X))return"yarn";if(V$(Q)||V$(Y))return"npm";return $},c3=(D=v2(),$=!1)=>{switch(D){case"bun":return $?"bun install":"install";case"pnpm":return $?"pnpm install":"install";case"yarn":return $?"yarn install":"install";case"npm":return $?"npm install":"install";case"unknown":return $?"unknown unknown":"unknown";default:return $?"npm install":"install"}},GH=(D=".",$="npx")=>{let U=`${D}/bun.lockb`,I=`${D}/bun.lock`,F=`${D}/pnpm-lock.yaml`,J=`${D}/shrinkwrap.yaml`,X=`${D}/yarn.lock`,Q=`${D}/package-lock.json`,Y=`${D}/npm-shrinkwrap.json`;if(V$(U)||V$(I))return"bunx";if(V$(F)||V$(J))return"pnpm exec";if(V$(X))return"yarn dlx";if(V$(Q)||V$(Y))return"npx";return $};var qH=()=>{};var HH,NH=(D)=>{return D===12288||D>=65281&&D<=65376||D>=65504&&D<=65510},zH=(D)=>{return D===8987||D===9001||D>=12272&&D<=12287||D>=12289&&D<=12350||D>=12441&&D<=12543||D>=12549&&D<=12591||D>=12593&&D<=12686||D>=12688&&D<=12771||D>=12783&&D<=12830||D>=12832&&D<=12871||D>=12880&&D<=19903||D>=65040&&D<=65049||D>=65072&&D<=65106||D>=65108&&D<=65126||D>=65128&&D<=65131||D>=127488&&D<=127490||D>=127504&&D<=127547||D>=127552&&D<=127560||D>=131072&&D<=196605||D>=196608&&D<=262141};var LH=T(()=>{HH=(()=>{let D=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return($)=>{let U=0;D.lastIndex=0;while(D.test($))U+=1;return $.length-U}})()});var yC,mC,wH,hC,ZH,nC,iC,lC,MH=(D,$={},U={})=>{let I=$.limit??1/0,F=$.ellipsis??"",J=$?.ellipsisWidth??(F?MH(F,lC,U).width:0),X=0,Q=U.controlWidth??0,Y=U.tabWidth??8,W=U.emojiWidth??2,B=2,K=U.regularWidth??1,q=U.wideWidth??2,H=[[nC,K],[yC,0],[mC,Q],[hC,Y],[ZH,W],[wH,q]],G=0,z=0,N=D.length,M=0,Z=!1,L=N,v=Math.max(0,I-J),A=0,V=0,b=0,y=0;D:while(!0){if(V>A||z>=N&&z>G){let _=D.slice(A,V)||D.slice(G,z);M=0;for(let n of _.replaceAll(iC,"")){let m=n.codePointAt(0)||0;if(NH(m))y=2;else if(zH(m))y=q;else y=K;if(b+y>v)L=Math.min(L,Math.max(A,G)+M);if(b+y>I){Z=!0;break D}M+=n.length,b+=y}A=V=0}if(z>=N)break D;for(let _=0,n=H.length;_<n;_++){let[m,UD]=H[_];if(m.lastIndex=z,m.test(D)){if(M=m===wH?HH(D.slice(z,m.lastIndex)):m===ZH?1:m.lastIndex-z,y=M*UD,b+y>v)L=Math.min(L,z+Math.floor((v-b)/UD));if(b+y>I){Z=!0;break D}b+=y,A=G,V=z,z=G=m.lastIndex;continue D}}z+=1}return{width:Z?v:b,index:Z?L:N,truncated:Z,ellipsed:Z&&I>=J}},OH;var EH=T(()=>{LH();yC=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,mC=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,wH=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,hC=/\t{1,1000}/y,ZH=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,nC=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,iC=/\p{M}+/gu,lC={limit:1/0,ellipsis:""},OH=MH});var dC,cC=(D,$={})=>{return OH(D,dC,$).width},X0;var NF=T(()=>{EH();dC={limit:1/0,ellipsis:"",ellipsisWidth:0},X0=cC});function g0(D,$,U){return String(D).normalize().split(aC).map((I)=>tC(I,$,U)).join(`
|
|
2
2
|
`)}var p3="\x1B",RH="",pC=39,LF="\x07",SH="[",rC="]",TH="m",wF,vH,VH=(D)=>{if(D>=30&&D<=37)return 39;if(D>=90&&D<=97)return 39;if(D>=40&&D<=47)return 49;if(D>=100&&D<=107)return 49;if(D===1||D===2)return 22;if(D===3)return 23;if(D===4)return 24;if(D===7)return 27;if(D===8)return 28;if(D===9)return 29;if(D===0)return 0;return},jH=(D)=>`${p3}${SH}${D}${TH}`,AH=(D)=>`${p3}${wF}${D}${LF}`,zF=(D,$,U)=>{let I=$[Symbol.iterator](),F=!1,J=!1,X=D.at(-1),Q=X===void 0?0:X0(X),Y=I.next(),W=I.next(),B=0;while(!Y.done){let K=Y.value,q=X0(K);if(Q+q<=U)D[D.length-1]+=K;else D.push(K),Q=0;if(K===p3||K===RH)F=!0,J=$.startsWith(wF,B+1);if(F){if(J){if(K===LF)F=!1,J=!1}else if(K===TH)F=!1}else if(Q+=q,Q===U&&!W.done)D.push(""),Q=0;Y=W,W=I.next(),B+=K.length}if(X=D.at(-1),!Q&&X!==void 0&&X.length&&D.length>1)D[D.length-2]+=D.pop()},oC=(D)=>{let $=D.split(" "),U=$.length;while(U){if(X0($[U-1]))break;U--}if(U===$.length)return D;return $.slice(0,U).join(" ")+$.slice(U).join("")},tC=(D,$,U={})=>{if(U.trim!==!1&&D.trim()==="")return"";let I="",F,J,X=D.split(" "),Q=[""],Y=0;for(let K=0;K<X.length;K++){let q=X[K];if(U.trim!==!1){let G=Q.at(-1)??"",z=G.trimStart();if(G.length!==z.length)Q[Q.length-1]=z,Y=X0(z)}if(K!==0){if(Y>=$&&(U.wordWrap===!1||U.trim===!1))Q.push(""),Y=0;if(Y||U.trim===!1)Q[Q.length-1]+=" ",Y++}let H=X0(q);if(U.hard&&H>$){let G=$-Y,z=1+Math.floor((H-G-1)/$);if(Math.floor((H-1)/$)<z)Q.push("");zF(Q,q,$),Y=X0(Q.at(-1)??"");continue}if(Y+H>$&&Y&&H){if(U.wordWrap===!1&&Y<$){zF(Q,q,$),Y=X0(Q.at(-1)??"");continue}Q.push(""),Y=0}if(Y+H>$&&U.wordWrap===!1){zF(Q,q,$),Y=X0(Q.at(-1)??"");continue}Q[Q.length-1]+=q,Y+=H}if(U.trim!==!1)Q=Q.map((K)=>oC(K));let W=Q.join(`
|
|
3
3
|
`),B=!1;for(let K=0;K<W.length;K++){let q=W[K];if(I+=q,!B){if(B=q>="\uD800"&&q<="\uDBFF",B)continue}else B=!1;if(q===p3||q===RH){vH.lastIndex=K+1;let G=vH.exec(W)?.groups;if(G?.code!==void 0){let z=Number.parseFloat(G.code);F=z===pC?void 0:z}else if(G?.uri!==void 0)J=G.uri.length===0?void 0:G.uri}if(W[K+1]===`
|
|
4
4
|
`){if(J)I+=AH("");let H=F?VH(F):void 0;if(F&&H)I+=jH(H)}else if(q===`
|