Skip to content

Your lightweight open-source personal agent.

removed duplicated code

Aleksander W. Oleszkiewicz (Alek)be8ac1e48423
diff --git a/nanobot/cli/commands.py b/nanobot/cli/commands.py
index 4ed4f314b..18e0977f8 100644
--- a/nanobot/cli/commands.py
+++ b/nanobot/cli/commands.py
@@ -597,11 +597,7 @@ 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"),
- refresh: bool = typer.Option(
- False,
- "--refresh",
- help="Refresh config, preserving existing settings without prompting",
- ),
+ non_interactive_refresh: bool = typer.Option(False, "--refresh", help="Refresh config, preserving existing settings without prompting"),
):
"""Initialize nanobot configuration and workspace."""
from nanobot.config.loader import get_config_path, load_config, save_config, set_config_path
@@ -623,25 +619,24 @@ def onboard(
if config_path.exists():
if wizard:
config = _apply_workspace_override(load_config(config_path))
- elif refresh:
- 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:
- console.print(f"[yellow]Config already exists at {config_path}[/yellow]")
- console.print(
- " [bold]y[/bold] = overwrite with defaults (existing values will be lost)"
- )
- console.print(
- " [bold]N[/bold] = refresh config, keeping existing values and adding new fields"
- )
- if typer.confirm("Overwrite?"):
- config = _apply_workspace_override(Config())
- save_config(config, config_path)
- console.print(f"[green]✓[/green] Config reset to defaults at {config_path}")
- else:
+ should_refresh = non_interactive_refresh
+ if not non_interactive_refresh:
+ console.print(f"[yellow]Config already exists at {config_path}[/yellow]")
+ console.print(
+ " [bold]y[/bold] = overwrite with defaults (existing values will be lost)"
+ )
+ console.print(
+ " [bold]N[/bold] = refresh config, keeping existing values and adding new fields"
+ )
+ if typer.confirm("Overwrite?"):
+ config = _apply_workspace_override(Config())
+ save_config(config, config_path)
+ console.print(f"[green]✓[/green] Config reset to defaults at {config_path}")
+ else:
+ should_refresh = True
+
+ if should_refresh:
config = _apply_workspace_override(load_config(config_path))
save_config(config, config_path)
console.print(