diff --git a/.github/workflows/build_on_push.yaml b/.github/workflows/build_on_push.yaml index 7f07772..5563bdb 100644 --- a/.github/workflows/build_on_push.yaml +++ b/.github/workflows/build_on_push.yaml @@ -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 }}' diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..8978606 --- /dev/null +++ b/AGENTS.md @@ -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 (`true`). +* 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. diff --git a/src/DemaConsulting.SpdxTool/DemaConsulting.SpdxTool.csproj b/src/DemaConsulting.SpdxTool/DemaConsulting.SpdxTool.csproj index 7c4d6ba..235ca06 100644 --- a/src/DemaConsulting.SpdxTool/DemaConsulting.SpdxTool.csproj +++ b/src/DemaConsulting.SpdxTool/DemaConsulting.SpdxTool.csproj @@ -6,6 +6,7 @@ 12 enable enable + true True DemaConsulting.SpdxTool SPDX Tool diff --git a/test/DemaConsulting.SpdxTool.Tests/TestAddPackage.cs b/test/DemaConsulting.SpdxTool.Tests/AddPackageTests.cs similarity index 99% rename from test/DemaConsulting.SpdxTool.Tests/TestAddPackage.cs rename to test/DemaConsulting.SpdxTool.Tests/AddPackageTests.cs index f01d18a..27c09a9 100644 --- a/test/DemaConsulting.SpdxTool.Tests/TestAddPackage.cs +++ b/test/DemaConsulting.SpdxTool.Tests/AddPackageTests.cs @@ -27,7 +27,7 @@ namespace DemaConsulting.SpdxTool.Tests; /// Tests for the 'add-package' command. /// [TestClass] -public class TestAddPackage +public class AddPackageTests { /// /// Test that the 'add-package' command is only valid in a workflow. diff --git a/test/DemaConsulting.SpdxTool.Tests/TestAddRelationship.cs b/test/DemaConsulting.SpdxTool.Tests/AddRelationshipTests.cs similarity index 99% rename from test/DemaConsulting.SpdxTool.Tests/TestAddRelationship.cs rename to test/DemaConsulting.SpdxTool.Tests/AddRelationshipTests.cs index 163e170..257ce2b 100644 --- a/test/DemaConsulting.SpdxTool.Tests/TestAddRelationship.cs +++ b/test/DemaConsulting.SpdxTool.Tests/AddRelationshipTests.cs @@ -27,7 +27,7 @@ namespace DemaConsulting.SpdxTool.Tests; /// Tests for the 'add-relationship' command /// [TestClass] -public class TestAddRelationship +public class AddRelationshipTests { /// /// SPDX file for finding packages diff --git a/test/DemaConsulting.SpdxTool.Tests/AssemblyInfo.cs b/test/DemaConsulting.SpdxTool.Tests/AssemblyInfo.cs new file mode 100644 index 0000000..0b05115 --- /dev/null +++ b/test/DemaConsulting.SpdxTool.Tests/AssemblyInfo.cs @@ -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] diff --git a/test/DemaConsulting.SpdxTool.Tests/TestCommand.cs b/test/DemaConsulting.SpdxTool.Tests/CommandTests.cs similarity index 99% rename from test/DemaConsulting.SpdxTool.Tests/TestCommand.cs rename to test/DemaConsulting.SpdxTool.Tests/CommandTests.cs index 06a058e..62d833c 100644 --- a/test/DemaConsulting.SpdxTool.Tests/TestCommand.cs +++ b/test/DemaConsulting.SpdxTool.Tests/CommandTests.cs @@ -27,7 +27,7 @@ namespace DemaConsulting.SpdxTool.Tests; /// Tests for the class. /// [TestClass] -public class TestCommand +public class CommandTests { /// /// Test the method with a missing variable. diff --git a/test/DemaConsulting.SpdxTool.Tests/TestCopyPackage.cs b/test/DemaConsulting.SpdxTool.Tests/CopyPackageTests.cs similarity index 99% rename from test/DemaConsulting.SpdxTool.Tests/TestCopyPackage.cs rename to test/DemaConsulting.SpdxTool.Tests/CopyPackageTests.cs index 0ce507f..f6eada4 100644 --- a/test/DemaConsulting.SpdxTool.Tests/TestCopyPackage.cs +++ b/test/DemaConsulting.SpdxTool.Tests/CopyPackageTests.cs @@ -27,7 +27,7 @@ namespace DemaConsulting.SpdxTool.Tests; /// Tests for the 'copy-package' command. /// [TestClass] -public class TestCopyPackage +public class CopyPackageTests { /// /// Test the 'copy-package' command with missing arguments. diff --git a/test/DemaConsulting.SpdxTool.Tests/DemaConsulting.SpdxTool.Tests.csproj b/test/DemaConsulting.SpdxTool.Tests/DemaConsulting.SpdxTool.Tests.csproj index c55d290..439ce2e 100644 --- a/test/DemaConsulting.SpdxTool.Tests/DemaConsulting.SpdxTool.Tests.csproj +++ b/test/DemaConsulting.SpdxTool.Tests/DemaConsulting.SpdxTool.Tests.csproj @@ -5,6 +5,7 @@ 12 enable enable + true false true diff --git a/test/DemaConsulting.SpdxTool.Tests/TestFindPackage.cs b/test/DemaConsulting.SpdxTool.Tests/FindPackageTests.cs similarity index 99% rename from test/DemaConsulting.SpdxTool.Tests/TestFindPackage.cs rename to test/DemaConsulting.SpdxTool.Tests/FindPackageTests.cs index 66b8483..b739450 100644 --- a/test/DemaConsulting.SpdxTool.Tests/TestFindPackage.cs +++ b/test/DemaConsulting.SpdxTool.Tests/FindPackageTests.cs @@ -24,7 +24,7 @@ namespace DemaConsulting.SpdxTool.Tests; /// Tests for the 'find-package' command /// [TestClass] -public class TestFindPackage +public class FindPackageTests { /// /// SPDX file for finding packages diff --git a/test/DemaConsulting.SpdxTool.Tests/TestGetVersion.cs b/test/DemaConsulting.SpdxTool.Tests/GetVersionTests.cs similarity index 99% rename from test/DemaConsulting.SpdxTool.Tests/TestGetVersion.cs rename to test/DemaConsulting.SpdxTool.Tests/GetVersionTests.cs index 1ca82d6..afe0813 100644 --- a/test/DemaConsulting.SpdxTool.Tests/TestGetVersion.cs +++ b/test/DemaConsulting.SpdxTool.Tests/GetVersionTests.cs @@ -24,7 +24,7 @@ namespace DemaConsulting.SpdxTool.Tests; /// Tests for the 'get-version' command /// [TestClass] -public class TestGetVersion +public class GetVersionTests { /// /// SPDX file for finding packages diff --git a/test/DemaConsulting.SpdxTool.Tests/TestHash.cs b/test/DemaConsulting.SpdxTool.Tests/HashTests.cs similarity index 99% rename from test/DemaConsulting.SpdxTool.Tests/TestHash.cs rename to test/DemaConsulting.SpdxTool.Tests/HashTests.cs index 1eadf67..8cc414f 100644 --- a/test/DemaConsulting.SpdxTool.Tests/TestHash.cs +++ b/test/DemaConsulting.SpdxTool.Tests/HashTests.cs @@ -24,7 +24,7 @@ namespace DemaConsulting.SpdxTool.Tests; /// Tests for the 'hash' command /// [TestClass] -public class TestHash +public class HashTests { /// /// Tests the 'hash' command with missing arguments diff --git a/test/DemaConsulting.SpdxTool.Tests/TestHelp.cs b/test/DemaConsulting.SpdxTool.Tests/HelpTests.cs similarity index 99% rename from test/DemaConsulting.SpdxTool.Tests/TestHelp.cs rename to test/DemaConsulting.SpdxTool.Tests/HelpTests.cs index 7ae9361..7ead01f 100644 --- a/test/DemaConsulting.SpdxTool.Tests/TestHelp.cs +++ b/test/DemaConsulting.SpdxTool.Tests/HelpTests.cs @@ -24,7 +24,7 @@ namespace DemaConsulting.SpdxTool.Tests; /// Tests for the 'help' command /// [TestClass] -public class TestHelp +public class HelpTests { /// /// Tests the 'help' command with missing arguments diff --git a/test/DemaConsulting.SpdxTool.Tests/TestLog.cs b/test/DemaConsulting.SpdxTool.Tests/LogTests.cs similarity index 99% rename from test/DemaConsulting.SpdxTool.Tests/TestLog.cs rename to test/DemaConsulting.SpdxTool.Tests/LogTests.cs index e302bf1..ae368b0 100644 --- a/test/DemaConsulting.SpdxTool.Tests/TestLog.cs +++ b/test/DemaConsulting.SpdxTool.Tests/LogTests.cs @@ -24,7 +24,7 @@ namespace DemaConsulting.SpdxTool.Tests; /// Tests for logging output. /// [TestClass] -public class TestLog +public class LogTests { /// /// Test that logging functions when '-l' is specified diff --git a/test/DemaConsulting.SpdxTool.Tests/TestPrint.cs b/test/DemaConsulting.SpdxTool.Tests/PrintTests.cs similarity index 99% rename from test/DemaConsulting.SpdxTool.Tests/TestPrint.cs rename to test/DemaConsulting.SpdxTool.Tests/PrintTests.cs index ec1c355..23f3fbb 100644 --- a/test/DemaConsulting.SpdxTool.Tests/TestPrint.cs +++ b/test/DemaConsulting.SpdxTool.Tests/PrintTests.cs @@ -24,7 +24,7 @@ namespace DemaConsulting.SpdxTool.Tests; /// Tests for the 'print' command /// [TestClass] -public class TestPrint +public class PrintTests { /// /// Tests the 'print' command from the command line diff --git a/test/DemaConsulting.SpdxTool.Tests/TestQuery.cs b/test/DemaConsulting.SpdxTool.Tests/QueryTests.cs similarity index 99% rename from test/DemaConsulting.SpdxTool.Tests/TestQuery.cs rename to test/DemaConsulting.SpdxTool.Tests/QueryTests.cs index 40c89fb..839a7a4 100644 --- a/test/DemaConsulting.SpdxTool.Tests/TestQuery.cs +++ b/test/DemaConsulting.SpdxTool.Tests/QueryTests.cs @@ -26,7 +26,7 @@ namespace DemaConsulting.SpdxTool.Tests; /// Tests for the 'query' command /// [TestClass] -public partial class TestQuery +public partial class QueryTests { /// /// Regular expression to check for version diff --git a/test/DemaConsulting.SpdxTool.Tests/TestRenameId.cs b/test/DemaConsulting.SpdxTool.Tests/RenameIdTests.cs similarity index 99% rename from test/DemaConsulting.SpdxTool.Tests/TestRenameId.cs rename to test/DemaConsulting.SpdxTool.Tests/RenameIdTests.cs index 2e1f584..cfb4e8c 100644 --- a/test/DemaConsulting.SpdxTool.Tests/TestRenameId.cs +++ b/test/DemaConsulting.SpdxTool.Tests/RenameIdTests.cs @@ -26,7 +26,7 @@ namespace DemaConsulting.SpdxTool.Tests; /// Tests for the 'rename-id' command. /// [TestClass] -public class TestRenameId +public class RenameIdTests { /// /// Test the 'rename-id' command with missing arguments. diff --git a/test/DemaConsulting.SpdxTool.Tests/TestRunWorkflow.cs b/test/DemaConsulting.SpdxTool.Tests/RunWorkflowTests.cs similarity index 99% rename from test/DemaConsulting.SpdxTool.Tests/TestRunWorkflow.cs rename to test/DemaConsulting.SpdxTool.Tests/RunWorkflowTests.cs index ae6bff6..ae6071d 100644 --- a/test/DemaConsulting.SpdxTool.Tests/TestRunWorkflow.cs +++ b/test/DemaConsulting.SpdxTool.Tests/RunWorkflowTests.cs @@ -26,7 +26,7 @@ namespace DemaConsulting.SpdxTool.Tests; /// Tests for the 'run-workflow' command. /// [TestClass] -public partial class TestRunWorkflow +public partial class RunWorkflowTests { /// /// Regular expression to check for dotnet version diff --git a/test/DemaConsulting.SpdxTool.Tests/TestSelfValidation.cs b/test/DemaConsulting.SpdxTool.Tests/SelfValidationTests.cs similarity index 99% rename from test/DemaConsulting.SpdxTool.Tests/TestSelfValidation.cs rename to test/DemaConsulting.SpdxTool.Tests/SelfValidationTests.cs index 612be55..37d04b1 100644 --- a/test/DemaConsulting.SpdxTool.Tests/TestSelfValidation.cs +++ b/test/DemaConsulting.SpdxTool.Tests/SelfValidationTests.cs @@ -24,7 +24,7 @@ namespace DemaConsulting.SpdxTool.Tests; /// Tests for the self-validation feature. /// [TestClass] -public class TestSelfValidation +public class SelfValidationTests { /// /// Test that the self-validation command succeeds. diff --git a/test/DemaConsulting.SpdxTool.Tests/TestSetVariable.cs b/test/DemaConsulting.SpdxTool.Tests/SetVariableTests.cs similarity index 99% rename from test/DemaConsulting.SpdxTool.Tests/TestSetVariable.cs rename to test/DemaConsulting.SpdxTool.Tests/SetVariableTests.cs index c1d9507..269e7e2 100644 --- a/test/DemaConsulting.SpdxTool.Tests/TestSetVariable.cs +++ b/test/DemaConsulting.SpdxTool.Tests/SetVariableTests.cs @@ -24,7 +24,7 @@ namespace DemaConsulting.SpdxTool.Tests; /// Tests for the 'set-variable' command. /// [TestClass] -public class TestSetVariable +public class SetVariableTests { /// /// Test the 'set-variable' command does not work from the command line. diff --git a/test/DemaConsulting.SpdxTool.Tests/TestSilent.cs b/test/DemaConsulting.SpdxTool.Tests/SilentTests.cs similarity index 98% rename from test/DemaConsulting.SpdxTool.Tests/TestSilent.cs rename to test/DemaConsulting.SpdxTool.Tests/SilentTests.cs index 678676c..68ec760 100644 --- a/test/DemaConsulting.SpdxTool.Tests/TestSilent.cs +++ b/test/DemaConsulting.SpdxTool.Tests/SilentTests.cs @@ -24,7 +24,7 @@ namespace DemaConsulting.SpdxTool.Tests; /// Tests for silencing output. /// [TestClass] -public class TestSilent +public class SilentTests { /// /// Test that silence functions when '-s' is specified diff --git a/test/DemaConsulting.SpdxTool.Tests/TestToMarkdown.cs b/test/DemaConsulting.SpdxTool.Tests/ToMarkdownTests.cs similarity index 99% rename from test/DemaConsulting.SpdxTool.Tests/TestToMarkdown.cs rename to test/DemaConsulting.SpdxTool.Tests/ToMarkdownTests.cs index 7e3483c..d1a6205 100644 --- a/test/DemaConsulting.SpdxTool.Tests/TestToMarkdown.cs +++ b/test/DemaConsulting.SpdxTool.Tests/ToMarkdownTests.cs @@ -24,7 +24,7 @@ namespace DemaConsulting.SpdxTool.Tests; /// Tests for the 'to-markdown' command. /// [TestClass] -public class TestToMarkdown +public class ToMarkdownTests { /// /// Test the 'to-markdown' command with missing arguments. diff --git a/test/DemaConsulting.SpdxTool.Tests/TestUnknownCommand.cs b/test/DemaConsulting.SpdxTool.Tests/UnknownCommandTests.cs similarity index 98% rename from test/DemaConsulting.SpdxTool.Tests/TestUnknownCommand.cs rename to test/DemaConsulting.SpdxTool.Tests/UnknownCommandTests.cs index 3ebd52b..fbb7b46 100644 --- a/test/DemaConsulting.SpdxTool.Tests/TestUnknownCommand.cs +++ b/test/DemaConsulting.SpdxTool.Tests/UnknownCommandTests.cs @@ -24,7 +24,7 @@ namespace DemaConsulting.SpdxTool.Tests; /// Tests for unknown command handling. /// [TestClass] -public class TestUnknownCommand +public class UnknownCommandTests { /// /// Test unknown commands are reported. diff --git a/test/DemaConsulting.SpdxTool.Tests/TestUpdatePackage.cs b/test/DemaConsulting.SpdxTool.Tests/UpdatePackageTests.cs similarity index 99% rename from test/DemaConsulting.SpdxTool.Tests/TestUpdatePackage.cs rename to test/DemaConsulting.SpdxTool.Tests/UpdatePackageTests.cs index 16088b1..c4861b9 100644 --- a/test/DemaConsulting.SpdxTool.Tests/TestUpdatePackage.cs +++ b/test/DemaConsulting.SpdxTool.Tests/UpdatePackageTests.cs @@ -26,7 +26,7 @@ namespace DemaConsulting.SpdxTool.Tests; /// Tests for the 'update-package' command. /// [TestClass] -public class TestUpdatePackage +public class UpdatePackageTests { /// /// Test the 'update-package' command does not work from the command line. diff --git a/test/DemaConsulting.SpdxTool.Tests/TestUsage.cs b/test/DemaConsulting.SpdxTool.Tests/UsageTests.cs similarity index 99% rename from test/DemaConsulting.SpdxTool.Tests/TestUsage.cs rename to test/DemaConsulting.SpdxTool.Tests/UsageTests.cs index de97612..548bd7b 100644 --- a/test/DemaConsulting.SpdxTool.Tests/TestUsage.cs +++ b/test/DemaConsulting.SpdxTool.Tests/UsageTests.cs @@ -24,7 +24,7 @@ namespace DemaConsulting.SpdxTool.Tests; /// Tests for usage information. /// [TestClass] -public class TestUsage +public class UsageTests { /// /// Test that usage information is printed when no command line arguments are specified diff --git a/test/DemaConsulting.SpdxTool.Tests/TestVersion.cs b/test/DemaConsulting.SpdxTool.Tests/VersionTests.cs similarity index 98% rename from test/DemaConsulting.SpdxTool.Tests/TestVersion.cs rename to test/DemaConsulting.SpdxTool.Tests/VersionTests.cs index af35d33..1fd0cc1 100644 --- a/test/DemaConsulting.SpdxTool.Tests/TestVersion.cs +++ b/test/DemaConsulting.SpdxTool.Tests/VersionTests.cs @@ -26,7 +26,7 @@ namespace DemaConsulting.SpdxTool.Tests; /// Tests for version information. /// [TestClass] -public partial class TestVersion +public partial class VersionTests { /// /// Regular expression to check for version diff --git a/test/DemaConsulting.SpdxTool.Tests/TestWildcard.cs b/test/DemaConsulting.SpdxTool.Tests/WildcardTests.cs similarity index 99% rename from test/DemaConsulting.SpdxTool.Tests/TestWildcard.cs rename to test/DemaConsulting.SpdxTool.Tests/WildcardTests.cs index 5ba5c60..889caec 100644 --- a/test/DemaConsulting.SpdxTool.Tests/TestWildcard.cs +++ b/test/DemaConsulting.SpdxTool.Tests/WildcardTests.cs @@ -26,7 +26,7 @@ namespace DemaConsulting.SpdxTool.Tests; /// Test for wildcard pattern matching /// [TestClass] -public class TestWildcard +public class WildcardTests { /// /// Test for exact matching