From 1224cbc434fb48c5465acaa928139711676fa1bd Mon Sep 17 00:00:00 2001 From: matija-ilijas Date: Tue, 19 Nov 2024 11:57:23 +0100 Subject: [PATCH 1/2] Disable all templates except Node-Mongoose-Express --- core/templates/registry.py | 6 +++--- tests/templates/test_templates.py | 22 ---------------------- 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/core/templates/registry.py b/core/templates/registry.py index a07a25a39d..a8ae330f3a 100644 --- a/core/templates/registry.py +++ b/core/templates/registry.py @@ -2,7 +2,7 @@ from enum import Enum from core.log import get_logger -from .javascript_react import JavascriptReactProjectTemplate +# from .javascript_react import JavascriptReactProjectTemplate from .node_express_mongoose import NodeExpressMongooseProjectTemplate # from .react_express import ReactExpressProjectTemplate @@ -13,13 +13,13 @@ log = get_logger(__name__) class ProjectTemplateEnum(str, Enum): """Choices of available project templates.""" - JAVASCRIPT_REACT = JavascriptReactProjectTemplate.name + # JAVASCRIPT_REACT = JavascriptReactProjectTemplate.name NODE_EXPRESS_MONGOOSE = NodeExpressMongooseProjectTemplate.name # REACT_EXPRESS = ReactExpressProjectTemplate.name PROJECT_TEMPLATES = { - JavascriptReactProjectTemplate.name: JavascriptReactProjectTemplate, + # JavascriptReactProjectTemplate.name: JavascriptReactProjectTemplate, NodeExpressMongooseProjectTemplate.name: NodeExpressMongooseProjectTemplate, # ReactExpressProjectTemplate.name: ReactExpressProjectTemplate, } diff --git a/tests/templates/test_templates.py b/tests/templates/test_templates.py index 04ff53ec39..0cfa688d96 100644 --- a/tests/templates/test_templates.py +++ b/tests/templates/test_templates.py @@ -57,28 +57,6 @@ async def test_render_react_express_nosql(mock_get_config, testmanager): assert "prisma/schema.prisma" not in files -@pytest.mark.asyncio -@patch("core.state.state_manager.get_config") -async def test_render_javascript_react(mock_get_config, testmanager): - mock_get_config.return_value.fs.type = "memory" - sm = StateManager(testmanager) - pm = MagicMock(run_command=AsyncMock()) - - await sm.create_project("TestProjectName") - await sm.commit() - - TemplateClass = PROJECT_TEMPLATES["javascript_react"] - template = TemplateClass(TemplateClass.options_class(), sm, pm) - - assert template.options_dict == {} - - await template.apply() - - files = sm.file_system.list() - for f in ["src/App.jsx", "vite.config.js"]: - assert f in files - - @pytest.mark.asyncio @patch("core.state.state_manager.get_config") async def test_render_node_express_mongoose(mock_get_config, testmanager): From 272b6df9b3a1dfe6d32485554d84b1b06dcab640 Mon Sep 17 00:00:00 2001 From: matija-ilijas Date: Tue, 19 Nov 2024 12:09:34 +0100 Subject: [PATCH 2/2] Fixed bug with template apply when using git --- core/agents/tech_lead.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/agents/tech_lead.py b/core/agents/tech_lead.py index e7f5228a43..449399e812 100644 --- a/core/agents/tech_lead.py +++ b/core/agents/tech_lead.py @@ -48,7 +48,7 @@ class TechLead(BaseAgent): await self.ui.send_project_stage(ProjectStage.CODING) - if self.current_state.specification.templates and not self.current_state.files: + if self.current_state.specification.templates and len(self.current_state.files) < 2: await self.apply_project_templates() self.next_state.action = "Apply project templates" await self.ui.send_epics_and_tasks(