Commit Graph

7 Commits

Author SHA1 Message Date
joakim 59861bc3bf Implement report system and fix template task filtering
- Fix template task filtering bug: templates now hidden from all reports
  except 'template' and 'all' reports, even when using custom filters
- Add support for status:template filter to explicitly show templates
- Implement comprehensive report system with 12 predefined reports:
  * active - Started tasks
  * all - All tasks including templates
  * completed - Completed tasks
  * list - Pending tasks (default)
  * minimal - Pending tasks in minimal format
  * newest - Most recent pending tasks
  * oldest - Oldest pending tasks
  * overdue - Overdue tasks
  * ready - Tasks ready to work on
  * recurring - Pending recurring instances
  * template - Recurring template tasks
  * waiting - Hidden/waiting tasks
- Replace list command with report-based architecture
- Add configurable default_report option (defaults to 'list')
- Add minimal display format (ID + description only)
- Support flexible syntax: 'opal <report> [filters]' or 'opal [filters] <report>'
- Add 'opal reports' command to list all available reports
2026-01-05 21:17:07 +01:00
joakim 944d628ca1 feat: Phase 3 - CLI sync commands
- Created comprehensive sync command suite:
  - 'opal sync init' - Configure sync with server (URL, API key)
  - 'opal sync status' - Show sync configuration and queue status
  - 'opal sync now' - Bidirectional sync with conflict resolution
  - 'opal sync up' - Push local changes to server
  - 'opal sync down' - Pull server changes to local
  - 'opal sync log' - View conflict resolution log
- Added interactive prompts for init (URL and API key)
- Automatic client ID generation (UUID)
- Display user-friendly sync results with emojis
- Support for viewing queued offline changes
- Integration with config system for persistent sync settings
2026-01-05 16:19:00 +01:00
joakim ba0cfc08e3 feat: Phase 1 - Core API server with authentication
- Added database schema for users, api_keys, sync_state, change_log, and sync_config
- Implemented API key generation and validation with bcrypt hashing
- Created Chi-based REST API server with endpoints for:
  - Task CRUD operations (create, read, update, delete)
  - Task actions (complete, start, stop)
  - Tag management (list, add, remove)
  - Projects listing
  - Health check endpoint
- Added middleware for authentication and CORS
- Implemented change log tracking with triggers (key:value format)
- Added configurable change log retention (default 30 days)
- Created server CLI commands (opal server start, opal server keygen)
- Dependencies added: golang.org/x/crypto/bcrypt, github.com/go-chi/chi/v5
2026-01-05 16:14:49 +01:00
joakim 79eb3bb62a Add info and edit commands for interactive task management
- Add 'opal info' command to display detailed task information
  - Shows all task attributes including UUID, timestamps, and metadata
  - Supports flexible syntax (opal info 2 or opal 2 info)
  - Displays recurrence information and parent UUID for recurring tasks

- Add 'opal edit' command to edit tasks in $EDITOR
  - Opens task in text editor with human-readable format
  - Supports all editable fields with smart date formatting
  - Special handling for recurring tasks (updates parent template)
  - Status changes trigger appropriate methods (Complete/Delete)
  - Auto-saves changes on editor exit without confirmation
  - Clear validation and error messages

- Register new commands in root command dispatcher
2026-01-05 11:05:20 +01:00
joakim 4b59b004f1 Fix help flags to show root help instead of list help
Previously, 'opal -h', 'opal --help', and 'opal help' would show the
list command help instead of the root command help. This was because
the argument preprocessing logic would rewrite these as 'opal list -h'
before Cobra could handle them.

Now we detect help flags/command before preprocessing and let Cobra
handle them naturally. This ensures:
- 'opal -h' and 'opal --help' show root help
- 'opal help' shows root help
- 'opal help <command>' shows command-specific help
- 'opal <command> -h' still shows command-specific help
- All existing flexible syntax continues to work
2026-01-05 10:27:12 +01:00
joakim a68d701d14 Fix three critical UX issues in opal-task
Issue 1: Fix recurrence calculation for overdue tasks
- Use completion date (End) as base for next instance, not original due date
- If task due Monday completed Wednesday, next is Wednesday+7d not Monday+7d
- Fallback to Due date if End is not set
- Update test to verify new behavior

Issue 2: Fix description parsing to work without quotes
- Add parseAddArgs() to extract description from non-modifier words
- Description = all words that don't start with +, -, or contain :
- Enables: opal add buy groceries +shop carrots → 'buy groceries carrots'
- Validate description is required (error if only modifiers)
- Validate recurring tasks require due date

Issue 3: Implement flexible command syntax
- Add preprocessArgs() to parse arguments before Cobra routing
- Detect command position and split filters (left) from modifiers (right)
- Rewrite os.Args so Cobra routes correctly
- Enable both 'opal 2 done' and 'opal done 2' syntax
- Commands without modifiers accept filters on either side
- Commands with modifiers enforce [filters] command [modifiers]
- Add confirmation for modify without filters (modifies all tasks)

All commands updated to use preprocessed ParsedArgs from context.
All tests passing (33 tests).
2026-01-04 21:24:14 +01:00
joakim 6e6c3dbea4 Implement opal-task Phases 6-8: Complete CLI Implementation
Phase 6: Display and Basic Commands
- Add display.go with colored formatting for tasks, projects, tags
- Implement cmd/root.go with Cobra command structure
- Implement cmd/list.go for listing and filtering tasks
- Implement cmd/add.go with support for regular and recurring tasks
- Implement cmd/done.go with bulk completion and confirmation

Phase 7: Advanced Commands
- Implement cmd/modify.go for updating task attributes
- Implement cmd/delete.go with soft delete confirmation
- Implement cmd/start.go and cmd/stop.go for task timing
- Implement cmd/count.go for counting filtered tasks
- Implement cmd/projects.go and cmd/tags.go for aggregation

Phase 8: Integration and Polish
- Update main.go to use CLI commands
- Add colored output with fatih/color
- Format task lists with proper alignment
- Highlight overdue tasks in red, upcoming in yellow
- Test end-to-end workflow: add, list, done, recurring tasks
- Verify recurrence spawning works correctly

All CLI commands functional and tested!
2026-01-04 18:17:04 +01:00