@capgo/cli 8.52.0 → 8.53.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +597 -597
- package/dist/notify-app-ready-worker.js +194 -194
- package/dist/package.json +1 -1
- package/dist/src/notify-app-ready-background.d.ts +1 -11
- package/dist/src/onboarding/background-api.d.ts +2 -0
- package/dist/src/onboarding/background-check.d.ts +9 -0
- package/dist/src/onboarding/background.d.ts +13 -0
- package/dist/src/onboarding/updater-installed.d.ts +2 -0
- package/dist/src/sdk.js +3 -3
- package/dist/src/updater-installed-background.d.ts +2 -0
- package/dist/src/updater-installed-worker.d.ts +1 -0
- package/dist/src/utils.d.ts +2 -12
- package/dist/updater-installed-worker.js +416 -0
- package/package.json +1 -1
- package/skills/usage/SKILL.md +3 -0
package/dist/package.json
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
1
|
import type { Command } from 'commander';
|
|
2
|
-
export
|
|
3
|
-
cwd: string;
|
|
4
|
-
command: string;
|
|
5
|
-
appId?: string;
|
|
6
|
-
apikey?: string;
|
|
7
|
-
capacitorConfig?: string;
|
|
8
|
-
packageJson?: string;
|
|
9
|
-
mainFile?: string;
|
|
10
|
-
supaHost?: string;
|
|
11
|
-
supaAnon?: string;
|
|
12
|
-
}
|
|
2
|
+
export type { OnboardingCheckOptions as NotifyAppReadyCheckOptions } from './onboarding/background';
|
|
13
3
|
export declare function startNotifyAppReadyCheck(command: Command, commandPath: string): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { OnboardingCheckOptions } from './background';
|
|
2
|
+
import type { NotifyAppReadyProject } from './notify-app-ready-project';
|
|
3
|
+
interface BackgroundOnboardingCheck {
|
|
4
|
+
channel: 'notify-app-ready' | 'updater-installed';
|
|
5
|
+
step: 'add_code' | 'add_updater';
|
|
6
|
+
scan: (project: NotifyAppReadyProject) => 'found' | 'not_found' | 'unknown';
|
|
7
|
+
}
|
|
8
|
+
export declare function runOnboardingCheck(options: OnboardingCheckOptions, check: BackgroundOnboardingCheck): Promise<void>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
export interface OnboardingCheckOptions {
|
|
3
|
+
cwd: string;
|
|
4
|
+
command: string;
|
|
5
|
+
appId?: string;
|
|
6
|
+
apikey?: string;
|
|
7
|
+
capacitorConfig?: string;
|
|
8
|
+
packageJson?: string;
|
|
9
|
+
mainFile?: string;
|
|
10
|
+
supaHost?: string;
|
|
11
|
+
supaAnon?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function startOnboardingCheck(command: Command, commandPath: string, workerUrl: URL): void;
|
package/dist/src/sdk.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as Bj0}from"node:module";var module={exports:{}};var Oj0=Object.create;var{getPrototypeOf:zj0,defineProperty:rF,getOwnPropertyNames:Ib}=Object;var H2=Object.prototype.hasOwnProperty;function V2($){return this[$]}var H0=($,D,Q)=>{var X=Ib(D);for(let J of X)if(!H2.call($,J)&&J!=="default")rF($,J,{get:V2.bind(D,J),enumerable:!0});if(Q){for(let J of X)if(!H2.call(Q,J)&&J!=="default")rF(Q,J,{get:V2.bind(D,J),enumerable:!0});return Q}},Lj0,Mj0,S1=($,D,Q)=>{var X=$!=null&&typeof $==="object";if(X){var J=D?Lj0??=new WeakMap:Mj0??=new WeakMap,Y=J.get($);if(Y)return Y}Q=$!=null?Oj0(zj0($)):{};let Z=D||!$||!$.__esModule?rF(Q,"default",{value:$,enumerable:!0}):Q;for(let F of Ib($))if(!H2.call(Z,F))rF(Z,F,{get:V2.bind($,F),enumerable:!0});if(X)J.set($,Z);return Z};var E=($,D)=>()=>(D||$((D={exports:{}}).exports,D),D.exports);var Nj0=($)=>$;function wj0($,D){this[$]=Nj0.bind(null,D)}var Q6=($,D)=>{for(var Q in D)rF($,Q,{get:D[Q],enumerable:!0,configurable:!0,set:wj0.bind(D,Q)})};var t=($,D)=>()=>($&&(D=$($=0)),D);var Q0=Bj0(import.meta.url);var i$;var Q8=t(()=>{i$={name:"@capgo/cli",type:"module",version:"8.52.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: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:ci-secrets":"bun test/test-ci-secrets.mjs","test:android-onboarding-progress":"bun test/test-android-onboarding-progress.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: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-list-output-text":"bun test/test-app-list-output-text.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: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:init-monorepo-targeting":"bun run test:capacitor-config-target && 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:manifest-path-encoding":"bun test/test-manifest-path-encoding.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-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 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: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:ci-secrets && bun run test:android-onboarding-progress && 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: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-list-output-text && 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: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:manifest-path-encoding && 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-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: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.4.3"},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","@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 U0;var y1=t(()=>{U0=class U0 extends Error{context;constructor($,D){super($);this.name="CliUserError",this.context=D}}});import{platform as Ej0}from"node:os";import{version as jj0}from"node:process";function Tj0($){for(let D=0;D<$.length;D++)if($.charCodeAt(D)>255)return!1;return!0}function Tb($){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 Cj0($){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 z2($,D){if(D===void 0||D===null){if(O2.has($.toLowerCase()))throw new U0(Tb($));throw new U0(`HTTP header "${$}" is missing or invalid.`)}if(typeof D!=="string"){if(O2.has($.toLowerCase()))throw new U0(Tb($));throw new U0(`HTTP header "${$}" is missing or invalid.`)}if(!Tj0(D)){if(O2.has($.toLowerCase()))throw new U0(Cj0($));throw new U0(`HTTP header "${$}" contains invalid characters (only ASCII is allowed).`)}return D}function c1($){let D={capgo_api:Aj0,"x-cli-version":i$.version,"x-cli-command":Ij0,"x-cli-node":jj0,"x-cli-os":Ej0()};if($)for(let[Q,X]of Object.entries($))D[Q]=z2(Q,X);return D}var Aj0="2025-10-01",Ij0="",O2;var a6=t(()=>{Q8();y1();O2=new Set(["authorization","capgkey","x-capgo-log-token"])});var Cb,Pb=($)=>{return $===12288||$>=65281&&$<=65376||$>=65504&&$<=65510},Sb=($)=>{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 xb=t(()=>{Cb=(()=>{let $=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return(D)=>{let Q=0;$.lastIndex=0;while($.test(D))Q+=1;return D.length-Q}})()});var Pj0,Sj0,_b,xj0,vb,_j0,vj0,kj0,kb=($,D={},Q={})=>{let X=D.limit??1/0,J=D.ellipsis??"",Y=D?.ellipsisWidth??(J?kb(J,kj0,Q).width:0),Z=0,F=Q.controlWidth??0,G=Q.tabWidth??8,U=Q.emojiWidth??2,W=2,q=Q.regularWidth??1,K=Q.wideWidth??2,H=[[_j0,q],[Pj0,0],[Sj0,F],[xj0,G],[vb,U],[_b,K]],V=0,O=0,z=$.length,N=0,B=!1,L=z,M=Math.max(0,X-Y),w=0,R=0,x=0,_=0;$:while(!0){if(R>w||O>=z&&O>V){let j=$.slice(w,R)||$.slice(V,O);N=0;for(let k of j.replaceAll(vj0,"")){let v=k.codePointAt(0)||0;if(Pb(v))_=2;else if(Sb(v))_=K;else _=q;if(x+_>M)L=Math.min(L,Math.max(w,V)+N);if(x+_>X){B=!0;break $}N+=k.length,x+=_}w=R=0}if(O>=z)break $;for(let j=0,k=H.length;j<k;j++){let[v,g]=H[j];if(v.lastIndex=O,v.test($)){if(N=v===_b?Cb($.slice(O,v.lastIndex)):v===vb?1:v.lastIndex-O,_=N*g,x+_>M)L=Math.min(L,O+Math.floor((M-x)/g));if(x+_>X){B=!0;break $}x+=_,w=V,R=O,O=V=v.lastIndex;continue $}}O+=1}return{width:B?M:x,index:B?L:z,truncated:B,ellipsed:B&&X>=Y}},yb;var fb=t(()=>{xb();Pj0=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Sj0=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,_b=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,xj0=/\t{1,1000}/y,vb=/[\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,_j0=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,vj0=/\p{M}+/gu,kj0={limit:1/0,ellipsis:""},yb=kb});var yj0,fj0=($,D={})=>{return yb($,yj0,D).width},P8;var L2=t(()=>{fb();yj0={limit:1/0,ellipsis:"",ellipsisWidth:0},P8=fj0});function E7($,D,Q){return String($).normalize().split(mj0).map((X)=>gj0(X,D,Q)).join(`
|
|
1
|
+
import{createRequire as Bj0}from"node:module";var module={exports:{}};var Oj0=Object.create;var{getPrototypeOf:zj0,defineProperty:rF,getOwnPropertyNames:Ib}=Object;var H2=Object.prototype.hasOwnProperty;function V2($){return this[$]}var H0=($,D,Q)=>{var X=Ib(D);for(let J of X)if(!H2.call($,J)&&J!=="default")rF($,J,{get:V2.bind(D,J),enumerable:!0});if(Q){for(let J of X)if(!H2.call(Q,J)&&J!=="default")rF(Q,J,{get:V2.bind(D,J),enumerable:!0});return Q}},Lj0,Mj0,S1=($,D,Q)=>{var X=$!=null&&typeof $==="object";if(X){var J=D?Lj0??=new WeakMap:Mj0??=new WeakMap,Y=J.get($);if(Y)return Y}Q=$!=null?Oj0(zj0($)):{};let Z=D||!$||!$.__esModule?rF(Q,"default",{value:$,enumerable:!0}):Q;for(let F of Ib($))if(!H2.call(Z,F))rF(Z,F,{get:V2.bind($,F),enumerable:!0});if(X)J.set($,Z);return Z};var E=($,D)=>()=>(D||$((D={exports:{}}).exports,D),D.exports);var Nj0=($)=>$;function wj0($,D){this[$]=Nj0.bind(null,D)}var Q6=($,D)=>{for(var Q in D)rF($,Q,{get:D[Q],enumerable:!0,configurable:!0,set:wj0.bind(D,Q)})};var t=($,D)=>()=>($&&(D=$($=0)),D);var Q0=Bj0(import.meta.url);var i$;var Q8=t(()=>{i$={name:"@capgo/cli",type:"module",version:"8.53.1",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: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:ci-secrets":"bun test/test-ci-secrets.mjs","test:android-onboarding-progress":"bun test/test-android-onboarding-progress.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: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-list-output-text":"bun test/test-app-list-output-text.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: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:init-monorepo-targeting":"bun run test:capacitor-config-target && 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:manifest-path-encoding":"bun test/test-manifest-path-encoding.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-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 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: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:ci-secrets && bun run test:android-onboarding-progress && 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: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-list-output-text && 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: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:manifest-path-encoding && 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-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: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.4.3"},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","@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 U0;var y1=t(()=>{U0=class U0 extends Error{context;constructor($,D){super($);this.name="CliUserError",this.context=D}}});import{platform as Ej0}from"node:os";import{version as jj0}from"node:process";function Tj0($){for(let D=0;D<$.length;D++)if($.charCodeAt(D)>255)return!1;return!0}function Tb($){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 Cj0($){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 z2($,D){if(D===void 0||D===null){if(O2.has($.toLowerCase()))throw new U0(Tb($));throw new U0(`HTTP header "${$}" is missing or invalid.`)}if(typeof D!=="string"){if(O2.has($.toLowerCase()))throw new U0(Tb($));throw new U0(`HTTP header "${$}" is missing or invalid.`)}if(!Tj0(D)){if(O2.has($.toLowerCase()))throw new U0(Cj0($));throw new U0(`HTTP header "${$}" contains invalid characters (only ASCII is allowed).`)}return D}function c1($){let D={capgo_api:Aj0,"x-cli-version":i$.version,"x-cli-command":Ij0,"x-cli-node":jj0,"x-cli-os":Ej0()};if($)for(let[Q,X]of Object.entries($))D[Q]=z2(Q,X);return D}var Aj0="2025-10-01",Ij0="",O2;var a6=t(()=>{Q8();y1();O2=new Set(["authorization","capgkey","x-capgo-log-token"])});var Cb,Pb=($)=>{return $===12288||$>=65281&&$<=65376||$>=65504&&$<=65510},Sb=($)=>{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 xb=t(()=>{Cb=(()=>{let $=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return(D)=>{let Q=0;$.lastIndex=0;while($.test(D))Q+=1;return D.length-Q}})()});var Pj0,Sj0,_b,xj0,vb,_j0,vj0,kj0,kb=($,D={},Q={})=>{let X=D.limit??1/0,J=D.ellipsis??"",Y=D?.ellipsisWidth??(J?kb(J,kj0,Q).width:0),Z=0,F=Q.controlWidth??0,G=Q.tabWidth??8,U=Q.emojiWidth??2,W=2,q=Q.regularWidth??1,K=Q.wideWidth??2,H=[[_j0,q],[Pj0,0],[Sj0,F],[xj0,G],[vb,U],[_b,K]],V=0,O=0,z=$.length,N=0,B=!1,L=z,M=Math.max(0,X-Y),w=0,R=0,x=0,_=0;$:while(!0){if(R>w||O>=z&&O>V){let j=$.slice(w,R)||$.slice(V,O);N=0;for(let k of j.replaceAll(vj0,"")){let v=k.codePointAt(0)||0;if(Pb(v))_=2;else if(Sb(v))_=K;else _=q;if(x+_>M)L=Math.min(L,Math.max(w,V)+N);if(x+_>X){B=!0;break $}N+=k.length,x+=_}w=R=0}if(O>=z)break $;for(let j=0,k=H.length;j<k;j++){let[v,g]=H[j];if(v.lastIndex=O,v.test($)){if(N=v===_b?Cb($.slice(O,v.lastIndex)):v===vb?1:v.lastIndex-O,_=N*g,x+_>M)L=Math.min(L,O+Math.floor((M-x)/g));if(x+_>X){B=!0;break $}x+=_,w=V,R=O,O=V=v.lastIndex;continue $}}O+=1}return{width:B?M:x,index:B?L:z,truncated:B,ellipsed:B&&X>=Y}},yb;var fb=t(()=>{xb();Pj0=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Sj0=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,_b=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,xj0=/\t{1,1000}/y,vb=/[\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,_j0=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,vj0=/\p{M}+/gu,kj0={limit:1/0,ellipsis:""},yb=kb});var yj0,fj0=($,D={})=>{return yb($,yj0,D).width},P8;var L2=t(()=>{fb();yj0={limit:1/0,ellipsis:"",ellipsisWidth:0},P8=fj0});function E7($,D,Q){return String($).normalize().split(mj0).map((X)=>gj0(X,D,Q)).join(`
|
|
2
2
|
`)}var sq="\x1B",mb="",uj0=39,N2="\x07",db="[",bj0="]",cb="m",w2,ub,bb=($)=>{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},hb=($)=>`${sq}${db}${$}${cb}`,gb=($)=>`${sq}${w2}${$}${N2}`,M2=($,D,Q)=>{let X=D[Symbol.iterator](),J=!1,Y=!1,Z=$.at(-1),F=Z===void 0?0:P8(Z),G=X.next(),U=X.next(),W=0;while(!G.done){let q=G.value,K=P8(q);if(F+K<=Q)$[$.length-1]+=q;else $.push(q),F=0;if(q===sq||q===mb)J=!0,Y=D.startsWith(w2,W+1);if(J){if(Y){if(q===N2)J=!1,Y=!1}else if(q===cb)J=!1}else if(F+=K,F===Q&&!U.done)$.push(""),F=0;G=U,U=X.next(),W+=q.length}if(Z=$.at(-1),!F&&Z!==void 0&&Z.length&&$.length>1)$[$.length-2]+=$.pop()},hj0=($)=>{let D=$.split(" "),Q=D.length;while(Q){if(P8(D[Q-1]))break;Q--}if(Q===D.length)return $;return D.slice(0,Q).join(" ")+D.slice(Q).join("")},gj0=($,D,Q={})=>{if(Q.trim!==!1&&$.trim()==="")return"";let X="",J,Y,Z=$.split(" "),F=[""],G=0;for(let q=0;q<Z.length;q++){let K=Z[q];if(Q.trim!==!1){let V=F.at(-1)??"",O=V.trimStart();if(V.length!==O.length)F[F.length-1]=O,G=P8(O)}if(q!==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 H=P8(K);if(Q.hard&&H>D){let V=D-G,O=1+Math.floor((H-V-1)/D);if(Math.floor((H-1)/D)<O)F.push("");M2(F,K,D),G=P8(F.at(-1)??"");continue}if(G+H>D&&G&&H){if(Q.wordWrap===!1&&G<D){M2(F,K,D),G=P8(F.at(-1)??"");continue}F.push(""),G=0}if(G+H>D&&Q.wordWrap===!1){M2(F,K,D),G=P8(F.at(-1)??"");continue}F[F.length-1]+=K,G+=H}if(Q.trim!==!1)F=F.map((q)=>hj0(q));let U=F.join(`
|
|
3
3
|
`),W=!1;for(let q=0;q<U.length;q++){let K=U[q];if(X+=K,!W){if(W=K>="\uD800"&&K<="\uDBFF",W)continue}else W=!1;if(K===sq||K===mb){ub.lastIndex=q+1;let V=ub.exec(U)?.groups;if(V?.code!==void 0){let O=Number.parseFloat(V.code);J=O===uj0?void 0:O}else if(V?.uri!==void 0)Y=V.uri.length===0?void 0:V.uri}if(U[q+1]===`
|
|
4
4
|
`){if(Y)X+=gb("");let H=J?bb(J):void 0;if(J&&H)X+=hb(H)}else if(K===`
|
|
@@ -400,7 +400,7 @@ ${IZ0.default.render($)}`}async function bL($,D,Q=!1){let{data:X,error:J}=await
|
|
|
400
400
|
`)}`),Y=Error(F.message);else T0.warn(`${F.message.replaceAll("\\n",`
|
|
401
401
|
`)}`)}if(Y)throw T0.error("Please fix the warnings and try again."),Y;T0.info("End of cli warnings.")}}async function yZ0($,D,Q,X=!0){let J=await UX(),Y=`${J.hostWeb}/settings/organization/plans`,Z=await a71($,D,["storage"],Q);if(Z==="permission_denied")await e71();if(Z==="billing_denied")await s71(Y,"Plan upgrade required for upload");let[F,G,U]=await Promise.all([i71($,D),p71($,D),r71($,D,Q)]);if(o71({trialDays:F,isPaying:G,hasCredits:U,warning:X}))T0.warn(`WARNING !!
|
|
402
402
|
Trial expires in ${F} days, upgrade here: ${J.hostWeb}/settings/organization/plans
|
|
403
|
-
`)}function kL($){try{if(!F$($))return;return YD($,"utf8").trim()||void 0}catch{return}}function L5(){let $=YX.CAPGO_TOKEN?.trim();if($)return $;let D=kL(`${wZ0()}/.capgo`);if(D)return D;return kL(".capgo")}function f0($=!1,D=(Q)=>T0.info(Q)){let Q=YX.CAPGO_TOKEN?.trim();if(Q){if(!$)D("Use CAPGO_TOKEN environment variable");return Q}let J=`${wZ0()}/.capgo`,Y=kL(J);if(Y){if(!$)D(`Use global API key ${J}`)}else if(J=".capgo",Y=kL(J),Y&&!$)D(`Use local API key ${J}`);if(!Y){let F=`No Capgo API key found. Run \`${SQ0()}\` first, then retry this command.`;throw T0.error(F),new U0(F)}return Y}async function*fZ0($){let D=await JZ($,{withFileTypes:!0});for(let Q of D){let X=V5($,Q.name);if(Q.isDirectory()&&!Q.name.startsWith(".")&&!Q.name.startsWith("node_modules")&&!Q.name.startsWith("dist"))yield*fZ0(X);else yield X}}function qX($){let Q=($.endsWith(".br")?$.slice(0,-3):$).split(".").pop()?.toLowerCase()||"";return{html:"text/html",htm:"text/html",js:"application/javascript",mjs:"application/javascript",cjs:"application/javascript",css:"text/css",json:"application/json",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",bmp:"image/bmp",webp:"image/webp",svg:"image/svg+xml",ico:"image/x-icon",avif:"image/avif",woff:"font/woff",woff2:"font/woff2",ttf:"font/ttf",otf:"font/otf",eot:"application/vnd.ms-fontobject",mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",mp4:"video/mp4",webm:"video/webm",xml:"application/xml",txt:"text/plain",md:"text/markdown",pdf:"application/pdf",wasm:"application/wasm",map:"application/json"}[Q]||"application/octet-stream"}async function uZ0($=!1,D=F4()){let Q=/(main|index)\.(ts|tsx|js|jsx)$/,X="",J=V5(D),Y=J.split("/").length;for await(let Z of fZ0(J))if(Z.split("/").length-Y<=2&&Q.test(Z)){if(X=Z,!$)T0.info(`Found main file here ${Z}`);break}return X}async function bZ0($,D){return $.from("app_versions").upsert(D,{onConflict:"name,app_id"}).eq("app_id",D.app_id).eq("name",D.name)}async function hZ0($,D,Q,X){let J={app_id:D,name:Q,version:0};try{let Y=await q1("files/upload_link",{apikey:$,body:J,useFilesHost:!0,supaHost:X?.supaHost,supaAnon:X?.supaAnon});if(Y.error){if(Y.error instanceof _D.FunctionsHttpError){let Z=await Y.error.context.json().catch(()=>({}));T0.error(`Upload URL error: ${Z.status||JSON.stringify(Z)}`)}else T0.error(`Cannot get upload url: ${Y.error.message}`);return""}return Y.data?.url??""}catch(Y){T0.error(`Cannot get upload url ${F0(Y)}`)}return""}async function*gZ0($){let D=JZ($,{withFileTypes:!0});for(let Q of D){let X=I1($,Q.name);if(Q.isDirectory())yield*gZ0(X);else yield X}}function x4($,D="5.10.0",Q="6.25.0",X="7.25.0"){if($.major===5&&v9($,i1(D)))return!0;if($.major===6&&v9($,i1(Q)))return!0;if($.major===7&&v9($,i1(X)))return!0;return!1}async function cL($){let D=[],Q=[".DS_Store",".git",".gitignore","node_modules","package-lock.json","tsconfig.json","tsconfig.app.json","tsconfig.spec.json","tsconfig.app.json","tsconfig.spec.json","tsconfig.app.json","tsconfig.spec.json"];for await(let X of gZ0($)){if(Q.some((F)=>X.includes(F))){T0.info(`Ignoring file ${X}, please ensure you have only required files in your dist folder`);continue}let J=YD(X);if(J.length===0){T0.info(`Ignoring empty file ${X}, please ensure you have only required files in your dist folder`);continue}let Y=await X5(J,"sha256"),Z=RZ0($,X);if(Z.startsWith("/"))Z=Z.substring(1);D.push({file:Z,hash:Y})}return D}async function lL($){if(BZ0()==="win32")return D51($);else return $51($)}function $51($){let D=new T_.default;return D.addLocalFolder($),D.toBuffer()}async function D51($){T0.info("Zipping file windows mode");let D=new T_.default,Q=(X,J)=>{let Y=JZ(X);for(let Z of Y){let F=I1(X,Z),G=v71(F);if(G.isFile()){let U=YD(F);D.addFile(I1(J,Z).split(EZ0).join("/"),U)}else if(G.isDirectory())Q(F,I1(J,Z))}};return Q($,""),D.toBuffer()}function $W($){let D=FX();return`App ${$} does not exist, run first \`${D.runner} @capgo/cli app add ${$}\` to create it`}function S_($){let Q=$?.originalResponse?.getBody?.(),X=$ instanceof Error?$.message:String($??"");return`${Q??""} ${X}`.includes("app_not_found")}async function mZ0($,D,Q,X,J,Y,Z,F){return new Promise((G,U)=>{s0($,{channel:"app",event:"App TUS upload",org_id:Q,tracking_version:2,tags:{"app-id":X}}),new yL.Upload(D,{endpoint:`${Z.hostFilesApi}/files/upload/attachments/`,chunkSize:F,retryDelays:[...oU],metadataForPartialUploads:{filename:`orgs/${Q}/apps/${X}/${J}.zip`,filetype:"application/gzip"},metadata:{filename:`orgs/${Q}/apps/${X}/${J}.zip`,filetype:"application/zip"},headers:c1({Authorization:$}),onError(q){if(T0.error(`Error uploading bundle: ${q.message}`),S_(q)){U(Error($W(X)));return}if(q instanceof yL.DetailedError){let K=q.originalResponse?.getBody(),H=q.originalResponse?.getStatus(),V=q.originalRequest?.getURL(),O=(()=>{try{let z=JSON.parse(K||'{"error": "unknown error"}');return z.status||z.error||z.message||"unknown error"}catch{return K||q.message}})();U(Error(`TUS upload failed (status ${H??"unknown"}, url ${V??"unknown"}): ${O}`))}else U(Error(`TUS upload failed: ${q.message||q.toString()}`))},onProgress(q,K){let H=(q/K*100).toFixed(2);Y.message(`Uploaded ${H}%`)},async onSuccess(){await s0($,{channel:"app",event:"App TUS done",org_id:Q,tracking_version:2,tags:{"app-id":X}}).catch(),G(!0)}}).start()})}async function nL($,D,Q,X){let Y=await q1("private/delete_failed_version",{apikey:$,method:"DELETE",body:{app_id:D,name:Q},supaHost:X?.supaHost,supaAnon:X?.supaAnon});if(Y.error){if(Y.error instanceof _D.FunctionsHttpError){let Z=await Y.error.context.json().catch(()=>({}));throw Error(Z.status||Z.message||JSON.stringify(Z))}throw Error(Y.error.message)}}async function dZ0($,D,Q,X,J){let Z=await q1("private/set_manifest",{apikey:$,body:{app_id:D,name:Q,manifest:X},supaHost:J?.supaHost,supaAnon:J?.supaAnon});if(Z.error){if(Z.error instanceof _D.FunctionsHttpError){let F=await Z.error.context.json().catch(()=>({}));throw Error(F.error||F.status||F.message||JSON.stringify(F))}throw Error(Z.error.message)}}async function cZ0($,D){if(!D.app_id||!D.name||!D.created_by)return T0.error("missing app_id, name, or created_by"),Promise.reject(Error("missing app_id, name, or created_by"));let{data:Q,error:X}=await $.from("channels").select().eq("app_id",D.app_id).eq("name",D.name).single();if(Q&&!X)return $.from("channels").update(D).eq("app_id",D.app_id).eq("name",D.name).select().single();return $.from("channels").insert(D).select().single()}async function s0($,D,Q,X,J){if((I7(YX.CAPGO_DISABLE_TELEMETRY)||I7(YX.CAPGO_DISABLE_POSTHOG))&&!D.notifyConsole)return;try{let
|
|
403
|
+
`)}function kL($){try{if(!F$($))return;return YD($,"utf8").trim()||void 0}catch{return}}function L5(){let $=YX.CAPGO_TOKEN?.trim();if($)return $;let D=kL(`${wZ0()}/.capgo`);if(D)return D;return kL(".capgo")}function f0($=!1,D=(Q)=>T0.info(Q)){let Q=YX.CAPGO_TOKEN?.trim();if(Q){if(!$)D("Use CAPGO_TOKEN environment variable");return Q}let J=`${wZ0()}/.capgo`,Y=kL(J);if(Y){if(!$)D(`Use global API key ${J}`)}else if(J=".capgo",Y=kL(J),Y&&!$)D(`Use local API key ${J}`);if(!Y){let F=`No Capgo API key found. Run \`${SQ0()}\` first, then retry this command.`;throw T0.error(F),new U0(F)}return Y}async function*fZ0($){let D=await JZ($,{withFileTypes:!0});for(let Q of D){let X=V5($,Q.name);if(Q.isDirectory()&&!Q.name.startsWith(".")&&!Q.name.startsWith("node_modules")&&!Q.name.startsWith("dist"))yield*fZ0(X);else yield X}}function qX($){let Q=($.endsWith(".br")?$.slice(0,-3):$).split(".").pop()?.toLowerCase()||"";return{html:"text/html",htm:"text/html",js:"application/javascript",mjs:"application/javascript",cjs:"application/javascript",css:"text/css",json:"application/json",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",bmp:"image/bmp",webp:"image/webp",svg:"image/svg+xml",ico:"image/x-icon",avif:"image/avif",woff:"font/woff",woff2:"font/woff2",ttf:"font/ttf",otf:"font/otf",eot:"application/vnd.ms-fontobject",mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",mp4:"video/mp4",webm:"video/webm",xml:"application/xml",txt:"text/plain",md:"text/markdown",pdf:"application/pdf",wasm:"application/wasm",map:"application/json"}[Q]||"application/octet-stream"}async function uZ0($=!1,D=F4()){let Q=/(main|index)\.(ts|tsx|js|jsx)$/,X="",J=V5(D),Y=J.split("/").length;for await(let Z of fZ0(J))if(Z.split("/").length-Y<=2&&Q.test(Z)){if(X=Z,!$)T0.info(`Found main file here ${Z}`);break}return X}async function bZ0($,D){return $.from("app_versions").upsert(D,{onConflict:"name,app_id"}).eq("app_id",D.app_id).eq("name",D.name)}async function hZ0($,D,Q,X){let J={app_id:D,name:Q,version:0};try{let Y=await q1("files/upload_link",{apikey:$,body:J,useFilesHost:!0,supaHost:X?.supaHost,supaAnon:X?.supaAnon});if(Y.error){if(Y.error instanceof _D.FunctionsHttpError){let Z=await Y.error.context.json().catch(()=>({}));T0.error(`Upload URL error: ${Z.status||JSON.stringify(Z)}`)}else T0.error(`Cannot get upload url: ${Y.error.message}`);return""}return Y.data?.url??""}catch(Y){T0.error(`Cannot get upload url ${F0(Y)}`)}return""}async function*gZ0($){let D=JZ($,{withFileTypes:!0});for(let Q of D){let X=I1($,Q.name);if(Q.isDirectory())yield*gZ0(X);else yield X}}function x4($,D="5.10.0",Q="6.25.0",X="7.25.0"){if($.major===5&&v9($,i1(D)))return!0;if($.major===6&&v9($,i1(Q)))return!0;if($.major===7&&v9($,i1(X)))return!0;return!1}async function cL($){let D=[],Q=[".DS_Store",".git",".gitignore","node_modules","package-lock.json","tsconfig.json","tsconfig.app.json","tsconfig.spec.json","tsconfig.app.json","tsconfig.spec.json","tsconfig.app.json","tsconfig.spec.json"];for await(let X of gZ0($)){if(Q.some((F)=>X.includes(F))){T0.info(`Ignoring file ${X}, please ensure you have only required files in your dist folder`);continue}let J=YD(X);if(J.length===0){T0.info(`Ignoring empty file ${X}, please ensure you have only required files in your dist folder`);continue}let Y=await X5(J,"sha256"),Z=RZ0($,X);if(Z.startsWith("/"))Z=Z.substring(1);D.push({file:Z,hash:Y})}return D}async function lL($){if(BZ0()==="win32")return D51($);else return $51($)}function $51($){let D=new T_.default;return D.addLocalFolder($),D.toBuffer()}async function D51($){T0.info("Zipping file windows mode");let D=new T_.default,Q=(X,J)=>{let Y=JZ(X);for(let Z of Y){let F=I1(X,Z),G=v71(F);if(G.isFile()){let U=YD(F);D.addFile(I1(J,Z).split(EZ0).join("/"),U)}else if(G.isDirectory())Q(F,I1(J,Z))}};return Q($,""),D.toBuffer()}function $W($){let D=FX();return`App ${$} does not exist, run first \`${D.runner} @capgo/cli app add ${$}\` to create it`}function S_($){let Q=$?.originalResponse?.getBody?.(),X=$ instanceof Error?$.message:String($??"");return`${Q??""} ${X}`.includes("app_not_found")}async function mZ0($,D,Q,X,J,Y,Z,F){return new Promise((G,U)=>{s0($,{channel:"app",event:"App TUS upload",org_id:Q,tracking_version:2,tags:{"app-id":X}}),new yL.Upload(D,{endpoint:`${Z.hostFilesApi}/files/upload/attachments/`,chunkSize:F,retryDelays:[...oU],metadataForPartialUploads:{filename:`orgs/${Q}/apps/${X}/${J}.zip`,filetype:"application/gzip"},metadata:{filename:`orgs/${Q}/apps/${X}/${J}.zip`,filetype:"application/zip"},headers:c1({Authorization:$}),onError(q){if(T0.error(`Error uploading bundle: ${q.message}`),S_(q)){U(Error($W(X)));return}if(q instanceof yL.DetailedError){let K=q.originalResponse?.getBody(),H=q.originalResponse?.getStatus(),V=q.originalRequest?.getURL(),O=(()=>{try{let z=JSON.parse(K||'{"error": "unknown error"}');return z.status||z.error||z.message||"unknown error"}catch{return K||q.message}})();U(Error(`TUS upload failed (status ${H??"unknown"}, url ${V??"unknown"}): ${O}`))}else U(Error(`TUS upload failed: ${q.message||q.toString()}`))},onProgress(q,K){let H=(q/K*100).toFixed(2);Y.message(`Uploaded ${H}%`)},async onSuccess(){await s0($,{channel:"app",event:"App TUS done",org_id:Q,tracking_version:2,tags:{"app-id":X}}).catch(),G(!0)}}).start()})}async function nL($,D,Q,X){let Y=await q1("private/delete_failed_version",{apikey:$,method:"DELETE",body:{app_id:D,name:Q},supaHost:X?.supaHost,supaAnon:X?.supaAnon});if(Y.error){if(Y.error instanceof _D.FunctionsHttpError){let Z=await Y.error.context.json().catch(()=>({}));throw Error(Z.status||Z.message||JSON.stringify(Z))}throw Error(Y.error.message)}}async function dZ0($,D,Q,X,J){let Z=await q1("private/set_manifest",{apikey:$,body:{app_id:D,name:Q,manifest:X},supaHost:J?.supaHost,supaAnon:J?.supaAnon});if(Z.error){if(Z.error instanceof _D.FunctionsHttpError){let F=await Z.error.context.json().catch(()=>({}));throw Error(F.error||F.status||F.message||JSON.stringify(F))}throw Error(Z.error.message)}}async function cZ0($,D){if(!D.app_id||!D.name||!D.created_by)return T0.error("missing app_id, name, or created_by"),Promise.reject(Error("missing app_id, name, or created_by"));let{data:Q,error:X}=await $.from("channels").select().eq("app_id",D.app_id).eq("name",D.name).single();if(Q&&!X)return $.from("channels").update(D).eq("app_id",D.app_id).eq("name",D.name).select().single();return $.from("channels").insert(D).select().single()}async function s0($,D,Q,X,J,Y){if((I7(YX.CAPGO_DISABLE_TELEMETRY)||I7(YX.CAPGO_DISABLE_POSTHOG))&&!D.notifyConsole)return;try{let F={};try{F=DE()}catch(H){if(Q)T0.error(`Failed to enrich event tags, sending caller tags only: ${F0(H)}`)}let G={...D,nonPersonTags:{...F,...D.nonPersonTags??{}}};if(Q)T0.info(`Get remove config: for ${D.event}`);let U=J??(await UX(!0,X)).hostApi;if(Q)T0.info(`Sending analytics event: ${JSON.stringify(G)}`);let W=new AbortController,q=setTimeout(()=>W.abort(),1e4),K=X?typeof AbortSignal.any==="function"?AbortSignal.any([W.signal,X]):X:W.signal;try{let H=await fetch(`${S8(U)}/private/events`,{method:"POST",body:JSON.stringify(G),headers:c1({"Content-Type":"application/json",capgkey:$}),signal:K,redirect:Y});if(clearTimeout(q),!H.ok)throw Error(`HTTP error! status: ${H.status}`);let V=await H.json();if(V.error&&Q)T0.error(`Failed to send analytics event: ${V.error}`)}finally{clearTimeout(q)}}catch(F){if(Q)T0.error("Failed to send Stats event details:"),T0.error(F0(F))}}function x_($){if(T0.error(`
|
|
404
404
|
\uD83D\uDD10 Access Denied: Two-Factor Authentication Required`),T0.error("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"),$)T0.error(`
|
|
405
405
|
The organization "${$}" requires all members to have 2FA enabled.`);else T0.error(`
|
|
406
406
|
This organization requires all members to have 2FA enabled.`);throw T0.error(`
|
|
@@ -505,7 +505,7 @@ ${b51($)}
|
|
|
505
505
|
Done ✅`}function g51($){let D=["Name","id"];if($.showOrg)D.push("Organization");if(D.push("Created"),$.showOrgId)D.push("Organization ID");return D}function m51($,D,Q){let X=[$.name??"",$.app_id];if(D.showOrg)X.push(Q.get($.owner_org)??"Unknown");if(X.push(KX($.created_at)),D.showOrgId)X.push($.owner_org);return X}function d51($,D,Q){let X=new m8;X.headers=g51(D),X.rows=[];for(let J of $.toReversed())X.rows.push(m51(J,D,Q));C.success("Apps"),C.success(X.toString())}async function c51($,D,Q){let X=[],J=0;while(!0){let{data:Y,error:Z}=await q1(XW(J,Q.filterByOrgId),{apikey:$,method:"GET",body:void 0,supaHost:Q.supaHost,supaAnon:Q.supaAnon});if(Z){if(!D)C.error("Apps not found");throw Error(`Apps not found: ${F0(Z)}`)}let F=Array.isArray(Y)?Y:[];if(!F.length)break;if(X.push(...F),F.length<50)break;J+=1}return X.sort((Y,Z)=>String(Z.created_at).localeCompare(String(Y.created_at)))}async function OF0($,D=!1){let Q=!D&&$.outputText;if(!D&&!Q)o0("List apps in Capgo");if(await R$(Q?{warn:(Y)=>HF0.write(`${Y}
|
|
506
506
|
`)}:void 0),Q&&$.apikey)k_("Use provided API key");$.apikey=$.apikey||f0(!1,Q?k_:void 0);let X=await U1($.apikey,$.supaHost,$.supaAnon,Boolean(Q));if(await K$(X,$.apikey),!D){if($.filterByOrgId)if(Q)HF0.write(`${VF0}
|
|
507
507
|
`);else C.warn(VF0);if(!Q)C.info("Getting active bundle in Capgo")}let J=await c51($.apikey,D||Boolean(Q),{supaHost:$.supaHost,supaAnon:$.supaAnon,filterByOrgId:$.filterByOrgId});if(F1({channel:"app",event:"Apps Listed",tags:{app_count:J.length}}),!J.length){if(!D&&!Q)C.error("No apps found");throw Error("No apps found")}if(!D)if(Q)k_(`
|
|
508
|
-
${h51(J)}`);else{let Y=new Map;if($.showOrg){let{data:Z,error:F}=await X.rpc("get_orgs_v7");if(F)throw Error(`Cannot get organizations: ${F0(F)}`);for(let G of Z??[])Y.set(G.gid,G.name??"Unknown")}C.info(`Active app in Capgo: ${J.length}`),d51(J,$,Y),Q1("Done ✅")}return J}F6();nH();import{env as l51}from"node:process";var n51=["CURSOR_AGENT","CURSOR_TRACE_ID","CLAUDECODE","CLAUDE_CODE","AIDER","GEMINI_CLI","CODEX_CLI","CAPGO_ONBOARDING_SOURCE"];function zF0($=l51){if($.CAPGO_ONBOARDING_SOURCE==="ai")return!0;return n51.some((D)=>D!=="CAPGO_ONBOARDING_SOURCE"&&Boolean($[D]))}y1();e0();var p51=/^[a-z0-9]+(\.[\w-]+)+$/i;function i51($,D,Q){if(!D.apikey){if(!Q)C.error("Missing API key, you need to provide an API key to upload your bundle");throw new U0("Missing API key")}if(!$){if(!Q)C.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw new U0("Missing appId")}if($==="io.ionic.starter"){if(!Q)C.error(`This appId ${$} cannot be used it's reserved, please change it in your capacitor config.`);throw new U0("Reserved appId, please change it in capacitor config")}if($.includes("--")){if(!Q)C.error('The app id includes illegal symbols. You cannot use "--" in the app id');throw new U0("App id includes illegal symbols")}if(!p51.test($)){if(!Q)C.error(`Invalid app ID format: "${$}"`),C.info("App ID must be in reverse domain notation (e.g., com.example.app)"),C.info("Valid format: lowercase letters, numbers, dots, hyphens, and underscores"),C.info("Examples: com.mycompany.myapp, io.capgo.app, com.example.my-app");throw new U0("Invalid app ID format")}}function r51($){if($)return $;return lH()==="mcp"?"mcp":"cli-direct"}function o51($){if(!$||typeof $!=="object")return!1;let{status:D,statusCode:Q}=$;return D===409||Q==="409"}function t51($,D){if(D===409)return!0;let Q=F0($).toLowerCase();return Q.includes("app_id_already_exists")||Q.includes("app id already exists")}async function a51($,D,Q,X){let J=0;while(!0){let{data:Y,error:Z}=await q1(XW(J,Q),{apikey:$,method:"GET",body:void 0,supaHost:X?.supaHost,supaAnon:X?.supaAnon});if(Z){let G=z8(Z);if(G===400||G===401||G===403)return null;throw Z}let F=Array.isArray(Y)?Y:[];if(F.some((G)=>G.app_id===D))return!0;if(F.length<50)return!1;J+=1}}async function s51($,D,Q,X){let{data:J,error:Y}=await q1(`app/${encodeURIComponent(D)}`,{apikey:$,method:"GET",body:void 0,supaHost:X?.supaHost,supaAnon:X?.supaAnon});if(Y){let Z=z8(Y);if(Z===404)return!1;if(Z===401||Z===403)return null;throw Y}return J?.owner_org===Q}async function e51($,D={}){let X=await(D.isAppInTargetOrganization??s51)($.apikey,$.appId,$.ownerOrg,{supaHost:$.supaHost,supaAnon:$.supaAnon});if(X===!0)return!0;if(X===!1)return!1;let Y=await(D.isAppListedInOrganization??a51)($.apikey,$.appId,$.ownerOrg,{supaHost:$.supaHost,supaAnon:$.supaAnon});if(Y===!0)return!0;if(Y===!1)return!1;throw Error("Cannot verify app ownership for this API key. Grant app.read or org.read, then retry.")}async function $Q1($,D={}){if(!t51($.createError,$.httpStatus))return"not_duplicate";try{return await e51($,D)?"duplicate_owned":"duplicate_taken"}catch(Q){throw Error(F0(Q))}}async function DQ1($,D){let Q=await sU({supaHost:D.supaHost,supaAnon:D.supaAnon}),J=Q.includes("/functions/v1")&&D.supaAnon?`Bearer ${D.supaAnon}`:$,Y=await fetch(`${Q}/app`,{method:"POST",headers:c1({"Content-Type":"application/json",Authorization:J,capgkey:$}),body:JSON.stringify({owner_org:D.ownerOrg,app_id:D.appId,name:D.name,...D.iconUrl?{icon:D.iconUrl}:{},need_onboarding:!1,created_from_onboarding:D.createdFromOnboarding,onboarding:D.onboardingSource?{source:D.onboardingSource,outcome:"in_progress"}:void 0})}),Z=await Y.json().catch(()=>null);if(!Y.ok){let G=gL(Z)||`HTTP ${Y.status}`,U=Error(G);throw U.httpStatus=Y.status,U}if(!Z?.app_id)throw Error("App create API returned no app_id");return Z}async function sL($,D,Q,X=!1,J){if(!X)o0("Adding");if(!X)await R$();D.apikey=D.apikey||f0();let Y=await O1(),Z=o1($,Y?.config);i51(Z,D,X);let F=await U1(D.apikey,D.supaHost,D.supaAnon),G=await K$(F,D.apikey);if(!Q)Q=await pL(F,D.apikey,"org.create_app");let U=Q.gid;await DW(F,D.apikey,"org.create_app",{orgId:U},{message:`Insufficient permissions to create an app in organization ${U}`,silent:X});let{name:W,icon:q}=D;if(W=W||Y.config?.appName||"Unknown",q=q||"resources/icon.png",!q||!W){if(!X)C.error("Missing argument, you need to provide a appId and a name, or be in a capacitor project");throw Error("Missing app name or icon path")}if(!X)C.info(`Adding ${Z} to Capgo`);let K=null,H=null;if(LF0(q)){if(K=MF0(q),H=qX(q)||"image/png",!X)C.warn(`Found app icon ${q}`)}else if(LF0(FZ)){if(K=MF0(FZ),H=qX(FZ)||"image/png",!X)C.warn(`Found app icon ${FZ}`)}else if(!X)C.warn(`Cannot find app icon in any of the following locations: ${q}, ${FZ}`);let V=GZ(U,Z),O;if(K&&H){let{error:L}=await F.storage.from("images").upload(V,K,{contentType:H,upsert:!1});if(L&&!o51(L)){if(!X)C.warn(`Could not upload app icon (${F0(L)}). Continuing without an icon.`)}else O=V}let z=r51(J),N=z==="mcp"?"mcp":zF0()?"ai":"cli",B=!1;try{await DQ1(D.apikey,{ownerOrg:U,appId:Z,name:W,iconUrl:O,createdFromOnboarding:z==="onboarding",onboardingSource:N,supaHost:D.supaHost,supaAnon:D.supaAnon})}catch(L){let M;try{M=await $Q1({apikey:D.apikey,appId:Z,ownerOrg:U,createError:L,httpStatus:L.httpStatus,supaHost:D.supaHost,supaAnon:D.supaAnon})}catch(w){let R=F0(w);if(!X)C.error(`Could not add app ${R}`);throw Error(`Could not add app ${R}`)}if(M==="duplicate_owned")B=!0;else if(M==="duplicate_taken"){let w=`App ID ${Z} already exists`;if(!X)C.error(`Could not add app: ${w}`);throw Error(`Could not add app: ${w}`)}else{let w=F0(L);if(!X)C.error(`Could not add app ${w}`);throw Error(`Could not add app ${w}`)}}if(B)F1({channel:"app",event:"CLI Recovered App Already Exists",appId:Z,apikey:D.apikey,orgId:U,tags:{source:z}});else await s0(D.apikey,{channel:"app",event:"App Created",icon:"\uD83C\uDD95",org_id:U,tracking_version:2,tags:{"app-id":Z,source:z},notifyConsole:!0}).catch(()=>{});if(!X){if(B)C.success(`App ${Z} already exists in Capgo`);else C.success(`App ${Z} added to Capgo`);C.info("This app is accessible to all members of your organization based on their permissions"),C.info(`Next step: upload a bundle with "npx @capgo/cli bundle upload ${Z}"`),Q1("Done ✅")}return{appId:Z,organizationUid:U,userId:G,name:W,iconUrl:O,signedURL:O}}X1();y1();e0();async function NF0($,D,Q=!1,X=!1){if(!Q)o0("Deleting");D.apikey=D.apikey||f0();let J=await O1(),Y=o1($,J?.config);if(!D.apikey){if(!Q)C.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!Y){if(!Q)C.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw new U0("Missing appId")}let Z=await U1(D.apikey,D.supaHost,D.supaAnon),F=await K$(Z,D.apikey);await h$(Z,D.apikey,Y,"app.delete",Q);let{data:G,error:U}=await q1(`app/${encodeURIComponent(Y)}`,{apikey:D.apikey,method:"GET",body:void 0,supaHost:D.supaHost,supaAnon:D.supaAnon});if(U&&z8(U)!==404){if(!Q)C.warn(`Cannot get the app owner ${F0(U)}`)}let W=typeof G?.owner_org==="string"?G.owner_org:void 0;if(!W){let N=`Cannot verify organization ownership for app ${Y}`;if(!Q)C.error(N);throw Error(N)}let{data:q,error:K}=await q1(`organization?orgId=${encodeURIComponent(W)}`,{apikey:D.apikey,method:"GET",body:void 0,supaHost:D.supaHost,supaAnon:D.supaAnon}),H=typeof q?.created_by==="string"?q.created_by:void 0;if(K||!H){let N=`Cannot verify organization ownership for app ${Y}`;if(!Q)C.error(N);throw Error(N)}if(!X&&H!==F)if(!Q){C.warn("Deleting the app is not recommended for users that are not the organization owner"),C.warn("You are invited as a super_admin but your are not the owner"),C.warn("It's strongly recommended that you do not continue!");let N=await P$({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(r0(N)||N==="no")throw C.warn("Canceled deleting the app, exiting"),new U0("App deletion cancelled")}else throw Error("Cannot delete app: you are not the organization owner");let{error:V}=W?await Z.storage.from("images").remove([GZ(W,Y)]):{error:null};if(V&&!Q)C.error("Could not delete app logo");let{error:O}=await Z.storage.from(`apps/${Y}/${F}`).remove(["versions"]);if(O&&!Q)C.error("Could not delete app version");let{error:z}=await q1(`app/${encodeURIComponent(Y)}`,{apikey:D.apikey,method:"DELETE",body:void 0,supaHost:D.supaHost,supaAnon:D.supaAnon});if(z){if(!Q)C.error("Could not delete app");throw Error(`Could not delete app: ${F0(z)}`)}if(W)await s0(D.apikey,{channel:"app",event:"App Deleted",org_id:W,tracking_version:2,tags:{"app-id":Y}}).catch(()=>{});if(!Q)C.success("App deleted in Capgo"),Q1("Done ✅");return!0}m2();X1();Q8();$D();e0();import{spawnSync as QQ1}from"node:child_process";import{readFileSync as XQ1}from"node:fs";import{dirname as f_}from"node:path";import{cwd as JQ1,version as YQ1}from"node:process";import{platform as DM,version as ZQ1}from"node:os";var FQ1="Some dependencies are not up to date";async function eL($){let D={},Q=Object.keys($);return(await Promise.all(Q.map((J)=>rH(J)))).forEach((J,Y)=>{if(J)D[Q[Y]]=J}),D}async function y_($){let D=b_($),Q=await hL(D,$),X={"@capgo/cli":i$.version};for(let[J,Y]of Q)if(J.startsWith("@capgo/")||J.startsWith("@capawesome/")||J.startsWith("capacitor"))X[J]=Y;return X}function u_($){if(!$)return;let D=$.split(",").map((Q)=>Q.trim()).filter(Boolean);return D.length>0?D:void 0}function b_($){let D=u_($);if(!D)return $$(JQ1());return f_(D[0])}function GQ1($){let D=JSON.parse(XQ1($,"utf-8"));return new Set([...Object.keys(D.dependencies??{}),...Object.keys(D.devDependencies??{})])}function jF0($,D,Q=GQ1){let X=[],J=new Set;for(let Z of $){let F=Q(Z),G=D.filter((U)=>F.has(U.name));if(G.length===0)continue;X.push({packageJsonPath:Z,packages:G});for(let U of G)J.add(U.name)}let Y=D.filter((Z)=>!J.has(Z.name));if(Y.length>0&&$[0])X.push({packageJsonPath:$[0],packages:Y});return X}function wF0($,D=DM()){if(D==="win32")return`"${$.replace(/"/g,'""')}"`;return`'${$.replaceAll("'","'\\''")}'`}function UQ1($,D,Q=DM()){if(Q==="win32")return`cd /d ${wF0($,Q)} && ${D}`;return`(cd ${wF0($,Q)} && ${D})`}function AF0($,D,Q,X=DM()){let J=u_($);if(!J||J.length<=1){let Y=b_($);return BF0($M(Y),D)}return jF0(J,D,Q).map(({packageJsonPath:Y,packages:Z})=>{let F=f_(Y),G=$M(F);return UQ1(F,BF0(G,Z),X)}).join(`
|
|
508
|
+
${h51(J)}`);else{let Y=new Map;if($.showOrg){let{data:Z,error:F}=await X.rpc("get_orgs_v7");if(F)throw Error(`Cannot get organizations: ${F0(F)}`);for(let G of Z??[])Y.set(G.gid,G.name??"Unknown")}C.info(`Active app in Capgo: ${J.length}`),d51(J,$,Y),Q1("Done ✅")}return J}F6();nH();import{env as l51}from"node:process";var n51=["CURSOR_AGENT","CURSOR_TRACE_ID","CLAUDECODE","CLAUDE_CODE","AIDER","GEMINI_CLI","CODEX_CLI","CAPGO_ONBOARDING_SOURCE"];function zF0($=l51){if($.CAPGO_ONBOARDING_SOURCE==="ai")return!0;return n51.some((D)=>D!=="CAPGO_ONBOARDING_SOURCE"&&Boolean($[D]))}y1();e0();var p51=/^[a-z0-9]+(\.[\w-]+)+$/i;function i51($,D,Q){if(!D.apikey){if(!Q)C.error("Missing API key, you need to provide an API key to upload your bundle");throw new U0("Missing API key")}if(!$){if(!Q)C.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw new U0("Missing appId")}if($==="io.ionic.starter"){if(!Q)C.error(`This appId ${$} cannot be used it's reserved, please change it in your capacitor config.`);throw new U0("Reserved appId, please change it in capacitor config")}if($.includes("--")){if(!Q)C.error('The app id includes illegal symbols. You cannot use "--" in the app id');throw new U0("App id includes illegal symbols")}if(!p51.test($)){if(!Q)C.error(`Invalid app ID format: "${$}"`),C.info("App ID must be in reverse domain notation (e.g., com.example.app)"),C.info("Valid format: lowercase letters, numbers, dots, hyphens, and underscores"),C.info("Examples: com.mycompany.myapp, io.capgo.app, com.example.my-app");throw new U0("Invalid app ID format")}}function r51($){if($)return $;return lH()==="mcp"?"mcp":"cli-direct"}function o51($){if(!$||typeof $!=="object")return!1;let{status:D,statusCode:Q}=$;return D===409||Q==="409"}function t51($,D){if(D===409)return!0;let Q=F0($).toLowerCase();return Q.includes("app_id_already_exists")||Q.includes("app id already exists")}async function a51($,D,Q,X){let J=0;while(!0){let{data:Y,error:Z}=await q1(XW(J,Q),{apikey:$,method:"GET",body:void 0,supaHost:X?.supaHost,supaAnon:X?.supaAnon});if(Z){let G=z8(Z);if(G===400||G===401||G===403)return null;throw Z}let F=Array.isArray(Y)?Y:[];if(F.some((G)=>G.app_id===D))return!0;if(F.length<50)return!1;J+=1}}async function s51($,D,Q,X){let{data:J,error:Y}=await q1(`app/${encodeURIComponent(D)}`,{apikey:$,method:"GET",body:void 0,supaHost:X?.supaHost,supaAnon:X?.supaAnon});if(Y){let Z=z8(Y);if(Z===404)return!1;if(Z===401||Z===403)return null;throw Y}return J?.owner_org===Q}async function e51($,D={}){let X=await(D.isAppInTargetOrganization??s51)($.apikey,$.appId,$.ownerOrg,{supaHost:$.supaHost,supaAnon:$.supaAnon});if(X===!0)return!0;if(X===!1)return!1;let Y=await(D.isAppListedInOrganization??a51)($.apikey,$.appId,$.ownerOrg,{supaHost:$.supaHost,supaAnon:$.supaAnon});if(Y===!0)return!0;if(Y===!1)return!1;throw Error("Cannot verify app ownership for this API key. Grant app.read or org.read, then retry.")}async function $Q1($,D={}){if(!t51($.createError,$.httpStatus))return"not_duplicate";try{return await e51($,D)?"duplicate_owned":"duplicate_taken"}catch(Q){throw Error(F0(Q))}}async function DQ1($,D){let Q=await sU({supaHost:D.supaHost,supaAnon:D.supaAnon}),J=Q.includes("/functions/v1")&&D.supaAnon?`Bearer ${D.supaAnon}`:$,Y=await fetch(`${Q}/app`,{method:"POST",headers:c1({"Content-Type":"application/json",Authorization:J,capgkey:$}),body:JSON.stringify({owner_org:D.ownerOrg,app_id:D.appId,name:D.name,...D.iconUrl?{icon:D.iconUrl}:{},need_onboarding:!1,created_from_onboarding:D.createdFromOnboarding,onboarding:D.onboardingSource?{source:D.onboardingSource,outcome:"in_progress"}:void 0})}),Z=await Y.json().catch(()=>null);if(!Y.ok){let G=gL(Z)||`HTTP ${Y.status}`,U=Error(G);throw U.httpStatus=Y.status,U}if(!Z?.app_id)throw Error("App create API returned no app_id");return Z}async function sL($,D,Q,X=!1,J){if(!X)o0("Adding");if(!X)await R$();D.apikey=D.apikey||f0();let Y=await O1(),Z=o1($,Y?.config);i51(Z,D,X);let F=await U1(D.apikey,D.supaHost,D.supaAnon),G=await K$(F,D.apikey);if(!Q)Q=await pL(F,D.apikey,"org.create_app");let U=Q.gid;await DW(F,D.apikey,"org.create_app",{orgId:U},{message:`Insufficient permissions to create an app in organization ${U}`,silent:X});let{name:W,icon:q}=D;if(W=W||Y.config?.appName||"Unknown",q=q||"resources/icon.png",!q||!W){if(!X)C.error("Missing argument, you need to provide a appId and a name, or be in a capacitor project");throw Error("Missing app name or icon path")}if(!X)C.info(`Adding ${Z} to Capgo`);let K=null,H=null;if(LF0(q)){if(K=MF0(q),H=qX(q)||"image/png",!X)C.warn(`Found app icon ${q}`)}else if(LF0(FZ)){if(K=MF0(FZ),H=qX(FZ)||"image/png",!X)C.warn(`Found app icon ${FZ}`)}else if(!X)C.warn(`Cannot find app icon in any of the following locations: ${q}, ${FZ}`);let V=GZ(U,Z),O;if(K&&H){let{error:L}=await F.storage.from("images").upload(V,K,{contentType:H,upsert:!1});if(L&&!o51(L)){if(!X)C.warn(`Could not upload app icon (${F0(L)}). Continuing without an icon.`)}else O=V}let z=r51(J),N=z==="mcp"?"mcp":zF0()?"ai":"cli",B=!1;try{await DQ1(D.apikey,{ownerOrg:U,appId:Z,name:W,iconUrl:O,createdFromOnboarding:z==="onboarding",onboardingSource:N,supaHost:D.supaHost,supaAnon:D.supaAnon})}catch(L){let M;try{M=await $Q1({apikey:D.apikey,appId:Z,ownerOrg:U,createError:L,httpStatus:L.httpStatus,supaHost:D.supaHost,supaAnon:D.supaAnon})}catch(w){let R=F0(w);if(!X)C.error(`Could not add app ${R}`);throw new U0(`Could not add app ${R}`)}if(M==="duplicate_owned")B=!0;else if(M==="duplicate_taken"){let w=`App ID ${Z} already exists`;if(!X)C.error(`Could not add app: ${w}`);throw new U0(`Could not add app: ${w}`)}else{let w=F0(L);if(!X)C.error(`Could not add app ${w}`);throw new U0(`Could not add app ${w}`)}}if(B)F1({channel:"app",event:"CLI Recovered App Already Exists",appId:Z,apikey:D.apikey,orgId:U,tags:{source:z}});else await s0(D.apikey,{channel:"app",event:"App Created",icon:"\uD83C\uDD95",org_id:U,tracking_version:2,tags:{"app-id":Z,source:z},notifyConsole:!0}).catch(()=>{});if(!X){if(B)C.success(`App ${Z} already exists in Capgo`);else C.success(`App ${Z} added to Capgo`);C.info("This app is accessible to all members of your organization based on their permissions"),C.info(`Next step: upload a bundle with "npx @capgo/cli bundle upload ${Z}"`),Q1("Done ✅")}return{appId:Z,organizationUid:U,userId:G,name:W,iconUrl:O,signedURL:O}}X1();y1();e0();async function NF0($,D,Q=!1,X=!1){if(!Q)o0("Deleting");D.apikey=D.apikey||f0();let J=await O1(),Y=o1($,J?.config);if(!D.apikey){if(!Q)C.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!Y){if(!Q)C.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw new U0("Missing appId")}let Z=await U1(D.apikey,D.supaHost,D.supaAnon),F=await K$(Z,D.apikey);await h$(Z,D.apikey,Y,"app.delete",Q);let{data:G,error:U}=await q1(`app/${encodeURIComponent(Y)}`,{apikey:D.apikey,method:"GET",body:void 0,supaHost:D.supaHost,supaAnon:D.supaAnon});if(U&&z8(U)!==404){if(!Q)C.warn(`Cannot get the app owner ${F0(U)}`)}let W=typeof G?.owner_org==="string"?G.owner_org:void 0;if(!W){let N=`Cannot verify organization ownership for app ${Y}`;if(!Q)C.error(N);throw Error(N)}let{data:q,error:K}=await q1(`organization?orgId=${encodeURIComponent(W)}`,{apikey:D.apikey,method:"GET",body:void 0,supaHost:D.supaHost,supaAnon:D.supaAnon}),H=typeof q?.created_by==="string"?q.created_by:void 0;if(K||!H){let N=`Cannot verify organization ownership for app ${Y}`;if(!Q)C.error(N);throw Error(N)}if(!X&&H!==F)if(!Q){C.warn("Deleting the app is not recommended for users that are not the organization owner"),C.warn("You are invited as a super_admin but your are not the owner"),C.warn("It's strongly recommended that you do not continue!");let N=await P$({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(r0(N)||N==="no")throw C.warn("Canceled deleting the app, exiting"),new U0("App deletion cancelled")}else throw Error("Cannot delete app: you are not the organization owner");let{error:V}=W?await Z.storage.from("images").remove([GZ(W,Y)]):{error:null};if(V&&!Q)C.error("Could not delete app logo");let{error:O}=await Z.storage.from(`apps/${Y}/${F}`).remove(["versions"]);if(O&&!Q)C.error("Could not delete app version");let{error:z}=await q1(`app/${encodeURIComponent(Y)}`,{apikey:D.apikey,method:"DELETE",body:void 0,supaHost:D.supaHost,supaAnon:D.supaAnon});if(z){if(!Q)C.error("Could not delete app");throw Error(`Could not delete app: ${F0(z)}`)}if(W)await s0(D.apikey,{channel:"app",event:"App Deleted",org_id:W,tracking_version:2,tags:{"app-id":Y}}).catch(()=>{});if(!Q)C.success("App deleted in Capgo"),Q1("Done ✅");return!0}m2();X1();Q8();$D();e0();import{spawnSync as QQ1}from"node:child_process";import{readFileSync as XQ1}from"node:fs";import{dirname as f_}from"node:path";import{cwd as JQ1,version as YQ1}from"node:process";import{platform as DM,version as ZQ1}from"node:os";var FQ1="Some dependencies are not up to date";async function eL($){let D={},Q=Object.keys($);return(await Promise.all(Q.map((J)=>rH(J)))).forEach((J,Y)=>{if(J)D[Q[Y]]=J}),D}async function y_($){let D=b_($),Q=await hL(D,$),X={"@capgo/cli":i$.version};for(let[J,Y]of Q)if(J.startsWith("@capgo/")||J.startsWith("@capawesome/")||J.startsWith("capacitor"))X[J]=Y;return X}function u_($){if(!$)return;let D=$.split(",").map((Q)=>Q.trim()).filter(Boolean);return D.length>0?D:void 0}function b_($){let D=u_($);if(!D)return $$(JQ1());return f_(D[0])}function GQ1($){let D=JSON.parse(XQ1($,"utf-8"));return new Set([...Object.keys(D.dependencies??{}),...Object.keys(D.devDependencies??{})])}function jF0($,D,Q=GQ1){let X=[],J=new Set;for(let Z of $){let F=Q(Z),G=D.filter((U)=>F.has(U.name));if(G.length===0)continue;X.push({packageJsonPath:Z,packages:G});for(let U of G)J.add(U.name)}let Y=D.filter((Z)=>!J.has(Z.name));if(Y.length>0&&$[0])X.push({packageJsonPath:$[0],packages:Y});return X}function wF0($,D=DM()){if(D==="win32")return`"${$.replace(/"/g,'""')}"`;return`'${$.replaceAll("'","'\\''")}'`}function UQ1($,D,Q=DM()){if(Q==="win32")return`cd /d ${wF0($,Q)} && ${D}`;return`(cd ${wF0($,Q)} && ${D})`}function AF0($,D,Q,X=DM()){let J=u_($);if(!J||J.length<=1){let Y=b_($);return BF0($M(Y),D)}return jF0(J,D,Q).map(({packageJsonPath:Y,packages:Z})=>{let F=f_(Y),G=$M(F);return UQ1(F,BF0(G,Z),X)}).join(`
|
|
509
509
|
`)}function WQ1($,D,Q){let X=u_($);if(!X||X.length<=1){let J=b_($);EF0($M(J),D,J);return}for(let{packageJsonPath:J,packages:Y}of jF0(X,D,Q)){let Z=f_(J);EF0($M(Z),Y,Z)}}function $M($){let D=QQ($,"npm"),Q=sX(D),X=KK($);return{pm:D,command:Q,installCommand:`${D} ${Q}`,runner:X}}function h_($,D){let Q=[];for(let X of Object.keys($)){let J=$[X],Y=D[X];if(J&&Y&&J!==Y)Q.push({name:X,installed:J,latest:Y})}return Q}function qQ1($){let D=[],Q=[];for(let X of $)if(X.name.startsWith("@capgo/"))D.push(X);else Q.push(X);return{capgo:D,other:Q}}function KQ1($,D,Q){if($==="skip")return[];if($==="all")return[...D,...Q];return D}function BF0($,D){let Q=D.map((X)=>`${X.name}@latest`).join(" ");return`${$.installCommand} ${Q}`.trim()}function RF0($){if(!$)return"";return typeof $==="string"?$:$.toString("utf8")}function EF0($,D,Q){if(D.length===0)return;let[X,...J]=$.installCommand.split(/\s+/).filter(Boolean);if(!X)throw Error("Cannot determine package manager install command");let Y=D.map((F)=>`${F.name}@latest`),Z=QQ1(X,[...J,...Y],{stdio:"pipe",cwd:Q});if(Z.error||Z.status!==0){let F=[RF0(Z.stdout),RF0(Z.stderr)].map((W)=>W.trim()).filter(Boolean).join(`
|
|
510
510
|
`),G=F?`
|
|
511
511
|
${F}`:"",U=`Dependency update failed with code ${Z.status??"unknown"}${G}`;throw Z.error??Error(U)}}function HQ1($,D){let Q=h_($,D);return{is_outdated:Q.length>0,dependency_count:Object.keys($).length,outdated_count:Q.length}}function IF0($){C.warn("\x1B[31m\uD83D\uDEA8 Some dependencies are not up to date\x1B[0m");for(let D of $)C.warn(` ${D.name}: ${D.installed} → ${D.latest}`)}function VQ1($,D,Q){if(!Q&&D.length>0)C.info(`Run:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -2883,17 +2883,7 @@ export declare function createSupabaseClient(apikey: string, supaHost?: string,
|
|
|
2883
2883
|
future_uuid?: string;
|
|
2884
2884
|
id?: number;
|
|
2885
2885
|
invite_magic_string?: string;
|
|
2886
|
-
last_name
|
|
2887
|
-
/**
|
|
2888
|
-
* Calculate checksums for iOS and Android native code in a dependency folder.
|
|
2889
|
-
* Includes both native source files and platform configuration files
|
|
2890
|
-
* (podspec, Package.swift, build.gradle) that define platform dependencies.
|
|
2891
|
-
*/
|
|
2892
|
-
? /**
|
|
2893
|
-
* Calculate checksums for iOS and Android native code in a dependency folder.
|
|
2894
|
-
* Includes both native source files and platform configuration files
|
|
2895
|
-
* (podspec, Package.swift, build.gradle) that define platform dependencies.
|
|
2896
|
-
*/: string;
|
|
2886
|
+
last_name?: string;
|
|
2897
2887
|
org_id?: string;
|
|
2898
2888
|
rbac_role_name?: string;
|
|
2899
2889
|
updated_at?: string;
|
|
@@ -5874,7 +5864,7 @@ type SendEventPayload = TrackOptions & {
|
|
|
5874
5864
|
notifyConsole?: false;
|
|
5875
5865
|
icon?: never;
|
|
5876
5866
|
});
|
|
5877
|
-
export declare function sendEvent(capgkey: string, payload: SendEventPayload, verbose?: boolean, signal?: AbortSignal, apiHost?: string): Promise<void>;
|
|
5867
|
+
export declare function sendEvent(capgkey: string, payload: SendEventPayload, verbose?: boolean, signal?: AbortSignal, apiHost?: string, redirect?: RequestInit['redirect']): Promise<void>;
|
|
5878
5868
|
export declare function show2FADeniedError(organizationName?: string): never;
|
|
5879
5869
|
export declare function filterOrgsByPermission(supabase: SupabaseClient<Database>, apikey: string, orgs: Organization[], permissionKey: string): Promise<Organization[]>;
|
|
5880
5870
|
export declare function getOrganizationListWithPermission(supabase: SupabaseClient<Database>, apikey: string, permissionKey: string): Promise<{
|