@capgo/cli 8.3.0 → 8.4.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.
Files changed (31) hide show
  1. package/dist/index.js +608 -608
  2. package/dist/package.json +26 -2
  3. package/dist/src/build/mobileprovision-parser.d.ts +9 -0
  4. package/dist/src/build/onboarding/android/flow.d.ts +505 -0
  5. package/dist/src/build/onboarding/android/keystore.d.ts +18 -0
  6. package/dist/src/build/onboarding/android/oauth-google.d.ts +31 -0
  7. package/dist/src/build/onboarding/android/oauth-scopes.d.ts +4 -0
  8. package/dist/src/build/onboarding/android/types.d.ts +42 -1
  9. package/dist/src/build/onboarding/apple-api.d.ts +5 -1
  10. package/dist/src/build/onboarding/env-export.d.ts +12 -1
  11. package/dist/src/build/onboarding/flow/android-flow.d.ts +3 -0
  12. package/dist/src/build/onboarding/flow/contract.d.ts +24 -0
  13. package/dist/src/build/onboarding/flow/ios-flow.d.ts +3 -0
  14. package/dist/src/build/onboarding/ios/flow.d.ts +650 -0
  15. package/dist/src/build/onboarding/ios/progress.d.ts +2 -0
  16. package/dist/src/build/onboarding/mcp/app-id-validation.d.ts +8 -0
  17. package/dist/src/build/onboarding/mcp/contract.d.ts +51 -0
  18. package/dist/src/build/onboarding/mcp/engine.d.ts +131 -0
  19. package/dist/src/build/onboarding/mcp/explanations.d.ts +4 -0
  20. package/dist/src/build/onboarding/mcp/oauth-session.d.ts +29 -0
  21. package/dist/src/build/onboarding/mcp/onboarding-tools.d.ts +17 -0
  22. package/dist/src/build/onboarding/mcp/step-input.d.ts +45 -0
  23. package/dist/src/build/onboarding/mcp/terminal-launch.d.ts +22 -0
  24. package/dist/src/build/onboarding/tail/flow.d.ts +283 -0
  25. package/dist/src/build/onboarding/tail-types.d.ts +29 -0
  26. package/dist/src/build/onboarding/types.d.ts +82 -1
  27. package/dist/src/build/onboarding/ui/p8-error.d.ts +13 -0
  28. package/dist/src/build/output-record.d.ts +17 -0
  29. package/dist/src/schemas/onboarding.d.ts +41 -0
  30. package/dist/src/sdk.js +9 -9
  31. package/package.json +26 -2
@@ -1,3 +1,4 @@
1
+ import type { TailProgress } from '../tail-types.js';
1
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' | '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
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';
3
4
  export type KeystoreMethod = 'existing' | 'generate';
@@ -38,7 +39,21 @@ export interface AndroidPackageChoice {
38
39
  /** How we picked it — useful for telemetry / resume clarity. */
39
40
  source: 'gradle' | 'capacitor-config' | 'user-input';
40
41
  }
