Skip to content

SP-874: Add single package import command#369

Open
Zgjim Haziri (ZgjimHaziri) wants to merge 2 commits into
mainfrom
SP-874-add-single-package-import-command
Open

SP-874: Add single package import command#369
Zgjim Haziri (ZgjimHaziri) wants to merge 2 commits into
mainfrom
SP-874-add-single-package-import-command

Conversation

@ZgjimHaziri
Copy link
Copy Markdown
Contributor

Description

Adds a new config package import command 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:

  • Added it under a new config package subgroup instead of overloading the existing batch config import. The two use different, non-interchangeable archive formats (the batch archive has nested per-package zips + manifest; the single-package format is a flat package.json + nodes/), so keeping them separate avoids confusing the workflows.
  • The command imports from a package zip (--file) or a directory (--directory, which the CLI flat-zips before upload), with an --overwrite flag and optional --json output. A 4 GB uncompressed guard is enforced on the archive.
  • Reframed the config docs and CLI help so the package commands read as the default for working with a package, and the batch commands are presented as their own batch-specific set whose artifacts don't mix with the single-package format.

Relevant links

Checklist

  • I have self-reviewed this PR
  • I have tested the change and proved that it works in different scenarios (unit tests cover file/directory imports, overwrite, JSON output, and the validation/error paths; full suite green)
  • I have updated docs if needed

Includes-AI-Code: true

Made with Cursor

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>
@ZgjimHaziri Zgjim Haziri (ZgjimHaziri) changed the title SP-874: add 'config package import' command for single-package import SP-874: Add single package import command Jun 4, 2026
@ZgjimHaziri Zgjim Haziri (ZgjimHaziri) marked this pull request as ready for review June 5, 2026 12:09
…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>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 5, 2026

Comment on lines +70 to +71
.option("-f, --file <file>", "Package zip file (relative path)")
.option("-d, --directory <directory>", "Package directory (relative path)")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants