-
Notifications
You must be signed in to change notification settings - Fork 1
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): frontend code generator #85
Merged
Merged
Changes from 82 commits
Commits
Show all changes
87 commits
Select commit
Hold shift + click to select a range
9d91437
feat(backent): adding react-ts template (#56)
Sma1lboy 5bbfdd9
Merge branch 'main' of https://github.com/Sma1lboy/GeneratorAI
ZHallen122 bfda89c
Merge branch 'main' of https://github.com/Sma1lboy/GeneratorAI
ZHallen122 da9ef45
Merge branch 'main' of https://github.com/Sma1lboy/GeneratorAI
ZHallen122 ec2bb50
Merge branch 'main' of https://github.com/Sma1lboy/GeneratorAI
ZHallen122 5bdd162
Merge branch 'main' of https://github.com/Sma1lboy/GeneratorAI
ZHallen122 2c9ae0f
Merge branch 'main' of https://github.com/Sma1lboy/GeneratorAI
ZHallen122 60a3098
Merge branch 'main' of https://github.com/Sma1lboy/GeneratorAI
ZHallen122 a923bc5
Merge branch 'main' of https://github.com/Sma1lboy/GeneratorAI
ZHallen122 fd2c639
Merge branch 'main' of https://github.com/Sma1lboy/GeneratorAI
ZHallen122 66137f1
Merge branch 'main' of https://github.com/Sma1lboy/GeneratorAI
ZHallen122 b7b809d
Merge branch 'main' of https://github.com/Sma1lboy/GeneratorAI
ZHallen122 02ff300
Merge branch 'main' of https://github.com/Sma1lboy/GeneratorAI
ZHallen122 3395501
Merge branch 'main' of https://github.com/Sma1lboy/GeneratorAI
ZHallen122 8b6646e
init frontend code generate
ZHallen122 2d610e9
FileGeneratorUtil
ZHallen122 cd4fe5f
update frontend code generator for fully generate
ZHallen122 09aeeea
update for code generate
ZHallen122 c791fcc
add code genearet to manager
ZHallen122 74cfffd
add esModuleInterop to support common js libarary
ZHallen122 98ea9c8
add op:FRONTEND:CODE step
ZHallen122 125576c
check if virtual dir correct at file arch
ZHallen122 a6d713a
fix order
ZHallen122 f708b9e
add css generate prompt
ZHallen122 a22836f
update
ZHallen122 e17a5ec
update
ZHallen122 be118f0
update to use sitemap struct
ZHallen122 e614d06
Merge branch 'main' of https://github.com/Sma1lboy/GeneratorAI
ZHallen122 fabdf32
Merge branch 'main' into feat_backend_frontend_code_generate
ZHallen122 580f27d
fix error
ZHallen122 e5cc2ed
update ux sitemap
ZHallen122 74d4610
improved prompt
ZHallen122 33f22d5
update sitemap prompt and messages
ZHallen122 01bfedf
update file name for sitemap
ZHallen122 faabb88
update sitemap prompt
ZHallen122 d4a1d1e
update prompts
ZHallen122 eebffc6
update sitemap structure: add messages
ZHallen122 7eecfe4
page by page update
ZHallen122 6f92d88
update
ZHallen122 1cb1dda
update UXSMD and S
ZHallen122 5cda996
update SMS
ZHallen122 45895c8
update prompt
ZHallen122 4b1bab6
update nameing
ZHallen122 f42e486
Fix Update import
ZHallen122 2452140
update import
ZHallen122 a8a402b
Merge branch 'main' into feat_backend_frontend_code_generate
ZHallen122 9e63a90
[autofix.ci] apply automated fixes
autofix-ci[bot] 9669af3
Fix ssr and csr issue (#99)
NarwhalChen a4886ab
Delete unuse code
ZHallen122 be2aa22
refactor: sequence executing with polling rather then steps (#100)
Sma1lboy 940119c
Concurrent frontend code generate
ZHallen122 707d779
[autofix.ci] apply automated fixes
autofix-ci[bot] ba87f34
fix currentFullFilePath
ZHallen122 027765d
specify <generate>tag and remove logger
ZHallen122 b5fb1a8
Ensure consistent handling by always requiring 'src' prefix
ZHallen122 12f285a
Ensure consistent handling by always requiring 'src' prefix
ZHallen122 7d3c56f
use retryable error
ZHallen122 77fa4f3
use retryable error
ZHallen122 67903f0
change node return string about file structure not json result
ZHallen122 7a21de5
file arch using messages
ZHallen122 a8cc115
update system prompt
ZHallen122 4cfb5b6
ResponseTagError change to RetryableError
ZHallen122 d2a57b7
add read file retry
ZHallen122 6f3ede5
fix(frontend): fix some ui issue and chat message thread issues (#101)
NarwhalChen 4a80f03
add retry to the frontend code generate
ZHallen122 c475dc6
pass json
ZHallen122 57737e6
fix: fixing bug of cannot delete chat history (#102)
NarwhalChen 55deed8
frontend generate test
ZHallen122 19af1ec
[autofix.ci] apply automated fixes
autofix-ci[bot] 7bdfba9
update prompt to correct add router depencies
ZHallen122 b97e552
update prompt
ZHallen122 d632f10
add s for folders
ZHallen122 407230d
Feat adding collapseable sidebar (#103)
NarwhalChen dd0881c
remove index.tsx in folder
ZHallen122 c245b8c
update
ZHallen122 67e2f83
update frontend code prompt
ZHallen122 e043c83
add tailwindcss to template
ZHallen122 4fa4e0f
[autofix.ci] apply automated fixes
autofix-ci[bot] 7345d6f
update file struct
ZHallen122 38bdf47
fix(backend): Fix frontend template (#104)
Sma1lboy 7aaf98e
chore(backend): adding log inside of context (#105)
Sma1lboy 46e13e2
refactor(backedn): adjusting prompt to reduce parsing error (#106)
ZHallen122 4449b09
chore(backend): Chore more fix on prompt (#107)
Sma1lboy 1fa9f47
Feat adding profilepage (#108)
NarwhalChen 1a0a2d7
add comment
ZHallen122 42d9525
Comment whole file and unuse delete file
ZHallen122 ce478e4
fix incorrect logic and add platform
ZHallen122 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
backend/src/build-system/__tests__/mock/MockBuilderContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
import { VirtualDirectory } from '../../virtual-dir'; | ||
import { readFileSync } from 'fs'; | ||
import { resolve } from 'path'; | ||
import * as path from 'path'; | ||
import { UXSMSHandler } from 'src/build-system/handlers/ux/sitemap-structure'; | ||
import { UXDMDHandler } from 'src/build-system/handlers/ux/datamap'; | ||
import { BackendRequirementHandler } from 'src/build-system/handlers/backend/requirements-document'; | ||
import { FileFAHandler } from 'src/build-system/handlers/file-manager/file-arch'; | ||
import { BuilderContext, GlobalDataKeys } from 'src/build-system/context'; | ||
import { v4 as uuidv4 } from 'uuid'; // UUID generator for unique identifiers | ||
import { | ||
BuildExecutionState, | ||
BuildHandlerConstructor, | ||
BuildSequence, | ||
ExtractHandlerReturnType, | ||
} from 'src/build-system/types'; | ||
import { buildProjectPath, copyProjectTemplate } from '../../utils/files'; | ||
|
||
export class MockBuilderContext extends BuilderContext { | ||
private mockNodeData: Map<BuildHandlerConstructor, any> = new Map(); | ||
private mockGlobalContext: Map<GlobalDataKeys | string, any> = new Map(); | ||
virtualDirectory: VirtualDirectory; | ||
|
||
constructor(sequence: BuildSequence, id: string) { | ||
super(sequence, id); // Call the parent constructor to initialize inherited properties | ||
this.virtualDirectory = new VirtualDirectory(); // Initialize the mock virtual directory | ||
const uuid = | ||
new Date().toISOString().slice(0, 10).replace(/:/g, '-') + '-' + uuidv4(); | ||
|
||
// Read mock data from files | ||
const uxSitemapStructure = this.readMockFile( | ||
path.join(__dirname, 'test_files', 'UX_Sitemap_Structure_Node.md'), | ||
); | ||
const uxDataMapDocument = this.readMockFile( | ||
path.join(__dirname, 'test_files', 'UX_DataMap_Document_Node.md'), | ||
); | ||
const backendRequirements = this.readMockFile( | ||
path.join(__dirname, 'test_files', 'Backend_Requirements_Node.md'), | ||
); | ||
const fileStructure = this.readMockFile( | ||
path.join(__dirname, 'test_files', 'File_Structure_Generation.md'), | ||
); | ||
const fileArchitecture = this.readMockFile( | ||
path.join(__dirname, 'test_files', 'File_Arch.md'), | ||
); | ||
|
||
this.mockNodeData.set(UXSMSHandler, uxSitemapStructure); | ||
this.mockNodeData.set(UXDMDHandler, uxDataMapDocument); | ||
this.mockNodeData.set(BackendRequirementHandler, backendRequirements); | ||
this.mockNodeData.set(FileFAHandler, fileArchitecture); | ||
this.buildVirtualDirectory(fileStructure); | ||
|
||
copyProjectTemplate( | ||
path.join(__dirname, '..', '..', '..', '..', 'template', 'react-ts'), | ||
uuid, | ||
'frontend', | ||
); | ||
|
||
// Set up mock data for globalContext | ||
this.mockGlobalContext.set( | ||
'frontendPath', | ||
buildProjectPath(uuid, 'frontend'), | ||
); | ||
} | ||
|
||
setGlobalContext<Key extends GlobalDataKeys | string>( | ||
key: Key, | ||
value: any, | ||
): void { | ||
this.mockGlobalContext.set(key, value); | ||
} | ||
|
||
setNodeData<T extends BuildHandlerConstructor>( | ||
handlerClass: T, | ||
data: ExtractHandlerReturnType<T>, | ||
): void { | ||
this.mockNodeData.set(handlerClass, data); | ||
} | ||
|
||
getExecutionState(): BuildExecutionState { | ||
return {} as BuildExecutionState; // Return a mock execution state | ||
} | ||
|
||
buildVirtualDirectory(jsonContent: string): boolean { | ||
return this.virtualDirectory.parseJsonStructure(jsonContent); | ||
} | ||
|
||
execute(): Promise<void> { | ||
return Promise.resolve(); // Mock a resolved promise for execution | ||
} | ||
|
||
getNodeData(handler: any): any { | ||
return this.mockNodeData.get(handler) || null; | ||
} | ||
|
||
getGlobalContext(key: string): any { | ||
return this.mockGlobalContext.get(key) || null; | ||
} | ||
|
||
// Helper method to read files | ||
private readMockFile(filePath: string): string { | ||
try { | ||
const absolutePath = resolve(filePath); // Resolve the file path | ||
return readFileSync(absolutePath, 'utf-8'); // Read the file content | ||
} catch (err) { | ||
console.error(`Error reading file at ${filePath}:`, err); | ||
return ''; // Return an empty string if file read fails | ||
} | ||
} | ||
|
||
// Add other methods as necessary for mocking | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uncomment dependencies to enforce build sequence validation.
The dependencies are commented out but appear to be necessary for proper build sequence validation.
Uncomment all the dependencies to ensure proper dependency checking:
Also applies to: 52-52, 57-58, 65-65, 70-70, 75-75, 80-80