summaryrefslogtreecommitdiff
path: root/internal/askcli/command_info_add_test.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_test.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_test.go')
-rw-r--r--internal/askcli/command_info_add_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/internal/askcli/command_info_add_test.go b/internal/askcli/command_info_add_test.go
index ce821ca..f4dc5c1 100644
--- a/internal/askcli/command_info_add_test.go
+++ b/internal/askcli/command_info_add_test.go
@@ -185,4 +185,26 @@ func TestParseAddArgs(t *testing.T) {
if desc != "Old task" || len(mods) != 1 || mods[0] != "-deprecated" {
t.Fatalf("parseAddArgs([\"-deprecated\", \"Old task\"]) = mods=%v, desc=%q", mods, desc)
}
+
+ // An arg starting with "+" but containing spaces is NOT a modifier — it is
+ // the start of the description. This prevents agents from quoting tag+desc
+ // together (e.g. "+code-quality Fix foo") and having them land in the wrong
+ // place.
+ mods, desc = parseAddArgs([]string{"+code-quality Fix foo bar"})
+ if desc != "+code-quality Fix foo bar" || len(mods) != 0 {
+ t.Fatalf("space-containing +arg should be description, got mods=%v, desc=%q", mods, desc)
+ }
+
+ // Same issue when mixed: a proper tag precedes a space-containing arg.
+ mods, desc = parseAddArgs([]string{"+cli", "+code-quality Fix foo bar"})
+ if desc != "+code-quality Fix foo bar" || len(mods) != 1 || mods[0] != "+cli" {
+ t.Fatalf("mixed case: mods=%v, desc=%q", mods, desc)
+ }
+
+ // All-modifier args (no description) should return empty description, not a
+ // duplicate of the modifiers.
+ mods, desc = parseAddArgs([]string{"+cli", "+agent"})
+ if desc != "" || len(mods) != 2 {
+ t.Fatalf("all-modifier case: mods=%v, desc=%q, want empty desc", mods, desc)
+ }
}