Commands
legato sidebar prints the sidebar as JSON: its collections, their sections and the pages in each.
legato arrange [file] changes the arrangement. It reads a JSON object from the file, or from stdin when there is no file. The object's op is one of set_collection, delete_collection, set_section, delete_section or move_page. Its other fields are the arguments of the MCP tool of that name. This object takes the page budget out of its section:
{"op": "move_page", "page_id": "budget", "section_id": null}Answers and refusals are JSON on stdout. Success exits with status 0, and a refusal with status 1.
Every answer has sidebar, the whole arrangement as it now is. legato arrange adds fields that depend on the op:
op | Adds |
|---|---|
set_collection | collection_id and created |
set_section | section_id and created |
move_page | page_id, collection_id and section_id |
delete_collection | deleted, moved_to, moved and note |
delete_section | deleted, moved and note |
set_section without a section_id makes a new section every time it runs, and set_collection without a collection_id makes a new collection. Keep the id from the answer to change or delete it later.
Reading and moving a page
This example adds a page and a section to your sidebar, moves the page into the section, then removes both. Start with the page and the section:
printf '%s\n' '{"title":"Example","cards":[{"id":"note","type":"text","body":"Hello"}]}' | legato set example --if-match none
legato sidebar
printf '%s\n' '{"op":"set_section","name":"Example"}' | legato arrangelegato sidebar prints {"sidebar": {...}}. The set_section answer has created, which is true, the new section's section_id, and sidebar. Use that section_id to move the page:
printf '%s\n' '{"op":"move_page","page_id":"example","section_id":"example-section-id"}' | legato arrangeReplace example-section-id with the id from the answer. The move prints page_id, collection_id, section_id and the sidebar with the page in its new place.
To remove the section and the page:
printf '%s\n' '{"op":"delete_section","section_id":"example-section-id"}' | legato arrange
legato delete exampleDeleting a section deletes no pages. Its pages stay in the same collection, outside any section, and the answer names them in moved. legato delete then moves the example page to the Trash.