-
-
Notifications
You must be signed in to change notification settings - Fork 126
feat(cli): build init --renew for iOS cert and Capgo-managed profiles #2281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,13 +81,41 @@ export async function deleteProgress( | |
| /** | ||
| * Determine the first incomplete step based on saved progress. | ||
| * Returns the step to resume from. | ||
| * | ||
| * For init-mode progress (the default, including legacy files without a `mode` | ||
| * field), resumes the onboarding chain. For renew-mode progress, resumes the | ||
| * renewal chain — analysis re-runs unless we have a stored plan; otherwise we | ||
| * pick up at the cert or profile step depending on what's already completed. | ||
| */ | ||
| export function getResumeStep(progress: OnboardingProgress | null): OnboardingStep { | ||
| if (!progress) | ||
| return 'welcome' | ||
|
|
||
| const { completedSteps } = progress | ||
|
|
||
| if (progress.mode === 'renew') { | ||
| if (!completedSteps.renewPlan) | ||
| return 'renew-analyzing' | ||
| if (!completedSteps.apiKeyVerified) { | ||
| if (progress.issuerId && progress.keyId && progress.p8Path) | ||
| return 'verifying-key' | ||
| if (progress.keyId && progress.p8Path) | ||
| return 'input-issuer-id' | ||
| if (progress.p8Path) | ||
| return 'input-key-id' | ||
| return 'api-key-instructions' | ||
| } | ||
| if (!completedSteps.certificateCreated) { | ||
| // Plan tells us whether the cert needs renewing; the renew-revoking-cert | ||
| // and creating-certificate handlers will short-circuit when it doesn't. | ||
| return 'renew-revoking-cert' | ||
| } | ||
| // Cert is done (or wasn't needed). Profiles either in progress or about to save. | ||
| if ((completedSteps.renewedProfiles?.length ?? 0) === 0) | ||
| return 'renew-creating-profiles' | ||
| return 'renew-creating-profiles' | ||
|
Comment on lines
+96
to
+116
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The renew resume branch is skipping required state and can renew the cert unnecessarily. Two cases break here:
This branch needs to read the stored plan and use it to decide between Suggested direction if (progress.mode === 'renew') {
if (!completedSteps.renewPlan)
return 'renew-analyzing'
- if (!completedSteps.apiKeyVerified) {
- if (progress.issuerId && progress.keyId && progress.p8Path)
- return 'verifying-key'
- if (progress.keyId && progress.p8Path)
- return 'input-issuer-id'
- if (progress.p8Path)
- return 'input-key-id'
- return 'api-key-instructions'
- }
- if (!completedSteps.certificateCreated) {
- return 'renew-revoking-cert'
- }
+ const plan = JSON.parse(completedSteps.renewPlan) as { cert: { needsRenewal: boolean } }
+ if (!completedSteps.apiKeyVerified)
+ return 'renew-plan'
+ if (!completedSteps.certificateCreated)
+ return plan.cert.needsRenewal ? 'renew-revoking-cert' : 'renew-creating-profiles'
if ((completedSteps.renewedProfiles?.length ?? 0) === 0)
return 'renew-creating-profiles'
return 'renew-creating-profiles'
}🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| if (!completedSteps.apiKeyVerified) { | ||
| // Resume at the furthest partial input step | ||
| if (progress.issuerId && progress.keyId && progress.p8Path) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new
--appIdoverride is assigned inside thegetConfig()try-block, so if config loading throws (the exact case this flag is meant to support outside project root),appIdstays undefined and the command exits with "Could not detect app ID". This makes the documented override path unusable unless Capacitor config can already be loaded.Useful? React with 👍 / 👎.