Skip to content

AGENTS.md

125 lines · 3.6 KB · Markdown
Raw

@kody/netlify — 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 token values. Do not disable or enable live jobs unless the operator asks — the bundled site-status job stays enabled: false unless they turn it on after a fork.

Secrets

NamePurpose
netlifyTokenDefault PAT (user scope); host api.netlify.com
netlifyToken-<label>Extra account via account: "<label>" or secretName

Import paths

ExportImport
root dispatcher (default smoke-test)kody:@kody/netlify
requestkody:@kody/netlify/request
get-userkody:@kody/netlify/get-user
list-accountskody:@kody/netlify/list-accounts
list-siteskody:@kody/netlify/list-sites
get-sitekody:@kody/netlify/get-site
list-deployskody:@kody/netlify/list-deploys
get-deploykody:@kody/netlify/get-deploy
create-deploykody:@kody/netlify/create-deploy
restore-deploykody:@kody/netlify/restore-deploy
list-env-varskody:@kody/netlify/list-env-vars
create-env-varkody:@kody/netlify/create-env-var
list-formskody:@kody/netlify/list-forms
list-form-submissionskody:@kody/netlify/list-form-submissions
smoke-testkody:@kody/netlify/smoke-test
scheduled-statuskody:@kody/netlify/scheduled-status

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

Smoke test (read-only)

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

export default async function main() {
	return await smokeTest()
	// Without netlifyToken: { ok: true, live: false, setup URLs }
	// With token: trimmed /user profile — no writes
}

Equivalent via root dispatcher:

import netlify from 'kody:@kody/netlify'

export default async function main() {
	return await netlify({ dryRun: true })
}

Read-only list:

import listSites from 'kody:@kody/netlify/list-sites'

export default async function main() {
	return await listSites({ per_page: 20 })
}

dryRun / confirm

Pass dryRun: true on create-deploy, restore-deploy, create-env-var, and mutating request calls to return { dryRun: true, method, path, body } without contacting Netlify. Those writes also throw unless confirm: true.

import createDeploy from 'kody:@kody/netlify/create-deploy'

export default async function main() {
	return await createDeploy({
		site: 'example-site',
		draft: true,
		dryRun: true,
	})
}
import restoreDeploy from 'kody:@kody/netlify/restore-deploy'

export default async function main() {
	return await restoreDeploy({
		site: 'example-site',
		deploy: 'deploy_123',
		dryRun: true,
	})
}
import createEnvVar from 'kody:@kody/netlify/create-env-var'

export default async function main() {
	return await createEnvVar({
		accountId: 'acme',
		site: 'example-site',
		key: 'EXAMPLE_FLAG',
		value: '1',
		dryRun: true,
	})
}

Edge cases

  • Env-var listing never returns values; dry-run create redacts value.
  • Never set production: true on create-deploy or restore production unless the caller explicitly confirmed that target.
  • Site ids, team slugs, and form ids come from the call — nothing is hard-coded.
  • Do not enable the site-status job on the official listing; after a fork, enable only if the operator wants the periodic read.
  • Fork/adapt: save your own netlifyToken; do not point at a shared platform store. Keep dryRun / confirm guards.