Skip to content

AGENTS.md

112 lines · 3.5 KB · Markdown
Raw

@kody/kit — agent notes

Human setup and intent live in README.md. This file is for agents: imports, smoke/dryRun execute snippets, and edge cases. Secrets by name only — never paste key values. Do not disable live webhooks or jobs (the bundled account-health job stays enabled: false unless the operator turns it on after a fork).

Auth

LaneCredential
API keykitApiKey / kitApiKey-<purpose> → header X-Kit-Api-Key
OAuthintegration kit / kit-<purpose>

Host: api.kit.com. Multi-account: account: 'work' → kit-work / kitApiKey-work, or pass integrationName / secretName explicitly.

Import paths

ExportImport
root dispatcher (default smoke-test) + re-exportskody:@kody/kit
accountskody:@kody/kit/accounts
accountkody:@kody/kit/account
requestkody:@kody/kit/request
subscriberskody:@kody/kit/subscribers
tagskody:@kody/kit/tags
formskody:@kody/kit/forms
broadcastskody:@kody/kit/broadcasts
sequenceskody:@kody/kit/sequences
htmlkody:@kody/kit/html
smoke-testkody:@kody/kit/smoke-test
scheduled-account-healthkody:@kody/kit/scheduled-account-health
typeskody:@kody/kit/types

Prefer static kody:@kody/kit/... imports from execute. Do not lead with packages.invoke. Pass maxItems on list helpers or large accounts can exhaust the execute timeout.

Smoke test (read-only)

import smokeTest from 'kody:@kody/kit/smoke-test'

export default async function main() {
	return await smokeTest()
	// Without credentials: { ok: true, live: false, setup URLs }
	// With key/OAuth: live account + a few broadcasts — no writes
}

Equivalent via root dispatcher:

import kit from 'kody:@kody/kit'

export default async function main() {
	return await kit({ action: 'smoke-test' })
}

dryRun / confirm

Pass dryRun: true on writes to return { dryRun: true, method, path, body } without contacting Kit. Live writes throw unless confirm: true.

import { createBroadcastDraft } from 'kody:@kody/kit/broadcasts'
import { subscribeAndTag } from 'kody:@kody/kit/subscribers'

export default async function main() {
	const draftPreview = await createBroadcastDraft({
		subject: 'Workshop reminder',
		content: '<p>See you tomorrow.</p>',
		dryRun: true,
	})
	const signupPreview = await subscribeAndTag({
		email_address: 'ada@example.com',
		tagName: 'waitlist',
		dryRun: true,
	})
	return { draftPreview, signupPreview }
}

A live draft only after explicit user approval of the exact subject and body:

import { createBroadcastDraft } from 'kody:@kody/kit/broadcasts'

export default async function main() {
	return await createBroadcastDraft({
		subject: 'Workshop reminder',
		content: '<p>See you tomorrow.</p>',
		confirm: true,
	})
}

Edge cases

  • Broadcast helpers refuse send_at and send/publish statuses. There is no send-broadcast export. A human sends drafts from the returned editUrl.
  • Form ids, tag names, sender addresses, and sequence names come from the call. This package has no default list, form, or template.
  • Always pass maxItems on exploratory list helpers.
  • Errors: missing credentials → save kitApiKey or connect OAuth; 401 → approve host api.kit.com; 403 → some bulk/purchase endpoints require OAuth; timeout on lists → pass maxItems.
  • Do not enable the account-health job on the official listing; after a fork, enable only if the operator wants the weekly read.