From 1e2e96f92d6fb25ae55303d90444534369bda0aa Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 23 Mar 2026 08:21:27 +0200 Subject: fix: correct taskwarrior filter ordering in dep and info commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - command_dep.go handleDepAddRm: was passing uuid as a modification argument (task modify depends:...) which could modify ALL agent tasks; now uses uuid: as filter - command_dep.go handleDepList: updated deprecated 'uuid ' space syntax to canonical 'uuid:' colon syntax - command_info_add.go handleInfo: same space→colon fix for consistency All mutation commands now uniformly use uuid: as the filter before the action verb. Co-Authored-By: Claude Sonnet 4.6 --- internal/askcli/command_dep.go | 5 +++-- internal/askcli/command_dep_test.go | 6 ++++++ internal/askcli/command_info_add.go | 2 +- internal/askcli/command_info_add_test.go | 3 ++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/internal/askcli/command_dep.go b/internal/askcli/command_dep.go index 035186e..7f51fdc 100644 --- a/internal/askcli/command_dep.go +++ b/internal/askcli/command_dep.go @@ -48,7 +48,8 @@ func (d Dispatcher) handleDepAddRm(ctx context.Context, args []string, stdout, s modArg = "depends:-" + depUUID } var outBuf bytes.Buffer - code, err := d.runner.Run(ctx, []string{"modify", uuid, modArg}, nil, &outBuf, io.Discard) + // uuid: scopes the modify to exactly one task; modArg sets the dependency. + code, err := d.runner.Run(ctx, []string{"uuid:" + uuid, "modify", modArg}, nil, &outBuf, io.Discard) if code != 0 { return code, err } @@ -67,7 +68,7 @@ func (d Dispatcher) handleDepList(ctx context.Context, args []string, stdout, st return 1, nil } var outBuf bytes.Buffer - code, err := d.runner.Run(ctx, []string{"uuid", uuid, "export"}, nil, &outBuf, stderr) + code, err := d.runner.Run(ctx, []string{"uuid:" + uuid, "export"}, nil, &outBuf, stderr) if code != 0 { return code, err } diff --git a/internal/askcli/command_dep_test.go b/internal/askcli/command_dep_test.go index 26ddf08..b059dd8 100644 --- a/internal/askcli/command_dep_test.go +++ b/internal/askcli/command_dep_test.go @@ -9,7 +9,9 @@ import ( ) func TestHandleDep_AddSuccess(t *testing.T) { + var capturedArgs []string d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { + capturedArgs = args return 0, nil }}) var stdout, stderr bytes.Buffer @@ -20,6 +22,10 @@ func TestHandleDep_AddSuccess(t *testing.T) { if !strings.Contains(stdout.String(), "ok") || !strings.Contains(stdout.String(), "uuid-1") { t.Fatalf("stdout = %q, want ok + uuid", stdout.String()) } + // Verify uuid: is the filter (not a modification argument). + if len(capturedArgs) < 3 || capturedArgs[0] != "uuid:uuid-1" || capturedArgs[1] != "modify" { + t.Fatalf("capturedArgs = %v, want [uuid:uuid-1, modify, depends:uuid-2]", capturedArgs) + } } func TestHandleDep_RmSuccess(t *testing.T) { diff --git a/internal/askcli/command_info_add.go b/internal/askcli/command_info_add.go index 5b76b2b..5545881 100644 --- a/internal/askcli/command_info_add.go +++ b/internal/askcli/command_info_add.go @@ -18,7 +18,7 @@ func (d Dispatcher) handleInfo(ctx context.Context, args []string, stdout, stder return 1, nil } var outBuf bytes.Buffer - code, err := d.runner.Run(ctx, []string{"uuid", uuid, "export"}, nil, &outBuf, stderr) + code, err := d.runner.Run(ctx, []string{"uuid:" + uuid, "export"}, nil, &outBuf, stderr) if code != 0 { return code, err } diff --git a/internal/askcli/command_info_add_test.go b/internal/askcli/command_info_add_test.go index b809097..ce821ca 100644 --- a/internal/askcli/command_info_add_test.go +++ b/internal/askcli/command_info_add_test.go @@ -11,7 +11,8 @@ import ( func TestHandleInfo_Success(t *testing.T) { jsonData := `[{"uuid":"test-uuid","description":"Test task","status":"pending","priority":"H","tags":["cli","agent"],"urgency":15.0,"depends":["dep-1"],"annotations":[{"description":"Note 1","entry":"2026-03-22T10:00:00Z"}]}]` d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { - if args[0] == "uuid" { + // args[0] is "uuid:" (the filter); emit data for any export call + if len(args) > 0 && strings.HasPrefix(args[0], "uuid:") { io.WriteString(stdout, jsonData) } return 0, nil -- cgit v1.2.3