taskmux 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.
@@ -0,0 +1,14 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+
12
+ # project claude rules
13
+ CLAUDE.md
14
+ .env*
taskmux-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Nik Cubrilovic
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
taskmux-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,451 @@
1
+ Metadata-Version: 2.4
2
+ Name: taskmux
3
+ Version: 0.1.0
4
+ Summary: Modern tmux development environment manager with real-time health monitoring, auto-restart, and WebSocket API
5
+ Project-URL: Homepage, https://github.com/nc9/taskmux
6
+ Project-URL: Repository, https://github.com/nc9/taskmux
7
+ Project-URL: Issues, https://github.com/nc9/taskmux/issues
8
+ Author-email: Nik Cubrilovic <git@nikcub.me>
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: daemon,development,manager,monitoring,session,terminal,tmux
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: MacOS
17
+ Classifier: Operating System :: POSIX :: Linux
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Topic :: Software Development :: Build Tools
25
+ Classifier: Topic :: System :: Monitoring
26
+ Classifier: Topic :: Terminals
27
+ Requires-Python: >=3.8
28
+ Requires-Dist: aiofiles>=23.0.0
29
+ Requires-Dist: aiohttp>=3.9.0
30
+ Requires-Dist: libtmux>=0.37.0
31
+ Requires-Dist: rich>=13.0.0
32
+ Requires-Dist: typer>=0.12.0
33
+ Requires-Dist: watchdog>=3.0.0
34
+ Requires-Dist: websockets>=12.0
35
+ Description-Content-Type: text/markdown
36
+
37
+ # Taskmux
38
+
39
+ A modern tmux development environment manager with real-time health monitoring, auto-restart capabilities, and WebSocket API. Built with Python using libtmux for reliable session management.
40
+
41
+ ## Why Taskmux?
42
+
43
+ Instead of manually managing multiple tmux windows or remembering complex command sequences, Taskmux provides:
44
+
45
+ - **Dynamic task management**: Define tasks in JSON, manage via modern CLI
46
+ - **Health monitoring**: Real-time task health checks with visual indicators
47
+ - **Auto-restart**: Automatically restart failed tasks to keep development flowing
48
+ - **WebSocket API**: Real-time status updates and remote task management
49
+ - **Rich CLI**: Beautiful terminal output with Typer and Rich integration
50
+ - **File watching**: Automatically detects config changes and reloads tasks
51
+ - **Zero setup**: Single command installation with uv tool management
52
+
53
+ ## Installation
54
+
55
+ ### Prerequisites
56
+
57
+ - [tmux](https://github.com/tmux/tmux) - Terminal multiplexer
58
+ - [uv](https://docs.astral.sh/uv/) - Modern Python package manager
59
+
60
+ ### Install uv (if you don't have it)
61
+
62
+ **Quick install** (macOS/Linux):
63
+ ```bash
64
+ curl -LsSf https://astral.sh/uv/install.sh | sh
65
+ ```
66
+
67
+ **Windows**:
68
+ ```powershell
69
+ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
70
+ ```
71
+
72
+ **Alternative methods**:
73
+ ```bash
74
+ # Via Homebrew (macOS)
75
+ brew install uv
76
+
77
+ # Via pipx
78
+ pipx install uv
79
+
80
+ # Via WinGet (Windows)
81
+ winget install --id=astral-sh.uv -e
82
+ ```
83
+
84
+ ### Install Taskmux
85
+
86
+ **Recommended** (installs globally):
87
+ ```bash
88
+ uv tool install taskmux
89
+ ```
90
+
91
+ **From source**:
92
+ ```bash
93
+ git clone https://github.com/your-repo/taskmux
94
+ cd taskmux
95
+ uv tool install .
96
+ ```
97
+
98
+ After installation, `taskmux` command will be available globally.
99
+
100
+ ## Quick Start
101
+
102
+ 1. **Create config file** in your project root:
103
+
104
+ ```json
105
+ {
106
+ "name": "myproject",
107
+ "tasks": {
108
+ "server": "npm run dev",
109
+ "build": "npm run build:watch",
110
+ "test": "npm run test:watch",
111
+ "db": "docker-compose up postgres"
112
+ }
113
+ }
114
+ ```
115
+
116
+ 2. **Start all tasks**:
117
+ ```bash
118
+ taskmux start
119
+ ```
120
+
121
+ 3. **Monitor and manage**:
122
+ ```bash
123
+ taskmux list # See what's running with health status
124
+ taskmux health # Detailed health check table
125
+ taskmux restart server # Restart specific task
126
+ taskmux logs -f test # Follow logs
127
+ ```
128
+
129
+ ## Commands Reference
130
+
131
+ ### Core Commands
132
+
133
+ ```bash
134
+ # Session Management
135
+ taskmux start # Start all tasks in tmux session
136
+ taskmux status # Show session and task status
137
+ taskmux list # List all tasks with health indicators
138
+ taskmux stop # Stop session and all tasks
139
+
140
+ # Task Management
141
+ taskmux restart <task> # Restart specific task
142
+ taskmux kill <task> # Kill specific task
143
+ taskmux add <task> "<command>" # Add new task to config
144
+ taskmux remove <task> # Remove task from config
145
+
146
+ # Monitoring
147
+ taskmux health # Health check with status table
148
+ taskmux logs <task> # Show recent logs
149
+ taskmux logs -f <task> # Follow logs (live)
150
+ taskmux logs -n 100 <task> # Show last N lines
151
+
152
+ # Advanced
153
+ taskmux watch # Watch config for changes
154
+ taskmux daemon --port 8765 # Run with WebSocket API
155
+ ```
156
+
157
+ ### Command Examples
158
+
159
+ ```bash
160
+ # Start development environment
161
+ taskmux start
162
+
163
+ # Check what's running with health status
164
+ taskmux list
165
+ # Output:
166
+ # Session: myproject
167
+ # ──────────────────────────────────────────────────
168
+ # 💚 Healthy server npm run dev
169
+ # 💚 Healthy build npm run build:watch
170
+ # 🔴 Unhealthy test npm run test:watch
171
+ # 💚 Healthy db docker-compose up postgres
172
+
173
+ # Detailed health check
174
+ taskmux health
175
+ # ┏━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━┓
176
+ # ┃ Status ┃ Task ┃ Health ┃
177
+ # ┡━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━┩
178
+ # │ 💚 │ server │ Healthy │
179
+ # │ 💚 │ build │ Healthy │
180
+ # │ 🔴 │ test │ Unhealthy │
181
+ # │ 💚 │ db │ Healthy │
182
+ # └────────┴─────────┴───────────┘
183
+
184
+ # Restart a misbehaving service
185
+ taskmux restart server
186
+
187
+ # Add a new background task
188
+ taskmux add worker "python background_worker.py"
189
+
190
+ # Follow logs for debugging
191
+ taskmux logs -f test
192
+
193
+ # Watch config file for changes
194
+ taskmux watch
195
+ ```
196
+
197
+ ## Configuration
198
+
199
+ ### Config File Format
200
+
201
+ Create `taskmux.json` in your project root:
202
+
203
+ ```json
204
+ {
205
+ "name": "session-name",
206
+ "tasks": {
207
+ "task-name": "command to run",
208
+ "another-task": "another command"
209
+ }
210
+ }
211
+ ```
212
+
213
+ ### Config Examples
214
+
215
+ **Web Development**:
216
+ ```json
217
+ {
218
+ "name": "webapp",
219
+ "tasks": {
220
+ "frontend": "npm run dev",
221
+ "backend": "python manage.py runserver",
222
+ "database": "docker-compose up -d postgres",
223
+ "redis": "redis-server",
224
+ "worker": "celery worker -A myapp",
225
+ "tailwind": "npx tailwindcss -w"
226
+ }
227
+ }
228
+ ```
229
+
230
+ **Data Science**:
231
+ ```json
232
+ {
233
+ "name": "analysis",
234
+ "tasks": {
235
+ "jupyter": "jupyter lab --port=8888",
236
+ "mlflow": "mlflow ui --port=5000",
237
+ "airflow": "airflow webserver",
238
+ "postgres": "docker run -p 5432:5432 postgres:13",
239
+ "tensorboard": "tensorboard --logdir=./logs"
240
+ }
241
+ }
242
+ ```
243
+
244
+ **Microservices**:
245
+ ```json
246
+ {
247
+ "name": "microservices",
248
+ "tasks": {
249
+ "api-gateway": "node gateway/server.js",
250
+ "user-service": "go run services/user/main.go",
251
+ "order-service": "python services/orders/app.py",
252
+ "redis": "redis-server",
253
+ "postgres": "docker-compose up -d db",
254
+ "monitoring": "prometheus --config.file=prometheus.yml"
255
+ }
256
+ }
257
+ ```
258
+
259
+ ## Advanced Features
260
+
261
+ ### Daemon Mode with WebSocket API
262
+
263
+ Run Taskmux as a background daemon with real-time API:
264
+
265
+ ```bash
266
+ # Start daemon on port 8765 (default)
267
+ taskmux daemon
268
+
269
+ # Custom port
270
+ taskmux daemon --port 9000
271
+ ```
272
+
273
+ **WebSocket API Usage**:
274
+ ```javascript
275
+ // Connect to WebSocket API
276
+ const ws = new WebSocket('ws://localhost:8765');
277
+
278
+ // Get status
279
+ ws.send(JSON.stringify({
280
+ command: "status"
281
+ }));
282
+
283
+ // Restart task
284
+ ws.send(JSON.stringify({
285
+ command: "restart",
286
+ params: { task: "server" }
287
+ }));
288
+
289
+ // Get logs
290
+ ws.send(JSON.stringify({
291
+ command: "logs",
292
+ params: { task: "server", lines: 50 }
293
+ }));
294
+ ```
295
+
296
+ ### Health Monitoring & Auto-restart
297
+
298
+ Taskmux continuously monitors task health and can auto-restart failed processes:
299
+
300
+ - **Health indicators**: 💚 Healthy, 🔴 Unhealthy, ○ Stopped
301
+ - **Process monitoring**: Detects when tasks exit or become unresponsive
302
+ - **Auto-restart**: Daemon mode automatically restarts failed tasks
303
+ - **Health checks**: Run `taskmux health` for detailed status
304
+
305
+ ### File Watching
306
+
307
+ Monitor config changes in real-time:
308
+
309
+ ```bash
310
+ # Terminal 1: Start file watcher
311
+ taskmux watch
312
+
313
+ # Terminal 2: Edit config
314
+ echo '{"name": "test", "tasks": {"new": "echo hello"}}' > taskmux.json
315
+ # Watcher automatically reloads config and updates running tasks
316
+
317
+ # New task is immediately available
318
+ taskmux restart new
319
+ ```
320
+
321
+ ## Workflow Integration
322
+
323
+ ### Daily Development
324
+
325
+ ```bash
326
+ # Morning: Start everything
327
+ taskmux start
328
+
329
+ # During development: Monitor health
330
+ taskmux health
331
+
332
+ # Restart services as needed
333
+ taskmux restart api
334
+ taskmux logs -f frontend
335
+
336
+ # Add new services on the fly
337
+ taskmux add monitoring "python monitor.py"
338
+
339
+ # Run with file watching for config changes
340
+ taskmux watch
341
+
342
+ # Evening: Stop everything
343
+ taskmux stop
344
+ ```
345
+
346
+ ### Tmux Integration
347
+
348
+ Taskmux creates standard tmux sessions. You can use all tmux commands:
349
+
350
+ ```bash
351
+ # Attach to session
352
+ tmux attach-session -t myproject
353
+
354
+ # Switch between task windows
355
+ # Ctrl+b 1, Ctrl+b 2, etc.
356
+
357
+ # Create additional windows
358
+ tmux new-window -t myproject -n shell
359
+
360
+ # Detach and reattach later
361
+ # Ctrl+b d
362
+ tmux attach-session -t myproject
363
+ ```
364
+
365
+ ### Multiple Projects
366
+
367
+ Each project gets its own tmux session based on the `name` field:
368
+
369
+ ```bash
370
+ # Project A (session: "webapp")
371
+ cd ~/projects/webapp
372
+ taskmux start
373
+
374
+ # Project B (session: "api")
375
+ cd ~/projects/api
376
+ taskmux start
377
+
378
+ # Both run simultaneously with separate sessions
379
+ tmux list-sessions
380
+ # webapp: 4 windows
381
+ # api: 2 windows
382
+ ```
383
+
384
+ ## Architecture
385
+
386
+ Taskmux is built with modern Python tooling:
387
+
388
+ - **libtmux**: Reliable Python API for tmux session management
389
+ - **Typer**: Modern CLI framework with rich help and validation
390
+ - **Rich**: Beautiful terminal output with tables and progress bars
391
+ - **WebSockets**: Real-time API for remote monitoring and control
392
+ - **asyncio**: Async health monitoring and daemon capabilities
393
+ - **Watchdog**: File system monitoring for config changes
394
+
395
+ ## Troubleshooting
396
+
397
+ ### Common Issues
398
+
399
+ **Config not found**:
400
+ ```bash
401
+ Error: Config file taskmux.json not found
402
+ ```
403
+ - Ensure `taskmux.json` exists in current directory
404
+ - Check JSON syntax with `jq . taskmux.json`
405
+
406
+ **Session already exists**:
407
+ ```bash
408
+ Session 'myproject' already exists
409
+ ```
410
+ - Kill existing session: `taskmux stop`
411
+ - Or attach to it: `tmux attach-session -t myproject`
412
+
413
+ **Task not restarting**:
414
+ - Check if task name exists: `taskmux list`
415
+ - Verify session is running: `taskmux status`
416
+ - Check task health: `taskmux health`
417
+
418
+ **libtmux connection issues**:
419
+ - Ensure tmux is installed and in PATH
420
+ - Try restarting tmux server: `tmux kill-server`
421
+
422
+ ### Debug Mode
423
+
424
+ View detailed tmux session information:
425
+ ```bash
426
+ # Check if session exists
427
+ tmux has-session -t myproject
428
+
429
+ # List windows in session
430
+ tmux list-windows -t myproject
431
+
432
+ # View logs manually
433
+ tmux capture-pane -t myproject:taskname -p
434
+
435
+ # Check daemon logs
436
+ tail -f ~/.taskmux/daemon.log
437
+ ```
438
+
439
+ ## Contributing
440
+
441
+ Taskmux follows modern Python development practices:
442
+
443
+ 1. **Modular architecture**: Separate concerns (CLI, tmux management, daemon, config)
444
+ 2. **Type hints**: Full type annotation for better IDE support
445
+ 3. **Rich CLI**: Beautiful, user-friendly command-line interface
446
+ 4. **Async support**: Background monitoring and WebSocket API
447
+ 5. **Comprehensive testing**: Test across different tmux versions and platforms
448
+
449
+ ## License
450
+
451
+ MIT License - feel free to modify and distribute.