claude-code-tools 0.1.8__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.

Potentially problematic release.


This version of claude-code-tools might be problematic. Click here for more details.

@@ -0,0 +1,181 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ *.manifest
31
+ *.spec
32
+
33
+ # Installer logs
34
+ pip-log.txt
35
+ pip-delete-this-directory.txt
36
+
37
+ # Unit test / coverage reports
38
+ htmlcov/
39
+ .tox/
40
+ .nox/
41
+ .coverage
42
+ .coverage.*
43
+ .cache
44
+ nosetests.xml
45
+ coverage.xml
46
+ *.cover
47
+ *.py,cover
48
+ .hypothesis/
49
+ .pytest_cache/
50
+ cover/
51
+
52
+ # Translations
53
+ *.mo
54
+ *.pot
55
+
56
+ # Django stuff:
57
+ *.log
58
+ local_settings.py
59
+ db.sqlite3
60
+ db.sqlite3-journal
61
+
62
+ # Flask stuff:
63
+ instance/
64
+ .webassets-cache
65
+
66
+ # Scrapy stuff:
67
+ .scrapy
68
+
69
+ # Sphinx documentation
70
+ docs/_build/
71
+
72
+ # PyBuilder
73
+ .pybuilder/
74
+ target/
75
+
76
+ # Jupyter Notebook
77
+ .ipynb_checkpoints
78
+
79
+ # IPython
80
+ profile_default/
81
+ ipython_config.py
82
+
83
+ # pyenv
84
+ .python-version
85
+
86
+ # pipenv
87
+ Pipfile.lock
88
+
89
+ # poetry
90
+ poetry.lock
91
+
92
+ # pdm
93
+ .pdm.toml
94
+ .pdm-python
95
+
96
+ # PEP 582
97
+ __pypackages__/
98
+
99
+ # Celery stuff
100
+ celerybeat-schedule
101
+ celerybeat.pid
102
+
103
+ # SageMath parsed files
104
+ *.sage.py
105
+
106
+ # Environments
107
+ .env
108
+ .venv
109
+ env/
110
+ venv/
111
+ ENV/
112
+ env.bak/
113
+ venv.bak/
114
+
115
+ # Spyder project settings
116
+ .spyderproject
117
+ .spyproject
118
+
119
+ # Rope project settings
120
+ .ropeproject
121
+
122
+ # mkdocs documentation
123
+ /site
124
+
125
+ # mypy
126
+ .mypy_cache/
127
+ .dmypy.json
128
+ dmypy.json
129
+
130
+ # Pyre type checker
131
+ .pyre/
132
+
133
+ # pytype static type analyzer
134
+ .pytype/
135
+
136
+ # Cython debug symbols
137
+ cython_debug/
138
+
139
+ # PyCharm
140
+ .idea/
141
+
142
+ # VS Code
143
+ .vscode/
144
+
145
+ # macOS
146
+ .DS_Store
147
+
148
+ # Windows
149
+ Thumbs.db
150
+ ehthumbs.db
151
+
152
+ # Linux
153
+ *~
154
+
155
+ # Temporary files
156
+ *.tmp
157
+ *.bak
158
+ *.swp
159
+ *.swo
160
+
161
+ # UV
162
+ .uv/
163
+
164
+ # Ruff
165
+ .ruff_cache/
166
+
167
+ # Local development
168
+ local/
169
+ scratch/
170
+
171
+ # Claude Code settings and environment files
172
+ settings.json
173
+ hook-settings.json
174
+ hooks/settings.json
175
+ .env*
176
+ node_modules/
177
+ package-lock.json
178
+
179
+ # Backup files
180
+ *.backup*
181
+ to-be-deleted.md
@@ -0,0 +1,36 @@
1
+ .PHONY: install release patch minor major dev-install help
2
+
3
+ help:
4
+ @echo "Available commands:"
5
+ @echo " make install - Install in editable mode (for development)"
6
+ @echo " make dev-install - Install with dev dependencies (includes commitizen)"
7
+ @echo " make release - Bump patch version and install globally"
8
+ @echo " make patch - Bump patch version (0.0.X) and install"
9
+ @echo " make minor - Bump minor version (0.X.0) and install"
10
+ @echo " make major - Bump major version (X.0.0) and install"
11
+
12
+ install:
13
+ uv tool install --force -e .
14
+
15
+ dev-install:
16
+ uv pip install -e ".[dev]"
17
+
18
+ release: patch
19
+
20
+ patch:
21
+ @echo "Bumping patch version..."
22
+ uv run cz bump --increment PATCH --yes
23
+ uv tool install --force --reinstall .
24
+ @echo "Installation complete!"
25
+
26
+ minor:
27
+ @echo "Bumping minor version..."
28
+ uv run cz bump --increment MINOR --yes
29
+ uv tool install --force --reinstall .
30
+ @echo "Installation complete!"
31
+
32
+ major:
33
+ @echo "Bumping major version..."
34
+ uv run cz bump --increment MAJOR --yes
35
+ uv tool install --force --reinstall .
36
+ @echo "Installation complete!"
@@ -0,0 +1,313 @@
1
+ Metadata-Version: 2.4
2
+ Name: claude-code-tools
3
+ Version: 0.1.8
4
+ Summary: Collection of tools for working with Claude Code
5
+ Requires-Python: >=3.11
6
+ Requires-Dist: click>=8.0.0
7
+ Requires-Dist: fire>=0.5.0
8
+ Requires-Dist: rich>=13.0.0
9
+ Provides-Extra: dev
10
+ Requires-Dist: commitizen>=3.0.0; extra == 'dev'
11
+ Description-Content-Type: text/markdown
12
+
13
+ # claude-code-tools
14
+
15
+ A collection of practical tools, hooks, and utilities for enhancing Claude Code.
16
+
17
+ ## 🎮 tmux-cli: Bridging Claude Code and Interactive CLIs
18
+
19
+ ![tmux-cli demo](demos/tmux-cli-demo-short.gif)
20
+
21
+ Consider these scenarios:
22
+
23
+ You're using Claude Code (CC) to build an interactive script. The script prompts
24
+ for user input, but CC can't respond to prompts.
25
+
26
+ You want Claude Code to debug using pdb, stepping through code line by line.
27
+
28
+ You need CC to launch another Claude Code instance for code review - not as a
29
+ hidden sub-agent, but as a visible session you can monitor (as shown in gif above).
30
+
31
+ **tmux-cli enables these workflows** by giving Claude Code programmatic control
32
+ over terminal applications.
33
+
34
+ For those new to [tmux](https://github.com/tmux/tmux/wiki), it's a terminal
35
+ multiplexer that lets you create and manage multiple terminal sessions. The key
36
+ benefit for our purposes is that tmux is scriptable and allows sending keystrokes
37
+ to specific panes or sessions programmatically.
38
+
39
+ **Important**: You don't need to learn tmux-cli commands. Claude Code will handle
40
+ all the interactions automatically. Just tell CC what you want to do, and it will
41
+ use tmux-cli behind the scenes.
42
+
43
+ **Think Playwright for terminals** - Terminal automation for AI agents.
44
+
45
+ **Works anywhere**: Automatically handles both local tmux panes and remote sessions.
46
+
47
+ ## 🚀 Quick Start
48
+
49
+ ```bash
50
+ # Install all the command-line tools
51
+ uv tool install git+https://github.com/pchalasani/claude-code-tools
52
+ ```
53
+
54
+ This gives you:
55
+ - `tmux-cli` - The interactive CLI controller we just covered
56
+ - `find-claude-session` - Search and resume Claude Code sessions by keywords
57
+ - `vault` - Encrypted backup for your .env files
58
+
59
+ ## 🎮 tmux-cli Deep Dive
60
+
61
+ ### What Claude Code Can Do With tmux-cli
62
+
63
+ 1. **Test Interactive Scripts** - CC can run and interact with scripts that
64
+ require user input, answering prompts automatically based on your instructions.
65
+
66
+ 2. **UI Development & Testing** - CC can launch web servers and coordinate with
67
+ browser automation tools to test your applications.
68
+
69
+ 3. **Interactive Debugging** - CC can use debuggers (pdb, node inspect, gdb) to
70
+ step through code, examine variables, and help you understand program flow.
71
+
72
+ 4. **Claude-to-Claude Communication** - CC can launch another Claude Code instance
73
+ to get specialized help or code reviews.
74
+
75
+ Claude Code knows how to use tmux-cli through its built-in help. You just describe
76
+ what you want, and CC handles the technical details.
77
+
78
+ For complete command reference, see [docs/tmux-cli-instructions.md](docs/tmux-cli-instructions.md).
79
+
80
+ ### Setting up tmux-cli for Claude Code
81
+
82
+ To enable CC to use tmux-cli, add this snippet to your global
83
+ `~/.claude/CLAUDE.md` file:
84
+
85
+ ```markdown
86
+ # tmux-cli Command to interact with CLI applications
87
+
88
+ `tmux-cli` is a bash command that enables Claude Code to control CLI applications
89
+ running in separate tmux panes - launch programs, send input, capture output,
90
+ and manage interactive sessions. Run `tmux-cli --help` for detailed usage
91
+ instructions.
92
+
93
+ Example uses:
94
+ - Interact with a script that waits for user input
95
+ - Launch another Claude Code instance to have it perform some analysis or review or
96
+ debugging etc
97
+ - Run a Python script with the Pdb debugger to step thru its execution, for
98
+ code-understanding and debugging
99
+ - Launch web apps and test them with browser automation MCP tools like Puppeteer
100
+ ```
101
+
102
+ For detailed instructions, see [docs/tmux-cli-instructions.md](docs/tmux-cli-instructions.md).
103
+
104
+ ## 🔍 find-claude-session
105
+
106
+ Search and resume Claude Code sessions by keywords with an interactive UI.
107
+
108
+ ### Setup (Recommended)
109
+
110
+ Add this function to your shell config (.bashrc/.zshrc) for persistent directory
111
+ changes:
112
+
113
+ ```bash
114
+ fcs() { eval "$(find-claude-session --shell "$@" | sed '/^$/d')"; }
115
+ ```
116
+
117
+ Or source the provided function:
118
+ ```bash
119
+ source /path/to/claude-code-tools/scripts/fcs-function.sh
120
+ ```
121
+
122
+ ### Usage
123
+
124
+ ```bash
125
+ # Search in current project
126
+ fcs "keyword1,keyword2,keyword3"
127
+
128
+ # Search across all Claude projects
129
+ fcs "keywords" --global
130
+ fcs "keywords" -g
131
+ ```
132
+
133
+ ### Features
134
+
135
+ - Interactive session selection with previews
136
+ - Cross-project search capabilities
137
+ - Automatic session resumption with `claude -r`
138
+ - Persistent directory changes when resuming cross-project sessions
139
+
140
+ Note: You can also use `find-claude-session` directly, but directory changes
141
+ won't persist after exiting Claude Code.
142
+
143
+ For detailed documentation, see [docs/find-claude-session.md](docs/find-claude-session.md).
144
+
145
+ ## 🔐 vault
146
+
147
+ Centralized encrypted backup for .env files across all your projects using SOPS.
148
+
149
+ ```bash
150
+ vault sync # Smart sync (auto-detect direction)
151
+ vault encrypt # Backup .env to ~/Git/dotenvs/
152
+ vault decrypt # Restore .env from centralized vault
153
+ vault list # Show all project backups
154
+ vault status # Check sync status for current project
155
+ ```
156
+
157
+ ### Key Features
158
+
159
+ - Stores all encrypted .env files in `~/Git/dotenvs/`
160
+ - Automatic sync direction detection
161
+ - GPG encryption via SOPS
162
+ - Timestamped backups for safety
163
+
164
+ For detailed documentation, see [docs/vault-documentation.md](docs/vault-documentation.md).
165
+
166
+ ## 🛡️ Claude Code Safety Hooks
167
+
168
+ This repository includes a comprehensive set of safety hooks that enhance Claude
169
+ Code's behavior and prevent dangerous operations.
170
+
171
+ ### Key Safety Features
172
+
173
+ - **File Deletion Protection** - Blocks `rm` commands, enforces TRASH directory
174
+ pattern
175
+ - **Git Safety** - Prevents dangerous `git add -A`, unsafe checkouts, and
176
+ accidental data loss
177
+ - **Context Management** - Blocks reading files >500 lines to prevent context
178
+ bloat
179
+ - **Command Enhancement** - Enforces ripgrep (`rg`) over grep for better
180
+ performance
181
+
182
+ ### Quick Setup
183
+
184
+ 1. Copy the sample hooks configuration:
185
+ ```bash
186
+ cp hooks/settings.sample.json hooks/settings.json
187
+ export CLAUDE_CODE_TOOLS_PATH=/path/to/claude-code-tools
188
+ ```
189
+
190
+ 2. Reference in your Claude Code settings or use `--hooks` flag:
191
+ ```bash
192
+ claude --hooks /path/to/hooks/settings.json
193
+ ```
194
+
195
+ ### Available Hooks
196
+
197
+ - `bash_hook.py` - Comprehensive bash command safety checks
198
+ - `file_size_conditional_hook.py` - Prevents reading huge files
199
+ - `grep_block_hook.py` - Enforces ripgrep usage
200
+ - `notification_hook.sh` - Sends ntfy.sh notifications
201
+ - `pretask/posttask_subtask_flag.py` - Manages sub-agent state
202
+
203
+ For complete documentation, see [hooks/README.md](hooks/README.md).
204
+
205
+ ## 🤖 Using Claude Code with Open-weight Anthropic API-compatible LLM Providers
206
+
207
+ You can use Claude Code with alternative LLMs served via Anthropic-compatible
208
+ APIs. Add these functions to your shell config (.bashrc/.zshrc):
209
+
210
+ ```bash
211
+ kimi() {
212
+ (
213
+ export ANTHROPIC_BASE_URL=https://api.moonshot.ai/anthropic
214
+ export ANTHROPIC_AUTH_TOKEN=$KIMI_API_KEY
215
+ claude "$@"
216
+ )
217
+ }
218
+
219
+ zai() {
220
+ (
221
+ export ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic
222
+ export ANTHROPIC_AUTH_TOKEN=$Z_API_KEY
223
+ claude "$@"
224
+ )
225
+ }
226
+ ```
227
+
228
+ After adding these functions:
229
+ - Set your API keys: `export KIMI_API_KEY=your-kimi-key` and
230
+ `export Z_API_KEY=your-z-key`
231
+ - Run `kimi` to use Claude Code with the Kimi K2 LLM
232
+ - Run `zai` to use Claude Code with the GLM-4.5 model
233
+
234
+ The functions use subshells to ensure the environment variables don't affect
235
+ your main shell session, so you could be running multiple instances of Claude Code,
236
+ each using a different LLM.
237
+
238
+ ## 📚 Documentation
239
+
240
+ - [tmux-cli detailed instructions](docs/tmux-cli-instructions.md) -
241
+ Comprehensive guide for using tmux-cli
242
+ - [Claude Code tmux tutorials](docs/claude-code-tmux-tutorials.md) -
243
+ Additional tutorials and examples
244
+ - [Vault documentation](docs/vault-documentation.md) -
245
+ Complete guide for the .env backup system
246
+ - [Hook configuration](hooks/README.md) - Setting up Claude Code hooks
247
+
248
+ ## 📋 Requirements
249
+
250
+ - Python 3.11+
251
+ - uv (for installation)
252
+ - tmux (for tmux-cli functionality)
253
+ - SOPS (for vault functionality)
254
+
255
+ ## 🛠️ Development
256
+
257
+ ### Setup
258
+
259
+ 1. Clone the repository:
260
+ ```bash
261
+ git clone https://github.com/username/claude-code-tools
262
+ cd claude-code-tools
263
+ ```
264
+
265
+ 2. Create and activate a virtual environment with uv:
266
+ ```bash
267
+ uv venv
268
+ source .venv/bin/activate # On Windows: .venv\Scripts\activate
269
+ ```
270
+
271
+ 3. Install in development mode:
272
+ ```bash
273
+ make install # Install tools in editable mode
274
+ make dev-install # Install with dev dependencies (includes commitizen)
275
+ ```
276
+
277
+ ### Making Changes
278
+
279
+ - The tools are installed in editable mode, so changes take effect immediately
280
+ - Test your changes by running the commands directly
281
+ - Follow the existing code style and conventions
282
+
283
+ ### Version Management
284
+
285
+ The project uses commitizen for version management:
286
+
287
+ ```bash
288
+ make patch # Bump patch version (0.0.X)
289
+ make minor # Bump minor version (0.X.0)
290
+ make major # Bump major version (X.0.0)
291
+ ```
292
+
293
+ ### Contributing
294
+
295
+ 1. Fork the repository
296
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
297
+ 3. Make your changes
298
+ 4. Test thoroughly
299
+ 5. Commit your changes (commitizen will format the commit message)
300
+ 6. Push to your fork
301
+ 7. Open a Pull Request
302
+
303
+ ### Available Make Commands
304
+
305
+ Run `make help` to see all available commands:
306
+ - `make install` - Install in editable mode for development
307
+ - `make dev-install` - Install with development dependencies
308
+ - `make release` - Bump patch version and install globally
309
+ - `make patch/minor/major` - Version bump commands
310
+
311
+ ## 📄 License
312
+
313
+ MIT