Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

scriptmonkey

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scriptmonkey - pypi Package Compare versions

Comparing version
1.2.1
to
1.3.1
+18
-6
PKG-INFO
Metadata-Version: 2.1
Name: scriptmonkey
Version: 1.2.1
Version: 1.3.1
Summary: A Python package that generates complex Python projects and fixes errors in your code using OpenAI's GPT API.

@@ -51,3 +51,3 @@ Home-page: https://github.com/lukerbs/ScriptMonkey

### Project Generation with `scriptmonkey`
### Project Generation with `scriptmonkey` CLI Tool

@@ -86,9 +86,9 @@ 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.

### Context-Aware Q&A with `scriptmonkey --ask`
### Context-Aware Q&A with `scriptmonkey --ask` CLI Tool
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.
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 questions about files, clarify concepts, get code reviews, or understand best practices in various programming languages.
#### How to Use
- **Ask a question without files**:
- **Ask a question**:

@@ -105,4 +105,16 @@ ```bash

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.
The `--files` flag allows you to provide specific files as context for your question. ScriptMonkey will include the contents of these files in its analysis, allowing it to reference the actual code or data you are working with. This is particularly useful for getting detailed feedback on specific code snippets, debugging issues, or seeking advice on how to improve certain parts of your project.
When you use `--files`, ScriptMonkey will read the contents of each provided file, include them in the prompt, and tailor its response based on the combined context of your question and the file contents. This feature ensures that you get precise, context-aware answers, helping you solve code challenges or understand complex concepts more effectively.
- **Ask a question with a directory tree**:
```bash
scriptmonkey --ask "How do I organize this project better?" --tree
```
The `--tree` flag will include a tree representation of the current working directory (up to 6 levels deep, excluding common large folders) in the context for your question. This is particularly useful when you want to get feedback on the structure of your codebase or when your question relates to the project organization.
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.
### Error Handling with `scriptmonkey.run()`

@@ -109,0 +121,0 @@

@@ -31,3 +31,3 @@

### Project Generation with `scriptmonkey`
### Project Generation with `scriptmonkey` CLI Tool

@@ -66,9 +66,9 @@ 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.

### Context-Aware Q&A with `scriptmonkey --ask`
### Context-Aware Q&A with `scriptmonkey --ask` CLI Tool
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.
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 questions about files, clarify concepts, get code reviews, or understand best practices in various programming languages.
#### How to Use
- **Ask a question without files**:
- **Ask a question**:

@@ -85,4 +85,16 @@ ```bash

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.
The `--files` flag allows you to provide specific files as context for your question. ScriptMonkey will include the contents of these files in its analysis, allowing it to reference the actual code or data you are working with. This is particularly useful for getting detailed feedback on specific code snippets, debugging issues, or seeking advice on how to improve certain parts of your project.
When you use `--files`, ScriptMonkey will read the contents of each provided file, include them in the prompt, and tailor its response based on the combined context of your question and the file contents. This feature ensures that you get precise, context-aware answers, helping you solve code challenges or understand complex concepts more effectively.
- **Ask a question with a directory tree**:
```bash
scriptmonkey --ask "How do I organize this project better?" --tree
```
The `--tree` flag will include a tree representation of the current working directory (up to 6 levels deep, excluding common large folders) in the context for your question. This is particularly useful when you want to get feedback on the structure of your codebase or when your question relates to the project organization.
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.
### Error Handling with `scriptmonkey.run()`

@@ -89,0 +101,0 @@

Metadata-Version: 2.1
Name: scriptmonkey
Version: 1.2.1
Version: 1.3.1
Summary: A Python package that generates complex Python projects and fixes errors in your code using OpenAI's GPT API.

@@ -51,3 +51,3 @@ Home-page: https://github.com/lukerbs/ScriptMonkey

### Project Generation with `scriptmonkey`
### Project Generation with `scriptmonkey` CLI Tool

@@ -86,9 +86,9 @@ 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.

### Context-Aware Q&A with `scriptmonkey --ask`
### Context-Aware Q&A with `scriptmonkey --ask` CLI Tool
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.
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 questions about files, clarify concepts, get code reviews, or understand best practices in various programming languages.
#### How to Use
- **Ask a question without files**:
- **Ask a question**:

