Skip to content

cli

πŸ€– AI-Generated Content

This documentation was generated with AI assistance and is still being audited. Some, or potentially a lot, of this information may be inaccurate. Learn more.

flavor.cli

FlavorPack command-line interface entrypoint.

Classes

Functions

cli

cli(ctx: Context) -> None

PSPF (Progressive Secure Package Format) Build Tool.

Configure logging via environment variables: - FLAVOR_LOG_LEVEL: Set log level for FlavorPack (trace, debug, info, warning, error) - FLAVOR_SETUP_LOG_LEVEL: Control Foundation's initialization logs - PROVIDE_LOG_LEVEL: Fallback log level if FLAVOR_LOG_LEVEL not set - PROVIDE_LOG_FILE: Write logs to file

Source code in flavor/cli.py
@click.group(context_settings=dict(help_option_names=["-h", "--help"]))
@click.version_option(
    __version__,
    "-V",
    "--version",
    prog_name="flavor",
    message="%(prog)s version %(version)s",
)
@click.pass_context
def cli(ctx: click.Context) -> None:
    """PSPF (Progressive Secure Package Format) Build Tool.

    Configure logging via environment variables:
    - FLAVOR_LOG_LEVEL: Set log level for FlavorPack (trace, debug, info, warning, error)
    - FLAVOR_SETUP_LOG_LEVEL: Control Foundation's initialization logs
    - PROVIDE_LOG_LEVEL: Fallback log level if FLAVOR_LOG_LEVEL not set
    - PROVIDE_LOG_FILE: Write logs to file
    """
    ctx.ensure_object(dict)

    # Load FlavorPack configuration from environment
    flavor_config = FlavorRuntimeConfig.from_env()

    # Initialize Foundation with proper configuration
    cli_ctx = CLIContext.from_env()

    # Get base telemetry config from environment
    base_telemetry = TelemetryConfig.from_env()

    # Merge with FlavorPack-specific settings
    telemetry_config = evolve(
        base_telemetry,
        service_name="flavorpack",
        logging=evolve(
            base_telemetry.logging,
            default_level=flavor_config.log_level,  # type: ignore[arg-type]
        ),
    )

    # Initialize Foundation with merged config
    hub = get_hub()
    hub.initialize_foundation(telemetry_config)

    ctx.obj["cli_context"] = cli_ctx
    ctx.obj["log"] = cli_ctx.logger