Skip to content

mille init

Overview

Terminal window
mille init
mille init ./path/to/project # specify target directory

Analyzes import statements in your source files to infer layer structure and dependencies, then generates mille.toml. You can pass a project directory as a positional argument. Defaults to the current directory (.) if omitted.

Options

FlagDefaultDescription
--output <path>mille.tomlWrite config to a custom path
--forcefalseOverwrite an existing file without prompting
--depth <N>autoLayer detection depth from project root

Auto-depth Detection

mille init tries depths 1–6, skips common source-layout roots (src, lib, app, etc.), and selects the first depth that yields 2–8 candidate layers.

For a project with src/domain/entity, src/domain/repository, src/usecase/ — depth 2 is chosen, rolling entity and repository up into domain.

Use --depth N to override.

Example Output

Detected languages: rust
Scanning imports...
Using layer depth: 2
Inferred layer structure:
domain ← (no internal dependencies)
usecase → domain
external: anyhow
infrastructure → domain
external: serde, tokio
Generated 'mille.toml'

Monorepo Naming

When multiple sub-projects contain the same directory name (e.g. crawler/src/domain and server/src/domain), mille init adds a distinguishing prefix (crawler_domain, server_domain). Merging is left to you.

Language-specific Auto-detection

LanguageAuto-detected
GoReads go.mod and generates [resolve.go] module_name
PythonDetects src/ layout and adds src to package_names
Java/KotlinReads pom.xml / build.gradle + settings.gradle for module_name