Skip to content

Commit 1b5e753

Browse files
authored
docs: adds claude.md files (#36)
* docs: adds claude.md files * docs: simplify SampleApp/CLAUDE.md Committed-By-Agent: claude
1 parent 7a57b6f commit 1b5e753

4 files changed

Lines changed: 106 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Privy Unity SDK
2+
3+
Unity SDK for Privy authentication and embedded wallet functionality. Distributed as a UPM package (`com.privy.unity-sdk`), targeting Unity 2022.3+.
4+
5+
## Repository Structure
6+
7+
```
8+
SDK/ # UPM package — runtime code, editor tools, native plugins
9+
SampleApp/ # Unity project demonstrating SDK usage
10+
docs/ # Developer documentation (releasing.md, native-code.md)
11+
agent_docs/ # AI assistant reference docs (code conventions, PR review rules)
12+
Format.csproj # Used for dotnet format (covers SDK/, excludes ExternalDependencies/)
13+
version.txt # Canonical version (managed by release-please — do not edit manually)
14+
```
15+
16+
For detailed SDK architecture, conventions, and patterns, see **[SDK/CLAUDE.md](SDK/CLAUDE.md)**.
17+
18+
## Essential Commands
19+
20+
```bash
21+
# Format all SDK source (run before committing)
22+
dotnet format Format.csproj
23+
```
24+
25+
## Commit Conventions
26+
27+
Use [Conventional Commits](https://www.conventionalcommits.org/)`feat:`, `fix:`, `chore:`, `docs:`, etc. Release-please uses these to generate the changelog and determine the next version bump automatically.
28+
29+
## Release Process
30+
31+
1. Merge conventional-commit PRs into `main`
32+
2. Release-please opens a release PR bumping `version.txt`, `SDK/package.json`, and `SDK/Runtime/Utils/SdkVersion.cs`
33+
3. Review and merge the release PR — release-please then creates the GitHub Release and git tag
34+
35+
See `docs/releasing.md` for the full release guide.
36+
37+
## GitHub Actions
38+
39+
| Workflow | Trigger | What it does |
40+
| -------------------- | ------------ | ----------------------------------- |
41+
| `claude.yml` | PR | Automated code review |
42+
| `format-check.yml` | PR | Verifies `dotnet format` was run |
43+
| `pr-title.yml` | PR | Enforces conventional commit format |
44+
| `release-please.yml` | Push to main | Manages release PRs and tags |

SDK/CLAUDE.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Privy Unity SDK — SDK/
2+
3+
Unity Package Manager package (`com.privy.unity-sdk`) providing authentication and embedded wallet functionality. Requires Unity 2022.3+.
4+
5+
## Directory Structure
6+
7+
```
8+
SDK/
9+
├── package.json # UPM package manifest (version, dependencies)
10+
├── Runtime/ # All runtime C# source (included in player builds)
11+
├── Editor/ # Editor-only scripts (excluded from player builds)
12+
├── ExternalDependencies/ # Vendored third-party libraries (UnityWebView, jsoncanonicalizer)
13+
└── Plugins/ # Native platform code (iOS Objective-C, WebGL .jslib)
14+
```
15+
16+
## Architecture
17+
18+
Every public service has a `public` interface (e.g. `ILoginWithEmail`) and a separate `internal` implementation (e.g. `LoginWithEmail`). SDK consumers only ever see interfaces and public models — never implementation classes.
19+
20+
All dependencies are constructor-injected. See `docs/dependency-injection.md`.
21+
22+
## Code Formatting
23+
24+
```bash
25+
dotnet format Format.csproj
26+
```
27+
28+
Run before committing. `Format.csproj` covers `Runtime/` and `Editor/` but excludes `ExternalDependencies/`.
29+
30+
## XML Documentation
31+
32+
All `public` interfaces, methods, properties, and classes require `/// <summary>` docs with `/// <param>` and `/// <exception cref="">` where applicable.
33+
34+
## Versioning and Release
35+
36+
See `docs/releasing.md`. Do not manually edit `version.txt`, `SDK/package.json`, or `SDK/Runtime/Utils/SdkVersion.cs`, and do not remove the `// x-release-please-start-version` / `// x-release-please-end` markers in `SdkVersion.cs`.
37+
38+
## Native Plugins
39+
40+
See `docs/native-code.md` for the ARC bridging guide, `MonoPInvokeCallback` pattern, and `DllImport`/`extern` usage.

SampleApp/CLAUDE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SampleApp/
2+
3+
A Unity project that demonstrates SDK usage. It is not a published artifact — its purpose is to exercise the public API and serve as a reference for consumers.

docs/dependency-injection.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Dependency Injection
2+
3+
The SDK uses manual constructor injection. There is no DI framework.
4+
5+
## Wiring
6+
7+
All service instantiation happens in `PrivyImpl`'s constructor. When adding a new service, instantiate it there and pass its dependencies explicitly. No service locators or static helpers beyond `PrivyManager`.
8+
9+
## Constructor params
10+
11+
Required dependencies must be null-checked:
12+
13+
```csharp
14+
_authDelegator = authDelegator ?? throw new ArgumentNullException(nameof(authDelegator));
15+
```
16+
17+
## Entry point
18+
19+
`PrivyManager.Initialize(config)` is the only way to create an SDK instance — no other public constructors exist. It creates `PrivyImpl`, which owns the full dependency graph.

0 commit comments

Comments
 (0)