Skip to content

feat: add Cloudsmith listPackages and promotePackages components#5658

Open
felixgateru wants to merge 11 commits into
superplanehq:mainfrom
felixgateru:feat/cloudsmith-packages-3
Open

feat: add Cloudsmith listPackages and promotePackages components#5658
felixgateru wants to merge 11 commits into
superplanehq:mainfrom
felixgateru:feat/cloudsmith-packages-3

Conversation

@felixgateru

Copy link
Copy Markdown
Collaborator

What changed

Extended the Cloudsmith integration with two new action components: ListPackages and PromotePackage.

Why

ListPackages — to give pipelines visibility into the state of packages in a repository.
PromotePackage — to automate the copy or move of a package from one repository to another within the same namespace (e.g. staging → production).

How

Backend

Extended pkg/integrations/cloudsmith/ with:

  • list_packages.go — cloudsmith.listPackages action
  • promote_package.go — cloudsmith.promotePackage action
  • client.go — added ListPackagesWithFilters (paginated, accepts Lucene query string), CopyPackage (POST /packages/{owner}/{repo}/{id}/copy/), and MovePackage (POST /packages/{owner}/{repo}/{id}/move/).
  • Added backend tests: list_packages_test.go and promote_package_test.go covering Setup, Execute, query building, and

Frontend

Added web_src/src/pages/app/mappers/cloudsmith/:

  • list_packages.ts — node mapper;
  • promote_package.ts — node mapper;
  • types.ts — added ListPackagesConfiguration, TrimmedPackageData, ListPackagesData, PromotePackageConfiguration, PromotePackageResult.
  • index.ts — registered both mappers in componentMappers and their registries in eventStateRegistry.

@superplanehq-integration

Copy link
Copy Markdown

👋 Commands for maintainers:

  • /sp start - Start an ephemeral machine (takes ~30s)
  • /sp stop - Stop a running machine (auto-executed on pr close)

@superplane-gh-integration-9000

superplane-gh-integration-9000 Bot commented Jun 23, 2026

Copy link
Copy Markdown

PR Risk Review

Risk: 25/100 (low)
Review approved: Yes
Check passed: Yes

Summary

Well-structured addition of two new Cloudsmith integration components (listPackages and promotePackage) with comprehensive tests, documentation, and frontend mappers following existing patterns.

Concerns

  • The ListPackagesWithFilters function fetches all pages without any upper bound, which could lead to excessive memory usage or long-running requests for repositories with many thousands of packages.
  • Cross-namespace validation in PromotePackage.Execute is only enforced at execution time, not during Setup, so misconfiguration won't be caught until the action runs.
  • The promote_package_test.go Setup test for 'missing mode' doesn't provide a Metadata context, which may pass only because the error is hit before metadata resolution - could be fragile if validation order changes.

@felixgateru felixgateru marked this pull request as ready for review June 24, 2026 06:35
Comment thread pkg/integrations/cloudsmith/promote_package.go
@felixgateru felixgateru force-pushed the feat/cloudsmith-packages-3 branch from e7dbf5b to 76620e7 Compare June 24, 2026 07:38

@cursor cursor Bot left a comment

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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 76620e7. Configure here.

Comment thread pkg/integrations/cloudsmith/promote_package.go
- ListPackages: lists packages in a repository with optional filtering
  by sync status (fully synchronised / awaiting / failed), quarantine
  status, and vulnerability scan result; emits cloudsmith.packages.listed
- PromotePackage: copies or moves a package to another repository within
  the same namespace; emits cloudsmith.package.promoted
- Extends Client with ListPackagesWithFilters, CopyPackage, MovePackage
- Frontend mappers, spec tests, event-state registry entries and icon wiring
- Integration instructions updated: Admin privilege required on both
  source and destination repos for PromotePackage
- Component docs regenerated

Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
- Payload now emits a single object with a packages[] array instead of
  one payload per package; each entry carries only description,
  display_name, format, is_quarantined, license, policy_violated,
  repository, slug_perm, stage_str, status_str and tags
- Details panel shows Packages Found, Quarantined count, and Vulnerable
  (policy_violated) count instead of per-package Format/Status/Security
  Scan/Repository URL which only reflected the first package
- Added TrimmedPackageData and ListPackagesData types in types.ts
- Updated example payload and regenerated component docs

Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
…vulnerable count

- security_scan_status added to TrimmedPackage and TrimmedPackageData so
  the scan result is available per package in the output
- Vulnerable count now checks security_scan_status == "Scan Detected
  Vulnerabilities" instead of policy_violated, which was incorrect

Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
…e metadata

- Custom EventStateRegistry reads execution.configuration.mode to return
  "copied" or "moved" state so the badge shows COPIED or MOVED instead
  of a generic PROMOTED
- buildMetadata now includes destination repository (arrow-right icon)
  and the action being performed — Copy or Move (copy icon) — alongside
  the existing source repository and package entries

Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
…spec

Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
…uests

Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
…slug

Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
@felixgateru felixgateru force-pushed the feat/cloudsmith-packages-3 branch from 7269017 to b75d9f8 Compare June 25, 2026 15:02
@superplane-gh-integration-9000

Copy link
Copy Markdown

Risk: 35/100 (low)

Summary

Adds two new Cloudsmith integration components — ListPackages (with optional sync/quarantine/vulnerability filtering) and PromotePackage (copy or move a package between same-namespace repositories) — including backend Go implementations, frontend TypeScript mappers, tests, and documentation.

Concerns

  • ListPackagesWithFilters fetches all pages with no upper bound; large repos could cause memory pressure or timeouts.
  • Cross-namespace owner mismatch is only caught in Execute, not in Setup; users see the error at run time, not configuration time.
  • PromotePackage emits the full Package struct; ListPackages trims fields, but PromotePackage does not — inconsistent output verbosity.
  • Execute switch default falls through to CopyPackage for any unrecognised mode value, bypassing the invalid-mode guard from Setup.

Recommended reviewers: bender-rodriguez-unit1

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.

1 participant