Skip to content

Commit db4214d

Browse files
committed
docs: trim CONTRIBUTING, rewrite AGENTS.md, drop CLAUDE.md
1 parent d5fbb93 commit db4214d

4 files changed

Lines changed: 47 additions & 145 deletions

File tree

‎AGENTS.md‎

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,42 @@
11
# AGENTS.md
22

3-
Instructions for AI agents working in this repository.
3+
## Purpose
44

5-
## Overview
5+
`@corbits/google-tools` is a Gmail tool pack for Interchange agents: search,
6+
read, label and draft over the Gmail REST API. It owns the tool definitions,
7+
input schemas, the Gmail client and the sidecar-bundle entry. It does not own
8+
OAuth or token storage; the host resolves the `gmail-api` credential and signs
9+
each request. It never sends mail.
610

7-
**Corbits Tools for Google** — tooling for Google.
11+
## Layout
812

9-
## Conventions
13+
- `src/client/client.ts`: `createGmailClient`, the typed Gmail REST calls.
14+
- `src/client/schemas.ts`: arktype schemas for Gmail responses.
15+
- `src/client/errors.ts`: `GmailApiError`.
16+
- `src/tools/definitions.ts`: the tool catalog, credential handle and scopes.
17+
- `src/tools/schemas.ts`: tool input schemas.
18+
- `src/tools/create-tools.ts`: `createGmailTools`, one handler per tool.
19+
- `src/tools/models.ts`: Gmail message and thread views returned to the model.
20+
- `src/tools/drafts.ts`: RFC 822 draft building.
21+
- `src/sidecar-bundle.ts`: the `./sidecar-bundle` entry the tool-package
22+
loader invokes.
23+
- `src/index.ts`: the root entry.
24+
- `e2e/`: live Gmail suites, gated on `GMAIL_LIVE_TEST=1`.
1025

11-
- **Runtime:** Bun + TypeScript, ES modules only.
12-
- Touch only code related to the task.
13-
- Comment _why_, never _what_.
14-
- No emojis in code or docs.
26+
## Rules
1527

16-
## Build & Validation
28+
- Every tool declares `approval: "ask"`, including read-only ones.
29+
- No tool sends mail.
30+
- Tokens never enter tool arguments or results; requests go through the
31+
host-resolved credential.
32+
- Parse every Gmail response with arktype; never `as T` untrusted input.
33+
- Declare tool definitions and approvals as explicit literals.
34+
- `exactOptionalPropertyTypes` is on: build results with the key omitted,
35+
not set to `undefined`.
1736

18-
```bash
37+
## Local development
38+
39+
```sh
1940
bun install
20-
bun run test
41+
bun run check
2142
```

‎CLAUDE.md‎

Lines changed: 0 additions & 105 deletions
This file was deleted.

‎CONTRIBUTING.md‎

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,35 @@
22

33
## Development
44

5-
```bash
5+
```sh
66
bun install
7-
bun run typecheck
8-
bun run typecheck:e2e
9-
bun run test
10-
bun run build
7+
bun run check
118
```
129

13-
The tests inject `fetch` implementations and do not call Gmail.
10+
`bun run check` runs typecheck, lint, format check and unit tests. `bun run format` rewrites the tree.
11+
12+
Contributors sign the [CLA](CLA.md) on their first PR; the CLA bot explains how.
13+
14+
Unit tests inject `fetch` and never call Gmail. `bun run test:e2e` runs the live
15+
suite, which skips unless `GMAIL_LIVE_TEST=1`.
1416

1517
## Live Gmail checks
1618

1719
Use a dedicated Gmail fixture account and a Desktop OAuth client granted only
18-
`gmail.modify`. The read smoke requires a query that matches exactly one
19-
one-message thread:
20+
`gmail.modify`. The fixture query must match exactly one one-message thread:
2021

21-
```bash
22+
```sh
2223
GMAIL_LIVE_TEST=1 \
2324
GMAIL_LIVE_CLIENT_ID='...' \
2425
GMAIL_LIVE_CLIENT_SECRET='...' \
2526
GMAIL_LIVE_FIXTURE_QUERY='subject:(interchange-gmail-e2e-fixture)' \
2627
bun run test:e2e
2728
```
2829

29-
The full live suite has been verified against a dedicated Gmail fixture account.
30-
It exercises every Gmail tool:
31-
32-
- `gmail_search_threads` finds the one-message fixture thread.
33-
- `gmail_get_thread` and `gmail_get_message` retrieve its metadata.
34-
- `gmail_list_labels` lists the account labels.
35-
- `gmail_create_draft` and `gmail_list_drafts` create and find a disposable
36-
draft, which the suite then deletes.
37-
- `gmail_label_message` and `gmail_unlabel_message` add and remove `STARRED`
38-
on the fixture message.
39-
- `gmail_label_thread` and `gmail_unlabel_thread` add and remove `STARRED`
40-
on every message in the fixture thread.
41-
42-
Add `GMAIL_LIVE_MUTATION_TEST=1` to run the draft and label checks. The suite
43-
deletes its draft, restores the fixture labels, and never sends email.
44-
45-
The first run opens Google OAuth and stores the refresh token in the ignored
46-
`.local/gmail-live-token.json` file. Set `GMAIL_LIVE_TOKEN_FILE` when using a
47-
different token file. Credentials and message contents are not logged.
30+
Add `GMAIL_LIVE_MUTATION_TEST=1` for the draft and label checks; the suite
31+
deletes its draft, restores the fixture labels and never sends email. The first
32+
run opens Google OAuth and stores the refresh token in the ignored
33+
`.local/gmail-live-token.json` (override with `GMAIL_LIVE_TOKEN_FILE`).
4834

4935
## Commit messages
5036

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ granted it and passes it to the tools. The token stays out of the agent.
5151
[`@corbits/oauth-core`](https://github.com/corbitsdev/corbits-oauth-core),
5252
which obtains the Google credential the hub stores.
5353

54-
## Tools
54+
## Reference
5555

5656
| Tool | Purpose |
5757
| ----------------------- | --------------------------------------------------- |

0 commit comments

Comments
 (0)