# Wisp developer reference API example tasks ## Goal Compile and run a Wisp-style Wasm API for Cloudflare Workers that serves a small developer reference catalog. ## Milestone 1: acceptance shape - [ ] Add `examples/wisp_static_api/` with `gleam.toml`, source layout, and a minimal JS host adapter. - [ ] Include initial datasets for gitignore, gitattributes, licenses, SPDX, MIME types, HTTP status codes, languages, and cron presets. - [ ] Define routes, exported functions, and host imports in a short ABI note. - [ ] Add a compile-only fixture that captures the first unsupported compiler diagnostic. ## Milestone 2: dependency support - [ ] Load enough dependency metadata for Wisp and direct support packages. - [ ] Support dependency module interfaces used by routing, request parsing, and response construction. - [ ] Report unsupported dependency and ABI shapes with source spans. - [ ] Add tests for cross-module route helpers and dependency imports. ## Milestone 3: bundler-profile JS host - [ ] Configure the example to use the JS host bundler profile. - [ ] Start with string request inputs and string or tagged response outputs. - [ ] Add adapter helpers for status, headers, and body data when needed. - [ ] Add a Gleam route table fixture that returns tagged response data without platform-specific request or response handles. - [ ] Validate that unsupported request or response handles fail before emit. ## Milestone 4: static data - [ ] Decide whether static data is handwritten Gleam or generated Gleam. - [ ] Keep generated sources deterministic and reviewable. - [ ] Implement list and detail routes for gitignore templates. - [ ] Implement list and detail routes for gitattributes templates. - [ ] Implement list and detail routes for licenses and SPDX metadata. - [ ] Implement lookup routes for MIME types and HTTP status codes. - [ ] Implement list and detail routes for languages and cron presets. - [ ] Add not-found and bad-request responses. - [ ] Add tests for route matching and returned data. ## Milestone 5: deployable JS host - [ ] Add minimal bundler-profile JS glue that loads the Wasm module and forwards request data. - [ ] Document local development and deployment commands. - [ ] Add a smoke test for bundler-profile request handling where practical. - [ ] Ensure the emitted Wasm artifact path is stable for the host adapter. ## Milestone 6: regression coverage - [ ] Add a compile fixture for the full static API example. - [ ] Snapshot import/export metadata for the bundler-profile Wasm. - [ ] Add diagnostics tests for unsupported bundler-profile ABI shapes. - [ ] Keep unsupported follow-up work recorded in the active task file. ## Done when The example builds from its project directory, can be called by a Cloudflare Worker host, and returns static data without custom manual memory handling in the host.