Skip to content

Commit d630e68

Browse files
committed
claude init
1 parent 80b37ef commit d630e68

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

AGENTS.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# AGENTS.md
2+
3+
This file provides guidance to the coding agents when working with code in this repository.
4+
5+
## Commands
6+
7+
```bash
8+
npm run build # Compile TypeScript to dist/
9+
npm test # Run all Jest tests (requires .env with TOKEN=)
10+
npm run check # Lint and format with Biome (auto-fix)
11+
```
12+
13+
Run a single test by name:
14+
```bash
15+
npm test -- --testNamePattern="test name here"
16+
```
17+
18+
Tests hit the real Scrape.do API — a `.env` file with `TOKEN=<api_token>` is required.
19+
20+
## Architecture
21+
22+
This is a TypeScript client library for the [Scrape.do](https://scrape.do) web scraping API. It compiles to CommonJS in `dist/` and is published as `@scrape-do/client`.
23+
24+
**Source files** (`src/`):
25+
- `lib.ts` — The `ScrapeDo` class: `sendRequest(method, options, body?)` builds query params and calls `makeRequest()`, which uses the native `https` module. `statistics()` hits the stats endpoint.
26+
- `types.ts` — All TypeScript interfaces: `RequestOptions`, `Response`, `StatisticsResponse`, etc.
27+
- `geocode.ts` — Enum of country/region codes passed as `geoCode` options.
28+
- `playwithbrowser.ts` — Types for browser automation actions (`playWithBrowser` option).
29+
30+
**Request flow**: `sendRequest` → serializes `options` into query params (arrays become `key[0]=val` style, nested objects handled recursively) → `makeRequest` performs the HTTPS request → response is returned as `Response` with status, headers, body, and parsed JSON if applicable.
31+
32+
**Key design detail**: The `token` is always injected as the first query param. Custom/extra/forward headers are serialized with different key prefixes. The `playWithBrowser` array of actions is JSON-stringified into a single query param.

CLAUDE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
@AGENTS.md

0 commit comments

Comments
 (0)