Setup Wizard and CLI Entry
March 11, 2026 ยท View on GitHub
Covers ductor command behavior, onboarding flow, and lifecycle commands.
Files
ductor_bot/__main__.py: CLI dispatch + config helpers +run_botductor_bot/cli_commands/lifecycle.py: start/stop/restart/upgrade/uninstall logicductor_bot/cli_commands/status.py:ductor status+ductor helpductor_bot/cli_commands/service.py: service command routingductor_bot/cli_commands/docker.py: docker subcommandsductor_bot/cli_commands/api_cmd.py: API enable/disable commandsductor_bot/cli_commands/agents.py: sub-agent registry commandsductor_bot/cli_commands/install.py: optional extras installer (ductor install <extra>)ductor_bot/infra/docker_extras.py: optional Docker package registry + Dockerfile generationductor_bot/cli/init_wizard.py: onboarding + smart reset
CLI commands
ductor: start bot (auto-onboarding if needed)ductor onboarding/ductor reset: onboarding flow (with smart reset when configured)ductor statusductor stopductor restartductor upgradeductor uninstallductor service <install|status|start|stop|logs|uninstall>ductor docker <rebuild|enable|disable|mount|unmount|mounts|extras|extras-add|extras-remove>ductor api <enable|disable>ductor agents <list|add|remove>ductor install <matrix|api>ductor help
Configuration gate
_is_configured() checks all active transports:
-
when
transportsis set: every listed transport must pass its checker -
when
transportsis empty: falls back to singletransport -
Telegram (default): valid non-placeholder
telegram_token+ non-emptyallowed_user_ids -
Matrix: non-empty
homeserver+ non-emptyuser_id
allowed_group_ids controls group authorization but does not satisfy startup configuration alone.
Onboarding flow (run_onboarding)
- banner
- provider install/auth check
- disclaimer
- transport selection (Telegram or Matrix)
- After initial setup, multiple transports can run in parallel via
the
transportsarray inconfig.json(see config.md)
- After initial setup, multiple transports can run in parallel via
the
- transport-specific credentials:
- Telegram: bot token prompt + user ID prompt
- Matrix: homeserver URL + bot user ID + password + allowed users
- Docker choice
- Docker extras selection (only when Docker enabled)
- timezone choice
- write merged config + initialize workspace
- optional service install
Step 7 shows a Rich table of optional AI/ML packages grouped by category (Audio/Speech, Vision/OCR, Document Processing, Scientific/Data, ML Frameworks, Web/Browser) with descriptions and size estimates. Users select via questionary.checkbox. Transitive dependencies are auto-resolved.
Return semantics:
Truewhen service install was completedFalseotherwise
Caller behavior:
- default
ductor: onboarding if needed, then foreground start unless service install path returnedTrue ductor onboarding/reset: callsstop_bot()first, then onboarding, then same service/foreground logic
Lifecycle command behavior
stop_bot()
Shutdown sequence:
- stop installed service (prevents auto-respawn)
- kill PID-file instance
- kill remaining ductor processes
- short lock-release wait on Windows
- stop Docker container when enabled
Restart
cmd_restart()=stop_bot()+ process re-exec- restart code
42is used for service-managed restart semantics
Upgrade
- dev installs: no self-upgrade, show guidance
- upgradeable installs: stop -> upgrade pipeline -> verify version -> restart
Uninstall
- stop bot/service
- optional Docker image cleanup
- remove
~/.ductorvia robust filesystem helper - uninstall package (
pipxorpip)
Status panel
ductor status shows:
- running state/PID/uptime
- provider/model
- Docker state
- error count from newest
ductor*.log - key paths
- sub-agent status table when configured (live health if bot is running)
Note: runtime primary log file is ~/.ductor/logs/agent.log; status error counter is currently ductor*.log-based.
Docker command notes
ductor docker ... commands update config.json and/or container/image state.
- mount/unmount paths are resolved and validated
- mount list shows host path, container target, status
- restart/rebuild is required for mount flag changes to affect running container
Docker extras management
ductor docker extrasshows a table of all available optional packages with their status (selected / โ) and a hint to rebuild after changes.ductor docker extras-add <id>adds an extra (+ transitive dependencies) toconfig.json.ductor docker extras-remove <id>removes an extra fromconfig.json, warns about reverse dependencies.- without
<id>,extras-add/extras-removelist available choices. - after add/remove, the user must run
ductor docker rebuildto apply changes to the Docker image. - selected extras are compiled into additional
RUNblocks appended to the baseDockerfile.sandboxat build time.
API command notes
ductor api enable:
- requires PyNaCl
- writes/updates
config.api - generates token when missing
ductor api disable:
- sets
config.api.enabled=false(keeps token/settings)
Both require bot restart to apply.
Service command routing
ductor service ... delegates to platform backends:
- Linux: systemd user service
- macOS: launchd Launch Agent
- Windows: Task Scheduler
Detailed backend behavior: service_management
ductor service logs:
- Linux:
journalctl --user -u ductor -f - macOS/Windows: tail from
~/.ductor/logs/agent.log(fallback newest*.log)