Skip to main content

Module init

Module init 

Source
Expand description

defect init — scan the environment for provider API keys, fetch each detected provider’s real model list over its API, and write a global ~/.config/defect/config.toml.

Interaction model follows rustup-init: detect the environment, show what will be written, confirm. When exactly one provider key is present and the user passes --yes, it is fully non-interactive. With multiple keys, --yes requires an explicit --default-provider — defect never guesses which provider should be the default from ambient state (see the project’s explicit-provider rule).

Model IDs are NEVER hardcoded: with an API key in hand, init calls the provider’s list_models() (the same path the agent uses) to obtain the live, authoritative set. A provider whose model list cannot be fetched is a hard error, not a fall back to a guessed model id.

The interactive prompts require the init build feature (on by default); a binary built with --no-default-features can still run defect init --yes.

Functions§

run
Entry point for defect init.