pun init
Create pun.toml for a project without existing tool configs.
pun init writes a new pun.toml. If the project has a Pint, PHP-CS-Fixer, PHPStan, Rector, or Mago config, use pun migrate instead.
pun init
pun init --yes
pun init --style psr12 --lint-sets dead-code,types --analyse strict
Choices and defaults
On a terminal, pun init asks three questions:
| Setting | Choices | Default | Flag |
|---|---|---|---|
| Format preset | laravel, psr12 |
laravel when detected, otherwise psr12 |
--style |
| Lint sets | The eight lint sets | dead-code, modernize |
--lint-sets a,b |
| Analyse preset | basic, essential, recommended, strict, max |
recommended |
--analyse |
--lint-sets "" selects no lint sets. Init also turns on each extension whose package composer.lock locks. For a Laravel app tested with Pest, the generated config is:
[extensions]
laravel = "on"
pest = "on"
phpunit = "on"
[format]
preset = "laravel"
[lint]
sets = ["dead-code", "modernize"]
[analyse]
preset = "recommended"
Init doesn’t run checks or edit Composer scripts, CI, Git hooks, or editor settings.
Without a terminal
--yes, agent mode, CI, or a non-terminal input or output turns off the prompts. Pun uses the defaults and your flags.
Existing configs
- If
pun.tomlexists, init leaves it unchanged and exits 2. - If an upstream config exists, interactive init offers to migrate it. Without prompts, init writes nothing and exits 2 with a migration hint.
Exit codes
| Code | When |
|---|---|
| 0 | Configuration written or migration succeeded |
| 2 | Existing config, invalid flag, or another run error |