Skip to content
← Public packages

@kentcdodds/environment

Weather, air quality, sun/moon, and outdoor environment snapshots.

AGENTS.md

85 lines · 2.6 KB · Markdown

@kentcdodds/environment — agent notes

Human setup and intent live in README.md. This file is for agents: imports, smoke checks, and edge cases. No user secrets. Do not disable live webhooks or jobs.

Secrets

None. Uses public Open-Meteo and Nominatim. Durable caches: weatherCache, forecastHistory in packageStorage.

Import paths

ExportImport
overview + AQI helperskody:@kentcdodds/environment
air-qualitykody:@kentcdodds/environment/air-quality
elevationkody:@kentcdodds/environment/elevation
forecast-historykody:@kentcdodds/environment/forecast-history
moonkody:@kentcdodds/environment/moon
snapshotkody:@kentcdodds/environment/snapshot
sunkody:@kentcdodds/environment/sun
weatherkody:@kentcdodds/environment/weather
weather-geocodekody:@kentcdodds/environment/weather-geocode

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

Named root helpers: getAirQuality, getHomeAirQuality, summarizeAirQuality, HOME_AIR_QUALITY_LOCATION.

Smoke test (read-only)

import { summarizeAirQuality } from 'kody:@kentcdodds/environment'

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

Combined outdoor snapshot:

import environmentSnapshot from 'kody:@kentcdodds/environment/snapshot'

export default async function main() {
	return await environmentSnapshot({ location: 'Highland, UT' })
}

Moon (no external API):

import moon from 'kody:@kentcdodds/environment/moon'

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

Geocode then weather:

import weatherGeocode from 'kody:@kentcdodds/environment/weather-geocode'
import weather from 'kody:@kentcdodds/environment/weather'

export default async function main() {
	const place = await weatherGeocode({ location: 'Denver, CO' })
	return await weather({ latitude: place.latitude, longitude: place.longitude })
}

Edge cases

  • Snapshot sections fail independently — a bad upstream yields { error } for that section, not a thrown whole-call failure.
  • Weather uses packageStorage cache when live Open-Meteo is degraded; do not reintroduce oversized user-value caches (retired 2026-07-27).
  • Default home AQI location is Highland, UT — always pass location / coordinates when the caller is not that household.
  • Moon is local synodic-cycle math (accurate within several hours); no API.
  • Venstar thermostats are indoor temp/humidity only — outdoor AQI is this package, not Venstar.
  • Formerly @kentcdodds/environment-lookups; prefer this package id/name.