AGENTS.md
106 lines · 3.0 KB · Markdown@kentcdodds/twitch — agent notes
Human setup and intent live in README.md. This file is for
agents: imports, smoke checks, snippets, and edge cases. Secrets / integration
ids by name only — never paste token values. Do not disable live webhooks
or jobs.
Auth / integration
| Name | Kind | Notes |
|---|---|---|
twitch | OAuth integration | Authorization + Client-Id for Helix |
Reconnect: /connect/oauth?provider=twitch. Host: api.twitch.tv.
Package constant: TWITCH_INTEGRATION = "twitch".
Import paths
| Export | Import |
|---|---|
| overview | kody:@kentcdodds/twitch |
| get-me | kody:@kentcdodds/twitch/get-me |
| get-stream | kody:@kentcdodds/twitch/get-stream |
| list-chatters | kody:@kentcdodds/twitch/list-chatters |
| send-chat-message | kody:@kentcdodds/twitch/send-chat-message |
| update-channel-info | kody:@kentcdodds/twitch/update-channel-info |
| request | kody:@kentcdodds/twitch/request |
| smoke-test | kody:@kentcdodds/twitch/smoke-test |
| guide | kody:@kentcdodds/twitch/guide |
| scopes | kody:@kentcdodds/twitch/scopes |
| types | kody:@kentcdodds/twitch/types |
Prefer static kody:@kentcdodds/twitch/... imports from execute. Do not lead
with packages.invoke.
Smoke test (read-only)
import smokeTest from 'kody:@kentcdodds/twitch/smoke-test'
export default async function main() {
return await smokeTest()
// => { ok: true, login, displayName, stream: { isLive, ... } }
}Optional read-only follow-ups:
import getMe from 'kody:@kentcdodds/twitch/get-me'
import getStream from 'kody:@kentcdodds/twitch/get-stream'
export default async function main() {
const me = await getMe()
const [stream] = await getStream({ login: me.login })
return { me, stream }
}Common snippets
Send chat (mutates — only when explicitly requested):
import sendChatMessage from 'kody:@kentcdodds/twitch/send-chat-message'
export default async function main() {
return await sendChatMessage({
broadcasterLogin: 'kentcdodds',
message: 'Hello chat!',
})
}Update title / game (mutates):
import updateChannelInfo from 'kody:@kentcdodds/twitch/update-channel-info'
export default async function main() {
return await updateChannelInfo({
title: 'Building with Kody',
gameName: 'Software and Game Development',
})
}Raw Helix escape hatch:
import request from 'kody:@kentcdodds/twitch/request'
export default async function main() {
return await request({ path: '/users', throwOnError: true })
}Edge cases
- Chat messages must be non-empty and ≤500 characters.
list-chattersneedsmoderator:read:chatters(included in default scopes).- Default connect scopes are broad (
TWITCH_DEFAULT_SCOPES); fall back toTWITCH_MINIMAL_STREAM_SCOPESvia./scopes/getConnectUrl({ scopes })if Twitch rejects breadth. - Prefer
./smoke-testor./get-mebefore any chat or channel mutation. - Never paste OAuth token values into chat or logs.