diff --git a/.agents/skills/opentui/SKILL.md b/.agents/skills/opentui/SKILL.md new file mode 100644 index 0000000..93676ad --- /dev/null +++ b/.agents/skills/opentui/SKILL.md @@ -0,0 +1,69 @@ +--- +name: opentui +description: Build terminal UIs with OpenTUI. Covers the core API, native audio, keymaps, React and Solid bindings, components, layout, keyboard input, plugins, and testing. +--- + +# OpenTUI Skill + +Canonical reference docs are authored once in sibling `docs/**/*.mdx` files. + +Inside the OpenTUI repo, this skill root lives at `packages/web/src/content/`, so the same files are also visible at `packages/web/src/content/docs/**/*.mdx`. + +## Path invariant + +- `/docs/` maps to `docs/.mdx` relative to this skill root +- in the repo, that same slug maps to `packages/web/src/content/docs/.mdx` + +## Reading order by area + +- Getting started: `/docs/getting-started` +- Core: `/docs/core-concepts/renderer` +- Audio: `/docs/core-concepts/audio` +- Keymap: `/docs/keymap/overview` +- React: `/docs/bindings/react` +- Solid: `/docs/bindings/solid` +- Components: `/docs/components/text`, `/docs/components/input` +- Layout: `/docs/core-concepts/layout` +- Keyboard: `/docs/core-concepts/keyboard` +- Plugins: `/docs/plugins/slots` +- Reference: `/docs/reference/env-vars` + +## Quick routing by intent + +| Intent(s) | Start here | +| ---------------------------------------------------------- | --------------------------------- | +| `getting-started`, `installation`, `quickstart`, `intro` | `docs/getting-started.mdx` | +| `core`, `renderer`, `terminal`, `scrollback`, `lifecycle` | `docs/core-concepts/renderer.mdx` | +| `audio`, `native-audio`, `sound`, `playback`, `pcm`, `fft` | `docs/core-concepts/audio.mdx` | +| `keymap`, `keybindings`, `shortcuts`, `commands`, `leader` | `docs/keymap/overview.mdx` | +| `layout`, `flexbox`, `yoga`, `positioning` | `docs/core-concepts/layout.mdx` | +| `keyboard`, `input`, `keybindings`, `paste`, `focus` | `docs/core-concepts/keyboard.mdx` | +| `react`, `jsx`, `hooks`, `animation`, `testing` | `docs/bindings/react.mdx` | +| `solid`, `signals`, `jsx`, `hooks`, `animation`, `testing` | `docs/bindings/solid.mdx` | +| `plugins`, `plugin`, `slots`, `registry`, `extensions` | `docs/plugins/slots.mdx` | +| `text`, `styling`, `content`, `selection` | `docs/components/text.mdx` | +| `input`, `form`, `editing`, `focus` | `docs/components/input.mdx` | +| `env`, `environment`, `configuration`, `flags` | `docs/reference/env-vars.mdx` | + +For concrete component requests, jump straight to `docs/components/.mdx` after the relevant entry page. For plugin implementation details, narrow from `docs/plugins/slots.mdx` into `docs/plugins/core.mdx`, `docs/plugins/react.mdx`, or `docs/plugins/solid.mdx`. + +## Current skill entry pages + +- `docs/getting-started.mdx` +- `docs/core-concepts/renderer.mdx` +- `docs/core-concepts/audio.mdx` +- `docs/keymap/overview.mdx` +- `docs/core-concepts/layout.mdx` +- `docs/core-concepts/keyboard.mdx` +- `docs/bindings/react.mdx` +- `docs/bindings/solid.mdx` +- `docs/plugins/slots.mdx` +- `docs/components/text.mdx` +- `docs/components/input.mdx` +- `docs/reference/env-vars.mdx` + +## Working rules + +- Prefer the current entry pages first, then read narrower docs in the same section. +- Read the sibling `docs/**/*.mdx` files directly instead of copying prose into this file. +- Use stable `/docs/...` URLs when cross-referencing docs. diff --git a/.agents/skills/opentui/config.ts b/.agents/skills/opentui/config.ts new file mode 100644 index 0000000..06059fe --- /dev/null +++ b/.agents/skills/opentui/config.ts @@ -0,0 +1,22 @@ +import { defineCollection, z } from "astro:content" + +const docs = defineCollection({ + type: "content", + schema: z.object({ + title: z.string(), + description: z.string().optional(), + order: z.number().int().nonnegative().optional(), + navTitle: z.string().optional(), + skill: z + .object({ + include: z.boolean().default(true), + entry: z.boolean().default(false), + intents: z.array(z.string().trim().min(1)).default([]), + }) + .optional(), + }), +}) + +export const collections = { + docs, +} diff --git a/.agents/skills/opentui/docs/bindings/react.mdx b/.agents/skills/opentui/docs/bindings/react.mdx new file mode 100644 index 0000000..acfa7a4 --- /dev/null +++ b/.agents/skills/opentui/docs/bindings/react.mdx @@ -0,0 +1,464 @@ +--- +title: React +description: Build terminal UIs with React and OpenTUI +order: 2 +skill: + entry: true + intents: [react, jsx, hooks, keyboard, paste, focus, blur, selection, animation, testing] +--- + +# React bindings + +Build terminal user interfaces using React with familiar patterns and components. + +## Installation + +Quick start with [bun](https://bun.sh) and [create-tui](https://github.com/msmps/create-tui): + +```bash +bun create tui --template react +``` + +Manual installation: + +```bash +bun install @opentui/react @opentui/core react +``` + +## Quick start + +```tsx +import { createCliRenderer } from "@opentui/core" +import { createRoot } from "@opentui/react" + +function App() { + return Hello, world! +} + +const renderer = await createCliRenderer() +createRoot(renderer).render() +``` + +## TypeScript configuration + +Configure your `tsconfig.json`: + +```json +{ + "compilerOptions": { + "lib": ["ESNext", "DOM"], + "target": "ESNext", + "module": "ESNext", + "moduleResolution": "bundler", + "jsx": "react-jsx", + "jsxImportSource": "@opentui/react", + "strict": true, + "skipLibCheck": true + } +} +``` + +## Runtime-loaded plugin support (if needed) + +If your app loads external TS/TSX modules at runtime (for example a file-based plugin system), import this once in your app entry before dynamic imports: + +```ts +import "@opentui/react/runtime-plugin-support" +``` + +Use this for both normal Bun runs and standalone compiled executables. + +## Components + +OpenTUI React provides JSX intrinsic elements that map to core renderables: + +### Layout & display + +- `` - Text display with styling +- `` - Container with borders and layout +- `` - Scrollable container +- `` - ASCII art text + +### Input + +- `` - Single-line text input +- `