Back to articles
rgql: AST-Aware GraphQL Refactoring That AI Agents Can Trust

rgql: AST-Aware GraphQL Refactoring That AI Agents Can Trust

via Dev.to JavaScriptYamashou

TL;DR — rgql is a CLI tool that renames GraphQL types, fields, and fragments across schema files and embedded TypeScript queries using full AST analysis. Because it's type-safe and deterministic, it's ideal for AI coding agents like Claude Code and Codex — they can invoke a single command instead of performing fragile find-and-replace across dozens of files. The Problem: Renaming in GraphQL Is Surprisingly Hard Imagine you have a User type with a firstName field, and a Product type that also has a firstName field. You want to rename User.firstName to User.fullName . A naive find-and-replace would touch both. Even a regex-aware approach struggles when the same field name appears in nested selections: query GetDashboard { user { firstName # ← should be renamed orders { product { firstName # ← should NOT be renamed } } } } Now multiply this across .graphql schema files and graphql tagged templates embedded in .ts / .tsx files. Manual refactoring is tedious and error-prone. IDE support for

Continue reading on Dev.to JavaScript

Opens in a new tab

Read Full Article
5 views

Related Articles