> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crewship.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# crewship init

> Initialize a crewship.toml configuration file

## Usage

```bash theme={null}
crewship init [directory]
```

Initialize a new `crewship.toml` configuration file in your project. This command auto-detects your project settings and creates a ready-to-use configuration.

## Arguments

| Argument    | Description                                       |
| ----------- | ------------------------------------------------- |
| `directory` | Project directory (defaults to current directory) |

## What It Does

The `init` command:

1. **Detects your framework** - Looks for `[tool.crewai]` in `pyproject.toml` to identify CrewAI projects
2. **Finds your entrypoint** - Searches for crew classes decorated with `@CrewBase` or named `*Crew`
3. **Extracts Python version** - Reads `requires-python` from `pyproject.toml`
4. **Creates configuration** - Generates a `crewship.toml` with sensible defaults

## Examples

### Initialize current directory

```bash theme={null}
cd my-crew
crewship init
```

Output:

```
🔍 Initializing Crewship project in /path/to/my-crew

   Found pyproject.toml, reading project info...
   Detected CrewAI project
   Detected entrypoint: my_crew.crew:MyCrew

✅ Created crewship.toml

   Framework:   crewai
   Entrypoint:  my_crew.crew:MyCrew
   Profile:     slim
   Python:      3.11

   Edit crewship.toml to customize your deployment settings.
   Then run "crewship deploy" to deploy your crew.
```

### Initialize a specific directory

```bash theme={null}
crewship init ./projects/my-crew
```

## Generated Configuration

The command creates a `crewship.toml` like this:

```toml theme={null}
[deployment]
framework = "crewai"
entrypoint = "my_crew.crew:MyCrew"
profile = "slim"
python = "3.11"

[build]
exclude = ["tests"]
```

## Entrypoint Detection

The command searches for your crew entrypoint in these locations:

1. `<project_name>/crew.py` - Standard CrewAI structure
2. `src/<project_name>/crew.py` - Source layout
3. Any top-level package with a `crew.py` file

It looks for:

* Classes decorated with `@CrewBase`
* Classes with names ending in `Crew`

If auto-detection fails, a default entrypoint is generated based on your project name.

## After Initialization

Once you have a `crewship.toml`, you can:

1. **Edit the configuration** - Customize entrypoint, profile, or build settings
2. **Set environment variables** - Add API keys with `crewship env set`
3. **Deploy** - Run `crewship deploy` to deploy your crew

## Related

<CardGroup cols={2}>
  <Card title="crewship.toml Reference" icon="file-code" href="/configuration/crewship-toml">
    Full configuration options
  </Card>

  <Card title="Deploy" icon="rocket" href="/cli/deploy">
    Deploy your crew
  </Card>
</CardGroup>
