npm package: @promakeai/cli
Description: Modular React template CLI (like shadcn/ui). Create React projects and add feature modules incrementally. Copies code directly into projects rather than installing as dependencies.
Latest version: 0.10.1

# @promakeai/cli

Modular React template CLI (like shadcn/ui). Create React projects and add feature modules incrementally. Copies code directly into projects rather than installing as dependencies.

## Quick Start

```bash
# Install globally
npm install -g @promakeai/cli

# Create a new project
promake create my-app --preset ecommerce --pm bun

# Add modules to existing project
promake add hero product-card

# Theme customization
promake theme --preset blue --radius medium

# Health check
promake doctor
```

## Commands

| Command | Description |
|---------|-------------|
| `promake create <name>` | Scaffold a new React project (generates admin token) |
| `promake add <items...>` | Add modules, components, or pages |
| `promake remove <modules...>` | Remove installed modules |
| `promake sync` | Install missing modules from promake.json |
| `promake theme` | Configure theme (colors, radius, fonts) |
| `promake list` | Browse available modules |
| `promake doctor` | Analyze project for issues |
| `promake init` | Initialize promake.json |
| `promake zip / unzip` | Archive utilities |

## Data Layer

Projects generated by Promake include `@promakeai/dbreact` with a JSON schema
(`src/db/schema.json`) and support for both SQLite and REST API modes.
Use `@/db` hooks (`useDbList`, `useDbGet`, etc.) for data access.

### Database Modes

- **SQLite** (default) — Prebuilt `database.db` loaded via sql.js WASM in the browser
- **REST API** — Connects to a remote API with automatic Bearer auth for logged-in users

### Auth Integration

When REST API mode is active, the template's `AppDbProvider` reads auth tokens from
localStorage (where auth-core's Zustand store persists under `"auth-storage"` key).
No direct dependency on auth-core module code.

### Admin Token

During `promake create`, a UUID admin token is generated and written to `.env` as
`VITE_DB_ADMIN_TOKEN`. This token is used by `@promakeai/dbcli` for authenticated
REST API access when managing the project's database.

### Schema Permissions

All template tables include `$permissions` metadata for role-based access control:

```json
"$permissions": {
  "anon": ["read"],
  "user": ["read"],
  "admin": ["read", "create", "update", "delete"]
}
```

Roles: `anon`, `user`, `admin`. Actions: `create`, `read`, `update`, `delete`.

## Available Presets

| Preset | Description |
|--------|-------------|
| `ecommerce` | Full e-commerce with products, categories, cart |
| `blog` | Blog with posts, categories, comments |
| `portfolio` | Portfolio with projects and sections |
| `empty` | Minimal template with no pre-installed modules |

## Development

```bash
# Install dependencies
bun install

# Run from source
bun run dev

# Build
bun run build

# Test
bun test

# Type check
bun run typecheck
```

## Related Packages

- [@promakeai/dbreact](https://www.npmjs.com/package/@promakeai/dbreact) — React database hooks (used in template)
- [@promakeai/dbcli](https://www.npmjs.com/package/@promakeai/dbcli) — Database CLI tool
- [@promakeai/orm](https://www.npmjs.com/package/@promakeai/orm) — Core ORM

## License

MIT