-
Notifications
You must be signed in to change notification settings - Fork 445
Feat:Add application output code configuration #1604
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
base: develop
Are you sure you want to change the base?
Conversation
WalkthroughThe Vue component now accepts props in setup and conditionally uses a provided generateAppCode override. The filesystem utility changes the write payload to an object { type: 'write', data } when writing via FileSystemWritableFileStream. No exported signatures changed except setup(props) in Main.vue. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as User
participant V as Main.vue
participant D as Default generateAppCode
participant O as Override generateAppCode (props.options)
U->>V: Trigger code generation
alt Override provided
V->>O: generate(appSchema)
O-->>V: result
else No override
V->>D: generate(appSchema)
D-->>V: result
end
V-->>U: Display/generated output
sequenceDiagram
autonumber
participant FS as writeFile()
participant H as File Handle
participant W as FileSystemWritableFileStream
FS->>H: getFile() / createWritable()
FS->>W: write({ type: 'write', data: fileContent })
W-->>FS: ack
FS->>W: close()
W-->>FS: closed
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/toolbars/generate-code/src/Main.vue (1)
45-45: Type the props to catch invalid overrides at compile timeAnnotate
setup’sprops(or theprops.optionsdeclaration) so the expectedgenerateAppCode(appSchema)signature is enforced andiconshape is clear.- setup(props) { + setup(props: { options?: { generateAppCode?: (appSchema: any) => Promise<any> | any; icon?: any } }) {Optionally, strengthen the
propsdeclaration:// additionally (outside this hunk) import type { PropType } from 'vue' props: { options: { type: Object as PropType<{ generateAppCode?: (appSchema: unknown) => Promise<{ genResult?: any[] }> | { genResult?: any[] } icon?: { default?: unknown } | unknown }>, default: () => ({}) } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
packages/toolbars/generate-code/src/Main.vue(2 hunks)packages/utils/src/fs/index.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/utils/src/fs/index.ts (1)
scripts/updateTemplate.mjs (1)
fileContent(122-122)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: push-check
🔇 Additional comments (1)
packages/toolbars/generate-code/src/Main.vue (1)
167-169: Configurable generateAppCode override — LGTMThe conditional fallback to the service implementation is clean and keeps existing behavior intact.
| } | ||
| const res = await generateAppCode(appSchema) | ||
| const res = await (props.options?.generateAppCode |
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.
const { getAllNestedBlocksSchema, generateAppCode } = getMetaApi('engine.service.generateCode')
generateAppCode是generateCode服务导出的方法,这里可以通过开发一个新的出码的MetaService,实现新的generateCode来实现,应该不需要这个配置也可以做到
English | 简体中文
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Background and solution
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit