Skip to content

Commit a36bfbd

Browse files
committed
Add repository guidance doc
1 parent 7201850 commit a36bfbd

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

AGENTS.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# AGENTS.md
2+
3+
This file provides guidance to Codex (Codex.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
C# SDK for the [AI21](https://ai21.com/) AI platform, auto-generated from the AI21 OpenAPI specification using [AutoSDK](https://github.com/HavenDV/AutoSDK). Published as a NuGet package under the `AI21` package name.
8+
9+
## Build Commands
10+
11+
```bash
12+
# Build the solution
13+
dotnet build AI21.slnx
14+
15+
# Build for release (also produces NuGet package)
16+
dotnet build AI21.slnx -c Release
17+
18+
# Run integration tests (requires AI21_API_KEY env var)
19+
dotnet test src/tests/AI21.IntegrationTests/AI21.IntegrationTests.csproj
20+
21+
# Regenerate SDK from OpenAPI spec
22+
cd src/libs/AI21 && ./generate.sh
23+
```
24+
25+
## Architecture
26+
27+
### Code Generation Pipeline
28+
29+
The SDK code is **entirely auto-generated** -- do not manually edit files in `src/libs/AI21/Generated/`.
30+
31+
1. `src/libs/AI21/openapi.yaml` -- the AI21 OpenAPI spec (fetched from `https://api.ai21.com/openapi.json`)
32+
2. `src/helpers/FixOpenApiSpec/` -- converts OpenAPI 3.1 to 3.0 format for compatibility
33+
3. `src/libs/AI21/generate.sh` -- orchestrates: download spec, fix spec, run AutoSDK CLI, output to `Generated/`
34+
4. CI auto-updates the spec and creates PRs if changes are detected
35+
36+
### Project Layout
37+
38+
| Project | Purpose |
39+
|---------|---------|
40+
| `src/libs/AI21/` | Main SDK library (`Ai21Api`) |
41+
| `src/tests/AI21.IntegrationTests/` | Integration tests against real AI21 API |
42+
| `src/helpers/FixOpenApiSpec/` | OpenAPI spec fixer tool |
43+
| `src/helpers/GenerateDocs/` | Documentation generator from integration tests |
44+
| `src/helpers/TrimmingHelper/` | NativeAOT/trimming compatibility validator |
45+
46+
### Build Configuration
47+
48+
- **Target:** `net10.0` (single target)
49+
- **Language:** C# preview with nullable reference types
50+
- **Signing:** Strong-named assemblies via `src/key.snk`
51+
- **Versioning:** Semantic versioning from git tags (`v` prefix) via MinVer
52+
- **Analysis:** All .NET analyzers enabled, AOT/trimming compatibility enforced
53+
- **Testing:** MSTest + FluentAssertions
54+
55+
### Key Conventions
56+
57+
- No hand-written extension files -- the SDK is purely generated code
58+
- The client class is named `Ai21Api`
59+
- The namespace is `AI21`
60+
61+
### CI/CD
62+
63+
- Uses shared workflows from `HavenDV/workflows` repo
64+
- Dependabot updates NuGet packages weekly (auto-merged)
65+
- Documentation deployed to GitHub Pages via MkDocs Material

0 commit comments

Comments
 (0)