DemaConsulting.SpdxTool 3.0.0-beta.2

Prefix Reserved
This is a prerelease version of DemaConsulting.SpdxTool.
dotnet tool install --global DemaConsulting.SpdxTool --version 3.0.0-beta.2
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local DemaConsulting.SpdxTool --version 3.0.0-beta.2
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=DemaConsulting.SpdxTool&version=3.0.0-beta.2&prerelease
                    
nuke :add-package DemaConsulting.SpdxTool --version 3.0.0-beta.2
                    

SpdxTool: SPDX SBOM editing from the CLI or MSBuild

GitHub forks GitHub Repo stars GitHub contributors GitHub Build Quality Gate Status Security Rating NuGet Version

Overview

DemaConsulting.SpdxTool is a .NET tool for creating, validating, and manipulating SPDX (Software Package Data Exchange) documents. The repository also contains DemaConsulting.SpdxTool.Targets, an MSBuild targets extension that integrates SPDX document decoration into the standard dotnet pack build workflow.

The workflow below shows how to use it: start from an SPDX SBOM and a workflow file, run SpdxTool from the command line, a CI pipeline, or dotnet pack, and use the updated SBOM, reports, and exit code as decorated packages, a quality gate, and compliance evidence.

SpdxTool workflow: start from an SPDX 2.x JSON SBOM, other SPDX documents, and workflow YAML files
(local or from a URL or NuGet package), run spdx-tool commands, run-workflow, or validate, or let the
SpdxTool.Targets package run a workflow during dotnet pack, get an updated SPDX document, a Markdown
summary, a Mermaid diagram, and a pass/fail exit code, then use them for decorated packages, a CI
quality gate, release documentation, and supply-chain compliance

Features

  • Create, validate, and manipulate SPDX (Software Package Data Exchange) documents from the command line.
  • Drive SBOM operations through workflow YAML files for repeatable, automated pipelines.
  • Self-validation system generates evidence of tool correctness for regulated environments.
  • MSBuild targets integration automatically decorates SBOMs during dotnet pack.
  • Multi-command CLI supporting add-package, validate, copy-package, to-markdown, diagram, and more.
  • Built-in help: spdx-tool help serves help topics and a card for every command, with runnable examples, search, and JSON output for AI agents.
  • Multi-framework support targeting .NET 10 and .NET 11.
  • Continuous compliance evidence generated automatically on every CI run.

Installation

The following will add SpdxTool to a .NET tool manifest file:

dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local DemaConsulting.SpdxTool

The tool can then be executed by:

dotnet spdx-tool <arguments>

Usage

Validate an SPDX document:

dotnet spdx-tool validate sbom.spdx.json

Run a workflow file:

dotnet spdx-tool run-workflow spdx-workflow.yaml

List the built-in help topics, then read the card of a command:

dotnet spdx-tool help
dotnet spdx-tool help validate

Full command reference:

Usage: spdx-tool [options] <command> [arguments]
       spdx-tool help [topic]

Options:
  -h, -?, --help                           Show this help message and exit
  -v, --version                            Show version information and exit
  -l, --log <log-file>                     Log output to file
  -s, --silent                             Silence console output
      --validate                           Perform self-validation
  -r, --result <file>                      Self-validation result file (.trx TRX or .xml JUnit XML)
      --depth <level>                      Self-validation report depth level

Commands:
  help                                     Display extended help about a command (workflow only).
  add-package                              Add package to SPDX document (workflow only).
  add-relationship <spdx.json> <args>      Add relationship between elements.
  copy-package <spdx.json> <args>          Copy package between SPDX documents.
  diagram <spdx.json> <mermaid.txt> [tools] Generate mermaid diagram.
  find-package <spdx.json> <criteria>      Find package ID in SPDX document
  get-version <spdx.json> <criteria>       Get the version of an SPDX package.
  hash <operation> <algorithm> <file>      Generate or verify hashes of files
  print <text>                             Print text to the console
  query <pattern> <program> [args]         Query program output for value
  rename-id <arguments>                    Rename an element ID in an SPDX document.
  run-workflow <workflow.yaml>             Runs the workflow file/url
  set-variable                             Set workflow variable (workflow only).
  to-markdown <spdx.json> <out.md> [args]  Create Markdown summary for SPDX document
  update-package                           Update package in SPDX document (workflow only).
  validate <spdx.json> [ntia]              Validate SPDX document for issues

Run 'spdx-tool help' for topics and examples.

Building

pwsh ./build.ps1 -All

User Guide

The SpdxTool User Guide is available on the SpdxTool releases page.

Contributing

