(a1a5d69) Add tags to a ticket with append --tags, keeping the ones it carries, and bump to 0.32.18
`set --tags` writes the whole field, so adding one tag to a ticket that
already carries some meant reading it first and retyping every one of
them. 30a2b34 wrote that down in the skill as the way to do it; this is
the flag that makes it unnecessary.
The merge is idempotent and ordered. A tag the ticket already carries is
reported as no change rather than added twice, which is the point of the
flag: the caller does not have to know what is there. A new one goes on
the end in the order it was given rather than sorting the field under
whoever last touched it. Values are split on commas the way the stored
field is, so `--tags "bug, tui"` names two tags and matches the two a
ticket carrying them already holds; without that the pair would land as
a single tag nothing can filter by and would not match itself on the
next call. `split_tags` is that rule, lifted out of `parse_tags` so the
argument and the field are separated by the same code.
It writes the same `Kind::Tags` entry `set --tags` writes, so `--actor`
and `--actor-from-git` come with it. Tags are logged wherever they move,
and the one command that adds to them without replacing them would
otherwise be the one tag change the log missed. The before and after are
read off the field rather than off the flag, so an append of `beta` onto
`alpha` reads as the pair and not as what the call asked for.
`non_empty` rather than the `clearable` that `set --tags` takes: that
message names `--clear`, and `append` has none, so it would send the
caller looking here for a flag that is `set`'s. A value that is only
separators reaches the handler and is refused there, in the words
`appended_items` refuses an all-blank section with. Emptying the field
stays `set --clear tags`.
`TAG_FLAGS` becomes pairs of command and flag, because `ls --tag` and
`append --tags` are spelled differently and one rule naming both options
would tell fish that each command accepts the other's. `add --tags` and
`set --tags` deliberately get no value rule and are recorded in the
test's `TAG_LIST_FLAGS` instead: they take the whole list, so the token
at the cursor is `bug,tui` and fish replaces a token entire, throwing
away what is already typed. The honesty test now walks `tag` and `tags`
both, so the next tag argument has to say which of the two it is.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
b4534eb86d
commit
7470255a22
+14
-8
@@ -169,16 +169,21 @@ worklane set 1b78a24 --clear due # take a value away again
|
||||
worklane set 1b78a24 --clear tags --clear plan # as many fields as you like
|
||||
worklane append 1b78a24 --acceptance "One more criterion"
|
||||
worklane append 1b78a24 --description "What was learned since."
|
||||
worklane append 1b78a24 --tags tui # add a tag, keeping the ones there
|
||||
worklane chown alice 1b78a24 # hand the ticket to someone
|
||||
worklane chown --clear 1b78a24 # hand it back to nobody
|
||||
```
|
||||
|
||||
`set` replaces, `append` adds, `--clear` empties. `set --tags` overwrites the whole
|
||||
field: to add a tag to a ticket that already carries one, replace the value with every
|
||||
tag separated by commas. Neither `set` nor `append` has `--owner` or `--status`: owner
|
||||
is `chown`'s and status is `mv`'s, so each field has exactly one writer. A field set to
|
||||
the value it already holds is reported unchanged and nothing is written, and so is a
|
||||
field cleared that was already unset.
|
||||
field, so **use `append --tags` to add a tag to a ticket that already carries some**: it
|
||||
keeps what is there, and a tag the ticket already has is reported as no change rather
|
||||
than added twice, so you do not have to read the ticket first. Several in one call by
|
||||
repeating the flag or by separating them with commas, `--tags "bug, tui"`, since that is
|
||||
how the field itself is written. Reach for `set --tags` when the whole list is being
|
||||
replaced, and `set --clear tags` to empty it: `append` has neither. Neither `set` nor
|
||||
`append` has `--owner` or `--status`: owner is `chown`'s and status is `mv`'s, so each
|
||||
field has exactly one writer. A field set to the value it already holds is reported
|
||||
unchanged and nothing is written, and so is a field cleared that was already unset.
|
||||
|
||||
**`--clear` takes the field as its value**, one of `due`, `tags`, `priority`,
|
||||
`description`, `acceptance` or `plan`, and repeats. It writes back exactly what `add`
|
||||
@@ -339,8 +344,8 @@ existing ticket will have been written from a different angle.
|
||||
|
||||
`show` ends with a HISTORY block: every comment on the ticket and every change to its
|
||||
status, owner, tags or campaign, oldest first, each naming who made it. You do not write
|
||||
these by hand. `mv`, `chown`, `set --tags` and `assign` record themselves, and a call
|
||||
that changes nothing records nothing. A campaign move is recorded by codename, or by
|
||||
these by hand. `mv`, `chown`, `set --tags`, `append --tags` and `assign` record
|
||||
themselves, and a call that changes nothing records nothing. A campaign move is recorded by codename, or by
|
||||
title for a campaign that has none, not by the uuid the field holds.
|
||||
|
||||
```
|
||||
@@ -380,7 +385,8 @@ you to move a ticket, or to put words on the board as their comment, so name the
|
||||
the flag — the move was theirs and the words are theirs, and an entry carrying your name
|
||||
reads later as though you decided both. Otherwise leave it off, unless your instructions
|
||||
say to use it. It is spelled the same on every command that writes an entry: `comment`,
|
||||
`mv`, `chown`, `set` and `assign`.
|
||||
`mv`, `chown`, `set`, `append` and `assign`. On the last two it reaches only the entry
|
||||
`--tags` writes, since that is the one field either of them logs.
|
||||
|
||||
Acting for the person without knowing how they spell themselves? `--actor-from-git`
|
||||
attributes the entry to the detected git user instead of `WORKLANE_ACTOR`, so their name
|
||||
|
||||
+16
-3
@@ -358,7 +358,7 @@ export const set = tool({
|
||||
|
||||
export const append = tool({
|
||||
description:
|
||||
"Add to a section of an existing worklane ticket without replacing what is there. The description gains a new paragraph; acceptance criteria and plan steps are added to the end of their lists, with steps numbered on from the last. Ticked criteria and handwritten content are left alone. To replace a section outright, use set.",
|
||||
"Add to an existing worklane ticket without replacing what is there. The description gains a new paragraph; acceptance criteria and plan steps are added to the end of their lists, with steps numbered on from the last; tags are added to the ones the ticket already carries. Ticked criteria and handwritten content are left alone. To replace a section or the whole tag list outright, use set.",
|
||||
args: {
|
||||
ticket: tool.schema
|
||||
.string()
|
||||
@@ -375,6 +375,14 @@ export const append = tool({
|
||||
.string()
|
||||
.describe("Implementation plan steps to add, one per line.")
|
||||
.optional(),
|
||||
tags: tool.schema
|
||||
.string()
|
||||
.describe("Tags to add, comma separated, keeping the ones the ticket already carries. A tag it already has is reported as no change rather than added twice, so the ticket does not have to be read first.")
|
||||
.optional(),
|
||||
actor: tool.schema
|
||||
.string()
|
||||
.describe("Who the entry is attributed to. Only reaches the entry tags writes, since that is the one field of this command's that is logged. If omitted, WORKLANE_ACTOR is used, then the git user.")
|
||||
.optional(),
|
||||
},
|
||||
async execute(args: Record<string, any>, context: ToolContext) {
|
||||
if (!args.ticket) {
|
||||
@@ -395,9 +403,14 @@ export const append = tool({
|
||||
if (args.plan) {
|
||||
itemLines(args.plan).forEach((line: string) => cmd.push("--plan", line));
|
||||
}
|
||||
if (args.tags) cmd.push("--tags", args.tags);
|
||||
// Last, and not counted as a field: the length check below is what refuses a call
|
||||
// that names nothing to add, and an actor alone adds nothing. Same shape as set.
|
||||
const fields = cmd.length;
|
||||
if (args.actor) cmd.push("--actor", args.actor);
|
||||
|
||||
if (cmd.length === 2) {
|
||||
return "Error appending: give at least one section to add to";
|
||||
if (fields === 2) {
|
||||
return "Error appending: give at least one field to add to";
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user