Skip to content

apm unpack

Terminal window
apm unpack BUNDLE_PATH [OPTIONS]

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.

FlagDefaultDescription
-o, --output PATH.Target project directory. Created if it does not exist.
--skip-verifyoffSkip the bundle completeness check against the bundle’s apm.lock.yaml. Useful for partial bundles.
--dry-runoffList files that would be unpacked without writing anything.
--forceoffDeploy despite critical hidden-character findings from the security scan. Use only after independent verification.
--verbose, -voffShow per-file paths and full diagnostic context.

Unpack a legacy archive into the current directory:

Terminal window
apm pack --format apm --archive
apm unpack ./build/my-pkg-1.0.0.zip

Unpack into a specific project directory:

Terminal window
apm unpack bundle.zip --output /path/to/project

Preview the extraction plan without writing files:

Terminal window
apm unpack bundle.zip --dry-run

Skip verification when working with a partial bundle:

Terminal window
apm unpack bundle.zip --skip-verify

Override a critical hidden-character finding after manual review:

Terminal window
apm unpack bundle.zip --force
  • Bundle formats. apm install deploys only plugin-format bundles. Legacy --format apm tarballs (whole-project bundles produced by older apm pack invocations) are deployed via apm unpack, except executable content (see the caution above), and have no equivalent install path. apm unpack refuses a plugin-format bundle (root plugin.json) and points to apm 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_files entry 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 --force is passed (exit code 1). Non-critical warnings are surfaced with a hint to run apm audit.
  • Verification. By default, every entry in the bundle’s deployed_files must exist inside the archive. --skip-verify disables 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 unpack warns and — with --verbose — suggests the apm pack --target command the publisher should run.
  • Org policy and integrity. Before a preview or a write, apm unpack applies the same org policy checks as apm 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 under fetch_failure_default: block fails closed. Each file is checked against its locked hash; a mismatch is refused when policy sets security.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 its apm.lock.yaml, as apm install <bundle> does, so apm audit checks 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 and apm unpack says so.
  • Lockfile is metadata. The bundle’s own apm.lock.yaml is read for verification and target metadata but is never copied to the output directory.
  • One operation at a time. apm unpack waits for any other running APM operation, like apm install (not with --dry-run).
  • Exit codes. 0 on success (including --dry-run); 1 on missing bundle, invalid bundle, executable content (--force does not override this), an org policy or integrity refusal, or critical security findings without --force.
  • apm pack — produce the bundles that apm unpack extracts.
  • 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.