diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 00000000..dc2220dd --- /dev/null +++ b/examples/README.md @@ -0,0 +1,26 @@ +# jcode-ui examples + +Cloneable starters for the React chat component library. + +| Example | Port | Pattern | +|---------|------|---------| +| [jcode-ui-minimal](./jcode-ui-minimal) | 5177 | `createMockRuntime` only — fastest start | +| [jcode-ui-zustand](./jcode-ui-zustand) | 5178 | `createExternalStoreRuntime` + Zustand | + +## Prerequisites + +```bash +cd packages/jcode-ui-core && pnpm build +cd ../jcode-ui && pnpm build +``` + +Each example is a **standalone pnpm workspace** (`ignore-workspace` via `.npmrc`) using +`file:../../packages/jcode-ui`, so installs stay local and always link monorepo packages. + +If pnpm blocks esbuild postinstall, the example `pnpm-workspace.yaml` already allows it. + +## Docs + +- https://www.j-code.net/chat-ui/docs +- https://www.j-code.net/chat-ui/docs/installation +- https://www.j-code.net/chat-ui/docs/guides/external-store diff --git a/examples/jcode-ui-minimal/.gitignore b/examples/jcode-ui-minimal/.gitignore new file mode 100644 index 00000000..596a78df --- /dev/null +++ b/examples/jcode-ui-minimal/.gitignore @@ -0,0 +1,4 @@ +node_modules +dist +pnpm-lock.yaml +*.tsbuildinfo diff --git a/examples/jcode-ui-minimal/.npmrc b/examples/jcode-ui-minimal/.npmrc new file mode 100644 index 00000000..de14fd9a --- /dev/null +++ b/examples/jcode-ui-minimal/.npmrc @@ -0,0 +1 @@ +ignore-workspace=true diff --git a/examples/jcode-ui-minimal/README.md b/examples/jcode-ui-minimal/README.md new file mode 100644 index 00000000..f756da68 --- /dev/null +++ b/examples/jcode-ui-minimal/README.md @@ -0,0 +1,30 @@ +# jcode-ui minimal example + +Drop-in chat UI with **`createMockRuntime`** — no backend, no store library. + +## Run + +From the monorepo root (packages must be built first): + +```bash +# once +cd packages/jcode-ui-core && pnpm build +cd ../jcode-ui && pnpm build + +cd ../../examples/jcode-ui-minimal +pnpm install +pnpm dev +``` + +Open http://localhost:5177 + +## What it shows + +- `Thread` + `ChatInput` +- Default tool registry (seeded with one `execute` card) +- Interactive send → fake assistant echo + +## Next + +- Wire a real store: see [`../jcode-ui-zustand`](../jcode-ui-zustand) +- Docs: https://www.j-code.net/chat-ui/docs diff --git a/examples/jcode-ui-minimal/index.html b/examples/jcode-ui-minimal/index.html new file mode 100644 index 00000000..c25f6918 --- /dev/null +++ b/examples/jcode-ui-minimal/index.html @@ -0,0 +1,12 @@ + + +
+ + +
- {target}
-
- )}
- {approval.is_external && (
-
- external
+
+ {target}
+
+ ) : null}
- )}
+ {prettyArgs(approval.tool_args)}
+
+ {prettyArgs(approval.tool_args)}