remix_cli 1.0.0-beta.1
remix_cli: ^1.0.0-beta.1 copied to clipboard
Install editable Remix design-system source into Flutter applications.
remix_cli #
See pinned GitHub registries for namespaces, revision updates, migration, and independent registry releases.
remix_cli installs editable component source into a Flutter application.
Choose a preset offered by your pinned registry. The official catalog serves
vanilla and fortal; the beta.14 catalog adds the HeroUI-inspired heroui
preset after its registry promotion. Remix remains the behavior dependency; the
application owns its tokens, theme values, component recipes, and generated
adapters.
The Vanilla and Fortal catalogs include an opt-in icons seam and cover the
core Remix component surface: accordion, app_bar, avatar, badge, button, callout, card,
checkbox, data_list, data_table, dialog, disclosure, divider,
icon_button, link, menu, popover, progress, radio,
segmented_control, select, sidebar, sidebar_layout, skeleton,
slider, spinner, switch, tabs, textfield, toast, toggle,
toggle_group, and tooltip, each with a theme dependency. The Fortal
preset also includes base_button, code, heading, kbd, text, and
typography. The data_table item uses checkbox, icon_button, and
select for its controls; toast uses button and icon_button for its
action and close control. The default sidebar item uses the application's
toggle recipe for destinations. sidebar_layout is a plain shell layout
with no Spec or generated adapter: it composes an installed sidebar into
a row above its compact breakpoint and a start-edge sheet below it.
The grouped dashboard_shell recipe builds on those pieces with host-owned
navigation, page content, optional search, and brand/account/action slots. It
has no generated adapter and does not install charts, tables, Agent surfaces,
or an application entry point.
The catalog also offers chart as an optional extension over
mix_chart; it does not depend on remix_fortal. Registry content is published independently on GitHub and pinned in remix.yaml.
Registry updates change pins only; installed source remains application-owned.
Commit remix.ownership.json with the configuration and installed source.
Target ownership is checked across separate installs; overlapping registries
are rejected even with --overwrite. Existing installations without ownership
records require verified, explicit add theme button --adopt migration; see
legacy ownership migration.
The heroui preset follows HeroUI's names, adding alert, avatar_group,
breadcrumbs, button_group, checkbox_group, chip, close_button,
dropdown, field_layout, input_group, modal, radio_group,
search_field, separator, surface, switch_group, table, textarea,
toggle_button, and toggle_button_group to shared names such as button and
select.
The Vanilla and Fortal presets additionally distribute the unstyled Agent items:
activity, answer, composer, execution, message, permission, plan,
and transcript, with shared models and support dependencies. These are
application-owned source, not a dependency on the private authoring source.
Each surface has an opt-in <component>_recipe item that installs a complete,
preset-specific styler bundle under lib/ui/recipes/; bare components remain
unstyled and backward compatible.
Install project-locally #
The CLI requires Flutter 3.44 or later (Dart 3.12). With an older SDK, adding the dependency fails during version solving.
A project-local development dependency is preferred because the app's lockfile
pins the CLI version; remix.yaml separately pins registry content:
flutter pub add 'dev:remix_cli:^1.0.0-beta.1'
dart run remix_cli:remix init --prefix Acme --preset fortal
dart run remix_cli:remix add button
Select the prerelease explicitly: the beta.14 registry's icon table requires
CLI 1.0.0-beta.1 or later. An unversioned install can select stable 0.1.0,
which supports older schema 1 icon tables. Existing projects should update
their CLI dependency before advancing to the new registry pin.
To run an unreleased build, point at a checkout or staged package path:
dart pub add "dev:remix_cli@{path: /path/to/remix/packages/remix_cli}"
The pinned catalog declares its required Remix version, which add records
for you. Existing beta.13 catalog pins remain usable; the beta.14 catalog
requires Remix ^1.0.0-beta.14. Updating the CLI alone does not advance a
project's catalog pin.
Global activation is convenient for experiments. Registry content remains
pinned per project in remix.yaml:
dart pub global activate remix_cli '^1.0.0-beta.1'
remix_cli is versioned independently of remix, so its version does not
match Remix's. Its registry is authored against one remix
version; add reports when your resolved remix is newer than that one.
Activate an unreleased CLI from Git #
To activate an unreleased revision from Git:
dart pub global activate --source git https://github.com/btwld/remix.git \
--git-path packages/remix_cli --git-ref main
remix --help
Add Pub's bin directory to PATH if prompted. To pin a specific revision,
replace main with a full commit SHA. Run the activation command again to update
a branch-based install. The CLI revision is independent of the registry commit in
remix.yaml. Activating a newer CLI does not advance that registry pin.
Git activation resolves CLI dependencies independently of a local checkout. In
contrast, --source path activates the live checkout using its
resolution: workspace configuration. That command can update the monorepo
lockfile to match your active Dart SDK. If you later restore or change that
lockfile, remix commands fail before the CLI starts:
The current activation of `remix_cli` cannot resolve to the same set of dependencies.
To recover the global command, run the Git activation command above. This replaces the path activation without modifying checkout manifests or lockfiles. To test local CLI edits, use a project-local path dependency instead.
Initialize a project #
Run from a Flutter package root:
dart run remix_cli:remix init
The default configuration is:
schema: 3
prefix: Ui
preset: vanilla
paths:
ui: lib/ui
defaultRegistry: "@remix"
registries:
"@remix":
repository: btwld/remix
path: registry
ref: registry-stable
revision: "<resolved-full-commit-sha>"
Customize it only at initialization:
dart run remix_cli:remix init --prefix Acme --preset fortal --ui-path lib/design_system
init validates the Flutter project, writes remix.yaml, and creates a barrel
with a managed export block. Repeating the same command is safe. A different
configuration is refused instead of silently rewriting an existing project.
The preset defaults to vanilla when omitted and cannot be changed after
initialization.
Schema 3 projects may also set iconLibrary: remix|lucide; omitting it keeps
Remix icons. It applies when items are installed; after changing it, reinstall
every installed item that uses icons (icons, dashboard_shell,
dashboard_demo, support) in one add --diff, then add --overwrite.
A registry's icons.yaml maps each icon to a constant in every library. From
schema 2, an icon a library does not draw names a fallback library instead:
installing it on that library renders the fallback's constant and adds the
fallback's package too. The schema 2 official icon table uses Lucide for icons
Remix does not draw, so those installs add lucide_flutter alongside
remix_ui_icons. Earlier schema 1 pins keep their original icon package
requirements.
Fortal as owned source #
With preset: fortal, add button installs the full local theme layer,
base_button.dart, button.dart, and the generated adapter. The configured
prefix replaces Fortal throughout: --prefix Acme creates AcmeTheme,
AcmeTokens, AcmeButton, and acmeButtonStyle. The installed application
does not depend directly on mix, naked_ui, or remix_fortal; it can edit
the generated palette data, tokens, recipes, and instance overrides as ordinary app
source.
Place AcmeTheme below the application host. For a routed WidgetsApp, wrap
the child of WidgetsApp.builder with AcmeTheme. Routes and dialogs then
inherit its tokens and text defaults. See lib/ui/theme/theme_scope.dart for
the scope example.
Every preset supports theme, darkTheme, and mode on its generated scope.
The old scope data and brightness parameters and config createScope
shortcut are removed. Update application-owned callers to this API.
With no configuration, roots use the generated light/dark pair and follow the
system. Nested scopes inherit the pair and active selection. A custom theme
without darkTheme is used in both modes; supplying darkTheme alone keeps the
base default. Every preset generates AcmeThemeData.light(), .dark(), and
AcmeThemeMode (system, light, dark). Use AcmeTheme with your
configured prefix.
Place the scope in WidgetsApp.builder above the Navigator. The CLI installs
theme files, not a complete app host or appearance picker. See the
application host standard.
The prefixes Remix and Mix are reserved for runtime dependencies.
Use an application prefix such as Ui or Acme.
Add a component #
dart run remix_cli:remix add button
Several items can be named in one command:
dart run remix_cli:remix add button card dialog
A batch installs as one unit. The items and everything they depend on are ordered once, so a dependency two of them share is written once, and the resolve, format, generation, and analysis steps run once for the whole batch rather than once per item. Naming an unknown item, or the same item twice, fails before anything is written.
The command installs Theme before Button, adds missing compatible hosted
dependencies, formats the authored files, runs generation only for the
declared adapters (including previously installed adapters), and analyzes the
installed UI path. Recipe-only installs do not need build.yaml. Installing
Agent @MixableSpec source enables Mix's opt-in spec-styler builder there,
scoped to the installed files. The CLI preserves comments and unrelated
settings; it refuses explicit builder disablement, excluded source, or
conflicting target ownership before writing. --dry-run reports the required
configuration and --diff shows it without changing the application.
The current mix_generator writes explicit this. qualifiers into generated
adapters, which flutter_lints reports as unnecessary_this infos. They do
not fail the command. To keep flutter analyze on the source you own, exclude
the adapters in analysis_options.yaml, matching your paths.ui:
analyzer:
exclude:
- lib/ui/**/*.g.dart
With the Vanilla preset and path, the application receives:
lib/ui/
ui.dart
theme/
tokens.dart
theme_data.dart
theme_scope.dart
effects.dart
components/
button.dart
button.g.dart
One add installs every named item plus shared dependencies once.
Default component items add an authored file and a
generated part to components/. Fortal also has shared source items without
generated parts, such as base_button and typography.
Existing authored source stays untouched. When generation runs, the build
includes every installed adapter. This protects earlier generated parts when
dependencies change.
Add a dashboard shell #
dart run remix_cli:remix add dashboard_shell
This installs the preset's sidebar, responsive sidebar layout, app bar, icon button,
textfield, icons, and theme dependency closure plus two editable files under
lib/ui/recipes/dashboard/. The public UiDashboardShell<T> API is the same
for vanilla and fortal. The host supplies RemixSidebarSection<T> values,
the selected value and callback, the current page body, title (with an
optional headerTitle widget to override the default title widget), and brand
slot. Account and header-action slots are optional. Search is absent unless the
host provides onSearchChanged.
The shell composes inside the existing application. It does not create a
MaterialApp, WidgetsApp, Navigator, route table, authentication layer, or
persistence mechanism. Place it below the preset theme scope and keep those
host responsibilities in the application. A normal reinstall preserves edits;
use --diff and explicit --overwrite for template updates.
Add the full dashboard demo #
Initialize the Vanilla or Fortal preset (HeroUI ships no dashboard), then use the same item and public dashboard API:
dart run remix_cli:remix init --prefix Ui --preset vanilla
# Or initialize a separate app with: --preset fortal
dart run remix_cli:remix add dashboard_demo
dashboard_demo installs UiDashboardDemo, UiDashboardOverview, the
usable shell, and the five product destinations from the reference dashboard
(Overview, Chat, Customers, Orders, and Settings). Product pages and navigation
match across presets while rendering each preset's native components and
variants. The overview's four metrics, revenue series, and recent records live
in editable lib/ui/recipes/dashboard/dashboard_sample_data.dart; replace them
there or pass a RegistryDashboardSampleData to UiDashboardDemo(data: ...).
The host supplies its Flutter application, directionality, brand, and theme
scope. Default uses UiTheme(theme: UiThemeData.light(), child: ...);
Fortal uses UiTheme(child: ...). The installer does not rewrite main.dart,
routes, authentication, persistence, or search behavior. Pass a real
onSearchChanged callback to show search; omit it to remove the field.
Installed recipe source follows the normal update contract. Re-running add dashboard_demo preserves local edits. Inspect a newer template with --diff, and
use --overwrite only when deliberately replacing the installed recipe.
Contributors can reproduce the isolated dashboard consumer gates for Vanilla and Fortal:
dart run tool/check_open_code.dart --preset vanilla --source checkout --item dashboard_demo --keep
dart run tool/check_open_code.dart --preset fortal --source checkout --item dashboard_demo --keep
dart run remix_cli:remix add icons is the deliberate exception. It adds
lib/ui/icons.dart, declares the selected icon package and any per-icon
fallback packages, and exposes a small, application-owned UiIcons alias set
with no generated adapter. The
default Remix selection uses remix_ui_icons, plus lucide_flutter for the
schema 2 official table's fallbacks. Add or rename
aliases there as your interface evolves. Every Remix icon remains one direct
package:remix_ui_icons/remix_ui_icons.dart import away.
Most Vanilla component items generate one widget. Four generate several:
checkbox also generates
UiCheckboxGroupItem, textfield generates UiTextField and UiTextArea,
tabs generates UiTabBar, UiTab, and UiTabView, and chart generates
UiLineChart, UiBarChart, and UiPieChart.
Add application-owned charts #
dart run remix_cli:remix add chart
This installs one editable components/chart.dart recipe and adds
mix_chart. The generated adapters cover line and area charts, grouped,
stacked, and floating bars, and pie and donut charts. They use the existing
application theme and never import Fortal.
Import mix_chart directly for chart data. The UI barrel exports the generated
widgets and the application-owned style functions, but it does not re-export a
dependency's API:
import 'package:mix_chart/mix_chart.dart';
import 'ui/ui.dart';
final chart = SizedBox(
height: 240,
child: UiLineChart(
semanticsLabel: 'Weekly revenue',
series: [
LineSeries(
id: 'revenue',
label: 'Revenue',
points: [
ChartPoint(id: 'mon', x: 0, y: 18),
ChartPoint(id: 'tue', x: 1, y: 31),
],
),
],
),
);
Charts have no intrinsic height, so give line and bar charts a bounded height
and pie charts a bounded size. A pie does not scale to its box: each slice
ring is 80px wide unless the chart's style sets PieSliceStyler().radius,
so size a donut's ring to fit. The palette is the theme's chart1 to chart5
tokens, a neutral gray ramp: edit them in theme/theme_data.dart to restyle
every chart, or pass palette or a chart style for one instance.
RemixCheckboxGroup, RemixRadioGroup, RemixTabs, and
RemixAccordionGroup are behavioral and carry no style, so the registry has
nothing to render for them: import them from package:remix/remix.dart and put
the installed adapters inside. toggle_group, segmented_control, menu, and
select are the opposite case — their rows are data rather than widgets, so
the parent's recipe carries the row style and one add covers both.
The authored files are application source. A normal rerun preserves them. The generated part is owned by the consumer's resolved generator and should be committed, but not edited by hand.
Review and overwrite #
Preview a new install without changing the project or running package tools:
dart run remix_cli:remix add button --dry-run
Compare the requested item with the pinned registry source using Git's no-index diff:
dart run remix_cli:remix add button --diff
After reviewing the difference, replace only the requested item's authored files:
dart run remix_cli:remix add button --overwrite
Overwriting Button preserves locally edited Theme files. With several items
named, --overwrite covers each of them and still preserves every dependency
that came in behind them; overwrite a dependency by naming it explicitly. Compatible existing
hosted, path, Git, custom-hosted, and override dependency declarations are also
preserved. An incompatible resolved dependency fails before authored-source
writes.
Section placement is checked but never rewritten. Packages the installed source
imports at runtime (remix, mix_annotations, mix_chart for chart,
remix_ui_icons and its lucide_flutter fallback for icons, and
remix_ui_fonts for the Vanilla theme)
must be declared under
dependencies; build-only packages (build_runner, mix_generator) may sit in
either section. Declaring the same package in both sections is rejected. A
misplaced declaration fails before any process runs or file is written, and the
CLI names the package and the section to move it to rather than editing your
pubspec.yaml.
If generation or analysis fails after installation, the authored source stays in place for inspection. Fix the reported issue and rerun the same command.
Exit codes #
0: success, including help, version, dry-run, diff, and no-op reruns64: invalid command or command-line arguments1: project/configuration, registry, dependency, process, generation, analysis, or filesystem failure
Manual updates #
The MVP's update workflow is explicit. Upgrading remix_cli does not change
the source you install; the registry pin in remix.yaml does:
- run
registry update @remixto move the pin to the newest promoted commit (@remixis the namespaceinitgives the official registry); - run
add button --diff; - review the template changes against local customizations;
- use
add button --overwriteonly when replacement is intended; - reapply or refine application-specific changes and commit
remix.yamland the regenerated adapter.
There is no automatic merge or migration layer.
Because --overwrite replaces only files present in the incoming registry item
and updateManagedBarrel preserves existing exports without pruning, removing
an obsolete template file during an upgrade requires manual cleanup. Before
upgrading an existing Vanilla project installed prior to token consolidation,
complete legacy ownership adoption
for every existing item and dependency. Commit remix.ownership.json with the
configuration and source, then update the theme:
- run
remix add theme --overwrite(ordart run remix_cli:remix add theme --overwrite) to updatetokens.dart,theme_data.dart, andtheme_scope.dart; - update installed components to use
<Prefix>Tokensinstead ofscale.dartby re-adding them with--overwrite(for example,remix add <component> --overwrite) or updating local component imports and references fromscale.dartand its retired helper classes (<Prefix>Space,<Prefix>Size,<Prefix>Stroke,<Prefix>Opacity, and<Prefix>Motion) to<Prefix>Tokens; - delete
lib/ui/theme/scale.dart; - remove
export 'theme/scale.dart';fromlib/ui/ui.dart.
All scale constants (s0_5 .. s16, controlSm .. pill, strokeHairline,
strokeIndicator, strokeRing, disabledOpacity, and motion) now reside on
<Prefix>Tokens in lib/ui/theme/tokens.dart.
Available styled items: activity_recipe, answer_recipe, composer_recipe,
execution_recipe, message_recipe, permission_recipe, plan_recipe, and
transcript_recipe. Each installs only its component and styled-control closure.