@capgo/cli 8.3.1 → 8.4.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 (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 +226 -226
  31. package/package.json +26 -2
@@ -1,3 +1,4 @@
1
+ import type { TailProgress } from './tail-types.js';
1
2
  export type Platform = 'ios' | 'android';
2
3
  export interface OnboardingCompletionSummary {
3
4
  /** The Capgo dashboard build URL, when a build was kicked off. */
@@ -73,7 +74,21 @@ export interface ProfileData {
73
74
  profileName: string;
74
75
  profileBase64: string;
75
76
  }
76
- export interface OnboardingProgress {
77
+ export interface IosCredentialsSaved {
78
+ /** ISO timestamp credentials.json was written — purely informational. */
79
+ savedAt: string;
80
+ }
81
+ export interface IosBuildRequested {
82
+ /** The build dashboard URL surfaced after the queue request succeeded. */
83
+ buildUrl: string;
84
+ }
85
+ export interface IosCiSecretsUploaded {
86
+ /** Provider the secrets were pushed to (matches the chosen ciSecretTarget). */
87
+ provider: 'github' | 'gitlab';
88
+ /** How many env vars were pushed — informational. */
89
+ count: number;
90
+ }
91
+ export interface OnboardingProgress extends TailProgress {
77
92
  platform: Platform;
78
93
  appId: string;
79
94
  startedAt: string;
@@ -127,10 +142,76 @@ export interface OnboardingProgress {
127
142
  * user already moved on from.
128
143
  */
129
144
  iosBundleIdContextAppId?: string;
145
+ /**
146
+ * LEGACY (engine-era confirm-app-id gate, removed by PR #2397). Older CLI
147
+ * versions persisted this when the user confirmed the bundle id at the
148
+ * now-removed `confirm-app-id` step. No code reads it anymore — the driver
149
+ * silently adopts the authoritative Release bundle id and the remote
150
+ * `verify-app` step owns the bundle-id invariant (see `iosBundleIdOverride`).
151
+ * Kept in the type only so older progress files keep parsing; resume IGNORES
152
+ * it (see test-ios-confirm-app-id.mjs).
153
+ */
154
+ appIdConfirmed?: boolean;
155
+ /**
156
+ * LEGACY (engine-era confirm-app-id gate, removed by PR #2397). The router
157
+ * target the removed `confirm-app-id` step would have returned to. No code
158
+ * reads it anymore; resume IGNORES it so a stale value can never park the
159
+ * wizard on a step that no longer renders (see test-ios-confirm-app-id.mjs).
160
+ */
161
+ pendingAppIdNext?: OnboardingStep;
162
+ /**
163
+ * Lifecycle of the iOS data-safety gate that runs BEFORE the setup-method
164
+ * fork when saved iOS credentials already exist for this appId. Mirrors the
165
+ * android `_credentialsExistGate` marker so the gate is resume-derivable
166
+ * instead of living only in the TUI's `setStep` calls:
167
+ * - 'pending' → saved iOS credentials exist; awaiting the user's
168
+ * backup-or-cancel choice (the `credentials-exist` step)
169
+ * - 'backup' → user chose backup; the `backing-up` effect must still run
170
+ * - 'done' → backup performed (or source absent); proceed to setup
171
+ * - 'cancel' → user chose to stop; onboarding halts to protect the
172
+ * existing credentials
173
+ *
174
+ * Absent on legacy/in-flight progress files → treated as "no gate", so the
175
+ * resume routing is unchanged for every existing progress file.
176
+ *
177
+ * ADDITIVE (BATCH 0): only consumed by `getIosResumeStep`'s Phase-0 gate.
178
+ */
179
+ _credentialsExistGate?: 'pending' | 'backup' | 'done' | 'cancel';
180
+ /**
181
+ * Which step triggered the `duplicate-profile-prompt`, so the post-deletion
182
+ * effect (`deleting-duplicate-profiles`) can route back to the right place on
183
+ * resume. The prompt is dual-origin: `creating-profile` reaches it on the
184
+ * create-new path, and `import-create-profile-only` reaches it on the import
185
+ * path. Persisting the origin prevents an import user from being routed back
186
+ * into the create-new `creating-profile` step (the exact class of resume bug
187
+ * the `setupMethod` branch was added to prevent).
188
+ *
189
+ * ADDITIVE (BATCH 0): persisted now so the engine surface is total; the
190
+ * effect that reads it is wired in a later batch.
191
+ */
192
+ duplicateProfileOrigin?: 'creating-profile' | 'import-create-profile-only';
193
+ /**
194
+ * Deferred recovery branch after the import `.p8` input chain. When the user
195
+ * picks "create" in `import-no-match-recovery` but has no ASC API key yet, the
196
+ * flow detours through `api-key-instructions` → `verifying-key` and must
197
+ * return to `import-create-profile-only` afterwards. Persisting the pending
198
+ * action (e.g. `'create-profile-only'`) lets resume restore that deferred
199
+ * target instead of dropping the user at the picker.
200
+ *
201
+ * ADDITIVE (BATCH 0): persisted now so the engine surface is total; the
202
+ * routing that reads it is wired in a later batch.
203
+ */
204
+ pendingRecoveryAction?: string;
130
205
  completedSteps: {
131
206
  apiKeyVerified?: ApiKeyData;
132
207
  certificateCreated?: CertificateData;
133
208
  profileCreated?: ProfileData;
209
+ /** Set once `saving-credentials` wrote credentials.json. Gates tail entry. */
210
+ credentialsSaved?: IosCredentialsSaved;
211
+ /** Set once `requesting-build` queued a build. Guards a double build-request. */
212
+ buildRequested?: IosBuildRequested;
213
+ /** Set once `uploading-ci-secrets` pushed the secrets. Guards a re-upload. */
214
+ ciSecretsUploaded?: IosCiSecretsUploaded;
134
215
  };
135
216
  /** Temporary — wiped after .p12 creation */
136
217
  _privateKeyPem?: string;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Pure classifier for the .p8 submit handlers' catch blocks (ui/app.tsx —
3
+ * the api-key-instructions onPathSubmit and input-p8-path onSubmit handlers).
4
+ *
5
+ * Those handlers' try blocks span more than the readFile: savePartialProgress
6
+ * and loadProgress run AFTER the read succeeded, so the catch must not rewrite
7
+ * every failure to "File not found: <path>". Only a genuinely missing file
8
+ * (ENOENT) earns the friendly not-found message; everything else (EACCES,
9
+ * persistence I/O failures, programming errors, non-Error throwables) is
10
+ * 'other' and the handler surfaces the REAL error instead.
11
+ */
12
+ export type P8SubmitErrorKind = 'not-found' | 'other';
13
+ export declare function classifyP8SubmitError(err: unknown): P8SubmitErrorKind;
@@ -28,3 +28,20 @@ export interface WriteBuildOutputRecordInput {
28
28
  * record's `qrCodePngPath` field is null when the PNG could not be produced.
29
29
  */
30
30
  export declare function writeBuildOutputRecord(recordPath: string, input: WriteBuildOutputRecordInput, onWarn?: (msg: string) => void): Promise<BuildOutputRecord>;
31
+ /**
32
+ * Returns a deterministic temp-file path for the build output record for a
33
+ * given (appId, platform) pair. Both the build hand-off (command emit) and
34
+ * the confirm (record read) call this helper so that the path is never passed
35
+ * back and forth across an MCP boundary.
36
+ *
37
+ * appId is sanitized: all `/` and `\` characters are replaced with `_`, and
38
+ * any `..` sequences are replaced with `_`, to prevent path traversal.
39
+ */
40
+ export declare function defaultBuildRecordPath(appId: string, platform: 'ios' | 'android'): string;
41
+ /**
42
+ * Read a build output record from `path`. Returns the parsed `BuildOutputRecord`
43
+ * if the file exists, is valid JSON, and the parsed object contains a string
44
+ * `jobId` property. Returns `null` in all other cases (missing file, parse
45
+ * error, missing/wrong-type jobId).
46
+ */
47
+ export declare function readBuildOutputRecord(path: string): Promise<BuildOutputRecord | null>;
@@ -0,0 +1,41 @@
1
+ import { z } from 'zod';
2
+ export declare const onboardingNextStepSchema: z.ZodObject<{
3
+ platform: z.ZodOptional<z.ZodEnum<{
4
+ android: "android";
5
+ ios: "ios";
6
+ }>>;
7
+ serviceAccountJsonPath: z.ZodOptional<z.ZodString>;
8
+ runBuild: z.ZodOptional<z.ZodBoolean>;
9
+ keyId: z.ZodOptional<z.ZodString>;
10
+ issuerId: z.ZodOptional<z.ZodString>;
11
+ p8Path: z.ZodOptional<z.ZodString>;
12
+ serviceAccountMethod: z.ZodOptional<z.ZodEnum<{
13
+ generate: "generate";
14
+ existing: "existing";
15
+ }>>;
16
+ playDeveloperId: z.ZodOptional<z.ZodString>;
17
+ gcpProjectId: z.ZodOptional<z.ZodString>;
18
+ gcpProjectName: z.ZodOptional<z.ZodString>;
19
+ androidPackage: z.ZodOptional<z.ZodString>;
20
+ saMethodChoice: z.ZodOptional<z.ZodEnum<{
21
+ retry: "retry";
22
+ oauth: "oauth";
23
+ "save-anyway": "save-anyway";
24
+ }>>;
25
+ checkBuild: z.ZodOptional<z.ZodBoolean>;
26
+ keystoreMethod: z.ZodOptional<z.ZodEnum<{
27
+ generate: "generate";
28
+ existing: "existing";
29
+ }>>;
30
+ keystorePath: z.ZodOptional<z.ZodString>;
31
+ keystoreStorePassword: z.ZodOptional<z.ZodString>;
32
+ keystoreAlias: z.ZodOptional<z.ZodString>;
33
+ keystoreKeyPassword: z.ZodOptional<z.ZodString>;
34
+ keystoreNewAlias: z.ZodOptional<z.ZodString>;
35
+ keystorePasswordMethod: z.ZodOptional<z.ZodEnum<{
36
+ random: "random";
37
+ manual: "manual";
38
+ }>>;
39
+ keystoreCommonName: z.ZodOptional<z.ZodString>;
40
+ }, z.core.$strip>;
41
+ export type OnboardingNextStepInput = z.infer<typeof onboardingNextStepSchema>;