-
Notifications
You must be signed in to change notification settings - Fork 378
Decouple Desktop UI into monorepo app #5912
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
Conversation
🎨 Storybook Build Status✅ Build completed successfully! ⏰ Completed at: 10/05/2025, 04:51:29 AM UTC 🔗 Links🎉 Your Storybook is ready for review! |
🎭 Playwright Test Results⏰ Completed at: 10/05/2025, 05:05:26 AM UTC 📈 Summary
📊 Test Reports by Browser
🎉 Click on the links above to view detailed test results for each browser configuration. |
Adds apps/desktop-ui package setup, Vite config, TypeScript config, base index.html, public assets, env/types, and base router/i18n/main wiring.
Relocates Desktop UI components, views, stores, types, and constants under apps/desktop-ui with no content changes (pure moves).
Updates existing app router to accommodate Desktop UI extraction.
Added by pattern from packages/* packages.
Copies style to local style.css
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.
Comprehensive PR Review
This review is generated by Claude. It may not always be accurate, as with human reviewers. If you believe that any of the comments are invalid or incorrect, please state why for each. For others, please implement the changes in one way or another.
Review Summary
PR: Decouple Desktop UI into monorepo app (#5912)
Impact: 1188 additions, 96 deletions across 67 files
Issue Distribution
- Critical: 0
- High: 1
- Medium: 4
- Low: 3
Category Breakdown
- Architecture: 4 issues
- Security: 2 issues
- Performance: 1 issue
- Code Quality: 1 issue
Key Findings
Architecture & Design
This PR successfully extracts desktop-specific functionality into a standalone apps/desktop-ui
package, which is a positive architectural move. The separation creates clear boundaries and eliminates conditional isElectron()
checks from the main app. However, several consistency issues were identified:
- Missing functions in desktop utilities compared to main app (
showNativeSystemMenu
) - Port conflicts between desktop and main Storybook instances
- Cross-dependencies from build scripts to desktop app constants
- Missing TypeScript type exports for consistency
The move to use file renaming (R100) rather than copy-paste is excellent for git history preservation.
Security Considerations
Two security vulnerabilities were identified in development configurations:
- Storybook server configured with
allowedHosts: true
creates host header attack vulnerability - Vite dev server exposes to all network interfaces (
0.0.0.0
) whenVITE_REMOTE_DEV=true
Both should be addressed before production deployment of development tooling.
Performance Impact
The desktop app eagerly loads all locale files at startup, which increases initial bundle size. Consider implementing lazy locale loading based on detected language for better startup performance.
Integration Points
The desktop UI properly integrates with:
- Nx build orchestration with appropriate caching and outputs
- pnpm workspace catalog for dependency management
- Shared frontend utilities package
- Main app locale files via path aliasing
The CODEOWNERS file was properly updated to consolidate ownership under @webfiltered
.
Positive Observations
- Clean separation of concerns with minimal code duplication
- Proper use of Nx monorepo architecture with appropriate tagging
- Good use of pnpm catalog for dependency management
- Comprehensive Storybook setup for component development
- Maintains TypeScript strict mode compliance
- Proper Vue 3 Composition API patterns throughout
- Well-structured component architecture with proper prop/emit patterns
References
Next Steps
- Address the high-priority security issue in Storybook configuration
- Resolve API consistency between desktop and main utilities
- Fix port conflicts for simultaneous development
- Consider performance optimization for locale loading
- Verify all development tooling works correctly in the new structure
This is a comprehensive automated review. For architectural decisions requiring human judgment, please request additional manual review.
Addressed all comments individually. Resolved all that were not introduced by this PR, just replicated, hallucinations, requests to add unused code, or just ridiculous. |
For visibility: I used both Sonnet 4.5 and Opus (it's a big PR, it needs some big understanding) to review this PR locally. Only came back with similar issues - things that are out of scope for this PR. I did caveat the bots with the i18n situation (only), as I realise it's not great. I also don't have the time to make it a pre-req for merge. Have updated PR description. |
@christian-byrne Did you guys get codex working on the repo? Can it review? |
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.
LGTM
@benceruleanlu can you remind me how it's done again? |
@codex review |
To use Codex here, create a Codex account and connect to github. |
@@ -1,12 +1,12 @@ | |||
import * as fs from 'fs' | |||
|
|||
import { DESKTOP_DIALOGS } from '../apps/desktop-ui/src/constants/desktopDialogs' |
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.
Want to add a path in the root tsconfig?
Maybe '@desktop/*': './apps/desktop-ui/src'
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.
My thought on this is that we should do this when we move the frontend to an app - properly, and all at once.
Right now the root tsconfig is actually still just the frontend tsconfig - and it doesn't make sense to have it ref the desktop.
#desktop-app { | ||
position: absolute; | ||
inset: 0; | ||
} |
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.
Can't use tailwind utilities for these?
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.
Like-for-like migration - honestly, I went one step too far here and didn't use top:0; left:0; width:100%; height:100%;
(because .. no).
size="small" | ||
:class=" | ||
cn('absolute top-2 right-8 transition-opacity', { | ||
'opacity-0 pointer-events-none select-none': !isHovered |
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.
The CSS hover doesn't work for this?
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.
This isn't a change, afaik. (edit: confirmed!)
ComfyUI_frontend/src/components/bottomPanel/tabs/terminal/BaseTerminal.vue
Lines 16 to 20 in 15783ed
size="small" | |
:class=" | |
cn('absolute top-2 right-8 transition-opacity', { | |
'opacity-0 pointer-events-none select-none': !isHovered | |
}) |
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.
These files were duplicated as is - i.e. the PR isn't to make changes, it's to do the split. Trying to fix things at the same time as you migrate them is almost always a misstep; if there are any issues, you will have no idea what caused it.
In my experience, it's usually the opportunistic fix.
I'll add context to the PR body.
const terminalEl = ref<HTMLElement | undefined>() | ||
const rootEl = ref<HTMLElement | undefined>() |
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.
nit: The possibly-undefinedness is implicit when you don't pass in a default.
const terminalEl = ref<HTMLElement | undefined>() | |
const rootEl = ref<HTMLElement | undefined>() | |
const terminalEl = ref<HTMLElement>() | |
const rootEl = ref<HTMLElement>() |
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.
Should be no change here too - can address post-migration.
ComfyUI_frontend/src/components/bottomPanel/tabs/terminal/BaseTerminal.vue
Lines 46 to 47 in 15783ed
const terminalEl = ref<HTMLElement | undefined>() | |
const rootEl = ref<HTMLElement | undefined>() |
const ComfyUIPreset = definePreset(Aura, { | ||
semantic: { | ||
// @ts-expect-error fixme ts strict error | ||
primary: Aura['primitive'].blue | ||
} | ||
}) |
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.
Should some of this also be moved to the design system package?
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.
Should be no change here, also - can address post-migration.
Lines 23 to 29 in 15783ed
const ComfyUIPreset = definePreset(Aura, { | |
semantic: { | |
// @ts-expect-error fixme ts strict error | |
primary: Aura['primitive'].blue | |
} | |
}) | |
bc2fd61
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.
The original images were not removed, and are being duplicated here for likely no reason. Comfy brand mark will probably see re-use. This can be moved to an assets package.
Originally LLM-parsed and "fixed"
The external: () => false configuration causes a PostCSS error during CSS URL processing. Removing it fixes the build without affecting dependency bundling.
## Summary Adds automated npm publishing for @comfyorg/desktop-ui package with version management and release workflows. - Ref: #5912 ## Changes - **What**: Three GitHub Actions workflows for desktop-ui npm publishing automation ### Two functions 1. Bump action - Just creates a version bump PR for `desktop-ui` 2. Publish action - Can be run manually - essentially a function with params / void return ### One automation - Watches for matching commits, then calls the Publish action with pre-filled details ## Review Focus Security hardening and workflow correctness. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-5915-Add-Desktop-UI-npm-publishing-workflows-2826d73d365081d9b7f8d7f752536ceb) by [Unito](https://www.unito.io)
## Summary Extracts desktop UI into apps/desktop-ui package with minimal changes. ## Changes - **What**: - Separates desktop-specific code into standalone package with independent Vite config, router, and i18n - Drastically simplifies the main app router by removing all desktop routes - Adds a some code duplication, most due to the existing design - Some duplication can be refactored to be *simpler* on either side - no need to split things by `isElectron()` - Rudimentary storybook support has been added - **Breaking**: Stacked PR for publishing must be merged before this PR makes it to stable core (but publishing _could_ be done manually) - #5915 - **Dependencies**: Takes full advantage of pnpm catalog. No additional dependencies added. ## Review Focus - Should be no changes to normal frontend operation - Scripts added to root package.json are acceptable - The duplication in this PR is copied as is, wherever possible. Any corrections or fix-ups beyond the scope of simply migrating the functionality as-is, can be addressed in later PRs. That said, if any changes are made, it instantly becomes more difficult to separate the duplicated code out into a shared utility. - Tracking issue to address concerns: #5925 ### i18n Fixing i18n is out of scope for this PR. It is a larger task that we should consider carefully and implement properly. Attempting to isolate the desktop i18n and duplicate the _current_ localisation scripts would be wasted energy.
## Summary Adds automated npm publishing for @comfyorg/desktop-ui package with version management and release workflows. - Ref: #5912 ## Changes - **What**: Three GitHub Actions workflows for desktop-ui npm publishing automation ### Two functions 1. Bump action - Just creates a version bump PR for `desktop-ui` 2. Publish action - Can be run manually - essentially a function with params / void return ### One automation - Watches for matching commits, then calls the Publish action with pre-filled details ## Review Focus Security hardening and workflow correctness. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-5915-Add-Desktop-UI-npm-publishing-workflows-2826d73d365081d9b7f8d7f752536ceb) by [Unito](https://www.unito.io)
Extracts desktop UI into apps/desktop-ui package with minimal changes. - **What**: - Separates desktop-specific code into standalone package with independent Vite config, router, and i18n - Drastically simplifies the main app router by removing all desktop routes - Adds a some code duplication, most due to the existing design - Some duplication can be refactored to be *simpler* on either side - no need to split things by `isElectron()` - Rudimentary storybook support has been added - **Breaking**: Stacked PR for publishing must be merged before this PR makes it to stable core (but publishing _could_ be done manually) - #5915 - **Dependencies**: Takes full advantage of pnpm catalog. No additional dependencies added. - Should be no changes to normal frontend operation - Scripts added to root package.json are acceptable - The duplication in this PR is copied as is, wherever possible. Any corrections or fix-ups beyond the scope of simply migrating the functionality as-is, can be addressed in later PRs. That said, if any changes are made, it instantly becomes more difficult to separate the duplicated code out into a shared utility. - Tracking issue to address concerns: #5925 Fixing i18n is out of scope for this PR. It is a larger task that we should consider carefully and implement properly. Attempting to isolate the desktop i18n and duplicate the _current_ localisation scripts would be wasted energy.
Summary
Extracts desktop UI into apps/desktop-ui package with minimal changes.
Changes
isElectron()
Review Focus
i18n
Fixing i18n is out of scope for this PR. It is a larger task that we should consider carefully and implement properly. Attempting to isolate the desktop i18n and duplicate the current localisation scripts would be wasted energy.