41
- export interface AndroidOnboardingProgress {
42
+ export interface CredentialsSaved {
43
+ /** ISO timestamp credentials.json was written — purely informational. */
44
+ savedAt: string;
45
+ }
46
+ export interface BuildRequested {
47
+ /** The build dashboard URL surfaced after the queue request succeeded. */
48
+ buildUrl: string;
49
+ }
50
+ export interface CiSecretsUploaded {
51
+ /** Provider the secrets were pushed to (matches the chosen ciSecretTarget). */
52
+ provider: 'github' | 'gitlab';
53
+ /** How many env vars were pushed — informational. */
54
+ count: number;
55
+ }
56
+ export interface AndroidOnboardingProgress extends TailProgress {
42
57
  platform: 'android';
43
58
  appId: string;
44
59
  startedAt: string;
@@ -62,11 +77,37 @@ export interface AndroidOnboardingProgress {
62
77
  androidPackageChosen?: AndroidPackageChoice;
63
78
  serviceAccountProvisioned?: ServiceAccountProvisioned;
64
79
  playInviteProvisioned?: PlayInviteProvisioned;
80
+ /** Set once `saving-credentials` wrote credentials.json. Gates tail entry. */
81
+ credentialsSaved?: CredentialsSaved;
82
+ /** Set once `requesting-build` queued a build. Guards a double build-request. */
83
+ buildRequested?: BuildRequested;
84
+ /** Set once `uploading-ci-secrets` pushed the secrets. Guards a re-upload. */
85
+ ciSecretsUploaded?: CiSecretsUploaded;
65
86
  };
66
87
  _oauthRefreshToken?: string;
67
88
  _keystoreBase64?: string;
68
89
  /** Base64 of the downloaded SA JSON key — saved as PLAY_CONFIG_JSON at end. */
69
90
  _serviceAccountKeyBase64?: string;
91
+ /** Platform whose onboarding is currently in-flight. */
92
+ activePlatform?: 'android';
93
+ /** True when the new-keystore password was auto-generated (random). Never logged. */
94
+ keystorePasswordGenerated?: boolean;
95
+ /** True once the user chose the MANUAL password method (lets the stateless MCP advance). */
96
+ keystorePasswordManual?: boolean;
97
+ /**
98
+ * Data-safety gate state for the shared engine (mirrors main's ink TUI
99
+ * `credentials-exist` → `backing-up` flow). The Ink driver does not read this
100
+ * field — it gates the same situation via React state — so it is harmless to
101
+ * the TUI. Lifecycle:
102
+ * - undefined → gate not yet evaluated (or no saved credentials exist)
103
+ * - 'pending' → saved android credentials exist; awaiting the user's
104
+ * backup-or-cancel choice (the `credentials-exist` step)
105
+ * - 'backup' → user chose backup; the `backing-up` effect must still run
106
+ * - 'done' → backup performed (or source absent); proceed to keystore
107
+ * - 'cancel' → user chose to stop; onboarding halts to protect the
108
+ * existing credentials (mirrors main's exitOnboarding())
109
+ */
110
+ _credentialsExistGate?: 'pending' | 'backup' | 'done' | 'cancel';
70
111
  }
71
112
  export declare const ANDROID_STEP_PROGRESS: Record<AndroidOnboardingStep, number>;
72
113
  export declare function getAndroidPhaseLabel(step: AndroidOnboardingStep): string;
@@ -79,6 +79,7 @@ export declare function classifyCertAvailability(args: {
79
79
  */
80
80
  export declare function listDistributionCerts(token: string, options?: {
81
81
  includeContent?: boolean;
82
+ types?: ('DISTRIBUTION' | 'IOS_DISTRIBUTION')[];
82
83
  }): Promise<AscDistributionCert[]>;
83
84
  /**
84
85
  * Compute the SHA1 hash of an ASC certificate's base64-DER content. Returns
@@ -140,7 +141,10 @@ export declare class CertificateLimitError extends Error {
140
141
  constructor(certificates: AscDistributionCert[]);
141
142
  }
142
143
  /**
143
- * Create a distribution certificate using a CSR.
144
+ * Create an Apple Distribution certificate (type DISTRIBUTION — the modern
145
+ * cross-platform type Xcode 11+ uses; the legacy IOS_DISTRIBUTION type is
146
+ * deprecated and its separate per-team pool tends to be full of old certs)
147
+ * using a CSR.
144
148
  * Returns the certificate ID, base64 DER content, expiration date, and team ID.
145
149
  *
146
150
  * Throws CertificateLimitError if the limit is reached, so the UI can ask
@@ -6,6 +6,12 @@
6
6
  * Reuses the renderer from `build credentials manage` so the file format
7
7
  * (section comments, .gitignore reminder, provisioning-map base64 fallback)
8
8
  * stays identical between the two paths.
9
+ *
10
+ * IMPORTANT (v1 contract): this writes a LOCAL `.env.capgo.<appId>.<platform>`
11
+ * file (mode 0o600). The file holds credentials, so it should stay local (add it to `.gitignore`). It performs NO git
12
+ * operation — no `git add`, no `git commit`, nothing touches the repo index.
13
+ * v1 must NOT add an auto-commit here; the user owns whether/when the file
14
+ * lands in version control.
9
15
  */
10
16
  import type { BuildCredentials } from '../../schemas/build.js';
11
17
  export interface EnvExportOpts {
@@ -14,7 +20,12 @@ export interface EnvExportOpts {
14
20
  credentials: Partial<BuildCredentials>;
15
21
  /** Default false — onboarding writes into the global store, not local. */
16
22
  local?: boolean;
17
- /** If absent, defaults to `<cwd>/.env.capgo.<appId>.<platform>`. */
23
+ /**
24
+ * If absent, defaults to `<cwd>/.env.capgo.<appId>.<platform>`.
25
+ *
26
+ * This is the path of a LOCAL 0o600 .env file holding credentials — keep it out of version control.
27
+ * Writing it performs NO git operation; v1 must not add an auto-commit.
28
+ */
18
29
  targetPath?: string;
19
30
  /** When true, write even if the file already exists. */
20
31
  overwrite?: boolean;
@@ -0,0 +1,3 @@
1
+ import type { AndroidOnboardingProgress, AndroidOnboardingStep } from '../android/types.js';
2
+ import type { PlatformFlow } from './contract.js';
3
+ export declare const androidFlow: PlatformFlow<AndroidOnboardingStep, AndroidOnboardingProgress, Record<string, unknown>>;
@@ -0,0 +1,24 @@
1
+ export type StepKind = 'auto' | 'human_gate' | 'choice' | 'info' | 'input' | 'done' | 'error';
2
+ export interface StepView {
3
+ kind: StepKind;
4
+ prompt: string;
5
+ options?: {
6
+ value: string;
7
+ label: string;
8
+ note?: string;
9
+ }[];
10
+ collect?: {
11
+ field: string;
12
+ desc: string;
13
+ secret?: boolean;
14
+ }[];
15
+ context?: Record<string, unknown>;
16
+ }
17
+ export interface PlatformFlow<Step extends string, Progress, Input> {
18
+ resumeStep: (progress: Progress | null) => Step;
19
+ viewForStep: (step: Step, progress: Progress, ctx?: Record<string, unknown>) => StepView;
20
+ applyInput: (step: Step, progress: Progress, input: Input) => Progress;
21
+ runEffect: (step: Step, progress: Progress, deps: unknown) => Promise<unknown>;
22
+ }
23
+ /** Runtime guard used by tests + frontends to validate a view-model. */
24
+ export declare function isStepView(v: unknown): v is StepView;
@@ -0,0 +1,3 @@
1
+ import type { OnboardingProgress, OnboardingStep } from '../types.js';
2
+ import type { PlatformFlow } from './contract.js';
3
+ export declare const iosFlow: PlatformFlow<OnboardingStep, OnboardingProgress, Record<string, unknown>>;