Skip to content

feat(project): add standalone project sbom command#1246

Open
RoboShyim (roboshyim) wants to merge 2 commits into
shopware:mainfrom
roboshyim:feat/project-sbom-command
Open

feat(project): add standalone project sbom command#1246
RoboShyim (roboshyim) wants to merge 2 commits into
shopware:mainfrom
roboshyim:feat/project-sbom-command

Conversation

@roboshyim

Copy link
Copy Markdown
Contributor

What changed?

Adds shopware-cli project sbom so developers can generate the same CycloneDX 1.7 SBOM that project ci already produces, without running the full CI build.

shopware-cli project sbom
shopware-cli project sbom ./my-shop \
  --format cyclonedx-json \
  --output sbom.json

Flags:

  • --format — currently only cyclonedx-json (validated; clear error for anything else)
  • --output / -o — destination path (default: sbom.cdx.json in the project root, same as CI)
  • --include-dev-dependencies — optional; off by default to match CI

The shared generator lives in writeProjectSBOM. project ci still calls it with SkipMissingLock: true so a lock-less tree does not fail the build. The standalone command fails with a clear non-zero exit when composer.lock is missing.

Why?

Projects need on-demand SBOMs for security reviews, vulnerability scanning, compliance, and release artifacts. That capability was coupled to project ci only.

Implements #1239

How was this tested?

  • go test ./cmd/project/ -count=1 (pass)
  • go vet ./cmd/project/
  • Manual smoke:
    • with a minimal composer.lock → writes CycloneDX 1.7 JSON with expected components
    • without composer.lock → non-zero exit + clear error
    • project sbom --help documents usage

Related issue or discussion

Closes #1239

Expose the existing CycloneDX 1.7 SBOM generator used by project ci as
shopware-cli project sbom so merchants can produce the artifact without
running the full CI pipeline.

- Reuse writeProjectSBOM for both project ci and project sbom
- Keep CI skip-when-lock-missing behavior unchanged
- Fail with a clear non-zero exit when lock is missing for project sbom
- Flags: --format cyclonedx-json, --output/-o, --include-dev-dependencies
- Tests + README usage example

Closes shopware#1239
@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.78947% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.99%. Comparing base (6ee195f) to head (f215a0b).

Files with missing lines Patch % Lines
cmd/project/project_sbom.go 58.33% 11 Missing and 4 partials ⚠️
internal/shop/project_sbom.go 85.71% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1246      +/-   ##
==========================================
+ Coverage   52.94%   52.99%   +0.04%     
==========================================
  Files         300      302       +2     
  Lines       23152    23213      +61     
==========================================
+ Hits        12258    12301      +43     
- Misses      10894    10908      +14     
- Partials        0        4       +4     
Flag Coverage Δ
go-test 52.99% <75.78%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread cmd/project/ci.go
Address review feedback: keep cmd/project as cobra surface only and put
the shared CycloneDX generation logic in internal/shop so project ci and
project sbom both call shop.WriteProjectSBOM.
@shyim

Copy link
Copy Markdown
Member

RoboShyim (@roboshyim) can you open up an PR at shopware/docs to mention this new command

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.

Add a standalone project sbom command

3 participants