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.3.1
to
1.3.3
+19
-5
PKG-INFO
Metadata-Version: 2.1
Name: scriptmonkey
Version: 1.3.1
Summary: A Python package that generates complex Python projects and fixes errors in your code using OpenAI's GPT API.
Version: 1.3.3
Summary: A Python package that generates complex software projects and fixes errors in your code using OpenAI's GPT API.
Home-page: https://github.com/lukerbs/ScriptMonkey

@@ -24,4 +24,6 @@ Author: Luke Kerbs

ScriptMonkey is an AI-powered Python package that reimagines how projects are built. It doesn’t just generate simple scripts or templates like traditional LLMs—it creates **entire, multi-file, multi-directory projects with fully custom code**. Complex Python projects can be generated in seconds based on your natural language descriptions, providing everything you need, from models and routes to templates and configuration files. With ScriptMonkey, you can instantly bootstrap new ideas or start complex projects without the tedious setup. And with built-in error detection and automatic fixes, ScriptMonkey keeps your development process smooth and stress-free, letting you focus on what matters most: building.
ScriptMonkey is an AI-powered CLI tool and Python library that reimagines how projects are built. It doesn’t just generate simple scripts or templates like traditional LLMs—it creates entire, multi-file, multi-directory projects with fully custom code. Complex software projects can be generated in seconds based on your natural language descriptions, providing everything you need, from models and routes to templates and configuration files. With ScriptMonkey, you can instantly bootstrap new ideas or start complex projects without the tedious setup. The tool is perfect for developers looking to quickly prototype, experiment, or build production-ready applications without having to write boilerplate code manually.
Importantly, ScriptMonkey is versatile and can be used to build any type of software project in any programming language. Whether you’re working with Python, JavaScript, Java, C++, or any other language, ScriptMonkey can generate project structures and provide tailored code. Additionally, its context-aware Q&A feature allows you to ask technical questions about projects in any language, with or without providing files for context. You can even use your default editor for longer, multi-line prompts, ensuring that ScriptMonkey can adapt to your specific needs.
## Features

@@ -92,4 +94,6 @@ - **Custom Project Generation**: Create entire Python projects, not just boilerplate code. ScriptMonkey generates the specific files and directories you need based on your description.

- **Ask a question**:
- **Pass a question directly**:
For quick, short prompts, you can directly pass your question using the `--ask` parameter:
```bash

@@ -99,2 +103,12 @@ scriptmonkey --ask "What are the best practices for database indexing?"

- **Use your default editor for longer prompts**:
If you need to provide a more detailed or multi-line prompt, simply use `--ask` without specifying a question. This will open up your default text editor (e.g., `vim`, `nano`, `notepad`) where you can write out your question or prompt:
```bash
scriptmonkey --ask
```
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.
- **Ask a question with files**:

@@ -116,3 +130,3 @@

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.
The `--tree` flag will include a tree representation of the current working directory 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. It can be used in tandem with the `--files` flag to provide additional context about how those files fit within the larger context of the project.

@@ -119,0 +133,0 @@ 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.

# ScriptMonkey šŸ’
ScriptMonkey is an AI-powered Python package that reimagines how projects are built. It doesn’t just generate simple scripts or templates like traditional LLMs—it creates **entire, multi-file, multi-directory projects with fully custom code**. Complex Python projects can be generated in seconds based on your natural language descriptions, providing everything you need, from models and routes to templates and configuration files. With ScriptMonkey, you can instantly bootstrap new ideas or start complex projects without the tedious setup. And with built-in error detection and automatic fixes, ScriptMonkey keeps your development process smooth and stress-free, letting you focus on what matters most: building.
ScriptMonkey is an AI-powered CLI tool and Python library that reimagines how projects are built. It doesn’t just generate simple scripts or templates like traditional LLMs—it creates entire, multi-file, multi-directory projects with fully custom code. Complex software projects can be generated in seconds based on your natural language descriptions, providing everything you need, from models and routes to templates and configuration files. With ScriptMonkey, you can instantly bootstrap new ideas or start complex projects without the tedious setup. The tool is perfect for developers looking to quickly prototype, experiment, or build production-ready applications without having to write boilerplate code manually.
Importantly, ScriptMonkey is versatile and can be used to build any type of software project in any programming language. Whether you’re working with Python, JavaScript, Java, C++, or any other language, ScriptMonkey can generate project structures and provide tailored code. Additionally, its context-aware Q&A feature allows you to ask technical questions about projects in any language, with or without providing files for context. You can even use your default editor for longer, multi-line prompts, ensuring that ScriptMonkey can adapt to your specific needs.
## Features

@@ -71,4 +73,6 @@ - **Custom Project Generation**: Create entire Python projects, not just boilerplate code. ScriptMonkey generates the specific files and directories you need based on your description.

- **Ask a question**:
- **Pass a question directly**:
For quick, short prompts, you can directly pass your question using the `--ask` parameter:
```bash

