@capgo/cli 8.33.0 → 8.33.2

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.
Files changed (35) hide show
  1. package/README.md +5 -2
  2. package/dist/index.js +690 -701
  3. package/dist/package.json +5 -3
  4. package/dist/src/analytics/cli-headers.d.ts +9 -0
  5. package/dist/src/analytics/org-resolver.d.ts +3 -1
  6. package/dist/src/api/app.d.ts +16 -4
  7. package/dist/src/api/channels.d.ts +31 -46
  8. package/dist/src/api/versions.d.ts +13 -4
  9. package/dist/src/app/list.d.ts +1 -1
  10. package/dist/src/build/credentials.d.ts +6 -0
  11. package/dist/src/build/onboarding/android/types.d.ts +1 -1
  12. package/dist/src/build/onboarding/android/ui/app.d.ts +2 -0
  13. package/dist/src/build/onboarding/command.d.ts +2 -0
  14. package/dist/src/build/onboarding/types.d.ts +1 -1
  15. package/dist/src/build/onboarding/ui/app.d.ts +2 -0
  16. package/dist/src/build/onboarding/ui/components.d.ts +1 -0
  17. package/dist/src/build/onboarding/ui/shell.d.ts +2 -0
  18. package/dist/src/build/onboarding/ui/steps/android-shared.d.ts +1 -1
  19. package/dist/src/bundle/auto-bump-ai.d.ts +50 -0
  20. package/dist/src/bundle/upload.d.ts +14 -0
  21. package/dist/src/capacitor-cli.d.ts +1 -0
  22. package/dist/src/channel/add.d.ts +0 -36
  23. package/dist/src/mcp/tool-schemas.d.ts +1 -0
  24. package/dist/src/posthog.d.ts +8 -0
  25. package/dist/src/preview/qr.d.ts +13 -9
  26. package/dist/src/schemas/auth.d.ts +2 -2
  27. package/dist/src/schemas/build.d.ts +22 -0
  28. package/dist/src/schemas/bundle.d.ts +2 -0
  29. package/dist/src/schemas/sdk.d.ts +15 -0
  30. package/dist/src/sdk.js +384 -395
  31. package/dist/src/shared/cli-user-error.d.ts +20 -0
  32. package/dist/src/types/supabase.types.d.ts +3 -0
  33. package/dist/src/utils.d.ts +23 -1
  34. package/dist/src/versionHelpers.d.ts +9 -1
  35. package/package.json +5 -3
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capgo/cli",
3
3
  "type": "module",
4
- "version": "8.33.0",
4
+ "version": "8.33.2",
5
5
  "description": "A CLI to upload to capgo servers",
6
6
  "author": "Martin martin@capgo.app",
7
7
  "license": "Apache 2.0",
@@ -73,6 +73,7 @@
73
73
  "test:upload": "bun test/test-upload-validation.mjs",
74
74
  "test:fail-on-incompatible": "bun test/test-fail-on-incompatible.mjs",
75
75
  "test:native-dependencies": "bun test/test-native-dependencies.mjs",
76
+ "test:package-json-guard": "bun test/test-package-json-guard.mjs",
76
77
  "test:credentials": "bun test/test-credentials.mjs",
77
78
  "test:asc-key-protocol": "bun test/test-asc-key-protocol.mjs",
78
79
  "test:credentials-validation": "bun test/test-credentials-validation.mjs",
@@ -160,7 +161,7 @@
160
161
  "test:ios-marketing-version": "bun test/test-ios-marketing-version.mjs",
161
162
  "test:platform-flow-contract": "bun test/test-platform-flow-contract.mjs",
162
163
  "test:tail-engine-shared": "bun test/test-tail-engine-shared.mjs",
163
- "test": "bun run build && bun run test:helper-dce && bun run test:version-detection:setup && bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:auto-bump-version && 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:credentials && 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: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: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:doctor-analytics && bun run test:posthog-exception && bun run test:build-platform-selection && 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:init-guardrails && bun run test:init-replay && 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:platform-flow-contract && bun run test:tail-engine-shared && bun run test:prescan && bun run test:android-reporting-api && 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:organization-set-api-host && bun run test:trial-warning && bun run test:plan-validation",
164
+ "test": "bun run build && bun run test:helper-dce && bun run test:version-detection:setup && bun run test:bundle && 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-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: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: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:doctor-analytics && bun run test:posthog-exception && bun run test:build-platform-selection && 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:init-guardrails && bun run test:init-replay && 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:platform-flow-contract && bun run test:tail-engine-shared && bun run test:prescan && bun run test:android-reporting-api && 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:organization-set-api-host && bun run test:trial-warning && bun run test:plan-validation",
164
165
  "test:build-platform-selection": "bun test/test-build-platform-selection.mjs",
165
166
  "test:ai-log-capture": "bun test/test-ai-log-capture.mjs",
166
167
  "test:ai-analyze-flow": "bun test/test-ai-analyze-flow.mjs",
@@ -205,7 +206,8 @@
205
206
  "test:organization-set-api-host": "bun test/test-organization-set-api-host.mjs",
206
207
  "test:trial-warning": "bun test/test-trial-warning.mjs",
207
208
  "test:plan-validation": "bun test/test-plan-validation.mjs",
