grokkit/cmd/workon.go
Greg Gauthier 9080cf7f3e feat(workon): add initial workon command for starting todo items
Introduces the `workon` CLI command which selects the next queued todo item,
moves it to doing/, creates a git branch, generates a work plan via Grok,
appends it to the file, and commits the changes. Includes skeleton implementation
with TODOs for full functionality.
2026-03-31 20:30:05 +01:00

41 lines
1.1 KiB
Go

package cmd
import (
"fmt"
"github.com/spf13/cobra"
"gmgauthier.com/grokkit/internal/logger"
"gmgauthier.com/grokkit/internal/workon" // we'll create this next
)
var workonCmd = &cobra.Command{
Use: "workon",
Short: "Start work on the next todo item from the queue",
Long: `workon picks the next .md file from todo/queued/,
moves it to todo/doing/, creates a matching git branch,
asks Grok to generate a Work Plan section,
appends it to the file, and commits everything.
Purely transactional — one command, clear success or failure.`,
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) != 0 {
return fmt.Errorf("workon takes no arguments")
}
logger.Info("Starting workon transaction")
if err := workon.Run(); err != nil {
return fmt.Errorf("workon failed: %w", err)
}
logger.Info("Workon completed successfully")
return nil
},
}
func init() {
workonCmd.Flags().StringP("message", "m", "", "Custom commit message (default: \"Start working on <item>\")")
// -f and -c flags will be added later when the spec needs them
}