@@ -78,2 +82,12 @@ scriptmonkey --ask "What are the best practices for database indexing?"

- **Use your default editor for longer prompts**:
If you need to provide a more detailed or multi-line prompt, simply use `--ask` without specifying a question. This will open up your default text editor (e.g., `vim`, `nano`, `notepad`) where you can write out your question or prompt:
```bash
scriptmonkey --ask
```
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.
- **Ask a question with files**:

@@ -95,3 +109,3 @@

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.
The `--tree` flag will include a tree representation of the current working directory 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. It can be used in tandem with the `--files` flag to provide additional context about how those files fit within the larger context of the project.

@@ -98,0 +112,0 @@ 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.

Metadata-Version: 2.1
Name: scriptmonkey
Version: 1.3.1
Summary: A Python package that generates complex Python projects and fixes errors in your code using OpenAI's GPT API.
Version: 1.3.3
Summary: A Python package that generates complex software projects and fixes errors in your code using OpenAI's GPT API.
Home-page: https://github.com/lukerbs/ScriptMonkey

@@ -24,4 +24,6 @@ Author: Luke Kerbs

ScriptMonkey is an AI-powered Python package that reimagines how projects are built. It doesn’t just generate simple scripts or templates like traditional LLMs—it creates **entire, multi-file, multi-directory projects with fully custom code**. Complex Python projects can be generated in seconds based on your natural language descriptions, providing everything you need, from models and routes to templates and configuration files. With ScriptMonkey, you can instantly bootstrap new ideas or start complex projects without the tedious setup. And with built-in error detection and automatic fixes, ScriptMonkey keeps your development process smooth and stress-free, letting you focus on what matters most: building.
ScriptMonkey is an AI-powered CLI tool and Python library that reimagines how projects are built. It doesn’t just generate simple scripts or templates like traditional LLMs—it creates entire, multi-file, multi-directory projects with fully custom code. Complex software projects can be generated in seconds based on your natural language descriptions, providing everything you need, from models and routes to templates and configuration files. With ScriptMonkey, you can instantly bootstrap new ideas or start complex projects without the tedious setup. The tool is perfect for developers looking to quickly prototype, experiment, or build production-ready applications without having to write boilerplate code manually.
Importantly, ScriptMonkey is versatile and can be used to build any type of software project in any programming language. Whether you’re working with Python, JavaScript, Java, C++, or any other language, ScriptMonkey can generate project structures and provide tailored code. Additionally, its context-aware Q&A feature allows you to ask technical questions about projects in any language, with or without providing files for context. You can even use your default editor for longer, multi-line prompts, ensuring that ScriptMonkey can adapt to your specific needs.
## Features

@@ -92,4 +94,6 @@ - **Custom Project Generation**: Create entire Python projects, not just boilerplate code. ScriptMonkey generates the specific files and directories you need based on your description.

