feat: add interactive setup wizard for first-run configuration

Implement a comprehensive setup wizard to improve onboarding and
configuration experience for both personal and server deployments.

Key features:
- Interactive wizard with profile selection (personal/server/custom)
- Quick setup mode with sensible defaults
- First-run detection with helpful welcome message
- Directory configuration with validation
- Server OAuth/JWT configuration with auto-generation
- Environment file creation for server deployments
- Template generators for systemd service and env files

New commands:
- opal setup              # Interactive wizard
- opal setup --quick      # Quick setup with defaults
- opal setup --profile    # Use specific profile
- opal setup --show-systemd  # Show systemd template
- opal setup --show-env   # Show environment file template

Implementation:
- internal/wizard/prompts.go: Reusable prompt utilities
- internal/wizard/profiles.go: Profile definitions and templates
- cmd/setup.go: Main setup command implementation
- cmd/root.go: First-run detection and welcome message
- internal/engine/config.go: ConfigExists() and IsFirstRun() helpers

User experience:
- On first run, shows welcome message suggesting 'opal setup'
- Non-intrusive - creates defaults automatically if skipped
- Wizard guides through all configuration options
- Server setup includes OAuth/JWT configuration
- Environment file created with proper permissions (0600)
- Clear next steps displayed after completion
This commit is contained in:
2026-01-06 21:49:13 +01:00
parent 5d01c9f564
commit 140d9f7f25
6 changed files with 721 additions and 2 deletions
+37 -1
View File
@@ -1,5 +1,20 @@
# Opal task manager
This is the counterpart to jade, where we track tasks.
## Quick Start
**First-time setup:**
```bash
opal setup # Interactive setup wizard
opal setup --quick # Quick setup with defaults
```
**Basic usage:**
```bash
opal add "Buy groceries" +personal due:tomorrow
opal list
opal done 1
```
## Syntax
`opal [<filter>] [<command>] [<modifier>]`
@@ -31,7 +46,28 @@ A task can be recurring. Then we have a template task and instances of that task
`opal add Change sheets due:sun recur:1w` - A task to be done every sunday.
A recurring task is given a status of recurring which hides it from view. The recurring task you create is called the template task, from which recurring tasks instances are created. So the template remains hidden, and the recurring instances that spawn from it are the tasks that you will see and complete.
## Storage
## Setup & Configuration
### Interactive Setup Wizard
Run the setup wizard on first use or to reconfigure:
```bash
opal setup # Interactive wizard
opal setup --quick # Quick setup with defaults
opal setup --profile=server # Use server profile
opal setup --show-systemd # Show systemd service template
opal setup --show-env # Show environment file template
```
The wizard guides you through:
- Choosing a deployment profile (personal/server)
- Configuring storage directories
- Setting task management preferences
- Optional server configuration (OAuth/JWT)
- Optional sync setup
### Storage
**Configuration:** `~/.config/opal/opal.yml` (or `$XDG_CONFIG_HOME/opal/opal.yml`)
**Database:** `~/.local/share/opal/opal.db` (or `$XDG_DATA_HOME/opal/opal.db`)