Skip to content

Conversation

@d-kuro
Copy link
Owner

@d-kuro d-kuro commented Jun 10, 2025

Summary

  • Add comprehensive tmux session management capabilities to gwq
  • Enable persistence and monitoring of long-running processes
  • Provide interactive session selection with fuzzy finder integration

Features Added

New gwq tmux subcommand group

  • gwq tmux list - List active tmux sessions

    • Support for JSON/CSV output formats
    • Real-time monitoring with --watch flag
    • Filtering by session status
  • gwq tmux run - Create new tmux sessions

    • Run commands in persistent tmux sessions
    • Auto-cleanup option for temporary sessions
    • Support for running in specific worktrees
  • gwq tmux attach - Attach to running sessions

    • Pattern matching for quick session access
    • Interactive fuzzy finder for session selection
  • gwq tmux kill - Terminate sessions

    • Batch operations support
    • Interactive multi-select with confirmation
    • Filter options for completed sessions cleanup

Technical Implementation

  • Added internal/tmux package for session lifecycle management
  • Integrated context cancellation for proper cleanup
  • Extended finder functionality for session selection
  • Removed unused code and simplified configuration structure

Use Cases

This feature enables users to:

  • Run development servers that persist across terminal sessions
  • Execute long-running build processes with monitoring
  • Manage test suites that take extended time
  • Keep processes running after SSH disconnections

Test plan

  • Run make test - all tests pass
  • Run make lint - no linting issues
  • Test gwq tmux run "sleep 30" creates a session
  • Verify gwq tmux list shows the running session
  • Test gwq tmux attach connects to the session
  • Verify gwq tmux kill terminates the session
  • Test fuzzy finder with multiple sessions
  • Verify JSON/CSV output formats work correctly

🤖 Generated with Claude Code

Add comprehensive tmux session management capabilities to gwq for managing
long-running processes with persistence and monitoring.

## Features

- `gwq tmux list` - List active tmux sessions with filtering and watch mode
- `gwq tmux run` - Create new tmux sessions with custom commands
- `gwq tmux attach` - Attach to running sessions with fuzzy finder support
- `gwq tmux kill` - Terminate sessions with batch operations support

## Implementation Details

- Add tmux package for session lifecycle management
- Integrate fuzzy finder for interactive session selection
- Support context cancellation for long-running operations
- Remove unused code and fields for cleaner implementation
- Add JSON/CSV output formats for scripting

This enables users to run long-running commands (like dev servers, build
processes, or tests) in persistent tmux sessions that survive terminal
disconnections.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@d-kuro d-kuro force-pushed the feat/tmux-session-management branch from a7e7760 to 645d1a3 Compare June 10, 2025 04:41
d-kuro added 6 commits June 10, 2025 13:41
- Extract common session finder creation logic
- Reduce code duplication between attach and kill commands
- Simplify multiple session kill error handling with count-based approach
- Create reusable helper methods for session formatting and options
- Remove unnecessary error accumulation in favor of simple failure counting

This improves code maintainability and reduces complexity while maintaining
the same functionality.
The --completed flag for tmux kill command was non-functional since tmux
sessions always show as 'running' when they exist. This removes:

- --completed flag from tmux kill command
- StatusCompleted, StatusFailed, StatusDetached constants
- Related filtering functions and switch cases
- Documentation references to --completed flag

Only StatusRunning remains as it's the only meaningful status for
active tmux sessions. This simplifies the codebase and removes
confusing non-functional features.
Completely remove Status type and related code since all tmux sessions
are inherently 'running' when they exist. This eliminates unnecessary
complexity and redundant information.

## Changes

- Remove Status type and StatusRunning constant
- Remove Status field from Session struct
- Remove --filter flag from tmux list command (was non-functional)
- Simplify session display - always show ● marker for active sessions
- Remove formatSessionStatus, countByStatus, filterRunningSessions functions
- Update CSV/JSON output to exclude status column
- Simplify confirmation dialogs and preview displays
- Update documentation and examples

## Result

- Simplified codebase with ~150 lines removed
- More accurate representation (existence = running)
- No confusing non-functional filter options
- Consistent ● markers for all sessions
CLAUDE.md should contain development guidelines, not specific feature
implementation details. The tmux feature documentation belongs in
README.md and release notes.
@d-kuro d-kuro self-assigned this Jun 10, 2025
d-kuro and others added 3 commits June 11, 2025 07:01
Remove bullet markers from session names and display working directory by default

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@d-kuro d-kuro merged commit fadc0ad into main Jun 10, 2025
1 check passed
@d-kuro d-kuro deleted the feat/tmux-session-management branch June 10, 2025 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants