Aalexbit-codemod

ag-ui-compliance

Migrate TanStack AI client APIs to AG-UI-compliant field names

tanstacktanstack-aiag-uimigrationtransformation
Public
1 executions

Run locally

npx codemod ag-ui-compliance

ag-ui-compliance

Migrates TanStack AI client code to AG-UI–compliant field names.

BeforeAfter
useChat({ body: {...} })useChat({ forwardedProps: {...} })
new ChatClient({ body: {...} })new ChatClient({ forwardedProps: {...} })
client.updateOptions({ body: {...} })client.updateOptions({ forwardedProps: {...} })
chat.updateBody(x) (Svelte)chat.updateForwardedProps(x)
chat({ conversationId: x })chat({ threadId: x })

Origin gating uses JSSG semantic analysis (definition()), so this covers cases the jscodeshift port misses:

  • Import aliasesimport { useChat as useAiChat } from '@tanstack/ai-react'
  • Barrel re-exportsexport { useChat } from '@tanstack/ai-react' then import from ./ai

Svelte updateBody is only renamed on method calls (chat.updateBody(...)), not bare property accesses (const fn = chat.updateBody) — safer than the jscodeshift port, which rewrote every matching member expression.

If both legacy and canonical keys are already present, the call is left alone and a warning is printed.

Run

bash

Development

bash

License

MIT

Ready to contribute?

Build your own codemod and share it with the community.