Skip to content

Commit c6e71e4

Browse files
committed
feat: add RuleSync .NET SDK
- Add RuleSync .NET SDK with full feature support - Add GitHub Actions workflow for .NET SDK CI/CD - Add JSON Schema support documentation - Fix: drop renamed/deleted skills from lockfile on re-fetch - Release v7.18.1 - Include local configuration updates
1 parent a09535c commit c6e71e4

20 files changed

+2214
-0
lines changed

.github/dependabot-dotnet.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "nuget"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
open-pull-requests-limit: 10
8+
labels:
9+
- "dependencies"
10+
commit-message:
11+
prefix: "chore"
12+
include: "scope"
13+
14+
- package-ecosystem: "github-actions"
15+
directory: "/"
16+
schedule:
17+
interval: "weekly"
18+
labels:
19+
- "dependencies"
20+
- "github-actions"

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,32 @@ jobs:
6363
test -f dist/index.cjs
6464
test -f dist/index.d.ts
6565
test -f dist/index.d.cts
66+
67+
dotnet-sdk:
68+
name: .NET SDK Build & Test
69+
runs-on: ubuntu-latest
70+
steps:
71+
- name: Checkout code
72+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
73+
74+
- name: Setup .NET
75+
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4
76+
with:
77+
dotnet-version: "8.0.x"
78+
79+
- name: Cache NuGet packages
80+
uses: actions/cache@d4323d4a2d73e8bdc6a9cce1f10cb6d643132eeb # v4.2.2
81+
with:
82+
path: ~/.nuget/packages
83+
key: ${{ runner.os }}-nuget-${{ hashFiles('sdk/dotnet/**/Directory.Packages.props') }}
84+
restore-keys: |
85+
${{ runner.os }}-nuget-
86+
87+
- name: Restore
88+
run: dotnet restore sdk/dotnet/RuleSync.Sdk.DotNet.sln
89+
90+
- name: Build
91+
run: dotnet build sdk/dotnet/RuleSync.Sdk.DotNet.sln --configuration Release --no-restore
92+
93+
- name: Test
94+
run: dotnet test sdk/dotnet/RuleSync.Sdk.DotNet.sln --configuration Release --no-build --verbosity normal

.github/workflows/publish-assets.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,23 @@ jobs:
7878
EVENT_NAME: ${{ github.event_name }}
7979
HEAD_REF: ${{ github.event.pull_request.head.ref }}
8080

81+
- name: Setup .NET
82+
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4
83+
with:
84+
dotnet-version: "8.0.x"
85+
86+
- name: Build .NET SDK
87+
run: |
88+
dotnet restore sdk/dotnet/RuleSync.Sdk.DotNet.sln
89+
dotnet build sdk/dotnet/RuleSync.Sdk.DotNet.sln --configuration Release --no-restore
90+
91+
- name: Pack .NET SDK
92+
env:
93+
RELEASE_TAG: ${{ steps.tag.outputs.tag }}
94+
run: |
95+
VERSION="${RELEASE_TAG#v}"
96+
dotnet pack sdk/dotnet/src/RuleSync.Sdk.DotNet/RuleSync.Sdk.DotNet.csproj --configuration Release --no-build --output ./nupkgs -p:Version="$VERSION"
97+
8198
- name: Upload assets to release
8299
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
83100
with:
@@ -94,3 +111,4 @@ jobs:
94111
repomix-toon.zip
95112
config-schema.json
96113
mcp-schema.json
114+
nupkgs/*.nupkg

.github/workflows/publish.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
permissions:
99
id-token: write # Required for OIDC
1010
contents: write # Required for checking out code and editing release state
11+
packages: write # Required for publishing to GitHub Packages
1112

1213
jobs:
1314
publish:
@@ -32,6 +33,29 @@ jobs:
3233
- name: Publish to npm
3334
run: pnpm publish
3435

36+
- name: Setup .NET
37+
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4
38+
with:
39+
dotnet-version: "8.0.x"
40+
41+
- name: Download NuGet package from release
42+
env:
43+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
45+
run: |
46+
TAG="${HEAD_BRANCH#release/}"
47+
mkdir -p nupkgs
48+
gh release download "$TAG" --pattern "*.nupkg" --dir nupkgs
49+
50+
- name: Publish to GitHub Packages
51+
env:
52+
GITHUB_ACTOR: ${{ github.actor }}
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
REPO_OWNER: ${{ github.repository_owner }}
55+
run: |
56+
dotnet nuget add source "https://nuget.pkg.github.com/${REPO_OWNER}/index.json" --name github --username "$GITHUB_ACTOR" --password "$GITHUB_TOKEN" --store-password-in-clear-text
57+
dotnet nuget push nupkgs/*.nupkg --source github --skip-duplicate
58+
3559
- name: Publish target draft release
3660
env:
3761
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

sdk/dotnet/.editorconfig

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
root = true
2+
3+
# All files
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 4
8+
end_of_line = lf
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
12+
# C# files
13+
[*.cs]
14+
# Indentation
15+
indent_size = 4
16+
tab_width = 4
17+
18+
# New lines
19+
csharp_new_line_before_open_brace = all
20+
csharp_new_line_before_else = true
21+
csharp_new_line_before_catch = true
22+
csharp_new_line_before_finally = true
23+
csharp_new_line_before_members_in_object_initializers = true
24+
csharp_new_line_before_members_in_anonymous_types = true
25+
csharp_new_line_between_query_expression_clauses = true
26+
27+
# Spaces
28+
csharp_space_after_cast = false
29+
csharp_space_after_keywords_in_control_flow_statements = true
30+
csharp_space_between_parentheses = false
31+
csharp_space_before_colon_in_inheritance_clause = true
32+
csharp_space_after_colon_in_inheritance_clause = true
33+
csharp_space_around_binary_operators = before_and_after
34+
csharp_space_between_method_declaration_parameter_list_parentheses = false
35+
csharp_space_between_method_call_parameter_list_parentheses = false
36+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
37+
38+
# Wrapping
39+
csharp_preserve_single_line_blocks = true
40+
csharp_preserve_single_line_statements = true
41+
42+
# Organize usings
43+
dotnet_sort_system_directives_first = true
44+
dotnet_separate_import_directive_groups = false
45+
46+
# Naming conventions
47+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
48+
dotnet_naming_style.camel_case_style.capitalization = camel_case
49+
50+
# Classes, structs, enums, delegates: PascalCase
51+
dotnet_naming_symbols.types.applicable_kinds = class, struct, enum, delegate, interface
52+
dotnet_naming_rule.types_naming.symbols = types
53+
dotnet_naming_rule.types_naming.style = pascal_case_style
54+
dotnet_naming_rule.types_naming.severity = suggestion
55+
56+
# Constants: PascalCase
57+
dotnet_naming_symbols.constants.applicable_kinds = field
58+
dotnet_naming_symbols.constants.applicable_accessibilities = *
59+
dotnet_naming_symbols.constants.required_modifiers = const
60+
dotnet_naming_rule.constants_naming.symbols = constants
61+
dotnet_naming_rule.constants_naming.style = pascal_case_style
62+
dotnet_naming_rule.constants_naming.severity = suggestion
63+
64+
# Static fields: PascalCase
65+
dotnet_naming_symbols.static_fields.applicable_kinds = field
66+
dotnet_naming_symbols.static_fields.applicable_accessibilities = *
67+
dotnet_naming_symbols.static_fields.required_modifiers = static
68+
dotnet_naming_rule.static_fields_naming.symbols = static_fields
69+
dotnet_naming_rule.static_fields_naming.style = pascal_case_style
70+
dotnet_naming_rule.static_fields_naming.severity = suggestion
71+
72+
# Instance fields: camelCase with underscore prefix
73+
dotnet_naming_style.instance_field_style.capitalization = camel_case
74+
net_naming_style.instance_field_style.required_prefix = _
75+
dotnet_naming_symbols.instance_fields.applicable_kinds = field
76+
dotnet_naming_symbols.instance_fields.applicable_accessibilities = private
77+
dotnet_naming_rule.instance_fields_naming.symbols = instance_fields
78+
dotnet_naming_rule.instance_fields_naming.style = instance_field_style
79+
dotnet_naming_rule.instance_fields_naming.severity = suggestion
80+
81+
# Parameters, locals: camelCase
82+
dotnet_naming_symbols.parameters_locals.applicable_kinds = parameter, local
83+
dotnet_naming_rule.parameters_locals_naming.symbols = parameters_locals
84+
dotnet_naming_rule.parameters_locals_naming.style = camel_case_style
85+
dotnet_naming_rule.parameters_locals_naming.severity = suggestion
86+
87+
# Expression-bodied members
88+
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
89+
csharp_style_expression_bodied_constructors = when_on_single_line:suggestion
90+
csharp_style_expression_bodied_operators = when_on_single_line:suggestion
91+
csharp_style_expression_bodied_properties = when_on_single_line:suggestion
92+
csharp_style_expression_bodied_indexers = when_on_single_line:suggestion
93+
csharp_style_expression_bodied_accessors = when_on_single_line:suggestion
94+
csharp_style_expression_bodied_lambdas = when_on_single_line:suggestion
95+
csharp_style_expression_bodied_local_functions = when_on_single_line:suggestion
96+
97+
# Pattern matching
98+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
99+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
100+
101+
# Var preferences
102+
csharp_style_var_for_built_in_types = true:suggestion
103+
csharp_style_var_when_type_is_apparent = true:suggestion
104+
csharp_style_var_elsewhere = true:suggestion
105+
106+
# Null checking
107+
csharp_style_throw_expression = true:suggestion
108+
csharp_style_conditional_delegate_call = true:suggestion
109+
110+
# Modifier preferences
111+
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
112+
csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:suggestion
113+
114+
# Parentheses preferences
115+
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion
116+
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion
117+
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
118+
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion
119+
120+
# Roslyn analyzer settings
121+
dotnet_diagnostic.CA1822.severity = suggestion # Mark members as static
122+
dotnet_diagnostic.CA2201.severity = none # Do not raise reserved exception types
123+
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary
124+
125+
# XML documentation
126+
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
127+
128+
# Project files
129+
[*.{csproj,props,targets}]
130+
indent_size = 2
131+
132+
# JSON files
133+
[*.{json,jsonc}]
134+
indent_size = 2
135+
136+
# YAML files
137+
[*.{yml,yaml}]
138+
indent_size = 2
139+
140+
# Markdown files
141+
[*.md]
142+
trim_trailing_whitespace = false

sdk/dotnet/.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Build outputs
2+
bin/
3+
obj/
4+
5+
# NuGet packages
6+
*.nupkg
7+
nupkgs/
8+
9+
# User-specific files
10+
*.user
11+
*.suo
12+
13+
# IDE
14+
.vscode/
15+
.idea/
16+
*.sln.iml
17+
18+
# Test results
19+
TestResults/
20+
21+
# Coverage
22+
coverage/
23+
*.coverage
24+
25+
# Misc
26+
*.log
27+
*.tmp
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<Project>
2+
<PropertyGroup>
3+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
4+
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
5+
</PropertyGroup>
6+
7+
<!-- Roslyn Source Generators -->
8+
<ItemGroup>
9+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
10+
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
11+
</ItemGroup>
12+
13+
<!-- Runtime Dependencies -->
14+
<ItemGroup>
15+
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
16+
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
17+
</ItemGroup>
18+
19+
<!-- Node.js Interop -->
20+
<ItemGroup>
21+
<PackageVersion Include="Microsoft.JavaScript.NodeApi" Version="0.9.5" />
22+
</ItemGroup>
23+
24+
<!-- Testing Packages -->
25+
<ItemGroup>
26+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
27+
<PackageVersion Include="xunit" Version="2.7.0" />
28+
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.7" />
29+
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
30+
</ItemGroup>
31+
</Project>

0 commit comments

Comments
 (0)