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

  1. Detect package manager (pnpm, yarn, bun, npm) via lockfiles and npm_execpath.
  2. Copy templates/base/* into the current frontend folder.
  3. 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.json from embedded sample context.
  • Creates temporary .flowbox-dev/vite.config.js and runtime index.html with component substitution.
  • Cleans temporary files on SIGINT/SIGTERM.

[WARNING!schedule/INDEX HTML SIDE EFFECT] If no index.html existed, start creates 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>.html for each component.

Reference

  • sdk/config/flowbox-ui/cli/index.js
  • sdk/config/flowbox-ui/templates/base/package.json
  • sdk/config/flowbox-ui/templates/dev/index.html