Kind: Interface
Source: src/context.ts
Interface for context renderer.
ContextRenderer defines the contract for converting context data into rendered output. Implementations receive context from the surrounding system and return the representation consumed by the next stage.
Diagram
mermaidgraph LR Context[Context data] --> Renderer[ContextRenderer] Renderer --> Output[Rendered output]
Usage
tsimport type { ContextRenderer } from "./context";
const renderer: ContextRenderer = {
render(context) {
return JSON.stringify(context);
},
};
const renderedContext = renderer.render({
user: "Ada",
action: "create",
});
console.log(renderedContext);
AI Coding Instructions
- Implement the
rendermethod required byContextRenderer. - Keep rendering logic focused on transforming the received context into output.
- Do not mutate the input context while rendering.
- Pass renderer implementations through the integration point that consumes rendered context.
Was this page helpful?