Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions docs/studio/behaviour/map.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,15 +260,20 @@ At most 15 parts: while there are more, the deepest level's sibling folders fold

A git repository whose map status is the empty state, with no map on the default branch, in the checkout or waiting on a PR, opens on the scan screen (`ui/map-scan.ts`, `server/src/map_scan.rs`, ticket #760), never a folder in no git repository or an Unreadable map. The page asks `map_scan` once each time the project's map opens, and says "Scanning this repository's folders…" until it answers. The server scans the main checkout, runs `system_map::check_text` on the skeleton in memory and adds the edges it computes to the skeleton as `import` links with no reason, one per pair of parts in the edge's direction; it answers with that map's text, each part's tracked file count, `read_languages`, `unread_languages`, and whether the runner would find `claude`. Nothing is written and no token is spent.

The canvas draws the skeleton's parts as grey plates (`.plate.draft`), each with its name and its folder and file count, and the links as lines from rim to rim. The plates are placed afresh on each draw and fitted to the canvas, with no fog, badges, footprints or marks, and no drag, pan or saved position. Beside them, the panel says the project has no `system-map.json` on its default branch and the teaching sentence, how many parts the scan proposes, then the languages line: the read languages with "links computed", then the unread ones with "no reader yet" ("TypeScript and Go: links computed. Ruby: no reader yet"; with none read, "no reader yet, so no links are drawn"). **Draft the map** follows, with a time hint of a quarter of a minute a part, a minute at least, and "Uses your Claude Code plan", never a dollar figure; the drafting run it starts is the Map draft's (#762). When `claude` is not found it is muted (`aria-disabled`) with a one-line reason, and the copy-prompt comes before it. The copy-prompt carries the skeleton as JSON and asks the user's own agent to write `system-map.json` at the main checkout's root, fill each part's name, caption and purpose from its files, and run `npx plotkeeper map check` until it passes; once the file is there, the window's next focus reads it from the checkout and draws the map in the scan's place. A scan that fails (git cannot list the files) leaves the plain "No map yet" screen and its prompt (#669). Below 1007 px the panel sits under the canvas.
The canvas draws the skeleton's parts as grey plates (`.plate.draft`), each with its name and its folder and file count, and the links as lines from rim to rim. The plates are placed afresh on each draw and fitted to the canvas, with no fog, badges, footprints or marks, and no drag, pan or saved position. A card sits centred on the canvas over the plates (`.map-scan-card`), which keep their full contrast. The card holds the title "No map yet", one line, "Claude can draft it from these N parts." ("Give the prompt to your own agent." without `claude`; "The scan found no code to propose parts from." with no parts), **Draft the map** with "Recommended · about N minutes" under it (a quarter of a minute a part, a minute at least; its hover says it runs on the Claude Code plan, never a dollar figure), and two openers: "Adjust parts (optional)" and "Use your own agent". Each opens a drawer at the screen's right edge (a light-dismissed popover with its title and Close); the drafting run Draft the map starts is the Map draft's (#762). When `claude` is not found, "Use your own agent" is the card's strong button above Draft the map, which is muted (`aria-disabled`), with no time hint, and "Needs the claude CLI, which is not on your PATH." under it. The copy-prompt carries the skeleton as JSON and asks the user's own agent to write `system-map.json` at the main checkout's root, fill each part's name, caption and purpose from its files, and run `npx plotkeeper map check` until it passes; once the file is there, the window's next focus reads it from the checkout and draws the map in the scan's place. A scan that fails (git cannot list the files) leaves the plain "No map yet" screen and its prompt (#669). Below 1007 px the panel sits under the canvas.

### Editing the skeleton

Before drafting, the person may fix the scan's grouping on the scan screen (ticket #761, stories 7-10); none of it is needed, and nothing is written. The skeleton is a value the page holds: each edit sends it with the edit to the server (`map_scan_edit`), which makes the edit in memory, runs `check_text` on the result and answers with the same reply as `map_scan`, its links computed again. Edits go one after another, each with the skeleton the one before left; an edit that fails keeps the skeleton and says why in the panel. Draft the map starts from the skeleton as the page holds it then (#762). The reply also carries the scan's reference-copy candidates, each ticked while the skeleton's `ignored` holds it, the loose files and tests (tracked files, code or not, that no part owns and no ignored folder holds), and, by part, the subfolders Split by subfolders would make parts of.
Before drafting, the person may fix the scan's grouping in the Adjust drawer and on the plates (ticket #761, stories 7-10); none of it is needed, and nothing is written. The skeleton is a value the page holds: each edit sends it with the edit to the server (`map_scan_edit`), which makes the edit in memory, runs `check_text` on the result and answers with the same reply as `map_scan`, its links computed again. Edits go one after another, each with the skeleton the one before left; an edit that fails keeps the skeleton and says why in the panel. Draft the map starts from the skeleton as the page holds it then (#762). The reply also carries the scan's reference-copy candidates, each ticked while the skeleton's `ignored` holds it, the loose files and tests (tracked files, code or not, that no part owns and no ignored folder holds), and, by part, the subfolders Split by subfolders would make parts of.

The Adjust drawer says "Optional. The draft works without this." and offers the edits by recommendation, one row a top-level folder of the loose files and tests together (the root's own files are one row, shown only when they hold code):

- **Recommended: leave out.** The folders with no code (no file a reader reads, by extension) whose leaving out the server allows, and the copies the scan found and left unticked, as chips with their file count, and one button, "Leave out these N", that sends an `ignore-folder` edit for each folder and an `ignore` edit for each copy, one after another. A chip's × keeps that folder in the map for the session: it moves down among the code. The root, and a folder holding a part's path, are never suggested, as `ignored` wins over the parts' paths.
- **Code no part holds yet.** One row a top-level folder, with its file count ("· no code" when it holds none) and a part picker: "Leave as is", "New part" or any part. Choosing one sends `home` with the folder's files at once, no Add to press; the files go to the part chosen, or to a new part named after their folder ("Root" for the root's own files): as their folder whole when no part's path is inside it, else each by its own path.
- **Left out.** The folders left out and the copies ticked, as chips, each with Undo, which takes it out of `ignored` and leaves its files loose again, making no part. After a press the focus goes to the first left-out folder's Undo, to the next row's picker, or to Leave out, else to the drawer's Close.

The drawer's foot holds "Tip: press a plate on the map to merge or split it." and the languages line.

- **Ignore.** The panel lists the candidates as checkboxes, ticked as the scan set them. Ticking one adds it to `ignored` and drops every part path inside it, a part left with none going; unticking it takes it out of `ignored`, and the folder, when no part's path covers it and it holds code, becomes a part of its own.
- **Loose files and tests.** One row a folder, naming its files (three, then "and N more"), with a choice of "A new part" or any part and Add. The files go to the part chosen, or to a new part named after their folder ("Root" for the root's own files): as their folder whole when no part's path is inside it, else each by its own path.
- **Ignore a loose folder.** Each loose row offers Ignore beside Add (`ignore-folder`): its folder goes into the skeleton's `ignored`, so its files leave the loose lists and the check needs no part for them, `check_text` and `plotkeeper map check` alike. Ignore is muted with its reason, and the server refuses it, on the root and on a folder that holds a part's files, as `ignored` wins over the parts' paths. The folders so ignored (the skeleton's `ignored` that are not candidates) are listed under Ignored folders, each with Unignore, which takes the folder out of `ignored` and leaves its files loose again, making no part. After either, the focus goes to that folder's Unignore, or to the first Ignore of its rows again. A folder with no loose files of its own that holds two or more rows (folders, or other parent rows) gets a **parent row** above them, indented, at every level (#790): it shows the folder and how many rows are right below it, and has Ignore alone, no Give to or Add, muted as a row's is when the folder holds a part's files. One press ignores the whole folder, and the server drops the `ignored` patterns inside it, so its Unignore brings every folder back, one ignored earlier on its own too. A folder with one row below it gets no parent row, since that row's Ignore does the job.
- **Merge into… and Split by subfolders.** A plate's press opens its actions beside it. Merge into… moves the part's paths into the part chosen. Split by subfolders makes a part of each subfolder holding the part's code; the part keeps its file paths, the files right in its folders and the subfolders with no code, and goes when it keeps nothing. It is offered when that leaves two parts owning code, else it is muted with the reason.

The parts' paths never nest, so which part owns a file never hangs on their order. A new part's id is its folder's name, with its parents' names added while the id is taken, then a number; its name is the folder's words. Each answer redraws the plates and lines; the panel is patched in place, so it stays open at its scroll and a focused box or button keeps the focus, and after a merge or a split the focus goes to the plate merged into or split. A draw of the same scan (a focus, a session's event) keeps the plates, and an open plate's actions with them.
Expand Down
Loading