Skip to content

AGENTS.md

104 lines · 3.4 KB · Markdown
Raw

@kentcdodds/producthunt — agent notes

Human setup and intent live in README.md. This file is for agents: imports, smoke execute snippets, and edge cases. Auth is the saved OAuth integration named producthunt — never paste tokens. Do not disable live webhooks or jobs.

Auth / integration

ItemValue
Integration nameproducthunt
Reconnecthttps://kody.codes/connect/oauth?provider=producthunt (or ./guide)
GraphQLhttps://api.producthunt.com/v2/api/graphql
Approved hostapi.producthunt.com

OAuth-managed secret names (do not paste values): producthuntAccessToken, producthuntClientSecret.

Pass integration on helpers only when the saved connection is not named producthunt.

Import paths

ExportImport
overviewkody:@kentcdodds/producthunt
typeskody:@kentcdodds/producthunt/types
requestkody:@kentcdodds/producthunt/request
smoke-testkody:@kentcdodds/producthunt/smoke-test
guidekody:@kentcdodds/producthunt/guide
get-viewerkody:@kentcdodds/producthunt/get-viewer
get-userkody:@kentcdodds/producthunt/get-user
get-postkody:@kentcdodds/producthunt/get-post
list-postskody:@kentcdodds/producthunt/list-posts
list-commentskody:@kentcdodds/producthunt/list-comments
get-collectionkody:@kentcdodds/producthunt/get-collection
list-collectionskody:@kentcdodds/producthunt/list-collections
get-topickody:@kentcdodds/producthunt/get-topic
list-topicskody:@kentcdodds/producthunt/list-topics

Prefer static kody:@kentcdodds/producthunt/... imports from execute. Do not lead with packages.invoke.

Smoke test (read-only)

import smokeTest from 'kody:@kentcdodds/producthunt/smoke-test'

export default async function main() {
	return await smokeTest()
	// => { ok: true, viewer: { username }, featuredPost: { slug } }
}

Connect URL / setup metadata (no Product Hunt call beyond local guide):

import guide from 'kody:@kentcdodds/producthunt/guide'

export default async function main() {
	return await guide()
}

Common read snippets

import listPosts from 'kody:@kentcdodds/producthunt/list-posts'
import getPost from 'kody:@kentcdodds/producthunt/get-post'
import getViewer from 'kody:@kentcdodds/producthunt/get-viewer'

export default async function main() {
	const featured = await listPosts({ featured: true, first: 5, order: 'RANKING' })
	const post = await getPost({ slug: 'clara-ai-sdr' })
	const me = await getViewer()
	return { featured, post, me }
}

Generic GraphQL escape hatch:

import request from 'kody:@kentcdodds/producthunt/request'

export default async function main() {
	return await request({
		query: `query TopicBySlug($slug: String!) {
			topic(slug: $slug) { id name slug }
		}`,
		variables: { slug: 'developer-tools' },
	})
}

Edge cases

  • Page sizes are clamped to 1–20.
  • get-viewer needs private scope; featured lists work with public.
  • There is no Product Hunt OpenAPI surface — transport is createAuthenticatedFetch('producthunt') against the GraphQL endpoint.
  • Prefer dedicated helpers over hand-written GraphQL when one exists.
  • Write mutations via request need Product Hunt app approval + write scope.
  • Never paste Product Hunt OAuth tokens or client secrets into chat or logs.