Problem
generateRoutes currently emits handler bodies as plain strings, requiring manual paste or eval at the consumer site. This is incompatible with typed Cloudflare Workers frameworks.
FoodFiles uses Hono with a typed app environment (Hono<AppEnv>). String-emitted handlers:
- Cannot be type-checked by tsc
- Cannot be composed with
AppEnv generics (bindings, variables)
- Cannot be tree-shaken or statically analyzed by bundlers
This blocks any automated route wiring for phase-0 consumers and makes generateRoutes unusable in a typed Hono project.
Acceptance Criteria
Context
FoodFiles is the designated phase-0 consumer for @stackbilt/contracts. The pantry and recipe routes are the primary integration targets. Without typed route generation, the contract layer cannot replace the hand-rolled Zod schemas in services/pantry.ts and services/recipe.ts.
Ref: CONTRACT-1 gap analysis (phase-0 integration audit)
Problem
generateRoutescurrently emits handler bodies as plain strings, requiring manual paste or eval at the consumer site. This is incompatible with typed Cloudflare Workers frameworks.FoodFiles uses Hono with a typed app environment (
Hono<AppEnv>). String-emitted handlers:AppEnvgenerics (bindings, variables)This blocks any automated route wiring for phase-0 consumers and makes
generateRoutesunusable in a typed Hono project.Acceptance Criteria
generateRoutesreturns importable route handler functions (or a Hono router instance) instead of stringsEnvgeneric so consumers can passHono<AppEnv>context throughtoHonoRouter<Env>(contract, handlers)helper (or equivalent) is exported from the packagetsc --strictin an isolated test fixturegenerateRoutesstring-output API is deprecated with a migration note in the changelogContext
FoodFiles is the designated phase-0 consumer for
@stackbilt/contracts. The pantry and recipe routes are the primary integration targets. Without typed route generation, the contract layer cannot replace the hand-rolled Zod schemas inservices/pantry.tsandservices/recipe.ts.Ref: CONTRACT-1 gap analysis (phase-0 integration audit)