Skip to content

Commit e10206a

Browse files
authored
Merge pull request #2 from managedcode/codex/set-up-.net-build-and-tests
Migrate to .NET 10, adopt TUnit, add integration tests and MCAF guidance
2 parents e0d10d9 + 66416bc commit e10206a

File tree

19 files changed

+328
-112
lines changed

19 files changed

+328
-112
lines changed

AGENTS.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Repository Agent Instructions (MCAF)
2+
3+
This repository follows the Managed Code Coding AI Framework (MCAF).
4+
5+
## Environment
6+
- Use .NET SDK **10.x** only (see `global.json`).
7+
- Solution format is **.slnx** (`ragsharp.slnx`). Do not reintroduce `.sln` files.
8+
- Tests use **TUnit**. Avoid xUnit/NUnit/MSTest packages.
9+
10+
## Verification
11+
- Prefer integration tests that exercise real filesystem/indexing behavior.
12+
- Run `dotnet test ragsharp.slnx` after changes when feasible.
13+
14+
## Repository Layout
15+
- Source projects live under `src/`.
16+
- Tests live under `tests/`.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ See the Codex skill specification at https://agentskills.io/specification.
99

1010
## Requirements
1111

12-
- .NET SDK 10 (primary) with multi-targeting to net8.0 for fallback.
12+
- .NET SDK 10 (only target).
1313
- Cross-platform (Windows/macOS/Linux).
1414

1515
## Install .NET 10

docs/Wiki/ProjectOverview.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# RagSharp Project Overview
2+
3+
RagSharp provides code graph indexing, storage, and tooling for analyzing .NET codebases.
4+
The core library builds a graph of symbols and relationships (types, members, inheritance,
5+
and references). A lightweight SQLite-backed store allows querying that graph, while the
6+
CLI and packaging utilities wrap the core capabilities for local workflows and publishing.
7+
8+
## Key Components
9+
10+
- **Code graph indexing**: `src/RagSharp.CodeGraph.Core` uses Roslyn + MSBuild workspace
11+
to parse solutions/projects and emit nodes/edges.
12+
- **Graph storage**: `src/RagSharp.CodeGraph.Store.LiteGraph` stores the graph in SQLite
13+
and supports symbol/document queries.
14+
- **CLI**: `src/RagSharp.CodeGraph.Cli` provides command-line access for indexing.
15+
- **Skill installer**: `src/RagSharp.SkillInstaller` installs bundled skill templates.
16+
- **Packaging**: `src/RagSharp.Packaging` handles packaging and publishing needs.
17+
18+
## Build & Test
19+
20+
```bash
21+
dotnet build ragsharp.slnx
22+
dotnet test ragsharp.slnx
23+
```
24+
25+
## Repository Conventions
26+
27+
- Target .NET SDK **10.x** only (`global.json`).
28+
- Use the `.slnx` solution format.
29+
- Tests are written with **TUnit** and favor integration coverage.

global.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"sdk": {
33
"version": "10.0.100",
44
"rollForward": "latestFeature",
5-
"allowPrerelease": true
5+
"allowPrerelease": true,
6+
"testRunner": "Microsoft.Testing.Platform"
67
}
78
}

ragsharp.sln

Lines changed: 0 additions & 55 deletions
This file was deleted.

ragsharp.slnx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Solution>
2+
<Folder Name="/src/">
3+
<Project Path="src/RagSharp.CodeGraph.Cli/RagSharp.CodeGraph.Cli.csproj" />
4+
<Project Path="src/RagSharp.CodeGraph.Core/RagSharp.CodeGraph.Core.csproj" />
5+
<Project Path="src/RagSharp.CodeGraph.Store.LiteGraph/RagSharp.CodeGraph.Store.LiteGraph.csproj" />
6+
<Project Path="src/RagSharp.Packaging/RagSharp.Packaging.csproj" />
7+
<Project Path="src/RagSharp.SkillInstaller/RagSharp.SkillInstaller.csproj" />
8+
</Folder>
9+
<Folder Name="/tests/">
10+
<Project Path="tests/RagSharp.CodeGraph.Tests/RagSharp.CodeGraph.Tests.csproj" />
11+
<Project Path="tests/RagSharp.SkillInstaller.Tests/RagSharp.SkillInstaller.Tests.csproj" />
12+
</Folder>
13+
</Solution>

src/RagSharp.CodeGraph.Cli/RagSharp.CodeGraph.Cli.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
4-
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
4+
<TargetFramework>net10.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<AssemblyName>ragsharp-codegraph</AssemblyName>

src/RagSharp.CodeGraph.Core/CodeGraphIndexer.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@ public CodeGraphIndexer(bool includeDataflow)
1919

2020
public async Task<IndexResult> IndexAsync(string rootPath, CancellationToken cancellationToken)
2121
{
22-
MSBuildLocator.RegisterDefaults();
22+
if (!MSBuildLocator.IsRegistered && MSBuildLocator.CanRegister)
23+
{
24+
MSBuildLocator.RegisterDefaults();
25+
}
2326
using var workspace = MSBuildWorkspace.Create();
2427

2528
var solutionPath = FindSolution(rootPath);
2629
if (solutionPath is not null)
2730
{
28-
var solution = await workspace.OpenSolutionAsync(solutionPath, cancellationToken).ConfigureAwait(false);
31+
var solution = await workspace.OpenSolutionAsync(solutionPath, progress: null, cancellationToken).ConfigureAwait(false);
2932
return await BuildIndexAsync(rootPath, solution.Projects, cancellationToken).ConfigureAwait(false);
3033
}
3134

@@ -35,7 +38,7 @@ public async Task<IndexResult> IndexAsync(string rootPath, CancellationToken can
3538
throw new InvalidOperationException("No .sln or .csproj found under the provided root.");
3639
}
3740

38-
var project = await workspace.OpenProjectAsync(projectPath, cancellationToken).ConfigureAwait(false);
41+
var project = await workspace.OpenProjectAsync(projectPath, progress: null, cancellationToken).ConfigureAwait(false);
3942
return await BuildIndexAsync(rootPath, new[] { project }, cancellationToken).ConfigureAwait(false);
4043
}
4144

@@ -159,7 +162,11 @@ public IndexState(IReadOnlyDictionary<string, string> files)
159162
public string ToJson()
160163
{
161164
var payload = new IndexStatePayload { Files = new Dictionary<string, string>(Files) };
162-
return System.Text.Json.JsonSerializer.Serialize(payload, new() { WriteIndented = true, PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.CamelCase });
165+
return System.Text.Json.JsonSerializer.Serialize(payload, new System.Text.Json.JsonSerializerOptions
166+
{
167+
WriteIndented = true,
168+
PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.CamelCase
169+
});
163170
}
164171

165172
public static IndexState FromJson(string json)
@@ -218,6 +225,11 @@ public void AddDocument(Project project, Document document, SyntaxTree tree, Sem
218225
var root = tree.GetRoot();
219226
foreach (var usingDirective in root.DescendantNodes().OfType<UsingDirectiveSyntax>())
220227
{
228+
if (usingDirective.Name is null)
229+
{
230+
continue;
231+
}
232+
221233
var name = usingDirective.Name.ToString();
222234
var nodeId = AddNode(NodeKind.UsingDirective, name, document.FilePath, GetLocation(_rootPath, usingDirective));
223235
AddEdge(EdgeKind.UsingDirective, documentNodeId, nodeId, GetLocation(_rootPath, usingDirective));
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
3+
<TargetFramework>net10.0</TargetFramework>
44
<Nullable>enable</Nullable>
55
<ImplicitUsings>enable</ImplicitUsings>
66
</PropertyGroup>
77
<ItemGroup>
8+
<PackageReference Include="Microsoft.Build.Locator" Version="1.7.8" />
89
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" />
910
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.10.0" />
1011
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.10.0" />
12+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.0" />
1113
</ItemGroup>
1214
</Project>

src/RagSharp.CodeGraph.Store.LiteGraph/RagSharp.CodeGraph.Store.LiteGraph.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
3+
<TargetFramework>net10.0</TargetFramework>
44
<Nullable>enable</Nullable>
55
<ImplicitUsings>enable</ImplicitUsings>
66
</PropertyGroup>

0 commit comments

Comments
 (0)