(d637288) Add campaign set, and bump to 0.21.0

`campaign add --codename` was the only writer of the field, so a campaign
already on the board could not be given one without editing the file by
hand -- which is every campaign filed before 0.20.0.

A `campaign set`, not a flag on something narrower: the file has more than
one editable thing, and the moment somebody wants to fix a typo in a title
there would be a second command to design. It carries `--title`, which
renames the file the way `set --title` does, and `--codename`, through the
same parser `campaign add` takes. Built out of `set`'s own parts --
`set_title`, `apply`, `report`, and the whole-file no-op comparison -- so
nothing about writing a field lives twice.

The codename goes through `set_or_insert_metadata_field` rather than
`set_metadata_field`: a campaign filed before the field existed has no such
line, and those are exactly the campaigns this is for. That exposed a
second thing -- `Codename` was not in `METADATA_ORDER`, so an inserted line
landed at the end of the block while `campaign_body` writes it under the
ID, two shapes of one file. It is in the list now, directly after ID.

`save_ticket` split into `save_entry` with `save_ticket` and
`save_campaign` as named wrappers, so a campaign gets the same write-then-
rename a ticket has rather than a second copy of it. `write_then_replace`
and `find_entry_file` take the noun, so a failure says "campaign" where it
is one.

No `--description`, filed as 32e98ab: `set` and `append` are a pair for a
prose section, and replacing a description with no way to add a paragraph
is the half that loses the rest of it. No `--owner` and no `--clear`, each
for a reason recorded on the ticket.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ansho Rei
2026-08-23 12:22:59 +02:00
co-authored by Claude Opus 5
parent 528566d103
commit 72dbdec2ec
12 changed files with 463 additions and 33 deletions
+9 -1
View File
@@ -1261,8 +1261,16 @@ pub fn parse_tags(content: &str) -> Vec<String> {
/// stamps follow `Created At`, since they answer the same question it does about a
/// later moment, and they are in flow order for a reader who sees one after another
/// across a board.
const METADATA_ORDER: [&str; 11] = [
///
/// `Codename` is a *campaign's* field and sits here for the same reason Campaign does: this
/// is the one list that decides where an inserted field lands, and a campaign filed before
/// the field existed is precisely the file `campaign set --codename` has to insert into.
/// Directly after ID, because that is where `campaign_body` writes it, so a campaign given
/// a codename later ends up with the same file as one filed with it. Nothing ever upserts
/// it on a ticket, so its place in a ticket's order costs nothing.
const METADATA_ORDER: [&str; 12] = [
"ID",
CODENAME_FIELD,
"Priority",
"Tags",
"Due",