address review feedback on #890: default provider, --listener-port, top-level imports

This commit is contained in:
Adil Hafeez 2026-04-17 13:00:23 -07:00
parent cf8d297600
commit c054523ecf
3 changed files with 81 additions and 15 deletions

View file

@ -6,7 +6,13 @@ import sys
import contextlib
import logging
import rich_click as click
import yaml
from planoai import targets
from planoai.defaults import (
DEFAULT_LLM_LISTENER_PORT,
detect_providers,
synthesize_default_config,
)
# Brand color - Plano purple
PLANO_COLOR = "#969FF4"
@ -317,7 +323,23 @@ def build(docker):
help="Show detailed startup logs with timestamps.",
is_flag=True,
)
def up(file, path, foreground, with_tracing, tracing_port, docker, verbose):
@click.option(
"--listener-port",
default=DEFAULT_LLM_LISTENER_PORT,
type=int,
show_default=True,
help="Override the LLM listener port when running without a config file. Ignored when a config file is present.",
)
def up(
file,
path,
foreground,
with_tracing,
tracing_port,
docker,
verbose,
listener_port,
):
"""Starts Plano."""
from rich.status import Status
@ -332,15 +354,8 @@ def up(file, path, foreground, with_tracing, tracing_port, docker, verbose):
# pass-through config that covers the common LLM providers and
# auto-wires OTel export to ``planoai obs``. See cli/planoai/defaults.py.
if not os.path.exists(plano_config_file):
import yaml
from planoai.defaults import (
detect_providers,
synthesize_default_config,
)
detection = detect_providers()
cfg_dict = synthesize_default_config()
cfg_dict = synthesize_default_config(listener_port=listener_port)
default_dir = os.path.expanduser("~/.plano")
os.makedirs(default_dir, exist_ok=True)
@ -350,7 +365,7 @@ def up(file, path, foreground, with_tracing, tracing_port, docker, verbose):
plano_config_file = synthesized_path
console.print(
f"[dim]No plano config found; using defaults ({detection.summary}). "
f"Listening on :12000, tracing -> http://localhost:4317.[/dim]"
f"Listening on :{listener_port}, tracing -> http://localhost:4317.[/dim]"
)
if not docker: