Dx packaging move to 2gp migrate

From forcedotcom/sf-skills · View interactive version

Dx packaging move to 2gp migrate is an AI agent skill from the GitHub repository forcedotcom/sf-skills. Use this skill when users want to finalize the irreversible, one-way Move-to-2GP cutover for a converted 1GP managed package — afterward, new major/minor 1GP versions can NEVER be created. Also use when an ISV admin asks to move a 1GP package to 2GP development. TRIGGER when: the user asks to move,

How to use this skill

Skill file

Move to 2GP Development

When to Use This Skill

Finalize the irreversible, one-way Move-to-2GP cutover for a converted 1GP managed package — afterward, new major/minor 1GP versions can NEVER be created. Use when an ISV admin asks to move a 1GP package to 2GP development. The agent dispatches the finalize directly via the packaging Connect API (POST /connect/packaging/package/{packageId}/finalize-move-to-2gp, shipped 266) after clearing the eligibility + conversion/subscriber-migration-testing gates and obtaining the three explicit affirmations the endpoint requires; it then wire-verifies the result against PackageConversion.EndDate (read-only Tooling exposure, shipped 264).

Workflow


BACKEND / VERSIONING MECHANICS (relocated from the discover card — describe-only, never shown on the card):

Critical Constraints

Preconditions:

Operational rules:

MULTI-ORG DISPATCH (read once, important): this workflow spans two orgs — the 1GP DE (packaging) org and the DevHub org. Each step's invocation block carries a target_org field naming which org the call must hit ({packaging_org_alias} vs {devhub_alias}); route each call to the org its target_org names rather than assuming a single org for the whole workflow. Route to the DevHub org: discover-package-on-devhub, check-eligibility-2gp-converted-released, and check-already-done. Route to the packaging org: check-eligibility-1gp-released, finalize-move-to-2gp, and verify-finalize-on-packaging-org. If your execution channel can only reach one connected org at a time, run each off-target read-only step against the org named in its target_org before dispatching the finalize against the packaging org; a CLI-driven runner can map that routing onto its own tooling. A step sent to the wrong org returns empty or misleading results.

TWO ROOT INTENTS — pick by user phrasing.

INTENT A — "tell me how to move my package to 2GP" (planning /

education): walk the user through the full sequence —

discover-package-on-devhub → check-eligibility-1gp-released →

check-eligibility-2gp-converted-released → check-already-done →

remind-of-prerequisites (testing, source retrieval) → describe the

manual finalize step in Setup. Treat this as a planning

conversation, NOT a dispatch action.

discover-package-on-devhub → check-eligibility-1gp-released →

check-eligibility-2gp-converted-released → check-already-done →

confirm-affirmations → finalize-move-to-2gp (direct Connect API

dispatch) → verify-finalize-on-packaging-org (wire-verify against

PackageConversion.EndDate) → verify-finalize-by-user-confirmation

(optional cross-check). The finalize step now dispatches the

packaging Connect API POST directly against the 1GP DE org — the

agent does NOT open a browser tab in the normal path. It MUST

still obtain the three explicit affirmations in confirm-affirmations

first (the endpoint requires all three flags true and rejects the

call otherwise), then POST, then wire-verify EndDate. The manual

browser fallback path is retained only as a fallback for orgs on a

pre-266 release (see finalize-move-to-2gp.invocation.fallback).

EARLY EXIT: if check-already-done returns ≥1 row (a Package2Version exists with ConvertedFromVersionId = NULL), the move-to-2GP has ALREADY been completed — or the package was 2GP-native to start with. Report this to the user and stop. Do NOT proceed to affirmations or finalize.

ELIGIBILITY GATING: if check-eligibility-1gp-released returns no Released 1GP version, OR if check-eligibility-2gp-converted-released returns no matching Released 2GP-converted version at the same major.minor, the user is NOT eligible to Move to 2GP. Surface the specific missing piece and what to do — typically "you need to promote 2GP version X.Y to Released before you can move-to-2GP." If DevHub is not authenticated, skip the proactive 2GP eligibility query and rely on the endpoint's server-side validation instead — the finalize call returns a 400 with a specific reason (e.g. version mismatch) when the latest released version has not been converted + promoted; relay that message to the user.

RELEASE HISTORY (both milestones now shipped — describe-only, not an ongoing constraint): 264 shipped the read-only PackageConversion Tooling exposure, lighting up verify-finalize-on-packaging-org (EndDate-based wire-verify). 266 shipped the finalize Connect API — finalize-move-to-2gp now dispatches POST /services/data/v69.0/connect/packaging/package/{packageId}/finalize-move-to-2gp against the 1GP DE org (invocation.kind: rest, operationId finalizeMoveTo2gp, MCP-enabled). The endpoint requires the three affirmation flags (acknowledgedIrrevocable / acknowledgedTestingComplete / acknowledgedSourceRetrieved) all true in the request body, mirroring the Setup dialog's checkboxes — this is the load-bearing safety gate, so the confirm-affirmations step remains mandatory. For orgs still on a pre-266 release, the manual browser fallback applies.

Only the 1GP DE (packaging) org is required for the finalize dispatch + wire-verify. The DevHub org is optional — used only for the proactive eligibility pre-check; the endpoint validates eligibility server-side regardless.

Verification Checklist

After every write operation, confirm the effect by re-reading state:

Read Operations reference before executing this workflow. It contains the original operation definitions, dependencies, inputs, and verification instructions.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.