Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d2c9006
feat!: dotnet 10 migration
Jan 29, 2026
55b4a90
chore(core): bump core System.CommandLine to 2.0.2
Feb 5, 2026
fc46e22
chore(cmf-cli): bump cmf-cli System.CommandLine to 2.0.2
Feb 5, 2026
e4bb4a3
chore(tests): bump cmf-cli System.CommandLine to 2.0.2
Feb 5, 2026
fbbfc4a
chore: removing support for datapackage v1 (#656)
Skidz0r Mar 2, 2026
11b7918
chore: system commandline migrations
Mar 20, 2026
7c198df
chore!: disable OSX builds in release workflow
m-s- Mar 26, 2026
2be100c
feat!: remove mes v8 and v9 support
Mar 11, 2026
3ff3c19
test: add Invoke method for single string argument in CommandWrapper
Mar 26, 2026
69c5c8c
chore(devcontainer): minor improvements
Mar 26, 2026
1994821
chore(agents): add cmf-cli-dotnet agent and dotnet best practices skill
Mar 26, 2026
acce2ce
chore(help): remove v10 metadata support and related files
joaoopereira Mar 30, 2026
1c8a9dc
test: update Bump tests to use new metadata structure and versioning
joaoopereira Mar 30, 2026
2fde74e
chore(devcontainer): add SYS_PTRACE capability to CLI devcontainer
joaoopereira Mar 30, 2026
1b91478
chore: migration left-overs
joaoopereira Apr 14, 2026
96575a1
test: add manual mock for http-proxy-agent to support Jest testing
joaoopereira Apr 14, 2026
0008eb4
chore: solve rebase conflicts
joaoopereira Apr 14, 2026
04516f6
chore: update dependencies for improved performance and security
joaoopereira Apr 14, 2026
b874e11
build: update CI workflow to trigger on development branch only
joaoopereira Apr 16, 2026
9a9df3f
chore: add missing dotnet6
joaoopereira May 4, 2026
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
74 changes: 44 additions & 30 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,49 @@
{
"name": "CLI devcontainer",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
"features": {
"ghcr.io/devcontainers/features/dotnet": {
"version": "10.0",
"additionalVersions": ["8.0"]
},
"ghcr.io/devcontainers/features/node": {
"version": "12"
},
"ghcr.io/devcontainers/features/github-cli": {},
"ghcr.io/nils-geistmann/devcontainers-features/zsh": {
"plugins": "git dotnet node npm"
}
"name": "CLI devcontainer",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
"capAdd": ["SYS_PTRACE"],
"features": {
"ghcr.io/devcontainers/features/dotnet": {
"version": "10.0",
"additionalVersions": ["6.0", "8.0"]
},
"customizations": {
"vscode": {
"extensions": [
"ms-dotnettools.csdevkit",
"mhutchie.git-graph",
"actboy168.tasks",
"esbenp.prettier-vscode",
"EditorConfig.EditorConfig",
"redhat.vscode-yaml",
"davidanson.vscode-markdownlint",
"github.vscode-github-actions"
]
}
"ghcr.io/devcontainers/features/node": {
"version": "18",
"additionalVersions": ["20"]
},
"containerEnv": {
"NPM_CONFIG_MIN_RELEASE_AGE": "3"
"ghcr.io/devcontainers/features/github-cli": {},
"ghcr.io/nils-geistmann/devcontainers-features/zsh": {
"plugins": "git dotnet node npm dotenv"
},
"postCreateCommand": "npm ci && echo \"alias 'cmf=/workspaces/cli/cmf-cli/bin/Debug/cmf'\" >> /home/$USER/.bashrc"
"ghcr.io/stuartleeks/dev-container-features/shell-history": {}
},
"customizations": {
"vscode": {
"extensions": [
"ms-dotnettools.csdevkit",
"mhutchie.git-graph",
"actboy168.tasks",
"esbenp.prettier-vscode",
"EditorConfig.EditorConfig",
"redhat.vscode-yaml",
"davidanson.vscode-markdownlint",
"github.vscode-github-actions",
"FullStackSpider.visual-nuget"
]
},
"settings": {
"dotnet.solution.autoOpen": "src/cmf-cli.slnx",
"csharp.experimental.debug.hotReload": true,
"editor.formatOnSave": true,
"editor.rulers": [120],
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true
}
},
"containerEnv": {
"DOTNET_CLI_TELEMETRY_OPTOUT": "1",
"NPM_CONFIG_MIN_RELEASE_AGE": "3",
"ZSH_DOTENV_PROMPT": "false"
},
"postCreateCommand": "npm ci && echo \"alias 'cmf=/workspaces/cli/cmf-cli/bin/Debug/cmf'\" >> /home/$USER/.bashrc"
}
79 changes: 79 additions & 0 deletions .github/agents/cmf-cli-dotnet.agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
name: cmf-cli-dotnet
description: .NET/C# developer for the cmf-cli repository. Use this agent when implementing CLI commands, fixing C# bugs, writing tests, or refactoring code in core/, cmf-cli/, features/, or tests/.
tools:
- codebase
- editFiles
- fetch
- findTestFiles
- problems
- runCommands
- runTasks
- runTests
- search
- usages
---

You are a senior .NET/C# developer working exclusively on the **Critical Manufacturing CLI** (`cmf-cli` repository).

## Repository Layout

- `core/` – shared CLI infrastructure (base commands, utilities, services, constants)
- `cmf-cli/` – main executable (commands, handlers, builders, factories)
- `features/` – CLI feature implementations (src + test sub-folders)
- `tests/` – automated tests (MSTest + FluentAssertions + Moq)
- `docs/` – documentation (update when behaviour changes)

Always explore the relevant folder before modifying code. Prefer existing abstractions in `core/` over creating new ones.

## Skills

Apply the **dotnet-best-practices** skill for all C# code you write or review.

## C# Conventions

- Follow existing namespace structure: `Cmf.CLI.{Feature}` or `Cmf.Common.CLI.{Area}`
- Use primary constructor syntax for dependency injection
- Use async/await for I/O and long-running tasks; return `Task` or `Task<T>`
- Use `ResourceManager` for user-facing strings (see `CliMessages.resx` / `CoreMessages.resx`)
- Keep methods small and focused; avoid large classes
- Prefer `ArgumentNullException.ThrowIfNull` for guard clauses

## CLI Command Design

Every command must have:
- A clear `[CmfCommand]` attribute with description, examples, and parent binding
- Input argument/option validation with helpful error messages
- A corresponding test in `tests/Specs/`

Follow the pattern in existing commands under `cmf-cli/Commands/`.

## Testing Rules

- Framework: **MSTest** with **FluentAssertions** assertions
- Pattern: **Arrange / Act / Assert**
- Mock dependencies with **Moq**
- Cover both success and failure scenarios, including null-argument validation
- Never break existing tests; update them when behaviour intentionally changes

## Safety Constraints

- Do NOT change licensing or publishing workflows
- Do NOT introduce breaking changes to existing CLI commands
- Do NOT remove commands without providing a migration path
- Do NOT add external NuGet dependencies without justification

## Build & Validate

Use the workspace **build** task (`dotnet build cmf-cli/cmf.csproj`) to verify changes compile.
Use the **runTests** tool or `dotnet test tests/tests.csproj` to validate test results.
Always check for compiler errors and warnings (`problems` tool) after editing.

## Commit Messages

Follow [Conventional Commits](https://www.conventionalcommits.org/):
- `feat(scope): description` for new features
- `fix(scope): description` for bug fixes
- `test(scope): description` for test additions
- `docs(scope): description` for documentation updates
- `refactor(scope): description` for refactors
85 changes: 85 additions & 0 deletions .github/agents/skills/dotnet-best-practices/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
name: dotnet-best-practices
description: 'Ensure .NET/C# code meets best practices for the solution/project.'
---

# .NET/C# Best Practices

Your task is to ensure .NET/C# code in ${selection} meets the best practices specific to this solution/project. This includes:

## Documentation & Structure

- Create comprehensive XML documentation comments for all public classes, interfaces, methods, and properties
- Include parameter descriptions and return value descriptions in XML comments
- Follow the established namespace structure: {Core|Console|App|Service}.{Feature}

## Design Patterns & Architecture

- Use primary constructor syntax for dependency injection (e.g., `public class MyClass(IDependency dependency)`)
- Implement the Command Handler pattern with generic base classes (e.g., `CommandHandler<TOptions>`)
- Use interface segregation with clear naming conventions (prefix interfaces with 'I')
- Follow the Factory pattern for complex object creation.

## Dependency Injection & Services

- Use constructor dependency injection with null checks via ArgumentNullException
- Register services with appropriate lifetimes (Singleton, Scoped, Transient)
- Use Microsoft.Extensions.DependencyInjection patterns
- Implement service interfaces for testability

## Resource Management & Localization

- Use ResourceManager for localized messages and error strings
- Separate LogMessages and ErrorMessages resource files
- Access resources via `_resourceManager.GetString("MessageKey")`

## Async/Await Patterns

- Use async/await for all I/O operations and long-running tasks
- Return Task or Task<T> from async methods
- Use ConfigureAwait(false) where appropriate
- Handle async exceptions properly

## Testing Standards

- Use MSTest framework with FluentAssertions for assertions
- Follow AAA pattern (Arrange, Act, Assert)
- Use Moq for mocking dependencies
- Test both success and failure scenarios
- Include null parameter validation tests

## Configuration & Settings

- Use strongly-typed configuration classes with data annotations
- Implement validation attributes (Required, NotEmptyOrWhitespace)
- Use IConfiguration binding for settings
- Support appsettings.json configuration files

## Semantic Kernel & AI Integration

- Use Microsoft.SemanticKernel for AI operations
- Implement proper kernel configuration and service registration
- Handle AI model settings (ChatCompletion, Embedding, etc.)
- Use structured output patterns for reliable AI responses

## Error Handling & Logging

- Use structured logging with Microsoft.Extensions.Logging
- Include scoped logging with meaningful context
- Throw specific exceptions with descriptive messages
- Use try-catch blocks for expected failure scenarios

## Performance & Security

- Use C# 12+ features and .NET 8 optimizations where applicable
- Implement proper input validation and sanitization
- Use parameterized queries for database operations
- Follow secure coding practices for AI/ML operations

## Code Quality

- Ensure SOLID principles compliance
- Avoid code duplication through base classes and utilities
- Use meaningful names that reflect domain concepts
- Keep methods focused and cohesive
- Implement proper disposal patterns for resources
17 changes: 8 additions & 9 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
workflow_dispatch:
push:
branches:
- main
- development
paths-ignore:
- 'features/**'
Expand All @@ -20,16 +19,16 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12, 18]
node-version: [18, 20]
steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
10.0.x

- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v4
Expand All @@ -40,13 +39,13 @@ jobs:
run: |
dotnet build --configuration Release

- name: Test (Node 12)
if: matrix.node-version == 12
run: dotnet test --configuration Release --no-build --no-restore --verbosity normal --filter "TestCategory!=Node18" --collect:"XPlat Code Coverage" --logger trx --results-directory TestResults

- name: Test (Node 18)
- name: Test ${{ matrix.node-version }}
if: matrix.node-version == 18
run: dotnet test --configuration Release --no-build --no-restore --verbosity normal --filter "TestCategory!=Node12" --collect:"XPlat Code Coverage" --logger trx --results-directory TestResults
run: dotnet test --configuration Release --no-build --no-restore --verbosity normal --filter "TestCategory!=Node20" --collect:"XPlat Code Coverage" --logger trx --results-directory TestResults

- name: Test ${{ matrix.node-version }}
if: matrix.node-version == 20
run: dotnet test --configuration Release --no-build --no-restore --verbosity normal --filter "TestCategory!=Node18" --collect:"XPlat Code Coverage" --logger trx --results-directory TestResults

- name: Merge Coverage Reports
run: |
Expand Down
15 changes: 2 additions & 13 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
registry-url: https://registry.npmjs.org/
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Install zip
dotnet-version: '10.0.x'
- name: install zip
uses: montudor/action-zip@v0.1.0
- run: npm ci
- run: npm run build:prod
Expand All @@ -32,9 +32,6 @@ jobs:
- name: Create artifact linux-x64
run: zip -X -r ../cmf-cli.linux-x64.zip .
working-directory: dist/linux-x64
- name: Create artifact osx-x64
run: zip -X -r ../cmf-cli.osx-x64.zip .
working-directory: dist/osx-x64
- name: Publish win-x64 to release
uses: JasonEtco/upload-to-release@master
with:
Expand All @@ -47,21 +44,13 @@ jobs:
args: dist/cmf-cli.linux-x64.zip application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish osx-x64 to release
uses: JasonEtco/upload-to-release@master
with:
args: dist/cmf-cli.osx-x64.zip application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get version from npm package
id: package-version
run: echo "version=$(node -p "require('./npm/package.json').version")" >> $GITHUB_OUTPUT
- name: Upload win-x64 to criticalmanufacturing.io
run: curl -v --user "${{secrets.CRITICALMANUFACTURING_IO_USER}}:${{secrets.CRITICALMANUFACTURING_IO_TOKEN}}" --upload-file dist/cmf-cli.win-x64.zip https://criticalmanufacturing.io/repository/tools/cmf-cli.win-x64-${{ steps.package-version.outputs.version }}.zip
- name: Upload linux-x64 to criticalmanufacturing.io
run: curl -v --user "${{secrets.CRITICALMANUFACTURING_IO_USER}}:${{secrets.CRITICALMANUFACTURING_IO_TOKEN}}" --upload-file dist/cmf-cli.linux-x64.zip https://criticalmanufacturing.io/repository/tools/cmf-cli.linux-x64-${{ steps.package-version.outputs.version }}.zip
- name: Upload osx-x64 to criticalmanufacturing.io
run: curl -v --user "${{secrets.CRITICALMANUFACTURING_IO_USER}}:${{secrets.CRITICALMANUFACTURING_IO_TOKEN}}" --upload-file dist/cmf-cli.osx-x64.zip https://criticalmanufacturing.io/repository/tools/cmf-cli.osx-x64-${{ steps.package-version.outputs.version }}.zip
- run: npm run publish
if: "github.event.release.prerelease"
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
10.0.x
- name: Setup node versions
uses: actions/setup-node@v4
with:
node-version: '12'
node-version: '18'
- name: Check NuGet minimum package age
run: npm run check:nuget:min-age
- name: Install dependencies
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -367,4 +367,6 @@ npm/*.tgz
#vendors
!**/vendors/**

.DS_Store
.DS_Store

.env
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ staged_files=$(git diff --cached --name-only)
# Check if any changes are in cmf-cli, core, or tests folders
if echo "$staged_files" | grep -qE "^(cmf-cli|core|tests)/"; then
echo "Changes detected in cmf-cli, core, or tests folders. Running tests..."
dotnet test --filter "(TestCategory!=LongRunning)&(TestCategory!=Node12)"
dotnet test --filter "(TestCategory!=LongRunning)"
else
echo "No changes in cmf-cli, core, or tests folders. Skipping tests."
fi
Loading
Loading