Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/build_on_push.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
---
name: Build

on: [push, workflow_dispatch]
on:
push: # On push to any branch
workflow_dispatch: # Allow manual trigger
schedule: # 5PM UTC every Monday
- cron: '0 17 * * 1'

env:
version: '0.0.0-run.${{ github.run_number }}'
Expand Down
72 changes: 72 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# AI Instructions for SpdxTool

This file provides specific context and instructions for AI coding agents to
interact effectively with this C# project.


## Project Overview

SpdxTool is a C# .NET tool for manipulating SPDX SBOM files.


## Technologies and Dependencies

* **Language**: C# 12
* **.NET Frameworks**: .NET 8, 9, and 10
* **Primary Dependencies**: [DemaConsulting.SpdxModel, YamlDotNet]


## Project Structure

The repository is organized as follows:

* `/.config/`: Contains the .NET Tool configuration.
* `/.github/workflows/`: Contains the CI/CD pipeline configurations.
* `/docs/`: Contains usage documentation.
* `/src/DemaConsulting.SpdxTool/`: Contains the library source code.
* `/test/DemaConsulting.SpdxTool.Tests/`: Contains the library unit tests.
* `/DemaConsulting.SpdxTool.sln`: The main Visual Studio solution file.


## Development Commands

Use these commands to perform common development tasks:

* **Restore DotNet Tools**:
```bash
dotnet tool restore
```

* **Build the Project**:
```bash
dotnet build
```

* **Run All Tests**:
```bash
dotnet test
```


## Testing Guidelines

* Tests are located under the `/test/DemaConsulting.SpdxTool.Tests/` folder and use the MSTest framework.
* Test files should end with `.cs` and adhere to the naming convention `[Component]Tests.cs`.
* All new features should be tested with comprehensive unit tests.
* The build must pass all tests and static analysis warnings before merging.
* Tests should be written using the AAA (Arrange, Act, Assert) pattern.


## Code Style and Conventions

* Follow standard C# naming conventions (PascalCase for classes/methods/properties, camelCase for local variables).
* Use nullable reference types (`#nullable enable`).
* Warnings are treated as errors (`<TreatWarningsAsErrors>true</TreatWarningsAsErrors>`).
* Avoid public fields; prefer properties.


## Boundaries and Guardrails

