CLI Commands (init, add, start, update)
flowbox-ui CLI behavior is implemented in sdk/config/flowbox-ui/cli/index.js.
Command reference
| Command | What it does | Key implementation details |
|---|---|---|
flowbox-ui init |
Initializes frontend harness | Copies templates/base, detects package manager from lockfiles/env, installs Svelte/Vite/toolkit deps. |
flowbox-ui add <name> |
Adds one config UI component | Creates src/<name>/main.js + ConfigForm.svelte from templates. |
flowbox-ui start <name> |
Runs local dev harness | Creates src/<name>/test/config.json if missing, writes temporary index.html, starts Vite with HMR. |
flowbox-ui update [name] |
Refreshes template files after upgrades | Replaces vite.config.js, vite.config.dev.js, and regenerates index*.html files depending on component count. |
init flowbox-init behavior in detail
- Detect package manager (
pnpm,yarn,bun,npm) via lockfiles andnpm_execpath. - Copy
templates/base/*into the current frontend folder. - Install required deps (
svelte,@sveltejs/vite-plugin-svelte,vite,mitt, toolkit package).
[NOTE!lightbulb/PM DETECTION] If no lockfile/execpath signal is found, the CLI prompts for package manager and defaults to
npm.
start harness behavior
- Requires
src/<name>/to exist. - Auto-creates
src/<name>/test/config.jsonfrom embedded sample context. - Creates temporary
.flowbox-dev/vite.config.jsand runtimeindex.htmlwith component substitution. - Cleans temporary files on SIGINT/SIGTERM.
[WARNING!schedule/INDEX HTML SIDE EFFECT] If no
index.htmlexisted,startcreates one and removes it on exit. If one existed, it is left in place.
update for multi-component projects
- 0 components: writes
index.template.html. - 1 component: writes
index.html. - Multiple components: writes
index.<name>.htmlfor each component.
Reference
sdk/config/flowbox-ui/cli/index.jssdk/config/flowbox-ui/templates/base/package.jsonsdk/config/flowbox-ui/templates/dev/index.html