|
1 | | -# go-tui-template |
| 1 | +# meshd |
2 | 2 |
|
3 | | -Personal base template for Go terminal UIs built on the [Charm](https://charm.sh) stack. |
| 3 | +A terminal UI for [Syncthing](https://syncthing.net) — monitor folders and devices, view sync status, and manage pending connections, all without leaving your terminal. |
4 | 4 |
|
5 | | -## Stack |
| 5 | +Built on the same Go/Bubbletea stack as [tuitube](https://github.com/gitcoder89431/tuitube). |
6 | 6 |
|
7 | | -- [Bubble Tea v2](https://charm.land/bubbletea/v2) — TUI framework |
8 | | -- [Lip Gloss v2](https://charm.land/lipgloss/v2) — styling and layout |
9 | | -- [Bubbles](https://github.com/charmbracelet/bubbles) — components (table, spinner, list, etc.) |
10 | | -- [GoReleaser v2](https://goreleaser.com) — release pipeline |
| 7 | +## What it looks like |
| 8 | + |
| 9 | +``` |
| 10 | +┌─ Dashboard ──────────────────────────────────────────────────┐ |
| 11 | +│ Folders ///////////////// Devices ////////////////////////// │ |
| 12 | +│ Projects ✓ Up to Date MacBook ● Online │ |
| 13 | +│ Photos ↻ Syncing 87% Phone ↻ Syncing 43% │ |
| 14 | +│ Docs ✓ Up to Date Work PC ○ Offline │ |
| 15 | +│ ──────────────────────────────────────────────────────────── │ |
| 16 | +│ Projects — /home/dev/Projects │ |
| 17 | +│ Shared with 2 device(s): │ |
| 18 | +│ └─ MacBook │ |
| 19 | +│ └─ Phone │ |
| 20 | +└──────────────────────────────────────────────────────────────┘ |
| 21 | +``` |
| 22 | + |
| 23 | +## Features |
| 24 | + |
| 25 | +- **Dashboard** — split folders/devices view with live sync status badges, detail panel for the selected item |
| 26 | +- **Pending** — lists devices and folders waiting to be accepted or dismissed |
| 27 | +- **Themes** — 15+ built-in themes via `ctrl+k` → Themes |
| 28 | +- **Command palette** — `ctrl+k` for quick navigation |
| 29 | +- **Auto-polls** every 10 seconds; press `r` to force refresh |
| 30 | +- **Auto-reads API key** from Syncthing config — no manual setup |
11 | 31 |
|
12 | | -## What's included |
| 32 | +## Requirements |
13 | 33 |
|
14 | | -- Header / sidebar / main / footer layout |
15 | | -- Screen router with sidebar navigation |
16 | | -- Command palette (`ctrl+k`) |
17 | | -- Global keybindings and help overlay (`?`) |
18 | | -- Theme system with 15+ built-in themes (`ctrl+t` to cycle) |
19 | | -- Debug log screen |
20 | | -- GoReleaser config + GitHub Actions release workflow (push tag or manual bump) |
| 34 | +- [Syncthing](https://syncthing.net) installed and running |
| 35 | +- Go 1.26+ |
21 | 36 |
|
22 | | -## Starting a new project |
| 37 | +## Install |
23 | 38 |
|
24 | 39 | ```bash |
25 | | -gh repo create my-new-app --template gitcoder89431/go-tui-template --clone |
26 | | -cd my-new-app |
| 40 | +# From source |
| 41 | +git clone https://github.com/gitcoder89431/meshd |
| 42 | +cd meshd |
| 43 | +go install ./cmd/meshd |
27 | 44 |
|
28 | | -# Rename the module and binary |
29 | | -OLD=github.com/gitcoder89431/go-tui-template |
30 | | -NEW=github.com/yourname/my-new-app |
31 | | -find . -type f -name "*.go" -exec sed -i "s|$OLD|$NEW|g" {} + |
32 | | -sed -i "s|$OLD|$NEW|g" go.mod |
33 | | -sed -i "s|go-tui-template|my-new-app|g" internal/config/config.go .goreleaser.yaml Dockerfile .github/workflows/publish.yml |
34 | | -mv cmd/go-tui-template cmd/my-new-app |
| 45 | +# Or download a release binary (see Releases) |
| 46 | +``` |
| 47 | + |
| 48 | +## Setup |
| 49 | + |
| 50 | +Start Syncthing if it isn't already running: |
| 51 | + |
| 52 | +```bash |
| 53 | +# Linux (systemd) |
| 54 | +systemctl --user enable --now syncthing |
| 55 | + |
| 56 | +# macOS |
| 57 | +brew services start syncthing |
| 58 | +``` |
35 | 59 |
|
36 | | -# Update README and AGENTS.md |
| 60 | +Then just run: |
37 | 61 |
|
38 | | -go mod tidy |
39 | | -go run ./cmd/my-new-app |
| 62 | +```bash |
| 63 | +meshd |
40 | 64 | ``` |
41 | 65 |
|
42 | | -## Adding a screen |
| 66 | +meshd reads your Syncthing API key automatically from the default config location (`~/.local/state/syncthing/config.xml` on Linux, `~/Library/Application Support/Syncthing/config.xml` on macOS). No copy-pasting required. |
43 | 67 |
|
44 | | -1. Create a file in `internal/screens/`. |
45 | | -2. Implement the `screens.Screen` interface: `Init`, `Update`, `View`, `Title`, and `KeyBindings`. |
46 | | -3. Register the screen in `registerScreens` in `internal/app/app.go`. |
47 | | -4. Add the screen ID to the `preferred` slice in `refreshScreenOrder` if it belongs in the primary sidebar. |
48 | | -5. Register a command in `registerCommands` if the screen should be reachable from `ctrl+k`. |
49 | | -6. Run `go test ./...` and `go build ./cmd/go-tui-template`. |
| 68 | +### Options |
| 69 | + |
| 70 | +``` |
| 71 | +meshd --url http://127.0.0.1:8384 # custom Syncthing URL (default) |
| 72 | +meshd --key <api-key> # override API key |
| 73 | +meshd --version # print version |
| 74 | +``` |
| 75 | + |
| 76 | +## Keybindings |
| 77 | + |
| 78 | +| Key | Action | |
| 79 | +|-----|--------| |
| 80 | +| `tab` / `h` / `l` | Switch between Folders and Devices pane | |
| 81 | +| `j` / `↓` | Move down | |
| 82 | +| `k` / `↑` | Move up | |
| 83 | +| `r` | Force refresh from Syncthing | |
| 84 | +| `ctrl+k` | Open command palette | |
| 85 | +| `?` | Help overlay | |
| 86 | +| `q` / `ctrl+c` | Quit | |
| 87 | + |
| 88 | +## Stack |
| 89 | + |
| 90 | +- [Bubble Tea v2](https://charm.land/bubbletea/v2) — TUI framework |
| 91 | +- [Lip Gloss v2](https://charm.land/lipgloss/v2) — styling and layout |
| 92 | +- [Syncthing REST API](https://docs.syncthing.net/dev/rest.html) — no extra dependencies, plain HTTP |
50 | 93 |
|
51 | 94 | ## Development |
52 | 95 |
|
53 | 96 | ```bash |
54 | | -go run ./cmd/go-tui-template # run |
55 | | -go test ./... # test |
56 | | -go build ./cmd/go-tui-template # build check |
| 97 | +go run ./cmd/meshd # run |
| 98 | +go test ./... # test |
| 99 | +go build ./cmd/meshd # build check |
57 | 100 | ``` |
58 | 101 |
|
59 | 102 | ## Release |
60 | 103 |
|
61 | 104 | Releases are handled by GoReleaser via GitHub Actions. |
62 | 105 |
|
63 | 106 | ```bash |
64 | | -# Auto-trigger on tag push |
65 | 107 | git tag v0.1.0 && git push origin v0.1.0 |
66 | | - |
67 | | -# Or use the manual publish workflow (patch/minor/major bump) |
68 | | -gh workflow run publish.yml -f bump=patch |
69 | 108 | ``` |
70 | | - |
71 | | -## Notes |
72 | | - |
73 | | -- `Width(n)` / `Height(n)` in Lip Gloss v2 set the **total outer size** including borders. Do not pre-subtract `GetFrameSize()` before passing to these methods. |
74 | | -- Some Bubbles components still return Bubble Tea v1 types — check for type mismatches when wiring new ones into the model. |
75 | | - |
76 | | -## Credits |
77 | | - |
78 | | -Built on packages by **[elpdev](https://github.com/elpdev)**: |
79 | | -- `tuitheme` — 14 built-in themes with a clean palette system |
80 | | -- `tuimod` — `Screen` interface and `KeyCapturer` |
81 | | -- `tuilayout` — responsive header/sidebar/main/footer dimensions |
82 | | -- `tuipalette` — command palette with theme preview |
|
0 commit comments