From ba929c035c7c74113d061c57cc5b500af0b20b74 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 23 Mar 2026 08:03:40 +0200 Subject: fix: use uuid: filter for start/stop/done/annotate/modify commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Taskwarrior expects the filter before the action verb. Commands like 'task start ' are invalid — the UUID must be part of the filter: 'task uuid: start'. All mutation commands now use this pattern consistently, matching how priority/tag/denotate already worked. Co-Authored-By: Claude Sonnet 4.6 --- internal/askcli/command_write.go | 12 +++++++----- internal/askcli/command_write_test.go | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/internal/askcli/command_write.go b/internal/askcli/command_write.go index c55bd95..b07ce3e 100644 --- a/internal/askcli/command_write.go +++ b/internal/askcli/command_write.go @@ -39,7 +39,7 @@ func (d Dispatcher) handleModify(ctx context.Context, args []string, stdout, std } modArgs := args[2:] var outBuf bytes.Buffer - code, err := d.runner.Run(ctx, append([]string{"modify", uuid}, modArgs...), nil, &outBuf, io.Discard) + code, err := d.runner.Run(ctx, append([]string{"uuid:" + uuid, "modify"}, modArgs...), nil, &outBuf, io.Discard) if code != 0 { return code, err } @@ -59,7 +59,7 @@ func (d Dispatcher) handleAnnotate(ctx context.Context, args []string, stdout, s } note := strings.Join(args[2:], " ") var outBuf bytes.Buffer - code, err := d.runner.Run(ctx, []string{"annotate", uuid, note}, nil, &outBuf, io.Discard) + code, err := d.runner.Run(ctx, []string{"uuid:" + uuid, "annotate", note}, nil, &outBuf, io.Discard) if code != 0 { return code, err } @@ -78,7 +78,9 @@ func (d Dispatcher) handleStart(ctx context.Context, args []string, stdout, stde return 1, nil } var outBuf bytes.Buffer - code, err := d.runner.Run(ctx, []string{"start", uuid}, nil, &outBuf, io.Discard) + // uuid: is used as the filter so taskwarrior selects the exact task; + // the action verb follows the filter. + code, err := d.runner.Run(ctx, []string{"uuid:" + uuid, "start"}, nil, &outBuf, io.Discard) if code != 0 { return code, err } @@ -97,7 +99,7 @@ func (d Dispatcher) handleStop(ctx context.Context, args []string, stdout, stder return 1, nil } var outBuf bytes.Buffer - code, err := d.runner.Run(ctx, []string{"stop", uuid}, nil, &outBuf, io.Discard) + code, err := d.runner.Run(ctx, []string{"uuid:" + uuid, "stop"}, nil, &outBuf, io.Discard) if code != 0 { return code, err } @@ -116,7 +118,7 @@ func (d Dispatcher) handleDone(ctx context.Context, args []string, stdout, stder return 1, nil } var outBuf bytes.Buffer - code, err := d.runner.Run(ctx, []string{"done", uuid}, nil, &outBuf, io.Discard) + code, err := d.runner.Run(ctx, []string{"uuid:" + uuid, "done"}, nil, &outBuf, io.Discard) if code != 0 { return code, err } diff --git a/internal/askcli/command_write_test.go b/internal/askcli/command_write_test.go index f0e062d..2e494db 100644 --- a/internal/askcli/command_write_test.go +++ b/internal/askcli/command_write_test.go @@ -201,12 +201,14 @@ func TestAllWriteHandlers_PassCorrectArgs(t *testing.T) { args []string wantArgs []string }{ + // All commands use uuid: as the filter so taskwarrior selects + // the exact task; the action verb and any arguments follow. {"denotate", []string{"denotate", "my-uuid", "text"}, []string{"uuid:my-uuid", "denotate", "text"}}, - {"modify", []string{"modify", "my-uuid", "priority:H"}, []string{"modify", "my-uuid", "priority:H"}}, - {"annotate", []string{"annotate", "my-uuid", "note"}, []string{"annotate", "my-uuid", "note"}}, - {"start", []string{"start", "my-uuid"}, []string{"start", "my-uuid"}}, - {"stop", []string{"stop", "my-uuid"}, []string{"stop", "my-uuid"}}, - {"done", []string{"done", "my-uuid"}, []string{"done", "my-uuid"}}, + {"modify", []string{"modify", "my-uuid", "priority:H"}, []string{"uuid:my-uuid", "modify", "priority:H"}}, + {"annotate", []string{"annotate", "my-uuid", "note"}, []string{"uuid:my-uuid", "annotate", "note"}}, + {"start", []string{"start", "my-uuid"}, []string{"uuid:my-uuid", "start"}}, + {"stop", []string{"stop", "my-uuid"}, []string{"uuid:my-uuid", "stop"}}, + {"done", []string{"done", "my-uuid"}, []string{"uuid:my-uuid", "done"}}, {"priority", []string{"priority", "my-uuid", "H"}, []string{"uuid:my-uuid", "modify", "priority:H"}}, {"tag", []string{"tag", "my-uuid", "+cli"}, []string{"uuid:my-uuid", "modify", "+cli"}}, } -- cgit v1.2.3