# Files & Docs

Read and edit a project's files, markdown docs and Pages beside its terminals, without leaving Rundesk.

Want a quick look at a README, a doc, some code or an image without leaving your agents? Every project has a **Files** tree, and a **Docs** tab beside it when the project has docs. Pick something and it opens on the right while the list stays in the sidebar, so you can even watch a page change while an agent writes it. A project with a pages folder for your own writing also has a **Pages** tab, described on [Writing pages](/docs/pages.md).

None of the tabs changes a file on its own: a file changes only when you save your edits, or make, move, rename or delete a file or folder, as [Edit, create, move, rename and delete files](#edit-create-move-rename-and-delete-files) describes, and an export writes only the file you pick.

## Browse a project's files

The button on a project's header is named after the tabs it opens: **Files** alone, **Files & Docs** when the project has docs, and **Files & Pages** when it has a pages folder, with docs or without.

1. Hover a project's header and choose **Files**, **Files & Docs** or **Files & Pages**. When it has more than one tab, pick the **Files** tab.
2. Browse the tree, or type in **Search files**.
3. Pick a file to open it on the right.

**Agents**, or Esc, goes back to the project's rows.

- Folders come before files, and names sort in natural order, so `2-` comes before `10-`.
- **Search files** lists the files whose path holds every word you type, best matches first, and below them the files whose text holds it, at most 100, each with its first five matching lines. A pasted path finds its file too: relative or absolute, with backslashes from Windows, or in quotes. Down steps into the results, Enter opens the first, and Esc clears the search.
- The arrow keys move through the tree, Home and End jump, Enter or Space opens, and left and right collapse and expand.
- Right-click any row for **New** › **New file** or **New folder**, first in the menu, a file's going into its folder, for **Copy path** and **Delete**, and on a file for **Open** › **Open in new tab** or **Open in editor**. Shift+F10 opens the same menu on the row you are on. To make a file or folder at the top of the project, right-click below the rows, or click **+** beside **Search files** and pick **New file** or **New folder**.
- Every right-click menu of a path, here and in Docs, Pages and Changes, on a tab, and the **⋯** menu of an open file, shows its common items at once and gathers the rest under **Open**, **New**, **Export** and **Move**. A group with one item shows that item instead. Rest the pointer on a group, or press → or Enter on it, to open it. ↑ and ↓ move inside it, and ← or Esc closes it.

The pages folder belongs to Pages: the tree shows it, but nothing in it can be made, renamed, moved or deleted there, and those menu items say **Managed in Pages**, with a tooltip naming the way out: add `pages: false` to the project's command file ([`desk.yml`](/docs/desk-yml.md#turn-the-docs-or-pages-off-for-a-project)) to edit the folder here. A sheet you pick opens in the Pages tab, and any other file there opens to read only.

In a git checkout the tree lists what git sees. A file's name shows what changed since the last commit: blue when modified, green when new or renamed, and a folder takes a lighter tint of the strongest change inside it. A file with unsaved text turns orange instead, as [Edit, create, move, rename and delete files](#edit-create-move-rename-and-delete-files) describes. Files git ignores, such as `.env`, show in gray and open only when you pick them, and an ignored folder such as `node_modules` shows as one row that lists its contents when you open it. Files an agent adds or removes appear on their own.

## Read a project's docs

The **Docs** tab shows when the project's docs folder holds a markdown page; without one, there is no Docs tab. The docs folder is the folder the project's [`desk.yml`](/docs/desk-yml.md) names under `docs:`, and `docs/` without one; the view lists pages from that folder only. [Where docs live](/docs/writing-docs.md#where-docs-live) says what counts as docs, and [Writing docs](/docs/writing-docs.md) covers how to write the pages.

The **Docs** tab lists each page by its title. The folder's own pages come first, then each folder as a section, with `README.md` first and the rest by name. **Search docs** finds pages by title, file name or path, the same pasted paths as Files included, and below those the pages whose text holds what you typed. As in Files, a page changed since the last commit is blue or green, and a page git ignores is gray; the [docs check](#see-what-a-doc-needs-fixed), which finds what a page needs fixed, never reads an ignored page, so put docs outside ignored folders.

Right-click a page in the Docs list, or press Shift+F10 on it, for **Copy path**, **Open** › **Open in new tab** or **Open in editor**, **Delete** and the export items below.

## What an open file shows

Each open file has a tab in a bar over it. Under the tabs, a row shows the open file's whole path in the project (for a sheet, its folders and its first line instead, as [Writing pages](/docs/pages.md) describes), with **Find** at its right end, a markdown file's formatted and source switch, and a **⋯** menu, on any file but a sheet. **Find** opens the same search as ⌘F, and closes it when it is open. You can type into a text file and save it with ⌘S, as [Edit, create, move, rename and delete files](#edit-create-move-rename-and-delete-files) describes.

- Clicking a file opens it in a preview tab, its name in italics, which the next file you click replaces. A file already open switches to its tab.
- Double-click a file, or choose **Open** › **Open in new tab** from its right-click menu, to give it a tab that stays. Double-click the preview tab to make it stay.
- The X on a tab, shown on hover, closes it, as do a middle click and ⌘W (Ctrl+Shift+W on Windows) for the tab on screen.
- Drag a tab along the bar to reorder it. The arrow keys, Home and End move between tabs.
- Right-click a tab, or open the path row's **⋯** menu (a sheet has none: right-click its tab or its row in Pages), for **Copy path**, **Open in editor**, a markdown page's exports under **Export**, and **Close tab** at the end, with **Close all tabs** below it when more than one tab is open. Press Enter on the italic tab to make it stay.

Each workspace has its own tabs while the app runs, and each tab comes back at the scroll and view you left it on.

| File type | Display |
|---|---|
| Markdown | Drawn as a page, with tables, task lists, alerts, footnotes, code colored for its language, and `mermaid` diagrams and charts. Switch between **View formatted** and **View source**. |
| Images | Shown as themselves. |
| CSV and TSV | A table, its first row as the headings, which stay in view as you scroll. Click a heading to sort by it, rising, then falling, then back to the file's order; drag a heading's edge to widen its column, or double-click the edge to fit it again. Neither changes the file. Switch between **View as table** and **View source**. |
| Text and code | Highlighted for their language, with line numbers and wrapped lines. |
| Other files | A message to open the file in your editor instead. |

A markdown page with front matter shows its `title`, `subtitle` and `intent` as its header, with its infobox beside the text on a wide window or under the header on a narrow one. A page in the docs folder also shows, above its title, the sections it sits in. On a wide window, a page with two headings or more lists them under **On this page**, marking the section in view. HTML written into a markdown file is not drawn.

When the file you are reading is among the project's current changes, the path row shows **Show changes** with the lines it adds and removes, such as `+12 −3`. Click it to open the file's diff against the last commit.

Links between files of the project open them here. A link to code, such as a citation, opens it in a tab of its own, and a web link opens in your browser.

## Diagrams in markdown

An entity relationship diagram (`erDiagram`) draws each table as a card listing its columns' keys, names and types, laid out automatically, with lines between the related columns. Tables tagged into areas take each area's color, and a legend above the diagram names them; it stays above the diagram on the page, and in the expanded view stays along the top while you pan and zoom.

A diagram wider than the page starts scaled down to fit its width, so you see all of it at once, and a very tall one is scaled to fit most of the window's height. A diagram that already fits is shown at its own size.

Every drawn diagram has an **Expand** button in its top-right corner. It opens the diagram over the window, where the scroll wheel or a pinch zooms toward the pointer, dragging moves it, and **Fit** shows it whole again; Esc, a click outside it or **Collapse** closes it. **Export as JPG** there saves that diagram alone, drawn light on white.

## Edit, create, move, rename and delete files

Click into a text or code file and type, as in any code editor: its colors stay on as you type, and undo, redo, Tab to indent and closing brackets and quotes work as you expect. A markdown or CSV file is edited in its source view; the formatted page and the table only show it. A sheet in a project's pages folder is the exception: you type into it formatted, as [Writing pages](/docs/pages.md) describes. A file in a commit or a diff, an image, and a file that isn't UTF-8 can't be edited.

- **⌘S** (Ctrl+S on Windows) saves. A tab with unsaved changes shows `*` after its name until you save, and the file's name turns orange, over git's blue or green, in the Files tree, the Docs and Pages lists and on its tab. A folder holding one takes a lighter orange. The orange goes when you save, discard your changes or undo back to the saved text. Rundesk never saves your text on its own (**Page settings** writes a sheet's `page:` block as you change it), and its tools never let an agent write your files, apart from making and ordering sheets in Pages.
- Your unsaved text stays when you switch tabs or workspaces. Closing the tab, closing all tabs, removing the project or quitting asks first: **Save**, **Don't save** or **Cancel**.
- If an agent or another editor changes the file while you have unsaved changes, Rundesk tells you instead of writing over it: **Discard my changes** loads the file as it is now, and **Save mine over it** saves yours.
- **New file** and **New folder** ask for a name right in the tree. A name with `/`, such as `src/lib/util.ts`, makes its folders too. A new file opens in a tab, ready to type into, and a markdown or CSV file opens in its source even if you last picked **View formatted**; a new folder shows open in the tree, empty, ready for what you put in it.
- In the Docs list, **New** › **New page** and **New folder** do the same inside your docs folder: right-click a section, or below the pages, or click **+** beside **Search docs**. A page gets `.md` if you leave it off, and opens in its source so you can start writing. A new folder shows as a section right away, even before it holds a page.
- **Drag** a file or folder to move it. The card beside the pointer says where it will land:
  - onto a folder: moves it into that folder;
  - onto a file: moves it beside that file;
  - onto **Move to** and your project's name, which appears over the search as you drag: moves it to the top of the project.

  On a row like `parent / child`, drop onto the name of the folder you mean. Hold it over a closed folder for a moment and the folder opens, so you can reach one inside it. Press Esc to cancel. In the Docs list, drag a page or section onto a section, or onto **Move to Docs** for the top; pages stay inside your docs folder.
- **Rename** on a row's right-click menu, or F2, edits the name right in the tree. Type `lib/util.ts` to move the file into `lib` as you rename it, or choose **Move to** to type the whole path from the top, so you can move anything without a mouse. Open tabs and unsaved changes follow the file. **Undo** in the message that appears, or ⌘Z in the tree (Ctrl+Z on Windows), puts it back.
- **Delete** on a row's right-click menu, or the Delete key (⌘⌫ also works, Ctrl+Backspace on Windows), asks first, saying how many files a folder holds and whether you'd lose unsaved changes. Then it moves the file or folder to the Trash (the Recycle Bin on Windows), where you can restore it. It works the same on a page or section in the Docs list, where a section you empty leaves the list and the docs folder itself has no row to delete. The project's own folder and its `.git` folder can't be deleted.

## Find text in a file

⌘F (Ctrl+F on Windows) opens a find bar, and ⌘A (Ctrl+A) selects the whole file. Code and markdown share the bar: every match is marked and counted, Enter goes to the next, Shift+Enter to the one before, and Esc closes the bar.

## Jump to a method, function or heading

In a code file, the path row names the class and method you are reading, such as **Refund › issue**, and follows you as you scroll. Click it, or press ⌘⇧O (Ctrl+Shift+O on Windows), to open the file's outline: its classes, methods and functions in order, each method under its class. Type part of a name to filter it, use the arrow keys to move, and press Enter or click to jump there; the line is marked as a search result's is, and Esc closes the list. It works in every language Rundesk colors, from TypeScript, Python and C# to Swift, Kotlin, shell, SQL and Lua; a file with nothing to declare, such as JSON or CSS, says so.

A markdown file's outline is its headings, each under the one above it, and the path row names the headings you are under, such as **Setup › Install › macOS**, formatted or in source. Pick one to jump there: the page scrolls to it and marks it for a moment.

## Read a file while it changes

While a file is shown, Rundesk checks it every second and reads it again when it changes, so a doc an agent is writing updates as you read. The last version remains on screen until the new one arrives, so the view never blanks.

## Export a page

A markdown file shown formatted offers **Export** › **Export as PDF** and **Export as JPG** in the path row's **⋯** menu. **Export as PDF** is on macOS only, and on Windows **Export as JPG** shows by itself, with no **Export** submenu. Right-click a page in the Docs list for the same two. Rundesk asks where to save, offering your Downloads folder.

- **PDF** prints the page as a document: dark text on plain white, half-inch margins, diagrams drawn light, the infobox as a table on the right, and the References on a page of their own. A block never splits across a page break unless it is taller than a page. Each page's foot carries `Workspace › Project`, `Page N of M` and `Exported from rundesk.app`. Web links stay clickable; links to other pages or to code become plain text.
- **JPG** is the whole page in one image, in the app's dark look, with the same footer at its end.

An export leaves out what only works in Rundesk: the docs check's count, the `[citation needed]` marks and **On this page**. A PDF or JPG is named after the project and the page's title, such as `Rundesk – Teamwork`.

## Export the docs as one PDF

**Export docs as PDF**, the download button beside **Search docs** in the Docs tab, saves every page of the docs folder as one PDF, on macOS. Right-click a section in the Docs list for **Export as PDF** to save that section alone. A dialog shows how far it is, page by page, with **Cancel** while the pages are rendered; a long folder then pauses for a few seconds while the PDF is written.

The PDF opens with a cover and a contents page, each entry a link to its page, and a sidebar outline in Preview and other PDF viewers. Every page starts on a new sheet, and a link to another page in the PDF jumps to it. A citation's link to code shows the file's path, since the reader may not have the code. It is named after the project and what it holds, such as `Rundesk – Docs` or `Rundesk – Agents`.

## See what a doc needs fixed

A page in the docs folder shows the findings of the docs check above its title, such as `3 citations needed · 1 hint`. Click the count to list them, and click a line to jump to its place in the page. Each uncited sentence ends with a red `[citation needed]` mark, a citation whose file is not there shows its number in red, and each page in the Docs list shows its count of warnings beside its name.

The mark is there because every statement in a project's docs cites the code that does it, so a sentence with no source cannot pass for a checked one; [Why docs cite their sources](/docs/writing-docs.md#why-docs-cite-their-sources) explains it.

The check only reads, so nothing is written into your pages, and agents working in the project see the same findings. [Check your docs](/docs/writing-docs.md#check-your-docs) lists what counts as a warning and what as a hint.

## Related pages

- [Writing docs](/docs/writing-docs.md): the format the **Docs** tab reads, and how to cite the code.
- [desk.yml](/docs/desk-yml.md#docs-where-the-projects-docs-live-and-how-theyre-checked): point the **Docs** tab at a folder other than `docs/`.
- [Workspaces and projects](/docs/projects.md): the sidebar and project header these views open from.
