Skip to content

Commit 23ac01e

Browse files
committed
Refactor project files and improve code structure
1 parent a63ae50 commit 23ac01e

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
lines changed

src/NetContextClient/NetContextClient.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,4 @@
1313
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
1414
</ItemGroup>
1515

16-
<ItemGroup>
17-
<ProjectReference Include="..\NetContextServer\NetContextServer.csproj" />
18-
</ItemGroup>
19-
2016
</Project>

src/NetContextServer/NetContextServer.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@
1313

1414
<ItemGroup>
1515
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.3" />
16-
<PackageReference Include="Microsoft.ML.TorchSharp" Version="0.22.2" />
1716
<PackageReference Include="Microsoft.SemanticKernel" Version="1.42.0" />
1817
<PackageReference Include="ModelContextProtocol" Version="0.1.0-preview.1.25171.12" />
19-
<PackageReference Include="System.Text.Json" Version="9.0.3" />
2018
<PackageReference Include="NuGet.Protocol" Version="6.13.2" />
2119
</ItemGroup>
2220

src/NetContextServer/Services/PackageAnalyzerService.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,13 @@ await GatherDependenciesForPackageAsync(
200200
return analysis;
201201
}
202202

203-
private async Task GatherDependenciesForPackageAsync(string packageId, NuGetVersion packageVersion, List<string> dependencies, HashSet<string> visited, int currentDepth, int maxDepth)
203+
private static async Task GatherDependenciesForPackageAsync(
204+
string packageId,
205+
NuGetVersion packageVersion,
206+
List<string> dependencies,
207+
HashSet<string> visited,
208+
int currentDepth,
209+
int maxDepth)
204210
{
205211
if (currentDepth > maxDepth) return;
206212
if (visited.Contains(packageId)) return;

src/NetContextServer/Tools/PackageTools.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ private static string GenerateDependencyGraph(string rootPackageId, List<string>
102102
return "No dependencies";
103103
}
104104

105-
var lines = new List<string>();
106-
lines.Add($"└─ {rootPackageId}");
105+
var lines = new List<string>
106+
{
107+
$"└─ {rootPackageId}"
108+
};
107109

108110
// Group dependencies for visualization
109111
var grouped = dependencies

src/NetContextServer/Tools/ThinkTools.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.ComponentModel;
33
using System.Text.Encodings.Web;
44
using System.Text.Json;
5-
using System.Text.Json.Serialization;
65
using System.Text.RegularExpressions;
76

87
namespace NetContextServer.Tools;
@@ -12,8 +11,11 @@ namespace NetContextServer.Tools;
1211
/// to reason about its actions without making state changes.
1312
/// </summary>
1413
[McpToolType]
15-
public static class ThinkTools
14+
public static partial class ThinkTools
1615
{
16+
[GeneratedRegex(@"(?i)(exec\s+\{|system\s*\(|eval\s*\(|<script|javascript:)", RegexOptions.Compiled, "en-US")]
17+
private static partial Regex InvalidContentRegex();
18+
1719
/// <summary>
1820
/// Default JSON serializer options used for think tool output.
1921
/// </summary>
@@ -49,9 +51,7 @@ public static class ThinkTools
4951
/// <summary>
5052
/// Pattern to detect potentially harmful content.
5153
/// </summary>
52-
private static readonly Regex InvalidContentPattern = new(
53-
@"(?i)(exec\s+\{|system\s*\(|eval\s*\(|<script|javascript:)",
54-
RegexOptions.Compiled);
54+
private static readonly Regex InvalidContentPattern = InvalidContentRegex();
5555

5656
/// <summary>
5757
/// Provides a space for structured thinking during complex operations.

tests/NetContextServer/NetContextServer.Tests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2121
</PackageReference>
2222
<PackageReference Include="Xunit.SkippableFact" Version="1.5.23" />
23-
<PackageReference Include="NuGet.Protocol" Version="6.13.2" />
2423
</ItemGroup>
2524

2625
<ItemGroup>

0 commit comments

Comments
 (0)