dirshot 0.1.3__tar.gz → 0.3.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.
- dirshot-0.3.0/PKG-INFO +197 -0
- dirshot-0.3.0/README.md +180 -0
- {dirshot-0.1.3 → dirshot-0.3.0}/pyproject.toml +14 -6
- dirshot-0.3.0/src/dirshot/__init__.py +22 -0
- dirshot-0.3.0/src/dirshot/dirshot.py +1084 -0
- dirshot-0.3.0/src/dirshot/reconstruct.py +110 -0
- dirshot-0.3.0/src/dirshot.egg-info/PKG-INFO +197 -0
- {dirshot-0.1.3 → dirshot-0.3.0}/src/dirshot.egg-info/SOURCES.txt +2 -2
- dirshot-0.3.0/src/dirshot.egg-info/requires.txt +3 -0
- dirshot-0.3.0/tests/test_dirshot.py +139 -0
- dirshot-0.1.3/PKG-INFO +0 -110
- dirshot-0.1.3/README.md +0 -96
- dirshot-0.1.3/src/dirshot/__init__.py +0 -21
- dirshot-0.1.3/src/dirshot/dirshot.py +0 -1118
- dirshot-0.1.3/src/dirshot/examples.py +0 -65
- dirshot-0.1.3/src/dirshot.egg-info/PKG-INFO +0 -110
- dirshot-0.1.3/src/dirshot.egg-info/requires.txt +0 -1
- dirshot-0.1.3/tests/test.py +0 -200
- {dirshot-0.1.3 → dirshot-0.3.0}/setup.cfg +0 -0
- {dirshot-0.1.3 → dirshot-0.3.0}/src/dirshot.egg-info/dependency_links.txt +0 -0
- {dirshot-0.1.3 → dirshot-0.3.0}/src/dirshot.egg-info/top_level.txt +0 -0
dirshot-0.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dirshot
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: A flexible, high-performance utility for creating project snapshots and searching files with a rich terminal UI.
|
|
5
|
+
Author-email: init-helpful <init.helpful@gmail.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/init-helpful/dirshot
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/init-helpful/dirshot/issues
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Topic :: Terminals
|
|
12
|
+
Classifier: Topic :: Utilities
|
|
13
|
+
Requires-Python: >=3.7
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
Provides-Extra: rich
|
|
16
|
+
Requires-Dist: rich>=13.0.0; extra == "rich"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# dirshot 📸
|
|
20
|
+
|
|
21
|
+
[](https://badge.fury.io/py/dirshot)
|
|
22
|
+
[](https://opensource.org/licenses/MIT)
|
|
23
|
+

|
|
24
|
+
|
|
25
|
+
A flexible, high-performance utility for creating project snapshots and searching files, complete with rich visual feedback in your terminal.
|
|
26
|
+
|
|
27
|
+
`dirshot` scans your project directories to either create a single, comprehensive text file "snapshot" of your codebase or to search for specific keywords within your files. It's perfect for feeding project context to Large Language Models (LLMs), archiving codebases, conducting security audits, or simply navigating complex projects.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## ✨ Key Features
|
|
32
|
+
|
|
33
|
+
- **Rich Terminal Visuals**: Powered by `rich`, `dirshot` provides a beautiful and informative live view of its progress, including spinners, progress bars, summary tables, and thread activity. It falls back to a simple text-based progress indicator if `rich` is not installed.
|
|
34
|
+
- **Powerful Presets**: Comes with an extensive list of `LanguagePreset` and `IgnorePreset` enums to instantly configure scans for dozens of languages, frameworks, and tools (Python, JavaScript, Go, Rust, Terraform, Docker, etc.).
|
|
35
|
+
- **Dual Modes**:
|
|
36
|
+
- **Snapshot Mode**: Collate all project files matching your criteria into a single, easy-to-share output file.
|
|
37
|
+
- **Search Mode**: Hunt for specific keywords in filenames or, optionally, within file contents.
|
|
38
|
+
- **Highly Customizable**: Fine-tune scans by combining presets with manual lists of file extensions, ignore paths, and specific file names to include or exclude.
|
|
39
|
+
- **Concurrent & Fast**: Uses a `ThreadPoolExecutor` for high-performance file discovery and processing, making scans quick and efficient.
|
|
40
|
+
- **Detailed Output**: Generates an optional file tree, shows detailed scan summaries, and can even approximate token/character counts, which is useful for LLM context limits.
|
|
41
|
+
|
|
42
|
+
## 📦 Installation
|
|
43
|
+
|
|
44
|
+
You can install `dirshot` directly from PyPI.
|
|
45
|
+
|
|
46
|
+
**Basic Installation (no visual dependencies):**
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install dirshot
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Installation with Enhanced Terminal Visuals:**
|
|
53
|
+
|
|
54
|
+
To get the full rich terminal experience, install the `rich` extra, which adds support for `rich`.
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install dirshot[rich]
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## 🚀 How to Use
|
|
61
|
+
|
|
62
|
+
`dirshot` is used by importing the `generate_snapshot` function into a Python script.
|
|
63
|
+
|
|
64
|
+
Here is a basic example of creating a snapshot of a Python project:
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
# snapshot_script.py
|
|
68
|
+
from src.dirshot import generate_snapshot, LanguagePreset, IgnorePreset
|
|
69
|
+
# or
|
|
70
|
+
# from src.dirshot import *
|
|
71
|
+
|
|
72
|
+
generate_snapshot(
|
|
73
|
+
root_directory=".", # optional
|
|
74
|
+
output_file_name="my_python_project.txt",
|
|
75
|
+
language_presets=[LanguagePreset.PYTHON, LanguagePreset.MARKUP],
|
|
76
|
+
ignore_presets=[
|
|
77
|
+
IgnorePreset.VERSION_CONTROL, # Ignore .git
|
|
78
|
+
IgnorePreset.PYTHON, # Ignore __pycache__, venv, etc.
|
|
79
|
+
IgnorePreset.IDE_METADATA # Ignore .vscode, .idea
|
|
80
|
+
],
|
|
81
|
+
generate_tree=True,
|
|
82
|
+
show_token_count=True
|
|
83
|
+
)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
To run this, save the code as a Python file (e.g., `snapshot_script.py`) and execute it from your terminal:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
python snapshot_script.py
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## 📋 Examples
|
|
93
|
+
|
|
94
|
+
The `examples.py` file in the repository contains many more use cases. Here are a few common ones:
|
|
95
|
+
|
|
96
|
+
#### 1. Full-Stack Web App (React + Node.js)
|
|
97
|
+
|
|
98
|
+
This example combines multiple presets to capture a full-stack JavaScript project while ignoring common clutter like `node_modules`.
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
generate_snapshot(
|
|
102
|
+
root_directory=".",
|
|
103
|
+
output_file_name="fullstack_js_snapshot.txt",
|
|
104
|
+
language_presets=[
|
|
105
|
+
LanguagePreset.REACT, # Handles all frontend JS/TS/JSX files
|
|
106
|
+
LanguagePreset.WEB_FRONTEND # Includes HTML and CSS files
|
|
107
|
+
],
|
|
108
|
+
ignore_presets=[
|
|
109
|
+
IgnorePreset.NODE_JS, # Crucial for ignoring node_modules
|
|
110
|
+
IgnorePreset.IDE_METADATA,
|
|
111
|
+
IgnorePreset.BUILD_ARTIFACTS,
|
|
112
|
+
IgnorePreset.VERSION_CONTROL
|
|
113
|
+
],
|
|
114
|
+
generate_tree=True,
|
|
115
|
+
show_tree_stats=True
|
|
116
|
+
)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
#### 2. Data Science Project (Python, Notebooks & SQL)
|
|
120
|
+
|
|
121
|
+
Collate all relevant files from a data analysis or machine learning project.
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
generate_snapshot(
|
|
125
|
+
root_directory="./data_science_project",
|
|
126
|
+
output_file_name="data_science_snapshot.txt",
|
|
127
|
+
language_presets=[
|
|
128
|
+
LanguagePreset.PYTHON,
|
|
129
|
+
LanguagePreset.DATA_SCIENCE_NOTEBOOKS, # .ipynb
|
|
130
|
+
LanguagePreset.SQL,
|
|
131
|
+
LanguagePreset.MARKUP # Include READMEs
|
|
132
|
+
],
|
|
133
|
+
ignore_presets=[
|
|
134
|
+
IgnorePreset.PYTHON, # Ignores venv, __pycache__, etc.
|
|
135
|
+
IgnorePreset.JUPYTER_NOTEBOOKS, # Ignores .ipynb_checkpoints
|
|
136
|
+
IgnorePreset.IDE_METADATA,
|
|
137
|
+
IgnorePreset.VERSION_CONTROL
|
|
138
|
+
]
|
|
139
|
+
)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
#### 3. Search for Secrets or API Keys
|
|
143
|
+
|
|
144
|
+
Use "Search Mode" to perform a security audit. This example intentionally omits the `SECRET_FILES` ignore preset to ensure `.env` files are searched.
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
generate_snapshot(
|
|
148
|
+
root_directory=".",
|
|
149
|
+
output_file_name="secrets_audit_results.txt",
|
|
150
|
+
search_keywords=["password", "secret_key", "api_key", "token"],
|
|
151
|
+
language_presets=[LanguagePreset.CONFIGURATION],
|
|
152
|
+
search_file_contents=True,
|
|
153
|
+
ignore_presets=[
|
|
154
|
+
IgnorePreset.VERSION_CONTROL,
|
|
155
|
+
IgnorePreset.NODE_JS,
|
|
156
|
+
IgnorePreset.BUILD_ARTIFACTS
|
|
157
|
+
# Deliberately not ignoring SECRET_FILES
|
|
158
|
+
]
|
|
159
|
+
)
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## ⚙️ API Reference
|
|
163
|
+
|
|
164
|
+
The `generate_snapshot()` function accepts the following parameters:
|
|
165
|
+
|
|
166
|
+
| Parameter | Type | Default | Description |
|
|
167
|
+
| ------------------------------------- | ---------------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------- |
|
|
168
|
+
| `root_directory` | `str` | `"."` | The starting directory for the scan. |
|
|
169
|
+
| `output_file_name` | `str` | `"project_snapshot.txt"` | The name of the file to save the results to. |
|
|
170
|
+
| `search_keywords` | `Optional[List[str]]` | `None` | If provided, switches to **Search Mode**. Otherwise, runs in **Snapshot Mode**. |
|
|
171
|
+
| `files` | `Optional[List[str]]` | `None` | A list of specific filenames to include. If provided, checks this list first before extensions. |
|
|
172
|
+
| `language_presets` | `Optional[List[LanguagePreset]]` | `None` | A list of `LanguagePreset` enums for common file types (e.g., `LanguagePreset.PYTHON`). |
|
|
173
|
+
| `ignore_presets` | `Optional[List[IgnorePreset]]` | `None` | A list of `IgnorePreset` enums for common ignore patterns (e.g., `IgnorePreset.NODE_JS`). |
|
|
174
|
+
| `file_extensions` | `Optional[List[str]]` | `None` | A manual list of file extensions to include (e.g., `[".py", ".md"]`). |
|
|
175
|
+
| `ignore_if_in_path` | `Optional[List[str]]` | `None` | A list of directory or file substring names to exclude (e.g., `["temp"]` excludes `src/temp/file.py`). |
|
|
176
|
+
| `ignore_extensions` | `Optional[List[str]]` | `None` | A manual list of file extensions to explicitly ignore (e.g., `[".log", ".tmp"]`). |
|
|
177
|
+
| `search_file_contents` | `bool` | `True` | In Search Mode, search for keywords within file contents. |
|
|
178
|
+
| `generate_tree` | `bool` | `True` | Include a file tree of the matched files at the top of the output. |
|
|
179
|
+
| `show_tree_stats` | `bool` | `False` | Display file and directory counts in the generated tree. |
|
|
180
|
+
| `show_token_count` | `bool` | `False` | Display an approximated token/character count in the summary and output file. |
|
|
181
|
+
| `exclude_whitespace_in_token_count` | `bool` | `False` | If `True`, removes whitespace before counting tokens for a more compact count. |
|
|
182
|
+
| `max_workers` | `Optional[int]` | `CPU count + 4` | The maximum number of worker threads for concurrent processing. |
|
|
183
|
+
| `read_binary_files` | `bool` | `False` | If `True`, the content search will attempt to read and search through binary files. |
|
|
184
|
+
| `only_show_tree` | `bool` | `False` | If `True`, the output file will contain only the file tree (and stats), omitting file content. |
|
|
185
|
+
| `case_sensitive_filter` | `bool` | `False` | If `True`, file filtering (extensions, ignore paths) is case-sensitive. |
|
|
186
|
+
| `case_sensitive_search` | `bool` | `False` | If `True`, keyword searching is case-sensitive. |
|
|
187
|
+
|
|
188
|
+
## 🤝 Contributing
|
|
189
|
+
|
|
190
|
+
Contributions are welcome! Please feel free to submit a pull request or open an issue.
|
|
191
|
+
|
|
192
|
+
1. Fork the repository.
|
|
193
|
+
2. Create a new branch (`git checkout -b feature/your-feature-name`).
|
|
194
|
+
3. Make your changes.
|
|
195
|
+
4. Commit your changes (`git commit -m 'Add some feature'`).
|
|
196
|
+
5. Push to the branch (`git push origin feature/your-feature-name`).
|
|
197
|
+
6. Open a pull request.
|
dirshot-0.3.0/README.md
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
|
|
2
|
+
# dirshot 📸
|
|
3
|
+
|
|
4
|
+
[](https://badge.fury.io/py/dirshot)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
A flexible, high-performance utility for creating project snapshots and searching files, complete with rich visual feedback in your terminal.
|
|
9
|
+
|
|
10
|
+
`dirshot` scans your project directories to either create a single, comprehensive text file "snapshot" of your codebase or to search for specific keywords within your files. It's perfect for feeding project context to Large Language Models (LLMs), archiving codebases, conducting security audits, or simply navigating complex projects.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## ✨ Key Features
|
|
15
|
+
|
|
16
|
+
- **Rich Terminal Visuals**: Powered by `rich`, `dirshot` provides a beautiful and informative live view of its progress, including spinners, progress bars, summary tables, and thread activity. It falls back to a simple text-based progress indicator if `rich` is not installed.
|
|
17
|
+
- **Powerful Presets**: Comes with an extensive list of `LanguagePreset` and `IgnorePreset` enums to instantly configure scans for dozens of languages, frameworks, and tools (Python, JavaScript, Go, Rust, Terraform, Docker, etc.).
|
|
18
|
+
- **Dual Modes**:
|
|
19
|
+
- **Snapshot Mode**: Collate all project files matching your criteria into a single, easy-to-share output file.
|
|
20
|
+
- **Search Mode**: Hunt for specific keywords in filenames or, optionally, within file contents.
|
|
21
|
+
- **Highly Customizable**: Fine-tune scans by combining presets with manual lists of file extensions, ignore paths, and specific file names to include or exclude.
|
|
22
|
+
- **Concurrent & Fast**: Uses a `ThreadPoolExecutor` for high-performance file discovery and processing, making scans quick and efficient.
|
|
23
|
+
- **Detailed Output**: Generates an optional file tree, shows detailed scan summaries, and can even approximate token/character counts, which is useful for LLM context limits.
|
|
24
|
+
|
|
25
|
+
## 📦 Installation
|
|
26
|
+
|
|
27
|
+
You can install `dirshot` directly from PyPI.
|
|
28
|
+
|
|
29
|
+
**Basic Installation (no visual dependencies):**
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install dirshot
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Installation with Enhanced Terminal Visuals:**
|
|
36
|
+
|
|
37
|
+
To get the full rich terminal experience, install the `rich` extra, which adds support for `rich`.
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install dirshot[rich]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## 🚀 How to Use
|
|
44
|
+
|
|
45
|
+
`dirshot` is used by importing the `generate_snapshot` function into a Python script.
|
|
46
|
+
|
|
47
|
+
Here is a basic example of creating a snapshot of a Python project:
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
# snapshot_script.py
|
|
51
|
+
from src.dirshot import generate_snapshot, LanguagePreset, IgnorePreset
|
|
52
|
+
# or
|
|
53
|
+
# from src.dirshot import *
|
|
54
|
+
|
|
55
|
+
generate_snapshot(
|
|
56
|
+
root_directory=".", # optional
|
|
57
|
+
output_file_name="my_python_project.txt",
|
|
58
|
+
language_presets=[LanguagePreset.PYTHON, LanguagePreset.MARKUP],
|
|
59
|
+
ignore_presets=[
|
|
60
|
+
IgnorePreset.VERSION_CONTROL, # Ignore .git
|
|
61
|
+
IgnorePreset.PYTHON, # Ignore __pycache__, venv, etc.
|
|
62
|
+
IgnorePreset.IDE_METADATA # Ignore .vscode, .idea
|
|
63
|
+
],
|
|
64
|
+
generate_tree=True,
|
|
65
|
+
show_token_count=True
|
|
66
|
+
)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
To run this, save the code as a Python file (e.g., `snapshot_script.py`) and execute it from your terminal:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
python snapshot_script.py
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## 📋 Examples
|
|
76
|
+
|
|
77
|
+
The `examples.py` file in the repository contains many more use cases. Here are a few common ones:
|
|
78
|
+
|
|
79
|
+
#### 1. Full-Stack Web App (React + Node.js)
|
|
80
|
+
|
|
81
|
+
This example combines multiple presets to capture a full-stack JavaScript project while ignoring common clutter like `node_modules`.
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
generate_snapshot(
|
|
85
|
+
root_directory=".",
|
|
86
|
+
output_file_name="fullstack_js_snapshot.txt",
|
|
87
|
+
language_presets=[
|
|
88
|
+
LanguagePreset.REACT, # Handles all frontend JS/TS/JSX files
|
|
89
|
+
LanguagePreset.WEB_FRONTEND # Includes HTML and CSS files
|
|
90
|
+
],
|
|
91
|
+
ignore_presets=[
|
|
92
|
+
IgnorePreset.NODE_JS, # Crucial for ignoring node_modules
|
|
93
|
+
IgnorePreset.IDE_METADATA,
|
|
94
|
+
IgnorePreset.BUILD_ARTIFACTS,
|
|
95
|
+
IgnorePreset.VERSION_CONTROL
|
|
96
|
+
],
|
|
97
|
+
generate_tree=True,
|
|
98
|
+
show_tree_stats=True
|
|
99
|
+
)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### 2. Data Science Project (Python, Notebooks & SQL)
|
|
103
|
+
|
|
104
|
+
Collate all relevant files from a data analysis or machine learning project.
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
generate_snapshot(
|
|
108
|
+
root_directory="./data_science_project",
|
|
109
|
+
output_file_name="data_science_snapshot.txt",
|
|
110
|
+
language_presets=[
|
|
111
|
+
LanguagePreset.PYTHON,
|
|
112
|
+
LanguagePreset.DATA_SCIENCE_NOTEBOOKS, # .ipynb
|
|
113
|
+
LanguagePreset.SQL,
|
|
114
|
+
LanguagePreset.MARKUP # Include READMEs
|
|
115
|
+
],
|
|
116
|
+
ignore_presets=[
|
|
117
|
+
IgnorePreset.PYTHON, # Ignores venv, __pycache__, etc.
|
|
118
|
+
IgnorePreset.JUPYTER_NOTEBOOKS, # Ignores .ipynb_checkpoints
|
|
119
|
+
IgnorePreset.IDE_METADATA,
|
|
120
|
+
IgnorePreset.VERSION_CONTROL
|
|
121
|
+
]
|
|
122
|
+
)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
#### 3. Search for Secrets or API Keys
|
|
126
|
+
|
|
127
|
+
Use "Search Mode" to perform a security audit. This example intentionally omits the `SECRET_FILES` ignore preset to ensure `.env` files are searched.
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
generate_snapshot(
|
|
131
|
+
root_directory=".",
|
|
132
|
+
output_file_name="secrets_audit_results.txt",
|
|
133
|
+
search_keywords=["password", "secret_key", "api_key", "token"],
|
|
134
|
+
language_presets=[LanguagePreset.CONFIGURATION],
|
|
135
|
+
search_file_contents=True,
|
|
136
|
+
ignore_presets=[
|
|
137
|
+
IgnorePreset.VERSION_CONTROL,
|
|
138
|
+
IgnorePreset.NODE_JS,
|
|
139
|
+
IgnorePreset.BUILD_ARTIFACTS
|
|
140
|
+
# Deliberately not ignoring SECRET_FILES
|
|
141
|
+
]
|
|
142
|
+
)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## ⚙️ API Reference
|
|
146
|
+
|
|
147
|
+
The `generate_snapshot()` function accepts the following parameters:
|
|
148
|
+
|
|
149
|
+
| Parameter | Type | Default | Description |
|
|
150
|
+
| ------------------------------------- | ---------------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------- |
|
|
151
|
+
| `root_directory` | `str` | `"."` | The starting directory for the scan. |
|
|
152
|
+
| `output_file_name` | `str` | `"project_snapshot.txt"` | The name of the file to save the results to. |
|
|
153
|
+
| `search_keywords` | `Optional[List[str]]` | `None` | If provided, switches to **Search Mode**. Otherwise, runs in **Snapshot Mode**. |
|
|
154
|
+
| `files` | `Optional[List[str]]` | `None` | A list of specific filenames to include. If provided, checks this list first before extensions. |
|
|
155
|
+
| `language_presets` | `Optional[List[LanguagePreset]]` | `None` | A list of `LanguagePreset` enums for common file types (e.g., `LanguagePreset.PYTHON`). |
|
|
156
|
+
| `ignore_presets` | `Optional[List[IgnorePreset]]` | `None` | A list of `IgnorePreset` enums for common ignore patterns (e.g., `IgnorePreset.NODE_JS`). |
|
|
157
|
+
| `file_extensions` | `Optional[List[str]]` | `None` | A manual list of file extensions to include (e.g., `[".py", ".md"]`). |
|
|
158
|
+
| `ignore_if_in_path` | `Optional[List[str]]` | `None` | A list of directory or file substring names to exclude (e.g., `["temp"]` excludes `src/temp/file.py`). |
|
|
159
|
+
| `ignore_extensions` | `Optional[List[str]]` | `None` | A manual list of file extensions to explicitly ignore (e.g., `[".log", ".tmp"]`). |
|
|
160
|
+
| `search_file_contents` | `bool` | `True` | In Search Mode, search for keywords within file contents. |
|
|
161
|
+
| `generate_tree` | `bool` | `True` | Include a file tree of the matched files at the top of the output. |
|
|
162
|
+
| `show_tree_stats` | `bool` | `False` | Display file and directory counts in the generated tree. |
|
|
163
|
+
| `show_token_count` | `bool` | `False` | Display an approximated token/character count in the summary and output file. |
|
|
164
|
+
| `exclude_whitespace_in_token_count` | `bool` | `False` | If `True`, removes whitespace before counting tokens for a more compact count. |
|
|
165
|
+
| `max_workers` | `Optional[int]` | `CPU count + 4` | The maximum number of worker threads for concurrent processing. |
|
|
166
|
+
| `read_binary_files` | `bool` | `False` | If `True`, the content search will attempt to read and search through binary files. |
|
|
167
|
+
| `only_show_tree` | `bool` | `False` | If `True`, the output file will contain only the file tree (and stats), omitting file content. |
|
|
168
|
+
| `case_sensitive_filter` | `bool` | `False` | If `True`, file filtering (extensions, ignore paths) is case-sensitive. |
|
|
169
|
+
| `case_sensitive_search` | `bool` | `False` | If `True`, keyword searching is case-sensitive. |
|
|
170
|
+
|
|
171
|
+
## 🤝 Contributing
|
|
172
|
+
|
|
173
|
+
Contributions are welcome! Please feel free to submit a pull request or open an issue.
|
|
174
|
+
|
|
175
|
+
1. Fork the repository.
|
|
176
|
+
2. Create a new branch (`git checkout -b feature/your-feature-name`).
|
|
177
|
+
3. Make your changes.
|
|
178
|
+
4. Commit your changes (`git commit -m 'Add some feature'`).
|
|
179
|
+
5. Push to the branch (`git push origin feature/your-feature-name`).
|
|
180
|
+
6. Open a pull request.
|
|
@@ -4,22 +4,30 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "dirshot"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.3.0"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name="init-helpful", email="init.helpful@gmail.com" },
|
|
10
10
|
]
|
|
11
|
-
description = "A flexible utility for creating project snapshots and searching
|
|
11
|
+
description = "A flexible, high-performance utility for creating project snapshots and searching files with a rich terminal UI."
|
|
12
12
|
readme = "README.md"
|
|
13
13
|
requires-python = ">=3.7"
|
|
14
14
|
classifiers = [
|
|
15
15
|
"Programming Language :: Python :: 3",
|
|
16
16
|
"License :: OSI Approved :: MIT License",
|
|
17
17
|
"Operating System :: OS Independent",
|
|
18
|
+
"Topic :: Terminals",
|
|
19
|
+
"Topic :: Utilities",
|
|
18
20
|
]
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
dependencies = []
|
|
22
24
|
|
|
23
25
|
[project.urls]
|
|
24
26
|
"Homepage" = "https://github.com/init-helpful/dirshot"
|
|
25
|
-
"Bug Tracker" = "https://github.com/init-helpful/dirshot/issues"
|
|
27
|
+
"Bug Tracker" = "https://github.com/init-helpful/dirshot/issues"
|
|
28
|
+
|
|
29
|
+
# Install with: pip install dirshot[rich]
|
|
30
|
+
[project.optional-dependencies]
|
|
31
|
+
rich = [
|
|
32
|
+
"rich>=13.0.0",
|
|
33
|
+
]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
"""
|
|
3
|
+
dirshot - A flexible, high-performance utility for creating project snapshots
|
|
4
|
+
and searching files with a rich terminal UI.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .dirshot import (
|
|
8
|
+
generate_snapshot,
|
|
9
|
+
LanguagePreset,
|
|
10
|
+
IgnorePreset,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
# The primary function for all scanning and snapshot operations.
|
|
15
|
+
"generate_snapshot",
|
|
16
|
+
|
|
17
|
+
# Enums for easy configuration of scanning criteria.
|
|
18
|
+
"LanguagePreset",
|
|
19
|
+
"IgnorePreset",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
__version__ = "0.2.0"
|