apm unpack
Synopsis
Section titled “Synopsis”apm unpack BUNDLE_PATH [OPTIONS]Description
Section titled “Description”apm unpack extracts an APM bundle (a .zip or legacy .tar.gz archive, or an already-unpacked bundle directory) into a target project. It runs the built-in security scan against the bundle contents before writing any files, and — unless --skip-verify is set — checks that every entry in the bundle’s apm.lock.yaml deployed_files list is actually present in the archive.
Extraction is additive-only: only files listed in the bundle’s lockfile are written. Existing project files at colliding paths are overwritten by the bundle version. Files outside the bundle’s manifest are never touched, and the bundle’s apm.lock.yaml is treated as metadata — it is not copied into the output directory.
BUNDLE_PATH accepts a .zip archive (the default), a legacy .tar.gz archive, or the directory form of an unpacked bundle.
Options
Section titled “Options”| Flag | Default | Description |
|---|---|---|
-o, --output PATH | . | Target project directory. Created if it does not exist. |
--skip-verify | off | Skip the bundle completeness check against the bundle’s apm.lock.yaml. Useful for partial bundles. |
--dry-run | off | List files that would be unpacked without writing anything. |
--force | off | Deploy despite critical hidden-character findings from the security scan. Use only after independent verification. |
--verbose, -v | off | Show per-file paths and full diagnostic context. |
Examples
Section titled “Examples”Unpack a legacy archive into the current directory:
apm pack --format apm --archiveapm unpack ./build/my-pkg-1.0.0.zipUnpack into a specific project directory:
apm unpack bundle.zip --output /path/to/projectPreview the extraction plan without writing files:
apm unpack bundle.zip --dry-runSkip verification when working with a partial bundle:
apm unpack bundle.zip --skip-verifyOverride a critical hidden-character finding after manual review:
apm unpack bundle.zip --forceBehavior
Section titled “Behavior”- Bundle formats.
apm installdeploys only plugin-format bundles. Legacy--format apmtarballs (whole-project bundles produced by olderapm packinvocations) are deployed viaapm unpack, except executable content (see the caution above), and have no equivalentinstallpath.apm unpackrefuses a plugin-format bundle (rootplugin.json) and points toapm install. - Additive writes only. Files not listed in the bundle’s lockfile are left alone; the bundle never deletes project files.
- Overwrite on collision. When a bundle file shares a path with a local file, the bundle file wins.
- Managed destinations only. Every
deployed_filesentry must land under a known integration directory (.github/,.claude/,.agents/, …) of the output directory, with no symlinked path component. Any other entry fails the unpack before a file is written. Bundle paths that run through a symlink are skipped. - Security scan. Bundle contents are scanned before deployment. Critical hidden-character findings block extraction unless
--forceis passed (exit code1). Non-critical warnings are surfaced with a hint to runapm audit. - Verification. By default, every entry in the bundle’s
deployed_filesmust exist inside the archive.--skip-verifydisables this check; missing files are then reported as skipped. - Target mismatch warning. If the bundle was packed for a different harness target than the output project’s detected target,
apm unpackwarns and — with--verbose— suggests theapm pack --targetcommand the publisher should run. - Org policy and integrity. Before a preview or a write,
apm unpackapplies the same org policy checks asapm install <bundle>, resolved from the output directory: the bundle’s locked dependencies and pack target are checked (a bundle with no pack target is checked as targeting every harness; an unknown pack target, or a file outside the pack target’s paths, is refused), and an unavailable policy underfetch_failure_default: blockfails closed. Each file is checked against its locked hash; a mismatch is refused when policy setssecurity.integrity.require_hashes, otherwise it warns. - Tracked output. When the output directory is an APM project (it has
apm.yml), the deployed files are recorded in itsapm.lock.yaml, asapm install <bundle>does, soapm auditchecks them. Files the lockfile already records with the same content stay with their recorded owner, so restoring a bundle into a checkout with a committed lockfile leaves tracked files unchanged. A lockfile that cannot be updated (malformed, a symbolic link, or written by a newer APM) is refused before any file is written. Any other directory stays untracked andapm unpacksays so. - Lockfile is metadata. The bundle’s own
apm.lock.yamlis read for verification and target metadata but is never copied to the output directory. - One operation at a time.
apm unpackwaits for any other running APM operation, likeapm install(not with--dry-run). - Exit codes.
0on success (including--dry-run);1on missing bundle, invalid bundle, executable content (--forcedoes not override this), an org policy or integrity refusal, or critical security findings without--force.
Related
Section titled “Related”apm pack— produce the bundles thatapm unpackextracts.apm install— the preferred deploy path for plugin-format bundles.apm audit— inspect hidden-character findings flagged during extraction.- Pack a bundle — producer guide covering bundle formats and distribution.
Copyright (c) Microsoft Corporation. General documentation: CC-BY-4.0. Software, code examples and OpenAPM: Apache-2.0. See scope and exclusions.