| name | update-gql-schema |
| description | Use when updating the SDK GraphQL schema from a local or staging API server |
Update GraphQL Schema
Updates the SDK's GraphQL schema and related types from an API server instance.
Usage
/update-gql-schema local # Download from local server
/update-gql-schema staging # Download from staging server
/update-gql-schema # Will prompt for server choice
Checklist
You MUST use TodoWrite to create a todo for EACH step below. Mark each complete only after verification.
Download Schema
Update Documents
Check for New Enums
Export Input Types
Validate
IMPORTANT: Do not mark the schema update complete until build and all tests pass.
Code Patterns
Enum Definition (enums.ts)
export enum EnumName {
VALUE_ONE = 'VALUE_ONE',
VALUE_TWO = 'VALUE_TWO',
}
Scalar Binding (graphql.ts)
import type { ..., EnumName } from './enums';
scalars: {
...
EnumName: EnumName,
...
}
Input Type Export
export type InputName = ReturnType<typeof graphql.scalar<'InputName'>>;
Stop Conditions
| Condition | Action |
|---|
| Schema download fails | Check if server is running, verify URL |
pnpm check fails | Fix document errors before proceeding |
| Build fails | Fix TypeScript errors, re-run build until it passes |
| Tests fail | Investigate and fix failing tests, re-run until all pass |
Never mark the schema update as complete while build errors or test failures exist. The iterative fix-and-verify loop is mandatory.
Common Mistakes
- Creating type exports for enums — Enums are both values and types; don't use
ReturnType<typeof graphql.scalar<'EnumName'>>
- Adding new queries/mutations without being asked — Only update existing documents unless explicitly requested
- Forgetting scalar bindings — Every input type needs a corresponding entry in
graphql.ts
- Non-alphabetical ordering — Scalar bindings should be alphabetically ordered
- Missing JSDoc comments — All enums should have documentation
- Marking complete with failing build/tests — Always run
pnpm build and pnpm test --run and fix all errors before marking complete