SP-874: Add single package import command#369
SP-874: Add single package import command#369Zgjim Haziri (ZgjimHaziri) wants to merge 3 commits into
Conversation
Adds the CLI counterpart to the new pacman single-package import API. The command lives under a new 'config package' subgroup, separate from the existing batch 'config import', because the two use different, non-interchangeable archive formats. Supports importing from a package zip (--file) or a directory (--directory, flat-zipped by the CLI), with --overwrite and optional --json output. Config docs and CLI help updated to frame the batch commands as their own batch-specific set. Includes-AI-Code: true Co-authored-by: Cursor <cursoragent@cursor.com>
…fixes) Mark injected members as readonly and use node: import prefixes for built-in modules. The single-package-import test mocks node:fs explicitly so the temp file cleanup is intercepted (the global fs mock only covers the bare specifier). Includes-AI-Code: true Co-authored-by: Cursor <cursoragent@cursor.com>
| .option("-f, --file <file>", "Package zip file (relative path)") | ||
| .option("-d, --directory <directory>", "Package directory (relative path)") |
There was a problem hiding this comment.
Something that could make the interface a bit simpler, could be a source paramter that replaces both file and directory, and could be either a zip file or a directory and is resolved internally by the tool to determine its type
There was a problem hiding this comment.
I like the explicit options a bit more, since it's more clear what the options are. Let's see what the others think, and we can decide based on that.
|
|
||
| `config package import` imports a package from a package zip (or directory). Unlike [`config import`](#batch-import-packages) — which performs a **batch** import and expects the multi-package batch archive (`manifest.json`, a top-level `variables.json`, `studio.json`, and a nested `<packageKey>_<version>.zip` per package) — `config package import` takes a plain, flat package layout and imports it on its own. | ||
|
|
||
| > A zip produced by `config export` is a **batch archive** and cannot be imported with `config package import`. Likewise, a package zip cannot be imported with `config import`. Use the command that matches how the artifact was produced. |
There was a problem hiding this comment.
A zip produced by
config exportis a batch archive and cannot be imported withconfig package import.
I'm not sure I understand what this means? Can you explain?
There was a problem hiding this comment.
Batch artifact, would be the right word. This means that if you export via config export, you cannot import via config package import. Because the structure of the former batch one, is different from the latter single import.
There was a problem hiding this comment.
Let's change it then.
| content-cli config package import -p <sourceProfile> -f <file path> --overwrite | ||
| ``` | ||
|
|
||
| When overwriting, variable assignments whose key is no longer declared in the imported `package.json` are pruned, keeping declarations and assignments consistent. |
There was a problem hiding this comment.
When overwriting, variable assignments whose key is no longer declared in the imported
package.jsonare pruned
Can we say ingored, instead of pruned?
| .action(this.batchImportPackages); | ||
|
|
||
| const packageCommand = configCommand.command("package") | ||
| .description("Commands for working with a package."); |
There was a problem hiding this comment.
| .description("Commands for working with a package."); | |
| .description("Commands for working with a single package."); |
- Rename "batch archive" to "batch artifact" in config-commands docs - Describe overwritten, undeclared variable assignments as "ignored" - Clarify the 'config package' group description (single package) Includes-AI-Code: true Co-authored-by: Cursor <cursoragent@cursor.com>
|



Description
Adds a new
config package importcommand for importing a single package — the CLI counterpart to the new pacman single-package import API (POST /pacman/api/core/staging/packages/import-file).How it was done:
config packagesubgroup instead of overloading the existing batchconfig import. The two use different, non-interchangeable archive formats (the batch archive has nested per-package zips + manifest; the single-package format is a flatpackage.json+nodes/), so keeping them separate avoids confusing the workflows.--file) or a directory (--directory, which the CLI flat-zips before upload), with an--overwriteflag and optional--jsonoutput. A 4 GB uncompressed guard is enforced on the archive.Relevant links
Checklist
Includes-AI-Code: true
Made with Cursor