Generate Modular Architecture Logic
ink_generate_script_logicGenerate zero-dependency JavaScript or TypeScript modules for state stores, event buses, scroll observers, theme toggles, and form validators, with built-in memory cleanup and error boundaries.
Instructions
PURPOSE: Generate zero-dependency, memory-safe JavaScript and TypeScript architectural modules (State Store, Event Bus, Intersection Scroll Observer, Theme Switcher, Form Validator) with production error boundaries.
BEHAVIOR: Synthesizes modular ES6+ JavaScript and optional TypeScript declarations purely in-memory. Zero filesystem modifications. All generated code enforces memory cleanup paradigms (explicit unsubscribe functions, WeakMap caching, EventTarget/listener teardown).
USAGE GUIDELINES:
When to use: Use when creating application state management, event-driven decoupled messaging, viewport scroll animators, theme togglers, or accessible form validation.
When NOT to use: Do NOT use to render UI elements or write component styling (use ink_craft_component instead) or WebGL graphics (use ink_build_threejs_experience instead).
Alternatives: Use ink_craft_component for visual UI components; use ink_build_threejs_experience for 3D canvas rendering.
RETURNS: ResultEnvelope containing zero-dependency ES module 'code', optional 'typescriptTypes', architectural pattern documentation, and executable 'usageExample'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pattern | No | Architectural runtime pattern: 'state-store' (pub/sub state container), 'event-bus' (typed decoupled messaging), 'scroll-observer' (IntersectionObserver animator), 'theme-toggle' (dark/light/system theme switcher with persistence), 'form-validator' (real-time accessible field validation) | state-store |
| moduleName | No | Name of the exported JavaScript/TypeScript class or module | AppStore |
| typescript | No | When true, emits strict TypeScript interfaces and generic typings alongside the implementation |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | Domain-specific typed payload returned by the tool | |
| status | Yes | Execution outcome status | |
| summary | Yes | Concise, human-readable executive summary of the tool outcome | |
| evidence | No | Audit trail, source references, and generated artifact locations | |
| warnings | Yes | Operational cautions, craft advice, or non-blocking warnings | |
| nextActions | No | Actionable sequential recommendations or subsequent tool suggestions |