Skip to content

Commit 70037a0

Browse files
authored
Add CLAUDE.md (#771)
1 parent bf3186c commit 70037a0

1 file changed

Lines changed: 109 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## What this repo does
6+
7+
Auto-generates a Rust Azure DevOps API crate (`azure_devops_rust_api`) from the Azure DevOps OpenAPI spec (`vsts-rest-api-specs`, included as a git submodule). The pipeline is:
8+
9+
1. **`vsts-api-patcher`** — reads `vsts-rest-api-specs/`, patches known issues in the OpenAPI JSON, writes `vsts-rest-api-specs.patched/`
10+
2. **`autorust`** — reads `vsts-rest-api-specs.patched/`, generates Rust source into `azure_devops_rust_api/src/`
11+
3. **`azure_devops_rust_api`** — the generated crate, compiled and published to crates.io
12+
13+
## Commands
14+
15+
### Full build (patch → generate → compile)
16+
```sh
17+
./build.sh
18+
```
19+
20+
### Build individual components
21+
```sh
22+
# Run patcher only (from repo root)
23+
cd vsts-api-patcher && cargo run --release && cd ..
24+
25+
# Run code generator only (from repo root)
26+
cd autorust && cargo run --bin ado-autorust --release && cd ..
27+
28+
# Build generated crate
29+
cd azure_devops_rust_api && cargo build --all-features && cd ..
30+
```
31+
32+
### Lint
33+
```sh
34+
cargo clippy --all-features -- --deny warnings
35+
cargo clippy --all-features --examples -- --deny warnings
36+
```
37+
38+
### Check (faster than build, no generated output)
39+
```sh
40+
cd azure_devops_rust_api
41+
cargo check --all-features
42+
cargo check --all-features --examples
43+
```
44+
45+
### Publish to crates.io
46+
```sh
47+
./publish.sh
48+
```
49+
50+
## Architecture
51+
52+
### Key distinction: generated vs. hand-written code
53+
54+
**Do NOT edit generated files directly** — they are overwritten by `./build.sh`:
55+
- `azure_devops_rust_api/src/<module>/mod.rs` — generated API operations
56+
- `azure_devops_rust_api/src/<module>/models.rs` — generated model types
57+
58+
**Hand-written source** (edit these directly):
59+
- `azure_devops_rust_api/src/auth.rs``Credential` enum (PAT + OAuth)
60+
- `azure_devops_rust_api/src/date_time.rs` — datetime serde helpers
61+
- `azure_devops_rust_api/src/telemetry.rs` — telemetry pipeline policy
62+
- `azure_devops_rust_api/src/headers.rs` — common header helpers
63+
64+
### Code generator internals (`autorust/`)
65+
66+
- `autorust/ado-autorust/src/main.rs` — entry point; maps each OpenAPI spec file to an output module
67+
- `autorust/codegen/src/codegen_operations/` — generates API operation code (clients, builders, responses)
68+
- `create_client_and_builder.rs` — Pipeline/Transport/RetryOptions usage
69+
- `request_builder_send.rs` — Pipeline::send() calls
70+
- `request_builder_into_future.rs` — into_body()/into_model() calls
71+
- `response_code.rs` — Response type definitions
72+
- `autorust/codegen/src/codegen_models.rs` — generates model structs/enums
73+
- `autorust/autorust.toml` — config for boxed/optional/invalid properties (fixes recursive type issues)
74+
75+
### Patcher (`vsts-api-patcher/`)
76+
77+
- `src/main.rs` — walks spec files, calls patcher, writes patched JSON
78+
- `src/patcher.rs` — all spec patches; patching logic keyed on spec filename
79+
80+
### Generated crate structure
81+
82+
Each Azure DevOps API area is a separate feature-gated module (e.g. `git`, `build`, `wit`). All features are listed in `azure_devops_rust_api/Cargo.toml`. API version is 7.1.
83+
84+
## Updating `azure_core` / `azure_identity`
85+
86+
See `SKILL.md` for the full process. Key files affected by breaking changes:
87+
- Codegen: `autorust/codegen/src/codegen_operations/` files (then re-run `./build.sh`)
88+
- Hand-written: `azure_devops_rust_api/src/auth.rs`, `telemetry.rs`, `date_time.rs`
89+
90+
## Releasing
91+
92+
See `SKILL.md` for the full process. Files to update: `azure_devops_rust_api/Cargo.toml` (version), `azure_devops_rust_api/README.md` (version in example snippet), `CHANGELOG.md`.
93+
94+
## Updating the OpenAPI spec submodule
95+
96+
```sh
97+
git submodule update --remote vsts-rest-api-specs
98+
git add .
99+
git commit -m "Updated vsts-rest-api-specs to latest revision"
100+
./build.sh
101+
cargo clippy --all-features -- --deny warnings
102+
cargo clippy --all-features --examples -- --deny warnings
103+
```
104+
105+
## Commit message style
106+
107+
- Dependency updates: `Update azure_core, azure_identity to X.Y`
108+
- Releases: `Release X.Y.0`
109+
- No conventional commit prefixes

0 commit comments

Comments
 (0)