morphscreen
v0.1.1
Published
Set MorphScreen up in your app with one command, and check it: npx morphscreen init writes a route that keeps your key on the server and a chat page whose answers are drawn as UI while they stream; npx morphscreen doctor says what's wrong and how to fix i
Maintainers
Readme
morphscreen
Set MorphScreen up in your app with one command, then check it. MorphScreen lets a model answer with UI (cards, charts, tables, forms, quizzes and your own components), checked line by line and drawn while it streams.
npx morphscreen initIn a Next.js app with the App Router, that:
- installs
@morphscreen/webwith your package manager - writes
app/api/morphscreen/route.ts, which adds your key on the server and streams the answer back - writes a chat page at
/morphscreen(app/morphscreen/page.tsxandchat.tsx) - writes
scripts/copy-morphscreen-core.mjsand runs it beforedevandbuild, so the WebAssembly core is inpublic/ - adds
MORPHSCREEN_KEY=to.env.localfor your key
It never overwrites a file that's already there, asks nothing, and is safe to run twice. Put your key in .env.local (free, no card), start the app and open /morphscreen.
Other frameworks aren't set up by init yet. It says which guide to follow instead: React, Vue, Svelte, Angular, or any page.
npx morphscreen doctorChecks the SDK's version, the core in public/, the stylesheet import, the server route, the key (set, the right shape, never NEXT_PUBLIC_, never in browser code), a content security policy that blocks WebAssembly, whether the API is up and whether it takes your key. Each problem comes with its fix. --offline skips npm and the API.
Both take --json, for scripts and coding agents. The exit code is 0 when everything's fine and 1 otherwise.
Apache-2.0. Source: sdk/cli.
