feat: add apm pack and apm unpack commands#218
Merged
danielmeppiel merged 7 commits intomainfrom Mar 10, 2026
Merged
Conversation
Implements self-contained bundle creation and consumption from the resolved dependency tree. New commands: - apm pack: collects deployed files into a portable bundle with target filtering, archive support, dry-run, and lockfile enrichment - apm unpack: extracts bundles with completeness verification, additive-only merge semantics, and path-traversal protection Architecture: - New bundle/ service layer (packer.py, unpacker.py, lockfile_enrichment.py) - New commands/pack.py command layer (following deps.py extraction pattern) - 3 lines added to cli.py for wiring Tests: 28 unit tests, 2 integration tests Docs: docs/pack-unpack.md
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class bundling support to APM via new apm pack / apm unpack commands, enabling creation and consumption of portable bundles based on apm.lock’s deployed_files.
Changes:
- Introduces a bundle service layer (
packer,unpacker,lockfile_enrichment) plus a thin Click command wrapper. - Wires
pack/unpackinto the main CLI and adds dedicated docs (docs/pack-unpack.md). - Adds unit + integration tests covering pack/unpack behavior, dry-run, verification, and enrichment.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
src/apm_cli/bundle/packer.py |
Implements bundle creation from lockfile deployed_files, with target filtering + optional archive output. |
src/apm_cli/bundle/unpacker.py |
Implements bundle extraction, completeness verification, and additive merge semantics. |
src/apm_cli/bundle/lockfile_enrichment.py |
Adds pack: metadata to the bundle’s lockfile copy. |
src/apm_cli/bundle/__init__.py |
Exposes pack/unpack APIs from the bundle package. |
src/apm_cli/commands/pack.py |
Adds Click commands/options and orchestrates pack/unpack output. |
src/apm_cli/cli.py |
Registers the new pack and unpack commands. |
docs/pack-unpack.md |
Documents usage, options, semantics, and enriched lockfile format. |
tests/unit/test_packer.py |
Unit coverage for packer (filtering, archive, dry-run, errors, enrichment). |
tests/unit/test_unpacker.py |
Unit coverage for unpacker (directory/archive, verify, dry-run, overwrite semantics). |
tests/unit/test_lockfile_enrichment.py |
Unit coverage for pack metadata enrichment. |
tests/integration/test_pack_unpack_e2e.py |
E2E round-trip tests for install → pack → unpack. |
Collaborator
Author
|
@copilot address unresolved pr review comments |
Contributor
|
@danielmeppiel I've opened a new pull request, #219, to work on those changes. Once the pull request is ready, I'll request review from you. |
7 tasks
Co-authored-by: danielmeppiel <51440732+danielmeppiel@users.noreply.github.com>
fix: address unresolved review comments on apm pack/unpack
- Add 'agents' as accepted --target choice (alias for 'vscode'), matching compile command - Add -t short flag for --target, matching compile command - Add 'agents' prefix mapping in packer for consistency
This was referenced Mar 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
apm packandapm unpackcommands for creating and consuming self-contained bundles from the resolved dependency tree.Commands
apm packCollects all deployed files from locked dependencies into a portable bundle.
apm unpackExtracts a bundle into the current project with completeness verification.
Architecture
Follows the
commands/deps.pyextraction pattern — no monolithic cli.py growth:src/apm_cli/bundle/):packer.py—pack_bundle()with target filtering, archive, dry-rununpacker.py—unpack_bundle()with verification, additive merge, path-traversal protectionlockfile_enrichment.py— addspack:metadata section to lockfile copy in bundlesrc/apm_cli/commands/pack.py) — thin Click orchestratorscli.pyKey design decisions
deployed_files, not disk scanapm.lockgets apack:section (format, target, timestamp); project lockfile is never modifiedbundle.json— single manifest via enriched lockfiledeployed_filespresent), per-file hashes deferred to v2Tests
test_packer.py(15),test_unpacker.py(9),test_lockfile_enrichment.py(4)test_pack_unpack_e2e.py(round-trip + dry-run)Manual validation
Verified on
apm-sample-project:Documentation
docs/pack-unpack.mdwith command reference, options, merge semantics, and enriched lockfile format