(1db02e5) Give the board a tags file, and bump to 0.25.0

The board carried twenty-four tags and defined none of them. `campaign` and
`campaigns` were both on it, one ticket each side, and nothing on disk could
have caught that.

`.worklane/tags.md` is the vocabulary: one level-two heading per tag, its
annotation as the prose under it, alphabetical by byte so a near-duplicate
lands next to what it duplicates. `worklane tags add <tag> --annotation`
writes it, `init` creates it empty, and `tags add` creates it on demand for a
board that predates it.

Declaring a tag tags no ticket, and tagging a ticket declares nothing. The
counts stay derived from the status directories, so the file and the board can
disagree; reporting that disagreement is 9564ac9.

`tags` becomes a group with an optional subcommand. The bare form is still the
listing, byte for byte, because the shipped fish completion calls it that way
to fill in `ls --tag`; `tags ls` is the same arm.

Every write re-renders the whole file from the parsed vocabulary rather than
splicing one section, which is why an unreadable file is an error in
`TagIndex::load` where an unreadable campaigns directory is an empty index:
empty here would mean erased.

`no_tag_taking_option_is_missing` used to panic on any tag positional. It now
allows what `TAG_NEW_COMMANDS` records, which is `tags add` alone: the tag it
takes does not exist yet, so completing it from `worklane tags` would offer
exactly the values it refuses.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ansho Rei
2026-08-23 15:47:05 +02:00
co-authored by Claude Opus 5
parent b1dbf3ed75
commit f515d69930
8 changed files with 739 additions and 16 deletions
+28 -6
View File
@@ -351,6 +351,18 @@ mod tests {
assert_eq!(seen, 4, "expected assign, campaign show, campaign set and ls --campaign");
}
/// Commands whose tag positional names a tag that does not exist yet.
///
/// `tags add` declares a word the board has never carried, so completing it from
/// `worklane tags` would offer exactly the values the command refuses. Recorded rather
/// than skipped, so the *next* tag positional has to say which it is: `tags set` takes
/// a tag that is already declared and wants a rule in the fish block, and the test
/// below fails until it gets one or lands here.
///
/// In the test module because nothing outside it reads the list; the rule it encodes is
/// about what the fish block is missing, which is a test's question.
const TAG_NEW_COMMANDS: [(&str, &str); 1] = [("tags", "add")];
/// Tags have their own list because their values come from `worklane tags` rather than
/// from a listing of objects, so a second tag-taking option would need that rule and
/// not the campaign one.
@@ -363,19 +375,29 @@ mod tests {
}
seen += 1;
let name = path.join(" ");
let long = arg.get_long().unwrap_or_else(|| {
panic!(
let Some(long) = arg.get_long() else {
let nested = match path.as_slice() {
[parent, child] => {
TAG_NEW_COMMANDS.contains(&(parent.as_str(), child.as_str()))
}
_ => false,
};
assert!(
nested,
"`worklane {name}` takes a tag as a positional, \
which the fish block has no rule for"
)
});
which the fish block has no rule for"
);
continue;
};
assert!(
TAG_FLAGS.contains(&long),
"`worklane {name} --{long}` takes a tag but is not in TAG_FLAGS"
);
}
assert_eq!(seen, 1, "expected ls --tag");
assert_eq!(seen, 2, "expected ls --tag and tags add");
}
/// **Every rule naming an option has to say which command it belongs to.** A bare