# init

```bash
npx blockstudio init [options]
```

Creates a `blocks.json` config file in the current directory.

## Interactive mode

When run in a terminal, `init` walks through an interactive setup:

1. Prompts for the block install directory (default: `blockstudio`)
2. Asks if you want to add a registry
3. If yes, prompts for a name and URL, then repeats

If `blocks.json` already exists, you're asked whether to overwrite it.

## Non-interactive mode

With `--yes`, or when stdin is not a terminal, `init` writes `blocks.json`
straight away with an empty `registries` object. An existing `blocks.json` is
overwritten without asking.

## Options

| Option | Description |
|--------|-------------|
| `-d, --directory <path>` | Block install directory. Default: `blockstudio`. Only used in non-interactive mode; the interactive prompt ignores it. |
| `-y, --yes` | Skip all prompts and use defaults. |

## Examples

Interactive setup:

```bash
npx blockstudio init
```

Non-interactive with custom directory:

```bash
npx blockstudio init --yes --directory my-blocks
```

## Output

Prints `Created <path>/blocks.json` and writes:

```json
{
  "$schema": "https://blockstudio.dev/schema/blocks.json",
  "directory": "blockstudio",
  "registries": {}
}
```
