Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ jobs:
- name: Install dependencies
run: bun ci

- name: Build Agent SDK package
run: bun run build:agent-sdk
- name: Run codegen
run: bun run --cwd apps/agent codegen

- name: Run Typecheck
run: bun run typecheck
env:
NODE_OPTIONS: --max-old-space-size=4096
2 changes: 1 addition & 1 deletion apps/agent/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ VITE_PUBLIC_SENTRY_DSN=
# BrowserOS API URL
VITE_PUBLIC_BROWSEROS_API=https://api.browseros.com

# GraphQL Schema Path
# GraphQL Schema Path (optional — falls back to schema/schema.graphql)
GRAPHQL_SCHEMA_PATH=

# Sentry build (source maps)
Expand Down
8 changes: 8 additions & 0 deletions apps/agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ SENTRY_PROJECT=your-project
SENTRY_AUTH_TOKEN=your-token
```

### GraphQL Schema

Codegen requires a GraphQL schema. By default it uses the bundled `schema/schema.graphql`, so no extra setup is needed. If you have access to the original API source, you can set the following environment variable

```env
GRAPHQL_SCHEMA_PATH=/path/to/api-repo/.../schema.graphql
```

## Scripts

| Script | Description |
Expand Down
10 changes: 6 additions & 4 deletions apps/agent/codegen.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { existsSync } from 'node:fs'
import path from 'node:path'
import { includeIgnoreFile } from '@eslint/compat'
import type { CodegenConfig } from '@graphql-codegen/cli'

// biome-ignore lint/style/noProcessEnv: env needed for codegen config
const env = process.env

const schemaPath = env.GRAPHQL_SCHEMA_PATH
if (!schemaPath) {
const schemaPath =
env.GRAPHQL_SCHEMA_PATH ?? path.resolve(__dirname, 'schema/schema.graphql')
if (!existsSync(schemaPath)) {
throw new Error(
'GRAPHQL_SCHEMA_PATH is not set. Set it in .env.development to the local path of:\n' +
'https://github.com/browseros-ai/BrowserOS-workers/blob/main/apps/api/src/modules/graphql/schema.graphql',
'No schema found. Either set GRAPHQL_SCHEMA_PATH in .env.development ' +
'or ensure schema/schema.graphql exists',
)
}

Expand Down
Loading
Loading