Skip to content

feat: add Zarf package disassembly command - #1520

Draft
Racer159 wants to merge 19 commits into
mainfrom
feat/add-disassemble-capability
Draft

feat: add Zarf package disassembly command#1520
Racer159 wants to merge 19 commits into
mainfrom
feat/add-disassemble-capability

Conversation

@Racer159

Copy link
Copy Markdown
Contributor

Description

This PR adds a Zarf package disassembly command to uds-cli - the goal is to take a built Zarf package and disassemble it into re-creatable source code that can be modified entirely offline. This is possible today manually with zarf tools archiver commands but this makes the process a bit more streamlined and intentional.

Related Issue

Fixes #N/A

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Other (security config, docs update, etc)

Checklist before merging

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.

We will likely want to talk to the Zarf team about how better to handle translations like this - there is a "safety" check test whenever the schemas (either beta or alpha) shift on us but this conversion should be owned more by Zarf than us in the future.

assert.Equal(t, v1beta1.APIVersion, reassembled.PackageDefinition.OriginalAPIVersion())
}

func TestPackageSchemaCoverage(t *testing.T) {

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.

This is that safety check test

@Racer159
Racer159 marked this pull request as ready for review September 1, 2026 19:51
@Racer159
Racer159 requested a review from a team as a code owner September 1, 2026 19:51
@Racer159

Racer159 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

since I know is'a comin' - @greptileai review

@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds legacy and Next-mode commands that disassemble complete Zarf packages into locally rebuildable source.

  • Loads local or OCI package artifacts and preserves supported v1alpha1/v1beta1 definitions.
  • Localizes charts, manifests, files, images, repositories, documentation, and package-level values.
  • Stages output atomically, marks reconstructed package versions, and rejects incomplete package forms.
  • Extends local package handling to uncompressed .tar archives and documents the offline workflow.

Confidence Score: 5/5

The PR appears safe to merge with no concrete blocking or independently actionable non-blocking issues identified.

Package inputs are validated before name-derived paths are used, output is staged before publication, and reconstructed resources are consistently rewritten to local offline inputs.

Important Files Changed

Filename Overview
internal/mode/disassemble/disassemble.go Orchestrates validated package loading, staged asset localization, definition rewriting, cleanup, and atomic publication.
internal/mode/disassemble/beta.go Maps localized alpha resources back into the original v1beta1 definition while replacing remote build inputs with local assets.
internal/mode/disassemble/kubernetes.go Rewrites packaged manifests, rendered kustomizations, charts, and values files into rebuildable local paths.
internal/mode/disassemble/images.go Converts packaged image content into a shared local OCI-layout archive referenced by reconstructed components.
internal/mode/disassemble/repos.go Copies packaged Git repositories and rewrites sources to absolute local file URLs required by Zarf.
internal/cli/bundle/dev_disassemble.go Adds the Next-mode command, resolves inherited configuration, configures Zarf runtime options, and prints structured results.
internal/legacy/cli/dev_disassemble.go Adds the compatible legacy command and forwards legacy verification and runtime configuration.
internal/zarf/local.go Extends canonical local package loading and ingestion to support uncompressed .tar package archives.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  CLI[uds dev disassemble] --> Load[Load local or OCI Zarf package]
  Load --> Validate[Validate package and reject differential or skeleton forms]
  Validate --> Stage[Create output staging directory]
  Stage --> Assets[Localize package and component assets]
  Assets --> Definition[Rewrite zarf.yaml with local sources]
  Definition --> Publish[Atomically publish output directory]
  Publish --> Rebuild[Rebuild package offline]
Loading

Reviews (1): Last reviewed commit: "fix unit test" | Re-trigger Greptile

@Racer159
Racer159 marked this pull request as draft September 1, 2026 20:30
@Racer159

Racer159 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Want to improve UX a little so moved back to draft - specifically thinking about how a chart edit might be needed... the zarf yaml I think can also use Zarf's helpers to be formatted a little cleaner and I want to explore that too.

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