# uip flow init

> `uip flow init` scaffolds a new Flow project directory with a minimal manifest and a starter `.flow` file containing a single manual-trigger node.

`uip flow init` scaffolds a new Flow project directory with a minimal manifest and a starter `.flow` file containing a single manual-trigger node.

## Synopsis

```
uip flow init <name> [--force]
```

Honors [global options](./global-options.md). Exit codes follow the [standard contract](./exit-codes.md).

## Arguments

- `<name>` *(required)* — project folder name. Validated against `VALID_PROJECT_NAME_REGEX`: letters, numbers, underscores (`_`), and hyphens (`-`) only.

## Options

- `--force` — initialize even if the target directory exists and is non-empty. Existing files are **not** cleared — files are written alongside; this is useful for reinitializing inside a pre-created folder.

## Behavior

The command creates `<name>/` in the current working directory and writes two files:

- `project.uiproj` — `{ "Name": "<name>", "ProjectType": "Flow" }`
- `<name>.flow` — seed Flow JSON containing:
  - One `core.trigger.manual` start node wired to a generated `entryPointId`
  - The matching node definition in `definitions[]`
  - Empty `edges`, `bindings`, `variables`
  - Canvas `layout.nodes.start` position

If `<name>` already exists and is non-empty and `--force` is not set, the command fails with an error prompting the user to pass `--force`.

## Examples

```bash
# Create a new project in ./invoice-flow
uip flow init invoice-flow

# Reinitialize into an existing non-empty folder (e.g. a Git repo)
uip flow init invoice-flow --force
```

## Data shape (--output json)

```json
{
  "Code": "FlowInit",
  "Data": {
    "Status": "Created successfully",
    "Path": "/workspace/invoice-flow"
  }
}
```

On failure, `Code` is absent and the response carries `Result: "Failure"`, `Message`, and `Instructions`.

## See also

- [`uip flow pack`](./uip-flow-pack.md) — pack the scaffolded project
- [`uip flow node`](./uip-flow-node-edge.md) — add nodes to the starter `.flow` file
- [`uip flow registry`](./uip-flow-registry.md) — discover node types to add
- [Flow overview](./uip-flow.md)