See CONTRIBUTING.md for guidelines on setting up your development environment, coding standards, running tests, and submitting pull requests.

Before contributing, please read our Code of Conduct.

License

This project is licensed under the MIT License — see LICENSE for details.

By contributing to this project, you agree that your contributions will be licensed under the MIT License.

Support

Workflow YAML Files

The SpdxTool can be driven using workflow YAML files of the following format:

# Workflow parameters
parameters:
  parameter-name: value

# Workflow steps
steps:
  - command: <command-name>
    inputs:
      <arguments mapping>

  - command: <command-name>
    inputs:
      input1: value
      input2: ${{ parameter-name }}

Self Validation

Running self-validation produces a report containing the following information:

# DemaConsulting.SpdxTool

| Information         | Value                                              |
| :------------------ | :------------------------------------------------- |
| SpdxTool Version    | <version>                                          |
| Machine Name        | <machine-name>                                     |
| OS Version          | <os-version>                                       |
| DotNet Runtime      | <dotnet-runtime-version>                           |
| Time Stamp          | <timestamp>                                        |

✓ SpdxTool_AddPackage - Passed
✓ SpdxTool_AddRelationship - Passed
✓ SpdxTool_Basic - Passed
✓ SpdxTool_CopyPackage - Passed
✓ SpdxTool_Diagram - Passed
✓ SpdxTool_FindPackage - Passed
✓ SpdxTool_GetVersion - Passed
✓ SpdxTool_Hash - Passed
✓ SpdxTool_Ntia - Passed
✓ SpdxTool_Query - Passed
✓ SpdxTool_RenameId - Passed
✓ SpdxTool_RunNuGetWorkflow - Passed
✓ SpdxTool_ToMarkdown - Passed
✓ SpdxTool_UpdatePackage - Passed

Total Tests: 14
Passed: 14
Failed: 0

Validation Passed

Each test in the report proves a specific command works correctly:

  • SpdxTool_AddPackage - add-package command adds a package with relationships to an SPDX file.
  • SpdxTool_AddRelationship - add-relationship command adds a relationship between SPDX elements.
  • SpdxTool_Basic - validate command accepts valid and rejects invalid SPDX files.
  • SpdxTool_CopyPackage - copy-package command copies a package with relationships between SPDX files.
  • SpdxTool_Diagram - diagram command generates a Mermaid diagram from an SPDX file.
  • SpdxTool_FindPackage - find-package command locates a package by name in an SPDX file.
  • SpdxTool_GetVersion - get-version command retrieves a package version from an SPDX file.
  • SpdxTool_Hash - hash command generates and verifies file hashes.
  • SpdxTool_Ntia - validate command enforces NTIA minimum SBOM element requirements.
  • SpdxTool_Query - query command extracts values from program output.
  • SpdxTool_RenameId - rename-id command renames an element identifier throughout an SPDX file.
  • SpdxTool_RunNuGetWorkflow - run-workflow command executes a workflow from a NuGet package.
  • SpdxTool_ToMarkdown - to-markdown command generates a Markdown summary from an SPDX file.
  • SpdxTool_UpdatePackage - update-package command updates all fields of a package in an SPDX file.

On validation failure the tool will exit with a non-zero exit code.

This report may be useful in regulated industries requiring evidence of tool validation.

Project Quality

This project maintains high code quality standards:

  • ✓ Comprehensive unit test coverage
  • ✓ Static code analysis with multiple analyzers
  • ✓ Continuous integration with SonarCloud
  • ✓ Self-validation system for tool correctness
  • ✓ Warnings treated as errors
  • ✓ EditorConfig for consistent code style
  • ✓ Continuous Compliance: Compliance evidence generated automatically on every CI run, following the Continuous Compliance methodology

Additional Information

Additional information can be found at:

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
3.0.0-beta.2 58 11/26/2026
3.0.0-beta.1 68 11/13/2026
2.10.1 2,835 10/5/2026
2.10.0 7,569 4/6/2026
2.9.0 2,098 3/2/2026
2.8.0 466 2/25/2026
2.7.0 350 2/20/2026
2.6.0 2,884 12/15/2025
2.5.1 700 12/9/2025
2.5.0 469 12/4/2025
2.4.0 383 7/6/2025
2.3.0 3,067 5/4/2025
2.2.1 297 5/4/2025
2.2.0 478 12/1/2024
2.1.1 285 10/9/2024
2.1.0 243 10/3/2024
2.0.0 265 9/13/2024
1.4.1 274 9/13/2024
1.4.0 274 7/29/2024
1.3.2 200 7/24/2024
Loading failed