Files
joakim 7aaaa86a0a feat: add annotations, undo system, and schema updates
Add annotations as JSON column on tasks table with Annotate/Denotate
methods and CLI commands. Add undo system backed by change_log with
lightweight undo_stack table (capped at 10 entries). All mutating CLI
commands (add, done, delete, modify, start, stop) now record undo
entries. Undo restores prior task state from change_log data.

Schema changes (in v1 migration):
- annotations TEXT column on tasks
- undo_stack table
- annotations field in change_log triggers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 13:54:58 +01:00

29 lines
576 B
Go

package cmd
import (
"fmt"
"os"
"git.jnss.me/joakim/opal/internal/engine"
"github.com/spf13/cobra"
)
var undoCmd = &cobra.Command{
Use: "undo",
Short: "Undo the last action",
Long: `Undo the most recent mutating action (add, done, delete, modify, start, stop).
The undo stack keeps the last 10 operations. Each undo pops one operation.
Examples:
opal undo`,
Run: func(cmd *cobra.Command, args []string) {
description, err := engine.PopUndo()
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
fmt.Println(description)
},
}