Skip to content

Commit fce69fe

Browse files
committed
style: format with oxfmt
1 parent 4d50bc4 commit fce69fe

21 files changed

Lines changed: 667 additions & 322 deletions

‎AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Instructions for AI agents working in this repository.
1010

1111
- **Runtime:** Bun + TypeScript, ES modules only.
1212
- Touch only code related to the task.
13-
- Comment *why*, never *what*.
13+
- Comment _why_, never _what_.
1414
- No emojis in code or docs.
1515

1616
## Build & Validation

‎CLAUDE.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
Default to using Bun instead of Node.js.
32

43
- Use `bun <file>` instead of `node <file>` or `ts-node <file>`

‎package.json‎

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
{
22
"name": "@corbits/google-tools",
33
"version": "0.1.0",
4-
"type": "module",
5-
"license": "LGPL-2.1-only",
64
"description": "Corbits Google tools for Interchange, starting with Gmail.",
75
"keywords": [
86
"corbits",
9-
"google",
107
"gmail",
11-
"tools",
12-
"interchange"
8+
"google",
9+
"interchange",
10+
"tools"
1311
],
14-
"author": "Sawyer Cutler <sawyer@dirtroad.dev>",
1512
"homepage": "https://github.com/corbitsdev/google-tools#readme",
16-
"repository": {
17-
"type": "git",
18-
"url": "git+https://github.com/corbitsdev/google-tools.git"
19-
},
2013
"bugs": {
2114
"url": "https://github.com/corbitsdev/google-tools/issues"
2215
},
23-
"publishConfig": {
24-
"access": "public"
25-
},
26-
"engines": {
27-
"node": ">=24"
16+
"license": "LGPL-2.1-only",
17+
"author": "Sawyer Cutler <sawyer@dirtroad.dev>",
18+
"repository": {
19+
"type": "git",
20+
"url": "git+https://github.com/corbitsdev/google-tools.git"
2821
},
22+
"files": [
23+
"dist",
24+
"LICENSE",
25+
"README.md"
26+
],
27+
"type": "module",
28+
"sideEffects": false,
2929
"main": "./dist/index.js",
3030
"types": "./dist/index.d.ts",
3131
"exports": {
@@ -38,23 +38,9 @@
3838
"default": "./dist/sidecar-bundle.js"
3939
}
4040
},
41-
"interchange": {
42-
"tools": "./dist/sidecar-bundle.js",
43-
"credentials": [
44-
{
45-
"handle": "gmail-api",
46-
"scopes": [
47-
"https://www.googleapis.com/auth/gmail.modify"
48-
]
49-
}
50-
]
41+
"publishConfig": {
42+
"access": "public"
5143
},
52-
"files": [
53-
"dist",
54-
"LICENSE",
55-
"README.md"
56-
],
57-
"sideEffects": false,
5844
"scripts": {
5945
"typecheck": "tsc -p tsconfig.typecheck.json --noEmit",
6046
"typecheck:live": "tsc -p tsconfig.live.json --noEmit",
@@ -66,6 +52,18 @@
6652
"format": "oxfmt",
6753
"format:check": "oxfmt --check"
6854
},
55+
"dependencies": {
56+
"arktype": "^2.2.3"
57+
},
58+
"devDependencies": {
59+
"@intx/agent": "^0.3.0",
60+
"@intx/types": "^0.3.0",
61+
"@types/bun": "1.3.14",
62+
"@types/node": "22.10.5",
63+
"oxfmt": "0.70.0",
64+
"oxlint": "1.85.0",
65+
"typescript": "5.9.3"
66+
},
6967
"peerDependencies": {
7068
"@intx/agent": "*",
7169
"@intx/types": "*"
@@ -78,16 +76,18 @@
7876
"optional": true
7977
}
8078
},
81-
"devDependencies": {
82-
"@intx/agent": "^0.3.0",
83-
"@intx/types": "^0.3.0",
84-
"@types/bun": "1.3.14",
85-
"@types/node": "22.10.5",
86-
"oxfmt": "0.70.0",
87-
"oxlint": "1.85.0",
88-
"typescript": "5.9.3"
79+
"engines": {
80+
"node": ">=24"
8981
},
90-
"dependencies": {
91-
"arktype": "^2.2.3"
82+
"interchange": {
83+
"tools": "./dist/sidecar-bundle.js",
84+
"credentials": [
85+
{
86+
"handle": "gmail-api",
87+
"scopes": [
88+
"https://www.googleapis.com/auth/gmail.modify"
89+
]
90+
}
91+
]
9292
}
9393
}

‎src/client/client.test.ts‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ describe("createGmailClient", () => {
5050

5151
const client = createGmailClient({ fetchImpl });
5252
await expect(
53-
client.getMessage("message/1", { format: "metadata", metadataHeaders: [] }),
53+
client.getMessage("message/1", {
54+
format: "metadata",
55+
metadataHeaders: [],
56+
}),
5457
).resolves.toEqual({ id: "message/1" });
5558
});
5659

@@ -63,7 +66,9 @@ describe("createGmailClient", () => {
6366

6467
await expect(
6568
client.listMessages({ query: "in:inbox", pageSize: 10 }),
66-
).rejects.toThrow("Gmail API response did not match the expected list-messages shape");
69+
).rejects.toThrow(
70+
"Gmail API response did not match the expected list-messages shape",
71+
);
6772
});
6873

6974
test("rejects malformed Gmail headers", async () => {
@@ -79,14 +84,18 @@ describe("createGmailClient", () => {
7984

8085
await expect(
8186
client.getMessage("message-1", { format: "full" }),
82-
).rejects.toThrow("Gmail API response did not match the expected get-message shape");
87+
).rejects.toThrow(
88+
"Gmail API response did not match the expected get-message shape",
89+
);
8390
});
8491

8592
test("rejects an empty successful response body", async () => {
8693
const fetchImpl: GmailFetch = async () => new Response("", { status: 200 });
8794
const client = createGmailClient({ fetchImpl });
8895

89-
await expect(client.listLabels()).rejects.toThrow("response body was empty");
96+
await expect(client.listLabels()).rejects.toThrow(
97+
"response body was empty",
98+
);
9099
});
91100

92101
test("maps non-success responses to GmailApiError", async () => {

‎src/client/client.ts‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ function responseBodyError(
165165
);
166166
}
167167

168-
export function createGmailClient({ fetchImpl }: CreateGmailClientOptions): GmailClient {
168+
export function createGmailClient({
169+
fetchImpl,
170+
}: CreateGmailClientOptions): GmailClient {
169171
if (typeof fetchImpl !== "function") {
170172
throw new Error("createGmailClient: provide fetchImpl");
171173
}
@@ -206,15 +208,23 @@ export function createGmailClient({ fetchImpl }: CreateGmailClientOptions): Gmai
206208
try {
207209
raw = await response.text();
208210
} catch (cause) {
209-
throw responseBodyError(response.status, "could not read response body", cause);
211+
throw responseBodyError(
212+
response.status,
213+
"could not read response body",
214+
cause,
215+
);
210216
}
211217

212218
if (!response.ok) {
213219
throw new GmailApiError(response.status, response.statusText, raw);
214220
}
215221

216222
if (raw.length === 0) {
217-
throw responseBodyError(response.status, "response body was empty", undefined);
223+
throw responseBodyError(
224+
response.status,
225+
"response body was empty",
226+
undefined,
227+
);
218228
}
219229

220230
let parsed: unknown;
@@ -322,7 +332,9 @@ export function createGmailClient({ fetchImpl }: CreateGmailClientOptions): Gmai
322332
body: {
323333
message: {
324334
raw: options.raw,
325-
...(options.threadId === undefined ? {} : { threadId: options.threadId }),
335+
...(options.threadId === undefined
336+
? {}
337+
: { threadId: options.threadId }),
326338
},
327339
},
328340
signal: options.signal,

‎src/client/schemas.ts‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,25 @@ export type GmailThread = typeof GmailThreadSchema.infer;
7777
export const GmailDraftSchema = GmailSchemas.GmailDraft;
7878
export type GmailDraft = typeof GmailDraftSchema.infer;
7979

80-
export const GmailListThreadsResponseSchema = GmailSchemas.GmailListThreadsResponse;
81-
export type GmailListThreadsResponse = typeof GmailListThreadsResponseSchema.infer;
80+
export const GmailListThreadsResponseSchema =
81+
GmailSchemas.GmailListThreadsResponse;
82+
export type GmailListThreadsResponse =
83+
typeof GmailListThreadsResponseSchema.infer;
8284

83-
export const GmailListMessagesResponseSchema = GmailSchemas.GmailListMessagesResponse;
84-
export type GmailListMessagesResponse = typeof GmailListMessagesResponseSchema.infer;
85+
export const GmailListMessagesResponseSchema =
86+
GmailSchemas.GmailListMessagesResponse;
87+
export type GmailListMessagesResponse =
88+
typeof GmailListMessagesResponseSchema.infer;
8589

86-
export const GmailListDraftsResponseSchema = GmailSchemas.GmailListDraftsResponse;
87-
export type GmailListDraftsResponse = typeof GmailListDraftsResponseSchema.infer;
90+
export const GmailListDraftsResponseSchema =
91+
GmailSchemas.GmailListDraftsResponse;
92+
export type GmailListDraftsResponse =
93+
typeof GmailListDraftsResponseSchema.infer;
8894

89-
export const GmailListLabelsResponseSchema = GmailSchemas.GmailListLabelsResponse;
90-
export type GmailListLabelsResponse = typeof GmailListLabelsResponseSchema.infer;
95+
export const GmailListLabelsResponseSchema =
96+
GmailSchemas.GmailListLabelsResponse;
97+
export type GmailListLabelsResponse =
98+
typeof GmailListLabelsResponseSchema.infer;
9199

92100
export type GmailResponseSchema<T> = (response: unknown) => T | ArkErrors;
93101

‎src/sidecar-bundle.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ export const gmail = defineTool<GmailToolEnv>({
1313
requires: ["capabilities"],
1414
definitions: GMAIL_TOOL_CATALOG.map((definition) => ({
1515
name: definition.name,
16-
...(definition.approval === undefined ? {} : { approval: definition.approval }),
16+
...(definition.approval === undefined
17+
? {}
18+
: { approval: definition.approval }),
1719
})),
1820
factory: (env) => createGmailTools({ capabilities: env.capabilities }),
1921
});

0 commit comments

Comments
 (0)