* **NEVER** modify files within the `/obj/` or `/bin/` directories.
* **NEVER** commit secrets, API keys, or sensitive configuration data.
* **ASK FIRST** before making significant architectural changes to the core library logic.
1 change: 1 addition & 0 deletions src/DemaConsulting.SpdxTool/DemaConsulting.SpdxTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<LangVersion>12</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<PackageId>DemaConsulting.SpdxTool</PackageId>
<Title>SPDX Tool</Title>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace DemaConsulting.SpdxTool.Tests;
/// Tests for the 'add-package' command.
/// </summary>
[TestClass]
public class TestAddPackage
public class AddPackageTests
{
/// <summary>
/// Test that the 'add-package' command is only valid in a workflow.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace DemaConsulting.SpdxTool.Tests;
/// Tests for the 'add-relationship' command
/// </summary>
[TestClass]
public class TestAddRelationship
public class AddRelationshipTests
{
/// <summary>
/// SPDX file for finding packages
Expand Down
23 changes: 23 additions & 0 deletions test/DemaConsulting.SpdxTool.Tests/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) 2024 DEMA Consulting
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

using Microsoft.VisualStudio.TestTools.UnitTesting;

[assembly: DoNotParallelize]
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace DemaConsulting.SpdxTool.Tests;
/// Tests for the <see cref="Command" /> class.
/// </summary>
[TestClass]
public class TestCommand
public class CommandTests
{
/// <summary>
/// Test the <see cref="Command.Expand" /> method with a missing variable.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace DemaConsulting.SpdxTool.Tests;
/// Tests for the 'copy-package' command.
/// </summary>
[TestClass]
public class TestCopyPackage
public class CopyPackageTests
{
/// <summary>
/// Test the 'copy-package' command with missing arguments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<LangVersion>12</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace DemaConsulting.SpdxTool.Tests;
/// Tests for the 'find-package' command
/// </summary>
[TestClass]
public class TestFindPackage
public class FindPackageTests
{
/// <summary>
/// SPDX file for finding packages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace DemaConsulting.SpdxTool.Tests;
/// Tests for the 'get-version' command
/// </summary>
[TestClass]
public class TestGetVersion
public class GetVersionTests
{
/// <summary>
/// SPDX file for finding packages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace DemaConsulting.SpdxTool.Tests;
/// Tests for the 'hash' command
/// </summary>
[TestClass]
public class TestHash
public class HashTests
{
/// <summary>
/// Tests the 'hash' command with missing arguments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace DemaConsulting.SpdxTool.Tests;
/// Tests for the 'help' command
/// </summary>
[TestClass]
public class TestHelp
public class HelpTests
{
/// <summary>
/// Tests the 'help' command with missing arguments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace DemaConsulting.SpdxTool.Tests;
/// Tests for logging output.
/// </summary>
[TestClass]
public class TestLog
public class LogTests
{
/// <summary>
/// Test that logging functions when '-l' is specified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace DemaConsulting.SpdxTool.Tests;
/// Tests for the 'print' command
/// </summary>
[TestClass]
public class TestPrint
public class PrintTests
{
/// <summary>
/// Tests the 'print' command from the command line
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace DemaConsulting.SpdxTool.Tests;
/// Tests for the 'query' command
/// </summary>
[TestClass]
public partial class TestQuery
public partial class QueryTests
{
/// <summary>
/// Regular expression to check for version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace DemaConsulting.SpdxTool.Tests;
/// Tests for the 'rename-id' command.
/// </summary>
[TestClass]
public class TestRenameId
public class RenameIdTests
{
/// <summary>
/// Test the 'rename-id' command with missing arguments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace DemaConsulting.SpdxTool.Tests;
/// Tests for the 'run-workflow' command.
/// </summary>
[TestClass]
public partial class TestRunWorkflow
public partial class RunWorkflowTests
{
/// <summary>
/// Regular expression to check for dotnet version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace DemaConsulting.SpdxTool.Tests;
/// Tests for the self-validation feature.
/// </summary>
[TestClass]
public class TestSelfValidation
public class SelfValidationTests
{
/// <summary>
/// Test that the self-validation command succeeds.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace DemaConsulting.SpdxTool.Tests;
/// Tests for the 'set-variable' command.
/// </summary>
[TestClass]
public class TestSetVariable
public class SetVariableTests
{
/// <summary>
/// Test the 'set-variable' command does not work from the command line.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace DemaConsulting.SpdxTool.Tests;
/// Tests for silencing output.
/// </summary>
[TestClass]
public class TestSilent
public class SilentTests
{
/// <summary>
/// Test that silence functions when '-s' is specified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace DemaConsulting.SpdxTool.Tests;
/// Tests for the 'to-markdown' command.
/// </summary>
[TestClass]
public class TestToMarkdown
public class ToMarkdownTests
{
/// <summary>
/// Test the 'to-markdown' command with missing arguments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace DemaConsulting.SpdxTool.Tests;
/// Tests for unknown command handling.
/// </summary>
[TestClass]
public class TestUnknownCommand
public class UnknownCommandTests
{
/// <summary>
/// Test unknown commands are reported.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace DemaConsulting.SpdxTool.Tests;
/// Tests for the 'update-package' command.
/// </summary>
[TestClass]
public class TestUpdatePackage
public class UpdatePackageTests
{
/// <summary>
/// Test the 'update-package' command does not work from the command line.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace DemaConsulting.SpdxTool.Tests;
/// Tests for usage information.
/// </summary>
[TestClass]
public class TestUsage
public class UsageTests
{
/// <summary>
/// Test that usage information is printed when no command line arguments are specified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace DemaConsulting.SpdxTool.Tests;
/// Tests for version information.
/// </summary>
[TestClass]
public partial class TestVersion
public partial class VersionTests
{
/// <summary>
/// Regular expression to check for version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace DemaConsulting.SpdxTool.Tests;
/// Test for wildcard pattern matching
/// </summary>
[TestClass]
public class TestWildcard
public class WildcardTests
{
/// <summary>
/// Test for exact matching
Expand Down