| 🛟 Updated. 28d5985 k33g 19h ago | 1 | # Reference: packages |
| 2 | |
| 3 | > Neutral, exhaustive description of what turbo-core holds. |
| 4 | |
| 5 | Eighteen packages. Dependencies run strictly downwards; there are no cycles and no interface indirection to prevent one. |
| 6 | |
| 7 | ``` |
| 8 | app → {editor, ui, lsp, buffer, terminal, filetree, settings, snippets, tools, syntax, theme, profile, version} |
| 9 | editor → {buffer, syntax, ui, theme} |
| 10 | terminal → {ui, theme, tcell, golang.org/x/sys} |
| 11 | filetree → {ui, theme, tcell} |
| 12 | snippets → {toml, projectfile, profile} |
| 13 | settings → {toml, projectfile, profile} |
| 14 | tools → {toml, projectfile, profile} |
| 15 | syntax → theme |
| 16 | ui → theme |
| 17 | theme → {profile-free; takes a directory}, tcell, toml |
| 18 | lsp → profile |
| 19 | ``` |
| 20 | |
| 21 | | Package | What it holds | Depends on | |
| 22 | | --- | --- | --- | |
| 23 | | `profile` | The editor's identity: name, slug, language server, starter templates, and the paths derived from them | **stdlib only** | |
| 24 | | `buffer` | The text of one file: lines of runes, cursor, selection, undo, search, load and save | **stdlib only** | |
| 25 | | `projectfile` | Atomic writes of the TOML files a project keeps in the editor's own directory | **stdlib only** | |
| 26 | | `version` | What build of itself a binary is: linker stamp, then Go build info | **stdlib only** | |
| 27 | | `jsonrpc` | JSON-RPC 2.0 over a framed stream: calls, notifications, inbound requests answerable later | **stdlib only** | |
| 28 | | `lsp` | LSP framing, the methods, and the child process | `jsonrpc`, `profile` | |
| 29 | | `theme` | TOML into tcell styles; eleven embedded themes plus the user's own; two kinds of inheritance | `tcell`, `toml` | |
| 30 | | `syntax` | Colouring: eight built-in languages, the registry an editor adds its own to, and the scanner toolkit | `theme` | |
| 31 | | `settings` | A project's `settings.toml`: load, create, rewrite one key in place | `toml`, `projectfile`, `profile` | |
| 32 | | `snippets` | Reusable text from a project's and a user's `snippets.toml`, grouped for a menu | `toml`, `projectfile`, `profile` | |
| 33 | | `tools` | The commands a project runs on itself, and which menu each is in | `toml`, `projectfile`, `profile` | |
| 34 | | `ui` | Turbo Vision widgets: painter, desktop, window, menu, dialog, controls, status bar | `theme`, `tcell` | |
| 35 | | `editor` | The editing widget: viewport, scrolling, keys, mouse, snippet insertion | `buffer`, `syntax`, `theme`, `ui` | |
| 36 | | `terminal` | A shell in a window: pseudo-terminal, VT/ANSI emulator, screen grid, the widget | `theme`, `ui`, `tcell`, `golang.org/x/sys` | |
| 37 | | `filetree` | A project's files as an expandable tree, and the window showing it | `theme`, `ui`, `tcell` | |
| 38 | | `acp` | A coding agent in a window: the Agent Client Protocol, the conversation, the widget | `jsonrpc`, `profile`, `projectfile`, `syntax`, `theme`, `ui`, `tcell`, `toml` | |
| 39 | | `app` | Assembly: menus, dialogs, event routing, completion popup, language-server lifecycle | all of the above | |
| 40 | |
| 41 | ## Third-party dependencies |
| 42 | |
| 43 | Three, and only three: |
| 44 | |
| 45 | | Module | Why | |
| 46 | | --- | --- | |
| 47 | | `github.com/gdamore/tcell/v2` | the terminal | |
| 48 | | `github.com/BurntSushi/toml` | every configuration file the editor reads | |
| 49 | | `golang.org/x/sys` | the pseudo-terminal ioctls on Linux and macOS; the pseudo-console, process and job-object calls on Windows | |
| 50 | |
| 51 | The tokeniser, the JSON-RPC client, the LSP framing and the VT/ANSI emulator are hand-written. |
| 52 | |
| 53 | ## The diagram |
| 54 | |
| 55 | `docs/diagrams/packages.drawio` holds the same graph in draw.io format, checked against `go list -deps`. |
| 56 | |
| 57 | ## See also |
| 58 | |
| 59 | - Why the graph is shaped this way: [architecture](../explanation/architecture.md) |