# axle init

Add Axle to a repository.

```sh
axle init [--force] [--dry-run]
```

Adds Axle to the repository you run it in. Before Axle is installed, run it through your package manager:

```sh
pnpm dlx @axle-rs/axle init                     # pnpm
npx @axle-rs/axle init                          # npm
yarn dlx @axle-rs/axle init                     # Yarn
bunx @axle-rs/axle init                         # Bun
nub dlx @axle-rs/axle init                      # nub
aube dlx @axle-rs/axle init                     # aube
```

It:

- writes an `axle.toml` at the root with the [`#:schema` line](https://axlers.dev/docs/reference/configuration.md#editor-support), since Axle needs no other settings to start
- adds `@axle-rs/axle` to the root `package.json`'s `devDependencies`, unless it's already a dependency
- adds `.axle/` to `.gitignore`, unless it's listed

```text
Created axle.toml
Updated package.json
Updated .gitignore

Next, run pnpm install to install Axle.
```

Then install, as it says, with the repository's package manager:

```sh
pnpm install                                    # pnpm
npm install                                     # npm
yarn install                                    # Yarn
bun install                                     # Bun
nub install                                     # nub
aube install                                    # aube
```

`package.json` and `.gitignore` keep their formatting, comments and line endings; only the new lines change. Axle writes all the files or none, so a file it [can't write](https://axlers.dev/docs/messages/file-not-written.md) leaves everything as it was.

## Options

| Option      | What it does                                                                                                        |
| ----------- | ------------------------------------------------------------------------------------------------------------------- |
| `--force`   | replaces an `axle.toml` that is already there; without it, one is an [error](https://axlers.dev/docs/messages/config-already-exists.md) |
| `--dry-run` | prints the changes as a diff and writes nothing                                                                     |
