Skip to content

refactor(claude-isolated-test): Docker improvements and tmux enhancements - #235

Merged
baleen37 merged 9 commits into
mainfrom
chore/docker
Jan 31, 2026
Merged

refactor(claude-isolated-test): Docker improvements and tmux enhancements#235
baleen37 merged 9 commits into
mainfrom
chore/docker

Conversation

@baleen37

@baleen37 baleen37 commented Jan 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • Docker 이미지 빌드 최적화 (단일 레이어로 통합, npm cache 정리)
  • tmux 세션 관리 기능 강화 (--session-name, --list-sessions, --kill-session 옵션)
  • ANTHROPIC_API_KEY 인증 방식 지원 추가
  • tmux 소켓 영속성을 위한 Docker 볼륨 마운트 추가
  • 스크립트 구조 단순화 (lib 디렉토리 제거, 단일 shell.sh로 통합)
  • 스킬 이름 변경: claude-isolated-test → isolated-test-guide

Test plan

  • Docker 이미지 빌드 성공 확인
  • 컨테이너 실행 및 tmux 세션 연결 확인
  • 여러 tmux 세션 동시 사용 확인
  • ANTHROPIC_API_KEY 인증 확인
  • 컨테이너 재시작 후 tmux 세션 유지 확인

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added tmux session management capabilities (create, list, and kill sessions).
    • Expanded authentication support with multiple token sources (OAuth, API key, Keychain).
    • New CLI flags for session and token management.
  • Documentation

    • Enhanced guide with tmux, authentication, container, and usage examples.
  • Bug Fixes

    • Improved error handling and diagnostics for missing authentication tokens.

✏️ Tip: You can customize this high-level summary in your review settings.

baleen37 and others added 8 commits January 31, 2026 13:52
…h_container_claude

Rename function from attach_container_tmux to attach_container_claude to better reflect its purpose of attaching to a Claude Code session via tmux. Add clarifying comment about tmux session behavior.

The function uses tmux with -A flag to attach to existing "claude" session or create a new one if it doesn't exist.

Co-Authored-By: Claude <noreply@anthropic.com>
…ckerfile

- Add TMUX_TMPDIR=/tmux environment variable
- Create /tmux directory with claude:claude ownership
- Enables tmux socket persistence via volume mount

This works together with the volume mount in shell.sh to ensure tmux
sockets persist across container restarts.

Co-Authored-By: Claude <noreply@anthropic.com>
Add tmux socket persistence volume mount and environment variable:
- Volume: ${container_name}-tmux:/tmux for socket persistence
- Environment: TMUX_TMPDIR=/tmux to configure socket location

This works with Task 8 (Dockerfile TMUX_TMPDIR addition) to enable
proper tmux socket management in the Docker container.

Co-Authored-By: Claude <noreply@anthropic.com>
Add -l|--list-sessions option that lists all active tmux sessions
in the container without attaching. This allows users to see what
sessions are available before deciding which one to attach to.

Implementation:
- Add list_sessions() function that runs tmux list-sessions
- Handle case where no sessions exist with friendly error message
- Exit after listing (don't attach to container)

Co-Authored-By: Claude <noreply@anthropic.com>
Add -S|--session-name NAME option that allows connecting to a specific
tmux session by name instead of always using the default "claude" session.

Changes:
- Add SESSION_NAME variable with default value "claude"
- Add -S|--session-name option to argument parser
- Modify attach_container_claude to accept session name as second parameter
- Update usage help text to document the new option

Co-Authored-By: Claude <noreply@anthropic.com>
Add support for ANTHROPIC_API_KEY as primary authentication method.
New authentication priority order:
1. ANTHROPIC_API_KEY (standard API key)
2. CLAUDE_CODE_OAUTH_TOKEN (OAuth)
3. ANTHROPIC_AUTH_TOKEN (OAuth alternative)
4. Keychain (fallback)

When using ANTHROPIC_API_KEY, the token is passed to the container as
ANTHROPIC_API_KEY environment variable instead of CLAUDE_CODE_OAUTH_TOKEN.

Co-Authored-By: Claude <noreply@anthropic.com>
…atures

Add documentation for:
- tmux integration behavior and session persistence
- New options: --list-sessions, --session-name, --kill-session
- Authentication methods and priority (ANTHROPIC_API_KEY, OAuth, Keychain)
- Volume mounts for tmux socket persistence (/tmux)
- Usage examples for multi-session workflows

Co-Authored-By: Claude <noreply@anthropic.com>
Rename claude-isolated-test skill to isolated-test-guide for better naming clarity.

Co-Authored-By: Claude <noreply@anthropic.com>
@baleen37
baleen37 enabled auto-merge January 31, 2026 05:28
@coderabbitai

coderabbitai Bot commented Jan 31, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This PR enhances the isolated test skill with tmux session management capabilities, expanded documentation, and refactored authentication handling supporting multiple token sources (OAuth, API key, Keychain) within a Docker container environment.

Changes

Cohort / File(s) Summary
Documentation Updates
plugins/me/commands/claude-isolated-test.md, plugins/me/skills/claude-isolated-test/SKILL.md
Renamed skill reference from "claude-isolated-test" to "isolated-test-guide" and significantly expanded skill documentation with tmux session management, authentication methods, container control commands, volume mounting, and usage examples.
Container Configuration
plugins/me/skills/claude-isolated-test/docker/Dockerfile
Added /tmux directory and TMUX_TMPDIR environment variable to persist tmux sockets with proper ownership, enabling tmux session support in the container.
CLI & Session Management
plugins/me/skills/claude-isolated-test/shell.sh
Added tmux session lifecycle controls (kill_session, list_sessions), refactored authentication to support multiple token sources with explicit type tracking, introduced attach_container_claude function for tmux session attachment, updated container creation signature to include auth type parameter, and extended CLI flags for session management and token source selection.

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI as shell.sh
    participant Auth as Auth Handler
    participant Docker as Docker Container
    participant Tmux as Tmux Session

    User->>CLI: Call with token/flags
    CLI->>Auth: Determine token source (OAuth/API-Key/Keychain)
    Auth->>Auth: Resolve auth token & type
    Auth-->>CLI: Return token + auth_type
    CLI->>Docker: Create container with auth_type + tmux dir
    Docker->>Docker: Mount tmux socket directory
    Docker->>Tmux: Initialize tmux session
    CLI->>Tmux: Attach/Create session with name
    Tmux-->>User: Interactive session established
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 In containers we bounce with glee,
Tmux sessions, wild and free!
Multi-tokens dance in harmony,
Claude's isolated test—a symphony! ✨
Sessions managed, auth secure tight,
Our docker dreams take flight!

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/docker

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@baleen37
baleen37 merged commit 07197d0 into main Jan 31, 2026
1 of 2 checks passed
@baleen37
baleen37 deleted the chore/docker branch January 31, 2026 05:30
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.

1 participant