fix: keep onboard cli defaults unchanged
Remove the PR changes that made nanobot onboard default to the wizard, added --defaults, added non-TTY fallback behavior, and changed the Docker smoke command. Keep Quick Start available through nanobot onboard --wizard.
This commit is contained in:
+10
-36
@@ -432,36 +432,16 @@ def main(
|
||||
# ============================================================================
|
||||
|
||||
|
||||
def _onboard_can_prompt() -> bool:
|
||||
"""Return True when onboard can safely show interactive prompts."""
|
||||
return sys.stdin.isatty() and sys.stdout.isatty()
|
||||
|
||||
|
||||
@app.command()
|
||||
def onboard(
|
||||
workspace: str | None = typer.Option(None, "--workspace", "-w", help="Workspace directory"),
|
||||
config: str | None = typer.Option(None, "--config", "-c", help="Path to config file"),
|
||||
wizard: bool = typer.Option(False, "--wizard", help="Use interactive wizard (default)"),
|
||||
defaults: bool = typer.Option(
|
||||
False,
|
||||
"--defaults",
|
||||
help="Create or refresh the default config without the wizard",
|
||||
),
|
||||
wizard: bool = typer.Option(False, "--wizard", help="Use interactive wizard"),
|
||||
):
|
||||
"""Initialize nanobot configuration and workspace."""
|
||||
from nanobot.config.loader import get_config_path, load_config, save_config, set_config_path
|
||||
from nanobot.config.schema import Config
|
||||
|
||||
can_prompt = _onboard_can_prompt()
|
||||
wants_wizard = wizard or not defaults
|
||||
use_wizard = wants_wizard and not defaults and can_prompt
|
||||
default_fallback = wants_wizard and not use_wizard and not defaults
|
||||
default_refresh_without_prompt = defaults and not can_prompt
|
||||
if default_fallback:
|
||||
console.print(
|
||||
"[yellow]No interactive terminal detected; using --defaults setup instead.[/yellow]"
|
||||
)
|
||||
|
||||
if config:
|
||||
config_path = Path(config).expanduser().resolve()
|
||||
set_config_path(config_path)
|
||||
@@ -474,20 +454,10 @@ def onboard(
|
||||
loaded.agents.defaults.workspace = workspace
|
||||
return loaded
|
||||
|
||||
def _refresh_existing_config() -> Config:
|
||||
refreshed = _apply_workspace_override(load_config(config_path))
|
||||
save_config(refreshed, config_path)
|
||||
console.print(
|
||||
f"[green]✓[/green] Config refreshed at {config_path} (existing values preserved)"
|
||||
)
|
||||
return refreshed
|
||||
|
||||
# Create or update config
|
||||
if config_path.exists():
|
||||
if use_wizard:
|
||||
if wizard:
|
||||
config = _apply_workspace_override(load_config(config_path))
|
||||
elif default_fallback or default_refresh_without_prompt:
|
||||
config = _refresh_existing_config()
|
||||
else:
|
||||
console.print(f"[yellow]Config already exists at {config_path}[/yellow]")
|
||||
console.print(
|
||||
@@ -501,16 +471,20 @@ def onboard(
|
||||
save_config(config, config_path)
|
||||
console.print(f"[green]✓[/green] Config reset to defaults at {config_path}")
|
||||
else:
|
||||
config = _refresh_existing_config()
|
||||
config = _apply_workspace_override(load_config(config_path))
|
||||
save_config(config, config_path)
|
||||
console.print(
|
||||
f"[green]✓[/green] Config refreshed at {config_path} (existing values preserved)"
|
||||
)
|
||||
else:
|
||||
config = _apply_workspace_override(Config())
|
||||
# In wizard mode, don't save yet - the wizard will handle saving if should_save=True
|
||||
if not use_wizard:
|
||||
if not wizard:
|
||||
save_config(config, config_path)
|
||||
console.print(f"[green]✓[/green] Created config at {config_path}")
|
||||
|
||||
# Run interactive wizard if enabled
|
||||
if use_wizard:
|
||||
if wizard:
|
||||
from nanobot.cli.onboard import run_onboard
|
||||
|
||||
try:
|
||||
@@ -544,7 +518,7 @@ def onboard(
|
||||
|
||||
console.print(f"\n{__logo__} nanobot is ready!")
|
||||
console.print("\nNext steps:")
|
||||
if use_wizard:
|
||||
if wizard:
|
||||
console.print(f" 1. Chat: [cyan]{agent_cmd}[/cyan]")
|
||||
console.print(f" 2. Start gateway: [cyan]{gateway_cmd}[/cyan]")
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user