Token导航 LogoToken导航TokenDH.com
开发需要联网github未标认证来源可访问许可证需确认审计通过

appmigrationkitappmigrationkit 命令行

Agent Skill

appmigrationkit 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

15,227

周安装

622

GitHub Stars

524

下载量

4,876
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:appmigrationkit(appmigrationkit 命令行)
来源仓库:https://github.com/dpearson2699/swift-ios-skills
仓库路径:skills/appmigrationkit
安装命令:
npx skills add https://github.com/dpearson2699/swift-ios-skills --skill appmigrationkit
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/dpearson2699/swift-ios-skills --skill appmigrationkit

简介

用于处理 GitHub 仓库、Issue 和 Pull Request。

  • 适合整理代码协作信息和仓库状态。appmigrationkit 属于开发类 Skill,可作为该场景下的辅助能力补充。
  • 通过 GitHub 安装,需确认权限范围。
  • 可能执行命令或访问网络,建议评估操作边界。
  • 适用于 Codex、Claude、Cursor 和 Gemini CLI。

SKILL.md

AppMigrationKit

One-time cross-platform data transfer for app resources. Enables apps to export data from one platform (e.g., Android) and import it on iOS during device setup or onboarding. iOS 26+ / iPadOS 26+ / Swift 6.3.

Beta-sensitive. AppMigrationKit is new in iOS 26 and may change before GM. Re-check current Apple documentation before relying on specific API details.

AppMigrationKit uses an app extension model. The system orchestrates the transfer between devices. The app provides an extension conforming to export and import protocols, and the system calls that extension at the appropriate time. The app itself never manages the network connection between devices.

Contents

Architecture Overview

AppMigrationKit operates through three layers:

  1. App extension -- An AppMigrationExtension conforming type that the system invokes during migration. It handles data export and import.
  2. System orchestration -- The OS manages the device-to-device session, transport, and scheduling. The extension does not control when it runs.
  3. Containing app -- After migration completes, the app checks MigrationStatus.importStatus on first launch to determine whether migration occurred and whether it succeeded.

Key types:

TypeRole
AppMigrationExtensionProtocol for the app extension entry point
ResourcesExportingWithOptionsProtocol for exporting files via archiver
ResourcesExportingSimplified export protocol (no custom options)
ResourcesImportingProtocol for importing files on the destination
ResourcesArchiverStreams files into the export archive
MigrationDataContainerAccess to the containing app's data directories
MigrationStatusCheck import result from the containing app
MigrationPlatformIdentifies the other device's platform (e.g., .android)
MigrationAppIdentifierIdentifies the source app by store and bundle ID
AppMigrationTesterTest-only actor for validating export/import logic

Setup and Entitlements

Entitlement

The app extension requires the com.apple.developer.app-migration.data-container-access entitlement. Its value is a single-element string array containing the bundle identifier of the containing app:

<key>com.apple.developer.app-migration.data-container-access</key>
<array>
    <string>com.example.myapp</string>
</array>

No other values are valid. This entitlement grants the extension read access to the containing app's data container during export and write access during import.

Extension Target

Add a new App Extension target to the Xcode project. The extension conforms to one or more of the migration protocols (ResourcesExportingWithOptions, ResourcesExporting, ResourcesImporting).

App Migration Extension

The extension entry point conforms to AppMigrationExtension. During migration, the system prevents launching the containing app and its other extensions to ensure exclusive data access.

Accessing the Data Container

The extension accesses the containing app's files through appContainer:

import AppMigrationKit

struct MyMigrationExtension: ResourcesExportingWithOptions, ResourcesImporting {
    // Access the containing app's directories
    let container = appContainer

    // container.bundleIdentifier     -- app's bundle ID
    // container.containerRootDirectory -- root of the app container
    // container.documentsDirectory    -- Documents/
    // container.applicationSupportDirectory -- Application Support/
}

MigrationDataContainer provides containerRootDirectory, documentsDirectory, and applicationSupportDirectory as URL values pointing into the containing app's sandbox.

Exporting Resources

Conform to ResourcesExportingWithOptions (or ResourcesExporting for no custom options) to package files for transfer. The system calls exportResources(to:request:) with a ResourcesArchiver and a MigrationRequestWithOptions.

Declaring Export Properties

struct MyMigrationExtension: ResourcesExportingWithOptions {
    typealias OptionsType = MigrationDefaultSupportedOptions

    var resourcesSizeEstimate: Int {
        // Return estimated total bytes of exported data
        calculateExportSize()
    }

    var resourcesVersion: String {
        "1.0"
    }

    var resourcesCompressible: Bool {
        true  // Let the system compress during transport
    }
}
  • resourcesSizeEstimate -- Estimated total bytes. The system uses this for progress UI and free-space checks.
  • resourcesVersion -- Format version string. The import side receives this to handle versioned data formats.
  • resourcesCompressible -- When true, the archiver may compress files during transport.

Implementing Export

func exportResources(
    to archiver: sending ResourcesArchiver,
    request: MigrationRequestWithOptions<MigrationDefaultSupportedOptions>
) async throws {
    let docsDir = appContainer.documentsDirectory

    // Check destination platform if needed
    if request.destinationPlatform == .android {
        // Platform-specific export logic
    }

    // Append files one at a time -- make continuous progress
    let userDataURL = docsDir.appending(path: "user_data.json")
    try await archiver.appendItem(at: userDataURL)

    // Append with a custom archive path
    let settingsURL = docsDir.appending(path: "settings.plist")
    try await archiver.appendItem(at: settingsURL, pathInArchive: "preferences/settings.plist")

    // Append a directory
    let photosDir = docsDir.appending(path: "photos")
    try await archiver.appendItem(at: photosDir, pathInArchive: "media/photos")
}

The archiver streams files incrementally. Call appendItem(at:pathInArchive:) repeatedly as each resource is ready. The system may terminate the extension if it appears hung, so avoid long gaps between append calls.

Cancellation

ResourcesArchiver handles task cancellation automatically by throwing cancellation errors. Do not catch these errors -- doing so causes the system to kill the extension.

Migration Platform

MigrationRequestWithOptions exposes destinationPlatform as a MigrationPlatform value. Use this to tailor exported data:

if request.destinationPlatform == .android {
    // Export in a format the Android app expects
}

MigrationPlatform provides .android as a static constant. Custom platforms can be created with MigrationPlatform("customPlatform").

Importing Resources

Conform to ResourcesImporting to receive transferred files on the destination device. The system calls importResources(at:request:) after app installation but before the app is launchable.

struct MyMigrationExtension: ResourcesImporting {
    func importResources(
        at importedDataURL: URL,
        request: ResourcesImportRequest
    ) async throws {
        let sourceVersion = request.sourceVersion
        let sourceApp = request.sourceAppIdentifier

        // sourceApp.platform        -- e.g., .android
        // sourceApp.bundleIdentifier -- source app's bundle ID
        // sourceApp.storeIdentifier  -- e.g., .googlePlay

        // Copy imported files into the app container
        let docsDir = appContainer.documentsDirectory

        let userData = importedDataURL.appending(path: "user_data.json")
        if FileManager.default.fileExists(atPath: userData.path()) {
            try FileManager.default.copyItem(
                at: userData,
                to: docsDir.appending(path: "user_data.json")
            )
        }
    }
}

Error Handling During Import

On import error, the system clears the containing app's data container to prevent partial state. However, app group containers are not cleared. The import implementation should clear any app group containers before writing imported content:

func importResources(
    at importedDataURL: URL,
    request: ResourcesImportRequest
) async throws {
    // Clear shared app group data first
    let groupURL = FileManager.default.containerURL(
        forSecurityApplicationGroupIdentifier: "group.com.example.myapp"
    )
    if let groupURL {
        try? FileManager.default.removeItem(at: groupURL.appending(path: "shared_data"))
    }

    // Then import
    try await performImport(from: importedDataURL)
}

Source App Identifier

ResourcesImportRequest provides sourceAppIdentifier as a MigrationAppIdentifier with three properties:

  • platform -- The source device's platform (e.g., .android)
  • bundleIdentifier -- The source app's bundle identifier
  • storeIdentifier -- The app store (e.g., .googlePlay)

Migration Status

After migration completes, the containing app checks the result on first launch:

import AppMigrationKit

func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
    if let status = MigrationStatus.importStatus {
        switch status {
        case .success:
            showMigrationSuccessUI()
            MigrationStatus.clearImportStatus()
        case .failure(let error):
            showMigrationFailureUI(error: error)
            MigrationStatus.clearImportStatus()
        }
    }
    return true
}
  • MigrationStatus.importStatus is nil if no migration occurred.
  • Call clearImportStatus() after handling the result to prevent showing the notification on subsequent launches.
  • The enum has two cases: .success and .failure(any Error).

Progress Tracking

The import side exposes a Progress object via resourcesImportProgress. The system uses this to display transfer progress to the user. Update completedUnitCount incrementally during import:

var resourcesImportProgress: Progress {
    Progress(totalUnitCount: 100)
}

