|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +C# SDK originally based on the Ollama OpenAPI specification, generated using [OpenApiGenerator](https://github.com/HavenDV/OpenApiGenerator) (the predecessor to AutoSDK). This repository uses a **source-generator-based approach** rather than the CLI-based AutoSDK pipeline used by newer tryAGI SDKs. The code is generated at build time from the OpenAPI spec via a Roslyn source generator. |
| 8 | + |
| 9 | +**Note:** This repo does not follow the standard AutoSDK pattern. It uses the older `OpenApiGenerator` NuGet package as a build-time source generator. |
| 10 | + |
| 11 | +## Build Commands |
| 12 | + |
| 13 | +```bash |
| 14 | +# Build the solution |
| 15 | +dotnet build Reka.sln |
| 16 | + |
| 17 | +# Build for release (also produces NuGet package) |
| 18 | +dotnet build Reka.sln -c Release |
| 19 | + |
| 20 | +# Run integration tests (uses Testcontainers, no API key required -- runs Ollama in Docker) |
| 21 | +dotnet test src/tests/Reka.IntegrationTests/Reka.IntegrationTests.csproj |
| 22 | +``` |
| 23 | + |
| 24 | +## Architecture |
| 25 | + |
| 26 | +### Code Generation |
| 27 | + |
| 28 | +Unlike newer tryAGI SDKs, there is **no `generate.sh` script** and **no `Generated/` directory**. Code is generated at build time by the `OpenApiGenerator` Roslyn source generator, which reads from `docs/openapi.yaml`. |
| 29 | + |
| 30 | +- `docs/openapi.yaml` -- the OpenAPI spec consumed at build time |
| 31 | +- The `OpenApiGenerator` NuGet package (v0.7.1) generates client code as a source generator during compilation |
| 32 | +- Hand-written file: `src/libs/Reka/SourceGenerationContext.cs` -- JSON serializer context for trimming/AOT support |
| 33 | + |
| 34 | +### Project Layout |
| 35 | + |
| 36 | +| Project | Purpose | |
| 37 | +|---------|---------| |
| 38 | +| `src/libs/Reka/` | Main SDK library (`OllamaApiClient`), namespace `Ollama` | |
| 39 | +| `src/libs/Reka.Models/` | Separate models library, namespace `Ollama` | |
| 40 | +| `src/tests/Reka.IntegrationTests/` | Integration tests using Testcontainers (Docker-based) | |
| 41 | + |
| 42 | +### Build Configuration |
| 43 | + |
| 44 | +- **Targets:** `netstandard2.0;net4.6.2;net6.0;net8.0` (multi-target) |
| 45 | +- **Language:** C# preview with nullable reference types |
| 46 | +- **Signing:** Strong-named assemblies via `src/key.snk` |
| 47 | +- **Versioning:** Fixed version (`1.1.2`) set in `src/libs/Directory.Build.props` (no MinVer) |
| 48 | +- **Analysis:** All .NET analyzers enabled, AOT/trimming compatibility enforced |
| 49 | +- **Testing:** MSTest + FluentAssertions + Moq + Testcontainers |
| 50 | + |
| 51 | +### Key Differences from Standard tryAGI SDKs |
| 52 | + |
| 53 | +- Uses `OpenApiGenerator` source generator instead of `AutoSDK` CLI |
| 54 | +- Multi-target framework (netstandard2.0 through net8.0) instead of net10.0 only |
| 55 | +- No `src/helpers/` directory (no FixOpenApiSpec, GenerateDocs, or TrimmingHelper) |
| 56 | +- Tests use Docker via Testcontainers rather than API key-based integration |
| 57 | +- Namespace is `Ollama`, not `Reka` |
| 58 | +- Fixed version in Directory.Build.props instead of MinVer-based versioning |
0 commit comments