claude-code-tools 0.1.9__py3-none-any.whl → 0.1.11__py3-none-any.whl
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.
Potentially problematic release.
This version of claude-code-tools might be problematic. Click here for more details.
- claude_code_tools/__init__.py +1 -1
- claude_code_tools/tmux_cli_controller.py +69 -11
- claude_code_tools/tmux_remote_controller.py +69 -0
- {claude_code_tools-0.1.9.dist-info → claude_code_tools-0.1.11.dist-info}/METADATA +1 -1
- claude_code_tools-0.1.11.dist-info/RECORD +13 -0
- docs/claude-code-tmux-tutorials.md +105 -0
- docs/find-claude-session.md +149 -0
- docs/tmux-cli-instructions.md +164 -0
- docs/vault-documentation.md +161 -0
- claude_code_tools-0.1.9.dist-info/RECORD +0 -8
- {claude_code_tools-0.1.9.dist-info → claude_code_tools-0.1.11.dist-info}/WHEEL +0 -0
- {claude_code_tools-0.1.9.dist-info → claude_code_tools-0.1.11.dist-info}/entry_points.txt +0 -0
claude_code_tools/__init__.py
CHANGED
|
@@ -11,7 +11,74 @@ from typing import Optional, List, Dict, Tuple, Callable, Union
|
|
|
11
11
|
import json
|
|
12
12
|
import os
|
|
13
13
|
import hashlib
|
|
14
|
-
|
|
14
|
+
import importlib.resources
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _load_help_text():
|
|
18
|
+
"""Load help text from the package's docs directory."""
|
|
19
|
+
try:
|
|
20
|
+
# For development, try to load from the actual file system first
|
|
21
|
+
import pathlib
|
|
22
|
+
module_dir = pathlib.Path(__file__).parent
|
|
23
|
+
# Try looking in the parent directory (repo root) for docs
|
|
24
|
+
docs_file = module_dir.parent / 'docs' / 'tmux-cli-instructions.md'
|
|
25
|
+
if docs_file.exists():
|
|
26
|
+
return docs_file.read_text(encoding='utf-8')
|
|
27
|
+
|
|
28
|
+
# For installed packages, use importlib.resources
|
|
29
|
+
if hasattr(importlib.resources, 'files'):
|
|
30
|
+
# Python 3.9+ style
|
|
31
|
+
import importlib.resources as resources
|
|
32
|
+
|
|
33
|
+
# Try different possible locations for the docs
|
|
34
|
+
# 1. Try docs as a subdirectory within the package
|
|
35
|
+
try:
|
|
36
|
+
help_file = resources.files('claude_code_tools') / 'docs' / 'tmux-cli-instructions.md'
|
|
37
|
+
if help_file.is_file():
|
|
38
|
+
return help_file.read_text(encoding='utf-8')
|
|
39
|
+
except:
|
|
40
|
+
pass
|
|
41
|
+
|
|
42
|
+
# 2. Try accessing parent package to find docs at root level
|
|
43
|
+
try:
|
|
44
|
+
# This assumes docs/ is packaged at the same level as claude_code_tools/
|
|
45
|
+
package_root = resources.files('claude_code_tools').parent
|
|
46
|
+
help_file = package_root / 'docs' / 'tmux-cli-instructions.md'
|
|
47
|
+
if help_file.is_file():
|
|
48
|
+
return help_file.read_text(encoding='utf-8')
|
|
49
|
+
except:
|
|
50
|
+
pass
|
|
51
|
+
|
|
52
|
+
# Try pkg_resources as another fallback
|
|
53
|
+
try:
|
|
54
|
+
import pkg_resources
|
|
55
|
+
# Try different paths
|
|
56
|
+
for path in ['docs/tmux-cli-instructions.md', '../docs/tmux-cli-instructions.md']:
|
|
57
|
+
try:
|
|
58
|
+
return pkg_resources.resource_string(
|
|
59
|
+
'claude_code_tools', path
|
|
60
|
+
).decode('utf-8')
|
|
61
|
+
except:
|
|
62
|
+
continue
|
|
63
|
+
except:
|
|
64
|
+
pass
|
|
65
|
+
|
|
66
|
+
except Exception as e:
|
|
67
|
+
pass
|
|
68
|
+
|
|
69
|
+
# If all else fails, return a basic help message
|
|
70
|
+
return """# tmux-cli Instructions
|
|
71
|
+
|
|
72
|
+
Error: Could not load full documentation.
|
|
73
|
+
|
|
74
|
+
Basic usage:
|
|
75
|
+
- tmux-cli launch "command" - Launch a CLI application
|
|
76
|
+
- tmux-cli send "text" --pane=PANE_ID - Send input to a pane
|
|
77
|
+
- tmux-cli capture --pane=PANE_ID - Capture output from a pane
|
|
78
|
+
- tmux-cli kill --pane=PANE_ID - Kill a pane
|
|
79
|
+
- tmux-cli help - Display full help
|
|
80
|
+
|
|
81
|
+
For full documentation, see docs/tmux-cli-instructions.md in the package repository."""
|
|
15
82
|
|
|
16
83
|
|
|
17
84
|
class TmuxCLIController:
|
|
@@ -657,10 +724,6 @@ class CLI:
|
|
|
657
724
|
|
|
658
725
|
def help(self):
|
|
659
726
|
"""Display tmux-cli usage instructions."""
|
|
660
|
-
# Find the instructions file relative to this module
|
|
661
|
-
module_dir = Path(__file__).parent.parent
|
|
662
|
-
instructions_file = module_dir / "docs" / "tmux-cli-instructions.md"
|
|
663
|
-
|
|
664
727
|
# Add mode-specific header
|
|
665
728
|
mode_info = f"\n{'='*60}\n"
|
|
666
729
|
if self.mode == 'local':
|
|
@@ -670,12 +733,7 @@ class CLI:
|
|
|
670
733
|
mode_info += f"{'='*60}\n"
|
|
671
734
|
|
|
672
735
|
print(mode_info)
|
|
673
|
-
|
|
674
|
-
if instructions_file.exists():
|
|
675
|
-
print(instructions_file.read_text())
|
|
676
|
-
else:
|
|
677
|
-
print("Error: tmux-cli-instructions.md not found")
|
|
678
|
-
print(f"Expected location: {instructions_file}")
|
|
736
|
+
print(_load_help_text())
|
|
679
737
|
|
|
680
738
|
if self.mode == 'remote':
|
|
681
739
|
print("\n" + "="*60)
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Remote Tmux Controller - Stub implementation
|
|
4
|
+
This is a minimal stub to prevent import errors when tmux-cli is used outside tmux.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import subprocess
|
|
8
|
+
from typing import Optional, List, Dict
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class RemoteTmuxController:
|
|
12
|
+
"""Stub implementation of RemoteTmuxController to prevent import errors."""
|
|
13
|
+
|
|
14
|
+
def __init__(self, session_name: str = "remote-cli-session"):
|
|
15
|
+
"""Initialize with session name."""
|
|
16
|
+
self.session_name = session_name
|
|
17
|
+
print(f"Warning: RemoteTmuxController is not fully implemented.")
|
|
18
|
+
print(f"Remote mode functionality is currently unavailable.")
|
|
19
|
+
print(f"Please use tmux-cli from inside a tmux session for full functionality.")
|
|
20
|
+
|
|
21
|
+
def list_panes(self) -> List[Dict[str, str]]:
|
|
22
|
+
"""Return empty list."""
|
|
23
|
+
return []
|
|
24
|
+
|
|
25
|
+
def launch_cli(self, command: str, name: Optional[str] = None) -> Optional[str]:
|
|
26
|
+
"""Not implemented."""
|
|
27
|
+
raise NotImplementedError("Remote mode is not available. Please use tmux-cli from inside tmux.")
|
|
28
|
+
|
|
29
|
+
def send_keys(self, text: str, pane_id: Optional[str] = None, enter: bool = True,
|
|
30
|
+
delay_enter: bool = True):
|
|
31
|
+
"""Not implemented."""
|
|
32
|
+
raise NotImplementedError("Remote mode is not available. Please use tmux-cli from inside tmux.")
|
|
33
|
+
|
|
34
|
+
def capture_pane(self, pane_id: Optional[str] = None, lines: Optional[int] = None) -> str:
|
|
35
|
+
"""Not implemented."""
|
|
36
|
+
raise NotImplementedError("Remote mode is not available. Please use tmux-cli from inside tmux.")
|
|
37
|
+
|
|
38
|
+
def wait_for_idle(self, pane_id: Optional[str] = None, idle_time: float = 2.0,
|
|
39
|
+
check_interval: float = 0.5, timeout: Optional[int] = None) -> bool:
|
|
40
|
+
"""Not implemented."""
|
|
41
|
+
raise NotImplementedError("Remote mode is not available. Please use tmux-cli from inside tmux.")
|
|
42
|
+
|
|
43
|
+
def send_interrupt(self, pane_id: Optional[str] = None):
|
|
44
|
+
"""Not implemented."""
|
|
45
|
+
raise NotImplementedError("Remote mode is not available. Please use tmux-cli from inside tmux.")
|
|
46
|
+
|
|
47
|
+
def send_escape(self, pane_id: Optional[str] = None):
|
|
48
|
+
"""Not implemented."""
|
|
49
|
+
raise NotImplementedError("Remote mode is not available. Please use tmux-cli from inside tmux.")
|
|
50
|
+
|
|
51
|
+
def kill_window(self, window_id: Optional[str] = None):
|
|
52
|
+
"""Not implemented."""
|
|
53
|
+
raise NotImplementedError("Remote mode is not available. Please use tmux-cli from inside tmux.")
|
|
54
|
+
|
|
55
|
+
def attach_session(self):
|
|
56
|
+
"""Not implemented."""
|
|
57
|
+
raise NotImplementedError("Remote mode is not available. Please use tmux-cli from inside tmux.")
|
|
58
|
+
|
|
59
|
+
def cleanup_session(self):
|
|
60
|
+
"""Not implemented."""
|
|
61
|
+
raise NotImplementedError("Remote mode is not available. Please use tmux-cli from inside tmux.")
|
|
62
|
+
|
|
63
|
+
def list_windows(self) -> List[Dict[str, str]]:
|
|
64
|
+
"""Not implemented."""
|
|
65
|
+
raise NotImplementedError("Remote mode is not available. Please use tmux-cli from inside tmux.")
|
|
66
|
+
|
|
67
|
+
def _resolve_pane_id(self, pane: Optional[str]) -> Optional[str]:
|
|
68
|
+
"""Not implemented."""
|
|
69
|
+
raise NotImplementedError("Remote mode is not available. Please use tmux-cli from inside tmux.")
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
claude_code_tools/__init__.py,sha256=N-T6rVgTsM1TgWAxNFB1nkUl44M9mxO3LWXGat-oZhM,90
|
|
2
|
+
claude_code_tools/dotenv_vault.py,sha256=KPI9NDFu5HE6FfhQUYw6RhdR-miN0ScJHsBg0OVG61k,9617
|
|
3
|
+
claude_code_tools/find_claude_session.py,sha256=k7K-lwHY2aEWEgUw92T_NT3ds6cGql9eq1CKQikig68,21295
|
|
4
|
+
claude_code_tools/tmux_cli_controller.py,sha256=0PqWBhITw74TtOKAfiUJMyHEFVOlLp4sEYmSlDHyznc,27482
|
|
5
|
+
claude_code_tools/tmux_remote_controller.py,sha256=uK9lJKrNz7_NeV1_V3BM-q0r6sRVmYfOR8H3zo5hfH8,3220
|
|
6
|
+
docs/claude-code-tmux-tutorials.md,sha256=S-9U3a1AaPEBPo3oKpWuyOfKK7yPFOIu21P_LDfGUJk,7558
|
|
7
|
+
docs/find-claude-session.md,sha256=fACbQP0Bj5jqIpNWk0lGDOQQaji-K9Va3gUv2RA47VQ,4284
|
|
8
|
+
docs/tmux-cli-instructions.md,sha256=lQqKTI-uhH-EdU9P4To4GC10WJjj3VllAW4cxd8jfj8,4167
|
|
9
|
+
docs/vault-documentation.md,sha256=5XzNpHyhGU38JU2hKEWEL1gdPq3rC2zBg8yotK4eNF4,3600
|
|
10
|
+
claude_code_tools-0.1.11.dist-info/METADATA,sha256=bOjivMZ6Ozi5fOQMhmVsK0J9B21cvHtE9UDxF9Md1Mo,9767
|
|
11
|
+
claude_code_tools-0.1.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
12
|
+
claude_code_tools-0.1.11.dist-info/entry_points.txt,sha256=yUTZlZ2jteoUZ9bGPvZKI9tjmohPDhRk1fovu5pZACM,181
|
|
13
|
+
claude_code_tools-0.1.11.dist-info/RECORD,,
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Advanced tmux + Claude Code Integration Resources
|
|
2
|
+
|
|
3
|
+
Based on comprehensive research across multiple platforms, here's a curated collection of resources specifically addressing advanced tmux techniques and integration strategies with Claude Code. The findings reveal a sophisticated ecosystem with tools, workflows, and configuration strategies that go well beyond basic usage.
|
|
4
|
+
|
|
5
|
+
## Essential Written Resources
|
|
6
|
+
|
|
7
|
+
### Official Documentation and Team Insights
|
|
8
|
+
|
|
9
|
+
**Claude Code Best Practices - Anthropic** (2024-2025)
|
|
10
|
+
https://www.anthropic.com/engineering/claude-code-best-practices
|
|
11
|
+
The official best practices document explicitly covers tmux integration for managing multiple Claude Code sessions. Key insights include workflow patterns for composing Claude Code into broader workflows with tmux for window and session management.
|
|
12
|
+
|
|
13
|
+
**Latent Space Podcast - Claude Code Team Interview** (2024)
|
|
14
|
+
https://www.latent.space/p/claude-code
|
|
15
|
+
Direct insights from Boris Cherny and Cat Wu (Claude Code creators) discussing how "a lot of people use code with tmux to manage a bunch of windows and sessions happening in parallel." They emphasize the Unix utility philosophy and intentional design decisions around tmux compatibility.
|
|
16
|
+
|
|
17
|
+
### Advanced Technical Tutorials
|
|
18
|
+
|
|
19
|
+
**"Vibe Coding Anytime, Anywhere with tmux, Tailscale, and Claude Code"** by Nuttakit Kundum (July 2025)
|
|
20
|
+
https://nuttakitkundum.medium.com/vibe-coding-anytime-anywhere-with-tmux-tailscale-and-claude-code-fda01f3c5cd2
|
|
21
|
+
Demonstrates sophisticated session persistence workflows, showing how to maintain Claude Code sessions across devices using tmux. Covers mobile development with Galaxy Fold, SSH workflows, and tmux pane management for remote coding.
|
|
22
|
+
|
|
23
|
+
**"LLM Codegen go Brrr – Parallelization with Git Worktrees and Tmux"** - DEV Community (2024)
|
|
24
|
+
https://dev.to/skeptrune/llm-codegen-go-brrr-parallelization-with-git-worktrees-and-tmux-2gop
|
|
25
|
+
Comprehensive guide on advanced parallelization techniques using Git worktrees and tmux to manage multiple Claude Code instances simultaneously. Includes pain points, manual workflows, and proposed automation solutions.
|
|
26
|
+
|
|
27
|
+
**"How to automate development journaling with Claude Code"** by Takuya/Devas (June 2025)
|
|
28
|
+
https://www.devas.life/how-to-automate-development-journaling-with-claude-code/
|
|
29
|
+
In-depth integration guide combining Claude Code with tmux and neovim, including MCP integration and automated workflows. Shows building a RAG system with sophisticated tmux configurations.
|
|
30
|
+
|
|
31
|
+
### Japanese Advanced Resources (Zenn Platform)
|
|
32
|
+
|
|
33
|
+
The Japanese developer community has produced particularly sophisticated tmux + Claude Code resources:
|
|
34
|
+
|
|
35
|
+
**"Claude Codeを並列組織化してClaude Code 'Company'にするtmuxコマンド集"** by Kazuph
|
|
36
|
+
https://zenn.dev/kazuph/articles/beb87d102bd4f5
|
|
37
|
+
Advanced tmux command collection for organizing multiple Claude Code instances into a "company" structure with boss-worker relationships using tmux panes. Includes orchestration commands and multi-agent coordination patterns.
|
|
38
|
+
|
|
39
|
+
**"Claude Code Maxで実現する完全自動並列開発システム"** by Studio Prairie
|
|
40
|
+
https://zenn.dev/studio_prairie/articles/90f5fc48a6dea7
|
|
41
|
+
Demonstrates a fully automated parallel development system using Claude Code Max with tmux orchestration, showing advanced workflow automation techniques.
|
|
42
|
+
|
|
43
|
+
## Video Resources
|
|
44
|
+
|
|
45
|
+
While video content is limited, these stand out for advanced techniques:
|
|
46
|
+
|
|
47
|
+
**"Claude Code / OpenCode + T-Mux + Worktrees: This SELF-SPAWNING AI Coder TEAM is INSANITY!"**
|
|
48
|
+
https://www.youtube.com/watch?v=bWKHPelgNgs
|
|
49
|
+
11-minute demonstration of combining Claude Code with tmux and Git Worktrees to create a self-spawning AI coder team. Covers task claiming systems, agent-spawn workflow automation, and monitoring multiple AI agents in tmux sessions.
|
|
50
|
+
|
|
51
|
+
**"【AI組織実現‼️Claude Code Organization】現役エンジニアが「5人のAIが勝手に開発する会社」の作り方を解説!"**
|
|
52
|
+
https://www.youtube.com/watch?v=Qxus36eijkM
|
|
53
|
+
Japanese tutorial demonstrating advanced AI organization with hierarchical agent structures (President → Manager → Worker) using tmux session management and mouse operation configuration.
|
|
54
|
+
|
|
55
|
+
## Production-Ready Tools and GitHub Projects
|
|
56
|
+
|
|
57
|
+
### Claude Squad - Complete Multi-Agent Management
|
|
58
|
+
https://github.com/smtg-ai/claude-squad
|
|
59
|
+
The most mature solution for managing multiple Claude Code agents. Uses tmux for isolated terminal sessions with git worktrees for separate codebases. Features include TUI interface, auto-accept mode for background tasks, and support for multiple AI agents (Claude Code, Aider, Codex).
|
|
60
|
+
|
|
61
|
+
### tmux-mcp - Model Context Protocol Server
|
|
62
|
+
https://github.com/nickgnd/tmux-mcp
|
|
63
|
+
Enables Claude Desktop to interact programmatically with tmux sessions. Features include listing/searching tmux sessions, viewing and navigating windows/panes, executing commands, and creating new sessions. Essential for deep tmux integration.
|
|
64
|
+
|
|
65
|
+
### Advanced Configuration Scripts
|
|
66
|
+
|
|
67
|
+
**Task Master Agent Spawner**
|
|
68
|
+
https://gist.github.com/worksfornow/df0cb6c4f6fd4966cd17133bc711fd20
|
|
69
|
+
Sophisticated Claude Code slash command for parallel task delegation. Creates multiple worktrees and launches Claude agents in tmux sessions with automated status tracking and branch management.
|
|
70
|
+
|
|
71
|
+
## Key Integration Patterns and Workflows
|
|
72
|
+
|
|
73
|
+
### Multi-Agent Parallelization Pattern
|
|
74
|
+
- Use git worktrees + tmux sessions for parallel agent execution
|
|
75
|
+
- Each agent gets an isolated directory and tmux session
|
|
76
|
+
- Example command: `tmux new-session -d -s "agent-<task_id>" -c "worktrees/<feature_name>" claude`
|
|
77
|
+
|
|
78
|
+
### Terminal Orchestration Pattern
|
|
79
|
+
Brian P. Hogan's recommendation: "Use tmux. Have a pane with Claude Code and use tmux with a big scrollback buffer. Then have another pane where you run Git commands and other shell commands."
|
|
80
|
+
|
|
81
|
+
### Session Persistence Pattern
|
|
82
|
+
- Implement persistent tmux sessions for Claude Code context preservation
|
|
83
|
+
- Tools like "claunch" provide project-specific session management
|
|
84
|
+
- Critical for maintaining context across disconnections
|
|
85
|
+
|
|
86
|
+
### MCP Integration Pattern
|
|
87
|
+
- Use Model Context Protocol servers for programmatic tmux control
|
|
88
|
+
- tmux-mcp server enables Claude Desktop to read and control tmux sessions
|
|
89
|
+
- Allows AI assistants to observe and interact with terminal sessions
|
|
90
|
+
|
|
91
|
+
## Advanced Techniques Summary
|
|
92
|
+
|
|
93
|
+
The resources reveal several sophisticated techniques:
|
|
94
|
+
|
|
95
|
+
1. **Hierarchical Agent Organization**: Using tmux panes to create boss-worker relationships between multiple Claude Code instances
|
|
96
|
+
2. **Automated Worktree Management**: Scripts that automatically create git worktrees and spawn Claude Code instances in dedicated tmux sessions
|
|
97
|
+
3. **Session Orchestration**: Tools for managing dozens of parallel Claude Code sessions with monitoring and merging capabilities
|
|
98
|
+
4. **Mobile Development Workflows**: Using tmux for persistent remote Claude Code sessions accessible from mobile devices
|
|
99
|
+
5. **Custom Slash Commands**: Creating project-specific delegation commands that leverage tmux for task distribution
|
|
100
|
+
|
|
101
|
+
## Notable Gaps
|
|
102
|
+
|
|
103
|
+
The research reveals that while basic tmux + Claude Code integration is well-documented, there's still room for more comprehensive English-language video tutorials covering complex tmux layout management, detailed multiplexing features, and live coding sessions with sophisticated setups.
|
|
104
|
+
|
|
105
|
+
These resources represent the cutting edge of tmux + Claude Code integration, focusing on advanced techniques that leverage tmux's multiplexing capabilities to enhance Claude Code workflows significantly beyond basic usage.
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# find-claude-session Documentation
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`find-claude-session` is a command-line utility that searches through Claude Code session files to find sessions containing specific keywords. It provides an interactive UI for session selection and automatic resumption.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Interactive UI**: Rich terminal interface showing session previews
|
|
10
|
+
- **Global Search**: Search across all Claude projects with `-g/--global` flag
|
|
11
|
+
- **Smart Selection**: Automatically resume sessions with `claude -r`
|
|
12
|
+
- **Cross-project Navigation**: Switch to different project directories when needed
|
|
13
|
+
- **Shell Integration**: Persistent directory changes with the `fcs` wrapper function
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Basic Command
|
|
18
|
+
```bash
|
|
19
|
+
find-claude-session "keyword1,keyword2,keyword3"
|
|
20
|
+
```
|
|
21
|
+
- Accepts comma-separated keywords as a single argument
|
|
22
|
+
- Searches for sessions containing ALL keywords (AND operation)
|
|
23
|
+
- Case-insensitive matching
|
|
24
|
+
|
|
25
|
+
### Global Search
|
|
26
|
+
```bash
|
|
27
|
+
find-claude-session "keywords" --global
|
|
28
|
+
find-claude-session "keywords" -g
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Shell Function (Recommended)
|
|
32
|
+
```bash
|
|
33
|
+
# Add to .bashrc/.zshrc
|
|
34
|
+
fcs() { eval "$(find-claude-session --shell "$@" | sed '/^$/d')"; }
|
|
35
|
+
|
|
36
|
+
# Usage
|
|
37
|
+
fcs "keywords" # Local search
|
|
38
|
+
fcs "keywords" -g # Global search
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## How It Works
|
|
42
|
+
|
|
43
|
+
1. **Directory Mapping**:
|
|
44
|
+
- Current directory: `/Users/username/projects/myapp`
|
|
45
|
+
- Maps to: `~/.claude/projects/-Users-username-projects-myapp/`
|
|
46
|
+
- Rule: Replace all `/` with `-` in the path
|
|
47
|
+
|
|
48
|
+
2. **Search Process**:
|
|
49
|
+
- Reads JSONL files line by line (memory efficient)
|
|
50
|
+
- Checks if ALL keywords exist in the session
|
|
51
|
+
- Sorts by modification time (newest first)
|
|
52
|
+
- Displays top 10 matches in interactive UI
|
|
53
|
+
|
|
54
|
+
3. **Session Selection**:
|
|
55
|
+
- Shows session ID, project name, date, and preview
|
|
56
|
+
- Enter a number (1-10) to select
|
|
57
|
+
- Automatically runs `claude -r SESSION_ID`
|
|
58
|
+
- For cross-project sessions, changes directory first
|
|
59
|
+
|
|
60
|
+
## Installation
|
|
61
|
+
|
|
62
|
+
### Via uv tool
|
|
63
|
+
```bash
|
|
64
|
+
uv tool install git+https://github.com/username/claude-code-tools
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### For Development
|
|
68
|
+
```bash
|
|
69
|
+
git clone https://github.com/username/claude-code-tools
|
|
70
|
+
cd claude-code-tools
|
|
71
|
+
make install # Installs in editable mode
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Technical Details
|
|
75
|
+
|
|
76
|
+
### File Format
|
|
77
|
+
Claude Code stores sessions as JSONL files:
|
|
78
|
+
- Each line is a separate JSON object
|
|
79
|
+
- Contains messages, timestamps, and metadata
|
|
80
|
+
- Located in `~/.claude/projects/PROJECT_PATH/`
|
|
81
|
+
|
|
82
|
+
### Dependencies
|
|
83
|
+
- Python 3.11+
|
|
84
|
+
- click (CLI framework)
|
|
85
|
+
- rich (optional, for interactive UI)
|
|
86
|
+
|
|
87
|
+
### Performance
|
|
88
|
+
- Memory efficient: streams files line by line
|
|
89
|
+
- Early exit when all keywords found
|
|
90
|
+
- Parallel search in global mode
|
|
91
|
+
- Progress indicator for large searches
|
|
92
|
+
|
|
93
|
+
## Advanced Features
|
|
94
|
+
|
|
95
|
+
### Progress Indicators
|
|
96
|
+
- Shows search progress in global mode
|
|
97
|
+
- Displays number of projects searched
|
|
98
|
+
- Real-time match counter
|
|
99
|
+
|
|
100
|
+
### Fallback Mode
|
|
101
|
+
If `rich` library is not available:
|
|
102
|
+
- Falls back to simple text interface
|
|
103
|
+
- Still fully functional
|
|
104
|
+
- Plain numbered list for selection
|
|
105
|
+
|
|
106
|
+
### Cross-project Sessions
|
|
107
|
+
When selecting a session from a different project:
|
|
108
|
+
1. Prompts to change directory
|
|
109
|
+
2. Changes to project directory
|
|
110
|
+
3. Resumes the session
|
|
111
|
+
4. With `fcs` wrapper, directory change persists
|
|
112
|
+
|
|
113
|
+
## Examples
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Find sessions about a specific error
|
|
117
|
+
fcs "TypeError,undefined,function"
|
|
118
|
+
|
|
119
|
+
# Find sessions about a feature across all projects
|
|
120
|
+
fcs "authentication,JWT,middleware" -g
|
|
121
|
+
|
|
122
|
+
# Find sessions with specific library discussions
|
|
123
|
+
fcs "langroid,MCP,sampling"
|
|
124
|
+
|
|
125
|
+
# Direct usage without shell function
|
|
126
|
+
find-claude-session "docker,compose" --global
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Tips and Tricks
|
|
130
|
+
|
|
131
|
+
1. **Keyword Selection**: Use specific, unique terms for better results
|
|
132
|
+
2. **Multiple Keywords**: More keywords = more precise matches
|
|
133
|
+
3. **Global Search**: Use `-g` when you can't remember which project
|
|
134
|
+
4. **Shell Function**: Always use `fcs` for better workflow
|
|
135
|
+
5. **Recent Sessions**: Results are sorted by modification time
|
|
136
|
+
|
|
137
|
+
## Troubleshooting
|
|
138
|
+
|
|
139
|
+
### No Claude directory found
|
|
140
|
+
- Ensure you're in a directory with Claude Code history
|
|
141
|
+
- Check if `~/.claude/projects/` exists
|
|
142
|
+
|
|
143
|
+
### No matches found
|
|
144
|
+
- Try fewer or more general keywords
|
|
145
|
+
- Use global search (`-g`) to search all projects
|
|
146
|
+
|
|
147
|
+
### Directory changes don't persist
|
|
148
|
+
- Make sure you're using the `fcs` shell function
|
|
149
|
+
- Check that the function is properly sourced in your shell config
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# tmux-cli Instructions
|
|
2
|
+
|
|
3
|
+
A command-line tool for controlling CLI applications running in tmux panes/windows.
|
|
4
|
+
Automatically detects whether you're inside or outside tmux and uses the appropriate mode.
|
|
5
|
+
|
|
6
|
+
## Auto-Detection
|
|
7
|
+
- **Inside tmux (Local Mode)**: Manages panes in your current tmux window
|
|
8
|
+
- **Outside tmux (Remote Mode)**: Creates and manages a separate tmux session with windows
|
|
9
|
+
|
|
10
|
+
## Prerequisites
|
|
11
|
+
- tmux must be installed
|
|
12
|
+
- The `tmux-cli` command must be available (installed via `uv tool install`)
|
|
13
|
+
|
|
14
|
+
## ⚠️ IMPORTANT: Always Launch a Shell First!
|
|
15
|
+
|
|
16
|
+
**Always launch zsh first** to prevent losing output when commands fail:
|
|
17
|
+
```bash
|
|
18
|
+
tmux-cli launch "zsh" # Do this FIRST
|
|
19
|
+
tmux-cli send "your-command" --pane=%48 # Then run commands
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
If you launch a command directly and it errors, the pane closes immediately and you lose all output!
|
|
23
|
+
|
|
24
|
+
## Core Commands
|
|
25
|
+
|
|
26
|
+
### Launch a CLI application
|
|
27
|
+
```bash
|
|
28
|
+
tmux-cli launch "command"
|
|
29
|
+
# Example: tmux-cli launch "python3"
|
|
30
|
+
# Returns: pane ID (e.g., %48)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Send input to a pane
|
|
34
|
+
```bash
|
|
35
|
+
tmux-cli send "text" --pane=PANE_ID
|
|
36
|
+
# Example: tmux-cli send "print('hello')" --pane=%48
|
|
37
|
+
|
|
38
|
+
# By default, there's a 1-second delay between text and Enter.
|
|
39
|
+
# This ensures compatibility with various CLI applications.
|
|
40
|
+
|
|
41
|
+
# To send without Enter:
|
|
42
|
+
tmux-cli send "text" --pane=PANE_ID --enter=False
|
|
43
|
+
|
|
44
|
+
# To send immediately without delay:
|
|
45
|
+
tmux-cli send "text" --pane=PANE_ID --delay-enter=False
|
|
46
|
+
|
|
47
|
+
# To use a custom delay (in seconds):
|
|
48
|
+
tmux-cli send "text" --pane=PANE_ID --delay-enter=0.5
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Capture output from a pane
|
|
52
|
+
```bash
|
|
53
|
+
tmux-cli capture --pane=PANE_ID
|
|
54
|
+
# Example: tmux-cli capture --pane=%48
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### List all panes
|
|
58
|
+
```bash
|
|
59
|
+
tmux-cli list_panes
|
|
60
|
+
# Returns: JSON with pane IDs, indices, and status
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Kill a pane
|
|
64
|
+
```bash
|
|
65
|
+
tmux-cli kill --pane=PANE_ID
|
|
66
|
+
# Example: tmux-cli kill --pane=%48
|
|
67
|
+
|
|
68
|
+
# SAFETY: You cannot kill your own pane - this will give an error
|
|
69
|
+
# to prevent accidentally terminating your session
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Send interrupt (Ctrl+C)
|
|
73
|
+
```bash
|
|
74
|
+
tmux-cli interrupt --pane=PANE_ID
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Send escape key
|
|
78
|
+
```bash
|
|
79
|
+
tmux-cli escape --pane=PANE_ID
|
|
80
|
+
# Useful for exiting Claude or vim-like applications
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Wait for pane to become idle
|
|
84
|
+
```bash
|
|
85
|
+
tmux-cli wait_idle --pane=PANE_ID
|
|
86
|
+
# Waits until no output changes for 2 seconds (default)
|
|
87
|
+
|
|
88
|
+
# Custom idle time and timeout:
|
|
89
|
+
tmux-cli wait_idle --pane=PANE_ID --idle-time=3.0 --timeout=60
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Get help
|
|
93
|
+
```bash
|
|
94
|
+
tmux-cli help
|
|
95
|
+
# Displays this documentation
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Typical Workflow
|
|
99
|
+
|
|
100
|
+
1. **ALWAYS launch a shell first** (prefer zsh) - this prevents losing output on errors:
|
|
101
|
+
```bash
|
|
102
|
+
tmux-cli launch "zsh" # Returns pane ID - DO THIS FIRST!
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
2. Run your command in the shell:
|
|
106
|
+
```bash
|
|
107
|
+
tmux-cli send "python script.py" --pane=%48
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
3. Interact with the program:
|
|
111
|
+
```bash
|
|
112
|
+
tmux-cli send "user input" --pane=%48
|
|
113
|
+
tmux-cli capture --pane=%48 # Check output
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
4. Clean up when done:
|
|
117
|
+
```bash
|
|
118
|
+
tmux-cli kill --pane=%48
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Remote Mode Specific Commands
|
|
122
|
+
|
|
123
|
+
These commands are only available when running outside tmux:
|
|
124
|
+
|
|
125
|
+
### Attach to session
|
|
126
|
+
```bash
|
|
127
|
+
tmux-cli attach
|
|
128
|
+
# Opens the managed tmux session to view live
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Clean up session
|
|
132
|
+
```bash
|
|
133
|
+
tmux-cli cleanup
|
|
134
|
+
# Kills the entire managed session and all its windows
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### List windows
|
|
138
|
+
```bash
|
|
139
|
+
tmux-cli list_windows
|
|
140
|
+
# Shows all windows in the managed session
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Tips
|
|
144
|
+
- Always save the pane/window ID returned by `launch`
|
|
145
|
+
- Use `capture` to check the current state before sending input
|
|
146
|
+
- In local mode: Pane IDs can be like `%48` or pane indices like `1`, `2`
|
|
147
|
+
- In remote mode: Window IDs can be indices like `0`, `1` or full form like `session:0.0`
|
|
148
|
+
- If you launch a command directly (not via shell), the pane/window closes when
|
|
149
|
+
the command exits
|
|
150
|
+
- **IMPORTANT**: The tool prevents you from killing your own pane/window to avoid
|
|
151
|
+
accidentally terminating your session
|
|
152
|
+
|
|
153
|
+
## Avoiding Polling
|
|
154
|
+
Instead of repeatedly checking with `capture`, use `wait_idle`:
|
|
155
|
+
```bash
|
|
156
|
+
# Send command to a CLI application
|
|
157
|
+
tmux-cli send "analyze this code" --pane=%48
|
|
158
|
+
|
|
159
|
+
# Wait for it to finish (no output for 3 seconds)
|
|
160
|
+
tmux-cli wait_idle --pane=%48 --idle-time=3.0
|
|
161
|
+
|
|
162
|
+
# Now capture the result
|
|
163
|
+
tmux-cli capture --pane=%48
|
|
164
|
+
```
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Vault - Encrypted .env Backup Manager
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The `vault` tool provides centralized, encrypted backup for `.env` files across
|
|
6
|
+
all your projects. It uses SOPS (Secrets OPerationS) with GPG encryption to
|
|
7
|
+
securely store your environment variables in a central location at
|
|
8
|
+
`~/Git/dotenvs/`.
|
|
9
|
+
|
|
10
|
+
## How It Works
|
|
11
|
+
|
|
12
|
+
1. **Central Storage**: All encrypted backups are stored in `~/Git/dotenvs/`
|
|
13
|
+
2. **Project-based**: Each project's `.env` file is backed up with the project
|
|
14
|
+
directory name (e.g., `myproject.env.encrypt`)
|
|
15
|
+
3. **GPG Encryption**: Uses your GPG key to encrypt/decrypt files
|
|
16
|
+
4. **Smart Sync**: Automatically detects which version is newer and syncs
|
|
17
|
+
appropriately
|
|
18
|
+
5. **Safety First**: Always creates timestamped backups before overwriting
|
|
19
|
+
|
|
20
|
+
## Requirements
|
|
21
|
+
|
|
22
|
+
- GPG key configured on your system
|
|
23
|
+
- SOPS installed (`brew install sops` on macOS)
|
|
24
|
+
|
|
25
|
+
## Commands
|
|
26
|
+
|
|
27
|
+
### vault sync
|
|
28
|
+
|
|
29
|
+
Smart synchronization that automatically detects the sync direction:
|
|
30
|
+
- If only local `.env` exists → encrypts to vault
|
|
31
|
+
- If only vault backup exists → decrypts to local
|
|
32
|
+
- If local is newer → encrypts to vault (with confirmation)
|
|
33
|
+
- If vault is newer → decrypts to local (with confirmation)
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
vault sync # Auto-detect direction
|
|
37
|
+
vault sync --push # Force encrypt (local → vault)
|
|
38
|
+
vault sync --pull # Force decrypt (vault → local)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### vault encrypt
|
|
42
|
+
|
|
43
|
+
Explicitly encrypt your local `.env` file to the centralized vault:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
vault encrypt
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Features:
|
|
50
|
+
- Creates timestamped backup if encrypted file already exists
|
|
51
|
+
- Requires confirmation before overwriting existing backups
|
|
52
|
+
|
|
53
|
+
### vault decrypt
|
|
54
|
+
|
|
55
|
+
Explicitly decrypt from the centralized vault to local `.env`:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
vault decrypt
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Features:
|
|
62
|
+
- Creates timestamped backup of current `.env` before overwriting
|
|
63
|
+
- Warns if local `.env` is newer than backup
|
|
64
|
+
- Requires confirmation in case of conflicts
|
|
65
|
+
|
|
66
|
+
### vault list
|
|
67
|
+
|
|
68
|
+
List all encrypted backups in the central vault:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
vault list
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Shows all `.env.encrypt` files in `~/Git/dotenvs/` with their sizes.
|
|
75
|
+
|
|
76
|
+
### vault status
|
|
77
|
+
|
|
78
|
+
Show detailed status for the current project:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
vault status
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Displays:
|
|
85
|
+
- Whether local `.env` exists
|
|
86
|
+
- Whether backup exists
|
|
87
|
+
- Which version is newer (with timestamps)
|
|
88
|
+
- Sync status (in sync, local newer, backup newer, etc.)
|
|
89
|
+
|
|
90
|
+
## Workflow Examples
|
|
91
|
+
|
|
92
|
+
### Initial Setup
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
cd myproject
|
|
96
|
+
# Create your .env file with secrets
|
|
97
|
+
vault encrypt # Backup to central vault
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Cloning a Project
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
git clone https://github.com/user/project
|
|
104
|
+
cd project
|
|
105
|
+
vault decrypt # Restore .env from central vault
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Regular Development
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# After modifying .env
|
|
112
|
+
vault sync # Automatically encrypts to vault
|
|
113
|
+
|
|
114
|
+
# On a different machine
|
|
115
|
+
vault sync # Automatically decrypts newer version
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Conflict Resolution
|
|
119
|
+
|
|
120
|
+
When both local and vault versions exist but differ:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
vault status # Check which is newer
|
|
124
|
+
vault sync --push # Force local → vault
|
|
125
|
+
vault sync --pull # Force vault → local
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Security Notes
|
|
129
|
+
|
|
130
|
+
- Files are encrypted using your GPG key
|
|
131
|
+
- Only you can decrypt the files (with your private key)
|
|
132
|
+
- The central vault (`~/Git/dotenvs/`) should be included in your backups
|
|
133
|
+
- Consider version controlling the encrypted files for additional safety
|
|
134
|
+
|
|
135
|
+
## Troubleshooting
|
|
136
|
+
|
|
137
|
+
### "No GPG key found"
|
|
138
|
+
|
|
139
|
+
Generate a GPG key:
|
|
140
|
+
```bash
|
|
141
|
+
gpg --gen-key
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### "SOPS not found"
|
|
145
|
+
|
|
146
|
+
Install SOPS:
|
|
147
|
+
```bash
|
|
148
|
+
# macOS
|
|
149
|
+
brew install sops
|
|
150
|
+
|
|
151
|
+
# Linux
|
|
152
|
+
# Download from https://github.com/mozilla/sops/releases
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Permission Issues
|
|
156
|
+
|
|
157
|
+
Ensure you have write access to `~/Git/dotenvs/`:
|
|
158
|
+
```bash
|
|
159
|
+
mkdir -p ~/Git/dotenvs
|
|
160
|
+
chmod 700 ~/Git/dotenvs
|
|
161
|
+
```
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
claude_code_tools/__init__.py,sha256=A9bCZil9tXYE103gMBo_m91Z8AHthQFBebD-oJ51A_E,89
|
|
2
|
-
claude_code_tools/dotenv_vault.py,sha256=KPI9NDFu5HE6FfhQUYw6RhdR-miN0ScJHsBg0OVG61k,9617
|
|
3
|
-
claude_code_tools/find_claude_session.py,sha256=k7K-lwHY2aEWEgUw92T_NT3ds6cGql9eq1CKQikig68,21295
|
|
4
|
-
claude_code_tools/tmux_cli_controller.py,sha256=lemoz1UljbXMHQRdP3475K8MEqBS67TiiVqoEJ-dadc,25272
|
|
5
|
-
claude_code_tools-0.1.9.dist-info/METADATA,sha256=Q9US7C7xOaXcL-mUAqlTD0UvCxor66OOhQz46WlNZP0,9766
|
|
6
|
-
claude_code_tools-0.1.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
7
|
-
claude_code_tools-0.1.9.dist-info/entry_points.txt,sha256=yUTZlZ2jteoUZ9bGPvZKI9tjmohPDhRk1fovu5pZACM,181
|
|
8
|
-
claude_code_tools-0.1.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|