From 9335fa73928cfcf636a8c006733272fd11620605 Mon Sep 17 00:00:00 2001 From: Erik Garrison Date: Thu, 19 Feb 2026 08:31:13 -0600 Subject: [PATCH] feat: support provider name aliases in -p flag Allow providers to have a user-facing `name` field in settings.yaml that the -p flag matches against before falling back to module name. This enables more intuitive provider selection when the same module (e.g., provider-openai) is configured for different services: providers: - name: openrouter module: provider-openai config: base_url: https://openrouter.ai/api/v1 amplifier run -p openrouter "hello" The name match is checked first; if no name matches, the existing module-based lookup runs as before. Error messages now show both name and module when available. --- amplifier_app_cli/commands/run.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/amplifier_app_cli/commands/run.py b/amplifier_app_cli/commands/run.py index c0069392..9661cfd8 100644 --- a/amplifier_app_cli/commands/run.py +++ b/amplifier_app_cli/commands/run.py @@ -213,17 +213,28 @@ def run( ) providers_list = config_data.get("providers", []) - # Find the target provider + # Find the target provider by name first, then by module target_idx = None for i, entry in enumerate(providers_list): - if isinstance(entry, dict) and entry.get("module") == provider_module: + if isinstance(entry, dict) and entry.get("name") == provider: target_idx = i + provider_module = entry.get("module", provider_module) break + if target_idx is None: + for i, entry in enumerate(providers_list): + if isinstance(entry, dict) and entry.get("module") == provider_module: + target_idx = i + break if target_idx is None: + def _provider_label(p: dict) -> str: + name = p.get("name") + module = p.get("module", "?").replace("provider-", "") + return f"{name} ({module})" if name else module + console.print( f"[red]Error:[/red] Provider '{provider}' not configured\n" - f"Available providers: {', '.join(p.get('module', '?').replace('provider-', '') for p in providers_list if isinstance(p, dict))}\n" + f"Available providers: {', '.join(_provider_label(p) for p in providers_list if isinstance(p, dict))}\n" f"Run 'amplifier provider use --help' for configuration options" ) sys.exit(1)