Skip to content

Commit ec7eb20

Browse files
committed
update agents.md
1 parent 177d170 commit ec7eb20

1 file changed

Lines changed: 24 additions & 7 deletions

File tree

AGENTS.md

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,27 @@
33
## Package manager
44
- Use `pnpm` for all package management
55

6-
## Commands
7-
- `pnpm test` — run all tests (AVA, serial)
6+
## Setup and Commands
7+
8+
### Initial Setup Checklist
9+
1. Create a `.env` file in the project root (loaded via `dotenv/config`)
10+
2. Verify all required environment variables are set and non-empty:
11+
- `VRCHAT_EMAIL`
12+
- `VRCHAT_USERNAME`
13+
- `VRCHAT_PASSWORD`
14+
- `VRCHAT_TOTP_SECRET`
15+
- `VRCHAT_FRIEND_ID`
16+
- `VRCHAT_GROUP_ID`
17+
- **If any variable is missing, empty, or malformed, stop immediately and print the exact variable names that must be set before any test run.**
18+
3. Before every local test run, execute `pnpm test:clean` first. Do not reuse any existing `data/state/` or AVA cache from a previous run. (CI does this automatically.)
19+
4. Execute `pnpm get-spec` to download the latest `openapi-internal+legacy.yaml` to `openapi.yaml` (CI does this automatically).
20+
21+
### Available Commands
22+
- `pnpm test` — run all tests (AVA; serial mode configured in `ava.config.js`)
823
- `pnpm fast-fail` — stop on first failure
924
- `pnpm type-check` — TypeScript type check
1025
- `pnpm test:clean` — clear `data/state` and AVA cache (`pwsh ./scripts/clean.ps1`)
26+
- `pnpm get-spec` — download latest `openapi-internal+legacy.yaml` to `openapi.yaml`
1127

1228
## Project purpose
1329
Integration-test suite against the live VRChat API. Downloads the latest `openapi-internal+legacy.yaml` from vrchatapi/specification releases, then validates actual API responses against the schema.
@@ -19,12 +35,11 @@ Integration-test suite against the live VRChat API. Downloads the latest `openap
1935
- Test results recorded as markdown to `data/requests/`
2036

2137
## Running tests
22-
Requires these env vars (add to `.env` — loaded via `dotenv/config`):
23-
`VRCHAT_EMAIL`, `VRCHAT_USERNAME`, `VRCHAT_PASSWORD`, `VRCHAT_TOTP_SECRET`, `VRCHAT_FRIEND_ID`, `VRCHAT_GROUP_ID`
2438

25-
Auth flow: login with Basic auth → 2FA TOTP → verify → cookie-based reuse. Rate-limit protection: 200ms between requests, exponential backoff up to 10 retries on 429.
26-
27-
Before a fresh run, always clear state: `pnpm test:clean` (CI does this)
39+
### Authentication and Error Handling
40+
- Auth flow: login with Basic auth → 2FA TOTP → verify → cookie-based reuse
41+
- Rate-limit protection: 200ms between requests, exponential backoff up to 10 retries on 429
42+
- **If login fails, TOTP verification fails, or cookie-based reuse cannot be established, abort the run immediately with a clear error message and do not continue with partial state.**
2843

2944
## Test patterns
3045
- `testOperation` macro (from `_utilities.ts`) handles: parameter injection, schema validation (`@exodus/schemasafe` lax mode), response logging
@@ -37,6 +52,8 @@ Before a fresh run, always clear state: `pnpm test:clean` (CI does this)
3752
- `tests/_utilities.ts` — core test framework (fetch, schema validation, request/response recorder)
3853
- `tests/_consts.ts` — env vars, shared constants like `tupperUserId`, `defaultAvatarId`
3954
- `tests/_cache.ts` — file-based state and caching, sensitive/unstable value tracking
55+
- `tests/_users.ts` — shared unstable key lists (e.g. `unstableUserKeys`)
56+
- `ava.config.js` — AVA config with serial mode, custom test ordering via `_order.json`, tsx loader
4057
- `scripts/clean.ps1` — clears `data/state/` and AVA cache for a fresh run (`pnpm test:clean`)
4158
- `scripts/get-spec.ps1` — downloads latest `openapi-internal+legacy.yaml` to `openapi.yaml`
4259
- `openapi.yaml` (in `.gitignore`) — downloaded at test time by CI or `scripts/get-spec.ps1`

0 commit comments

Comments
 (0)