Skip to content

Commit

Permalink
#2: storing requirements
Browse files Browse the repository at this point in the history
to make it easier to debug, as well as to alter the requirements manually before feeding them back in
  • Loading branch information
tolitius committed Apr 11, 2024
1 parent e5b61d5 commit 25ae852
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,5 @@ cython_debug/
#.idea/

prototype/
requirements/
.DS_Store
22 changes: 20 additions & 2 deletions jemma/team/project_manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from jemma.tools import say, color, open_local_browser
import os
from jemma.tools import say, color, open_local_browser, name_to_file_name
from jemma.requirements.feature import Feature, UserStory

class ProjectManager:
Expand All @@ -7,6 +8,20 @@ def __init__(self, feature, project_name="project", role = "Project Manager"):
self.role = role
self.project_name = project_name

def record_requirement(self,
name,
requirement,
path):
# create the directory if it doesn't exist
os.makedirs(path, exist_ok=True)

requirement_path = os.path.join(path,
name_to_file_name(name))
with open(requirement_path, "w") as requirement_file:
requirement_file.write(requirement)

print(f"storing requirements for \"{name}\" in \"{requirement_path}\"")

def meet_to_create_user_stories(self,
thinker,
business_owner):
Expand Down Expand Up @@ -142,9 +157,12 @@ def user_stories_to_requirement(self):
def meet_to_create_requirements(self,
thinker,
business_owner,
idea):
idea,
store_path="requirements"):
say(self.role, "\nDear Business Owner, in this meeting we'll work on creating requirements based on the 💡 idea",
who_color = color.CYAN, message_color = color.YELLOW)

requirements = business_owner.idea_to_prompt(thinker, idea)
self.record_requirement(idea, requirements, store_path)

self.feature = Feature(requirements)
9 changes: 9 additions & 0 deletions jemma/tools.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import webbrowser
import os, argparse, sys, re

from datetime import datetime

class color:
PURPLE = '\033[95m'
CYAN = '\033[96m'
Expand Down Expand Up @@ -28,6 +30,13 @@ def read_file(path):
data = file.read()
return data

def name_to_file_name(name, extension="txt"):

clean_name = re.sub(r'[^a-zA-Z0-9\s-]', '', name).replace(' ', '-').lower()

timestamp = datetime.now().strftime("%Y-%m-%d.%H-%M-%S-%f")[:-3]
return f"{clean_name}.{timestamp}.{extension}"

def open_local_browser(dir_path):
current_dir = os.getcwd()
try:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='jemma',
version='0.1.42',
version='0.1.4200',
description='convert ideas into code',
author='tolitius',
packages=find_packages(),
Expand Down

0 comments on commit 25ae852

Please sign in to comment.