scriptmonkey 1.3.3__tar.gz → 1.4.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.
Files changed (20) hide show
  1. {scriptmonkey-1.3.3 → scriptmonkey-1.4.0}/PKG-INFO +40 -2
  2. {scriptmonkey-1.3.3 → scriptmonkey-1.4.0}/README.md +38 -1
  3. {scriptmonkey-1.3.3 → scriptmonkey-1.4.0}/scriptmonkey/core.py +42 -0
  4. {scriptmonkey-1.3.3 → scriptmonkey-1.4.0}/scriptmonkey.egg-info/PKG-INFO +40 -2
  5. {scriptmonkey-1.3.3 → scriptmonkey-1.4.0}/scriptmonkey.egg-info/requires.txt +1 -0
  6. {scriptmonkey-1.3.3 → scriptmonkey-1.4.0}/setup.py +2 -2
  7. {scriptmonkey-1.3.3 → scriptmonkey-1.4.0}/scriptmonkey/__init__.py +0 -0
  8. {scriptmonkey-1.3.3 → scriptmonkey-1.4.0}/scriptmonkey/__main__.py +0 -0
  9. {scriptmonkey-1.3.3 → scriptmonkey-1.4.0}/scriptmonkey/file_handler.py +0 -0
  10. {scriptmonkey-1.3.3 → scriptmonkey-1.4.0}/scriptmonkey/openai_client/__init__.py +0 -0
  11. {scriptmonkey-1.3.3 → scriptmonkey-1.4.0}/scriptmonkey/openai_client/basemodels.py +0 -0
  12. {scriptmonkey-1.3.3 → scriptmonkey-1.4.0}/scriptmonkey/openai_client/client.py +0 -0
  13. {scriptmonkey-1.3.3 → scriptmonkey-1.4.0}/scriptmonkey/openai_client/prompting.py +0 -0
  14. {scriptmonkey-1.3.3 → scriptmonkey-1.4.0}/scriptmonkey/openai_client/prompts/fix_error.txt +0 -0
  15. {scriptmonkey-1.3.3 → scriptmonkey-1.4.0}/scriptmonkey/openai_client/prompts/project_description.txt +0 -0
  16. {scriptmonkey-1.3.3 → scriptmonkey-1.4.0}/scriptmonkey.egg-info/SOURCES.txt +0 -0
  17. {scriptmonkey-1.3.3 → scriptmonkey-1.4.0}/scriptmonkey.egg-info/dependency_links.txt +0 -0
  18. {scriptmonkey-1.3.3 → scriptmonkey-1.4.0}/scriptmonkey.egg-info/entry_points.txt +0 -0
  19. {scriptmonkey-1.3.3 → scriptmonkey-1.4.0}/scriptmonkey.egg-info/top_level.txt +0 -0
  20. {scriptmonkey-1.3.3 → scriptmonkey-1.4.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: scriptmonkey
3
- Version: 1.3.3
3
+ Version: 1.4.0
4
4
  Summary: A Python package that generates complex software projects and fixes errors in your code using OpenAI's GPT API.
5
5
  Home-page: https://github.com/lukerbs/ScriptMonkey
6
6
  Author: Luke Kerbs
@@ -17,6 +17,7 @@ Requires-Dist: pydantic
17
17
  Requires-Dist: tqdm
18
18
  Requires-Dist: python-dotenv
19
19
  Requires-Dist: rich
20
+ Requires-Dist: pyperclip
20
21
 
21
22
 
22
23
  # ScriptMonkey 🐒
@@ -108,7 +109,7 @@ ScriptMonkey can help answer your technical questions, whether or not you provid
108
109
 
109
110
  After you write your question in the editor and save and close it, ScriptMonkey will use the content as the question. This is especially useful for longer or more complex queries that require more explanation.
110
111
 
111
- - **Ask a question with files**:
112
+ - **Ask a question about specific local files**:
112
113
 
113
114
  ```bash
114
115
  scriptmonkey --ask "Can you help me optimize this function?" --files ./path/to/file1.py ./path/to/file2.js
@@ -128,6 +129,43 @@ ScriptMonkey can help answer your technical questions, whether or not you provid
128
129
 
129
130
  ScriptMonkey will analyze your question and any provided files or the directory tree to give a detailed, markdown-formatted response with explanations and code suggestions, if applicable. This feature is great for in-depth guidance on code optimization, architecture, or general programming questions.
130
131
 
132
+ ### Copy Key Files and Project Details with `--copy`
133
+
134
+ ScriptMonkey's new `--copy` feature is designed to streamline the process of copying critical code files and project structure details into your clipboard, making it easier to ask questions to LLMs like ChatGPT or Claude. This feature formats the copied content in a neat way that includes file contents and the directory tree, making it simple to paste into a conversation for contextual help.
135
+
136
+ #### How to Use
137
+
138
+ - **Copy file contents directly**:
139
+
140
+ You can use the --copy flag to quickly copy the contents of specified files into your clipboard, neatly formatted for easy sharing with an LLM. When combined with the --files flag, ScriptMonkey will copy the contents of the selected files along with a complete directory tree of your project. This provides additional context, helping LLMs better understand your project’s structure:
141
+
142
+ ```bash
143
+ scriptmonkey --copy --files path/to/file1.py path/to/file2.js
144
+ ```
145
+
146
+ Your files and project directory tree are automatically copied to your clipboard in the format:
147
+
148
+ ```
149
+ - - - - - - - - - -
150
+ Here are some details about the project.
151
+
152
+ # path/to/file1.py
153
+ <content from file1.py>
154
+
155
+ - - - - - - - - - -
156
+
157
+ # path/to/file2.js
158
+ <content from file2.js>
159
+
160
+ - - - - - - - - - -
161
+
162
+ # PROJECT TREE
163
+ <directory structure>
164
+ ```
165
+
166
+
167
+
168
+
131
169
  ### Error Handling with `scriptmonkey.run()`
132
170
 
133
171
  ScriptMonkey doesn't just build projects; it also makes debugging a breeze.
@@ -88,7 +88,7 @@ ScriptMonkey can help answer your technical questions, whether or not you provid
88
88
 
89
89
  After you write your question in the editor and save and close it, ScriptMonkey will use the content as the question. This is especially useful for longer or more complex queries that require more explanation.
90
90
 
91
- - **Ask a question with files**:
91
+ - **Ask a question about specific local files**:
92
92
 
93
93
  ```bash
94
94
  scriptmonkey --ask "Can you help me optimize this function?" --files ./path/to/file1.py ./path/to/file2.js
@@ -108,6 +108,43 @@ ScriptMonkey can help answer your technical questions, whether or not you provid
108
108
 
109
109
  ScriptMonkey will analyze your question and any provided files or the directory tree to give a detailed, markdown-formatted response with explanations and code suggestions, if applicable. This feature is great for in-depth guidance on code optimization, architecture, or general programming questions.
110
110
 
111
+ ### Copy Key Files and Project Details with `--copy`
112
+
113
+ ScriptMonkey's new `--copy` feature is designed to streamline the process of copying critical code files and project structure details into your clipboard, making it easier to ask questions to LLMs like ChatGPT or Claude. This feature formats the copied content in a neat way that includes file contents and the directory tree, making it simple to paste into a conversation for contextual help.
114
+
115
+ #### How to Use
116
+
117
+ - **Copy file contents directly**:
118
+
119
+ You can use the --copy flag to quickly copy the contents of specified files into your clipboard, neatly formatted for easy sharing with an LLM. When combined with the --files flag, ScriptMonkey will copy the contents of the selected files along with a complete directory tree of your project. This provides additional context, helping LLMs better understand your project’s structure:
120
+
121
+ ```bash
122
+ scriptmonkey --copy --files path/to/file1.py path/to/file2.js
123
+ ```
124
+
125
+ Your files and project directory tree are automatically copied to your clipboard in the format:
126
+
127
+ ```
128
+ - - - - - - - - - -
129
+ Here are some details about the project.
130
+
131
+ # path/to/file1.py
132
+ <content from file1.py>
133
+
134
+ - - - - - - - - - -
135
+
136
+ # path/to/file2.js
137
+ <content from file2.js>
138
+
139
+ - - - - - - - - - -
140
+
141
+ # PROJECT TREE
142
+ <directory structure>
143
+ ```
144
+
145
+
146
+
147
+
111
148
  ### Error Handling with `scriptmonkey.run()`
112
149
 
113
150
  ScriptMonkey doesn't just build projects; it also makes debugging a breeze.
@@ -21,6 +21,7 @@ import time
21
21
  from pprint import pprint
22
22
  import os
23
23
  import platform
24
+ import pyperclip
24
25
 
25
26
  import re
26
27
  from rich.console import Console
@@ -525,6 +526,34 @@ def render_response_with_syntax_highlighting(response):
525
526
  console.print(Markdown(response[last_pos:]))
526
527
 
527
528
 
529
+ def copy_files_to_clipboard(file_paths, include_tree=True):
530
+ """
531
+ Reads the content from the specified files and copies it to the clipboard in the specified format.
532
+ Optionally includes a project directory tree.
533
+ """
534
+ formatted_output = "- - - - - - - - - -\nHere are some details about the project.\n\n"
535
+
536
+ for path in file_paths:
537
+ try:
538
+ content = read_file(path)
539
+ formatted_output += f"# {path}\n{content}\n\n- - - - - - - - - -\n"
540
+ except FileNotFoundError:
541
+ console.print(f"[bold yellow]Warning: {path} not found. Skipping this file.[/bold yellow]")
542
+ except Exception as e:
543
+ console.print(f"[bold red]Error reading {path}: {e}[/bold red]")
544
+
545
+ # Include the directory tree if requested
546
+ if include_tree:
547
+ start_directory = os.getcwd()
548
+ tree = generate_directory_tree(start_directory)
549
+ formatted_output += "- - - - - - - - - -\n\n# PROJECT TREE\n"
550
+ formatted_output += f"{tree}\n\n"
551
+
552
+ # Copy the formatted output to the clipboard
553
+ pyperclip.copy(formatted_output)
554
+ console.print("[green]🐒 Content has been copied to the clipboard.[/green]")
555
+
556
+
528
557
  def handle_no_prompt():
529
558
  print(f"\nNo Prompt Provided (Tip: Did you save before closing the editor?).\n🐒 Quitting ScriptMonkey...\n")
530
559
  exit()
@@ -536,6 +565,9 @@ def main():
536
565
  parser.add_argument("--files", nargs="*", help="Paths to files to include in the prompt", type=str)
537
566
  parser.add_argument("--tree", help="Include a directory tree in the prompt", action="store_true")
538
567
  parser.add_argument("--set-api-key", help="Set the OpenAI API key", action="store_true")
568
+ parser.add_argument(
569
+ "--copy", help="Copy the content of the specified files to the clipboard", action="store_true"
570
+ ) # New --copy flag
539
571
  args = parser.parse_args()
540
572
 
541
573
  print(f"\n- - 🐒 WELCOME TO SCRIPT MONKEY 🐒 - - -\n")
@@ -545,6 +577,16 @@ def main():
545
577
  update_api_key()
546
578
  return
547
579
 
580
+ if args.copy:
581
+ # Handle the --copy functionality
582
+ file_paths = args.files if args.files else []
583
+ if not file_paths:
584
+ console.print("[bold red]❌ No files specified to copy. Use --files to specify file paths.[/bold red]")
585
+ return
586
+ include_tree = args.tree
587
+ copy_files_to_clipboard(file_paths)
588
+ return
589
+
548
590
  if args.ask is not None:
549
591
  # Handle the --ask functionality
550
592
  # Check if the --ask flag was used without a direct question (e.g., `--ask` alone)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: scriptmonkey
3
- Version: 1.3.3
3
+ Version: 1.4.0
4
4
  Summary: A Python package that generates complex software projects and fixes errors in your code using OpenAI's GPT API.
5
5
  Home-page: https://github.com/lukerbs/ScriptMonkey
6
6
  Author: Luke Kerbs
@@ -17,6 +17,7 @@ Requires-Dist: pydantic
17
17
  Requires-Dist: tqdm
18
18
  Requires-Dist: python-dotenv
19
19
  Requires-Dist: rich
20
+ Requires-Dist: pyperclip
20
21
 
21
22
 
22
23
  # ScriptMonkey 🐒
@@ -108,7 +109,7 @@ ScriptMonkey can help answer your technical questions, whether or not you provid
108
109
 
109
110
  After you write your question in the editor and save and close it, ScriptMonkey will use the content as the question. This is especially useful for longer or more complex queries that require more explanation.
110
111
 
111
- - **Ask a question with files**:
112
+ - **Ask a question about specific local files**:
112
113
 
113
114
  ```bash
114
115
  scriptmonkey --ask "Can you help me optimize this function?" --files ./path/to/file1.py ./path/to/file2.js
@@ -128,6 +129,43 @@ ScriptMonkey can help answer your technical questions, whether or not you provid
128
129
 
129
130
  ScriptMonkey will analyze your question and any provided files or the directory tree to give a detailed, markdown-formatted response with explanations and code suggestions, if applicable. This feature is great for in-depth guidance on code optimization, architecture, or general programming questions.
130
131
 
132
+ ### Copy Key Files and Project Details with `--copy`
133
+
134
+ ScriptMonkey's new `--copy` feature is designed to streamline the process of copying critical code files and project structure details into your clipboard, making it easier to ask questions to LLMs like ChatGPT or Claude. This feature formats the copied content in a neat way that includes file contents and the directory tree, making it simple to paste into a conversation for contextual help.
135
+
136
+ #### How to Use
137
+
138
+ - **Copy file contents directly**:
139
+
140
+ You can use the --copy flag to quickly copy the contents of specified files into your clipboard, neatly formatted for easy sharing with an LLM. When combined with the --files flag, ScriptMonkey will copy the contents of the selected files along with a complete directory tree of your project. This provides additional context, helping LLMs better understand your project’s structure:
141
+
142
+ ```bash
143
+ scriptmonkey --copy --files path/to/file1.py path/to/file2.js
144
+ ```
145
+
146
+ Your files and project directory tree are automatically copied to your clipboard in the format:
147
+
148
+ ```
149
+ - - - - - - - - - -
150
+ Here are some details about the project.
151
+
152
+ # path/to/file1.py
153
+ <content from file1.py>
154
+
155
+ - - - - - - - - - -
156
+
157
+ # path/to/file2.js
158
+ <content from file2.js>
159
+
160
+ - - - - - - - - - -
161
+
162
+ # PROJECT TREE
163
+ <directory structure>
164
+ ```
165
+
166
+
167
+
168
+
131
169
  ### Error Handling with `scriptmonkey.run()`
132
170
 
133
171
  ScriptMonkey doesn't just build projects; it also makes debugging a breeze.
@@ -3,3 +3,4 @@ pydantic
3
3
  tqdm
4
4
  python-dotenv
5
5
  rich
6
+ pyperclip
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="scriptmonkey",
5
- version="1.3.3",
5
+ version="1.4.0",
6
6
  description="A Python package that generates complex software projects and fixes errors in your code using OpenAI's GPT API.",
7
7
  long_description=open("README.md", "r").read(),
8
8
  long_description_content_type="text/markdown",
@@ -11,7 +11,7 @@ setup(
11
11
  author_email="LDK.kerbs@gmail.com",
12
12
  license="MIT",
13
13
  packages=find_packages(),
14
- install_requires=["openai", "pydantic", "tqdm", "python-dotenv", "rich"],
14
+ install_requires=["openai", "pydantic", "tqdm", "python-dotenv", "rich", "pyperclip"],
15
15
  python_requires=">=3.6",
16
16
  entry_points={
17
17
  "console_scripts": [
File without changes