You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+
## Commands
6
+
7
+
```bash
8
+
# Build
9
+
npm run build # Compile TypeScript to ./dist/
10
+
11
+
# Test
12
+
npm test# Run all tests with coverage (requires .env file)
13
+
npm run test:ci # Run tests for CI (no .env required)
14
+
15
+
# Run a single test file
16
+
npx jest tests/run/yepcodeRun.test.ts
17
+
18
+
# Lint
19
+
npm run lint # Check for lint errors
20
+
npm run lint:fix # Auto-fix lint errors
21
+
```
22
+
23
+
Tests require a `.env` file with `YEPCODE_*` credentials to run against the real API.
24
+
25
+
## Architecture
26
+
27
+
This is a zero-dependency TypeScript SDK for the YepCode Cloud API. It requires Node.js >= 18 (uses native `fetch`). Output is compiled CommonJS to `./dist/`.
28
+
29
+
### Public surface (`src/index.ts`)
30
+
31
+
Four exported classes:
32
+
-**`YepCodeRun`** — Execute JavaScript/Python code in isolated YepCode sandboxes. Creates processes (deduplicated by SHA256 hash of code), executes them, and returns `Execution` instances.
33
+
-**`YepCodeEnv`** — CRUD for team-level environment variables with auto-pagination.
34
+
-**`YepCodeStorage`** — Upload/list/download/delete files (accepts `File`, `Blob`, or `Readable` streams).
35
+
-**`YepCodeApi`** — Raw HTTP client exposing the full REST API (processes, executions, schedules, modules, sandboxes, service accounts).
36
+
37
+
### Key internals
38
+
39
+
**`src/api/yepcodeApi.ts`** — The core HTTP client (~820 lines). Handles:
40
+
- Auth via API token, client credentials (OAuth), or direct access token
41
+
- Auto-refresh of expired access tokens
42
+
- All REST endpoints as typed methods
43
+
44
+
**`src/run/execution.ts`** — Wraps a running execution with adaptive polling:
45
+
- 250ms × 4, then 500ms × 8, then 1000ms thereafter
46
+
- Logs polled every 2s or on completion
47
+
- Event callbacks: `onLog`, `onFinish`, `onError`
48
+
49
+
**`src/api/configManager.ts`** — Reads `YEPCODE_API_TOKEN`, `YEPCODE_CLIENT_ID`, `YEPCODE_CLIENT_SECRET`, `YEPCODE_TEAM_ID`, `YEPCODE_ACCESS_TOKEN`, `YEPCODE_API_HOST` from the environment.
50
+
51
+
**`src/utils/languageDetector.ts`** — Regex/scoring-based JS vs Python detection used when language is not specified explicitly.
52
+
53
+
## OpenAPI spec
54
+
55
+
The live spec is always available at:
56
+
```
57
+
https://cloud.yepcode.io/api/rest/public/api-docs
58
+
```
59
+
60
+
Fetch it with `WebFetch` to audit which endpoints are missing from `src/api/yepcodeApi.ts` before adding new ones. New endpoints are deployed to that URL before this SDK is updated.
0 commit comments