Spaces:
Runtime error
Runtime error
levisstrauss commited on
Commit Β·
f8b002a
1
Parent(s): f299f7c
Fix rendering issues
Browse files
app.py
CHANGED
|
@@ -812,7 +812,13 @@ class ProjectPlannerWorkflow:
|
|
| 812 |
|
| 813 |
features_prompt = f"Based on these user stories, define the key product features:\n\n{user_stories}"
|
| 814 |
features = self._program_manager_handler(features_prompt)
|
| 815 |
-
self.stats["features"] =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 816 |
self.log(f"Defined {self.stats['features']} product features", "success")
|
| 817 |
|
| 818 |
yield ("β
Features complete", user_stories, features, "", "")
|
|
@@ -835,52 +841,95 @@ class ProjectPlannerWorkflow:
|
|
| 835 |
self.log("Project plan compilation complete!", "success")
|
| 836 |
|
| 837 |
yield ("β
Project plan ready!", user_stories, features, tasks, full_plan)
|
| 838 |
-
|
| 839 |
def _compile_full_plan(self, user_stories: str, features: str, tasks: str) -> str:
|
| 840 |
"""Compile all outputs into a formatted project plan."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 841 |
plan = f"""# π Project Plan
|
| 842 |
|
| 843 |
-
|
| 844 |
-
|
| 845 |
-
|
| 846 |
-
|
| 847 |
-
|
| 848 |
-
|
| 849 |
-
|
| 850 |
-
|
| 851 |
-
|
| 852 |
-
|
| 853 |
-
|
| 854 |
-
|
| 855 |
-
|
| 856 |
-
|
| 857 |
-
|
| 858 |
-
|
| 859 |
-
|
| 860 |
-
|
| 861 |
-
|
| 862 |
-
|
| 863 |
-
|
| 864 |
-
|
| 865 |
-
|
| 866 |
-
|
| 867 |
-
|
| 868 |
-
|
| 869 |
-
|
| 870 |
-
|
| 871 |
-
|
| 872 |
-
|
| 873 |
-
|
| 874 |
-
|
| 875 |
-
|
| 876 |
-
|
| 877 |
-
|
| 878 |
-
|
| 879 |
-
|
| 880 |
-
|
|
|
|
|
|
|
| 881 |
for log_entry in self.workflow_log:
|
| 882 |
-
|
| 883 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 884 |
return plan
|
| 885 |
|
| 886 |
|
|
|
|
| 812 |
|
| 813 |
features_prompt = f"Based on these user stories, define the key product features:\n\n{user_stories}"
|
| 814 |
features = self._program_manager_handler(features_prompt)
|
| 815 |
+
self.stats["features"] = max(
|
| 816 |
+
features.lower().count("feature name"),
|
| 817 |
+
features.count("##"),
|
| 818 |
+
features.count("**") // 2,
|
| 819 |
+
len([line for line in features.split('\n') if
|
| 820 |
+
line.strip().startswith(('1.', '2.', '3.', '4.', '5.', '6.', '7.', '8.', '9.'))])
|
| 821 |
+
)
|
| 822 |
self.log(f"Defined {self.stats['features']} product features", "success")
|
| 823 |
|
| 824 |
yield ("β
Features complete", user_stories, features, "", "")
|
|
|
|
| 841 |
self.log("Project plan compilation complete!", "success")
|
| 842 |
|
| 843 |
yield ("β
Project plan ready!", user_stories, features, tasks, full_plan)
|
| 844 |
+
|
| 845 |
def _compile_full_plan(self, user_stories: str, features: str, tasks: str) -> str:
|
| 846 |
"""Compile all outputs into a formatted project plan."""
|
| 847 |
+
|
| 848 |
+
# Recalculate stats with better detection
|
| 849 |
+
self.stats["user_stories"] = max(
|
| 850 |
+
user_stories.lower().count("as a"),
|
| 851 |
+
len([line for line in user_stories.split('\n') if line.strip().startswith(('1.', '2.', '3.', '4.', '5.'))])
|
| 852 |
+
)
|
| 853 |
+
|
| 854 |
+
self.stats["features"] = max(
|
| 855 |
+
features.lower().count("feature name"),
|
| 856 |
+
features.lower().count("feature:"),
|
| 857 |
+
len([line for line in features.split('\n') if
|
| 858 |
+
line.strip() and line.strip()[0].isdigit() and '.' in line[:3]]),
|
| 859 |
+
features.count("**") // 2 if "**" in features else 0
|
| 860 |
+
)
|
| 861 |
+
|
| 862 |
+
self.stats["tasks"] = max(
|
| 863 |
+
tasks.lower().count("task id"),
|
| 864 |
+
tasks.lower().count("task title"),
|
| 865 |
+
len([line for line in tasks.split('\n') if "task id" in line.lower()])
|
| 866 |
+
)
|
| 867 |
+
|
| 868 |
+
# Build the plan document
|
| 869 |
plan = f"""# π Project Plan
|
| 870 |
|
| 871 |
+
**Generated:** {datetime.now().strftime("%Y-%m-%d %H:%M")}
|
| 872 |
+
|
| 873 |
+
---
|
| 874 |
+
|
| 875 |
+
## π Summary Statistics
|
| 876 |
+
|
| 877 |
+
| Metric | Count |
|
| 878 |
+
|--------|-------|
|
| 879 |
+
| User Stories | {self.stats['user_stories']} |
|
| 880 |
+
| Product Features | {self.stats['features']} |
|
| 881 |
+
| Engineering Tasks | {self.stats['tasks']} |
|
| 882 |
+
| Evaluation Iterations | {self.stats['iterations']} |
|
| 883 |
+
|
| 884 |
+
---
|
| 885 |
+
|
| 886 |
+
## π€ User Stories
|
| 887 |
+
|
| 888 |
+
{user_stories}
|
| 889 |
+
|
| 890 |
+
---
|
| 891 |
+
|
| 892 |
+
## π¦ Product Features
|
| 893 |
+
|
| 894 |
+
{features}
|
| 895 |
+
|
| 896 |
+
---
|
| 897 |
+
|
| 898 |
+
## π§ Engineering Tasks
|
| 899 |
+
|
| 900 |
+
{tasks}
|
| 901 |
+
|
| 902 |
+
---
|
| 903 |
+
|
| 904 |
+
## π Workflow Log
|
| 905 |
+
|
| 906 |
+
| Time | Level | Message |
|
| 907 |
+
|------|-------|---------|
|
| 908 |
+
"""
|
| 909 |
+
|
| 910 |
+
# Add each log entry as a proper table row
|
| 911 |
for log_entry in self.workflow_log:
|
| 912 |
+
# Escape pipe characters in message to prevent table breaking
|
| 913 |
+
message = log_entry['message'].replace('|', '\\|')
|
| 914 |
+
plan += f"| {log_entry['timestamp']} | {log_entry['level']} | {message} |\n"
|
| 915 |
+
|
| 916 |
+
# Add footer
|
| 917 |
+
plan += """
|
| 918 |
+
---
|
| 919 |
+
|
| 920 |
+
## β
Next Steps
|
| 921 |
+
|
| 922 |
+
1. Review and prioritize the user stories with stakeholders
|
| 923 |
+
2. Validate feature groupings with the product team
|
| 924 |
+
3. Estimate engineering tasks with the development team
|
| 925 |
+
4. Create sprint plan based on dependencies
|
| 926 |
+
5. Set up project tracking in your preferred tool (Jira, Linear, etc.)
|
| 927 |
+
|
| 928 |
+
---
|
| 929 |
+
|
| 930 |
+
*Generated by AI Project Planner | Powered by GPT-3.5*
|
| 931 |
+
"""
|
| 932 |
+
|
| 933 |
return plan
|
| 934 |
|
| 935 |
|