summaryrefslogtreecommitdiff
path: root/internal/askcli/command_info_add.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-23 22:41:39 +0200
committerPaul Buetow <paul@buetow.org>2026-03-23 22:41:39 +0200
commit5beb39a3338e83c9a5906d2e5f7acb3bf795811d (patch)
tree0777ad808aa9e8dd5ae9b3a6c149a2b8eac579d7 /internal/askcli/command_info_add.go
parentb18ee2f6b6e0cb7164a7bbbc8efbb4c75cffade6 (diff)
fix: prevent ask add from swallowing tags into descriptions, add rc.confirmation=offv0.25.11
parseAddArgs now rejects args that start with '+'/'-' but contain spaces as modifiers — those are description text, not tags (tags cannot have spaces). This prevents agents from quoting tag+description together and having the tag silently land in the task description with no tag applied. Also removed the fallthrough that duplicated all-modifier args as description. Added rc.confirmation=off to every taskwarrior invocation so that write operations (done, delete, start, etc.) succeed non-interactively when stdin is unavailable (as is always the case when called from an agent). Bump version to v0.25.11. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/askcli/command_info_add.go')
-rw-r--r--internal/askcli/command_info_add.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/internal/askcli/command_info_add.go b/internal/askcli/command_info_add.go
index 0de9be5..2680163 100644
--- a/internal/askcli/command_info_add.go
+++ b/internal/askcli/command_info_add.go
@@ -70,15 +70,22 @@ func extractUUIDFromAddOutput(output string) string {
return ""
}
+// parseAddArgs splits args into taskwarrior modifier tokens and the description.
+// Modifier tokens are args that start with "priority:", "+", or "-" AND contain
+// no spaces (tags and priority flags cannot have spaces). The first arg that is
+// not a modifier begins the description; all remaining args are joined with spaces.
+// If all args are modifiers the description is empty.
func parseAddArgs(args []string) (modifiers []string, description string) {
for i, arg := range args {
- if strings.HasPrefix(arg, "priority:") || strings.HasPrefix(arg, "+") || strings.HasPrefix(arg, "-") {
+ isModifier := !strings.Contains(arg, " ") &&
+ (strings.HasPrefix(arg, "priority:") || strings.HasPrefix(arg, "+") || strings.HasPrefix(arg, "-"))
+ if isModifier {
modifiers = append(modifiers, arg)
} else {
description = strings.Join(args[i:], " ")
return
}
}
- description = strings.Join(args, " ")
+ // All args were modifiers; no description provided.
return
}