Skip to content

fix(memory): move list items between sections without losing them - #394

Open
arthware-dev wants to merge 7 commits into
feature/0.5.0-beta.1from
fix/list-section-moves
Open

arthware-dev wants to merge 7 commits into
feature/0.5.0-beta.1from
fix/list-section-moves

Conversation

@arthware-dev

Copy link
Copy Markdown
Contributor

Summary

  • Asked to sort the groceries by aisle, the agent ran list add <list> <item> --section <section> on items already on the list, which changed nothing, then list move to the same list, which deleted the item. add --section now moves an open item to that section, and move --section moves it within its list. Both are one commit, so no item can be lost between taking it out and putting it back.
  • list set --section no longer accepts an order that leaves out a section still holding items, so no item is left under a heading the list no longer knows.
  • Removing or moving the last item under a # title keeps the title.

Rebase merge: the four commits stand alone, each is its own changelog line.

Refs: #392
Refs: #393

Removing the last item under a `#` heading deleted that heading,
although a `#` heading is not a section of the list: it is a title a
person wrote in Obsidian or Forgejo. Only a `##` section heading the
removal leaves empty is removed now.

A move between sections takes the item's line out the same way, so
without this every sort could delete such a title.

Refs: #393
`stack memory list add <list> <item> --section <section>` on an item
that was already open answered "already on" and changed nothing, so
sorting a list into its sections did nothing. The agent then removed
items to add them again and lost them when its turn ended in between.

An open item now moves to the section named, in the same commit as
the items the command adds:

- Its line moves as written, with its people, date, links and
  sub-items. `--for` and `--due` are for new items only, and the
  answer says so.
- A ticked item of the same name stays where it is.
- Without `--section`, or with the section it is in already, nothing
  changes.

Refs: #393
`stack memory list move <list> <item> --to <list>` with the list the
item is on deleted the item: a move adds to the target and then
removes from the source, the add was skipped because the item was
already there, and the remove took its only line.

A move within one list is now one change of the file:

- `move <list> <item> --section <section>`, with or without `--to`
  naming the same list, moves the item under that heading.
- Without `--section` it is refused with how to sort an item into a
  section, and the list stays as it is.
- The item is named by its whole name: a part of a name, or an item
  that is only ticked, is refused with the open items.
- `--section` with a move to another list puts the item in that
  section there. Without it, a move to another list is unchanged.

Refs: #393
`stack memory list set <list> --section ...` replaced the list's
sections with whatever it was given. The agent once gave it item
names, and every item was left under a heading the list no longer
knew: nothing could be added there, and the agent could not name it.

An order that leaves out a section still holding items, ticked ones
included, is now refused with each such section and its count, and
the list stays as it is. An order naming every section with items is
taken, with new sections added; empty sections may be left out. The
refusal says how to rename a section.

Refs: #392
Told that the milk belongs to the dairy products, the agent wrote
`stack memory list move <list> Milch --to "<section>"`, the section's
name where the list's name goes, and was refused each time with "no
list". It never tried `add --section`.

A `--to` that names no list but a section of the item's list now moves
the items to that section, as `move --section` does: one commit, each
line moved as written. A list of that name still wins. A `--to` naming
neither is refused with the lists and the list's sections, and on a
list without sections a mistyped list name never becomes a heading.

Refs: #393
Sorting an item already on a list with `add --section` and also
`--for` or `--due` gave a commit subject of about 170 characters
that ended in the answer's note to the agent ("--for and --due were
given to new items only; ..."). The code that shortens a long subject
read the note as part of the section's name.

A subject now stops before the note, as it stops before the next
clause of an answer. The commit body keeps the whole answer.

Refs: #393
Asked to sort the groceries by aisle, the agent wrote one
`stack memory list add` with every item and a `--section` per aisle.
Only the last `--section` counted, so every item already on the list
moved to that one section and the others were left empty.

`add` and `move` now refuse a `--section` that names more than one
section, and `move` a `--to` that names more than one place. The
refusal says to run one command per section, and nothing changes.
One section, or the same one written twice, works as before.

Refs: #393
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant