Spaces:
Build error
Build error
# FallnAI Autonomous Software Developer | |
# tasks.py | |
from crewai import Task | |
from textwrap import dedent | |
class SoftwareDevelopmentTasks: | |
def __init__(self, user_prompt): | |
self.user_prompt = user_prompt | |
def plan_software(self, agent): | |
return Task( | |
description=dedent(f""" | |
Plan the development of a software application based on the following request: | |
"{self.user_prompt}" | |
Break down the project into clear, executable steps for the other agents. | |
The final output should be a detailed development plan. | |
"""), | |
agent=agent | |
) | |
def write_code(self, agent): | |
return Task( | |
description=dedent(""" | |
Write the core Python code for the application based on the provided plan. | |
Ensure the code is functional, well-commented, and includes necessary imports. | |
The final output must be a single, complete Python script. | |
"""), | |
agent=agent | |
) | |
def write_ui(self, agent): | |
return Task( | |
description=dedent(""" | |
Create a simple but functional HTML/CSS user interface to interact with the Python script. | |
The UI should be a single HTML file with embedded CSS. | |
The final output must be the complete HTML file content. | |
"""), | |
agent=agent | |
) | |
def review_and_test(self, agent, code_content, ui_content): | |
return Task( | |
description=dedent(f""" | |
Review and test the generated Python code and UI. | |
Identify any bugs, errors, or security vulnerabilities. | |
If any issues are found, provide specific feedback for the Coder and UI agents to fix. | |
The final output should be a confirmation that the code is working or a list of required fixes. | |
Code to test: {code_content} | |
UI to test: {ui_content} | |
"""), | |
agent=agent | |
) | |
def write_documentation(self, agent): | |
return Task( | |
description=dedent(""" | |
Analyze the provided software code and the original user request. | |
Write a detailed README.md file that includes: | |
- A project title and a brief description. | |
- A "How to Use" section with clear instructions. | |
- An "Installation" section listing any required dependencies. | |
The final output should be the complete documentation content for a single file named README.md. | |
"""), | |
agent=agent | |
) | |
def push_to_github(self, agent, repo_name): | |
return Task( | |
description=dedent(f""" | |
Take the final, verified code and documentation and push it to a new GitHub repository. | |
The repository name should be '{repo_name}'. | |
The final output must be the URL of the repository. | |
"""), | |
agent=agent | |
) | |