meadows-tui 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- meadows_tui-0.1.0/.env.example +19 -0
- meadows_tui-0.1.0/.gitignore +6 -0
- meadows_tui-0.1.0/PKG-INFO +120 -0
- meadows_tui-0.1.0/README.md +103 -0
- meadows_tui-0.1.0/pyproject.toml +92 -0
- meadows_tui-0.1.0/src/meadows/tui/__about__.py +3 -0
- meadows_tui-0.1.0/src/meadows/tui/__init__.py +12 -0
- meadows_tui-0.1.0/src/meadows/tui/__main__.py +3 -0
- meadows_tui-0.1.0/src/meadows/tui/app.py +886 -0
- meadows_tui-0.1.0/src/meadows/tui/cli.py +115 -0
- meadows_tui-0.1.0/src/meadows/tui/client_bridge.py +240 -0
- meadows_tui-0.1.0/src/meadows/tui/config.py +38 -0
- meadows_tui-0.1.0/src/meadows/tui/themes.py +50 -0
- meadows_tui-0.1.0/tasks.py +261 -0
- meadows_tui-0.1.0/tests/test_tui.py +332 -0
- meadows_tui-0.1.0/uv.lock +1513 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# meadows-tui — quick-start
|
|
2
|
+
|
|
3
|
+
# Required: one of these auth methods
|
|
4
|
+
MEADOWS_JWT=
|
|
5
|
+
# or
|
|
6
|
+
MEADOWS_JWT_SECRET=
|
|
7
|
+
MEADOWS_USERNAME=
|
|
8
|
+
|
|
9
|
+
# Server (optional, default: http://localhost:8080)
|
|
10
|
+
MEADOWS_SERVER_URL=http://localhost:8080
|
|
11
|
+
|
|
12
|
+
# Theme (optional, default: auto)
|
|
13
|
+
MEADOWS_THEME=auto
|
|
14
|
+
|
|
15
|
+
# Logging (optional, default: WARNING)
|
|
16
|
+
MEADOWS_LOG_LEVEL=WARNING
|
|
17
|
+
|
|
18
|
+
# Display name (optional, default: MEADOWS Chat)
|
|
19
|
+
MEADOWS_SYSTEM_NAME=MEADOWS Chat
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: meadows-tui
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MEADOWS terminal UI client: a curses-based TUI chat client for MEADOWS.
|
|
5
|
+
Author: MEADOWS
|
|
6
|
+
Requires-Python: >=3.12
|
|
7
|
+
Requires-Dist: click>=8.1.0
|
|
8
|
+
Requires-Dist: meadows-client
|
|
9
|
+
Requires-Dist: meadows-protocol
|
|
10
|
+
Provides-Extra: dev
|
|
11
|
+
Requires-Dist: hatch; extra == 'dev'
|
|
12
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
|
|
13
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
|
|
14
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
15
|
+
Requires-Dist: ruff==0.14.9; extra == 'dev'
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# meadows-tui
|
|
19
|
+
|
|
20
|
+
> MEADOWS terminal UI client: a curses-based TUI chat client for MEADOWS.
|
|
21
|
+
> Uses click for CLI argument parsing and curses for the terminal interface.
|
|
22
|
+
> Connects directly to meadows-server via Socket.IO using meadows-client.
|
|
23
|
+
|
|
24
|
+
## What this package contains
|
|
25
|
+
|
|
26
|
+
- `cli.py` — Click entry point with env-var support
|
|
27
|
+
- `app.py` — Curses-based terminal app with dark/light theme, keybindings, auth flow
|
|
28
|
+
- `screens/auth_screen.py` — JWT token paste or local secret auth
|
|
29
|
+
- `screens/chat_screen.py` — Main chat: messages, sidebar, input
|
|
30
|
+
- `widgets/message_widget.py` — Message rendering with quotes, reactions
|
|
31
|
+
- `widgets/input_widget.py` — Chat input with reply quote preview
|
|
32
|
+
- `widgets/sidebar_widget.py` — Groups, users, and bots panels
|
|
33
|
+
- `client_bridge.py` — Adapts MeadowClient events to curses-compatible messages
|
|
34
|
+
- `themes.py` — Dark and light color definitions (mapped to curses colors)
|
|
35
|
+
- `config.py` — Configuration dataclass
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
uv pip install -e ".[dev]"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Run
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# With a JWT token
|
|
47
|
+
MEADOWS_JWT=eyJ... meadows-tui
|
|
48
|
+
|
|
49
|
+
# Or with a shared secret
|
|
50
|
+
MEADOWS_JWT_SECRET=secret MEADOWS_USERNAME=alice meadows-tui
|
|
51
|
+
|
|
52
|
+
# Or specify server explicitly
|
|
53
|
+
meadows-tui --server http://chat.example.com:8080 --token eyJ...
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## CLI Options
|
|
57
|
+
|
|
58
|
+
| Option | Env Var | Default | Description |
|
|
59
|
+
|--------|---------|---------|-------------|
|
|
60
|
+
| `--server` | `MEADOWS_SERVER_URL` | `http://localhost:8080` | Socket.IO server URL |
|
|
61
|
+
| `--token` | `MEADOWS_JWT` | — | JWT token (pasted) |
|
|
62
|
+
| `--jwt-secret` | `MEADOWS_JWT_SECRET` | — | Secret for local token gen |
|
|
63
|
+
| `--username` | `MEADOWS_USERNAME` | — | Username for local token gen |
|
|
64
|
+
| `--theme` | `MEADOWS_THEME` | `auto` | `dark`, `light`, or `auto` |
|
|
65
|
+
| `--log-level` | `MEADOWS_LOG_LEVEL` | `WARNING` | `DEBUG`, `INFO`, `WARNING`, `ERROR` |
|
|
66
|
+
|
|
67
|
+
## Keybindings
|
|
68
|
+
|
|
69
|
+
| Key | Action |
|
|
70
|
+
|-----|--------|
|
|
71
|
+
| `Ctrl+t` | Toggle dark/light theme |
|
|
72
|
+
| `Ctrl+b` | Toggle sidebar |
|
|
73
|
+
| `Ctrl+n` | Focus input |
|
|
74
|
+
| `Ctrl+g` | Focus groups list |
|
|
75
|
+
| `Ctrl+q` | Quit |
|
|
76
|
+
|
|
77
|
+
## Architecture invariants
|
|
78
|
+
|
|
79
|
+
1. **Protocol constants only.** The only import from `meadows.protocol` is `EventName` (in `__init__.py`).
|
|
80
|
+
2. **Transport via meadows-client.** No raw Socket.IO usage; all transport goes through `MeadowClient`.
|
|
81
|
+
3. **Event bridge.** Socket.IO events from the server are translated to curses-compatible messages in `client_bridge.py`.
|
|
82
|
+
4. **Theme support.** Dark/light modes with terminal-appropriate colors (mapped to curses color constants), toggleable at runtime.
|
|
83
|
+
5. **PEP 420 namespace.** `src/meadows/tui/__init__.py` exists; there is NO `src/meadows/__init__.py`.
|
|
84
|
+
|
|
85
|
+
## Configuration (env vars)
|
|
86
|
+
|
|
87
|
+
| variable | default | purpose |
|
|
88
|
+
|----------|---------|---------|
|
|
89
|
+
| `MEADOWS_SERVER_URL` | `http://localhost:8080` | server URL for Socket.IO |
|
|
90
|
+
| `MEADOWS_JWT` | — | pre-encoded JWT token |
|
|
91
|
+
| `MEADOWS_JWT_SECRET` | — | JWT secret for local token generation |
|
|
92
|
+
| `MEADOWS_USERNAME` | — | username when using JWT secret |
|
|
93
|
+
| `MEADOWS_THEME` | `auto` | color theme choice |
|
|
94
|
+
| `MEADOWS_LOG_LEVEL` | `WARNING` | logging verbosity |
|
|
95
|
+
| `MEADOWS_SYSTEM_NAME` | `MEADOWS Chat` | display name |
|
|
96
|
+
|
|
97
|
+
## Development
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
uv pip install -e ".[dev]"
|
|
101
|
+
uv pip install edwh
|
|
102
|
+
|
|
103
|
+
uv run edwh local.setup # check/ensure env vars
|
|
104
|
+
uv run edwh local.test # uv run pytest -q
|
|
105
|
+
uv run edwh local.lint # uv run ruff check src tests
|
|
106
|
+
uv run edwh local.fmt # uv run ruff format src tests && ruff check --fix src tests
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Features
|
|
110
|
+
|
|
111
|
+
- Multi-group chat with sidebar navigation
|
|
112
|
+
- Message send/receive with typing indicators
|
|
113
|
+
- Dark and light color themes (toggle at runtime)
|
|
114
|
+
- Collapsible sidebar
|
|
115
|
+
- Emoji reactions (quick pick from 9 emojis)
|
|
116
|
+
- Reply to messages (quote preview)
|
|
117
|
+
- Message removal
|
|
118
|
+
- User and bot lists per group
|
|
119
|
+
- JWT authentication (pasted token or local secret)
|
|
120
|
+
- Auto-connect via env vars
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# meadows-tui
|
|
2
|
+
|
|
3
|
+
> MEADOWS terminal UI client: a curses-based TUI chat client for MEADOWS.
|
|
4
|
+
> Uses click for CLI argument parsing and curses for the terminal interface.
|
|
5
|
+
> Connects directly to meadows-server via Socket.IO using meadows-client.
|
|
6
|
+
|
|
7
|
+
## What this package contains
|
|
8
|
+
|
|
9
|
+
- `cli.py` — Click entry point with env-var support
|
|
10
|
+
- `app.py` — Curses-based terminal app with dark/light theme, keybindings, auth flow
|
|
11
|
+
- `screens/auth_screen.py` — JWT token paste or local secret auth
|
|
12
|
+
- `screens/chat_screen.py` — Main chat: messages, sidebar, input
|
|
13
|
+
- `widgets/message_widget.py` — Message rendering with quotes, reactions
|
|
14
|
+
- `widgets/input_widget.py` — Chat input with reply quote preview
|
|
15
|
+
- `widgets/sidebar_widget.py` — Groups, users, and bots panels
|
|
16
|
+
- `client_bridge.py` — Adapts MeadowClient events to curses-compatible messages
|
|
17
|
+
- `themes.py` — Dark and light color definitions (mapped to curses colors)
|
|
18
|
+
- `config.py` — Configuration dataclass
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
uv pip install -e ".[dev]"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Run
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# With a JWT token
|
|
30
|
+
MEADOWS_JWT=eyJ... meadows-tui
|
|
31
|
+
|
|
32
|
+
# Or with a shared secret
|
|
33
|
+
MEADOWS_JWT_SECRET=secret MEADOWS_USERNAME=alice meadows-tui
|
|
34
|
+
|
|
35
|
+
# Or specify server explicitly
|
|
36
|
+
meadows-tui --server http://chat.example.com:8080 --token eyJ...
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## CLI Options
|
|
40
|
+
|
|
41
|
+
| Option | Env Var | Default | Description |
|
|
42
|
+
|--------|---------|---------|-------------|
|
|
43
|
+
| `--server` | `MEADOWS_SERVER_URL` | `http://localhost:8080` | Socket.IO server URL |
|
|
44
|
+
| `--token` | `MEADOWS_JWT` | — | JWT token (pasted) |
|
|
45
|
+
| `--jwt-secret` | `MEADOWS_JWT_SECRET` | — | Secret for local token gen |
|
|
46
|
+
| `--username` | `MEADOWS_USERNAME` | — | Username for local token gen |
|
|
47
|
+
| `--theme` | `MEADOWS_THEME` | `auto` | `dark`, `light`, or `auto` |
|
|
48
|
+
| `--log-level` | `MEADOWS_LOG_LEVEL` | `WARNING` | `DEBUG`, `INFO`, `WARNING`, `ERROR` |
|
|
49
|
+
|
|
50
|
+
## Keybindings
|
|
51
|
+
|
|
52
|
+
| Key | Action |
|
|
53
|
+
|-----|--------|
|
|
54
|
+
| `Ctrl+t` | Toggle dark/light theme |
|
|
55
|
+
| `Ctrl+b` | Toggle sidebar |
|
|
56
|
+
| `Ctrl+n` | Focus input |
|
|
57
|
+
| `Ctrl+g` | Focus groups list |
|
|
58
|
+
| `Ctrl+q` | Quit |
|
|
59
|
+
|
|
60
|
+
## Architecture invariants
|
|
61
|
+
|
|
62
|
+
1. **Protocol constants only.** The only import from `meadows.protocol` is `EventName` (in `__init__.py`).
|
|
63
|
+
2. **Transport via meadows-client.** No raw Socket.IO usage; all transport goes through `MeadowClient`.
|
|
64
|
+
3. **Event bridge.** Socket.IO events from the server are translated to curses-compatible messages in `client_bridge.py`.
|
|
65
|
+
4. **Theme support.** Dark/light modes with terminal-appropriate colors (mapped to curses color constants), toggleable at runtime.
|
|
66
|
+
5. **PEP 420 namespace.** `src/meadows/tui/__init__.py` exists; there is NO `src/meadows/__init__.py`.
|
|
67
|
+
|
|
68
|
+
## Configuration (env vars)
|
|
69
|
+
|
|
70
|
+
| variable | default | purpose |
|
|
71
|
+
|----------|---------|---------|
|
|
72
|
+
| `MEADOWS_SERVER_URL` | `http://localhost:8080` | server URL for Socket.IO |
|
|
73
|
+
| `MEADOWS_JWT` | — | pre-encoded JWT token |
|
|
74
|
+
| `MEADOWS_JWT_SECRET` | — | JWT secret for local token generation |
|
|
75
|
+
| `MEADOWS_USERNAME` | — | username when using JWT secret |
|
|
76
|
+
| `MEADOWS_THEME` | `auto` | color theme choice |
|
|
77
|
+
| `MEADOWS_LOG_LEVEL` | `WARNING` | logging verbosity |
|
|
78
|
+
| `MEADOWS_SYSTEM_NAME` | `MEADOWS Chat` | display name |
|
|
79
|
+
|
|
80
|
+
## Development
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
uv pip install -e ".[dev]"
|
|
84
|
+
uv pip install edwh
|
|
85
|
+
|
|
86
|
+
uv run edwh local.setup # check/ensure env vars
|
|
87
|
+
uv run edwh local.test # uv run pytest -q
|
|
88
|
+
uv run edwh local.lint # uv run ruff check src tests
|
|
89
|
+
uv run edwh local.fmt # uv run ruff format src tests && ruff check --fix src tests
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Features
|
|
93
|
+
|
|
94
|
+
- Multi-group chat with sidebar navigation
|
|
95
|
+
- Message send/receive with typing indicators
|
|
96
|
+
- Dark and light color themes (toggle at runtime)
|
|
97
|
+
- Collapsible sidebar
|
|
98
|
+
- Emoji reactions (quick pick from 9 emojis)
|
|
99
|
+
- Reply to messages (quote preview)
|
|
100
|
+
- Message removal
|
|
101
|
+
- User and bot lists per group
|
|
102
|
+
- JWT authentication (pasted token or local secret)
|
|
103
|
+
- Auto-connect via env vars
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "meadows-tui"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "MEADOWS terminal UI client: a curses-based TUI chat client for MEADOWS."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.12"
|
|
11
|
+
license-expression = "MIT"
|
|
12
|
+
authors = [{ name = "MEADOWS" }]
|
|
13
|
+
dependencies = [
|
|
14
|
+
"meadows-protocol",
|
|
15
|
+
"meadows-client",
|
|
16
|
+
"click>=8.1.0",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
[project.scripts]
|
|
20
|
+
meadows-tui = "meadows.tui.cli:main"
|
|
21
|
+
|
|
22
|
+
[project.optional-dependencies]
|
|
23
|
+
dev = [
|
|
24
|
+
"hatch",
|
|
25
|
+
"pytest>=8.0.0",
|
|
26
|
+
"pytest-asyncio>=0.23.0",
|
|
27
|
+
"pytest-cov>=5.0.0",
|
|
28
|
+
"ruff==0.14.9",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[tool.hatch.build.targets.wheel]
|
|
32
|
+
packages = ["src/meadows"]
|
|
33
|
+
|
|
34
|
+
[tool.uv.sources]
|
|
35
|
+
meadows-protocol = { path = "../meadows-protocol", editable = true }
|
|
36
|
+
meadows-client = { path = "../meadows-client", editable = true }
|
|
37
|
+
|
|
38
|
+
[tool.ruff]
|
|
39
|
+
target-version = "py312"
|
|
40
|
+
line-length = 120
|
|
41
|
+
|
|
42
|
+
[tool.ruff.lint]
|
|
43
|
+
select = ["F", "E", "W", "Q", "A", "SIM", "ARG", "PTH", "RUF", "C90", "N", "YTT"]
|
|
44
|
+
|
|
45
|
+
[tool.pytest.ini_options]
|
|
46
|
+
testpaths = ["tests"]
|
|
47
|
+
asyncio_mode = "auto"
|
|
48
|
+
|
|
49
|
+
[tool.vommit]
|
|
50
|
+
allow_breaking_bang = true
|
|
51
|
+
allow_breaking_footer = true
|
|
52
|
+
prerelease_token = "rc"
|
|
53
|
+
confirm = true
|
|
54
|
+
|
|
55
|
+
[tool.vommit.git]
|
|
56
|
+
enabled = true
|
|
57
|
+
origin = "origin"
|
|
58
|
+
branch = "main"
|
|
59
|
+
on_wrong_branch = "error"
|
|
60
|
+
tag_format = "v{version}"
|
|
61
|
+
commit_format = "{version}"
|
|
62
|
+
|
|
63
|
+
[tool.vommit.changelog]
|
|
64
|
+
enabled = true
|
|
65
|
+
file = "CHANGELOG.md"
|
|
66
|
+
include_prereleases = false
|
|
67
|
+
placeholder = "<!-- next-version-placeholder -->"
|
|
68
|
+
placeholder_regex = "<auto>"
|
|
69
|
+
entry_title_format = "## v{version} ({date:%Y-%m-%d})"
|
|
70
|
+
|
|
71
|
+
[tool.vommit.changelog.levels]
|
|
72
|
+
break = "Breaking Change{s}"
|
|
73
|
+
feat = "Feature{s}"
|
|
74
|
+
fix = "Fix{es}"
|
|
75
|
+
perf = "Performance"
|
|
76
|
+
docs = "Documentation"
|
|
77
|
+
|
|
78
|
+
[tool.vommit.pypi]
|
|
79
|
+
enabled = true
|
|
80
|
+
use_keyring = true
|
|
81
|
+
|
|
82
|
+
[tool.vommit.commands]
|
|
83
|
+
clean = "rm -rf ./dist"
|
|
84
|
+
build = "uv build"
|
|
85
|
+
publish = "../pypi-publish"
|
|
86
|
+
post_publish = ""
|
|
87
|
+
|
|
88
|
+
[tool.vommit.version_bump_map]
|
|
89
|
+
break = "major"
|
|
90
|
+
feat = "minor"
|
|
91
|
+
fix = "patch"
|
|
92
|
+
perf = "patch"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""MEADOWS terminal UI client.
|
|
2
|
+
|
|
3
|
+
Textual-based TUI chat client connecting to MEADOWS server via
|
|
4
|
+
meadows-client. Uses click for CLI argument parsing.
|
|
5
|
+
|
|
6
|
+
This package imports only EventName from meadows.protocol for protocol
|
|
7
|
+
constants, and relies on meadows-client for transport.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from meadows.protocol import EventName
|
|
11
|
+
|
|
12
|
+
__all__ = ["EventName"]
|