@capgo/cli 8.0.0-alpha.5 → 8.0.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.
Files changed (222) hide show
  1. package/README.md +733 -84
  2. package/dist/index.js +1132 -317
  3. package/dist/keychain-export.swift +351 -0
  4. package/dist/package.json +120 -30
  5. package/dist/src/ai/analyze.d.ts +48 -0
  6. package/dist/src/ai/log-capture.d.ts +14 -0
  7. package/dist/src/ai/prompt.d.ts +1 -0
  8. package/dist/src/ai/render-markdown.d.ts +12 -0
  9. package/dist/src/ai/sse.d.ts +5 -0
  10. package/dist/src/ai/stream-markdown.d.ts +22 -0
  11. package/dist/src/ai/telemetry.d.ts +39 -0
  12. package/dist/src/analytics/error-category.d.ts +11 -0
  13. package/dist/src/analytics/org-resolver.d.ts +11 -0
  14. package/dist/src/analytics/supabase-perf.d.ts +48 -0
  15. package/dist/src/analytics/track.d.ts +70 -0
  16. package/dist/src/api/app.d.ts +17 -8
  17. package/dist/src/api/channels.d.ts +2442 -2729
  18. package/dist/src/api/crypto.d.ts +26 -0
  19. package/dist/src/api/update.d.ts +7 -1
  20. package/dist/src/api/versions.d.ts +9 -2
  21. package/dist/src/app/add.d.ts +6 -4
  22. package/dist/src/app/debug.d.ts +3 -7
  23. package/dist/src/app/delete.d.ts +1 -2
  24. package/dist/src/app/info.d.ts +5 -1
  25. package/dist/src/app/list.d.ts +23 -2
  26. package/dist/src/app/set.d.ts +0 -1
  27. package/dist/src/app/setting.d.ts +3 -9
  28. package/dist/src/app/updateProbe.d.ts +43 -0
  29. package/dist/src/build/credentials-command.d.ts +89 -0
  30. package/dist/src/build/credentials-manage.d.ts +7 -0
  31. package/dist/src/build/credentials.d.ts +78 -0
  32. package/dist/src/build/env-render.d.ts +8 -0
  33. package/dist/src/build/last-output-command.d.ts +6 -0
  34. package/dist/src/build/mobileprovision-parser.d.ts +35 -0
  35. package/dist/src/build/needed.d.ts +28 -0
  36. package/dist/src/build/onboarding/ai-fit.d.ts +110 -0
  37. package/dist/src/build/onboarding/analytics.d.ts +23 -0
  38. package/dist/src/build/onboarding/android/gcp-api.d.ts +128 -0
  39. package/dist/src/build/onboarding/android/gradle-parser.d.ts +19 -0
  40. package/dist/src/build/onboarding/android/keystore.d.ts +77 -0
  41. package/dist/src/build/onboarding/android/oauth-config.d.ts +24 -0
  42. package/dist/src/build/onboarding/android/oauth-google.d.ts +134 -0
  43. package/dist/src/build/onboarding/android/play-api.d.ts +91 -0
  44. package/dist/src/build/onboarding/android/progress.d.ts +22 -0
  45. package/dist/src/build/onboarding/android/service-account-validation.d.ts +58 -0
  46. package/dist/src/build/onboarding/android/types.d.ts +72 -0
  47. package/dist/src/build/onboarding/android/ui/app.d.ts +17 -0
  48. package/dist/src/build/onboarding/app-verification.d.ts +86 -0
  49. package/dist/src/build/onboarding/apple-api.d.ts +234 -0
  50. package/dist/src/build/onboarding/build-log.d.ts +10 -0
  51. package/dist/src/build/onboarding/bundle-id-detector.d.ts +117 -0
  52. package/dist/src/build/onboarding/ci-secrets.d.ts +87 -0
  53. package/dist/src/build/onboarding/command.d.ts +6 -0
  54. package/dist/src/build/onboarding/csr.d.ts +33 -0
  55. package/dist/src/build/onboarding/diff-utils.d.ts +24 -0
  56. package/dist/src/build/onboarding/env-export.d.ts +46 -0
  57. package/dist/src/build/onboarding/error-categories.d.ts +13 -0
  58. package/dist/src/build/onboarding/file-picker.d.ts +47 -0
  59. package/dist/src/build/onboarding/macos-signing.d.ts +190 -0
  60. package/dist/src/build/onboarding/min-terminal-size.d.ts +16 -0
  61. package/dist/src/build/onboarding/progress.d.ts +51 -0
  62. package/dist/src/build/onboarding/recovery.d.ts +7 -0
  63. package/dist/src/build/onboarding/telemetry.d.ts +28 -0
  64. package/dist/src/build/onboarding/types.d.ts +140 -0
  65. package/dist/src/build/onboarding/ui/app.d.ts +36 -0
  66. package/dist/src/build/onboarding/ui/completed-steps-log.d.ts +9 -0
  67. package/dist/src/build/onboarding/ui/components.d.ts +178 -0
  68. package/dist/src/build/onboarding/ui/frame-fit.d.ts +10 -0
  69. package/dist/src/build/onboarding/ui/min-size-gate.d.ts +20 -0
  70. package/dist/src/build/onboarding/ui/platform-picker.d.ts +19 -0
  71. package/dist/src/build/onboarding/ui/shell.d.ts +33 -0
  72. package/dist/src/build/onboarding/ui/steps/android-ci.d.ts +45 -0
  73. package/dist/src/build/onboarding/ui/steps/android-keystore.d.ts +75 -0
  74. package/dist/src/build/onboarding/ui/steps/android-sa-gcp.d.ts +85 -0
  75. package/dist/src/build/onboarding/ui/steps/android-shared.d.ts +67 -0
  76. package/dist/src/build/onboarding/ui/steps/ios-ci.d.ts +44 -0
  77. package/dist/src/build/onboarding/ui/steps/ios-credentials.d.ts +66 -0
  78. package/dist/src/build/onboarding/ui/steps/ios-import.d.ts +79 -0
  79. package/dist/src/build/onboarding/ui/steps/ios-shared.d.ts +93 -0
  80. package/dist/src/build/onboarding/workflow-generator.d.ts +48 -0
  81. package/dist/src/build/onboarding/workflow-ui-helpers.d.ts +18 -0
  82. package/dist/src/build/onboarding/workflow-writer.d.ts +36 -0
  83. package/dist/src/build/output-record.d.ts +30 -0
  84. package/dist/src/build/pbxproj-parser.d.ts +48 -0
  85. package/dist/src/build/platform-paths.d.ts +20 -0
  86. package/dist/src/build/qr.d.ts +5 -0
  87. package/dist/src/build/request.d.ts +102 -43
  88. package/dist/src/build/telemetry.d.ts +17 -0
  89. package/dist/src/bundle/builder-cta.d.ts +67 -0
  90. package/dist/src/bundle/check.d.ts +0 -1
  91. package/dist/src/bundle/cleanup.d.ts +3 -12
  92. package/dist/src/bundle/compatibility.d.ts +23 -12
  93. package/dist/src/bundle/decrypt.d.ts +4 -0
  94. package/dist/src/bundle/delete.d.ts +3 -8
  95. package/dist/src/bundle/encrypt.d.ts +4 -0
  96. package/dist/src/bundle/list.d.ts +5 -2
  97. package/dist/src/bundle/partial.d.ts +5 -3
  98. package/dist/src/bundle/releaseType.d.ts +15 -0
  99. package/dist/src/bundle/unlink.d.ts +6 -5
  100. package/dist/src/bundle/upload-command.d.ts +8 -0
  101. package/dist/src/bundle/upload.d.ts +21 -14
  102. package/dist/src/bundle/upload_interface.d.ts +2 -50
  103. package/dist/src/bundle/zip.d.ts +4 -19
  104. package/dist/src/capacitor-cli.d.ts +13 -0
  105. package/dist/src/channel/add.d.ts +8 -10
  106. package/dist/src/channel/currentBundle.d.ts +3 -9
  107. package/dist/src/channel/delete.d.ts +3 -9
  108. package/dist/src/channel/list.d.ts +31 -4
  109. package/dist/src/channel/set.d.ts +2 -17
  110. package/dist/src/checksum.d.ts +1 -2
  111. package/dist/src/config/index.d.ts +2 -13
  112. package/dist/src/docs.d.ts +0 -1
  113. package/dist/src/github-command.d.ts +9 -0
  114. package/dist/src/github.d.ts +40 -0
  115. package/dist/src/index.d.ts +0 -1
  116. package/dist/src/init/app-conflict.d.ts +2 -0
  117. package/dist/src/init/command.d.ts +57 -0
  118. package/dist/src/init/index.d.ts +1 -0
  119. package/dist/src/init/prompts.d.ts +41 -0
  120. package/dist/src/init/runtime.d.ts +111 -0
  121. package/dist/src/init/ui/app.d.ts +9 -0
  122. package/dist/src/init/ui/components.d.ts +31 -0
  123. package/dist/src/init/ui.d.ts +12 -0
  124. package/dist/src/init/updater.d.ts +13 -0
  125. package/dist/src/key.d.ts +16 -0
  126. package/dist/src/login.d.ts +0 -1
  127. package/dist/src/mcp/server.d.ts +5 -0
  128. package/dist/src/onboarding-support.d.ts +18 -0
  129. package/dist/src/organization/add.d.ts +26 -0
  130. package/dist/src/organization/delete.d.ts +3 -0
  131. package/dist/src/{organisation → organization}/index.d.ts +1 -1
  132. package/dist/src/{organisation → organization}/list.d.ts +14 -2
  133. package/dist/src/organization/members.d.ts +12 -0
  134. package/dist/src/organization/set.d.ts +21 -0
  135. package/dist/src/posthog.d.ts +13 -0
  136. package/dist/src/probe.d.ts +20 -0
  137. package/dist/src/promptPreferences.d.ts +13 -0
  138. package/dist/src/replicationProgress.d.ts +8 -0
  139. package/dist/src/run/device.d.ts +5 -0
  140. package/dist/src/runner-command.d.ts +5 -0
  141. package/dist/src/schemas/app.d.ts +26 -0
  142. package/dist/src/schemas/base.d.ts +7 -0
  143. package/dist/src/schemas/build.d.ts +196 -0
  144. package/dist/src/schemas/bundle.d.ts +157 -0
  145. package/dist/src/schemas/channel.d.ts +62 -0
  146. package/dist/src/schemas/common.d.ts +46 -0
  147. package/dist/src/schemas/config.d.ts +20 -0
  148. package/dist/src/schemas/index.d.ts +19 -0
  149. package/dist/src/schemas/organization.d.ts +41 -0
  150. package/dist/src/schemas/sdk.d.ts +335 -0
  151. package/dist/src/schemas/validate.d.ts +12 -0
  152. package/dist/src/sdk.d.ts +69 -337
  153. package/dist/src/sdk.js +542 -301
  154. package/dist/src/terminal-table.d.ts +7 -0
  155. package/dist/src/types/supabase.types.d.ts +2770 -296
  156. package/dist/src/updaterConfig.d.ts +8 -0
  157. package/dist/src/user/account.d.ts +0 -1
  158. package/dist/src/utils/latest-version.d.ts +0 -1
  159. package/dist/src/utils/safeWrites.d.ts +21 -0
  160. package/dist/src/utils/security_policy_errors.d.ts +47 -0
  161. package/dist/src/utils.d.ts +2869 -341
  162. package/dist/src/versionHelpers.d.ts +19 -0
  163. package/package.json +120 -30
  164. package/skills/native-builds/SKILL.md +255 -0
  165. package/skills/organization-management/SKILL.md +93 -0
  166. package/skills/release-management/SKILL.md +225 -0
  167. package/skills/usage/SKILL.md +92 -0
  168. package/dist/src/api/app.d.ts.map +0 -1
  169. package/dist/src/api/channels.d.ts.map +0 -1
  170. package/dist/src/api/cryptoV2.d.ts +0 -16
  171. package/dist/src/api/cryptoV2.d.ts.map +0 -1
  172. package/dist/src/api/update.d.ts.map +0 -1
  173. package/dist/src/api/versions.d.ts.map +0 -1
  174. package/dist/src/app/add.d.ts.map +0 -1
  175. package/dist/src/app/debug.d.ts.map +0 -1
  176. package/dist/src/app/delete.d.ts.map +0 -1
  177. package/dist/src/app/info.d.ts.map +0 -1
  178. package/dist/src/app/list.d.ts.map +0 -1
  179. package/dist/src/app/set.d.ts.map +0 -1
  180. package/dist/src/app/setting.d.ts.map +0 -1
  181. package/dist/src/build/request.d.ts.map +0 -1
  182. package/dist/src/bundle/check.d.ts.map +0 -1
  183. package/dist/src/bundle/cleanup.d.ts.map +0 -1
  184. package/dist/src/bundle/compatibility.d.ts.map +0 -1
  185. package/dist/src/bundle/decryptV2.d.ts +0 -13
  186. package/dist/src/bundle/decryptV2.d.ts.map +0 -1
  187. package/dist/src/bundle/delete.d.ts.map +0 -1
  188. package/dist/src/bundle/encryptV2.d.ts +0 -14
  189. package/dist/src/bundle/encryptV2.d.ts.map +0 -1
  190. package/dist/src/bundle/list.d.ts.map +0 -1
  191. package/dist/src/bundle/partial.d.ts.map +0 -1
  192. package/dist/src/bundle/unlink.d.ts.map +0 -1
  193. package/dist/src/bundle/upload.d.ts.map +0 -1
  194. package/dist/src/bundle/upload_interface.d.ts.map +0 -1
  195. package/dist/src/bundle/zip.d.ts.map +0 -1
  196. package/dist/src/channel/add.d.ts.map +0 -1
  197. package/dist/src/channel/currentBundle.d.ts.map +0 -1
  198. package/dist/src/channel/delete.d.ts.map +0 -1
  199. package/dist/src/channel/list.d.ts.map +0 -1
  200. package/dist/src/channel/set.d.ts.map +0 -1
  201. package/dist/src/checksum.d.ts.map +0 -1
  202. package/dist/src/config/index.d.ts.map +0 -1
  203. package/dist/src/docs.d.ts.map +0 -1
  204. package/dist/src/index.d.ts.map +0 -1
  205. package/dist/src/init.d.ts +0 -7
  206. package/dist/src/init.d.ts.map +0 -1
  207. package/dist/src/keyV2.d.ts +0 -19
  208. package/dist/src/keyV2.d.ts.map +0 -1
  209. package/dist/src/login.d.ts.map +0 -1
  210. package/dist/src/organisation/add.d.ts +0 -19
  211. package/dist/src/organisation/add.d.ts.map +0 -1
  212. package/dist/src/organisation/delete.d.ts +0 -8
  213. package/dist/src/organisation/delete.d.ts.map +0 -1
  214. package/dist/src/organisation/index.d.ts.map +0 -1
  215. package/dist/src/organisation/list.d.ts.map +0 -1
  216. package/dist/src/organisation/set.d.ts +0 -13
  217. package/dist/src/organisation/set.d.ts.map +0 -1
  218. package/dist/src/sdk.d.ts.map +0 -1
  219. package/dist/src/types/supabase.types.d.ts.map +0 -1
  220. package/dist/src/user/account.d.ts.map +0 -1
  221. package/dist/src/utils/latest-version.d.ts.map +0 -1
  222. package/dist/src/utils.d.ts.map +0 -1
