Improve DX for Schema & System Prompt Generation Across Backends

オープン
#368 コメント 3 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@AbhinRustagi がすでに取り組んでいます。

2026年4月15日 から。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
react, typescript, vite

調査の方向性

Start by reading the existing defineComponent() schema and renderer workflow, then inspect the library entry point specified in the issue (./src/library.ts) and how library.prompt() and library.toJSONSchema() are used. The proposed starting point is a Vite plugin configured in vite.config.ts; done means the build generates system-prompt.txt and schema.json in the configured output directory.

索引モデルが issue の本文から書いたものです。

説明

enhancement

Is your feature request related to a problem?

The current schema + prompt generation workflow is tightly coupled to React:

  • Schema and renderers are bundled together in defineComponent(). The backend only needs the schema (names, props, descriptions), but the CLI must import React and all component deps just to extract it.
  • CLI breaks outside React — doesn't work for Vue/Svelte frontends, React Native (can't resolve native imports), or non-JS backends (Python, Go) without a separate Node build step.
  • React Native workaround is fragile. Docs recommend maintaining two mirror library files (real renderers + null renderers). Any drift silently breaks GenUI with no automated check.

Describe the solution you'd like

Bundler plugins that generate system-prompt.txt and schema.json as build artifacts during the frontend build.

Since the frontend build already has React, Zod, and all component deps resolved, we hook into it to extract the schema — no separate CLI step, no manual sync.

Starting with Vite

// vite.config.ts
import { openuiPlugin } from "@openuidev/vite-plugin";
 
export default defineConfig({
  plugins: [
    openuiPlugin({
      library: "./src/library.ts",
      outDir: "../backend/generated",
    }),
  ],
});

The plugin calls library.prompt() and library.toJSONSchema() during build, writes the output files. Any backend (Python, Go, etc.) reads the plain files — no Node dependency.

Scaling to other bundlers

Use unplugin to write the logic once and compile to Vite, webpack, esbuild, and Rollup from a single codebase. For Metro (React Native), a dedicated plugin would eliminate the dual-library workaround entirely.

** Describe alternatives you've considered **

Dual library files (current React Native approach): Two mirror files with identical schemas — one with real renderers, one with () => null for the CLI. Works today but manual sync is fragile, scales poorly, and feels like a workaround rather than a solution.

主要言語
TypeScript
スター
10k
フォーク
698
平均マージ
1日 6時間
マージ済み PR(30日)
148

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

thesysdev/openui のほかの issue

thesysdev/openui の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。