kopipasta 0.16.0__py3-none-any.whl → 0.18.0__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 kopipasta might be problematic. Click here for more details.
- kopipasta/main.py +38 -5
- {kopipasta-0.16.0.dist-info → kopipasta-0.18.0.dist-info}/METADATA +1 -1
- kopipasta-0.18.0.dist-info/RECORD +8 -0
- kopipasta-0.16.0.dist-info/RECORD +0 -8
- {kopipasta-0.16.0.dist-info → kopipasta-0.18.0.dist-info}/LICENSE +0 -0
- {kopipasta-0.16.0.dist-info → kopipasta-0.18.0.dist-info}/WHEEL +0 -0
- {kopipasta-0.16.0.dist-info → kopipasta-0.18.0.dist-info}/entry_points.txt +0 -0
- {kopipasta-0.16.0.dist-info → kopipasta-0.18.0.dist-info}/top_level.txt +0 -0
kopipasta/main.py
CHANGED
|
@@ -8,11 +8,22 @@ import re
|
|
|
8
8
|
from typing import Dict, List, Optional, Set, Tuple
|
|
9
9
|
import pyperclip
|
|
10
10
|
import fnmatch
|
|
11
|
+
from pygments import highlight
|
|
12
|
+
from pygments.lexers import get_lexer_for_filename, TextLexer
|
|
13
|
+
from pygments.formatters import TerminalFormatter
|
|
14
|
+
import pygments.util
|
|
11
15
|
|
|
12
16
|
import requests
|
|
13
17
|
|
|
14
18
|
FileTuple = Tuple[str, bool, Optional[List[str]], str]
|
|
15
19
|
|
|
20
|
+
def get_colored_code(file_path, code):
|
|
21
|
+
try:
|
|
22
|
+
lexer = get_lexer_for_filename(file_path)
|
|
23
|
+
except pygments.util.ClassNotFound:
|
|
24
|
+
lexer = TextLexer()
|
|
25
|
+
return highlight(code, lexer, TerminalFormatter())
|
|
26
|
+
|
|
16
27
|
def read_gitignore():
|
|
17
28
|
default_ignore_patterns = [
|
|
18
29
|
'.git', 'node_modules', 'venv', '.venv', 'dist', '.idea', '__pycache__',
|
|
@@ -375,7 +386,8 @@ def select_file_patches(file_path):
|
|
|
375
386
|
print(f"\nSelecting patches for {file_path}")
|
|
376
387
|
for index, (chunk_code, start_line, end_line) in enumerate(code_chunks):
|
|
377
388
|
print(f"\nChunk {index + 1} (Lines {start_line + 1}-{end_line}):")
|
|
378
|
-
|
|
389
|
+
colored_chunk = get_colored_code(file_path, chunk_code)
|
|
390
|
+
print(colored_chunk)
|
|
379
391
|
while True:
|
|
380
392
|
choice = input("(y)es include / (n)o skip / (q)uit rest of file? ").lower()
|
|
381
393
|
if choice == 'y':
|
|
@@ -706,15 +718,36 @@ def generate_prompt(files_to_include: List[FileTuple], ignore_patterns: List[str
|
|
|
706
718
|
prompt += "## Task Instructions\n\n"
|
|
707
719
|
task_instructions = input("Enter the task instructions: ")
|
|
708
720
|
prompt += f"{task_instructions}\n\n"
|
|
709
|
-
prompt += "##
|
|
721
|
+
prompt += "## Instructions for Achieving the Task\n\n"
|
|
710
722
|
analysis_text = (
|
|
711
|
-
"
|
|
712
|
-
"
|
|
713
|
-
"
|
|
723
|
+
"1. **Confirm and Understand the Task**:\n"
|
|
724
|
+
" - Rephrase the task in your own words to ensure understanding.\n"
|
|
725
|
+
" - Ask for any necessary clarifications.\n"
|
|
726
|
+
" - Once everything is clear, ask to proceed.\n\n"
|
|
727
|
+
"2. **Outline a Plan**:\n"
|
|
728
|
+
" - Provide a brief plan on how to approach the task.\n"
|
|
729
|
+
" - Make minimal incremental changes to maintain a working codebase at each step.\n"
|
|
730
|
+
" - This is an iterative process aimed at achieving the task step by step.\n\n"
|
|
731
|
+
"3. **Implement Changes Iteratively**:\n"
|
|
732
|
+
" - Apply changes in small, manageable increments.\n"
|
|
733
|
+
" - Ensure the codebase remains functional after each change.\n"
|
|
734
|
+
" - After each increment, verify stability before proceeding to the next step.\n\n"
|
|
735
|
+
"4. **Present Code Changes Clearly**:\n"
|
|
736
|
+
" - Specify the file being modified at the beginning of each code block.\n"
|
|
737
|
+
" - Format changes for clarity:\n"
|
|
738
|
+
" - For small changes: Show only the changed lines with clear comments.\n"
|
|
739
|
+
" - For larger changes: Provide the full new implementation of changed parts, using placeholders like `'// ... (rest of the function)'` for unchanged code.\n"
|
|
740
|
+
" - Provide context by including important unchanged parts as needed.\n"
|
|
741
|
+
" - Use clear comments to explain the changes and reference old code if helpful.\n\n"
|
|
742
|
+
"5. **Encourage User Testing and Collaboration**:\n"
|
|
743
|
+
" - Ask the user to test the code on their machine after each change.\n"
|
|
744
|
+
" - If debugging is needed, include debugging messages in the code.\n"
|
|
745
|
+
" - Request the user to share any error messages or outputs from debugging to assist further.\n"
|
|
714
746
|
)
|
|
715
747
|
prompt += analysis_text
|
|
716
748
|
return prompt
|
|
717
749
|
|
|
750
|
+
|
|
718
751
|
def main():
|
|
719
752
|
parser = argparse.ArgumentParser(description="Generate a prompt with project structure, file contents, and web content.")
|
|
720
753
|
parser.add_argument('inputs', nargs='+', help='Files, directories, or URLs to include in the prompt')
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
kopipasta/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
kopipasta/main.py,sha256=VuVUOjCL1XeAV9u7oo-hx2v42KgE0mFYWzfoDn2hL6E,35090
|
|
3
|
+
kopipasta-0.18.0.dist-info/LICENSE,sha256=xw4C9TAU7LFu4r_MwSbky90uzkzNtRwAo3c51IWR8lk,1091
|
|
4
|
+
kopipasta-0.18.0.dist-info/METADATA,sha256=be12_mfA2Ivg30CH8gIVrghmVzz71-56nAanX7ZsZhM,5646
|
|
5
|
+
kopipasta-0.18.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
6
|
+
kopipasta-0.18.0.dist-info/entry_points.txt,sha256=but54qDNz1-F8fVvGstq_QID5tHjczP7bO7rWLFkc6Y,50
|
|
7
|
+
kopipasta-0.18.0.dist-info/top_level.txt,sha256=iXohixMuCdw8UjGDUp0ouICLYBDrx207sgZIJ9lxn0o,10
|
|
8
|
+
kopipasta-0.18.0.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
kopipasta/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
kopipasta/main.py,sha256=saG3HuptoAg7kPz-VqiGF9Bh3oznMmATxsQbRpZc_ZY,33134
|
|
3
|
-
kopipasta-0.16.0.dist-info/LICENSE,sha256=xw4C9TAU7LFu4r_MwSbky90uzkzNtRwAo3c51IWR8lk,1091
|
|
4
|
-
kopipasta-0.16.0.dist-info/METADATA,sha256=e6kZrq96erWpl2HRyGiknXTRHQdnERd3eWccFEK0kC0,5646
|
|
5
|
-
kopipasta-0.16.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
6
|
-
kopipasta-0.16.0.dist-info/entry_points.txt,sha256=but54qDNz1-F8fVvGstq_QID5tHjczP7bO7rWLFkc6Y,50
|
|
7
|
-
kopipasta-0.16.0.dist-info/top_level.txt,sha256=iXohixMuCdw8UjGDUp0ouICLYBDrx207sgZIJ9lxn0o,10
|
|
8
|
-
kopipasta-0.16.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|