- **Ask a question**:
- **Pass a question directly**:
For quick, short prompts, you can directly pass your question using the `--ask` parameter:
```bash

@@ -99,2 +103,12 @@ scriptmonkey --ask "What are the best practices for database indexing?"

- **Use your default editor for longer prompts**:
If you need to provide a more detailed or multi-line prompt, simply use `--ask` without specifying a question. This will open up your default text editor (e.g., `vim`, `nano`, `notepad`) where you can write out your question or prompt:
```bash
scriptmonkey --ask
```
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.
- **Ask a question with files**:

@@ -116,3 +130,3 @@

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.
The `--tree` flag will include a tree representation of the current working directory 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. It can be used in tandem with the `--files` flag to provide additional context about how those files fit within the larger context of the project.

@@ -119,0 +133,0 @@ 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.

import sys
import traceback
from collections import defaultdict
import argparse

@@ -13,3 +14,3 @@ from .openai_client import (

from .openai_client.prompting import load_prompt
from .file_handler import read_file, write_file
from .file_handler import read_file, write_file, ignored_dirs, important_extensions
import platform

@@ -148,3 +149,3 @@ import tempfile

def get_multiline_input_with_editor() -> str:
def get_multiline_input_with_editor(mode: str) -> str:
"""

@@ -154,3 +155,13 @@ Opens the user's default text editor for entering multi-line input.

adjusted based on the detected editor.
:mode: enums['BUILD', 'ASK']
"""
if mode == "BUILD":
purpose = "Project Builder"
user_prompt = "Please describe your project in detail below."
elif mode == "ASK":
purpose = "Prompt Editor"
user_prompt = "Please write your question down below."
with tempfile.NamedTemporaryFile(suffix=".txt") as temp_file:

@@ -170,4 +181,4 @@ # Detect the editor from the environment or default based on the OS

instructions = (
"!# šŸ’ Welcome to ScriptMonkey's project generator!\n"
"!# Please describe your project in detail below.\n"
f"!# šŸ’ Welcome to ScriptMonkey's {purpose}!\n"
f"!# {user_prompt}\n"
"!# Use 'i' to start editing, and when you're done, press 'Esc',\n"

@@ -179,4 +190,4 @@ "!# type ':wq' to save and exit.\n"

instructions = (
"!# šŸ’ Welcome to ScriptMonkey's project generator!\n"
"!# Please describe your project in detail below.\n"
f"!# šŸ’ Welcome to ScriptMonkey's {purpose}!\n"
f"!# {user_prompt}\n"
"!# When you're done, press 'Ctrl+O' to save and 'Ctrl+X' to exit.\n"

@@ -187,4 +198,4 @@ "!# (Lines starting with '!#' will be ignored.)\n\n"

instructions = (
"!# šŸ’ Welcome to ScriptMonkey's project generator!\n"
"!# Please describe your project in detail below.\n"
f"!# šŸ’ Welcome to ScriptMonkey's {purpose}!\n"
f"!# {user_prompt}\n"
"!# When you're done, save and close the Notepad window.\n"

@@ -195,4 +206,4 @@ "!# (Lines starting with '!#' will be ignored.)\n\n"

instructions = (
"!# šŸ’ Welcome to ScriptMonkey's project generator!\n"
"!# Please describe your project in detail below.\n"
f"!# šŸ’ Welcome to ScriptMonkey's {purpose}!\n"
f"!# {user_prompt}\n"
"!# When you're done, save the file and close the editor window.\n"

@@ -203,4 +214,4 @@ "!# (Lines starting with '!#' will be ignored.)\n\n"

instructions = (
"!# šŸ’ Welcome to ScriptMonkey's project generator!\n"
"!# Please describe your project in detail below.\n"
f"!# šŸ’ Welcome to ScriptMonkey's {purpose}!\n"
f"!# {user_prompt}\n"
"!# Save and close the editor when you're done.\n"

@@ -371,7 +382,9 @@ "!# (Lines starting with '!#' will be ignored.)\n\n"

def generate_directory_tree(start_path, prefix="", max_depth=6, current_depth=0, max_files=10):
def generate_directory_tree(start_path, prefix="", max_depth=None, current_depth=0, max_files_per_type=5):
"""
Generates a directory tree as a string with options to limit depth, ignore directories, and cap the number of files.
Generates a directory tree as a string with options to limit files of the same type,
ignore directories, and handle critical code files.
"""
if current_depth > max_depth:
# If max_depth is defined and the current depth exceeds it, stop recursion
if max_depth is not None and current_depth > max_depth:
return ""

@@ -381,47 +394,33 @@

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)")
# Group files by their extensions
files_by_extension = defaultdict(list)
for name in files:
if os.path.isdir(os.path.join(start_path, name)):
files_by_extension["<dir>"].append(name)
else:
_, ext = os.path.splitext(name)
files_by_extension[ext].append(name)
for index, name in enumerate(files):
# Build a list of files to display
display_files = []
# Add directories first
display_files.extend(sorted(files_by_extension["<dir>"]))
# Add files, limiting non-important file types
for ext, ext_files in files_by_extension.items():
if ext == "<dir>":
continue
if ext in important_extensions:
# Include all files of important types
display_files.extend(sorted(ext_files))
else:
# Limit the number of files to `max_files_per_type` for non-important types
display_files.extend(sorted(ext_files)[:max_files_per_type])
if len(ext_files) > max_files_per_type:
display_files.append(f"... ({len(ext_files) - max_files_per_type} more {ext} files omitted)")
# Iterate over the files and directories to build the tree
for index, name in enumerate(display_files):
path = os.path.join(start_path, name)

@@ -433,10 +432,15 @@

connector = "└── " if index == len(files) - 1 else "ā”œā”€ā”€ "
connector = "└── " if index == len(display_files) - 1 else "ā”œā”€ā”€ "
tree += prefix + connector + name + "\n"
if os.path.isdir(path):
new_prefix = prefix + (" " if index == len(files) - 1 else "│ ")
new_prefix = prefix + (" " if index == len(display_files) - 1 else "│ ")
tree += generate_directory_tree(
path, new_prefix, max_depth=max_depth, current_depth=current_depth + 1, max_files=max_files
path,
new_prefix,
max_depth=max_depth,
current_depth=current_depth + 1,
max_files_per_type=max_files_per_type,
)
return tree

@@ -485,2 +489,3 @@

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("- - Directory Tree - -")
console.print(tree)

@@ -496,3 +501,3 @@

# Display the response using rich markdown and detect code blocks
console.rule("šŸ’ ScriptMonkey Response šŸ’")
console.rule("šŸ’ ANSWER šŸ’")
render_response_with_syntax_highlighting(response)

@@ -524,3 +529,3 @@ console.print("\n")

# Print the code block with syntax highlighting
syntax = Syntax(f"\n{code_content}", language, theme="monokai", line_numbers=True)
syntax = Syntax(f"\n{code_content}", language, theme="monokai", line_numbers=False)
console.print("\n")

@@ -537,5 +542,10 @@ console.print(syntax)

def handle_no_prompt():
print(f"\nNo Prompt Provided (Tip: Did you save before closing the editor?).\nšŸ’ Quitting ScriptMonkey...\n")
exit()
def main():
parser = argparse.ArgumentParser(description="ScriptMonkey - Generate Python projects and fix code.")
parser.add_argument("--ask", help="Ask a question to ChatGPT", type=str)
parser.add_argument("--ask", nargs="?", const=True, help="Ask a question to ChatGPT", type=str)
parser.add_argument("--files", nargs="*", help="Paths to files to include in the prompt", type=str)

@@ -545,2 +555,3 @@ parser.add_argument("--tree", help="Include a directory tree in the prompt", action="store_true")

args = parser.parse_args()
print(f"\n- - šŸ’ WELCOME TO SCRIPT MONKEY šŸ’ - - -\n")

@@ -553,10 +564,18 @@

if args.ask:
if args.ask is not None:
# Handle the --ask functionality
question = args.ask
# Check if the --ask flag was used without a direct question (e.g., `--ask` alone)
if args.ask is True:
question = get_multiline_input_with_editor(mode="ASK")
if not question:
handle_no_prompt()
else:
question = args.ask
file_paths = args.files if args.files else []
include_tree = args.tree
ask_gpt_with_files(question, file_paths, include_tree)
return
else:
# Original ScriptMonkey functionality
# Handle the build project functionality
print(f"Opening prompt editor... ")

@@ -566,8 +585,6 @@ time.sleep(2)

# Step 1: Get multi-line project description from user
project_description = get_multiline_input_with_editor()
project_description = get_multiline_input_with_editor(mode="BUILD")
if not project_description:
print(
f"\nNo Project Description Provided (Tip: Did you save before closing the editor?).\nšŸ’ Quitting ScriptMonkey..."
)
exit()
handle_no_prompt()
print(f"Project Description: {project_description}")

@@ -591,1 +608,2 @@

print(f"šŸ’ ScriptMonkey wrote a README.md file at: '{readme_path}'")
return

@@ -23,1 +23,76 @@ def read_file(path: str) -> str:

file.write(content)
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",
}
# Define important file extensions
important_extensions = {
# General programming and scripting languages
".py",
".js",
".ts",
".tsx",
".jsx",
".java",
".cpp",
".c",
".h",
".hpp",
".go",
".rb",
".rs",
".php",
".sh",
".pl",
".swift",
".kt",
".kts",
".dart",
".scala",
".lua",
".r",
".jl",
".cs",
".csx",
".m",
".mm",
".bat",
".cmd",
}

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

name="scriptmonkey",
version="1.3.1",
description="A Python package that generates complex Python projects and fixes errors in your code using OpenAI's GPT API.",
version="1.3.3",
description="A Python package that generates complex software projects and fixes errors in your code using OpenAI's GPT API.",
long_description=open("README.md", "r").read(),

@@ -9,0 +9,0 @@ long_description_content_type="text/markdown",