From a2e8aa399f3ddae8a55ac9ccaf5cedc52f57cf72 Mon Sep 17 00:00:00 2001 From: Max Sveshnikov Date: Sat, 7 Sep 2024 10:45:29 +0200 Subject: [PATCH] Minor --- ProjectManagerAgent.js | 10 +++++++++- README.md | 1 + TesterAgent.js | 11 +++++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ProjectManagerAgent.js b/ProjectManagerAgent.js index c64daad..b3600bb 100644 --- a/ProjectManagerAgent.js +++ b/ProjectManagerAgent.js @@ -14,10 +14,18 @@ const ProjectManagerAgent = { async run(projectStructure, readme) { console.log(chalk.cyan("🚀 Project Manager Agent starting...")); - await this.orchestrateAgents(projectStructure, readme); await this.buildApp(); await this.runTests(); await this.performUIChecks(); + await this.checkDependencies(); + await this.optimizeAssets(); + await this.monitorPerformance(); + await this.generateDockerfile(); + await this.setupCICD(); + await this.generateChangeLog(); + await this.setupEnvironmentConfig(); + await this.generateBuildScript(); + await this.orchestrateAgents(projectStructure, readme); console.log(chalk.green("✅ Project Manager Agent completed its tasks.")); }, diff --git a/README.md b/README.md index 69b5cfe..c632ef5 100644 --- a/README.md +++ b/README.md @@ -86,3 +86,4 @@ AutoCode currently supports the following programming languages: - Swift Each language has its own configuration for file extensions, recommended linter, formatter, and package manager. + diff --git a/TesterAgent.js b/TesterAgent.js index da2d4d2..7a88e6c 100644 --- a/TesterAgent.js +++ b/TesterAgent.js @@ -17,6 +17,7 @@ class TesterAgent { await this.generateIntegrationTests(projectStructure, readme); await this.generateUnitTests(projectStructure, readme); await this.runTests(); + await this.optimizeTests(); console.log("Tester Agent completed."); } @@ -74,7 +75,7 @@ Generate a complete Jest test file for this endpoint. Include necessary imports, messages: [{ role: "user", content: prompt }], }); - const testContent = response.content[0].text; + const testContent = this.extractCodeSnippet(response.content[0].text); const testFileName = `${endpoint.file.replace(".js", "")}.test.js`; const testFilePath = path.join(process.cwd(), this.testsDirectory, testFileName); @@ -122,7 +123,7 @@ Generate a complete Jest test file for this module. Include necessary imports, m messages: [{ role: "user", content: prompt }], }); - const testContent = response.content[0].text; + const testContent = this.extractCodeSnippet(response.content[0].text); const testFileName = `${path.basename(file, ".js")}.test.js`; const testFilePath = path.join(process.cwd(), this.testsDirectory, testFileName); @@ -157,6 +158,12 @@ Generate a complete Jest test file for this module. Include necessary imports, m await FileManager.write(testFile, optimizedContent); } } + + extractCodeSnippet(text) { + const codeBlockRegex = /```(?:javascript|js)?\n([\s\S]*?)\n```/; + const match = text.match(codeBlockRegex); + return match ? match[1] : text; + } } export default new TesterAgent();