@@ -0,0 +1,79 @@
1
+ import type { FC } from 'react';
2
+ export interface SelectOption {
3
+ label: string;
4
+ value: string;
5
+ }
6
+ /**
7
+ * Why the wizard ended up on the no-match recovery menu. Drives the Alert
8
+ * + hint copy in `ImportNoMatchRecoveryStep` so each route gets accurate
9
+ * context — previously the screen claimed "no profile linked to this cert"
10
+ * even when the parent had just logged "Apple linked them to X" (cases 3
11
+ * and 4 below). Set by the parent right before each setStep call; absent
12
+ * (undefined) is treated as the legacy `no-profile-on-disk` default for
13
+ * back-compat with call sites that haven't been audited yet.
14
+ *
15
+ * - 'no-profile-on-disk' : identity picked, no usable on-disk
16
+ * profile, and no ASC key to query Apple.
17
+ * - 'apple-no-cert-match' : findCertIdBySha1 returned null — Apple
18
+ * doesn't recognize this cert.
19
+ * - 'apple-no-profiles-linked' : Apple has the cert but zero profiles
20
+ * linked to it.
21
+ * - 'apple-bundle-mismatch' : Apple has profiles but none target the
22
+ * current app's bundle id.
23
+ * - 'apple-distribution-mismatch': Apple has profiles for this bundle id
24
+ * but none in the requested distribution
25
+ * mode (app_store vs ad_hoc).
26
+ * - 'apple-other' : catch-all when none of the specific
27
+ * filters above explain the empty result.
28
+ */
29
+ export type NoMatchReason = 'no-profile-on-disk' | 'apple-no-cert-match' | 'apple-no-profiles-linked' | 'apple-bundle-mismatch' | 'apple-distribution-mismatch' | 'apple-other';
30
+ export declare const ImportScanningStep: FC;
31
+ export interface ImportDistributionModeStepProps {
32
+ dense?: boolean;
33
+ onChange: (value: string) => void | Promise<void>;
34
+ }
35
+ export declare const ImportDistributionModeStep: FC<ImportDistributionModeStepProps>;
36
+ export interface ImportPickIdentityStepProps {
37
+ identityCount: number;
38
+ options: SelectOption[];
39
+ dense?: boolean;
40
+ onChange: (value: string) => void | Promise<void>;
41
+ }
42
+ export declare const ImportPickIdentityStep: FC<ImportPickIdentityStepProps>;
43
+ export interface ImportPickProfileStepProps {
44
+ matchedCount: number;
45
+ droppedCount: number;
46
+ distribution: 'app_store' | 'ad_hoc' | null;
47
+ options: SelectOption[];
48
+ dense?: boolean;
49
+ onChange: (value: string) => void;
50
+ }
51
+ export declare const ImportPickProfileStep: FC<ImportPickProfileStepProps>;
52
+ export interface ImportNoMatchRecoveryStepProps {
53
+ identityName: string;
54
+ options: SelectOption[];
55
+ /**
56
+ * Why the wizard ended up here. Optional for back-compat — undefined
57
+ * renders the legacy `no-profile-on-disk` wording.
58
+ */
59
+ reason?: NoMatchReason;
60
+ /** Concrete iOS bundle id; used by the bundle-mismatch + distribution-mismatch alerts. */
61
+ appId?: string;
62
+ /** Active distribution mode; used by the distribution-mismatch alert. */
63
+ importDistribution?: 'app_store' | 'ad_hoc' | null;
64
+ dense?: boolean;
65
+ onChange: (value: string) => void;
66
+ }
67
+ export declare const ImportNoMatchRecoveryStep: FC<ImportNoMatchRecoveryStepProps>;
68
+ export declare const ImportCreateProfileOnlyStep: FC;
69
+ export interface ImportExportWarningStepProps {
70
+ identityName: string;
71
+ dense?: boolean;
72
+ onChange: (value: string) => void;
73
+ }
74
+ export declare const ImportExportWarningStep: FC<ImportExportWarningStepProps>;
75
+ export interface ImportCompilingHelperStepProps {
76
+ dense?: boolean;
77
+ }
78
+ export declare const ImportCompilingHelperStep: FC<ImportCompilingHelperStepProps>;
79
+ export declare const ImportExportingStep: FC;
@@ -0,0 +1,93 @@
1
+ import type { FC } from 'react';
2
+ import type { BuildOnboardingRecoveryAdvice } from '../../recovery.js';
3
+ import type { AiResultKind } from '../components.js';
4
+ export declare const WelcomeStep: FC;
5
+ export interface PlatformSelectStepProps {
6
+ appId: string;
7
+ dense?: boolean;
8
+ onChange: (value: string) => void | Promise<void>;
9
+ }
10
+ export declare const PlatformSelectStep: FC<PlatformSelectStepProps>;
11
+ export interface NoPlatformStepProps {
12
+ iosDir: string;
13
+ addIosCommand: string;
14
+ syncIosCommand: string;
15
+ dense?: boolean;
16
+ onChange: (value: string) => void;
17
+ }
18
+ export declare const NoPlatformStep: FC<NoPlatformStepProps>;
19
+ export interface AddingPlatformStepProps {
20
+ addIosCommand: string;
21
+ doctorCommand: string;
22
+ dense?: boolean;
23
+ }
24
+ export declare const AddingPlatformStep: FC<AddingPlatformStepProps>;
25
+ export interface AiAnalysisPromptStepProps {
26
+ dense?: boolean;
27
+ onChange: (value: string) => void | Promise<void>;
28
+ }
29
+ export declare const AiAnalysisPromptStep: FC<AiAnalysisPromptStepProps>;
30
+ export declare const AiAnalysisRunningStep: FC<{
31
+ streamText?: string;
32
+ terminalRows: number;
33
+ terminalCols: number;
34
+ }>;
35
+ export interface AiAnalysisResultStepProps {
36
+ analysisText: string | null;
37
+ collapsed: boolean;
38
+ result: {
39
+ kind: AiResultKind;
40
+ message: string;
41
+ } | null;
42
+ canRetry: boolean;
43
+ retriesLeft: number;
44
+ maxRetries: number;
45
+ dense?: boolean;
46
+ onChange: (value: string) => void | Promise<void>;
47
+ }
48
+ export declare const AiAnalysisResultStep: FC<AiAnalysisResultStepProps>;
49
+ export interface ErrorStepProps {
50
+ error: string;
51
+ recoveryAdvice: BuildOnboardingRecoveryAdvice | null;
52
+ supportBundlePath: string | null;
53
+ showRetry: boolean;
54
+ dense?: boolean;
55
+ /** When true, the full error + recovery advice was already shown in the
56
+ * scrollable viewer (it was taller than the viewport), so render only the
57
+ * error headline + the action prompt here — keeping Try again / Restart /
58
+ * Exit reachable no matter how long the advice was. */
59
+ collapsed?: boolean;
60
+ onChange: (value: string) => void | Promise<void>;
61
+ }
62
+ export declare function formatErrorViewerLines(error: string, recoveryAdvice: BuildOnboardingRecoveryAdvice | null, supportBundlePath: string | null): string[];
63
+ /**
64
+ * Estimate the rendered row height of the COMFORTABLE ErrorStep body (marginTop
65
+ * + error line + recovery advice + action prompt), independent of whether the
66
+ * collapsed or full form actually renders. The parent uses this to decide
67
+ * whether to route the error through the scroll viewer.
68
+ *
69
+ * Why a structural estimate and not `measureElement`: measuring the rendered
70
+ * body would FEEDBACK-LOOP — a collapsed body measures short → "fits" → render
71
+ * full → measures tall → collapse → measures short → … This estimate depends
72
+ * only on the advice shape + width, so the decision is stable at any size.
73
+ *
74
+ * Calibrated against the VT harness: the body estimate lands within ~1 row of
75
+ * the real render across every recovery-advice shape, and the surrounding frame
76
+ * chrome (boxed header + completed-steps log + padding) is a fixed ~15 rows the
77
+ * caller reserves on top.
78
+ */
79
+ export declare function estimateErrorBodyRows(error: string, recoveryAdvice: BuildOnboardingRecoveryAdvice | null, supportBundlePath: string | null, cols: number, showRetry: boolean): number;
80
+ export declare const ErrorStep: FC<ErrorStepProps>;
81
+ export interface BuildCompleteStepProps {
82
+ buildUrl: string;
83
+ ciSecretUploadSummary: string | null;
84
+ buildRequestCommand: string;
85
+ /** Absolute path of a workflow file written by the GitHub Actions flow. */
86
+ workflowWrittenPath?: string | null;
87
+ /** Absolute path of credentials exported to a .env fallback. */
88
+ envExportPath?: string | null;
89
+ /** Surfaced when the .env export failed (non-fatal). */
90
+ envExportError?: string | null;
91
+ dense?: boolean;
92
+ }
93
+ export declare const BuildCompleteStep: FC<BuildCompleteStepProps>;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Pure generator for a GitHub Actions workflow file that runs `capgo build
3
+ * request` against credentials uploaded as repository secrets.
4
+ *
5
+ * No I/O — caller decides where to write the resulting file. This keeps the
6
+ * generator trivially testable: feed it opts, get a `{ path, content }` back.
7
+ *
8
+ * v1 deliberately limited: GitHub-only (no GitLab YAML), single `workflow_dispatch`
9
+ * trigger (no push/pr triggers), one platform per dispatch (no matrix), no
10
+ * monorepo subdirectory handling. Each of these is a follow-up.
11
+ */
12
+ export type PackageManager = 'bun' | 'npm' | 'pnpm' | 'yarn';
13
+ export type BuildScriptChoice = {
14
+ type: 'npm-script';
15
+ name: string;
16
+ } | {
17
+ type: 'custom';
18
+ command: string;
19
+ } | {
20
+ type: 'skip';
21
+ };
22
+ export interface WorkflowGeneratorOpts {
23
+ /** The app's bundle ID, e.g. com.example.app */
24
+ appId: string;
25
+ /** Default platform when the user dispatches the workflow without overriding the input. */
26
+ defaultPlatform: 'ios' | 'android';
27
+ /** Detected via getPMAndCommand(). Drives setup actions and the `npx`/`bunx`/etc runner. */
28
+ packageManager: PackageManager;
29
+ /** What runs to produce the web bundle before `capgo build request` fires. */
30
+ buildScript: BuildScriptChoice;
31
+ /** Exact secret names that were pushed to GitHub (drives the env: block). */
32
+ secretKeys: string[];
33
+ }
34
+ export interface GeneratedWorkflow {
35
+ /** Relative path inside the repo where the file should live. */
36
+ path: string;
37
+ /** Full file content, ready to write. */
38
+ content: string;
39
+ }
40
+ /** Default path inside the repo. */
41
+ export declare const WORKFLOW_PATH = ".github/workflows/capgo-build.yml";
42
+ /**
43
+ * Build the GitHub Actions workflow YAML.
44
+ *
45
+ * The shape is intentionally simple: one job, one platform per dispatch,
46
+ * `workflow_dispatch` trigger only. Power users can fork it after the fact.
47
+ */
48
+ export declare function generateWorkflow(opts: WorkflowGeneratorOpts): GeneratedWorkflow;
@@ -0,0 +1,18 @@
1
+ import type { PackageManager } from './workflow-generator.js';
2
+ export interface BuildScriptOption {
3
+ label: string;
4
+ value: string;
5
+ }
6
+ /**
7
+ * `getPMAndCommand()` returns the literal string 'unknown' when no recognizable
8
+ * lockfile is present. The workflow generator only knows the four real ones —
9
+ * fall back to 'npm' for the generator template.
10
+ */
11
+ export declare function normalizePackageManager(pm: string): PackageManager;
12
+ /**
13
+ * Build the picker options for `pick-build-script`. Shows ALL scripts from
14
+ * package.json (the user picks; we don't auto-guess), with the project-type
15
+ * recommendation surfaced at the top, plus escape hatches for custom commands
16
+ * and "skip build entirely" (raw HTML Capacitor apps).
17
+ */
18
+ export declare function buildScriptPickerOptions(scripts: Record<string, string>, recommended: string | null): BuildScriptOption[];
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Thin wrapper that turns the pure `generateWorkflow` output into actual files
3
+ * on disk. Kept separate from `workflow-generator.ts` so the generator stays
4
+ * trivially unit-testable without mocking fs.
5
+ *
6
+ * The wizard's Ink layer owns all prompts (overwrite confirmation, etc.); this
7
+ * module only handles "does it exist?" and "write it".
8
+ */
9
+ import type { WorkflowGeneratorOpts } from './workflow-generator.js';
10
+ import { WORKFLOW_PATH } from './workflow-generator.js';
11
+ export { WORKFLOW_PATH };
12
+ export interface WorkflowWriteOptions {
13
+ /** When true, overwrite an existing file. Default: false. */
14
+ overwrite?: boolean;
15
+ /** Optional base dir override. Defaults to cwd(). */
16
+ baseDir?: string;
17
+ }
18
+ export type WorkflowWriteResult = {
19
+ kind: 'written';
20
+ absolutePath: string;
21
+ content: string;
22
+ } | {
23
+ kind: 'exists';
24
+ absolutePath: string;
25
+ existingContent: string;
26
+ newContent: string;
27
+ };
28
+ /**
29
+ * Generate the workflow YAML and write it to `.github/workflows/capgo-build.yml`.
30
+ * Creates the `.github/workflows/` directory if it doesn't exist.
31
+ *
32
+ * If the file already exists and `overwrite` is false, returns `kind: 'exists'`
33
+ * with both the existing and proposed content so the caller can render a diff
34
+ * and ask for explicit confirmation before clobbering.
35
+ */
36
+ export declare function writeWorkflowFile(opts: WorkflowGeneratorOpts, writeOptions?: WorkflowWriteOptions): WorkflowWriteResult;
@@ -0,0 +1,30 @@
1
+ /** Stable shape written to disk; bump schemaVersion if breaking changes are made. */
2
+ export interface BuildOutputRecord {
3
+ schemaVersion: 1;
4
+ jobId: string;
5
+ appId: string;
6
+ platform: 'ios' | 'android';
7
+ buildMode: 'debug' | 'release';
8
+ status: string;
9
+ outputUrl: string | null;
10
+ qrCodeAscii: string | null;
11
+ qrCodePngPath: string | null;
12
+ finishedAt: string;
13
+ }
14
+ export interface WriteBuildOutputRecordInput {
15
+ jobId: string;
16
+ appId: string;
17
+ platform: 'ios' | 'android';
18
+ buildMode: 'debug' | 'release';
19
+ status: string;
20
+ outputUrl: string | null;
21
+ }
22
+ /**
23
+ * Write a build-output record to `recordPath` (JSON) and, when a URL is available,
24
+ * a PNG QR code to `<recordPath>.qr.png`. Returns the parsed record exactly as
25
+ * written so callers can log a summary without re-reading the file.
26
+ *
27
+ * Failures rendering the PNG are non-fatal — the JSON is always written. The
28
+ * record's `qrCodePngPath` field is null when the PNG could not be produced.
29
+ */
30
+ export declare function writeBuildOutputRecord(recordPath: string, input: WriteBuildOutputRecordInput, onWarn?: (msg: string) => void): Promise<BuildOutputRecord>;
@@ -0,0 +1,48 @@
1
+ export interface PbxTarget {
2
+ name: string;
3
+ bundleId: string;
4
+ productType: string;
5
+ }
6
+ /**
7
+ * Parse a pbxproj file's content and return all signable native targets
8
+ * with their resolved bundle identifiers.
9
+ */
10
+ export declare function findSignableTargets(pbxprojContent: string): PbxTarget[];
11
+ /**
12
+ * Search for an Xcode project.pbxproj file in standard locations:
13
+ * <searchDir>/ios/*.xcodeproj/project.pbxproj
14
+ * <searchDir>/*.xcodeproj/project.pbxproj
15
+ * Returns the first found path, or null.
16
+ */
17
+ export declare function findXcodeProject(searchDir: string): string | null;
18
+ /**
19
+ * Convenience: find the Xcode project in projectDir and read its pbxproj content.
20
+ * Returns null if no project is found.
21
+ */
22
+ export declare function readPbxproj(projectDir: string): string | null;
23
+ /**
24
+ * Replace every `PRODUCT_BUNDLE_IDENTIFIER = <fromId>;` assignment in pbxproj
25
+ * content with `<toId>` (tolerates optional quotes and surrounding whitespace).
26
+ * Pure — returns the new content and the number of replacements made.
27
+ *
28
+ * Matching by exact value (rather than by config block) is deliberate: callers
29
+ * pass the resolved Release build id as `fromId`, and real Capacitor/RN projects
30
+ * give extensions a SUFFIXED id (com.app.ext), so only the main target's
31
+ * assignment(s) match. A Debug config that shares the exact same value is
32
+ * updated too (keeping Debug == Release); a Debug config with a different value
33
+ * is left untouched.
34
+ */
35
+ export declare function replaceBundleIdInPbxproj(content: string, fromId: string, toId: string): {
36
+ content: string;
37
+ changed: number;
38
+ };
39
+ /**
40
+ * Locate the project's pbxproj (same search order as detectIosBundleIds) and
41
+ * rewrite its `PRODUCT_BUNDLE_IDENTIFIER = <fromId>;` assignments to `<toId>`,
42
+ * writing the file back only when something changed. Returns the number of
43
+ * replacements (0 when no project or no matching assignment was found). Throws
44
+ * only on a filesystem read/write error.
45
+ */
46
+ export declare function writeReleaseBundleId(cwd: string, iosDir: string, fromId: string, toId: string): {
47
+ changed: number;
48
+ };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Platform Path Helpers
3
+ *
4
+ * Used by cloud build packaging to resolve custom Capacitor native project paths
5
+ * (e.g. android.path / ios.path) in monorepos.
6
+ */
7
+ /**
8
+ * Normalize a user-configured relative path:
9
+ * - Converts Windows separators to forward slashes
10
+ * - Strips a leading "./"
11
+ * - Strips trailing slashes
12
+ * - Returns "" for "." / "./" / empty
13
+ */
14
+ export declare function normalizeRelPath(input: string): string;
15
+ /**
16
+ * Get the platform directory to use inside the project zip based on Capacitor config.
17
+ * Falls back to the default platform directory ("ios" or "android") when not configured
18
+ * or when configured as ".".
19
+ */
20
+ export declare function getPlatformDirFromCapacitorConfig(capConfig: any, platform: 'ios' | 'android'): string;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Handle a custom_msg from the websocket stream.
3
+ * Known kinds get rich rendering; unknown kinds get a warning + raw dump.
4
+ */
5
+ export declare function handleCustomMsg(kind: string, data: Record<string, unknown>, log: (line: string) => void, warn: (line: string) => void): Promise<void>;
@@ -1,48 +1,107 @@
1
- import type { OptionsBase } from '../utils';
2
- export interface BuildCredentials {
3
- BUILD_CERTIFICATE_BASE64?: string;
4
- BUILD_PROVISION_PROFILE_BASE64?: string;
5
- BUILD_PROVISION_PROFILE_BASE64_PROD?: string;
6
- P12_PASSWORD?: string;
7
- APPLE_ID?: string;
8
- APPLE_APP_SPECIFIC_PASSWORD?: string;
9
- APPLE_KEY_ID?: string;
10
- APPLE_ISSUER_ID?: string;
11
- APPLE_KEY_CONTENT?: string;
12
- APP_STORE_CONNECT_TEAM_ID?: string;
13
- ANDROID_KEYSTORE_FILE?: string;
14
- KEYSTORE_KEY_ALIAS?: string;
15
- KEYSTORE_KEY_PASSWORD?: string;
16
- KEYSTORE_STORE_PASSWORD?: string;
17
- PLAY_CONFIG_JSON?: string;
18
- [key: string]: string | undefined;
1
+ /**
2
+ * Native Build Request Module
3
+ *
4
+ * This module handles native iOS and Android build requests through Capgo's cloud build service.
5
+ *
6
+ * CREDENTIAL SECURITY GUARANTEE:
7
+ * ═══════════════════════════════════════════════════════════════════════════
8
+ * Your build credentials (certificates, keystores, passwords, API keys) are:
9
+ *
10
+ * ✓ NEVER stored permanently on Capgo servers
11
+ * ✓ Used ONLY during the active build process
12
+ * ✓ Automatically deleted from Capgo servers after build completion
13
+ * ✓ Retained for a MAXIMUM of 24 hours (even if build fails)
14
+ * ✓ Builds sent DIRECTLY to app stores (Apple/Google)
15
+ * ✓ Build outputs may optionally be uploaded for time-limited download links
16
+ *
17
+ * Credentials are transmitted securely over HTTPS and used only in ephemeral
18
+ * build environments that are destroyed after each build completes.
19
+ * ═══════════════════════════════════════════════════════════════════════════
20
+ *
21
+ * BEFORE BUILDING:
22
+ * You must save your credentials first using:
23
+ * - `npx @capgo/cli build credentials save --platform ios` (for iOS)
24
+ * - `npx @capgo/cli build credentials save --platform android` (for Android)
25
+ * - Credentials stored in ~/.capgo/credentials.json (local machine only)
26
+ * - Use `build credentials clear` to remove saved credentials
27
+ */
28
+ import type { BuildOptionsPayload, BuildRequestOptions, BuildRequestResult } from '../schemas/build';
29
+ /**
30
+ * Callback interface for build logging.
31
+ * Allows callers (like the onboarding UI) to capture log output
32
+ * without stdout/stderr interception hacks.
33
+ */
34
+ export interface BuildLogger {
35
+ info: (msg: string) => void;
36
+ error: (msg: string) => void;
37
+ warn: (msg: string) => void;
38
+ success: (msg: string) => void;
39
+ /** Called with build log lines streamed from the builder */
40
+ buildLog: (msg: string) => void;
41
+ /** Called with upload progress percentage (0-100) */
42
+ uploadProgress: (percent: number) => void;
43
+ /** Called with custom messages from the builder (QR codes, etc.) */
44
+ customMsg: (kind: string, data: Record<string, unknown>) => void | Promise<void>;
19
45
  }
20
- export interface BuildRequestOptions extends OptionsBase {
21
- path?: string;
22
- lane: 'ios' | 'android';
23
- buildMode?: 'debug' | 'release';
24
- credentials?: BuildCredentials;
25
- userId?: string;
46
+ type BuildPlatform = 'ios' | 'android';
47
+ interface ResolveBuildPlatformOptions {
48
+ silent?: boolean;
49
+ interactive?: boolean;
50
+ promptPlatform?: () => Promise<unknown>;
26
51
  }
27
- export interface BuildRequestResponse {
28
- jobId: string;
29
- folder: string;
30
- status: 'queued' | 'reserved';
31
- artifactKey: string;
32
- uploadUrl: string;
33
- machine?: {
34
- id: string;
35
- ip: string;
36
- [key: string]: unknown;
37
- } | null;
52
+ export declare function resolveBuildPlatform(platform: string | undefined, { silent, interactive, promptPlatform, }?: ResolveBuildPlatformOptions): Promise<BuildPlatform>;
53
+ export type { BuildCredentials, BuildRequestOptions, BuildRequestResult } from '../schemas/build';
54
+ /**
55
+ * Extract native node_modules roots that contain platform folders.
56
+ */
57
+ interface NativeDependencies {
58
+ packages: Set<string>;
59
+ cordovaPackages: Set<string>;
60
+ usesSPM: boolean;
61
+ usesCocoaPods: boolean;
38
62
  }
39
- export interface BuildRequestResult {
40
- success: boolean;
41
- jobId?: string;
42
- uploadUrl?: string;
43
- status?: string;
44
- error?: string;
63
+ interface ZipDirectoryOptions {
64
+ nodeModules?: string;
45
65
  }
46
- export declare function requestBuildInternal(appId: string, options: BuildRequestOptions, silent?: boolean): Promise<BuildRequestResult>;
66
+ /**
67
+ * Check if a file path should be included in the zip
68
+ */
69
+ export declare function shouldIncludeFile(filePath: string, platform: 'ios' | 'android', nativeDeps: NativeDependencies, platformDir: string): boolean;
70
+ /**
71
+ * Zip directory for native build, including only necessary files:
72
+ * - ios/ OR android/ folder (based on platform)
73
+ * - node_modules with native code (from Podfile/settings.gradle)
74
+ * - capacitor.config.*, package.json, package-lock.json
75
+ * Zip contents are the user's responsibility, not Capgo's; Capgo packages the user-provided files as-is.
76
+ */
77
+ export declare function zipDirectory(projectDir: string, outputPath: string, platform: 'ios' | 'android', capConfig: any, options?: ZipDirectoryOptions): Promise<void>;
78
+ /**
79
+ * Request a native build from Capgo's cloud build service
80
+ *
81
+ * @param appId - The app ID (e.g., com.example.app)
82
+ * @param options - Build request options including platform and credentials
83
+ * @param silent - Suppress console output
84
+ *
85
+ * @returns Build request result with job ID and status
86
+ *
87
+ * SECURITY NOTE:
88
+ * Credentials provided to this function are:
89
+ * - Transmitted securely over HTTPS to Capgo's build servers
90
+ * - Used ONLY during the active build process
91
+ * - Automatically deleted after build completion
92
+ * - NEVER stored permanently on Capgo servers
93
+ * - Build outputs may optionally be uploaded for time-limited download links
94
+ */
95
+ /** Keys that are non-secret build options and should NOT be sent in the credentials blob. */
96
+ export declare const NON_CREDENTIAL_KEYS: Set<string>;
97
+ /**
98
+ * Split merged credentials into a build options payload and a credentials-only payload.
99
+ * Non-secret configuration keys (schemes, directories, output control) go into buildOptions.
100
+ * Only actual secrets (certificates, passwords, API keys) remain in buildCredentials.
101
+ */
102
+ export declare function splitPayload(mergedCredentials: Record<string, string | undefined>, platform: 'ios' | 'android', buildMode: string, cliVersion: string): {
103
+ buildOptions: BuildOptionsPayload;
104
+ buildCredentials: Record<string, string>;
105
+ };
106
+ export declare function requestBuildInternal(appId: string, options: BuildRequestOptions, silent?: boolean, logger?: BuildLogger): Promise<BuildRequestResult>;
47
107
  export declare function requestBuildCommand(appId: string, options: BuildRequestOptions): Promise<void>;
48
- //# sourceMappingURL=request.d.ts.map
@@ -0,0 +1,17 @@
1
+ export type BuilderUploadFailureCategory = 'network_error' | 'unauthorized' | 'payload_too_large' | 'storage_failure' | 'unknown';
2
+ type BuilderUploadPhase = 'started' | 'succeeded' | 'failed';
3
+ export interface TrackBuilderUploadInput {
4
+ apikey: string;
5
+ appId: string;
6
+ orgId: string;
7
+ platform: 'ios' | 'android';
8
+ buildMode: string;
9
+ jobId: string;
10
+ sizeBytes: number;
11
+ phase: BuilderUploadPhase;
12
+ durationSeconds?: number;
13
+ error?: unknown;
14
+ }
15
+ export declare function mapBuilderUploadError(error: unknown): BuilderUploadFailureCategory;
16
+ export declare function trackBuilderUpload(input: TrackBuilderUploadInput): Promise<void>;
17
+ export {};
@@ -0,0 +1,67 @@
1
+ export type BuilderCtaSurface = 'skip' | 'ci-ad' | 'prompt-onboarding' | 'prompt-build';
2
+ export type BuilderCtaAction = 'continue' | 'abort' | 'launch-onboarding' | 'launch-build';
3
+ export interface BuilderCtaContext {
4
+ incompatible: boolean;
5
+ interactive: boolean;
6
+ hasCredentials: boolean;
7
+ }
8
+ /**
9
+ * Pure decision: which Builder CTA surface (if any) to show for this upload.
10
+ * - `skip`: do nothing (compatible bundle).
11
+ * - `ci-ad`: non-interactive — print a one-off ad, never prompt.
12
+ * - `prompt-onboarding` / `prompt-build`: interactive prompt, branched on
13
+ * whether the app already has build credentials.
14
+ */
15
+ export declare function decideBuilderCtaSurface(ctx: BuilderCtaContext): BuilderCtaSurface;
16
+ export interface ShouldBlockIncompatibleUploadContext {
17
+ incompatible: boolean;
18
+ failOnIncompatible: boolean;
19
+ interactive: boolean;
20
+ /** The resolved Builder CTA action (`continue` in CI / when declined). */
21
+ builderAction: BuilderCtaAction;
22
+ }
23
+ /**
24
+ * Pure decision: should an incompatible upload be blocked (abort + exit non-zero)
25
+ * instead of uploaded, given `--fail-on-incompatible`?
26
+ *
27
+ * - Only confirmed-incompatible bundles with the flag set are candidates.
28
+ * - Non-interactive (CI): block immediately.
29
+ * - Interactive: block only when the user declined the Capgo Builder native-build
30
+ * escape hatch (`builderAction === 'continue'`). Accepting a native build
31
+ * (`launch-build` / `launch-onboarding`) supersedes the OTA upload, so do not block.
32
+ */
33
+ export declare function shouldBlockIncompatibleUpload(ctx: ShouldBlockIncompatibleUploadContext): boolean;
34
+ export declare function printBuilderCiAd(hasCredentials: boolean): void;
35
+ export type BuilderCtaChoice = 'yes' | 'no' | 'learn';
36
+ interface BuilderSelectOption {
37
+ value: BuilderCtaChoice;
38
+ label: string;
39
+ }
40
+ interface BuilderSelectOptions {
41
+ message: string;
42
+ options: BuilderSelectOption[];
43
+ initialValue?: BuilderCtaChoice;
44
+ }
45
+ /** Select-prompt seam (`@clack/prompts` `select` satisfies it); injectable for tests. */
46
+ export type BuilderSelect = (opts: BuilderSelectOptions) => Promise<BuilderCtaChoice | symbol>;
47
+ export interface MaybePromptBuilderCtaParams {
48
+ incompatible: boolean;
49
+ interactive: boolean;
50
+ /** Whether the app already has saved build credentials (resolved by the caller). */
51
+ hasCredentials: boolean;
52
+ appId: string;
53
+ orgId: string;
54
+ apikey: string;
55
+ incompatibleCount: number;
56
+ /** Injectable for tests; defaults to the `@clack/prompts` select prompt. */
57
+ select?: BuilderSelect;
58
+ /** Injectable for tests; defaults to opening the learn page in the browser. */
59
+ openUrl?: (url: string) => Promise<unknown>;
60
+ }
61
+ /**
62
+ * Surface the Capgo Builder CTA for an incompatible upload and return the action
63
+ * the caller should take. Never throws; telemetry and prompt failures degrade to
64
+ * `continue` so the upload is never blocked by the CTA.
65
+ */
66
+ export declare function maybePromptBuilderCta(params: MaybePromptBuilderCtaParams): Promise<BuilderCtaAction>;
67
+ export {};
@@ -1,3 +1,2 @@
1
1
  export declare function searchInDirectory(dirPath: string, searchString: string): boolean;
2
2
  export declare function checkIndexPosition(dirPath: string): boolean;
3
- //# sourceMappingURL=check.d.ts.map
@@ -1,18 +1,9 @@
1
- import type { OptionsBase } from '../utils';
2
- interface Options extends OptionsBase {
3
- version: string;
4
- bundle: string;
5
- keep: number;
6
- force: boolean;
7
- ignoreChannel: boolean;
8
- }
9
- export declare function cleanupBundleInternal(appId: string, options: Options, silent?: boolean): Promise<{
1
+ import type { BundleCleanupOptions } from '../schemas/bundle';
2
+ export declare function cleanupBundleInternal(appId: string, options: BundleCleanupOptions, silent?: boolean): Promise<{
10
3
  removed: number;
11
4
  kept: number;
12
5
  }>;
13
- export declare function cleanupBundle(appId: string, options: Options): Promise<{
6
+ export declare function cleanupBundle(appId: string, options: BundleCleanupOptions): Promise<{
14
7
  removed: number;
15
8
  kept: number;
16
9
  }>;
17
- export {};
18
- //# sourceMappingURL=cleanup.d.ts.map