rxf-cli 0.1.3

CLI tool for the RXF SDK
 > 中文版本:[README.zh.md]./README.zh.md

# rxf CLI

Command-line tool for the [RXF SDK](https://github.com/gentean/rxf).
Scaffold new projects, start the development server, and build production binaries — all without touching Flutter or Rust directly.

## Prerequisites

- **Flutter SDK** >= 3.5.0
- **Rust toolchain**
- **rinf CLI** (global install):
  ```bash
  dart pub global activate rinf
  ```

## Installation

```bash
cargo install rxf-cli
```

## Commands

### `rxf-cli create <name>`

Scaffold a new RXF application:

```bash
rxf-cli create hello_rxf
cd hello_rxf
```

Generated project structure:

```text
hello_rxf/
├── package.json          # Frontend toolchain config (optional prettier/eslint)
├── rxf.config.json       # Global config (app name, appId, etc.)
├── jsconfig.json         # JS/JSX type hint config
├── types/
│   └── rxf-jsx.d.ts      # JSX component type definitions
└── src/
    └── pages/            # Business logic: UI and page logic
        └── home/
            ├── ui.jsx    # Page UI (JSX component tree)
            └── logic.js  # Page logic (event handlers, data binding)
```

### `rxf-cli dev`

Start the development server.
The CLI automatically creates a hidden `.rxf/` workspace, assembles and compiles the underlying Flutter/Rust dependencies, and launches the app:

```bash
rxf-cli dev
```

Press `r` to restart the app. The `.rxf/` workspace is created on first run and reused on subsequent runs.

### `rxf-cli build`

Build the application for production:

```bash
rxf-cli build
```

Build artifacts are copied to the `build/` directory in your project (e.g. `build/rxf_runner.app`).

## How It Works

- `rxf-cli dev` / `rxf-cli build` implicitly generate and maintain a `.rxf/` folder in your project.
  This folder contains a complete Flutter host app and a Rust rinf hub.
- The Flutter package (`rxf`) and Rust crate (`rxf`) versions used in `.rxf/` are read
  automatically from the published package manifests at CLI compile time.
- `src/pages/` JSX/JS files are loaded at runtime (native) or embedded at compile time (WASM)
  via the `include_pages!` macro in the Rust hub.
- The Rust hub embeds QuickJS to execute page logic and communicates with Flutter via rinf signals.