yera.cli.resources.setup_wizard
Setup wizard infrastructure.
Symbols
create_profile
create_profile(
profile_name: str,
update: bool,
ctx: AppContext,
) → NoneCreate or update a named profile and conditionally set it as the default.
Writes a new Profile record, preserving the description from any
pre-existing profile of the same name. Sets the profile as the system
default when no profiles previously existed, or when update is True.
Prints a status line to the console indicating whether the operation is a
fresh setup or an update.
Parameters
Name of the profile to create or overwrite.
When True, treats the operation as an update and re-applies
the default pointer.
Application context carrying the console for status output.
print_setup_summary
print_setup_summary(
profile_name: str,
skipped_providers: list[str],
ctx: AppContext,
) → NonePrint the wizard completion summary, profile state, and follow-up hints.
Prints the finalised profile as JSON, lists any providers that were skipped
during auto-detection, and emits contextual tip lines — always suggesting
yera doctor, and conditionally suggesting the setup provider and
setup models subcommands when there are skipped providers.
Parameters
Name of the profile to summarise. Used both for the heading and to look up the profile record from disk.
List of provider type strings that were not successfully configured during the setup wizard.
Application context carrying the console for output.
resolve_profile_name
resolve_profile_name(
profile_arg: str | None,
update: bool,
ctx: AppContext,
) → strResolve the target profile name, prompting interactively if not supplied.
If profile_arg is None, the user is prompted via the console with
"default" as the fallback. When update is False, raises
YeraError if the resolved name already exists in the stored profiles,
preventing accidental overwrites.
Parameters
Explicit profile name passed by the caller, or None to
trigger an interactive prompt.
When True, an existing profile with the resolved name is
allowed; no error is raised.
Application context carrying the console used for the prompt.
Returns
The resolved, stripped profile name string.
Raises
If the resolved name already exists and update is False.
run_batch_model_discovery
run_batch_model_discovery(
available_providers: list[str],
discovery_handler_map: dict,
ctx: AppContext,
connection_name: str,
) → list[BaseModelConfig] | NoneDiscover models for all available providers and persist them to the universe.
For each provider in available_providers, looks up the corresponding
discovery handler, resolves the active connection object from the loaded
providers config, and runs model discovery. All discovered models across all
providers are aggregated and written to the model universe in a single call.
Parameters
Ordered list of provider type strings to discover models for. Providers without a matching handler or connection are silently skipped.
Mapping of provider type string to discovery handler class.
Application context carrying console and error console.
The connection name to resolve for each provider.
Returns
The aggregated list of discovered BaseModelConfig instances, or None if available_providers is empty.
run_provider_detection
run_provider_detection(
profile_name: str,
provider_handler_map: dict,
ctx: AppContext,
connection_name: str,
) → tuple[list[str], list[str]]Attempt auto-detection and setup for each provider in the handler map.
Iterates over the provided handler map, skipping any provider that is already configured. For each remaining provider, runs the setup flow and, on success, writes an updated profile associating the provider with the given connection name. Providers that fail auto-detection are skipped with a console hint for manual configuration.
Parameters
Name of the profile to write successful providers into.
Mapping of provider type string to handler class.
Application context carrying console, error console, and config state.
The connection name to associate with each detected provider.
Returns
A two-tuple of (successful, skipped) where each element is a list of provider type strings.