Skip to content

Commit 51b3026

Browse files
committed
Update prompt
1 parent 4d1b641 commit 51b3026

File tree

7 files changed

+80
-99
lines changed

7 files changed

+80
-99
lines changed

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

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,23 @@ import { BuildSequence } from '../types';
33
import { ProjectInitHandler } from '../handlers/project-init';
44
import { PRDHandler } from '../handlers/product-manager/product-requirements-document/prd';
55
import { UXSMDHandler } from '../handlers/ux/sitemap-document';
6-
import { UXSMSHandler } from '../handlers/ux/sitemap-structure';
76
import { DBRequirementHandler } from '../handlers/database/requirements-document';
87
import { UXDMDHandler } from '../handlers/ux/datamap';
98
import { BuilderContext } from '../context';
10-
import { FrontendCodeHandler } from '../handlers/frontend-code-generate';
11-
import { FileStructureAndArchitectureHandler } from '../handlers/file-manager/file-struct';
9+
import { DBSchemaHandler } from '../handlers/database/schemas/schemas';
1210
import { BackendRequirementHandler } from '../handlers/backend/requirements-document';
11+
import { FileStructureAndArchitectureHandler } from '../handlers/file-manager/file-struct';
12+
import { UXSMSHandler } from '../handlers/ux/sitemap-structure';
13+
import { BackendCodeHandler } from '../handlers/backend/code-generate';
14+
import { FrontendCodeHandler } from '../handlers/frontend-code-generate';
1315

