add-data-source
Add a new WorldMonitor data source or map layer end to end — Railway seeder, Redis seed-meta and health registration, RPC, service, layer toggle, source attribution, and docs. Use when integrating a new API or dataset, adding a seed-*.mjs worker, or adding a map layer.
SKILL.md 原文预览
Add a data source
Source: CONTRIBUTING.md#adding-data-sources. Health contracts: docs/health-endpoints.mdx.
Requirements
- Freely accessible (no paid-only API for core functionality), permissive license or public government data, updates at least daily, geo-locatable.
Steps
- Seeder (if the data is cached): a
scripts/seed-*.mjsbuilt onrunSeed(domain, resource, canonicalKey, fetchFn, opts)fromscripts/_seed-utils.mjs. SetttlSecondsto at least 3x the cron interval. Load credentials withloadEnvFile()only. The seed must writeseed-meta:<key>. Send aUser-Agent. Follow a neighbouring seeder's Railway registration inscripts/railway-services.json. - Health: register the key in
api/health.js(BOOTSTRAP_KEYS,STANDALONE_KEYS,SEED_META, orON_DEMAND_KEYS). Datasets with no dashboard consumer are standalone health keys. - Shared startup data goes through
api/bootstrap.js; opt-in panels stay on the on-demand path. - RPC: follow the
add-rpc-endpointskill (proto,make generate, handler inserver/worldmonitor/{domain}/v1/, gateway,vite.config.ts). Non-JSON payloads (XML, binary, HTML embeds) may use a standalone Edge function listed inapi/api-route-exceptions.json. - Service module in
src/services/{domain}/wrapping the generated client. - Layer config and renderer following existing layer patterns; make it toggleable in the layer UI. Panels register in
src/config/panels.tsandsrc/app/panel-layout.ts. - Every new outbound host in
scripts/,server/,api/, orsrc/needs a row inshared/source-attribution-manifest.json:npm run sources:check, thennpm run sources:generate. Add a manifest row only together with the code that introduces its host; after a rebase that touches attribution, re-runsources:generateinstead of hand-merging. - Document the source in the data sources docs (
docs/data-sources.mdx).
Verify
- Producer and reader checks with fixtures (no live network in tests). Record live freshness separately when it matters.
npm run typecheck,npm run typecheck:api,npm run lint:boundaries,npm run test:related,npm run generateif derived files changed.- Browser behavior: the
verify-worldmonitorskill.
评论
