kopipasta 0.28.0__tar.gz → 0.29.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.
Potentially problematic release.
This version of kopipasta might be problematic. Click here for more details.
- {kopipasta-0.28.0/kopipasta.egg-info → kopipasta-0.29.0}/PKG-INFO +3 -1
- kopipasta-0.29.0/kopipasta/file.py +47 -0
- {kopipasta-0.28.0 → kopipasta-0.29.0}/kopipasta/main.py +375 -288
- kopipasta-0.29.0/kopipasta/prompt.py +163 -0
- kopipasta-0.29.0/kopipasta/tree_selector.py +510 -0
- {kopipasta-0.28.0 → kopipasta-0.29.0/kopipasta.egg-info}/PKG-INFO +3 -1
- {kopipasta-0.28.0 → kopipasta-0.29.0}/kopipasta.egg-info/SOURCES.txt +3 -0
- kopipasta-0.29.0/kopipasta.egg-info/requires.txt +5 -0
- kopipasta-0.28.0/kopipasta.egg-info/requires.txt → kopipasta-0.29.0/requirements.txt +2 -0
- {kopipasta-0.28.0 → kopipasta-0.29.0}/setup.py +1 -1
- kopipasta-0.28.0/requirements.txt +0 -3
- {kopipasta-0.28.0 → kopipasta-0.29.0}/LICENSE +0 -0
- {kopipasta-0.28.0 → kopipasta-0.29.0}/MANIFEST.in +0 -0
- {kopipasta-0.28.0 → kopipasta-0.29.0}/README.md +0 -0
- {kopipasta-0.28.0 → kopipasta-0.29.0}/kopipasta/__init__.py +0 -0
- {kopipasta-0.28.0 → kopipasta-0.29.0}/kopipasta/import_parser.py +0 -0
- {kopipasta-0.28.0 → kopipasta-0.29.0}/kopipasta.egg-info/dependency_links.txt +0 -0
- {kopipasta-0.28.0 → kopipasta-0.29.0}/kopipasta.egg-info/entry_points.txt +0 -0
- {kopipasta-0.28.0 → kopipasta-0.29.0}/kopipasta.egg-info/top_level.txt +0 -0
- {kopipasta-0.28.0 → kopipasta-0.29.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: kopipasta
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.29.0
|
|
4
4
|
Summary: A CLI tool to generate prompts with project structure and file contents
|
|
5
5
|
Home-page: https://github.com/mkorpela/kopipasta
|
|
6
6
|
Author: Mikko Korpela
|
|
@@ -22,6 +22,8 @@ License-File: LICENSE
|
|
|
22
22
|
Requires-Dist: pyperclip==1.9.0
|
|
23
23
|
Requires-Dist: requests==2.32.3
|
|
24
24
|
Requires-Dist: Pygments==2.18.0
|
|
25
|
+
Requires-Dist: rich==13.8.1
|
|
26
|
+
Requires-Dist: click==8.2.1
|
|
25
27
|
|
|
26
28
|
# kopipasta
|
|
27
29
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import fnmatch
|
|
2
|
+
import os
|
|
3
|
+
from typing import List, Optional, Tuple
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
FileTuple = Tuple[str, bool, Optional[List[str]], str]
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def read_file_contents(file_path):
|
|
10
|
+
try:
|
|
11
|
+
with open(file_path, 'r') as file:
|
|
12
|
+
return file.read()
|
|
13
|
+
except Exception as e:
|
|
14
|
+
print(f"Error reading {file_path}: {e}")
|
|
15
|
+
return ""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def is_ignored(path, ignore_patterns):
|
|
19
|
+
path = os.path.normpath(path)
|
|
20
|
+
for pattern in ignore_patterns:
|
|
21
|
+
if fnmatch.fnmatch(os.path.basename(path), pattern) or fnmatch.fnmatch(path, pattern):
|
|
22
|
+
return True
|
|
23
|
+
return False
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def is_binary(file_path):
|
|
27
|
+
try:
|
|
28
|
+
with open(file_path, 'rb') as file:
|
|
29
|
+
chunk = file.read(1024)
|
|
30
|
+
if b'\0' in chunk: # null bytes indicate binary file
|
|
31
|
+
return True
|
|
32
|
+
if file_path.lower().endswith(('.json', '.csv')):
|
|
33
|
+
return False
|
|
34
|
+
return False
|
|
35
|
+
except IOError:
|
|
36
|
+
return False
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def get_human_readable_size(size):
|
|
40
|
+
for unit in ['B', 'KB', 'MB', 'GB', 'TB']:
|
|
41
|
+
if size < 1024.0:
|
|
42
|
+
return f"{size:.2f} {unit}"
|
|
43
|
+
size /= 1024.0
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def is_large_file(file_path, threshold=102400): # 100 KB threshold
|
|
47
|
+
return os.path.getsize(file_path) > threshold
|