@@ -105,4 +105,16 @@ ```bash

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.
The `--files` flag allows you to provide specific files as context for your question. ScriptMonkey will include the contents of these files in its analysis, allowing it to reference the actual code or data you are working with. This is particularly useful for getting detailed feedback on specific code snippets, debugging issues, or seeking advice on how to improve certain parts of your project.
When you use `--files`, ScriptMonkey will read the contents of each provided file, include them in the prompt, and tailor its response based on the combined context of your question and the file contents. This feature ensures that you get precise, context-aware answers, helping you solve code challenges or understand complex concepts more effectively.
- **Ask a question with a directory tree**:
```bash
scriptmonkey --ask "How do I organize this project better?" --tree
```
The `--tree` flag will include a tree representation of the current working directory (up to 6 levels deep, excluding common large folders) in the context for your question. This is particularly useful when you want to get feedback on the structure of your codebase or when your question relates to the project organization.
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.
### Error Handling with `scriptmonkey.run()`

@@ -109,0 +121,0 @@

@@ -363,4 +363,75 @@ import sys

def ask_gpt_with_files(question, file_paths):
def generate_directory_tree(start_path, prefix="", max_depth=6, current_depth=0, max_files=10):
"""
Generates a directory tree as a string with options to limit depth, ignore directories, and cap the number of files.
"""
if current_depth > max_depth:
return ""
tree = ""
files = sorted(os.listdir(start_path))
ignored_dirs = {
"venv",
".venv",
"dist",
"build",
"__pycache__",
"node_modules",
".next",
"out",
".nuxt",
"public",
"jspm_packages",
".parcel-cache",
".vercel",
"target",
".gradle",
".mvn",
"bin",
"obj",
"coverage",
"vendor",
"storage",
"cache",
".git",
".idea",
".vscode",
".DS_Store",
"logs",
"log",
"tmp",
"temp",
".angular",
".bundle",
"vendor/bundle",
"htmlcov",
".mypy_cache",
".pytest_cache",
}
# Limit the number of files displayed
if len(files) > max_files:
files = files[:max_files]
files.append("... (more files omitted)")
for index, name in enumerate(files):
path = os.path.join(start_path, name)
# Skip ignored directories
if os.path.isdir(path) and name in ignored_dirs:
continue
connector = "└── " if index == len(files) - 1 else "├── "
tree += prefix + connector + name + "\n"
if os.path.isdir(path):
new_prefix = prefix + (" " if index == len(files) - 1 else "│ ")
tree += generate_directory_tree(
path, new_prefix, max_depth=max_depth, current_depth=current_depth + 1, max_files=max_files
)
return tree
def ask_gpt_with_files(question, file_paths, include_tree=False):
"""
Constructs a detailed and flexible prompt for ChatGPT using a question and optionally including content from specified files.

@@ -398,2 +469,10 @@ """

# Include the directory tree if the flag is set
if include_tree:
start_directory = os.getcwd()
tree = generate_directory_tree(start_directory)
prompt += "### Directory Tree:\n"
prompt += f"The directory tree of the current working directory is included below (up to a depth of 6 levels):\n\n```\n{tree}\n```\n\n"
console.print(tree)
# Output the constructed prompt to the console for transparency

@@ -450,2 +529,3 @@ console.rule("🐒 ScriptMonkey is Thinking 🐒")

parser.add_argument("--files", nargs="*", help="Paths to files to include in the prompt", type=str)
parser.add_argument("--tree", help="Include a directory tree in the prompt", action="store_true")
parser.add_argument("--set-api-key", help="Set the OpenAI API key", action="store_true")

@@ -464,3 +544,4 @@ args = parser.parse_args()

file_paths = args.files if args.files else []
ask_gpt_with_files(question, file_paths)
include_tree = args.tree
ask_gpt_with_files(question, file_paths, include_tree)
else:

@@ -467,0 +548,0 @@ # Original ScriptMonkey functionality

@@ -5,3 +5,3 @@ from setuptools import setup, find_packages

name="scriptmonkey",
version="1.2.1",
version="1.3.1",
description="A Python package that generates complex Python projects and fixes errors in your code using OpenAI's GPT API.",

@@ -8,0 +8,0 @@ long_description=open("README.md", "r").read(),