open-index/open-npm huggingface dataset:
npm package: @rippledb/cli
Description: CLI tools for RippleDB - schema codegen and utilities
Latest version: 0.1.1

# @rippledb/cli

CLI tools for RippleDB - schema codegen and utilities.

📖 **[Full Documentation](https://rippledb.dev/docs/reference/cli)**

👉 Config files are **validated at runtime** using a tiny `valibot` schema, so
typos/missing keys fail fast before generation runs.

## Installation

```bash
pnpm add -D @rippledb/cli
```

## Usage

### Generate RippleDB schema from Drizzle

1. Create a config file `ripple.config.ts`:

```ts
import { defineConfig } from "@rippledb/cli/config";

export default defineConfig({
  codegen: {
    drizzle: {
      entities: "./src/db/ripple-entities.ts",
      output: "./src/shared/schema.ts",
    },
  },
});
```

2. Create an entities file that exports the Drizzle tables you want in RippleDB:

```ts
// src/db/ripple-entities.ts
export { todos, users } from "./schema";
```

3. Run the codegen:

```bash
npx rippledb generate
```

This will generate a RippleDB schema file at the specified output path.

## Configuration

### `codegen.drizzle`

| Option     | Type     | Description                           |
| ---------- | -------- | ------------------------------------- |
| `entities` | `string` | Path to file exporting Drizzle tables |
| `output`   | `string` | Output path for generated schema      |

## Generated Output

The generated file will look like:

```ts
// AUTO-GENERATED by @rippledb/cli - DO NOT EDIT

import { defineSchema, type InferSchema, s } from "@rippledb/core";

export const schema = defineSchema({
  todos: {
    id: s.string(),
    title: s.string(),
    done: s.boolean(),
  },
  users: {
    id: s.string(),
    name: s.string(),
    email: s.string(),
  },
});

export type Schema = InferSchema<typeof schema>;
```