1416
(isIntegrationTest ? describe : describe.skip)('Build Sequence Test', () => {
1517
it('should execute build sequence successfully', async () => {
1618
const sequence: BuildSequence = {
1719
id: 'test-backend-sequence',
1820
version: '1.0.0',
1921
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',
22+
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`,
2223
databaseType: 'SQLite',
2324
model: 'gpt-4o-mini',
2425
projectSize: 'medium', // limit for fun
@@ -38,7 +39,6 @@ import { BackendRequirementHandler } from '../handlers/backend/requirements-docu
3839
{
3940
handler: UXSMSHandler,
4041
name: 'UX Sitemap Structure Node',
41-
// requires: ['op:UX:SMD'],
4242
},
4343
{
4444
handler: UXDMDHandler,
@@ -53,15 +53,33 @@ import { BackendRequirementHandler } from '../handlers/backend/requirements-docu
5353
name: 'Database Requirements Node',
5454
// requires: ['op:UX:DATAMAP:DOC'],
5555
},
56+
{
57+
handler: DBSchemaHandler,
58+
name: 'Database schema Node',
59+
// requires: ['op:UX:DATAMAP:DOC'],
60+
},
5661
{
5762
handler: BackendRequirementHandler,
5863
name: 'Backend Requirements Node',
5964
// requires: ['op:DATABASE_REQ', 'op:UX:DATAMAP:DOC', 'op:UX:SMD'],
6065
},
66+
{
67+
handler: BackendCodeHandler,
68+
name: 'Backend Code Generator Node',
69+
},
6170
{
6271
handler: FrontendCodeHandler,
6372
name: 'Frontend Code Generator Node',
6473
},
74+
75+
// // {
76+
// // handler: BackendFileStructureAndArchitectureHandler,
77+
// // name: 'Backend File Structure and Architecture',
78+
// // },
79+
// {
80+
// handler: BackendFileReviewHandler,
81+
// name: 'Backend File review Node',
82+
// },
6583
],
6684
packages: [],
6785
};

backend/src/build-system/handlers/backend/code-generate/prompt.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const generateBackendCodePrompt = (
4848
**Include:**
4949
1. **Server Setup:**
5050
- Initialize the server using the Express framework with ES Module syntax (use \`import\` instead of \`require\`).
51-
- Configure middleware for JSON parsing and CORS it should allow localhost.
51+
- Configure middleware for JSON parsing and CORS example "app.use(cors()); "
5252
5353
2. **Database Connection and Initialization:**
5454
Database schemas: These schemas are defined in \`./schema.sql\`. The code must read and execute this file during database initialization.

backend/src/build-system/handlers/backend/requirements-document/index.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { BuildNode, BuildNodeRequire } from 'src/build-system/hanlder-manager';
1212
import { DBRequirementHandler } from '../../database/requirements-document';
1313
import { UXDMDHandler } from '../../ux/datamap';
1414
import { DBSchemaHandler } from '../../database/schemas/schemas';
15+
import { MessageInterface } from 'src/common/model-provider/types';
1516

1617
type BackendRequirementResult = {
1718
overview: string;
@@ -65,14 +66,42 @@ export class BackendRequirementHandler implements BuildHandler<string> {
6566
packages,
6667
);
6768

69+
const messages = [
70+
{
71+
role: 'system' as const,
72+
content: overviewPrompt,
73+
},
74+
{
75+
role: 'user' as const,
76+
content: `## Database Requirements:
77+
${dbRequirements}
78+
`,
79+
},
80+
{
81+
role: 'user' as const,
82+
content: `## DataBase Schema:
83+
${dbSchema}
84+
`,
85+
},
86+
{
87+
role: 'user' as const,
88+
content: `## Frontend Data Requirements:
89+
${datamapDoc} `,
90+
},
91+
{
92+
role: 'user',
93+
content: `Now you can provide the code, don't forget the <GENERATE></GENERATE> tags. Do not be lazy.`,
94+
},
95+
] as MessageInterface[];
96+
6897
let backendOverview: string;
6998

7099
try {
71100
backendOverview = await chatSyncWithClocker(
72101
context,
73102
{
74103
model: 'gpt-4o-mini',
75-
messages: [{ content: overviewPrompt, role: 'system' }],
104+
messages: messages,
76105
},
77106
'generateBackendOverviewPrompt',
78107
BackendRequirementHandler.name,

backend/src/build-system/handlers/backend/requirements-document/prompt.ts

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const generateBackendOverviewPrompt = (
1010
return `Role: You are a Senior Backend Architect specializing in backend systems. Generate the System Overview and API Endpoints specifications based on the following inputs.
1111
1212
Task: Generate a Backend Overview Document following these guidelines:
13+
Project Name: ${projectName}
1314
1415
### Technology Stack
1516
- Language: ${language}
@@ -29,35 +30,25 @@ ${Object.entries(packages)
2930
4. Consider:
3031
- Data flow between frontend pages
3132
- Required data transformations
32-
- Authentication and authorization needs
3333
5. IMPORTANT: Carefully differentiate between public and authenticated endpoints:
34-
- Public endpoints (No Auth): Content retrieval endpoints (GET blog posts, portfolio items, etc.)
35-
- Authenticated endpoints (Auth Required): Content creation/modification endpoints (POST/PUT/DELETE blog posts, etc.)
34+
- Public endpoints (No Auth)
3635
6. For authenticated endpoints only, include authentication in the headers section using "Authorization": "Bearer {token}"
3736
7. Don't add authentication requirements to public-facing read operations (GET requests for viewing content)
37+
8. Do not add login when no documentation mentioned.
38+
9. It MUST be COMPLETE DO NOTE write TODO, and Future for api.
3839
3940
Your reply must start with: "<GENERATE>" and end with "</GENERATE>".
4041
4142
Include these sections:
42-
43-
<System_Overview>
44-
#### 1. System Overview
45-
- **Project Name**: ${projectName}
46-
- **Framework architecture**
47-
- **Data Flow**
48-
- Frontend-Backend data interactions
49-
- Data transformation layers
50-
</System_Overview>
51-
52-
<ApiDoc>
43+
## API Documentation
5344
Group endpoints by functional areas based on site structure.
5445
For each endpoint:
5546
\`\`\`
5647
Route: GET|POST|PUT|DELETE /api/resource
5748
Purpose: Functional description
5849
Data Requirements:
5950
- Required data transformations
60-
Required Auth: Yes/No
51+
Required Auth: No/Yes
6152
Request:
6253
{
6354
"headers": {},
@@ -70,22 +61,6 @@ Response:
7061
"success": {},
7162
"errors": {}
7263
}
73-
</ApiDoc>
74-
75-
76-
# Context input
77-
Project Name: ${projectName}
78-
79-
## Requirements Documentation
80-
1. Database Requirements:
81-
${dbRequirements}
82-
83-
2. DataBase Schema:
84-
${dbSchema}
85-
86-
2. Frontend Data Requirements:
87-
${datamapDoc}
88-
8964
\`\`\``;
9065
};
9166

backend/src/build-system/handlers/database/requirements-document/prompt.ts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,17 @@ export const prompts = {
1010
Follow these guidelines to generate the database requirements:
1111
1212
### Instructions and Rules:
13-
1. Analyze data elements mentioned in the UX Datamap
14-
2. Carefully distinguish between frontend state management and actual database storage needs
15-
3. Only include entities and attributes that require persistent storage
16-
4. For each feature in the UX Datamap, clearly determine if it needs database support or is purely frontend
17-
5. Identify entities and their relationships
18-
6. Determine data types and constraints
19-
7. Consider data persistence requirements
20-
8. Plan for scalability and performance
13+
1. IMPORTANT: Only include features and entities that are EXPLICITLY mentioned in the UX Datamap.
14+
2. Analyze data elements mentioned in the UX Datamap.
15+
3. DO NOT include any conditional or optional features (phrases containing "if", "optional", "may", "possible", or similar qualifiers).
16+
4. Do not add User, login, authentication unless specifically mentioned in the UX Datamap.
17+
5. Carefully distinguish between frontend state management and actual database storage needs
18+
6. Only include entities and attributes that require persistent storage
19+
7. For each feature in the UX Datamap, clearly determine if it needs database support or is purely frontend
20+
8. Identify entities and their relationships
21+
9. Determine data types and constraints
22+
10. Consider data persistence requirements
23+
11. Plan for scalability and performance
2124
2225
### Database Requirements Structure:
2326
---
@@ -56,10 +59,10 @@ For each entity:
5659
- Performance considerations
5760
5861
#### 6. Security Requirements
59-
- Access control
60-
- Data privacy considerations
61-
- Audit requirements
62-
- Encryption needs
62+
- Only include access control if user authentication is EXPLICITLY REQUIRED
63+
- Only include data privacy considerations for sensitive data that is actually being stored
64+
- Only include audit requirements if explicitly mentioned
65+
- Only include encryption needs if sensitive data is being stored
6366
6467
#### 7. Performance Requirements
6568
- Expected data volume
@@ -93,8 +96,8 @@ Focus on creating practical, implementable database requirements that will effec
9396
- Partitioning needs
9497
9598
4. Security & Compliance:
96-
- Access control
97-
- Data encryption
99+
- Only include access control if authentication is explicitly required
100+
- Data encryption only if sensitive data is being stored
98101
- Audit requirements
99102
100103
5. Maintenance & Operations:

backend/src/build-system/handlers/frontend-code-generate/CodeReview.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ export class CodeQueueProcessor {
276276
fixResponse = await chatSyncWithClocker(
277277
this.context,
278278
{
279-
// model: 'o3-mini-high',
280-
model: 'gpt-4o-mini',
279+
model: 'o3-mini-high',
280+
// model: 'gpt-4o-mini',
281281
messages: [
282282
{ role: 'system', content: fixPrompt },
283283
{

backend/src/build-system/handlers/ux/datamap/prompt.ts

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -83,50 +83,6 @@ For each page in sitemap:
8383
- How data changes based on user actions
8484
- What feedback is needed
8585
- When/how data updates
86-
87-
Example for Login Page:
88-
89-
##### Login Page
90-
**Purpose**: Allow users to authenticate and access their account
91-
92-
**User Goals**:
93-
- Sign into their account
94-
- Recover forgotten password
95-
- Stay signed in for convenience
96-
97-
**Required Data Elements**:
98-
99-
*Input Data*:
100-
- Username/Email
101-
- Purpose: Identify the user account
102-
- User expectation: Email format or username rules
103-
- Should be remembered if user chooses
104-
- Password
105-
- Purpose: Authenticate the user
106-
- Should be masked for security
107-
- Should support paste functionality
108-
- "Remember Me" option
109-
- Purpose: Convenience for returning users
110-
- Optional selection
111-
112-
*Display Data*:
113-
- Login form status
114-
- Authentication feedback
115-
- Password requirements (if needed)
116-
- Account recovery options
117-
118-
*Feedback & States*:
119-
- Loading state during authentication
120-
- Success feedback and redirect
121-
- Error messages for invalid credentials
122-
- Password recovery confirmation
123-
124-
**User Interactions**:
125-
- Form validation feedback
126-
- Login button state changes
127-
- Immediate feedback on input errors
128-
- Clear path to password recovery
129-
13086
---
13187
13288
Your reply must start with: "\`\`\`UXDataMap" and end with "\`\`\`".

0 commit comments

Comments
 (0)