@capgo/cli 8.32.6 → 8.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,10 +2,10 @@ import type { InstallCommand, PackageManagerRunner, PackageManagerType } from '@
2
2
  import type { SemVer } from '@std/semver';
3
3
  import type { SupabaseClient } from '@supabase/supabase-js';
4
4
  import type { Buffer } from 'node:buffer';
5
+ import type { UploadSpinner } from './bundle/reporter';
5
6
  import type { CapacitorConfig, ExtConfigPairs } from './config';
6
7
  import type { Compatibility, CompatibilityDetails, NativePackage } from './schemas/common';
7
8
  import type { Database } from './types/supabase.types';
8
- import { spinner as spinnerC } from '@clack/prompts';
9
9
  export declare const baseKey = ".capgo_key";
10
10
  export declare const baseKeyV2 = ".capgo_key_v2";
11
11
  export declare const baseKeyPub = ".capgo_key.pub";
@@ -135,7 +135,14 @@ interface CapgoConfig {
135
135
  hostFilesApi: string;
136
136
  hostApi: string;
137
137
  }
138
- export declare function getRemoteConfig(silent?: boolean, signal?: AbortSignal): Promise<CapgoConfig>;
138
+ export declare function getRemoteConfig(silent?: boolean, signal?: AbortSignal): Promise<{
139
+ supaHost?: string;
140
+ supaKey?: string;
141
+ host: string;
142
+ hostWeb: string;
143
+ hostFilesApi: string;
144
+ hostApi: string;
145
+ }>;
139
146
  interface CapgoFilesConfig {
140
147
  partialUpload: boolean;
141
148
  partialUploadForced: boolean;
@@ -148,12 +155,36 @@ interface CapgoFilesConfig {
148
155
  export declare function getRemoteFileConfig(): Promise<CapgoFilesConfig>;
149
156
  export declare function normalizeSupabaseHost(host: string): string;
150
157
  export declare function formatCapgoApiErrorBody(body: unknown): string;
151
- /** Resolve Capgo public API base URL for CLI mutations (app create/update, etc.). */
158
+ /** Capgo-managed Supabase hosts (cloud). Match hostname exactly. */
159
+ export declare function isCapgoManagedSupabaseHost(supaHost?: string): boolean;
160
+ /**
161
+ * Resolve Capgo public API base URL for CLI mutations (app create/update, etc.).
162
+ * Capgo cloud uses api.capgo.app. Self-host with only localSupa (default localApi)
163
+ * keeps /functions/v1 on that Supabase host.
164
+ */
152
165
  export declare function resolveConfiguredCapgoPublicApiHost(config: {
153
166
  hostApi: string;
167
+ hostFilesApi?: string;
154
168
  supaHost?: string;
155
169
  supaKey?: string;
156
170
  }): string;
171
+ export interface CapgoCliInvokeOptions {
172
+ apikey: string;
173
+ method?: string;
174
+ body?: unknown;
175
+ /** Capgo cloud files worker; ignored when resolving to self-host /functions/v1 */
176
+ useFilesHost?: boolean;
177
+ supaHost?: string;
178
+ supaAnon?: string;
179
+ }
180
+ /**
181
+ * Invoke Capgo HTTP APIs formerly reached via supabase.functions.invoke.
182
+ * Capgo cloud -> hostApi / hostFilesApi. Self-host -> /functions/v1.
183
+ */
184
+ export declare function invokeCapgoCliApi<T = any>(path: string, options: CapgoCliInvokeOptions): Promise<{
185
+ data: T | null;
186
+ error: Error | null;
187
+ }>;
157
188
  export declare function resolveCapgoPublicApiHost(options?: {
158
189
  supaHost?: string;
159
190
  supaAnon?: string;
@@ -5664,7 +5695,10 @@ export declare function findMainFileForProjectType(projectType: string, isTypeSc
5664
5695
  export declare function findBuildCommandForProjectType(projectType: string): Promise<"build" | "generate">;
5665
5696
  export declare function findMainFile(silent?: boolean, rootDir?: string): Promise<string>;
5666
5697
  export declare function updateOrCreateVersion(supabase: SupabaseClient<Database>, update: Database['public']['Tables']['app_versions']['Insert']): Promise<import("@supabase/supabase-js").PostgrestSingleResponse<null>>;
5667
- export declare function uploadUrl(supabase: SupabaseClient<Database>, appId: string, name: string): Promise<string>;
5698
+ export declare function uploadUrl(apikey: string, appId: string, name: string, options?: {
5699
+ supaHost?: string;
5700
+ supaAnon?: string;
5701
+ }): Promise<string>;
5668
5702
  export declare const BROTLI_MIN_UPDATER_VERSION_V5 = "5.10.0";
5669
5703
  export declare const BROTLI_MIN_UPDATER_VERSION_V6 = "6.25.0";
5670
5704
  export declare const BROTLI_MIN_UPDATER_VERSION_V7 = "7.0.30";
@@ -5677,8 +5711,11 @@ export type manifestType = Awaited<ReturnType<typeof generateManifest>>;
5677
5711
  export declare function zipFile(filePath: string): Promise<Buffer>;
5678
5712
  export declare function zipFileUnix(filePath: string): Buffer<ArrayBufferLike>;
5679
5713
  export declare function zipFileWindows(filePath: string): Promise<Buffer>;
5680
- export declare function uploadTUS(apikey: string, data: Buffer, orgId: string, appId: string, name: string, spinner: ReturnType<typeof spinnerC>, localConfig: CapgoConfig, chunkSize: number): Promise<boolean>;
5681
- export declare function deletedFailedVersion(supabase: SupabaseClient<Database>, appId: string, name: string): Promise<void>;
5714
+ export declare function uploadTUS(apikey: string, data: Buffer, orgId: string, appId: string, name: string, spinner: UploadSpinner, localConfig: CapgoConfig, chunkSize: number): Promise<boolean>;
5715
+ export declare function deletedFailedVersion(apikey: string, appId: string, name: string, options?: {
5716
+ supaHost?: string;
5717
+ supaAnon?: string;
5718
+ }): Promise<void>;
5682
5719
  export interface VersionManifestEntry {
5683
5720
  file_name: string;
5684
5721
  s3_path: string;
@@ -5688,7 +5725,10 @@ export interface VersionManifestEntry {
5688
5725
  * Writes delta manifest rows through the backend (file_size stays 0 until R2 size lookup).
5689
5726
  * Prefer this over writing app_versions.manifest jsonb — old CLIs still use that legacy path.
5690
5727
  */
5691
- export declare function setVersionManifest(supabase: SupabaseClient<Database>, appId: string, name: string, manifest: VersionManifestEntry[]): Promise<void>;
5728
+ export declare function setVersionManifest(apikey: string, appId: string, name: string, manifest: VersionManifestEntry[], options?: {
5729
+ supaHost?: string;
5730
+ supaAnon?: string;
5731
+ }): Promise<void>;
5692
5732
  export declare function updateOrCreateChannel(supabase: SupabaseClient<Database>, update: Database['public']['Tables']['channels']['Insert']): Promise<import("@supabase/supabase-js").PostgrestSingleResponse<{
5693
5733
  allow_dev: boolean;
5694
5734
  allow_device: boolean;
@@ -5759,6 +5799,11 @@ export declare function getPMAndCommand(): {
5759
5799
  installCommand: string;
5760
5800
  runner: PackageManagerRunner;
5761
5801
  };
5802
+ export declare function setPMAndCommand(next: {
5803
+ pm: PackageManagerType;
5804
+ command: InstallCommand;
5805
+ runner: PackageManagerRunner;
5806
+ }): void;
5762
5807
  export declare function getNativeProjectResetAdvice(platformRunner: string, nativePlatform: 'ios' | 'android'): {
5763
5808
  summary: string;
5764
5809
  command: string;
@@ -1,9 +1,34 @@
1
+ /** CLI / API auto-bump levels (fix is normalized to patch at parse time) */
2
+ export type AutoBumpLevel = 'major' | 'minor' | 'patch' | 'metadata';
3
+ /** @std/semver increment release types used by auto-bump */
4
+ export type AutoBumpRelease = 'major' | 'minor' | 'patch' | 'prerelease';
5
+ /**
6
+ * Normalize CLI/SDK auto-bump values.
7
+ * - bare flag / true → minor
8
+ * - fix → patch
9
+ * - metadata stays metadata (mapped to prerelease increment later)
10
+ */
11
+ export declare function normalizeAutoBumpLevel(level: string | boolean | undefined | null): AutoBumpLevel | undefined;
12
+ export declare function autoBumpLevelToRelease(level: AutoBumpLevel | AutoBumpRelease): AutoBumpRelease;
13
+ /**
14
+ * Auto-bump a semver version by the given level
15
+ * @param currentVersion - The current version string (e.g., "1.0.0")
16
+ * @param level - major | minor | patch | metadata | prerelease
17
+ * @returns The bumped version or a fallback version if parsing fails
18
+ */
19
+ export declare function autoBumpVersionBy(currentVersion: string, level?: AutoBumpLevel | AutoBumpRelease): string;
1
20
  /**
2
21
  * Auto-bump a semver version by incrementing the patch number
3
22
  * @param currentVersion - The current version string (e.g., "1.0.0")
4
23
  * @returns The bumped version or a fallback version if parsing fails
5
24
  */
6
25
  export declare function autoBumpVersion(currentVersion: string): string;
26
+ /**
27
+ * Auto-bump a semver version by incrementing the minor number
28
+ * @param currentVersion - The current version string (e.g., "1.0.0")
29
+ * @returns The bumped version or a fallback version if parsing fails
30
+ */
31
+ export declare function autoBumpMinorVersion(currentVersion: string): string;
7
32
  /**
8
33
  * Interactively ask the user how to handle version bumping
9
34
  * @param currentVersion - The current version
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capgo/cli",
3
3
  "type": "module",
4
- "version": "8.32.6",
4
+ "version": "8.33.0",
5
5
  "description": "A CLI to upload to capgo servers",
6
6
  "author": "Martin martin@capgo.app",
7
7
  "license": "Apache 2.0",
@@ -160,7 +160,7 @@
160
160
  "test:ios-marketing-version": "bun test/test-ios-marketing-version.mjs",
161
161
  "test:platform-flow-contract": "bun test/test-platform-flow-contract.mjs",
162
162
  "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: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",
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
164
  "test:build-platform-selection": "bun test/test-build-platform-selection.mjs",
165
165
  "test:ai-log-capture": "bun test/test-ai-log-capture.mjs",
166
166
  "test:ai-analyze-flow": "bun test/test-ai-analyze-flow.mjs",
@@ -204,7 +204,8 @@
204
204
  "test:app-permission-helper": "bun test/test-app-permission-helper.mjs",
205
205
  "test:organization-set-api-host": "bun test/test-organization-set-api-host.mjs",
206
206
  "test:trial-warning": "bun test/test-trial-warning.mjs",
207
- "test:plan-validation": "bun test/test-plan-validation.mjs"
207
+ "test:plan-validation": "bun test/test-plan-validation.mjs",
208
+ "test:auto-bump-version": "bun test/test-auto-bump-version.mjs"
208
209
  },
209
210
  "dependencies": {
210
211
  "@inkjs/ui": "^2.0.0",
@@ -7,6 +7,22 @@ description: Use when working with Capgo Cloud native iOS and Android build requ
7
7
 
8
8
  Use this skill for Capgo Cloud native iOS and Android build workflows.
9
9
 
10
+ ## Build prescan overrides
11
+
12
+ Before `build request` uploads, Capgo runs a local/remote **prescan**. Prefer per-check overrides over disabling the whole scan:
13
+
14
+ - `--prescan-skip <checkId>` — do not run that check (repeatable / comma-separated)
15
+ - `--prescan-warn <checkId>` — still run it, but downgrade findings to warning
16
+ - `--no-prescan` / `--prescan-ignore-fatal` — global escapes; use only when necessary
17
+
18
+ Example (intentional Capacitor `server.url` / Next.js shell):
19
+
20
+ ```bash
21
+ npx @capgo/cli@latest build request <appId> --platform ios --prescan-skip ios/capacitor-server-url-shipped
22
+ ```
23
+
24
+ Standalone: `build prescan` accepts `--skip` / `--warn`. Full catalog: `webdocs/prescan-checks.mdx`.
25
+
10
26
  ## Onboarding (automated iOS setup)
11
27
 
12
28
  ### `build init` (alias: `build onboarding`)
@@ -116,7 +132,7 @@ interface BuildLogger {
116
132
  - `--app-store-connect-team-id <id>`
117
133
  - `--ios-scheme <scheme>`
118
134
  - `--ios-target <target>`
119
- - `--ios-distribution <mode>`: `app_store` or `ad_hoc`
135
+ - `--ios-distribution <mode>`: `app_store` (default, uploads to TestFlight) or `ad_hoc` (skips store upload; use with `--output-upload` for IPA-only when the App Store app does not exist yet)
120
136
  - `--ios-provisioning-profile <mapping>`: repeatable path or `bundleId=path`
121
137
 
122
138
  #### Android request options
@@ -131,13 +147,13 @@ interface BuildLogger {
131
147
 
132
148
  #### Output behavior options
133
149
 
134
- - `--no-playstore-upload`: skip Play Store upload for the build, requires `--output-upload`
150
+ - `--output-upload`: upload the finished IPA/APK/AAB to Capgo storage and print a time-limited download link (and QR). Pair with `--no-playstore-upload` (Android) or `--ios-distribution ad_hoc` (iOS) for artifact-only builds
151
+ - `--no-output-upload`: skip Capgo storage upload (no download link); store upload can still happen when store credentials are set
152
+ - `--no-playstore-upload`: Android — skip Google Play upload for this build (ignores saved Play credentials). Requires `--output-upload`. Use when the Play app does not exist yet or you only need the AAB download
135
153
  - `--submit-to-store-review`: submit after upload instead of leaving a draft/inactive store release. Android completes the Google Play release; iOS submits to TestFlight external review.
136
154
  - `--store-release-name <name>`: Android Google Play version_name/release label.
137
155
  - `--store-release-notes <notes>`: Google Play changelog and iOS TestFlight What to Test text.
138
156
  - `--ios-testflight-groups <groups>`: comma-separated external TestFlight group names or IDs required with `--submit-to-store-review` on iOS.
139
- - `--output-upload`
140
- - `--no-output-upload`
141
157
  - `--output-retention <duration>`: `1h` to `7d`
142
158
  - `--skip-build-number-bump`
143
159
  - `--no-skip-build-number-bump`