Store

codemode-gatewaysourcetypescript
Path: codemode-gateway/src/snippets/store.tsRelative: src/snippets/store.tsSubproject: codemode-gatewayCategory: codemode-gateway
Lines: 137Bytes: 4,804Imports: 2Exports: 6

Content Preview

  1. import { normalizeCode } from "@cloudflare/codemode";
  2. import type { Env, Snippet, SnippetSummary } from "../types";
  3. /**
  4. * The gateway-native snippet store over the `SNIPPETS` KV namespace
  5. * (per ADR-2026-07-10-codemode-snippets-kv-not-runtime). Snippets are the
  6. * gateway's "procedural memory": named, described, discoverable sandbox
  7. * scripts that already ran and worked. The store owns name validation and the
  8. * canonicalization step; `codemode.run` (in `src/registry.ts`) owns execution.
  9. *