Skip to content

Commit 3e617fa

Browse files
ZHallen122NarwhalChenautofix-ci[bot]Sma1lboy
authored
refactor(backend): optimization build system prompt, support more features (#133)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced an extensive suite of UI components including interactive modals, accordions, alert dialogs, navigational menus, tables, and advanced form controls. - Enhanced theming with dark mode support, smooth animations, and responsive layouts that deliver a modern, dynamic user experience. - Added new components for user interactions such as sliders, toggles, and tooltips. - Implemented a comprehensive pagination system and a customizable sidebar for improved navigation. - **Chores** - Updated project configurations and dependencies to improve performance and maintainability. - Refined utility functions to ensure consistent styling and robust error handling. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: NarwhalChen <125920907+NarwhalChen@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Jackson Chen <90215880+Sma1lboy@users.noreply.github.com> Co-authored-by: Sma1lboy <541898146chen@gmail.com>
1 parent 5a5bb35 commit 3e617fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+10151
-1304
lines changed

backend/src/build-system/__tests__/fullstack-gen.spec.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ import { BuilderContext } from '../context';
1010
import { FrontendCodeHandler } from '../handlers/frontend-code-generate';
1111
import { FileStructureAndArchitectureHandler } from '../handlers/file-manager/file-struct';
1212
import { BackendRequirementHandler } from '../handlers/backend/requirements-document';
13+
import { UIUXLayoutHandler } from '../handlers/ux/uiux-layout';
1314

1415
(isIntegrationTest ? describe : describe.skip)('Build Sequence Test', () => {
1516
it('should execute build sequence successfully', async () => {
1617
const sequence: BuildSequence = {
1718
id: 'test-backend-sequence',
1819
version: '1.0.0',
19-
name: 'Wrtie a Cool personal website',
20-
description:
21-
'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',
20+
name: 'Wrtie a Single page Cool cybersecurity personal website',
21+
description: `A Single page personal blog website. I am a cybersecurity engineer so i want it to show i am a really cool hacker, with cool terminal functionality`,
2222
databaseType: 'SQLite',
2323
model: 'gpt-4o-mini',
2424
projectSize: 'medium', // limit for fun
@@ -40,6 +40,11 @@ import { BackendRequirementHandler } from '../handlers/backend/requirements-docu
4040
name: 'UX Sitemap Structure Node',
4141
// requires: ['op:UX:SMD'],
4242
},
43+
{
44+
handler: UIUXLayoutHandler,
45+
name: 'UIUX Layout Handler',
46+
// requires: ['op:UX:SMD'],
47+
},
4348
{
4449
handler: UXDMDHandler,
4550
name: 'UX DataMap Document Node',
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,71 @@
1-
import * as fs from 'fs-extra';
2-
import * as path from 'path';
3-
import { FileGeneratorHandler } from '../handlers/file-manager/file-generate';
4-
import { Logger } from '@nestjs/common';
5-
import { isIntegrationTest } from 'src/common/utils';
1+
// import * as fs from 'fs-extra';
2+
// import * as path from 'path';
3+
// import { FileGeneratorHandler } from '../handlers/file-manager/file-generate';
4+
// import { Logger } from '@nestjs/common';
5+
// import { isIntegrationTest } from 'src/common/utils';
66

7-
(isIntegrationTest ? describe : describe.skip)('FileGeneratorHandler', () => {
8-
const projectSrcPath = path.normalize(
9-
path.join('src', 'build-system', '__tests__', 'test-project'),
10-
);
7+
// (isIntegrationTest ? describe : describe.skip)('FileGeneratorHandler', () => {
8+
// const projectSrcPath = path.normalize(
9+
// path.join('src', 'build-system', '__tests__', 'test-project'),
10+
// );
1111

12-
const mdFilePath = path.normalize(
13-
path.join('src', 'build-system', '__tests__', 'file-arch.md'),
14-
);
12+
// const mdFilePath = path.normalize(
13+
// path.join('src', 'build-system', '__tests__', 'file-arch.md'),
14+
// );
1515

16-
const structMdFilePath = path.normalize(
17-
path.join('src', 'build-system', '__tests__', 'file-structure-document.md'),
18-
);
16+
// const structMdFilePath = path.normalize(
17+
// path.join('src', 'build-system', '__tests__', 'file-structure-document.md'),
18+
// );
1919

20-
beforeEach(async () => {
21-
// Ensure the project directory is clean
22-
await fs.remove(
23-
path.normalize(
24-
path.join('src', 'build-system', '__tests__', 'test-project', 'src'),
25-
),
26-
);
27-
});
20+
// beforeEach(async () => {
21+
// // Ensure the project directory is clean
22+
// await fs.remove(
23+
// path.normalize(
24+
// path.join('src', 'build-system', '__tests__', 'test-project', 'src'),
25+
// ),
26+
// );
27+
// });
2828

29-
afterEach(async () => {
30-
// Clean up the generated test files
31-
await fs.remove(
32-
path.normalize(
33-
path.join('src', 'build-system', '__tests__', 'test-project', 'src'),
34-
),
35-
);
36-
});
29+
// afterEach(async () => {
30+
// // Clean up the generated test files
31+
// await fs.remove(
32+
// path.normalize(
33+
// path.join('src', 'build-system', '__tests__', 'test-project', 'src'),
34+
// ),
35+
// );
36+
// });
3737

38-
it('should generate files based on file-arch.md', async () => {
39-
const archMarkdownContent = fs.readFileSync(
40-
path.normalize(path.resolve(mdFilePath)),
41-
'utf8',
42-
);
43-
const structMarkdownContent = fs.readFileSync(
44-
path.normalize(path.resolve(structMdFilePath)),
45-
'utf8',
46-
);
38+
// it('should generate files based on file-arch.md', async () => {
39+
// const archMarkdownContent = fs.readFileSync(
40+
// path.normalize(path.resolve(mdFilePath)),
41+
// 'utf8',
42+
// );
43+
// const structMarkdownContent = fs.readFileSync(
44+
// path.normalize(path.resolve(structMdFilePath)),
45+
// 'utf8',
46+
// );
4747

48-
const handler = new FileGeneratorHandler();
48+
// const handler = new FileGeneratorHandler();
4949

50-
// Run the file generator with the JSON data
51-
const result = await handler.generateFiles(
52-
archMarkdownContent,
53-
projectSrcPath,
54-
);
50+
// // Run the file generator with the JSON data
51+
// const result = await handler.generateFiles(
52+
// archMarkdownContent,
53+
// projectSrcPath,
54+
// );
5555

56-
Logger.log('File generation result:', result);
56+
// Logger.log('File generation result:', result);
5757

58-
// Verify that all files exist
59-
const jsonData = JSON.parse(
60-
/<GENERATEDCODE>([\s\S]*?)<\/GENERATEDCODE>/.exec(
61-
archMarkdownContent,
62-
)![1],
63-
);
64-
const files = Object.keys(jsonData.files);
58+
// // Verify that all files exist
59+
// const jsonData = JSON.parse(
60+
// /<GENERATEDCODE>([\s\S]*?)<\/GENERATEDCODE>/.exec(
61+
// archMarkdownContent,
62+
// )![1],
63+
// );
64+
// const files = Object.keys(jsonData.files);
6565

66-
for (const file of files) {
67-
const filePath = path.resolve(projectSrcPath, file);
68-
expect(fs.existsSync(filePath)).toBeTruthy();
69-
}
70-
}, 30000);
71-
});
66+
// for (const file of files) {
67+
// const filePath = path.resolve(projectSrcPath, file);
68+
// expect(fs.existsSync(filePath)).toBeTruthy();
69+
// }
70+
// }, 30000);
71+
// });
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,77 @@
1-
import { BuildSequence } from '../types';
2-
import * as fs from 'fs';
3-
import { executeBuildSequence } from './utils';
4-
import { isIntegrationTest } from 'src/common/utils';
5-
import { PRDHandler } from '../handlers/product-manager/product-requirements-document/prd';
6-
import { UXSMDHandler } from '../handlers/ux/sitemap-document';
7-
import { DBRequirementHandler } from '../handlers/database/requirements-document';
8-
import { DBSchemaHandler } from '../handlers/database/schemas/schemas';
9-
import { BackendCodeHandler } from '../handlers/backend/code-generate';
10-
import { ProjectInitHandler } from '../handlers/project-init';
11-
(isIntegrationTest ? describe : describe.skip)(
12-
'Sequence: PRD -> UXSD -> UXDD -> UXSS -> DBSchemas -> BackendCodeGenerator',
13-
() => {
14-
// Generate a unique folder with a timestamp
15-
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
16-
const logFolderPath = `./logs/backend_code_generator-${timestamp}`;
17-
fs.mkdirSync(logFolderPath, { recursive: true });
1+
// import { BuildSequence } from '../types';
2+
// import * as fs from 'fs';
3+
// import { executeBuildSequence } from './utils';
4+
// import { isIntegrationTest } from 'src/common/utils';
5+
// import { PRDHandler } from '../handlers/product-manager/product-requirements-document/prd';
6+
// import { UXSMDHandler } from '../handlers/ux/sitemap-document';
7+
// import { DBRequirementHandler } from '../handlers/database/requirements-document';
8+
// import { DBSchemaHandler } from '../handlers/database/schemas/schemas';
9+
// import { BackendCodeHandler } from '../handlers/backend/code-generate';
10+
// import { ProjectInitHandler } from '../handlers/project-init';
11+
// (isIntegrationTest ? describe : describe.skip)(
12+
// 'Sequence: PRD -> UXSD -> UXDD -> UXSS -> DBSchemas -> BackendCodeGenerator',
13+
// () => {
14+
// // Generate a unique folder with a timestamp
15+
// const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
16+
// const logFolderPath = `./logs/backend_code_generator-${timestamp}`;
17+
// fs.mkdirSync(logFolderPath, { recursive: true });
1818

19-
(isIntegrationTest ? it : it.skip)(
20-
'should execute the backend code generation sequence and log results to individual files',
21-
async () => {
22-
// Define the build sequence up to Backend Code Generator
23-
const sequence: BuildSequence = {
24-
id: 'test-backend-sequence',
25-
version: '1.0.0',
26-
name: 'Spotify-like Music Web',
27-
description: 'Users can play music',
28-
databaseType: 'SQLite',
29-
nodes: [
30-
{
31-
handler: ProjectInitHandler,
32-
name: 'Project Folders Setup',
33-
},
34-
{
35-
handler: PRDHandler,
36-
name: 'PRD Generation Node',
37-
},
19+
// (isIntegrationTest ? it : it.skip)(
20+
// 'should execute the backend code generation sequence and log results to individual files',
21+
// async () => {
22+
// // Define the build sequence up to Backend Code Generator
23+
// const sequence: BuildSequence = {
24+
// id: 'test-backend-sequence',
25+
// version: '1.0.0',
26+
// name: 'Spotify-like Music Web',
27+
// description: 'Users can play music',
28+
// databaseType: 'SQLite',
29+
// nodes: [
30+
// {
31+
// handler: ProjectInitHandler,
32+
// name: 'Project Folders Setup',
33+
// },
34+
// {
35+
// handler: PRDHandler,
36+
// name: 'PRD Generation Node',
37+
// },
3838

39-
{
40-
handler: UXSMDHandler,
41-
name: 'UX Sitemap Document Node',
42-
// requires: ['op:PRD'],
43-
},
39+
// {
40+
// handler: UXSMDHandler,
41+
// name: 'UX Sitemap Document Node',
42+
// // requires: ['op:PRD'],
43+
// },
4444

45-
{
46-
handler: UXSMDHandler,
47-
name: 'UX Data Map Document Node',
48-
// requires: ['op:UX:SMD'],
49-
},
45+
// {
46+
// handler: UXSMDHandler,
47+
// name: 'UX Data Map Document Node',
48+
// // requires: ['op:UX:SMD'],
49+
// },
5050

51-
{
52-
handler: DBRequirementHandler,
53-
name: 'Database Requirements Node',
54-
// requires: ['op:UX:DATAMAP:DOC'],
55-
},
51+
// {
52+
// handler: DBRequirementHandler,
53+
// name: 'Database Requirements Node',
54+
// // requires: ['op:UX:DATAMAP:DOC'],
55+
// },
5656

57-
{
58-
handler: DBSchemaHandler,
59-
name: 'Database Schemas Node',
60-
// requires: ['op:DATABASE_REQ'],
61-
},
57+
// {
58+
// handler: DBSchemaHandler,
59+
// name: 'Database Schemas Node',
60+
// // requires: ['op:DATABASE_REQ'],
61+
// },
6262

63-
{
64-
handler: BackendCodeHandler,
65-
name: 'Backend Code Generator Node',
66-
// requires: ['op:DATABASE:SCHEMAS', 'op:UX:DATAMAP:DOC'],
67-
},
68-
],
69-
};
63+
// {
64+
// handler: BackendCodeHandler,
65+
// name: 'Backend Code Generator Node',
66+
// // requires: ['op:DATABASE:SCHEMAS', 'op:UX:DATAMAP:DOC'],
67+
// },
68+
// ],
69+
// };
7070

71-
// Initialize the BuilderContext with the defined sequence and environment
72-
executeBuildSequence('backend code geneerate', sequence);
73-
},
74-
600000,
75-
); // Timeout set to 10 minutes
76-
},
77-
);
71+
// // Initialize the BuilderContext with the defined sequence and environment
72+
// executeBuildSequence('backend code geneerate', sequence);
73+
// },
74+
// 600000,
75+
// ); // Timeout set to 10 minutes
76+
// },
77+
// );

0 commit comments

Comments
 (0)