208
- "test:auto-bump-version": "bun test/test-auto-bump-version.mjs"
209
+ "test:auto-bump-version": "bun test/test-auto-bump-version.mjs",
210
+ "test:auto-bump-ai-diff": "bun test/test-auto-bump-ai-diff.mjs"
209
211
  },
210
212
  "dependencies": {
211
213
  "@inkjs/ui": "^2.0.0",
@@ -0,0 +1,9 @@
1
+ /** Must match CAPGO_API_DEFAULT_VERSION until a newer version is intentionally adopted. */
2
+ export declare const CAPGO_CLI_API_VERSION = "2025-10-01";
3
+ export declare function setCurrentCliCommand(command: string): void;
4
+ export declare function getCurrentCliCommand(): string;
5
+ /**
6
+ * Build Capgo API request headers that identify this CLI invocation.
7
+ * Does not invent an API key — callers merge Authorization/capgkey when available.
8
+ */
9
+ export declare function buildCliRequestHeaders(extra?: Record<string, string>): Record<string, string>;
@@ -1,7 +1,9 @@
1
1
  import { createSupabaseClient } from '../utils';
2
2
  export interface OrgResolverDeps {
3
- /** Injectable for tests; defaults to the real Supabase client factory. */
3
+ /** @deprecated Prefer fetchOwnerOrg; kept for existing unit tests. */
4
4
  createClient?: typeof createSupabaseClient;
5
+ /** Injectable for tests; defaults to GET app via invokeCapgoCliApi. */
6
+ fetchOwnerOrg?: (apikey: string, appId: string, signal?: AbortSignal) => Promise<string | undefined>;
5
7
  }
6
8
  /**
7
9
  * Resolves an app's owner organization id (`apps.owner_org`), promise-cached
@@ -1,10 +1,19 @@
1
1
  import type { SupabaseClient } from '@supabase/supabase-js';
2
2
  import type { Database } from '../types/supabase.types';
3
- export declare function checkAppExists(supabase: SupabaseClient<Database>, appid: string): Promise<boolean>;
3
+ export declare function checkAppExists(apikey: string, appid: string, options?: {
4
+ supaHost?: string;
5
+ supaAnon?: string;
6
+ }): Promise<boolean>;
4
7
  export type PendingOnboardingApp = Pick<Database['public']['Tables']['apps']['Row'], 'app_id' | 'name' | 'icon_url' | 'need_onboarding' | 'existing_app' | 'ios_store_url' | 'android_store_url'>;
5
8
  export type ExistingOrganizationApp = Pick<Database['public']['Tables']['apps']['Row'], 'app_id' | 'name' | 'owner_org' | 'need_onboarding'>;
6
- export declare function listPendingOnboardingApps(supabase: SupabaseClient<Database>, orgId: string): Promise<PendingOnboardingApp[]>;
7
- export declare function findAppInOrganization(supabase: SupabaseClient<Database>, orgId: string, appId: string): Promise<ExistingOrganizationApp | null>;
9
+ export declare function listPendingOnboardingApps(apikey: string, orgId: string, options?: {
10
+ supaHost?: string;
11
+ supaAnon?: string;
12
+ }): Promise<PendingOnboardingApp[]>;
13
+ export declare function findAppInOrganization(apikey: string, orgId: string, appId: string, options?: {
14
+ supaHost?: string;
15
+ supaAnon?: string;
16
+ }): Promise<ExistingOrganizationApp | null>;
8
17
  export declare function completePendingOnboardingApp(_supabase: SupabaseClient<Database>, orgId: string, appId: string, apikey: string, options?: {
9
18
  supaHost?: string;
10
19
  supaAnon?: string;
@@ -12,7 +21,10 @@ export declare function completePendingOnboardingApp(_supabase: SupabaseClient<D
12
21
  /**
13
22
  * Check multiple app IDs at once for batch validation (e.g., for suggestions)
14
23
  */
15
- export declare function checkAppIdsExist(supabase: SupabaseClient<Database>, appids: string[]): Promise<{
24
+ export declare function checkAppIdsExist(apikey: string, appids: string[], options?: {
25
+ supaHost?: string;
26
+ supaAnon?: string;
27
+ }): Promise<{
16
28
  appid: string;
17
29
  exists: boolean;
18
30
  }[]>;
@@ -5,52 +5,32 @@ interface CheckVersionOptions {
5
5
  autoUnlink?: boolean;
6
6
  channelName?: string;
7
7
  requireMatch?: boolean;
8
+ apikey?: string;
9
+ supaHost?: string;
10
+ supaAnon?: string;
11
+ }
12
+ interface CapgoHttpOptions {
13
+ apikey: string;
14
+ silent?: boolean;
15
+ supaHost?: string;
16
+ supaAnon?: string;
8
17
  }
9
18
  export declare function checkVersionNotUsedInChannel(supabase: SupabaseClient<Database>, appid: string, versionData: Database['public']['Tables']['app_versions']['Row'], options?: CheckVersionOptions): Promise<void>;
10
- export declare function createChannel(supabase: SupabaseClient<Database>, update: Database['public']['Tables']['channels']['Insert']): import("@supabase/supabase-js").PostgrestBuilder<{
11
- PostgrestVersion: "14.5";
12
- }, {
13
- allow_dev: boolean;
14
- allow_device: boolean;
15
- allow_device_self_set: boolean;
16
- allow_emulator: boolean;
17
- allow_prod: boolean;
18
- android: boolean;
19
+ export declare function createChannel(options: CapgoHttpOptions, update: {
19
20
  app_id: string;
20
- created_at: string;
21
- created_by: string;
22
- disable_auto_update: Database["public"]["Enums"]["disable_update"];
23
- disable_auto_update_under_native: boolean;
24
- electron: boolean;
25
- id: number;
26
- ios: boolean;
27
- name: string;
28
- owner_org: string;
29
- public: boolean;
30
- auto_pause_action: string;
31
- auto_pause_confidence: number;
32
- auto_pause_cooldown_minutes: number;
33
- auto_pause_enabled: boolean;
34
- auto_pause_failure_rate_bps: number | null;
35
- auto_pause_last_checked_at: string | null;
36
- auto_pause_last_triggered_at: string | null;
37
- auto_pause_min_attempts: number | null;
38
- auto_pause_min_failures: number | null;
39
- auto_pause_window_minutes: number;
40
- rollout_cache_ttl_seconds: number;
41
- rollout_enabled: boolean;
42
- rollout_id: string;
43
- rollout_pause_reason: string | null;
44
- rollout_paused_at: string | null;
45
- rollout_percentage_bps: number;
46
- rollout_version: number | null;
47
- rbac_id: string;
48
- updated_at: string;
49
- version: number | null;
50
- }, false>;
51
- export declare function delChannel(supabase: SupabaseClient<Database>, name: string, appId: string): import("@supabase/supabase-js").PostgrestBuilder<{
52
- PostgrestVersion: "14.5";
53
- }, never, false>;
21
+ channel: string;
22
+ version?: string | null;
23
+ public?: boolean;
24
+ allow_device_self_set?: boolean;
25
+ [key: string]: unknown;
26
+ }): Promise<{
27
+ data: any;
28
+ error: Error | null;
29
+ }>;
30
+ export declare function delChannel(options: CapgoHttpOptions, name: string, appId: string, deleteBundle?: boolean): Promise<{
31
+ data: any;
32
+ error: Error | null;
33
+ }>;
54
34
  export declare function findChannel(supabase: SupabaseClient<Database>, appId: string, name: string): import("@supabase/supabase-js").PostgrestBuilder<{
55
35
  PostgrestVersion: "14.5";
56
36
  }, {
@@ -92,14 +72,19 @@ export declare function findChannel(supabase: SupabaseClient<Database>, appId: s
92
72
  updated_at: string;
93
73
  version: number | null;
94
74
  }, false>;
95
- export declare function findBundleIdByChannelName(supabase: SupabaseClient<Database>, appId: string, name: string): PromiseLike<{
75
+ export type ChannelLinkedVersion = {
96
76
  id: number;
97
77
  name: string;
98
- } | null>;
78
+ };
79
+ export declare function findVersionsLinkedToChannel(supabase: SupabaseClient<Database>, appId: string, name: string): Promise<{
80
+ stable: ChannelLinkedVersion | null;
81
+ rollout: ChannelLinkedVersion | null;
82
+ }>;
83
+ export declare function isVersionLinkedToOtherChannel(supabase: SupabaseClient<Database>, appId: string, versionId: number, excludeChannelName: string): Promise<boolean>;
99
84
  export type { Channel } from '../schemas/channel';
100
85
  type Channel = import('../schemas/channel').Channel;
101
86
  export declare function displayChannels(data: Channel[], silent?: boolean): void;
102
- export declare function getActiveChannels(supabase: SupabaseClient<Database>, appid: string, silent?: boolean): Promise<{
87
+ export declare function getActiveChannels(options: CapgoHttpOptions, appid: string): Promise<{
103
88
  id: number;
104
89
  name: string;
105
90
  public: boolean;
@@ -2,16 +2,25 @@ import type { SupabaseClient } from '@supabase/supabase-js';
2
2
  import type { Database } from '../types/supabase.types';
3
3
  interface VersionOptions {
4
4
  silent?: boolean;
5
+ apikey?: string;
6
+ supaHost?: string;
7
+ supaAnon?: string;
5
8
  }
6
9
  interface DeleteSpecificVersionOptions extends VersionOptions {
7
10
  autoUnlink?: boolean;
8
11
  }
9
- export declare function deleteAppVersion(supabase: SupabaseClient<Database>, appid: string, bundle: string, options?: VersionOptions): Promise<void>;
12
+ interface CapgoHttpOptions {
13
+ apikey: string;
14
+ silent?: boolean;
15
+ supaHost?: string;
16
+ supaAnon?: string;
17
+ }
18
+ export declare function deleteAppVersion(supabase: SupabaseClient<Database> | null, appid: string, bundle: string, options?: VersionOptions): Promise<void>;
10
19
  export declare function deleteSpecificVersion(supabase: SupabaseClient<Database>, appid: string, bundle: string, options?: DeleteSpecificVersionOptions): Promise<void>;
11
20
  export declare function displayBundles(data: (Database['public']['Tables']['app_versions']['Row'] & {
12
21
  keep?: string;
13
22
  })[], silent?: boolean): void;
14
- export declare function getActiveAppVersions(supabase: SupabaseClient<Database>, appid: string, options?: VersionOptions): Promise<{
23
+ export declare function getActiveAppVersions(apikeyOrClient: string | SupabaseClient<Database>, appid: string, options?: VersionOptions): Promise<{
15
24
  app_id: string;
16
25
  checksum: string | null;
17
26
  cli_version: string | null;
@@ -36,8 +45,8 @@ export declare function getActiveAppVersions(supabase: SupabaseClient<Database>,
36
45
  updated_at: string | null;
37
46
  user_id: string | null;
38
47
  }[]>;
39
- export declare function getChannelsVersion(supabase: SupabaseClient<Database>, appid: string, options?: VersionOptions): Promise<(number | null)[]>;
40
- export declare function getVersionData(supabase: SupabaseClient<Database>, appid: string, bundle: string, options?: VersionOptions): Promise<{
48
+ export declare function getChannelsVersion(options: CapgoHttpOptions, appid: string): Promise<(number | null)[]>;
49
+ export declare function getVersionData(apikeyOrClient: string | SupabaseClient<Database>, appid: string, bundle: string, options?: VersionOptions): Promise<{
41
50
  app_id: string;
42
51
  checksum: string | null;
43
52
  cli_version: string | null;
@@ -31,7 +31,7 @@ export declare function listAppInternal(options: OptionsBase, silent?: boolean):
31
31
  updated_at: string | null;
32
32
  user_id: string | null;
33
33
  }[]>;
34
- export declare function listApp(options: OptionsBase): Promise<{
34
+ export declare function listApp(options: OptionsBase, silent?: boolean): Promise<{
35
35
  allow_device_custom_id: boolean;
36
36
  allow_preview: boolean;
37
37
  android_store_url: string | null;
@@ -26,6 +26,12 @@ export type { CredentialFile, SavedCredentials } from '../schemas/build';
26
26
  export declare function parseOutputRetentionSeconds(raw: string): number;
27
27
  export declare function parseOptionalBoolean(value: boolean | string | undefined): boolean;
28
28
  export declare function parseInAppUpdatePriority(value: number | string): number;
29
+ export declare const ANDROID_PLAY_STORE_TRACKS: readonly ["internal", "alpha", "beta", "production"];
30
+ export type AndroidPlayStoreTrack = typeof ANDROID_PLAY_STORE_TRACKS[number];
31
+ export declare const ANDROID_PLAY_STORE_RELEASE_STATUSES: readonly ["draft", "completed", "inProgress", "halted"];
32
+ export type AndroidPlayStoreReleaseStatus = typeof ANDROID_PLAY_STORE_RELEASE_STATUSES[number];
33
+ export declare function parseAndroidPlayStoreTrack(value: string): AndroidPlayStoreTrack;
34
+ export declare function parseAndroidPlayStoreReleaseStatus(value: string): AndroidPlayStoreReleaseStatus;
29
35
  /**
30
36
  * Load saved credentials for a specific app
31
37
  * Checks local file first, then global file
@@ -1,5 +1,5 @@
1
1
  import type { TailProgress } from '../tail-types.js';
2
- export type AndroidOnboardingStep = 'welcome' | 'resume-prompt' | 'credentials-exist' | 'backing-up' | 'no-platform' | 'keystore-method-select' | 'keystore-explainer' | 'keystore-existing-path' | 'keystore-existing-picker' | 'keystore-existing-store-password' | 'keystore-existing-detecting-alias' | 'keystore-existing-alias-select' | 'keystore-existing-alias' | 'keystore-existing-key-password' | 'keystore-new-alias' | 'keystore-new-password-method' | 'keystore-new-store-password' | 'keystore-new-key-password' | 'keystore-new-cn' | 'keystore-generating' | 'service-account-method-select' | 'sa-json-existing-path' | 'sa-json-existing-picker' | 'sa-json-validating' | 'sa-json-validation-failed' | 'google-sign-in' | 'google-sign-in-running' | 'play-developer-id-input' | 'gcp-projects-loading' | 'gcp-projects-select' | 'gcp-project-create-name' | 'android-package-select' | 'android-app-verify' | 'gcp-setup-running' | 'saving-credentials' | 'detecting-ci-secrets' | 'ci-secrets-setup' | 'ci-secrets-target-select' | 'ask-ci-secrets' | 'checking-ci-secrets' | 'confirm-ci-secret-overwrite' | 'uploading-ci-secrets' | 'ci-secrets-failed' | 'ask-github-actions-setup' | 'confirm-secrets-push' | 'ask-export-env' | 'exporting-env' | 'confirm-env-export-overwrite' | 'overwrite-and-export-env' | 'pick-package-manager' | 'pick-build-script' | 'pick-build-script-custom' | 'preview-workflow-file' | 'view-workflow-diff' | 'writing-workflow-file' | 'ask-build' | 'requesting-build' | 'ai-analysis-prompt' | 'ai-analysis-running' | 'ai-analysis-result' | 'ai-analysis-result-scroll' | 'build-complete' | 'error' | 'support-confirm' | 'support-log-view' | 'support-uploading';
2
+ export type AndroidOnboardingStep = 'welcome' | 'resume-prompt' | 'credentials-exist' | 'backing-up' | 'no-platform' | 'keystore-method-select' | 'keystore-explainer' | 'keystore-existing-path' | 'keystore-existing-picker' | 'keystore-existing-store-password' | 'keystore-existing-detecting-alias' | 'keystore-existing-alias-select' | 'keystore-existing-alias' | 'keystore-existing-key-password' | 'keystore-new-alias' | 'keystore-new-password-method' | 'keystore-new-store-password' | 'keystore-new-key-password' | 'keystore-new-cn' | 'keystore-generating' | 'service-account-method-select' | 'sa-json-existing-path' | 'sa-json-existing-picker' | 'sa-json-validating' | 'sa-json-validation-failed' | 'google-sign-in' | 'google-sign-in-running' | 'play-developer-id-input' | 'gcp-projects-loading' | 'gcp-projects-select' | 'gcp-project-create-name' | 'android-package-select' | 'android-app-verify' | 'gcp-setup-running' | 'saving-credentials' | 'detecting-ci-secrets' | 'ci-secrets-setup' | 'ci-secrets-target-select' | 'ask-ci-secrets' | 'checking-ci-secrets' | 'confirm-ci-secret-overwrite' | 'uploading-ci-secrets' | 'ci-secrets-failed' | 'ask-github-actions-setup' | 'confirm-secrets-push' | 'ask-export-env' | 'exporting-env' | 'confirm-env-export-overwrite' | 'overwrite-and-export-env' | 'pick-package-manager' | 'pick-build-script' | 'pick-build-script-custom' | 'preview-workflow-file' | 'view-workflow-diff' | 'writing-workflow-file' | 'ask-build' | 'requesting-build' | 'build-log-view' | 'ai-analysis-prompt' | 'ai-analysis-running' | 'ai-analysis-result' | 'ai-analysis-result-scroll' | 'build-complete' | 'error' | 'support-confirm' | 'support-log-view' | 'support-uploading';
3
3
  export type AndroidOnboardingErrorCategory = 'keystore_invalid' | 'google_oauth_failed' | 'play_account_id_invalid' | 'sa_json_shape_invalid' | 'sa_json_token_rejected' | 'sa_json_no_app_access' | 'sa_json_network_error' | 'unknown';
4
4
  export type KeystoreMethod = 'existing' | 'generate';
5
5
  export type ServiceAccountMethod = 'existing' | 'generate';
@@ -9,6 +9,8 @@ interface AppProps {
9
9
  /** Optional Capgo API key passed via -a/--apikey flag; takes precedence over saved key. */
10
10
  apikey?: string;
11
11
  supaHost?: string;
12
+ /** Custom Supabase anon key for self-hosting (--supa-anon). */
13
+ supaAnon?: string;
12
14
  /** Correlation id for this onboarding run; emitted as `journey_id` on every analytics event. */
13
15
  journeyId: string;
14
16
  /** Reports the current step to the shell on every transition, so the caller can
@@ -3,6 +3,8 @@ export interface OnboardingBuilderOptions {
3
3
  apikey?: string;
4
4
  platform?: string;
5
5
  supaHost?: string;
6
+ /** Custom Supabase anon key for self-hosting (--supa-anon). */
7
+ supaAnon?: string;
6
8
  /**
7
9
  * Offer the self-update prompt as the first wizard screen. ONLY the genuine
8
10
  * `build init` / `onboarding` entrypoint sets this. Other callers that reach
@@ -17,7 +17,7 @@ export interface OnboardingResult {
17
17
  /** Present only when outcome === 'completed'. */
18
18
  summary?: OnboardingCompletionSummary;
19
19
  }
20
- export type OnboardingStep = 'welcome' | 'resume-prompt' | 'platform-select' | 'adding-platform' | 'credentials-exist' | 'backing-up' | 'setup-method-select' | 'import-scanning' | 'import-distribution-mode' | 'import-pick-identity' | 'import-pick-profile' | 'import-validating-all-certs' | 'import-checking-apple-cert' | 'import-no-match-recovery' | 'import-portal-explanation' | 'import-provide-profile-path' | 'import-create-profile-only' | 'import-export-warning' | 'import-exporting' | 'p8-source-select' | 'asc-key-generating' | 'asc-key-created' | 'api-key-instructions' | 'p8-method-select' | 'input-p8-path' | 'input-key-id' | 'input-issuer-id' | 'verifying-key' | 'verify-app' | 'creating-certificate' | 'cert-limit-prompt' | 'revoking-certificate' | 'creating-profile' | 'duplicate-profile-prompt' | 'deleting-duplicate-profiles' | 'saving-credentials' | 'detecting-ci-secrets' | 'ci-secrets-setup' | 'ci-secrets-target-select' | 'ask-ci-secrets' | 'checking-ci-secrets' | 'confirm-ci-secret-overwrite' | 'uploading-ci-secrets' | 'ci-secrets-failed' | 'ask-github-actions-setup' | 'confirm-secrets-push' | 'ask-export-env' | 'exporting-env' | 'confirm-env-export-overwrite' | 'overwrite-and-export-env' | 'pick-package-manager' | 'pick-build-script' | 'pick-build-script-custom' | 'preview-workflow-file' | 'view-workflow-diff' | 'writing-workflow-file' | 'ask-build' | 'requesting-build' | 'ai-analysis-prompt' | 'ai-analysis-running' | 'ai-analysis-result' | 'ai-analysis-result-scroll' | 'build-complete' | 'no-platform' | 'error' | 'support-confirm' | 'support-log-view' | 'support-uploading';
20
+ export type OnboardingStep = 'welcome' | 'resume-prompt' | 'platform-select' | 'adding-platform' | 'credentials-exist' | 'backing-up' | 'setup-method-select' | 'import-scanning' | 'import-distribution-mode' | 'import-pick-identity' | 'import-pick-profile' | 'import-validating-all-certs' | 'import-checking-apple-cert' | 'import-no-match-recovery' | 'import-portal-explanation' | 'import-provide-profile-path' | 'import-create-profile-only' | 'import-export-warning' | 'import-exporting' | 'p8-source-select' | 'asc-key-generating' | 'asc-key-created' | 'api-key-instructions' | 'p8-method-select' | 'input-p8-path' | 'input-key-id' | 'input-issuer-id' | 'verifying-key' | 'verify-app' | 'creating-certificate' | 'cert-limit-prompt' | 'revoking-certificate' | 'creating-profile' | 'duplicate-profile-prompt' | 'deleting-duplicate-profiles' | 'saving-credentials' | 'detecting-ci-secrets' | 'ci-secrets-setup' | 'ci-secrets-target-select' | 'ask-ci-secrets' | 'checking-ci-secrets' | 'confirm-ci-secret-overwrite' | 'uploading-ci-secrets' | 'ci-secrets-failed' | 'ask-github-actions-setup' | 'confirm-secrets-push' | 'ask-export-env' | 'exporting-env' | 'confirm-env-export-overwrite' | 'overwrite-and-export-env' | 'pick-package-manager' | 'pick-build-script' | 'pick-build-script-custom' | 'preview-workflow-file' | 'view-workflow-diff' | 'writing-workflow-file' | 'ask-build' | 'requesting-build' | 'build-log-view' | 'ai-analysis-prompt' | 'ai-analysis-running' | 'ai-analysis-result' | 'ai-analysis-result-scroll' | 'build-complete' | 'no-platform' | 'error' | 'support-confirm' | 'support-log-view' | 'support-uploading';
21
21
  export type OnboardingErrorCategory = 'apple_api_unauthorized' | 'apple_api_forbidden' | 'apple_agreements_missing' | 'apple_api_rate_limited' | 'cert_limit_reached' | 'profile_creation_failed' | 'p8_invalid' | 'keychain_no_identities' | 'keychain_export_failed' | 'profile_no_match' | 'profile_read_failed' | 'unknown';
22
22
  export interface ApiKeyData {
23
23
  keyId: string;
@@ -37,6 +37,8 @@ interface AppProps {
37
37
  /** Optional Capgo API key passed via -a/--apikey flag; takes precedence over saved key */
38
38
  apikey?: string;
39
39
  supaHost?: string;
40
+ /** Custom Supabase anon key for self-hosting (--supa-anon). */
41
+ supaAnon?: string;
40
42
  /** Correlation id for this onboarding run; emitted as `journey_id` on every analytics event. */
41
43
  journeyId: string;
42
44
  /** Reports the current step to the shell on every transition, so the caller can
@@ -144,6 +144,7 @@ export declare const FullscreenBuildOutput: FC<{
144
144
  title: string;
145
145
  lines: string[];
146
146
  terminalRows: number;
147
+ onExit?: () => void;
147
148
  }>;
148
149
  /**
149
150
  * Minimal bordered table component for the confirm-secrets-push step.
@@ -26,6 +26,8 @@ export interface OnboardingShellProps {
26
26
  guidedHelperUsable: boolean;
27
27
  apikey?: string;
28
28
  supaHost?: string;
29
+ /** Custom Supabase anon key for self-hosting (--supa-anon). */
30
+ supaAnon?: string;
29
31
  /** Correlation id for this onboarding run; threaded into every analytics event the apps emit. */
30
32
  journeyId: string;
31
33
  /** Pre-resolved platform (--platform flag or the single existing native dir); skips the picker. */
@@ -36,7 +36,7 @@ export interface ErrorStepProps {
36
36
  }
37
37
  export declare const ErrorStep: FC<ErrorStepProps>;
38
38
  export interface AiAnalysisPromptStepProps {
39
- onChoose: (choice: 'debug' | 'skip' | 'support') => void;
39
+ onChoose: (choice: 'debug' | 'logs' | 'skip' | 'support') => void;
40
40
  dense?: boolean;
41
41
  }
42
42
  export declare const AiAnalysisPromptStep: FC<AiAnalysisPromptStepProps>;
@@ -0,0 +1,50 @@
1
+ import type { SupabaseClient } from '@supabase/supabase-js';
2
+ import type { Database } from '../types/supabase.types';
3
+ import type { AutoBumpLevel } from '../versionHelpers';
4
+ export type ManifestEntry = {
5
+ file: string;
6
+ hash: string;
7
+ };
8
+ export type ManifestDiff = {
9
+ added: string[];
10
+ removed: string[];
11
+ changed: string[];
12
+ counts: {
13
+ added: number;
14
+ removed: number;
15
+ changed: number;
16
+ };
17
+ };
18
+ export type AiBumpDecision = {
19
+ level: AutoBumpLevel;
20
+ reason: string;
21
+ };
22
+ export declare function diffManifests(local: ManifestEntry[], remote: ManifestEntry[]): ManifestDiff;
23
+ export declare function fetchRemoteManifest(supabase: SupabaseClient<Database>, versionId: number): Promise<ManifestEntry[]>;
24
+ export declare function resolveBaseVersionForAutoBump(supabase: SupabaseClient<Database>, appid: string, channels: string[]): Promise<{
25
+ name: string;
26
+ id: number;
27
+ } | null>;
28
+ export declare function requestAiBumpLevel(options: {
29
+ apikey: string;
30
+ appId: string;
31
+ baseVersion: string;
32
+ manifestDiff: ManifestDiff;
33
+ nativeCompatibility?: {
34
+ summary: string;
35
+ breaking?: boolean;
36
+ };
37
+ supaHost?: string;
38
+ supaAnon?: string;
39
+ }): Promise<AiBumpDecision>;
40
+ export declare function resolveAutoBumpLevelFromAi(ctx: {
41
+ supabase: SupabaseClient<Database>;
42
+ appid: string;
43
+ channels: string[];
44
+ path: string;
45
+ apikey: string;
46
+ options?: {
47
+ supaHost?: string;
48
+ supaAnon?: string;
49
+ };
50
+ }): Promise<AiBumpDecision>;
@@ -1,10 +1,24 @@
1
1
  import type { UploadBundleResult } from '../schemas/bundle';
2
2
  import type { UploadReporter, UploadSpinner } from './reporter';
3
3
  import type { OptionsUpload } from './upload_interface';
4
+ import { CliUserError } from '../shared/cli-user-error';
4
5
  import { createSupabaseClient } from '../utils';
5
6
  type SupabaseType = Awaited<ReturnType<typeof createSupabaseClient>>;
6
7
  export type { UploadBundleResult };
7
8
  export type { UploadReporter, UploadSpinner };
9
+ /**
10
+ * Thrown when `--fail-on-incompatible` aborts an upload because the bundle is
11
+ * incompatible with the channel's current native packages. A dedicated type lets
12
+ * `uploadBundle` skip the generic "retry the upload?" prompt — retrying an
13
+ * incompatible bundle is pointless.
14
+ *
15
+ * Extends `CliUserError` so `shouldCapturePosthogException` skips it: the
16
+ * `--fail-on-incompatible` abort is a state the user asked for, not a crash, so
17
+ * it must not open an error tracking `$exception` issue. The non-zero exit, the
18
+ * printed message, and the `Bundle Upload Blocked` event stay unchanged.
19
+ */
20
+ export declare class IncompatibleBundleError extends CliUserError {
21
+ }
8
22
  export declare function getDefaultUploadChannel(appId: string, supabase: SupabaseType, hostWeb: string): Promise<string>;
9
23
  export declare function uploadBundleInternal(preAppid: string, options: OptionsUpload, silent?: boolean, reporter?: UploadReporter): Promise<UploadBundleResult>;
10
24
  /**
@@ -6,6 +6,7 @@ export interface CapacitorCliConfig {
6
6
  };
7
7
  }
8
8
  export declare const requireTS: (typescript: unknown, filePath: string) => Record<string, unknown>;
9
+ export declare const formatJSObject: (value: unknown) => string;
9
10
  export declare const loadConfig: () => Promise<CapacitorCliConfig>;
10
11
  export declare const writeConfig: (extConfig: CapacitorConfig, extConfigFilePath: string) => Promise<void>;
11
12
  export declare const findMonorepoRoot: (currentPath: string) => string;
@@ -1,41 +1,5 @@
1
1
  import type { ChannelAddOptions } from '../schemas/channel';
2
2
  export declare function addChannelInternal(channelId: string, appId: string, options: ChannelAddOptions, silent?: boolean): Promise<{
3
- allow_dev: boolean;
4
- allow_device: boolean;
5
- allow_device_self_set: boolean;
6
- allow_emulator: boolean;
7
- allow_prod: boolean;
8
- android: boolean;
9
- app_id: string;
10
- created_at: string;
11
- created_by: string;
12
- disable_auto_update: import("../sdk").Database["public"]["Enums"]["disable_update"];
13
- disable_auto_update_under_native: boolean;
14
- electron: boolean;
15
- id: number;
16
- ios: boolean;
17
3
  name: string;
18
- owner_org: string;
19
- public: boolean;
20
- auto_pause_action: string;
21
- auto_pause_confidence: number;
22
- auto_pause_cooldown_minutes: number;
23
- auto_pause_enabled: boolean;
24
- auto_pause_failure_rate_bps: number | null;
25
- auto_pause_last_checked_at: string | null;
26
- auto_pause_last_triggered_at: string | null;
27
- auto_pause_min_attempts: number | null;
28
- auto_pause_min_failures: number | null;
29
- auto_pause_window_minutes: number;
30
- rollout_cache_ttl_seconds: number;
31
- rollout_enabled: boolean;
32
- rollout_id: string;
33
- rollout_pause_reason: string | null;
34
- rollout_paused_at: string | null;
35
- rollout_percentage_bps: number;
36
- rollout_version: number | null;
37
- rbac_id: string;
38
- updated_at: string;
39
- version: number | null;
40
4
  }>;
41
5
  export declare function addChannel(channelId: string, appId: string, options: ChannelAddOptions): Promise<void>;
@@ -30,6 +30,7 @@ export declare const mcpUploadBundleInputSchema: z.ZodObject<{
30
30
  minor: "minor";
31
31
  patch: "patch";
32
32
  metadata: "metadata";
33
+ ai: "ai";
33
34
  }>>;
34
35
  encrypt: z.ZodOptional<z.ZodBoolean>;
35
36
  capacitorConfig: z.ZodOptional<z.ZodString>;
@@ -8,7 +8,15 @@ interface CapturePosthogExceptionPayload {
8
8
  }
9
9
  export declare function isTruthyEnvValue(value: string | undefined): boolean;
10
10
  export declare function getPosthogToken(): string | undefined;
11
+ /**
12
+ * Expected user-configuration failures: a bad or missing API key (401
13
+ * `invalid_apikey` / `no_key_provided`) or an app that has not been created
14
+ * yet. These are real user errors, not CLI bugs — they are still counted via
15
+ * `trackCommandFailed`, but must NOT be sent to error tracking as exceptions.
16
+ */
17
+ export declare function isExpectedUserError(error: unknown): boolean;
11
18
  export declare function shouldCapturePosthogException(error: unknown): boolean;
12
19
  export declare function getCommandPath(command: Command): string;
20
+ export declare function getInstallId(configDir?: string): string;
13
21
  export declare function capturePosthogException(payload: CapturePosthogExceptionPayload): Promise<boolean>;
14
22
  export {};
@@ -1,8 +1,13 @@
1
- import type { SupabaseClient } from '@supabase/supabase-js';
2
1
  import type { OptionsBase } from '../schemas/base';
3
- import type { Database } from '../types/supabase.types';
4
2
  import { type PreviewWebEnv } from './web-url';
5
- type CapgoSupabaseClient = SupabaseClient<Database>;
3
+ import { invokeCapgoCliApi } from '../utils';
4
+ export interface CapgoPreviewHttpOptions {
5
+ apikey: string;
6
+ supaHost?: string;
7
+ supaAnon?: string;
8
+ /** Injectable for unit tests; defaults to invokeCapgoCliApi. */
9
+ invoke?: typeof invokeCapgoCliApi;
10
+ }
6
11
  export interface PreviewQrCommandOptions extends OptionsBase {
7
12
  bundle?: string;
8
13
  channel?: string;
@@ -27,10 +32,10 @@ export type PreviewQrTarget = {
27
32
  export declare function buildPreviewQrUrl(target: PreviewQrTarget): string;
28
33
  export declare function renderTerminalQrCode(value: string): Promise<string>;
29
34
  export declare function renderQrCodePng(value: string, outputPath: string): Promise<string>;
30
- export declare function assertAppAllowsPreview(supabase: CapgoSupabaseClient, appId: string): Promise<void>;
31
- export declare function resolveBundlePreviewTarget(supabase: CapgoSupabaseClient, appId: string, bundleRef: string): Promise<PreviewQrTarget | null>;
32
- export declare function resolveChannelPreviewTarget(supabase: CapgoSupabaseClient, appId: string, channelRef: string): Promise<PreviewQrTarget | null>;
33
- export declare function resolvePreviewQrTarget(supabase: CapgoSupabaseClient, appId: string, options: Pick<PreviewQrCommandOptions, 'bundle' | 'channel' | 'target' | 'type'>): Promise<PreviewQrTarget>;
35
+ export declare function assertAppAllowsPreview(options: CapgoPreviewHttpOptions, appId: string): Promise<void>;
36
+ export declare function resolveBundlePreviewTarget(options: CapgoPreviewHttpOptions, appId: string, bundleRef: string): Promise<PreviewQrTarget | null>;
37
+ export declare function resolveChannelPreviewTarget(options: CapgoPreviewHttpOptions, appId: string, channelRef: string): Promise<PreviewQrTarget | null>;
38
+ export declare function resolvePreviewQrTarget(http: CapgoPreviewHttpOptions, appId: string, options: Pick<PreviewQrCommandOptions, 'bundle' | 'channel' | 'target' | 'type'>): Promise<PreviewQrTarget>;
34
39
  export interface PreviewQrOutputOptions {
35
40
  png?: string;
36
41
  url?: boolean;
@@ -39,6 +44,5 @@ export interface PreviewQrOutputOptions {
39
44
  }
40
45
  export declare function resolvePreviewQrOutputValue(target: PreviewQrTarget, options?: PreviewQrOutputOptions): string;
41
46
  export declare function printPreviewQrCode(target: PreviewQrTarget, options?: PreviewQrOutputOptions): Promise<void>;
42
- export declare function printPreviewQrForResolvedTarget(supabase: CapgoSupabaseClient, appId: string, target: PreviewQrTarget, options?: PreviewQrOutputOptions): Promise<void>;
47
+ export declare function printPreviewQrForResolvedTarget(http: CapgoPreviewHttpOptions, appId: string, target: PreviewQrTarget, output?: PreviewQrOutputOptions): Promise<void>;
43
48
  export declare function getPreviewQr(appId: string, target: string | undefined, options: PreviewQrCommandOptions): Promise<void>;
44
- export {};
@@ -2,13 +2,13 @@ import { z } from 'zod';
2
2
  export declare const mcpLoginInputSchema: z.ZodObject<{
3
3
  apikey: z.ZodString;
4
4
  scope: z.ZodOptional<z.ZodEnum<{
5
- global: "global";
6
5
  local: "local";
6
+ global: "global";
7
7
  }>>;
8
8
  }, z.core.$strip>;
9
9
  export declare const mcpLogoutInputSchema: z.ZodObject<{
10
10
  scope: z.ZodOptional<z.ZodEnum<{
11
- global: "global";
12
11
  local: "local";
12
+ global: "global";
13
13
  }>>;
14
14
  }, z.core.$strip>;