Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(backend): build system backend generation #139

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
78 changes: 78 additions & 0 deletions backend/src/build-system/__tests__/backend-gen.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { isIntegrationTest } from 'src/common/utils';
import { BuildSequence } from '../types';
import { ProjectInitHandler } from '../handlers/project-init';
import { PRDHandler } from '../handlers/product-manager/product-requirements-document/prd';
import { UXSMDHandler } from '../handlers/ux/sitemap-document';
import { DBRequirementHandler } from '../handlers/database/requirements-document';
import { UXDMDHandler } from '../handlers/ux/datamap';
import { BuilderContext } from '../context';
import { DBSchemaHandler } from '../handlers/database/schemas/schemas';
import { BackendRequirementHandler } from '../handlers/backend/requirements-document';
import { BackendCodeHandler } from '../handlers/backend/code-generate';

Comment on lines +1 to +12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix import path error from pipeline failure.

The pipeline is failing with error: TS2307: Cannot find module 'codefox-common' or its corresponding type declarations. Check for the correct import path for isIntegrationTest.

-import { isIntegrationTest } from 'src/common/utils';
+import { isIntegrationTest } from '../../../common/utils';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { isIntegrationTest } from 'src/common/utils';
import { BuildSequence } from '../types';
import { ProjectInitHandler } from '../handlers/project-init';
import { PRDHandler } from '../handlers/product-manager/product-requirements-document/prd';
import { UXSMDHandler } from '../handlers/ux/sitemap-document';
import { DBRequirementHandler } from '../handlers/database/requirements-document';
import { UXDMDHandler } from '../handlers/ux/datamap';
import { BuilderContext } from '../context';
import { DBSchemaHandler } from '../handlers/database/schemas/schemas';
import { BackendRequirementHandler } from '../handlers/backend/requirements-document';
import { BackendCodeHandler } from '../handlers/backend/code-generate';
import { isIntegrationTest } from '../../../common/utils';
import { BuildSequence } from '../types';
import { ProjectInitHandler } from '../handlers/project-init';
import { PRDHandler } from '../handlers/product-manager/product-requirements-document/prd';
import { UXSMDHandler } from '../handlers/ux/sitemap-document';
import { DBRequirementHandler } from '../handlers/database/requirements-document';
import { UXDMDHandler } from '../handlers/ux/datamap';
import { BuilderContext } from '../context';
import { DBSchemaHandler } from '../handlers/database/schemas/schemas';
import { BackendRequirementHandler } from '../handlers/backend/requirements-document';
import { BackendCodeHandler } from '../handlers/backend/code-generate';
🧰 Tools
🪛 GitHub Actions: Run tests and upload coverage

[error] 4-4: TS2307: Cannot find module 'codefox-common' or its corresponding type declarations.

(isIntegrationTest ? describe : describe.skip)('Build Sequence Test', () => {
it('should execute build sequence successfully', async () => {
const sequence: BuildSequence = {
id: 'test-backend-sequence',
version: '1.0.0',
name: 'Wrtie a Cool personal website',
description:
'A personal blog website. I am a cybersecurity engineer so i want it to show i am a really cool hacker, with cool terminal functionality',
databaseType: 'SQLite',
model: 'gpt-4o-mini',
projectSize: 'medium', // limit for fun
nodes: [
{
handler: ProjectInitHandler,
name: 'Project Folders Setup',
},
{
handler: PRDHandler,
name: 'Project Requirements Document Node',
},
{
handler: UXSMDHandler,
name: 'UX Sitemap Document Node',
},
{
handler: UXDMDHandler,
name: 'UX DataMap Document Node',
},
{
handler: DBRequirementHandler,
name: 'Database Requirements Node',
// requires: ['op:UX:DATAMAP:DOC'],
},
{
handler: DBSchemaHandler,
name: 'Database schema Node',
// requires: ['op:UX:DATAMAP:DOC'],
},
{
handler: BackendRequirementHandler,
name: 'Backend Requirements Node',
// requires: ['op:DATABASE_REQ', 'op:UX:DATAMAP:DOC', 'op:UX:SMD'],
},
// // {
// // handler: BackendFileStructureAndArchitectureHandler,
// // name: 'Backend File Structure and Architecture',
// // },
{
handler: BackendCodeHandler,
name: 'Backend Code Generator Node',
},
// {
// handler: BackendFileReviewHandler,
// name: 'Backend File review Node',
// },
// {
// handler: FrontendCodeHandler,
// name: 'Frontend Code Generator Node',
// },
Comment on lines +56 to +71
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Consider completing the test by uncommenting additional handlers.

The test has several commented out handlers which suggests incomplete testing. Consider either uncommenting these handlers if they're meant to be part of the test or removing the commented code if they're not needed.


🏁 Script executed:

#!/bin/bash
# Check if the commented handlers are implemented and available

echo "Checking if BackendFileStructureAndArchitectureHandler exists:"
find backend/src -name "*backend-file-struct*" -o -name "*backend-architecture*"

echo "Checking if BackendFileReviewHandler exists:"
find backend/src -name "*file-review*"

echo "Checking if FrontendCodeHandler exists:"
find backend/src -name "*frontend*code*"

Length of output: 807


Action: Finalize test coverage for all handlers

Our verification confirms that the implementations for the commented handlers exist in the repository. In the test file (backend/src/build-system/tests/backend-gen.spec.ts), aside from the active test for Backend Code Generator Node, the following handlers are commented out:

  • BackendFileStructureAndArchitectureHandler
  • BackendFileReviewHandler
  • FrontendCodeHandler

To ensure comprehensive testing and maintain code clarity, please either:

  • Uncomment these handlers if they are intended to be covered by the test, or
  • Remove the commented-out code if these handlers are not meant to be part of the test.

],
packages: [],
};
const context = new BuilderContext(sequence, 'fullstack-code-gen');
await context.execute();
}, 2000000);
});
30 changes: 24 additions & 6 deletions backend/src/build-system/__tests__/fullstack-gen.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@ import { BuildSequence } from '../types';
import { ProjectInitHandler } from '../handlers/project-init';
import { PRDHandler } from '../handlers/product-manager/product-requirements-document/prd';
import { UXSMDHandler } from '../handlers/ux/sitemap-document';
import { UXSMSHandler } from '../handlers/ux/sitemap-structure';
import { DBRequirementHandler } from '../handlers/database/requirements-document';
import { UXDMDHandler } from '../handlers/ux/datamap';
import { BuilderContext } from '../context';
import { FrontendCodeHandler } from '../handlers/frontend-code-generate';
import { FileStructureAndArchitectureHandler } from '../handlers/file-manager/file-struct';
import { DBSchemaHandler } from '../handlers/database/schemas/schemas';
import { BackendRequirementHandler } from '../handlers/backend/requirements-document';
import { FileStructureAndArchitectureHandler } from '../handlers/file-manager/file-struct';
import { UXSMSHandler } from '../handlers/ux/sitemap-structure';
import { BackendCodeHandler } from '../handlers/backend/code-generate';
import { FrontendCodeHandler } from '../handlers/frontend-code-generate';

(isIntegrationTest ? describe : describe.skip)('Build Sequence Test', () => {
it('should execute build sequence successfully', async () => {
const sequence: BuildSequence = {
id: 'test-backend-sequence',
version: '1.0.0',
name: 'Wrtie a Cool personal website',
description:
'A personal blog website. I am a cybersecurity engineer so i want it to show i am a really cool hacker, with cool terminal functionality',
description: `A personal blog website. I am a cybersecurity engineer so i want it to show i am a really cool hacker, with cool terminal functionality`,
databaseType: 'SQLite',
model: 'gpt-4o-mini',
projectSize: 'medium', // limit for fun
Expand All @@ -38,7 +39,6 @@ import { BackendRequirementHandler } from '../handlers/backend/requirements-docu
{
handler: UXSMSHandler,
name: 'UX Sitemap Structure Node',
// requires: ['op:UX:SMD'],
},
{
handler: UXDMDHandler,
Expand All @@ -53,15 +53,33 @@ import { BackendRequirementHandler } from '../handlers/backend/requirements-docu
name: 'Database Requirements Node',
// requires: ['op:UX:DATAMAP:DOC'],
},
{
handler: DBSchemaHandler,
name: 'Database schema Node',
// requires: ['op:UX:DATAMAP:DOC'],
},
{
handler: BackendRequirementHandler,
name: 'Backend Requirements Node',
// requires: ['op:DATABASE_REQ', 'op:UX:DATAMAP:DOC', 'op:UX:SMD'],
},
{
handler: BackendCodeHandler,
name: 'Backend Code Generator Node',
},
{
handler: FrontendCodeHandler,
name: 'Frontend Code Generator Node',
},

// // {
// // handler: BackendFileStructureAndArchitectureHandler,
// // name: 'Backend File Structure and Architecture',
// // },
// {
// handler: BackendFileReviewHandler,
// name: 'Backend File review Node',
// },
],
packages: [],
};
Expand Down
Loading
Loading