func importResources(
    at importedDataURL: URL,
    request: ResourcesImportRequest
) async throws {
    let progress = resourcesImportProgress
    let files = try FileManager.default.contentsOfDirectory(
        at: importedDataURL, includingPropertiesForKeys: nil
    )
    let increment = Int64(100 / max(files.count, 1))
    for file in files {
        try processFile(file)
        progress.completedUnitCount += increment
    }
    progress.completedUnitCount = 100
}

Testing

AppMigrationTester is a test-only actor for validating migration logic in unit tests hosted by the containing app. Do not use it in production.

import Testing
import AppMigrationKit

@Test func testExportImportRoundTrip() async throws {
    let tester = try await AppMigrationTester(platform: .android)

    // Export
    let result = try await tester.exportController.exportResources(
        request: nil, progress: nil
    )
    #expect(result.exportProperties.uncompressedBytes > 0)

    // Import the exported data
    try await tester.importController.importResources(
        from: result.extractedResourcesURL,
        importRequest: nil, progress: nil
    )
    try await tester.importController.registerImportCompletion(with: .success)
}

DeviceToDeviceExportProperties on the result exposes uncompressedBytes, compressedBytes (nil if not compressible), sizeEstimate, and version.

See references/appmigrationkit-patterns.md for additional test patterns.

Common Mistakes

DON'T: Catch cancellation errors from ResourcesArchiver

// WRONG -- system kills the extension if cancellation is swallowed
func exportResources(to archiver: sending ResourcesArchiver, request: ...) async throws {
    do {
        try await archiver.appendItem(at: fileURL)
    } catch is CancellationError {
        // Swallowing this causes termination
    }
}

// CORRECT -- let cancellation propagate
func exportResources(to archiver: sending ResourcesArchiver, request: ...) async throws {
    try await archiver.appendItem(at: fileURL)
}

DON'T: Leave long gaps between archiver append calls

// WRONG -- system may assume the extension is hung and terminate it
func exportResources(to archiver: sending ResourcesArchiver, request: ...) async throws {
    let allFiles = gatherAllFiles()  // Takes 30 seconds
    for file in allFiles {
        try await archiver.appendItem(at: file)
    }
}

// CORRECT -- interleave file preparation with archiving
func exportResources(to archiver: sending ResourcesArchiver, request: ...) async throws {
    for file in knownFilePaths() {
        try await archiver.appendItem(at: file)
    }
}

DON'T: Convert files to intermediate format during export

// WRONG -- may exhaust disk space creating temporary copies
func exportResources(to archiver: sending ResourcesArchiver, request: ...) async throws {
    let converted = try convertToJSON(originalDatabase)  // Doubles disk usage
    try await archiver.appendItem(at: converted)
}

// CORRECT -- export files as-is, convert on import side if needed
func exportResources(to archiver: sending ResourcesArchiver, request: ...) async throws {
    try await archiver.appendItem(at: originalDatabase)
}

DON'T: Ignore app group containers during import error recovery

// WRONG -- system clears app container but not app groups on error
func importResources(at url: URL, request: ResourcesImportRequest) async throws {
    try writeToAppGroup(data)
    try writeToAppContainer(data)  // If this throws, app group has stale data
}

// CORRECT -- clear app group data before importing
func importResources(at url: URL, request: ResourcesImportRequest) async throws {
    try clearAppGroupData()
    try writeToAppGroup(data)
    try writeToAppContainer(data)
}

DON'T: Forget to clear import status after handling it

// WRONG -- migration UI shows every launch
if let status = MigrationStatus.importStatus {
    showMigrationResult(status)
    // Missing clearImportStatus()
}

// CORRECT
if let status = MigrationStatus.importStatus {
    showMigrationResult(status)
    MigrationStatus.clearImportStatus()
}

Review Checklist

  • Extension target added with com.apple.developer.app-migration.data-container-access entitlement
  • Entitlement array contains exactly one string: the containing app's bundle identifier
  • Extension conforms to ResourcesExportingWithOptions or ResourcesExporting for export
  • Extension conforms to ResourcesImporting for import
  • resourcesSizeEstimate returns a reasonable byte estimate
  • resourcesVersion is set and will be checked on import for format compatibility
  • Export calls appendItem incrementally without long pauses
  • Cancellation errors from ResourcesArchiver are not caught
  • Import clears app group containers before writing new data
  • Containing app checks MigrationStatus.importStatus on first launch
  • clearImportStatus() called after handling the migration result
  • AppMigrationTester used in unit tests to validate export and import
  • Files are exported as-is without intermediate format conversion on the export side
  • sourceVersion from import request used to handle versioned data formats

References

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.42%
按下载量换算1,825

Claude

29.19%
按下载量换算1,423

Cursor

20.27%
按下载量换算988

Gemini CLI

9.35%
按下载量换算456

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills