scriptmonkey 1.0.2__tar.gz → 1.2.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.
- {scriptmonkey-1.0.2 → scriptmonkey-1.2.0}/PKG-INFO +25 -3
- {scriptmonkey-1.0.2 → scriptmonkey-1.2.0}/README.md +23 -2
- {scriptmonkey-1.0.2 → scriptmonkey-1.2.0}/scriptmonkey/core.py +134 -18
- {scriptmonkey-1.0.2 → scriptmonkey-1.2.0}/scriptmonkey/openai_client/client.py +6 -4
- {scriptmonkey-1.0.2 → scriptmonkey-1.2.0}/scriptmonkey.egg-info/PKG-INFO +25 -3
- {scriptmonkey-1.0.2 → scriptmonkey-1.2.0}/scriptmonkey.egg-info/requires.txt +1 -0
- {scriptmonkey-1.0.2 → scriptmonkey-1.2.0}/setup.py +2 -2
- {scriptmonkey-1.0.2 → scriptmonkey-1.2.0}/scriptmonkey/__init__.py +0 -0
- {scriptmonkey-1.0.2 → scriptmonkey-1.2.0}/scriptmonkey/__main__.py +0 -0
- {scriptmonkey-1.0.2 → scriptmonkey-1.2.0}/scriptmonkey/file_handler.py +0 -0
- {scriptmonkey-1.0.2 → scriptmonkey-1.2.0}/scriptmonkey/openai_client/__init__.py +0 -0
- {scriptmonkey-1.0.2 → scriptmonkey-1.2.0}/scriptmonkey/openai_client/basemodels.py +0 -0
- {scriptmonkey-1.0.2 → scriptmonkey-1.2.0}/scriptmonkey/openai_client/prompting.py +0 -0
- {scriptmonkey-1.0.2 → scriptmonkey-1.2.0}/scriptmonkey/openai_client/prompts/fix_error.txt +0 -0
- {scriptmonkey-1.0.2 → scriptmonkey-1.2.0}/scriptmonkey/openai_client/prompts/project_description.txt +0 -0
- {scriptmonkey-1.0.2 → scriptmonkey-1.2.0}/scriptmonkey.egg-info/SOURCES.txt +0 -0
- {scriptmonkey-1.0.2 → scriptmonkey-1.2.0}/scriptmonkey.egg-info/dependency_links.txt +0 -0
- {scriptmonkey-1.0.2 → scriptmonkey-1.2.0}/scriptmonkey.egg-info/entry_points.txt +0 -0
- {scriptmonkey-1.0.2 → scriptmonkey-1.2.0}/scriptmonkey.egg-info/top_level.txt +0 -0
- {scriptmonkey-1.0.2 → scriptmonkey-1.2.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: scriptmonkey
|
|
3
|
-
Version: 1.0
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: A Python package that generates complex Python 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
|
|
@@ -16,6 +16,7 @@ Requires-Dist: openai
|
|
|
16
16
|
Requires-Dist: pydantic
|
|
17
17
|
Requires-Dist: tqdm
|
|
18
18
|
Requires-Dist: python-dotenv
|
|
19
|
+
Requires-Dist: rich
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
# ScriptMonkey 🐒
|
|
@@ -29,6 +30,7 @@ ScriptMonkey is an AI-powered Python package that reimagines how projects are bu
|
|
|
29
30
|
- **AI-Powered Fixes**: Uses OpenAI's GPT API to understand and resolve errors.
|
|
30
31
|
- **Code Auto-Correction**: Automatically updates your Python files with the fixes.
|
|
31
32
|
- **Cross-IDE Compatibility**: Works with any IDE or code editor.
|
|
33
|
+
- **Context-Aware Q&A**: Ask questions directly to ChatGPT with or without providing files for context. Get detailed answers with code examples, explanations, and best practices tailored to your needs.
|
|
32
34
|
|
|
33
35
|
## 🚀 Watch the Demo
|
|
34
36
|
|
|
@@ -46,7 +48,7 @@ pip install scriptmonkey
|
|
|
46
48
|
|
|
47
49
|
## Usage
|
|
48
50
|
|
|
49
|
-
### Project Generation with `
|
|
51
|
+
### Project Generation with `scriptmonkey`
|
|
50
52
|
|
|
51
53
|
ScriptMonkey can generate a complete, custom-coded project structure based on a description you provide. This feature helps you quickly set up new projects with the necessary files and folders.
|
|
52
54
|
|
|
@@ -55,7 +57,7 @@ ScriptMonkey can generate a complete, custom-coded project structure based on a
|
|
|
55
57
|
1. Run the following command in your terminal:
|
|
56
58
|
|
|
57
59
|
```bash
|
|
58
|
-
|
|
60
|
+
scriptmonkey
|
|
59
61
|
```
|
|
60
62
|
|
|
61
63
|
2. A text editor will open (e.g., `nano`, `vim`, or `notepad` depending on your environment). Follow the on-screen instructions to provide a detailed description of your project.
|
|
@@ -80,6 +82,26 @@ I need a Flask-based web application for managing a book library. The applicatio
|
|
|
80
82
|
|
|
81
83
|
ScriptMonkey will use this description to create a project structure and code files for you in a directory named `generated_project`.
|
|
82
84
|
|
|
85
|
+
### Context-Aware Q&A with `scriptmonkey --ask`
|
|
86
|
+
|
|
87
|
+
ScriptMonkey can help answer your technical questions, whether or not you provide code files for context. This feature allows you to leverage the power of ChatGPT to ask questiona about files, clarify concepts, get code reviews, or understand best practices in various programming languages.
|
|
88
|
+
|
|
89
|
+
#### How to Use
|
|
90
|
+
|
|
91
|
+
- **Ask a question without files**:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
scriptmonkey --ask "What are the best practices for database indexing?"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
- **Ask a question with files**:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
scriptmonkey --ask "Can you help me optimize this function?" --files ./path/to/file1.py ./path/to/file2.js
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
ScriptMonkey will analyze your question and any provided files 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.
|
|
104
|
+
|
|
83
105
|
### Error Handling with `scriptmonkey.run()`
|
|
84
106
|
|
|
85
107
|
ScriptMonkey doesn't just build projects; it also makes debugging a breeze.
|
|
@@ -10,6 +10,7 @@ ScriptMonkey is an AI-powered Python package that reimagines how projects are bu
|
|
|
10
10
|
- **AI-Powered Fixes**: Uses OpenAI's GPT API to understand and resolve errors.
|
|
11
11
|
- **Code Auto-Correction**: Automatically updates your Python files with the fixes.
|
|
12
12
|
- **Cross-IDE Compatibility**: Works with any IDE or code editor.
|
|
13
|
+
- **Context-Aware Q&A**: Ask questions directly to ChatGPT with or without providing files for context. Get detailed answers with code examples, explanations, and best practices tailored to your needs.
|
|
13
14
|
|
|
14
15
|
## 🚀 Watch the Demo
|
|
15
16
|
|
|
@@ -27,7 +28,7 @@ pip install scriptmonkey
|
|
|
27
28
|
|
|
28
29
|
## Usage
|
|
29
30
|
|
|
30
|
-
### Project Generation with `
|
|
31
|
+
### Project Generation with `scriptmonkey`
|
|
31
32
|
|
|
32
33
|
ScriptMonkey can generate a complete, custom-coded project structure based on a description you provide. This feature helps you quickly set up new projects with the necessary files and folders.
|
|
33
34
|
|
|
@@ -36,7 +37,7 @@ ScriptMonkey can generate a complete, custom-coded project structure based on a
|
|
|
36
37
|
1. Run the following command in your terminal:
|
|
37
38
|
|
|
38
39
|
```bash
|
|
39
|
-
|
|
40
|
+
scriptmonkey
|
|
40
41
|
```
|
|
41
42
|
|
|
42
43
|
2. A text editor will open (e.g., `nano`, `vim`, or `notepad` depending on your environment). Follow the on-screen instructions to provide a detailed description of your project.
|
|
@@ -61,6 +62,26 @@ I need a Flask-based web application for managing a book library. The applicatio
|
|
|
61
62
|
|
|
62
63
|
ScriptMonkey will use this description to create a project structure and code files for you in a directory named `generated_project`.
|
|
63
64
|
|
|
65
|
+
### Context-Aware Q&A with `scriptmonkey --ask`
|
|
66
|
+
|
|
67
|
+
ScriptMonkey can help answer your technical questions, whether or not you provide code files for context. This feature allows you to leverage the power of ChatGPT to ask questiona about files, clarify concepts, get code reviews, or understand best practices in various programming languages.
|
|
68
|
+
|
|
69
|
+
#### How to Use
|
|
70
|
+
|
|
71
|
+
- **Ask a question without files**:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
scriptmonkey --ask "What are the best practices for database indexing?"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
- **Ask a question with files**:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
scriptmonkey --ask "Can you help me optimize this function?" --files ./path/to/file1.py ./path/to/file2.js
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
ScriptMonkey will analyze your question and any provided files 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.
|
|
84
|
+
|
|
64
85
|
### Error Handling with `scriptmonkey.run()`
|
|
65
86
|
|
|
66
87
|
ScriptMonkey doesn't just build projects; it also makes debugging a breeze.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import sys
|
|
2
2
|
import traceback
|
|
3
|
+
import argparse
|
|
3
4
|
from .openai_client import (
|
|
4
5
|
chatgpt_json,
|
|
5
6
|
chatgpt,
|
|
@@ -20,6 +21,15 @@ from pprint import pprint
|
|
|
20
21
|
import os
|
|
21
22
|
import platform
|
|
22
23
|
|
|
24
|
+
import re
|
|
25
|
+
from rich.console import Console
|
|
26
|
+
from rich.markdown import Markdown
|
|
27
|
+
from rich.syntax import Syntax
|
|
28
|
+
|
|
29
|
+
console = Console()
|
|
30
|
+
|
|
31
|
+
CONFIG_FILE = os.path.expanduser("~/.scriptmonkey_config")
|
|
32
|
+
|
|
23
33
|
|
|
24
34
|
def get_platform():
|
|
25
35
|
os_name = platform.system()
|
|
@@ -109,7 +119,7 @@ def get_openai_api_key() -> str:
|
|
|
109
119
|
# Prompt user for API key if not found
|
|
110
120
|
if not api_key:
|
|
111
121
|
print("🐒 ScriptMonkey requires an OpenAI API key to function.")
|
|
112
|
-
api_key =
|
|
122
|
+
api_key = input("Please enter your OpenAI API key: ")
|
|
113
123
|
|
|
114
124
|
if api_key:
|
|
115
125
|
save_api_key(api_key)
|
|
@@ -123,7 +133,7 @@ def get_openai_api_key() -> str:
|
|
|
123
133
|
|
|
124
134
|
def update_api_key():
|
|
125
135
|
"""Prompt the user to update the OpenAI API key."""
|
|
126
|
-
api_key =
|
|
136
|
+
api_key = input("Enter the new OpenAI API key: ")
|
|
127
137
|
if api_key:
|
|
128
138
|
save_api_key(api_key)
|
|
129
139
|
print("✅ OpenAI API key updated successfully.")
|
|
@@ -283,29 +293,39 @@ def gather_project_context(project_description: str, project_files: list) -> str
|
|
|
283
293
|
|
|
284
294
|
def generate_code_for_file(file_description: dict, project_description: str, project_files: list) -> str:
|
|
285
295
|
"""
|
|
286
|
-
Generates
|
|
296
|
+
Generates content for a given file based on its description using the chatgpt() function.
|
|
287
297
|
|
|
288
298
|
Args:
|
|
289
|
-
file_description (dict): The description of the file for which
|
|
299
|
+
file_description (dict): The description of the file for which content is being generated.
|
|
290
300
|
project_description (str): A high-level description of the project's purpose and goals.
|
|
291
301
|
project_files (list): List of all project files for context.
|
|
292
302
|
|
|
293
303
|
Returns:
|
|
294
|
-
str: The generated
|
|
304
|
+
str: The generated content for the file.
|
|
295
305
|
"""
|
|
296
306
|
# Gather context about the project goal and other files
|
|
297
307
|
context = gather_project_context(project_description, project_files)
|
|
298
308
|
|
|
299
|
-
#
|
|
309
|
+
# Extract the file extension to inform the content type
|
|
310
|
+
file_extension = os.path.splitext(file_description["path"])[1].lower().strip(".")
|
|
311
|
+
|
|
312
|
+
# Dynamically adjust the content type description based on the file extension
|
|
313
|
+
if file_extension:
|
|
314
|
+
content_type_description = f"{file_extension.upper()} file content"
|
|
315
|
+
else:
|
|
316
|
+
content_type_description = "text content"
|
|
317
|
+
|
|
318
|
+
# Prepare instructions for OpenAI to generate content based on the file description and type
|
|
300
319
|
instructions = (
|
|
301
|
-
"Write the complete
|
|
302
|
-
"
|
|
303
|
-
"
|
|
320
|
+
f"Write the complete content for a {content_type_description} that fulfills the following requirements. "
|
|
321
|
+
"Consider the context of the entire project when generating the content and make use of imports where available and appropriate."
|
|
322
|
+
"Use relevant imports, references, and appropriate formatting or structure where necessary. Do not add extra commentary or explanation. "
|
|
323
|
+
"Make sure to return the content directly, without wrapping it in any code fences like triple quotes or backticks."
|
|
304
324
|
f"\n\nFile Description: {file_description['description']}"
|
|
305
325
|
f"\n\n{context}\n"
|
|
306
326
|
)
|
|
307
327
|
|
|
308
|
-
#
|
|
328
|
+
# Include functions for code files (if provided)
|
|
309
329
|
if file_description.get("functions"):
|
|
310
330
|
instructions += "\n\nFunctions:\n"
|
|
311
331
|
for function in file_description["functions"]:
|
|
@@ -314,14 +334,14 @@ def generate_code_for_file(file_description: dict, project_description: str, pro
|
|
|
314
334
|
f"(Inputs: {function['inputs']}, Outputs: {function['outputs']})\n"
|
|
315
335
|
)
|
|
316
336
|
|
|
317
|
-
# Call the chatgpt function to generate the
|
|
318
|
-
|
|
337
|
+
# Call the chatgpt function to generate the content
|
|
338
|
+
generated_content = chatgpt(prompt=instructions)
|
|
319
339
|
|
|
320
|
-
#
|
|
321
|
-
if "```
|
|
322
|
-
|
|
340
|
+
# Clean up any unintended code blocks
|
|
341
|
+
if f"```{file_extension}" in generated_content:
|
|
342
|
+
generated_content = generated_content.split(f"```{file_extension}")[1].split("```")[0].strip()
|
|
323
343
|
|
|
324
|
-
return
|
|
344
|
+
return generated_content
|
|
325
345
|
|
|
326
346
|
|
|
327
347
|
def generate_readme(description: str, project_structure: dict) -> str:
|
|
@@ -340,11 +360,107 @@ def generate_readme(description: str, project_structure: dict) -> str:
|
|
|
340
360
|
return readme_content
|
|
341
361
|
|
|
342
362
|
|
|
363
|
+
def ask_gpt_with_files(question, file_paths):
|
|
364
|
+
"""
|
|
365
|
+
Constructs a detailed and flexible prompt for ChatGPT using a question and optionally including content from specified files.
|
|
366
|
+
"""
|
|
367
|
+
prompt = (
|
|
368
|
+
f"### Question:\n"
|
|
369
|
+
f"{question}\n\n"
|
|
370
|
+
"If I have included any files below, you can use them for additional context for this question. "
|
|
371
|
+
"Please analyze the provided files below (if available) as needed and reference them when forming your answer. "
|
|
372
|
+
"If the answer involves code, please format any code examples using Markdown with properly labeled language-specific code blocks. "
|
|
373
|
+
"Your response should be in Markdown format to preserve readability.\n\n"
|
|
374
|
+
)
|
|
375
|
+
|
|
376
|
+
if file_paths:
|
|
377
|
+
prompt += "### Files Provided:\n"
|
|
378
|
+
for path in file_paths:
|
|
379
|
+
try:
|
|
380
|
+
content = read_file(path)
|
|
381
|
+
prompt += (
|
|
382
|
+
f"## File: {path}\n"
|
|
383
|
+
f"The content of the file '{path}' is included below. Use this as context for answering the question:\n\n"
|
|
384
|
+
f"```\n{content}\n```\n\n"
|
|
385
|
+
)
|
|
386
|
+
except FileNotFoundError:
|
|
387
|
+
console.print(f"[bold yellow]Warning: {path} not found. Skipping this file.[/bold yellow]")
|
|
388
|
+
except Exception as e:
|
|
389
|
+
console.print(f"[bold red]Error reading {path}: {e}[/bold red]")
|
|
390
|
+
|
|
391
|
+
else:
|
|
392
|
+
prompt += (
|
|
393
|
+
"No specific files have been provided, so please base your response solely on the question above. "
|
|
394
|
+
"If the response includes any code examples or technical explanations, please use Markdown formatting with language-specific code blocks for clarity.\n"
|
|
395
|
+
)
|
|
396
|
+
|
|
397
|
+
# Output the constructed prompt to the console for transparency
|
|
398
|
+
console.rule("🐒 ScriptMonkey is Thinking 🐒")
|
|
399
|
+
console.rule()
|
|
400
|
+
|
|
401
|
+
# Use the OpenAI API to get a response
|
|
402
|
+
try:
|
|
403
|
+
response = chatgpt(prompt=prompt)
|
|
404
|
+
# Display the response using rich markdown and detect code blocks
|
|
405
|
+
console.rule("🐒 ScriptMonkey Response 🐒")
|
|
406
|
+
render_response_with_syntax_highlighting(response)
|
|
407
|
+
console.print("\n")
|
|
408
|
+
console.rule()
|
|
409
|
+
except Exception as e:
|
|
410
|
+
console.print(f"[bold red]Error using OpenAI API: {e}[/bold red]")
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
def render_response_with_syntax_highlighting(response):
|
|
414
|
+
"""
|
|
415
|
+
Render a ChatGPT response with syntax highlighting for detected code blocks.
|
|
416
|
+
"""
|
|
417
|
+
# Regular expression to detect code blocks with a specified language (e.g., ```python)
|
|
418
|
+
code_block_pattern = re.compile(r"```(\w+)?\n(.*?)```", re.DOTALL)
|
|
419
|
+
last_pos = 0
|
|
420
|
+
|
|
421
|
+
# Iterate over all detected code blocks
|
|
422
|
+
for match in code_block_pattern.finditer(response):
|
|
423
|
+
language = match.group(1) or "text" # Default to 'text' if no language is specified
|
|
424
|
+
code_content = match.group(2)
|
|
425
|
+
|
|
426
|
+
# Print any text before the code block as markdown
|
|
427
|
+
if match.start() > last_pos:
|
|
428
|
+
pre_text = response[last_pos : match.start()]
|
|
429
|
+
console.print(Markdown(pre_text))
|
|
430
|
+
|
|
431
|
+
# Print the code block with syntax highlighting
|
|
432
|
+
syntax = Syntax(code_content, language, theme="monokai", line_numbers=True)
|
|
433
|
+
console.print("\n")
|
|
434
|
+
console.print(syntax)
|
|
435
|
+
console.print("\n")
|
|
436
|
+
|
|
437
|
+
last_pos = match.end()
|
|
438
|
+
|
|
439
|
+
# Print any remaining text after the last code block
|
|
440
|
+
if last_pos < len(response):
|
|
441
|
+
console.print(Markdown(response[last_pos:]))
|
|
442
|
+
|
|
443
|
+
|
|
343
444
|
def main():
|
|
344
|
-
|
|
445
|
+
parser = argparse.ArgumentParser(description="ScriptMonkey - Generate Python projects and fix code.")
|
|
446
|
+
parser.add_argument("--ask", help="Ask a question to ChatGPT", type=str)
|
|
447
|
+
parser.add_argument("--files", nargs="*", help="Paths to files to include in the prompt", type=str)
|
|
448
|
+
parser.add_argument("--set-api-key", help="Set the OpenAI API key", action="store_true")
|
|
449
|
+
args = parser.parse_args()
|
|
450
|
+
print(f"\n- - 🐒 WELCOME TO SCRIPT MONKEY 🐒 - - -\n")
|
|
451
|
+
|
|
452
|
+
if args.set_api_key:
|
|
453
|
+
# Handle setting the API key
|
|
345
454
|
update_api_key()
|
|
455
|
+
return
|
|
456
|
+
|
|
457
|
+
if args.ask:
|
|
458
|
+
# Handle the --ask functionality
|
|
459
|
+
question = args.ask
|
|
460
|
+
file_paths = args.files if args.files else []
|
|
461
|
+
ask_gpt_with_files(question, file_paths)
|
|
346
462
|
else:
|
|
347
|
-
|
|
463
|
+
# Original ScriptMonkey functionality
|
|
348
464
|
print(f"Opening prompt editor... ")
|
|
349
465
|
time.sleep(2)
|
|
350
466
|
|
|
@@ -9,27 +9,29 @@ CONFIG_FILE = os.path.expanduser("~/.scriptmonkey_config")
|
|
|
9
9
|
# Load environment variables from the .env file if present
|
|
10
10
|
load_dotenv()
|
|
11
11
|
|
|
12
|
+
|
|
12
13
|
def get_openai_api_key():
|
|
13
14
|
# Try to get the API key from environment variables
|
|
14
15
|
api_key = os.getenv("OPENAI_API_KEY")
|
|
15
|
-
|
|
16
|
+
|
|
16
17
|
# If not set, check the config file
|
|
17
18
|
if not api_key and os.path.exists(CONFIG_FILE):
|
|
18
|
-
with open(CONFIG_FILE,
|
|
19
|
+
with open(CONFIG_FILE, "r") as f:
|
|
19
20
|
api_key = f.read().strip()
|
|
20
21
|
|
|
21
22
|
# If still not set, prompt the user for it
|
|
22
23
|
if not api_key:
|
|
23
24
|
print("It looks like your OpenAI API key isn't set.")
|
|
24
25
|
api_key = input("🐒 Please paste your OpenAI API key here and press ENTER: ").strip()
|
|
25
|
-
|
|
26
|
+
|
|
26
27
|
# Save the key to the config file for future use
|
|
27
|
-
with open(CONFIG_FILE,
|
|
28
|
+
with open(CONFIG_FILE, "w") as f:
|
|
28
29
|
f.write(api_key)
|
|
29
30
|
print(f"Your API key has been saved to {CONFIG_FILE} for future use.")
|
|
30
31
|
|
|
31
32
|
return api_key
|
|
32
33
|
|
|
34
|
+
|
|
33
35
|
# Get the OpenAI API key using the function
|
|
34
36
|
OPENAI_API_KEY = get_openai_api_key()
|
|
35
37
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: scriptmonkey
|
|
3
|
-
Version: 1.0
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: A Python package that generates complex Python 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
|
|
@@ -16,6 +16,7 @@ Requires-Dist: openai
|
|
|
16
16
|
Requires-Dist: pydantic
|
|
17
17
|
Requires-Dist: tqdm
|
|
18
18
|
Requires-Dist: python-dotenv
|
|
19
|
+
Requires-Dist: rich
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
# ScriptMonkey 🐒
|
|
@@ -29,6 +30,7 @@ ScriptMonkey is an AI-powered Python package that reimagines how projects are bu
|
|
|
29
30
|
- **AI-Powered Fixes**: Uses OpenAI's GPT API to understand and resolve errors.
|
|
30
31
|
- **Code Auto-Correction**: Automatically updates your Python files with the fixes.
|
|
31
32
|
- **Cross-IDE Compatibility**: Works with any IDE or code editor.
|
|
33
|
+
- **Context-Aware Q&A**: Ask questions directly to ChatGPT with or without providing files for context. Get detailed answers with code examples, explanations, and best practices tailored to your needs.
|
|
32
34
|
|
|
33
35
|
## 🚀 Watch the Demo
|
|
34
36
|
|
|
@@ -46,7 +48,7 @@ pip install scriptmonkey
|
|
|
46
48
|
|
|
47
49
|
## Usage
|
|
48
50
|
|
|
49
|
-
### Project Generation with `
|
|
51
|
+
### Project Generation with `scriptmonkey`
|
|
50
52
|
|
|
51
53
|
ScriptMonkey can generate a complete, custom-coded project structure based on a description you provide. This feature helps you quickly set up new projects with the necessary files and folders.
|
|
52
54
|
|
|
@@ -55,7 +57,7 @@ ScriptMonkey can generate a complete, custom-coded project structure based on a
|
|
|
55
57
|
1. Run the following command in your terminal:
|
|
56
58
|
|
|
57
59
|
```bash
|
|
58
|
-
|
|
60
|
+
scriptmonkey
|
|
59
61
|
```
|
|
60
62
|
|
|
61
63
|
2. A text editor will open (e.g., `nano`, `vim`, or `notepad` depending on your environment). Follow the on-screen instructions to provide a detailed description of your project.
|
|
@@ -80,6 +82,26 @@ I need a Flask-based web application for managing a book library. The applicatio
|
|
|
80
82
|
|
|
81
83
|
ScriptMonkey will use this description to create a project structure and code files for you in a directory named `generated_project`.
|
|
82
84
|
|
|
85
|
+
### Context-Aware Q&A with `scriptmonkey --ask`
|
|
86
|
+
|
|
87
|
+
ScriptMonkey can help answer your technical questions, whether or not you provide code files for context. This feature allows you to leverage the power of ChatGPT to ask questiona about files, clarify concepts, get code reviews, or understand best practices in various programming languages.
|
|
88
|
+
|
|
89
|
+
#### How to Use
|
|
90
|
+
|
|
91
|
+
- **Ask a question without files**:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
scriptmonkey --ask "What are the best practices for database indexing?"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
- **Ask a question with files**:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
scriptmonkey --ask "Can you help me optimize this function?" --files ./path/to/file1.py ./path/to/file2.js
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
ScriptMonkey will analyze your question and any provided files 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.
|
|
104
|
+
|
|
83
105
|
### Error Handling with `scriptmonkey.run()`
|
|
84
106
|
|
|
85
107
|
ScriptMonkey doesn't just build projects; it also makes debugging a breeze.
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name="scriptmonkey",
|
|
5
|
-
version="1.0
|
|
5
|
+
version="1.2.0",
|
|
6
6
|
description="A Python package that generates complex Python 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"],
|
|
14
|
+
install_requires=["openai", "pydantic", "tqdm", "python-dotenv", "rich"],
|
|
15
15
|
python_requires=">=3.6",
|
|
16
16
|
entry_points={
|
|
17
17
|
"console_scripts": [
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scriptmonkey-1.0.2 → scriptmonkey-1.2.0}/scriptmonkey/openai_client/prompts/project_description.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|